Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'v3.19-rc3' into spi-sh-msiof

Linux 3.19-rc3

+2577 -2533
+7 -3
Documentation/devicetree/bindings/input/gpio-keys.txt
··· 10 10 Each button (key) is represented as a sub-node of "gpio-keys": 11 11 Subnode properties: 12 12 13 + - gpios: OF device-tree gpio specification. 14 + - interrupts: the interrupt line for that input. 13 15 - label: Descriptive name of the key. 14 16 - linux,code: Keycode to emit. 15 17 16 - Required mutual exclusive subnode-properties: 17 - - gpios: OF device-tree gpio specification. 18 - - interrupts: the interrupt line for that input 18 + Note that either "interrupts" or "gpios" properties can be omitted, but not 19 + both at the same time. Specifying both properties is allowed. 19 20 20 21 Optional subnode-properties: 21 22 - linux,input-type: Specify event type this button/key generates. ··· 24 23 - debounce-interval: Debouncing interval time in milliseconds. 25 24 If not specified defaults to 5. 26 25 - gpio-key,wakeup: Boolean, button can wake-up the system. 26 + - linux,can-disable: Boolean, indicates that button is connected 27 + to dedicated (not shared) interrupt which can be disabled to 28 + suppress events from the button. 27 29 28 30 Example nodes: 29 31
+2
Documentation/devicetree/bindings/input/stmpe-keypad.txt
··· 8 8 - debounce-interval : Debouncing interval time in milliseconds 9 9 - st,scan-count : Scanning cycles elapsed before key data is updated 10 10 - st,no-autorepeat : If specified device will not autorepeat 11 + - keypad,num-rows : See ./matrix-keymap.txt 12 + - keypad,num-columns : See ./matrix-keymap.txt 11 13 12 14 Example: 13 15
+1 -1
Makefile
··· 1 1 VERSION = 3 2 2 PATCHLEVEL = 19 3 3 SUBLEVEL = 0 4 - EXTRAVERSION = -rc1 4 + EXTRAVERSION = -rc3 5 5 NAME = Diseased Newt 6 6 7 7 # *DOCUMENTATION*
-24
arch/arm/boot/dts/armada-370-db.dts
··· 203 203 compatible = "linux,spdif-dir"; 204 204 }; 205 205 }; 206 - 207 - &pinctrl { 208 - /* 209 - * These pins might be muxed as I2S by 210 - * the bootloader, but it conflicts 211 - * with the real I2S pins that are 212 - * muxed using i2s_pins. We must mux 213 - * those pins to a function other than 214 - * I2S. 215 - */ 216 - pinctrl-0 = <&hog_pins1 &hog_pins2>; 217 - pinctrl-names = "default"; 218 - 219 - hog_pins1: hog-pins1 { 220 - marvell,pins = "mpp6", "mpp8", "mpp10", 221 - "mpp12", "mpp13"; 222 - marvell,function = "gpio"; 223 - }; 224 - 225 - hog_pins2: hog-pins2 { 226 - marvell,pins = "mpp5", "mpp7", "mpp9"; 227 - marvell,function = "gpo"; 228 - }; 229 - };
+1
arch/arm/configs/multi_v7_defconfig
··· 338 338 CONFIG_USB_XHCI_HCD=y 339 339 CONFIG_USB_XHCI_MVEBU=y 340 340 CONFIG_USB_EHCI_HCD=y 341 + CONFIG_USB_EHCI_EXYNOS=y 341 342 CONFIG_USB_EHCI_TEGRA=y 342 343 CONFIG_USB_EHCI_HCD_STI=y 343 344 CONFIG_USB_EHCI_HCD_PLATFORM=y
+9
arch/arm/kernel/setup.c
··· 1046 1046 seq_printf(m, "model name\t: %s rev %d (%s)\n", 1047 1047 cpu_name, cpuid & 15, elf_platform); 1048 1048 1049 + #if defined(CONFIG_SMP) 1050 + seq_printf(m, "BogoMIPS\t: %lu.%02lu\n", 1051 + per_cpu(cpu_data, i).loops_per_jiffy / (500000UL/HZ), 1052 + (per_cpu(cpu_data, i).loops_per_jiffy / (5000UL/HZ)) % 100); 1053 + #else 1054 + seq_printf(m, "BogoMIPS\t: %lu.%02lu\n", 1055 + loops_per_jiffy / (500000/HZ), 1056 + (loops_per_jiffy / (5000/HZ)) % 100); 1057 + #endif 1049 1058 /* dump out the processor features */ 1050 1059 seq_puts(m, "Features\t: "); 1051 1060
+12
arch/arm/kernel/smp.c
··· 387 387 388 388 void __init smp_cpus_done(unsigned int max_cpus) 389 389 { 390 + int cpu; 391 + unsigned long bogosum = 0; 392 + 393 + for_each_online_cpu(cpu) 394 + bogosum += per_cpu(cpu_data, cpu).loops_per_jiffy; 395 + 396 + printk(KERN_INFO "SMP: Total of %d processors activated " 397 + "(%lu.%02lu BogoMIPS).\n", 398 + num_online_cpus(), 399 + bogosum / (500000/HZ), 400 + (bogosum / (5000/HZ)) % 100); 401 + 390 402 hyp_mode_check(); 391 403 } 392 404
+5 -4
arch/arm64/configs/defconfig
··· 1 1 # CONFIG_LOCALVERSION_AUTO is not set 2 2 CONFIG_SYSVIPC=y 3 3 CONFIG_POSIX_MQUEUE=y 4 + CONFIG_FHANDLE=y 4 5 CONFIG_AUDIT=y 5 6 CONFIG_NO_HZ_IDLE=y 6 7 CONFIG_HIGH_RES_TIMERS=y ··· 14 13 CONFIG_IKCONFIG=y 15 14 CONFIG_IKCONFIG_PROC=y 16 15 CONFIG_LOG_BUF_SHIFT=14 17 - CONFIG_RESOURCE_COUNTERS=y 18 16 CONFIG_MEMCG=y 19 17 CONFIG_MEMCG_SWAP=y 20 18 CONFIG_MEMCG_KMEM=y 21 19 CONFIG_CGROUP_HUGETLB=y 22 20 # CONFIG_UTS_NS is not set 23 21 # CONFIG_IPC_NS is not set 24 - # CONFIG_PID_NS is not set 25 22 # CONFIG_NET_NS is not set 26 23 CONFIG_SCHED_AUTOGROUP=y 27 24 CONFIG_BLK_DEV_INITRD=y ··· 91 92 CONFIG_SERIAL_OF_PLATFORM=y 92 93 CONFIG_VIRTIO_CONSOLE=y 93 94 # CONFIG_HW_RANDOM is not set 94 - # CONFIG_HMC_DRV is not set 95 95 CONFIG_SPI=y 96 96 CONFIG_SPI_PL022=y 97 97 CONFIG_GPIO_PL061=y ··· 131 133 CONFIG_EXT4_FS=y 132 134 CONFIG_FANOTIFY=y 133 135 CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y 136 + CONFIG_QUOTA=y 137 + CONFIG_AUTOFS4_FS=y 134 138 CONFIG_FUSE_FS=y 135 139 CONFIG_CUSE=y 136 140 CONFIG_VFAT_FS=y ··· 152 152 CONFIG_DEBUG_KERNEL=y 153 153 CONFIG_LOCKUP_DETECTOR=y 154 154 # CONFIG_SCHED_DEBUG is not set 155 + # CONFIG_DEBUG_PREEMPT is not set 155 156 # CONFIG_FTRACE is not set 157 + CONFIG_KEYS=y 156 158 CONFIG_SECURITY=y 157 159 CONFIG_CRYPTO_ANSI_CPRNG=y 158 160 CONFIG_ARM64_CRYPTO=y 159 161 CONFIG_CRYPTO_SHA1_ARM64_CE=y 160 162 CONFIG_CRYPTO_SHA2_ARM64_CE=y 161 163 CONFIG_CRYPTO_GHASH_ARM64_CE=y 162 - CONFIG_CRYPTO_AES_ARM64_CE=y 163 164 CONFIG_CRYPTO_AES_ARM64_CE_CCM=y 164 165 CONFIG_CRYPTO_AES_ARM64_CE_BLK=y 165 166 CONFIG_CRYPTO_AES_ARM64_NEON_BLK=y
+6 -5
arch/arm64/include/asm/dma-mapping.h
··· 52 52 dev->archdata.dma_ops = ops; 53 53 } 54 54 55 - static inline int set_arch_dma_coherent_ops(struct device *dev) 55 + static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, 56 + struct iommu_ops *iommu, bool coherent) 56 57 { 57 - dev->archdata.dma_coherent = true; 58 - set_dma_ops(dev, &coherent_swiotlb_dma_ops); 59 - return 0; 58 + dev->archdata.dma_coherent = coherent; 59 + if (coherent) 60 + set_dma_ops(dev, &coherent_swiotlb_dma_ops); 60 61 } 61 - #define set_arch_dma_coherent_ops set_arch_dma_coherent_ops 62 + #define arch_setup_dma_ops arch_setup_dma_ops 62 63 63 64 /* do not use this function in a driver */ 64 65 static inline bool is_device_dma_coherent(struct device *dev)
+3 -2
arch/arm64/include/asm/pgtable.h
··· 298 298 #define pfn_pmd(pfn,prot) (__pmd(((phys_addr_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot))) 299 299 #define mk_pmd(page,prot) pfn_pmd(page_to_pfn(page),prot) 300 300 301 - #define pmd_page(pmd) pfn_to_page(__phys_to_pfn(pmd_val(pmd) & PHYS_MASK)) 302 301 #define pud_write(pud) pte_write(pud_pte(pud)) 303 302 #define pud_pfn(pud) (((pud_val(pud) & PUD_MASK) & PHYS_MASK) >> PAGE_SHIFT) 304 303 ··· 400 401 return (pmd_t *)pud_page_vaddr(*pud) + pmd_index(addr); 401 402 } 402 403 403 - #define pud_page(pud) pmd_page(pud_pmd(pud)) 404 + #define pud_page(pud) pfn_to_page(__phys_to_pfn(pud_val(pud) & PHYS_MASK)) 404 405 405 406 #endif /* CONFIG_ARM64_PGTABLE_LEVELS > 2 */ 406 407 ··· 435 436 { 436 437 return (pud_t *)pgd_page_vaddr(*pgd) + pud_index(addr); 437 438 } 439 + 440 + #define pgd_page(pgd) pfn_to_page(__phys_to_pfn(pgd_val(pgd) & PHYS_MASK)) 438 441 439 442 #endif /* CONFIG_ARM64_PGTABLE_LEVELS > 3 */ 440 443
+13 -1
arch/arm64/kernel/suspend.c
··· 5 5 #include <asm/debug-monitors.h> 6 6 #include <asm/pgtable.h> 7 7 #include <asm/memory.h> 8 + #include <asm/mmu_context.h> 8 9 #include <asm/smp_plat.h> 9 10 #include <asm/suspend.h> 10 11 #include <asm/tlbflush.h> ··· 99 98 */ 100 99 ret = __cpu_suspend_enter(arg, fn); 101 100 if (ret == 0) { 102 - cpu_switch_mm(mm->pgd, mm); 101 + /* 102 + * We are resuming from reset with TTBR0_EL1 set to the 103 + * idmap to enable the MMU; restore the active_mm mappings in 104 + * TTBR0_EL1 unless the active_mm == &init_mm, in which case 105 + * the thread entered __cpu_suspend with TTBR0_EL1 set to 106 + * reserved TTBR0 page tables and should be restored as such. 107 + */ 108 + if (mm == &init_mm) 109 + cpu_set_reserved_ttbr0(); 110 + else 111 + cpu_switch_mm(mm->pgd, mm); 112 + 103 113 flush_tlb_all(); 104 114 105 115 /*
+1 -1
arch/ia64/include/asm/unistd.h
··· 11 11 12 12 13 13 14 - #define NR_syscalls 318 /* length of syscall table */ 14 + #define NR_syscalls 319 /* length of syscall table */ 15 15 16 16 /* 17 17 * The following defines stop scripts/checksyscalls.sh from complaining about
+1
arch/ia64/include/uapi/asm/unistd.h
··· 331 331 #define __NR_getrandom 1339 332 332 #define __NR_memfd_create 1340 333 333 #define __NR_bpf 1341 334 + #define __NR_execveat 1342 334 335 335 336 #endif /* _UAPI_ASM_IA64_UNISTD_H */
+1
arch/ia64/kernel/entry.S
··· 1779 1779 data8 sys_getrandom 1780 1780 data8 sys_memfd_create // 1340 1781 1781 data8 sys_bpf 1782 + data8 sys_execveat 1782 1783 1783 1784 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls 1784 1785 #endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */
+1
arch/nios2/kernel/cpuinfo.c
··· 72 72 cpuinfo.has_div = fcpu_has(cpu, "altr,has-div"); 73 73 cpuinfo.has_mul = fcpu_has(cpu, "altr,has-mul"); 74 74 cpuinfo.has_mulx = fcpu_has(cpu, "altr,has-mulx"); 75 + cpuinfo.mmu = fcpu_has(cpu, "altr,has-mmu"); 75 76 76 77 if (IS_ENABLED(CONFIG_NIOS2_HW_DIV_SUPPORT) && !cpuinfo.has_div) 77 78 err_cpu("DIV");
+2 -18
arch/nios2/kernel/entry.S
··· 365 365 GET_THREAD_INFO r1 366 366 ldw r4, TI_PREEMPT_COUNT(r1) 367 367 bne r4, r0, restore_all 368 - 369 - need_resched: 370 368 ldw r4, TI_FLAGS(r1) /* ? Need resched set */ 371 369 BTBZ r10, r4, TIF_NEED_RESCHED, restore_all 372 370 ldw r4, PT_ESTATUS(sp) /* ? Interrupts off */ 373 371 andi r10, r4, ESTATUS_EPIE 374 372 beq r10, r0, restore_all 375 - movia r4, PREEMPT_ACTIVE 376 - stw r4, TI_PREEMPT_COUNT(r1) 377 - rdctl r10, status /* enable intrs again */ 378 - ori r10, r10 ,STATUS_PIE 379 - wrctl status, r10 380 - PUSH r1 381 - call schedule 382 - POP r1 383 - mov r4, r0 384 - stw r4, TI_PREEMPT_COUNT(r1) 385 - rdctl r10, status /* disable intrs */ 386 - andi r10, r10, %lo(~STATUS_PIE) 387 - wrctl status, r10 388 - br need_resched 389 - #else 390 - br restore_all 373 + call preempt_schedule_irq 391 374 #endif 375 + br restore_all 392 376 393 377 /*********************************************************************** 394 378 * A few syscall wrappers
+10 -3
arch/parisc/include/asm/ldcw.h
··· 33 33 34 34 #endif /*!CONFIG_PA20*/ 35 35 36 - /* LDCW, the only atomic read-write operation PA-RISC has. *sigh*. */ 36 + /* LDCW, the only atomic read-write operation PA-RISC has. *sigh*. 37 + We don't explicitly expose that "*a" may be written as reload 38 + fails to find a register in class R1_REGS when "a" needs to be 39 + reloaded when generating 64-bit PIC code. Instead, we clobber 40 + memory to indicate to the compiler that the assembly code reads 41 + or writes to items other than those listed in the input and output 42 + operands. This may pessimize the code somewhat but __ldcw is 43 + usually used within code blocks surrounded by memory barriors. */ 37 44 #define __ldcw(a) ({ \ 38 45 unsigned __ret; \ 39 - __asm__ __volatile__(__LDCW " 0(%2),%0" \ 40 - : "=r" (__ret), "+m" (*(a)) : "r" (a)); \ 46 + __asm__ __volatile__(__LDCW " 0(%1),%0" \ 47 + : "=r" (__ret) : "r" (a) : "memory"); \ 41 48 __ret; \ 42 49 }) 43 50
+10
arch/powerpc/include/asm/kexec.h
··· 86 86 extern void reserve_crashkernel(void); 87 87 extern void machine_kexec_mask_interrupts(void); 88 88 89 + static inline bool kdump_in_progress(void) 90 + { 91 + return crashing_cpu >= 0; 92 + } 93 + 89 94 #else /* !CONFIG_KEXEC */ 90 95 static inline void crash_kexec_secondary(struct pt_regs *regs) { } 91 96 ··· 109 104 static inline int crash_shutdown_unregister(crash_shutdown_t handler) 110 105 { 111 106 return 0; 107 + } 108 + 109 + static inline bool kdump_in_progress(void) 110 + { 111 + return false; 112 112 } 113 113 114 114 #endif /* CONFIG_KEXEC */
+1
arch/powerpc/include/asm/systbl.h
··· 366 366 SYSCALL_SPU(getrandom) 367 367 SYSCALL_SPU(memfd_create) 368 368 SYSCALL_SPU(bpf) 369 + COMPAT_SYS(execveat)
+1 -1
arch/powerpc/include/asm/unistd.h
··· 12 12 #include <uapi/asm/unistd.h> 13 13 14 14 15 - #define __NR_syscalls 362 15 + #define __NR_syscalls 363 16 16 17 17 #define __NR__exit __NR_exit 18 18 #define NR_syscalls __NR_syscalls
+1
arch/powerpc/include/uapi/asm/unistd.h
··· 384 384 #define __NR_getrandom 359 385 385 #define __NR_memfd_create 360 386 386 #define __NR_bpf 361 387 + #define __NR_execveat 362 387 388 388 389 #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */
+1 -1
arch/powerpc/kernel/machine_kexec_64.c
··· 330 330 * using debugger IPI. 331 331 */ 332 332 333 - if (crashing_cpu == -1) 333 + if (!kdump_in_progress()) 334 334 kexec_prepare_cpus(); 335 335 336 336 pr_debug("kexec: Starting switchover sequence.\n");
+1 -8
arch/powerpc/kernel/smp.c
··· 700 700 smp_store_cpu_info(cpu); 701 701 set_dec(tb_ticks_per_jiffy); 702 702 preempt_disable(); 703 + cpu_callin_map[cpu] = 1; 703 704 704 705 if (smp_ops->setup_cpu) 705 706 smp_ops->setup_cpu(cpu); ··· 738 737 smp_wmb(); 739 738 notify_cpu_starting(cpu); 740 739 set_cpu_online(cpu, true); 741 - 742 - /* 743 - * CPU must be marked active and online before we signal back to the 744 - * master, because the scheduler needs to see the cpu_online and 745 - * cpu_active bits set. 746 - */ 747 - smp_wmb(); 748 - cpu_callin_map[cpu] = 1; 749 740 750 741 local_irq_enable(); 751 742
+7 -1
arch/powerpc/platforms/pseries/lpar.c
··· 43 43 #include <asm/trace.h> 44 44 #include <asm/firmware.h> 45 45 #include <asm/plpar_wrappers.h> 46 + #include <asm/kexec.h> 46 47 #include <asm/fadump.h> 47 48 48 49 #include "pseries.h" ··· 268 267 * out to the user, but at least this will stop us from 269 268 * continuing on further and creating an even more 270 269 * difficult to debug situation. 270 + * 271 + * There is a known problem when kdump'ing, if cpus are offline 272 + * the above call will fail. Rather than panicking again, keep 273 + * going and hope the kdump kernel is also little endian, which 274 + * it usually is. 271 275 */ 272 - if (rc) 276 + if (rc && !kdump_in_progress()) 273 277 panic("Could not enable big endian exceptions"); 274 278 } 275 279 #endif
+1
arch/um/Kconfig.common
··· 3 3 default y 4 4 select HAVE_ARCH_AUDITSYSCALL 5 5 select HAVE_UID16 6 + select HAVE_FUTEX_CMPXCHG if FUTEX 6 7 select GENERIC_IRQ_SHOW 7 8 select GENERIC_CPU_DEVICES 8 9 select GENERIC_IO
+1 -1
arch/x86/kvm/mmu.c
··· 4448 4448 * zap all shadow pages. 4449 4449 */ 4450 4450 if (unlikely(kvm_current_mmio_generation(kvm) == 0)) { 4451 - printk_ratelimited(KERN_INFO "kvm: zapping shadow pages for mmio generation wraparound\n"); 4451 + printk_ratelimited(KERN_DEBUG "kvm: zapping shadow pages for mmio generation wraparound\n"); 4452 4452 kvm_mmu_invalidate_zap_all_pages(kvm); 4453 4453 } 4454 4454 }
+44 -44
arch/x86/kvm/vmx.c
··· 5840 5840 memset(vmx_msr_bitmap_legacy, 0xff, PAGE_SIZE); 5841 5841 memset(vmx_msr_bitmap_longmode, 0xff, PAGE_SIZE); 5842 5842 5843 - vmx_disable_intercept_for_msr(MSR_FS_BASE, false); 5844 - vmx_disable_intercept_for_msr(MSR_GS_BASE, false); 5845 - vmx_disable_intercept_for_msr(MSR_KERNEL_GS_BASE, true); 5846 - vmx_disable_intercept_for_msr(MSR_IA32_SYSENTER_CS, false); 5847 - vmx_disable_intercept_for_msr(MSR_IA32_SYSENTER_ESP, false); 5848 - vmx_disable_intercept_for_msr(MSR_IA32_SYSENTER_EIP, false); 5849 - vmx_disable_intercept_for_msr(MSR_IA32_BNDCFGS, true); 5850 - 5851 - memcpy(vmx_msr_bitmap_legacy_x2apic, 5852 - vmx_msr_bitmap_legacy, PAGE_SIZE); 5853 - memcpy(vmx_msr_bitmap_longmode_x2apic, 5854 - vmx_msr_bitmap_longmode, PAGE_SIZE); 5855 - 5856 - if (enable_apicv) { 5857 - for (msr = 0x800; msr <= 0x8ff; msr++) 5858 - vmx_disable_intercept_msr_read_x2apic(msr); 5859 - 5860 - /* According SDM, in x2apic mode, the whole id reg is used. 5861 - * But in KVM, it only use the highest eight bits. Need to 5862 - * intercept it */ 5863 - vmx_enable_intercept_msr_read_x2apic(0x802); 5864 - /* TMCCT */ 5865 - vmx_enable_intercept_msr_read_x2apic(0x839); 5866 - /* TPR */ 5867 - vmx_disable_intercept_msr_write_x2apic(0x808); 5868 - /* EOI */ 5869 - vmx_disable_intercept_msr_write_x2apic(0x80b); 5870 - /* SELF-IPI */ 5871 - vmx_disable_intercept_msr_write_x2apic(0x83f); 5872 - } 5873 - 5874 - if (enable_ept) { 5875 - kvm_mmu_set_mask_ptes(0ull, 5876 - (enable_ept_ad_bits) ? VMX_EPT_ACCESS_BIT : 0ull, 5877 - (enable_ept_ad_bits) ? VMX_EPT_DIRTY_BIT : 0ull, 5878 - 0ull, VMX_EPT_EXECUTABLE_MASK); 5879 - ept_set_mmio_spte_mask(); 5880 - kvm_enable_tdp(); 5881 - } else 5882 - kvm_disable_tdp(); 5883 - 5884 - update_ple_window_actual_max(); 5885 - 5886 5843 if (setup_vmcs_config(&vmcs_config) < 0) { 5887 5844 r = -EIO; 5888 5845 goto out7; 5889 - } 5846 + } 5890 5847 5891 5848 if (boot_cpu_has(X86_FEATURE_NX)) 5892 5849 kvm_enable_efer_bits(EFER_NX); ··· 5901 5944 5902 5945 if (nested) 5903 5946 nested_vmx_setup_ctls_msrs(); 5947 + 5948 + vmx_disable_intercept_for_msr(MSR_FS_BASE, false); 5949 + vmx_disable_intercept_for_msr(MSR_GS_BASE, false); 5950 + vmx_disable_intercept_for_msr(MSR_KERNEL_GS_BASE, true); 5951 + vmx_disable_intercept_for_msr(MSR_IA32_SYSENTER_CS, false); 5952 + vmx_disable_intercept_for_msr(MSR_IA32_SYSENTER_ESP, false); 5953 + vmx_disable_intercept_for_msr(MSR_IA32_SYSENTER_EIP, false); 5954 + vmx_disable_intercept_for_msr(MSR_IA32_BNDCFGS, true); 5955 + 5956 + memcpy(vmx_msr_bitmap_legacy_x2apic, 5957 + vmx_msr_bitmap_legacy, PAGE_SIZE); 5958 + memcpy(vmx_msr_bitmap_longmode_x2apic, 5959 + vmx_msr_bitmap_longmode, PAGE_SIZE); 5960 + 5961 + if (enable_apicv) { 5962 + for (msr = 0x800; msr <= 0x8ff; msr++) 5963 + vmx_disable_intercept_msr_read_x2apic(msr); 5964 + 5965 + /* According SDM, in x2apic mode, the whole id reg is used. 5966 + * But in KVM, it only use the highest eight bits. Need to 5967 + * intercept it */ 5968 + vmx_enable_intercept_msr_read_x2apic(0x802); 5969 + /* TMCCT */ 5970 + vmx_enable_intercept_msr_read_x2apic(0x839); 5971 + /* TPR */ 5972 + vmx_disable_intercept_msr_write_x2apic(0x808); 5973 + /* EOI */ 5974 + vmx_disable_intercept_msr_write_x2apic(0x80b); 5975 + /* SELF-IPI */ 5976 + vmx_disable_intercept_msr_write_x2apic(0x83f); 5977 + } 5978 + 5979 + if (enable_ept) { 5980 + kvm_mmu_set_mask_ptes(0ull, 5981 + (enable_ept_ad_bits) ? VMX_EPT_ACCESS_BIT : 0ull, 5982 + (enable_ept_ad_bits) ? VMX_EPT_DIRTY_BIT : 0ull, 5983 + 0ull, VMX_EPT_EXECUTABLE_MASK); 5984 + ept_set_mmio_spte_mask(); 5985 + kvm_enable_tdp(); 5986 + } else 5987 + kvm_disable_tdp(); 5988 + 5989 + update_ple_window_actual_max(); 5904 5990 5905 5991 return alloc_kvm_area(); 5906 5992
+1 -1
arch/x86/um/sys_call_table_32.c
··· 34 34 35 35 extern asmlinkage void sys_ni_syscall(void); 36 36 37 - const sys_call_ptr_t sys_call_table[] __cacheline_aligned = { 37 + const sys_call_ptr_t sys_call_table[] ____cacheline_aligned = { 38 38 /* 39 39 * Smells like a compiler bug -- it doesn't work 40 40 * when the & below is removed.
+1 -1
arch/x86/um/sys_call_table_64.c
··· 47 47 48 48 extern void sys_ni_syscall(void); 49 49 50 - const sys_call_ptr_t sys_call_table[] __cacheline_aligned = { 50 + const sys_call_ptr_t sys_call_table[] ____cacheline_aligned = { 51 51 /* 52 52 * Smells like a compiler bug -- it doesn't work 53 53 * when the & below is removed.
+3
crypto/af_alg.c
··· 455 455 { 456 456 struct af_alg_completion *completion = req->data; 457 457 458 + if (err == -EINPROGRESS) 459 + return; 460 + 458 461 completion->err = err; 459 462 complete(&completion->completion); 460 463 }
-2
drivers/acpi/processor_idle.c
··· 985 985 state->flags = 0; 986 986 switch (cx->type) { 987 987 case ACPI_STATE_C1: 988 - if (cx->entry_method != ACPI_CSTATE_FFH) 989 - state->flags |= CPUIDLE_FLAG_TIME_INVALID; 990 988 991 989 state->enter = acpi_idle_enter_c1; 992 990 state->enter_dead = acpi_idle_play_dead;
+17
drivers/acpi/video.c
··· 505 505 DMI_MATCH(DMI_PRODUCT_NAME, "HP ENVY 15 Notebook PC"), 506 506 }, 507 507 }, 508 + 509 + { 510 + .callback = video_disable_native_backlight, 511 + .ident = "SAMSUNG 870Z5E/880Z5E/680Z5E", 512 + .matches = { 513 + DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), 514 + DMI_MATCH(DMI_PRODUCT_NAME, "870Z5E/880Z5E/680Z5E"), 515 + }, 516 + }, 517 + { 518 + .callback = video_disable_native_backlight, 519 + .ident = "SAMSUNG 370R4E/370R4V/370R5E/3570RE/370R5V", 520 + .matches = { 521 + DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), 522 + DMI_MATCH(DMI_PRODUCT_NAME, "370R4E/370R4V/370R5E/3570RE/370R5V"), 523 + }, 524 + }, 508 525 {} 509 526 }; 510 527
+2 -1
drivers/base/power/domain.c
··· 2088 2088 * Returns a valid pointer to struct generic_pm_domain on success or ERR_PTR() 2089 2089 * on failure. 2090 2090 */ 2091 - static struct generic_pm_domain *of_genpd_get_from_provider( 2091 + struct generic_pm_domain *of_genpd_get_from_provider( 2092 2092 struct of_phandle_args *genpdspec) 2093 2093 { 2094 2094 struct generic_pm_domain *genpd = ERR_PTR(-ENOENT); ··· 2108 2108 2109 2109 return genpd; 2110 2110 } 2111 + EXPORT_SYMBOL_GPL(of_genpd_get_from_provider); 2111 2112 2112 2113 /** 2113 2114 * genpd_dev_pm_detach - Detach a device from its PM domain.
+31 -8
drivers/base/power/opp.c
··· 108 108 /* Lock to allow exclusive modification to the device and opp lists */ 109 109 static DEFINE_MUTEX(dev_opp_list_lock); 110 110 111 + #define opp_rcu_lockdep_assert() \ 112 + do { \ 113 + rcu_lockdep_assert(rcu_read_lock_held() || \ 114 + lockdep_is_held(&dev_opp_list_lock), \ 115 + "Missing rcu_read_lock() or " \ 116 + "dev_opp_list_lock protection"); \ 117 + } while (0) 118 + 111 119 /** 112 120 * find_device_opp() - find device_opp struct using device pointer 113 121 * @dev: device pointer used to lookup device OPPs ··· 216 208 * This function returns the number of available opps if there are any, 217 209 * else returns 0 if none or the corresponding error value. 218 210 * 219 - * Locking: This function must be called under rcu_read_lock(). This function 220 - * internally references two RCU protected structures: device_opp and opp which 221 - * are safe as long as we are under a common RCU locked section. 211 + * Locking: This function takes rcu_read_lock(). 222 212 */ 223 213 int dev_pm_opp_get_opp_count(struct device *dev) 224 214 { ··· 224 218 struct dev_pm_opp *temp_opp; 225 219 int count = 0; 226 220 221 + rcu_read_lock(); 222 + 227 223 dev_opp = find_device_opp(dev); 228 224 if (IS_ERR(dev_opp)) { 229 - int r = PTR_ERR(dev_opp); 230 - dev_err(dev, "%s: device OPP not found (%d)\n", __func__, r); 231 - return r; 225 + count = PTR_ERR(dev_opp); 226 + dev_err(dev, "%s: device OPP not found (%d)\n", 227 + __func__, count); 228 + goto out_unlock; 232 229 } 233 230 234 231 list_for_each_entry_rcu(temp_opp, &dev_opp->opp_list, node) { ··· 239 230 count++; 240 231 } 241 232 233 + out_unlock: 234 + rcu_read_unlock(); 242 235 return count; 243 236 } 244 237 EXPORT_SYMBOL_GPL(dev_pm_opp_get_opp_count); ··· 277 266 { 278 267 struct device_opp *dev_opp; 279 268 struct dev_pm_opp *temp_opp, *opp = ERR_PTR(-ERANGE); 269 + 270 + opp_rcu_lockdep_assert(); 280 271 281 272 dev_opp = find_device_opp(dev); 282 273 if (IS_ERR(dev_opp)) { ··· 325 312 { 326 313 struct device_opp *dev_opp; 327 314 struct dev_pm_opp *temp_opp, *opp = ERR_PTR(-ERANGE); 315 + 316 + opp_rcu_lockdep_assert(); 328 317 329 318 if (!dev || !freq) { 330 319 dev_err(dev, "%s: Invalid argument freq=%p\n", __func__, freq); ··· 375 360 { 376 361 struct device_opp *dev_opp; 377 362 struct dev_pm_opp *temp_opp, *opp = ERR_PTR(-ERANGE); 363 + 364 + opp_rcu_lockdep_assert(); 378 365 379 366 if (!dev || !freq) { 380 367 dev_err(dev, "%s: Invalid argument freq=%p\n", __func__, freq); ··· 800 783 801 784 /* Check for existing list for 'dev' */ 802 785 dev_opp = find_device_opp(dev); 803 - if (WARN(IS_ERR(dev_opp), "%s: dev_opp: %ld\n", dev_name(dev), 804 - PTR_ERR(dev_opp))) 786 + if (IS_ERR(dev_opp)) { 787 + int error = PTR_ERR(dev_opp); 788 + if (error != -ENODEV) 789 + WARN(1, "%s: dev_opp: %d\n", 790 + IS_ERR_OR_NULL(dev) ? 791 + "Invalid device" : dev_name(dev), 792 + error); 805 793 return; 794 + } 806 795 807 796 /* Hold our list modification lock here */ 808 797 mutex_lock(&dev_opp_list_lock);
+1 -1
drivers/char/agp/ali-agp.c
··· 417 417 module_init(agp_ali_init); 418 418 module_exit(agp_ali_cleanup); 419 419 420 - MODULE_AUTHOR("Dave Jones <davej@redhat.com>"); 420 + MODULE_AUTHOR("Dave Jones"); 421 421 MODULE_LICENSE("GPL and additional rights"); 422 422
+1 -1
drivers/char/agp/amd64-agp.c
··· 813 813 module_init(agp_amd64_mod_init); 814 814 module_exit(agp_amd64_cleanup); 815 815 816 - MODULE_AUTHOR("Dave Jones <davej@redhat.com>, Andi Kleen"); 816 + MODULE_AUTHOR("Dave Jones, Andi Kleen"); 817 817 module_param(agp_try_unsupported, bool, 0); 818 818 MODULE_LICENSE("GPL");
+1 -1
drivers/char/agp/ati-agp.c
··· 579 579 module_init(agp_ati_init); 580 580 module_exit(agp_ati_cleanup); 581 581 582 - MODULE_AUTHOR("Dave Jones <davej@redhat.com>"); 582 + MODULE_AUTHOR("Dave Jones"); 583 583 MODULE_LICENSE("GPL and additional rights"); 584 584
+1 -1
drivers/char/agp/backend.c
··· 356 356 __setup("agp=", agp_setup); 357 357 #endif 358 358 359 - MODULE_AUTHOR("Dave Jones <davej@redhat.com>"); 359 + MODULE_AUTHOR("Dave Jones, Jeff Hartmann"); 360 360 MODULE_DESCRIPTION("AGP GART driver"); 361 361 MODULE_LICENSE("GPL and additional rights"); 362 362 MODULE_ALIAS_MISCDEV(AGPGART_MINOR);
+1 -1
drivers/char/agp/intel-agp.c
··· 920 920 module_init(agp_intel_init); 921 921 module_exit(agp_intel_cleanup); 922 922 923 - MODULE_AUTHOR("Dave Jones <davej@redhat.com>"); 923 + MODULE_AUTHOR("Dave Jones, Various @Intel"); 924 924 MODULE_LICENSE("GPL and additional rights");
+1 -1
drivers/char/agp/intel-gtt.c
··· 1438 1438 } 1439 1439 EXPORT_SYMBOL(intel_gmch_remove); 1440 1440 1441 - MODULE_AUTHOR("Dave Jones <davej@redhat.com>"); 1441 + MODULE_AUTHOR("Dave Jones, Various @Intel"); 1442 1442 MODULE_LICENSE("GPL and additional rights");
+1 -1
drivers/char/agp/nvidia-agp.c
··· 1 1 /* 2 2 * Nvidia AGPGART routines. 3 3 * Based upon a 2.4 agpgart diff by the folks from NVIDIA, and hacked up 4 - * to work in 2.5 by Dave Jones <davej@redhat.com> 4 + * to work in 2.5 by Dave Jones. 5 5 */ 6 6 7 7 #include <linux/module.h>
+1 -1
drivers/char/agp/via-agp.c
··· 595 595 module_exit(agp_via_cleanup); 596 596 597 597 MODULE_LICENSE("GPL"); 598 - MODULE_AUTHOR("Dave Jones <davej@redhat.com>"); 598 + MODULE_AUTHOR("Dave Jones");
+17 -29
drivers/char/ipmi/ipmi_msghandler.c
··· 199 199 int guid_set; 200 200 char name[16]; 201 201 struct kref usecount; 202 - 203 - /* bmc device attributes */ 204 - struct device_attribute device_id_attr; 205 - struct device_attribute provides_dev_sdrs_attr; 206 - struct device_attribute revision_attr; 207 - struct device_attribute firmware_rev_attr; 208 - struct device_attribute version_attr; 209 - struct device_attribute add_dev_support_attr; 210 - struct device_attribute manufacturer_id_attr; 211 - struct device_attribute product_id_attr; 212 - struct device_attribute guid_attr; 213 - struct device_attribute aux_firmware_rev_attr; 214 202 }; 215 203 #define to_bmc_device(x) container_of((x), struct bmc_device, pdev.dev) 216 204 ··· 2240 2252 2241 2253 return snprintf(buf, 10, "%u\n", bmc->id.device_id); 2242 2254 } 2243 - DEVICE_ATTR(device_id, S_IRUGO, device_id_show, NULL); 2255 + static DEVICE_ATTR(device_id, S_IRUGO, device_id_show, NULL); 2244 2256 2245 2257 static ssize_t provides_device_sdrs_show(struct device *dev, 2246 2258 struct device_attribute *attr, ··· 2251 2263 return snprintf(buf, 10, "%u\n", 2252 2264 (bmc->id.device_revision & 0x80) >> 7); 2253 2265 } 2254 - DEVICE_ATTR(provides_device_sdrs, S_IRUGO, provides_device_sdrs_show, NULL); 2266 + static DEVICE_ATTR(provides_device_sdrs, S_IRUGO, provides_device_sdrs_show, 2267 + NULL); 2255 2268 2256 2269 static ssize_t revision_show(struct device *dev, struct device_attribute *attr, 2257 2270 char *buf) ··· 2262 2273 return snprintf(buf, 20, "%u\n", 2263 2274 bmc->id.device_revision & 0x0F); 2264 2275 } 2265 - DEVICE_ATTR(revision, S_IRUGO, revision_show, NULL); 2276 + static DEVICE_ATTR(revision, S_IRUGO, revision_show, NULL); 2266 2277 2267 2278 static ssize_t firmware_revision_show(struct device *dev, 2268 2279 struct device_attribute *attr, ··· 2273 2284 return snprintf(buf, 20, "%u.%x\n", bmc->id.firmware_revision_1, 2274 2285 bmc->id.firmware_revision_2); 2275 2286 } 2276 - DEVICE_ATTR(firmware_revision, S_IRUGO, firmware_revision_show, NULL); 2287 + static DEVICE_ATTR(firmware_revision, S_IRUGO, firmware_revision_show, NULL); 2277 2288 2278 2289 static ssize_t ipmi_version_show(struct device *dev, 2279 2290 struct device_attribute *attr, ··· 2285 2296 ipmi_version_major(&bmc->id), 2286 2297 ipmi_version_minor(&bmc->id)); 2287 2298 } 2288 - DEVICE_ATTR(ipmi_version, S_IRUGO, ipmi_version_show, NULL); 2299 + static DEVICE_ATTR(ipmi_version, S_IRUGO, ipmi_version_show, NULL); 2289 2300 2290 2301 static ssize_t add_dev_support_show(struct device *dev, 2291 2302 struct device_attribute *attr, ··· 2296 2307 return snprintf(buf, 10, "0x%02x\n", 2297 2308 bmc->id.additional_device_support); 2298 2309 } 2299 - DEVICE_ATTR(additional_device_support, S_IRUGO, add_dev_support_show, NULL); 2310 + static DEVICE_ATTR(additional_device_support, S_IRUGO, add_dev_support_show, 2311 + NULL); 2300 2312 2301 2313 static ssize_t manufacturer_id_show(struct device *dev, 2302 2314 struct device_attribute *attr, ··· 2307 2317 2308 2318 return snprintf(buf, 20, "0x%6.6x\n", bmc->id.manufacturer_id); 2309 2319 } 2310 - DEVICE_ATTR(manufacturer_id, S_IRUGO, manufacturer_id_show, NULL); 2320 + static DEVICE_ATTR(manufacturer_id, S_IRUGO, manufacturer_id_show, NULL); 2311 2321 2312 2322 static ssize_t product_id_show(struct device *dev, 2313 2323 struct device_attribute *attr, ··· 2317 2327 2318 2328 return snprintf(buf, 10, "0x%4.4x\n", bmc->id.product_id); 2319 2329 } 2320 - DEVICE_ATTR(product_id, S_IRUGO, product_id_show, NULL); 2330 + static DEVICE_ATTR(product_id, S_IRUGO, product_id_show, NULL); 2321 2331 2322 2332 static ssize_t aux_firmware_rev_show(struct device *dev, 2323 2333 struct device_attribute *attr, ··· 2331 2341 bmc->id.aux_firmware_revision[1], 2332 2342 bmc->id.aux_firmware_revision[0]); 2333 2343 } 2334 - DEVICE_ATTR(aux_firmware_revision, S_IRUGO, aux_firmware_rev_show, NULL); 2344 + static DEVICE_ATTR(aux_firmware_revision, S_IRUGO, aux_firmware_rev_show, NULL); 2335 2345 2336 2346 static ssize_t guid_show(struct device *dev, struct device_attribute *attr, 2337 2347 char *buf) ··· 2342 2352 (long long) bmc->guid[0], 2343 2353 (long long) bmc->guid[8]); 2344 2354 } 2345 - DEVICE_ATTR(guid, S_IRUGO, guid_show, NULL); 2355 + static DEVICE_ATTR(guid, S_IRUGO, guid_show, NULL); 2346 2356 2347 2357 static struct attribute *bmc_dev_attrs[] = { 2348 2358 &dev_attr_device_id.attr, ··· 2382 2392 2383 2393 if (bmc->id.aux_firmware_revision_set) 2384 2394 device_remove_file(&bmc->pdev.dev, 2385 - &bmc->aux_firmware_rev_attr); 2395 + &dev_attr_aux_firmware_revision); 2386 2396 if (bmc->guid_set) 2387 2397 device_remove_file(&bmc->pdev.dev, 2388 - &bmc->guid_attr); 2398 + &dev_attr_guid); 2389 2399 2390 2400 platform_device_unregister(&bmc->pdev); 2391 2401 } ··· 2412 2422 int err; 2413 2423 2414 2424 if (bmc->id.aux_firmware_revision_set) { 2415 - bmc->aux_firmware_rev_attr.attr.name = "aux_firmware_revision"; 2416 2425 err = device_create_file(&bmc->pdev.dev, 2417 - &bmc->aux_firmware_rev_attr); 2426 + &dev_attr_aux_firmware_revision); 2418 2427 if (err) 2419 2428 goto out; 2420 2429 } 2421 2430 if (bmc->guid_set) { 2422 - bmc->guid_attr.attr.name = "guid"; 2423 2431 err = device_create_file(&bmc->pdev.dev, 2424 - &bmc->guid_attr); 2432 + &dev_attr_guid); 2425 2433 if (err) 2426 2434 goto out_aux_firm; 2427 2435 } ··· 2429 2441 out_aux_firm: 2430 2442 if (bmc->id.aux_firmware_revision_set) 2431 2443 device_remove_file(&bmc->pdev.dev, 2432 - &bmc->aux_firmware_rev_attr); 2444 + &dev_attr_aux_firmware_revision); 2433 2445 out: 2434 2446 return err; 2435 2447 }
+1
drivers/char/ipmi/ipmi_ssif.c
··· 52 52 #include <linux/dmi.h> 53 53 #include <linux/kthread.h> 54 54 #include <linux/acpi.h> 55 + #include <linux/ctype.h> 55 56 56 57 #define PFX "ipmi_ssif: " 57 58 #define DEVICE_NAME "ipmi_ssif"
+1 -1
drivers/clocksource/arm_arch_timer.c
··· 462 462 463 463 /* Register the CP15 based counter if we have one */ 464 464 if (type & ARCH_CP15_TIMER) { 465 - if (arch_timer_use_virtual) 465 + if (IS_ENABLED(CONFIG_ARM64) || arch_timer_use_virtual) 466 466 arch_timer_read_counter = arch_counter_get_cntvct; 467 467 else 468 468 arch_timer_read_counter = arch_counter_get_cntpct;
+11
drivers/cpufreq/cpufreq-dt.c
··· 211 211 /* OPPs might be populated at runtime, don't check for error here */ 212 212 of_init_opp_table(cpu_dev); 213 213 214 + /* 215 + * But we need OPP table to function so if it is not there let's 216 + * give platform code chance to provide it for us. 217 + */ 218 + ret = dev_pm_opp_get_opp_count(cpu_dev); 219 + if (ret <= 0) { 220 + pr_debug("OPP table is not ready, deferring probe\n"); 221 + ret = -EPROBE_DEFER; 222 + goto out_free_opp; 223 + } 224 + 214 225 priv = kzalloc(sizeof(*priv), GFP_KERNEL); 215 226 if (!priv) { 216 227 ret = -ENOMEM;
+6
drivers/cpufreq/cpufreq.c
··· 2028 2028 /* Don't start any governor operations if we are entering suspend */ 2029 2029 if (cpufreq_suspended) 2030 2030 return 0; 2031 + /* 2032 + * Governor might not be initiated here if ACPI _PPC changed 2033 + * notification happened, so check it. 2034 + */ 2035 + if (!policy->governor) 2036 + return -EINVAL; 2031 2037 2032 2038 if (policy->governor->max_transition_latency && 2033 2039 policy->cpuinfo.transition_latency >
+1 -6
drivers/cpuidle/governors/ladder.c
··· 79 79 80 80 last_state = &ldev->states[last_idx]; 81 81 82 - if (!(drv->states[last_idx].flags & CPUIDLE_FLAG_TIME_INVALID)) { 83 - last_residency = cpuidle_get_last_residency(dev) - \ 84 - drv->states[last_idx].exit_latency; 85 - } 86 - else 87 - last_residency = last_state->threshold.promotion_time + 1; 82 + last_residency = cpuidle_get_last_residency(dev) - drv->states[last_idx].exit_latency; 88 83 89 84 /* consider promotion */ 90 85 if (last_idx < drv->state_count - 1 &&
+12 -17
drivers/cpuidle/governors/menu.c
··· 396 396 * power state and occurrence of the wakeup event. 397 397 * 398 398 * If the entered idle state didn't support residency measurements, 399 - * we are basically lost in the dark how much time passed. 400 - * As a compromise, assume we slept for the whole expected time. 399 + * we use them anyway if they are short, and if long, 400 + * truncate to the whole expected time. 401 401 * 402 402 * Any measured amount of time will include the exit latency. 403 403 * Since we are interested in when the wakeup begun, not when it ··· 405 405 * the measured amount of time is less than the exit latency, 406 406 * assume the state was never reached and the exit latency is 0. 407 407 */ 408 - if (unlikely(target->flags & CPUIDLE_FLAG_TIME_INVALID)) { 409 - /* Use timer value as is */ 408 + 409 + /* measured value */ 410 + measured_us = cpuidle_get_last_residency(dev); 411 + 412 + /* Deduct exit latency */ 413 + if (measured_us > target->exit_latency) 414 + measured_us -= target->exit_latency; 415 + 416 + /* Make sure our coefficients do not exceed unity */ 417 + if (measured_us > data->next_timer_us) 410 418 measured_us = data->next_timer_us; 411 - 412 - } else { 413 - /* Use measured value */ 414 - measured_us = cpuidle_get_last_residency(dev); 415 - 416 - /* Deduct exit latency */ 417 - if (measured_us > target->exit_latency) 418 - measured_us -= target->exit_latency; 419 - 420 - /* Make sure our coefficients do not exceed unity */ 421 - if (measured_us > data->next_timer_us) 422 - measured_us = data->next_timer_us; 423 - } 424 419 425 420 /* Update our correction ratio */ 426 421 new_factor = data->correction_factor[data->bucket];
-4
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
··· 121 121 if (IS_ERR(process)) 122 122 return PTR_ERR(process); 123 123 124 - process->is_32bit_user_mode = is_32bit_user_mode; 125 - 126 124 dev_dbg(kfd_device, "process %d opened, compat mode (32 bit) - %d\n", 127 125 process->pasid, process->is_32bit_user_mode); 128 - 129 - kfd_init_apertures(process); 130 126 131 127 return 0; 132 128 }
+2 -4
drivers/gpu/drm/amd/amdkfd/kfd_flat_memory.c
··· 299 299 struct kfd_dev *dev; 300 300 struct kfd_process_device *pdd; 301 301 302 - mutex_lock(&process->mutex); 303 - 304 302 /*Iterating over all devices*/ 305 303 while ((dev = kfd_topology_enum_kfd_devices(id)) != NULL && 306 304 id < NUM_OF_SUPPORTED_GPUS) { 307 305 308 306 pdd = kfd_get_process_device_data(dev, process, 1); 307 + if (!pdd) 308 + return -1; 309 309 310 310 /* 311 311 * For 64 bit process aperture will be statically reserved in ··· 347 347 348 348 id++; 349 349 } 350 - 351 - mutex_unlock(&process->mutex); 352 350 353 351 return 0; 354 352 }
+9
drivers/gpu/drm/amd/amdkfd/kfd_process.c
··· 26 26 #include <linux/slab.h> 27 27 #include <linux/amd-iommu.h> 28 28 #include <linux/notifier.h> 29 + #include <linux/compat.h> 30 + 29 31 struct mm_struct; 30 32 31 33 #include "kfd_priv.h" ··· 287 285 if (err != 0) 288 286 goto err_process_pqm_init; 289 287 288 + /* init process apertures*/ 289 + process->is_32bit_user_mode = is_compat_task(); 290 + if (kfd_init_apertures(process) != 0) 291 + goto err_init_apretures; 292 + 290 293 return process; 291 294 295 + err_init_apretures: 296 + pqm_uninit(&process->pqm); 292 297 err_process_pqm_init: 293 298 hash_del_rcu(&process->kfd_processes); 294 299 synchronize_rcu();
+6 -2
drivers/gpu/drm/amd/amdkfd/kfd_topology.c
··· 700 700 dev->node_props.simd_per_cu); 701 701 sysfs_show_32bit_prop(buffer, "max_slots_scratch_cu", 702 702 dev->node_props.max_slots_scratch_cu); 703 - sysfs_show_32bit_prop(buffer, "engine_id", 704 - dev->node_props.engine_id); 705 703 sysfs_show_32bit_prop(buffer, "vendor_id", 706 704 dev->node_props.vendor_id); 707 705 sysfs_show_32bit_prop(buffer, "device_id", ··· 713 715 dev->gpu->kgd)); 714 716 sysfs_show_64bit_prop(buffer, "local_mem_size", 715 717 kfd2kgd->get_vmem_size(dev->gpu->kgd)); 718 + 719 + sysfs_show_32bit_prop(buffer, "fw_version", 720 + kfd2kgd->get_fw_version( 721 + dev->gpu->kgd, 722 + KGD_ENGINE_MEC1)); 723 + 716 724 } 717 725 718 726 ret = sysfs_show_32bit_prop(buffer, "max_engine_clk_ccompute",
+15
drivers/gpu/drm/amd/include/kgd_kfd_interface.h
··· 45 45 KGD_POOL_FRAMEBUFFER = 3, 46 46 }; 47 47 48 + enum kgd_engine_type { 49 + KGD_ENGINE_PFP = 1, 50 + KGD_ENGINE_ME, 51 + KGD_ENGINE_CE, 52 + KGD_ENGINE_MEC1, 53 + KGD_ENGINE_MEC2, 54 + KGD_ENGINE_RLC, 55 + KGD_ENGINE_SDMA, 56 + KGD_ENGINE_MAX 57 + }; 58 + 48 59 struct kgd2kfd_shared_resources { 49 60 /* Bit n == 1 means VMID n is available for KFD. */ 50 61 unsigned int compute_vmid_bitmap; ··· 148 137 * 149 138 * @hqd_destroy: Destructs and preempts the queue assigned to that hqd slot. 150 139 * 140 + * @get_fw_version: Returns FW versions from the header 141 + * 151 142 * This structure contains function pointers to services that the kgd driver 152 143 * provides to amdkfd driver. 153 144 * ··· 189 176 int (*hqd_destroy)(struct kgd_dev *kgd, uint32_t reset_type, 190 177 unsigned int timeout, uint32_t pipe_id, 191 178 uint32_t queue_id); 179 + uint16_t (*get_fw_version)(struct kgd_dev *kgd, 180 + enum kgd_engine_type type); 192 181 }; 193 182 194 183 bool kgd2kfd_init(unsigned interface_version,
+1 -1
drivers/gpu/drm/drm_atomic_helper.c
··· 61 61 struct drm_crtc_state *crtc_state; 62 62 63 63 if (plane->state->crtc) { 64 - crtc_state = state->crtc_states[drm_crtc_index(plane->crtc)]; 64 + crtc_state = state->crtc_states[drm_crtc_index(plane->state->crtc)]; 65 65 66 66 if (WARN_ON(!crtc_state)) 67 67 return;
+60
drivers/gpu/drm/drm_irq.c
··· 830 830 * vblank events since the system was booted, including lost events due to 831 831 * modesetting activity. 832 832 * 833 + * This is the legacy version of drm_crtc_vblank_count(). 834 + * 833 835 * Returns: 834 836 * The software vblank counter. 835 837 */ ··· 844 842 return atomic_read(&vblank->count); 845 843 } 846 844 EXPORT_SYMBOL(drm_vblank_count); 845 + 846 + /** 847 + * drm_crtc_vblank_count - retrieve "cooked" vblank counter value 848 + * @crtc: which counter to retrieve 849 + * 850 + * Fetches the "cooked" vblank count value that represents the number of 851 + * vblank events since the system was booted, including lost events due to 852 + * modesetting activity. 853 + * 854 + * This is the native KMS version of drm_vblank_count(). 855 + * 856 + * Returns: 857 + * The software vblank counter. 858 + */ 859 + u32 drm_crtc_vblank_count(struct drm_crtc *crtc) 860 + { 861 + return drm_vblank_count(crtc->dev, drm_crtc_index(crtc)); 862 + } 863 + EXPORT_SYMBOL(drm_crtc_vblank_count); 847 864 848 865 /** 849 866 * drm_vblank_count_and_time - retrieve "cooked" vblank counter value ··· 925 904 * 926 905 * Updates sequence # and timestamp on event, and sends it to userspace. 927 906 * Caller must hold event lock. 907 + * 908 + * This is the legacy version of drm_crtc_send_vblank_event(). 928 909 */ 929 910 void drm_send_vblank_event(struct drm_device *dev, int crtc, 930 911 struct drm_pending_vblank_event *e) ··· 944 921 send_vblank_event(dev, e, seq, &now); 945 922 } 946 923 EXPORT_SYMBOL(drm_send_vblank_event); 924 + 925 + /** 926 + * drm_crtc_send_vblank_event - helper to send vblank event after pageflip 927 + * @crtc: the source CRTC of the vblank event 928 + * @e: the event to send 929 + * 930 + * Updates sequence # and timestamp on event, and sends it to userspace. 931 + * Caller must hold event lock. 932 + * 933 + * This is the native KMS version of drm_send_vblank_event(). 934 + */ 935 + void drm_crtc_send_vblank_event(struct drm_crtc *crtc, 936 + struct drm_pending_vblank_event *e) 937 + { 938 + drm_send_vblank_event(crtc->dev, drm_crtc_index(crtc), e); 939 + } 940 + EXPORT_SYMBOL(drm_crtc_send_vblank_event); 947 941 948 942 /** 949 943 * drm_vblank_enable - enable the vblank interrupt on a CRTC ··· 1634 1594 * 1635 1595 * Drivers should call this routine in their vblank interrupt handlers to 1636 1596 * update the vblank counter and send any signals that may be pending. 1597 + * 1598 + * This is the legacy version of drm_crtc_handle_vblank(). 1637 1599 */ 1638 1600 bool drm_handle_vblank(struct drm_device *dev, int crtc) 1639 1601 { ··· 1712 1670 return true; 1713 1671 } 1714 1672 EXPORT_SYMBOL(drm_handle_vblank); 1673 + 1674 + /** 1675 + * drm_crtc_handle_vblank - handle a vblank event 1676 + * @crtc: where this event occurred 1677 + * 1678 + * Drivers should call this routine in their vblank interrupt handlers to 1679 + * update the vblank counter and send any signals that may be pending. 1680 + * 1681 + * This is the native KMS version of drm_handle_vblank(). 1682 + * 1683 + * Returns: 1684 + * True if the event was successfully handled, false on failure. 1685 + */ 1686 + bool drm_crtc_handle_vblank(struct drm_crtc *crtc) 1687 + { 1688 + return drm_handle_vblank(crtc->dev, drm_crtc_index(crtc)); 1689 + } 1690 + EXPORT_SYMBOL(drm_crtc_handle_vblank);
+4 -2
drivers/gpu/drm/i915/i915_drv.c
··· 811 811 if (!i915.reset) 812 812 return 0; 813 813 814 + intel_reset_gt_powersave(dev); 815 + 814 816 mutex_lock(&dev->struct_mutex); 815 817 816 818 i915_gem_reset(dev); ··· 882 880 * of re-init after reset. 883 881 */ 884 882 if (INTEL_INFO(dev)->gen > 5) 885 - intel_reset_gt_powersave(dev); 883 + intel_enable_gt_powersave(dev); 886 884 } else { 887 885 mutex_unlock(&dev->struct_mutex); 888 886 } ··· 1586 1584 .gem_prime_import = i915_gem_prime_import, 1587 1585 1588 1586 .dumb_create = i915_gem_dumb_create, 1589 - .dumb_map_offset = i915_gem_dumb_map_offset, 1587 + .dumb_map_offset = i915_gem_mmap_gtt, 1590 1588 .dumb_destroy = drm_gem_dumb_destroy, 1591 1589 .ioctls = i915_ioctls, 1592 1590 .fops = &i915_driver_fops,
+2 -3
drivers/gpu/drm/i915/i915_drv.h
··· 2501 2501 int i915_gem_dumb_create(struct drm_file *file_priv, 2502 2502 struct drm_device *dev, 2503 2503 struct drm_mode_create_dumb *args); 2504 - int i915_gem_dumb_map_offset(struct drm_file *file_priv, 2505 - struct drm_device *dev, uint32_t handle, 2506 - uint64_t *offset); 2504 + int i915_gem_mmap_gtt(struct drm_file *file_priv, struct drm_device *dev, 2505 + uint32_t handle, uint64_t *offset); 2507 2506 /** 2508 2507 * Returns true if seq1 is later than seq2. 2509 2508 */
+5 -23
drivers/gpu/drm/i915/i915_gem.c
··· 401 401 i915_gem_create(struct drm_file *file, 402 402 struct drm_device *dev, 403 403 uint64_t size, 404 - bool dumb, 405 404 uint32_t *handle_p) 406 405 { 407 406 struct drm_i915_gem_object *obj; ··· 416 417 if (obj == NULL) 417 418 return -ENOMEM; 418 419 419 - obj->base.dumb = dumb; 420 420 ret = drm_gem_handle_create(file, &obj->base, &handle); 421 421 /* drop reference from allocate - handle holds it now */ 422 422 drm_gem_object_unreference_unlocked(&obj->base); ··· 435 437 args->pitch = ALIGN(args->width * DIV_ROUND_UP(args->bpp, 8), 64); 436 438 args->size = args->pitch * args->height; 437 439 return i915_gem_create(file, dev, 438 - args->size, true, &args->handle); 440 + args->size, &args->handle); 439 441 } 440 442 441 443 /** ··· 448 450 struct drm_i915_gem_create *args = data; 449 451 450 452 return i915_gem_create(file, dev, 451 - args->size, false, &args->handle); 453 + args->size, &args->handle); 452 454 } 453 455 454 456 static inline int ··· 1838 1840 drm_gem_free_mmap_offset(&obj->base); 1839 1841 } 1840 1842 1841 - static int 1843 + int 1842 1844 i915_gem_mmap_gtt(struct drm_file *file, 1843 1845 struct drm_device *dev, 1844 - uint32_t handle, bool dumb, 1846 + uint32_t handle, 1845 1847 uint64_t *offset) 1846 1848 { 1847 1849 struct drm_i915_private *dev_priv = dev->dev_private; ··· 1857 1859 ret = -ENOENT; 1858 1860 goto unlock; 1859 1861 } 1860 - 1861 - /* 1862 - * We don't allow dumb mmaps on objects created using another 1863 - * interface. 1864 - */ 1865 - WARN_ONCE(dumb && !(obj->base.dumb || obj->base.import_attach), 1866 - "Illegal dumb map of accelerated buffer.\n"); 1867 1862 1868 1863 if (obj->base.size > dev_priv->gtt.mappable_end) { 1869 1864 ret = -E2BIG; ··· 1882 1891 return ret; 1883 1892 } 1884 1893 1885 - int 1886 - i915_gem_dumb_map_offset(struct drm_file *file, 1887 - struct drm_device *dev, 1888 - uint32_t handle, 1889 - uint64_t *offset) 1890 - { 1891 - return i915_gem_mmap_gtt(file, dev, handle, true, offset); 1892 - } 1893 - 1894 1894 /** 1895 1895 * i915_gem_mmap_gtt_ioctl - prepare an object for GTT mmap'ing 1896 1896 * @dev: DRM device ··· 1903 1921 { 1904 1922 struct drm_i915_gem_mmap_gtt *args = data; 1905 1923 1906 - return i915_gem_mmap_gtt(file, dev, args->handle, false, &args->offset); 1924 + return i915_gem_mmap_gtt(file, dev, args->handle, &args->offset); 1907 1925 } 1908 1926 1909 1927 static inline int
+40 -8
drivers/gpu/drm/i915/i915_gem_context.c
··· 473 473 u32 hw_flags) 474 474 { 475 475 u32 flags = hw_flags | MI_MM_SPACE_GTT; 476 - int ret; 476 + const int num_rings = 477 + /* Use an extended w/a on ivb+ if signalling from other rings */ 478 + i915_semaphore_is_enabled(ring->dev) ? 479 + hweight32(INTEL_INFO(ring->dev)->ring_mask) - 1 : 480 + 0; 481 + int len, i, ret; 477 482 478 483 /* w/a: If Flush TLB Invalidation Mode is enabled, driver must do a TLB 479 484 * invalidation prior to MI_SET_CONTEXT. On GEN6 we don't set the value ··· 495 490 if (!IS_HASWELL(ring->dev) && INTEL_INFO(ring->dev)->gen < 8) 496 491 flags |= (MI_SAVE_EXT_STATE_EN | MI_RESTORE_EXT_STATE_EN); 497 492 498 - ret = intel_ring_begin(ring, 6); 493 + 494 + len = 4; 495 + if (INTEL_INFO(ring->dev)->gen >= 7) 496 + len += 2 + (num_rings ? 4*num_rings + 2 : 0); 497 + 498 + ret = intel_ring_begin(ring, len); 499 499 if (ret) 500 500 return ret; 501 501 502 502 /* WaProgramMiArbOnOffAroundMiSetContext:ivb,vlv,hsw,bdw,chv */ 503 - if (INTEL_INFO(ring->dev)->gen >= 7) 503 + if (INTEL_INFO(ring->dev)->gen >= 7) { 504 504 intel_ring_emit(ring, MI_ARB_ON_OFF | MI_ARB_DISABLE); 505 - else 506 - intel_ring_emit(ring, MI_NOOP); 505 + if (num_rings) { 506 + struct intel_engine_cs *signaller; 507 + 508 + intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(num_rings)); 509 + for_each_ring(signaller, to_i915(ring->dev), i) { 510 + if (signaller == ring) 511 + continue; 512 + 513 + intel_ring_emit(ring, RING_PSMI_CTL(signaller->mmio_base)); 514 + intel_ring_emit(ring, _MASKED_BIT_ENABLE(GEN6_PSMI_SLEEP_MSG_DISABLE)); 515 + } 516 + } 517 + } 507 518 508 519 intel_ring_emit(ring, MI_NOOP); 509 520 intel_ring_emit(ring, MI_SET_CONTEXT); ··· 531 510 */ 532 511 intel_ring_emit(ring, MI_NOOP); 533 512 534 - if (INTEL_INFO(ring->dev)->gen >= 7) 513 + if (INTEL_INFO(ring->dev)->gen >= 7) { 514 + if (num_rings) { 515 + struct intel_engine_cs *signaller; 516 + 517 + intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(num_rings)); 518 + for_each_ring(signaller, to_i915(ring->dev), i) { 519 + if (signaller == ring) 520 + continue; 521 + 522 + intel_ring_emit(ring, RING_PSMI_CTL(signaller->mmio_base)); 523 + intel_ring_emit(ring, _MASKED_BIT_DISABLE(GEN6_PSMI_SLEEP_MSG_DISABLE)); 524 + } 525 + } 535 526 intel_ring_emit(ring, MI_ARB_ON_OFF | MI_ARB_ENABLE); 536 - else 537 - intel_ring_emit(ring, MI_NOOP); 527 + } 538 528 539 529 intel_ring_advance(ring); 540 530
-3
drivers/gpu/drm/i915/i915_gem_execbuffer.c
··· 121 121 goto err; 122 122 } 123 123 124 - WARN_ONCE(obj->base.dumb, 125 - "GPU use of dumb buffer is illegal.\n"); 126 - 127 124 drm_gem_object_reference(&obj->base); 128 125 list_add_tail(&obj->obj_exec_link, &objects); 129 126 }
+14 -4
drivers/gpu/drm/i915/i915_irq.c
··· 281 281 struct drm_i915_private *dev_priv = dev->dev_private; 282 282 283 283 spin_lock_irq(&dev_priv->irq_lock); 284 + 284 285 WARN_ON(dev_priv->rps.pm_iir); 285 286 WARN_ON(I915_READ(gen6_pm_iir(dev_priv)) & dev_priv->pm_rps_events); 286 287 dev_priv->rps.interrupts_enabled = true; 288 + I915_WRITE(gen6_pm_ier(dev_priv), I915_READ(gen6_pm_ier(dev_priv)) | 289 + dev_priv->pm_rps_events); 287 290 gen6_enable_pm_irq(dev_priv, dev_priv->pm_rps_events); 291 + 288 292 spin_unlock_irq(&dev_priv->irq_lock); 289 293 } 290 294 ··· 3311 3307 GEN5_IRQ_INIT(GT, dev_priv->gt_irq_mask, gt_irqs); 3312 3308 3313 3309 if (INTEL_INFO(dev)->gen >= 6) { 3314 - pm_irqs |= dev_priv->pm_rps_events; 3315 - 3310 + /* 3311 + * RPS interrupts will get enabled/disabled on demand when RPS 3312 + * itself is enabled/disabled. 3313 + */ 3316 3314 if (HAS_VEBOX(dev)) 3317 3315 pm_irqs |= PM_VEBOX_USER_INTERRUPT; 3318 3316 ··· 3526 3520 dev_priv->pm_irq_mask = 0xffffffff; 3527 3521 GEN8_IRQ_INIT_NDX(GT, 0, ~gt_interrupts[0], gt_interrupts[0]); 3528 3522 GEN8_IRQ_INIT_NDX(GT, 1, ~gt_interrupts[1], gt_interrupts[1]); 3529 - GEN8_IRQ_INIT_NDX(GT, 2, dev_priv->pm_irq_mask, dev_priv->pm_rps_events); 3523 + /* 3524 + * RPS interrupts will get enabled/disabled on demand when RPS itself 3525 + * is enabled/disabled. 3526 + */ 3527 + GEN8_IRQ_INIT_NDX(GT, 2, dev_priv->pm_irq_mask, 0); 3530 3528 GEN8_IRQ_INIT_NDX(GT, 3, ~gt_interrupts[3], gt_interrupts[3]); 3531 3529 } 3532 3530 ··· 3619 3609 3620 3610 vlv_display_irq_reset(dev_priv); 3621 3611 3622 - dev_priv->irq_mask = 0; 3612 + dev_priv->irq_mask = ~0; 3623 3613 } 3624 3614 3625 3615 static void valleyview_irq_uninstall(struct drm_device *dev)
+3
drivers/gpu/drm/i915/i915_reg.h
··· 395 395 #define PIPE_CONTROL_STORE_DATA_INDEX (1<<21) 396 396 #define PIPE_CONTROL_CS_STALL (1<<20) 397 397 #define PIPE_CONTROL_TLB_INVALIDATE (1<<18) 398 + #define PIPE_CONTROL_MEDIA_STATE_CLEAR (1<<16) 398 399 #define PIPE_CONTROL_QW_WRITE (1<<14) 399 400 #define PIPE_CONTROL_POST_SYNC_OP_MASK (3<<14) 400 401 #define PIPE_CONTROL_DEPTH_STALL (1<<13) ··· 1129 1128 #define GEN6_VERSYNC (RING_SYNC_1(VEBOX_RING_BASE)) 1130 1129 #define GEN6_VEVSYNC (RING_SYNC_2(VEBOX_RING_BASE)) 1131 1130 #define GEN6_NOSYNC 0 1131 + #define RING_PSMI_CTL(base) ((base)+0x50) 1132 1132 #define RING_MAX_IDLE(base) ((base)+0x54) 1133 1133 #define RING_HWS_PGA(base) ((base)+0x80) 1134 1134 #define RING_HWS_PGA_GEN6(base) ((base)+0x2080) ··· 1460 1458 #define GEN6_BLITTER_FBC_NOTIFY (1<<3) 1461 1459 1462 1460 #define GEN6_RC_SLEEP_PSMI_CONTROL 0x2050 1461 + #define GEN6_PSMI_SLEEP_MSG_DISABLE (1 << 0) 1463 1462 #define GEN8_RC_SEMA_IDLE_MSG_DISABLE (1 << 12) 1464 1463 #define GEN8_FF_DOP_CLOCK_GATE_DISABLE (1<<10) 1465 1464
+19 -9
drivers/gpu/drm/i915/intel_pm.c
··· 6191 6191 valleyview_cleanup_gt_powersave(dev); 6192 6192 } 6193 6193 6194 + static void gen6_suspend_rps(struct drm_device *dev) 6195 + { 6196 + struct drm_i915_private *dev_priv = dev->dev_private; 6197 + 6198 + flush_delayed_work(&dev_priv->rps.delayed_resume_work); 6199 + 6200 + /* 6201 + * TODO: disable RPS interrupts on GEN9+ too once RPS support 6202 + * is added for it. 6203 + */ 6204 + if (INTEL_INFO(dev)->gen < 9) 6205 + gen6_disable_rps_interrupts(dev); 6206 + } 6207 + 6194 6208 /** 6195 6209 * intel_suspend_gt_powersave - suspend PM work and helper threads 6196 6210 * @dev: drm device ··· 6220 6206 if (INTEL_INFO(dev)->gen < 6) 6221 6207 return; 6222 6208 6223 - flush_delayed_work(&dev_priv->rps.delayed_resume_work); 6224 - 6225 - /* 6226 - * TODO: disable RPS interrupts on GEN9+ too once RPS support 6227 - * is added for it. 6228 - */ 6229 - if (INTEL_INFO(dev)->gen < 9) 6230 - gen6_disable_rps_interrupts(dev); 6209 + gen6_suspend_rps(dev); 6231 6210 6232 6211 /* Force GPU to min freq during suspend */ 6233 6212 gen6_rps_idle(dev_priv); ··· 6323 6316 { 6324 6317 struct drm_i915_private *dev_priv = dev->dev_private; 6325 6318 6319 + if (INTEL_INFO(dev)->gen < 6) 6320 + return; 6321 + 6322 + gen6_suspend_rps(dev); 6326 6323 dev_priv->rps.enabled = false; 6327 - intel_enable_gt_powersave(dev); 6328 6324 } 6329 6325 6330 6326 static void ibx_init_clock_gating(struct drm_device *dev)
+3
drivers/gpu/drm/i915/intel_ringbuffer.c
··· 362 362 flags |= PIPE_CONTROL_VF_CACHE_INVALIDATE; 363 363 flags |= PIPE_CONTROL_CONST_CACHE_INVALIDATE; 364 364 flags |= PIPE_CONTROL_STATE_CACHE_INVALIDATE; 365 + flags |= PIPE_CONTROL_MEDIA_STATE_CLEAR; 365 366 /* 366 367 * TLB invalidate requires a post-sync write. 367 368 */ 368 369 flags |= PIPE_CONTROL_QW_WRITE; 369 370 flags |= PIPE_CONTROL_GLOBAL_GTT_IVB; 371 + 372 + flags |= PIPE_CONTROL_STALL_AT_SCOREBOARD; 370 373 371 374 /* Workaround: we must issue a pipe_control with CS-stall bit 372 375 * set before a pipe_control command that has the state cache
+2 -4
drivers/gpu/drm/msm/adreno/adreno_gpu.c
··· 386 386 msm_gem_put_iova(gpu->memptrs_bo, gpu->base.id); 387 387 drm_gem_object_unreference(gpu->memptrs_bo); 388 388 } 389 - if (gpu->pm4) 390 - release_firmware(gpu->pm4); 391 - if (gpu->pfp) 392 - release_firmware(gpu->pfp); 389 + release_firmware(gpu->pm4); 390 + release_firmware(gpu->pfp); 393 391 msm_gpu_cleanup(&gpu->base); 394 392 }
+22 -31
drivers/gpu/drm/msm/hdmi/hdmi_connector.c
··· 141 141 uint32_t hpd_ctrl; 142 142 int i, ret; 143 143 144 + for (i = 0; i < config->hpd_reg_cnt; i++) { 145 + ret = regulator_enable(hdmi->hpd_regs[i]); 146 + if (ret) { 147 + dev_err(dev->dev, "failed to enable hpd regulator: %s (%d)\n", 148 + config->hpd_reg_names[i], ret); 149 + goto fail; 150 + } 151 + } 152 + 144 153 ret = gpio_config(hdmi, true); 145 154 if (ret) { 146 155 dev_err(dev->dev, "failed to configure GPIOs: %d\n", ret); ··· 169 160 if (ret) { 170 161 dev_err(dev->dev, "failed to enable hpd clk: %s (%d)\n", 171 162 config->hpd_clk_names[i], ret); 172 - goto fail; 173 - } 174 - } 175 - 176 - for (i = 0; i < config->hpd_reg_cnt; i++) { 177 - ret = regulator_enable(hdmi->hpd_regs[i]); 178 - if (ret) { 179 - dev_err(dev->dev, "failed to enable hpd regulator: %s (%d)\n", 180 - config->hpd_reg_names[i], ret); 181 163 goto fail; 182 164 } 183 165 } ··· 200 200 return ret; 201 201 } 202 202 203 - static int hdp_disable(struct hdmi_connector *hdmi_connector) 203 + static void hdp_disable(struct hdmi_connector *hdmi_connector) 204 204 { 205 205 struct hdmi *hdmi = hdmi_connector->hdmi; 206 206 const struct hdmi_platform_config *config = hdmi->config; ··· 212 212 213 213 hdmi_set_mode(hdmi, false); 214 214 215 - for (i = 0; i < config->hpd_reg_cnt; i++) { 216 - ret = regulator_disable(hdmi->hpd_regs[i]); 217 - if (ret) { 218 - dev_err(dev->dev, "failed to disable hpd regulator: %s (%d)\n", 219 - config->hpd_reg_names[i], ret); 220 - goto fail; 221 - } 222 - } 223 - 224 215 for (i = 0; i < config->hpd_clk_cnt; i++) 225 216 clk_disable_unprepare(hdmi->hpd_clks[i]); 226 217 227 218 ret = gpio_config(hdmi, false); 228 - if (ret) { 229 - dev_err(dev->dev, "failed to unconfigure GPIOs: %d\n", ret); 230 - goto fail; 219 + if (ret) 220 + dev_warn(dev->dev, "failed to unconfigure GPIOs: %d\n", ret); 221 + 222 + for (i = 0; i < config->hpd_reg_cnt; i++) { 223 + ret = regulator_disable(hdmi->hpd_regs[i]); 224 + if (ret) 225 + dev_warn(dev->dev, "failed to disable hpd regulator: %s (%d)\n", 226 + config->hpd_reg_names[i], ret); 231 227 } 232 - 233 - return 0; 234 - 235 - fail: 236 - return ret; 237 228 } 238 229 239 230 static void ··· 251 260 (hpd_int_status & HDMI_HPD_INT_STATUS_INT)) { 252 261 bool detected = !!(hpd_int_status & HDMI_HPD_INT_STATUS_CABLE_DETECTED); 253 262 254 - DBG("status=%04x, ctrl=%04x", hpd_int_status, hpd_int_ctrl); 255 - 256 - /* ack the irq: */ 263 + /* ack & disable (temporarily) HPD events: */ 257 264 hdmi_write(hdmi, REG_HDMI_HPD_INT_CTRL, 258 - hpd_int_ctrl | HDMI_HPD_INT_CTRL_INT_ACK); 265 + HDMI_HPD_INT_CTRL_INT_ACK); 266 + 267 + DBG("status=%04x, ctrl=%04x", hpd_int_status, hpd_int_ctrl); 259 268 260 269 /* detect disconnect if we are connected or visa versa: */ 261 270 hpd_int_ctrl = HDMI_HPD_INT_CTRL_INT_EN;
+1 -10
drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c
··· 331 331 struct drm_crtc_state *state) 332 332 { 333 333 struct mdp4_crtc *mdp4_crtc = to_mdp4_crtc(crtc); 334 - struct drm_device *dev = crtc->dev; 335 - 336 334 DBG("%s: check", mdp4_crtc->name); 337 - 338 - if (mdp4_crtc->event) { 339 - dev_err(dev->dev, "already pending flip!\n"); 340 - return -EBUSY; 341 - } 342 - 343 335 // TODO anything else to check? 344 - 345 336 return 0; 346 337 } 347 338 ··· 348 357 struct drm_device *dev = crtc->dev; 349 358 unsigned long flags; 350 359 351 - DBG("%s: flush", mdp4_crtc->name); 360 + DBG("%s: event: %p", mdp4_crtc->name, crtc->state->event); 352 361 353 362 WARN_ON(mdp4_crtc->event); 354 363
+2 -10
drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
··· 303 303 304 304 DBG("%s: check", mdp5_crtc->name); 305 305 306 - if (mdp5_crtc->event) { 307 - dev_err(dev->dev, "already pending flip!\n"); 308 - return -EBUSY; 309 - } 310 - 311 306 /* request a free CTL, if none is already allocated for this CRTC */ 312 307 if (state->enable && !mdp5_crtc->ctl) { 313 308 mdp5_crtc->ctl = mdp5_ctlm_request(mdp5_kms->ctlm, crtc); ··· 359 364 struct drm_device *dev = crtc->dev; 360 365 unsigned long flags; 361 366 362 - DBG("%s: flush", mdp5_crtc->name); 367 + DBG("%s: event: %p", mdp5_crtc->name, crtc->state->event); 363 368 364 369 WARN_ON(mdp5_crtc->event); 365 370 ··· 455 460 /* now that we know what irq's we want: */ 456 461 mdp5_crtc->err.irqmask = intf2err(intf); 457 462 mdp5_crtc->vblank.irqmask = intf2vblank(intf); 458 - 459 - /* when called from modeset_init(), skip the rest until later: */ 460 - if (!mdp5_kms) 461 - return; 463 + mdp_irq_update(&mdp5_kms->base); 462 464 463 465 spin_lock_irqsave(&mdp5_kms->resource_lock, flags); 464 466 intf_sel = mdp5_read(mdp5_kms, REG_MDP5_DISP_INTF_SEL);
+1 -11
drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
··· 216 216 goto fail; 217 217 } 218 218 219 - /* NOTE: the vsync and error irq's are actually associated with 220 - * the INTF/encoder.. the easiest way to deal with this (ie. what 221 - * we do now) is assume a fixed relationship between crtc's and 222 - * encoders. I'm not sure if there is ever a need to more freely 223 - * assign crtcs to encoders, but if there is then we need to take 224 - * care of error and vblank irq's that the crtc has registered, 225 - * and also update user-requested vblank_mask. 226 - */ 227 - encoder->possible_crtcs = BIT(0); 228 - mdp5_crtc_set_intf(priv->crtcs[0], 3, INTF_HDMI); 229 - 219 + encoder->possible_crtcs = (1 << priv->num_crtcs) - 1;; 230 220 priv->encoders[priv->num_encoders++] = encoder; 231 221 232 222 /* Construct bridge/connector for HDMI: */
+6 -3
drivers/gpu/drm/msm/mdp/mdp_kms.c
··· 42 42 mdp_kms->funcs->set_irqmask(mdp_kms, irqmask); 43 43 } 44 44 45 - static void update_irq_unlocked(struct mdp_kms *mdp_kms) 45 + /* if an mdp_irq's irqmask has changed, such as when mdp5 crtc<->encoder 46 + * link changes, this must be called to figure out the new global irqmask 47 + */ 48 + void mdp_irq_update(struct mdp_kms *mdp_kms) 46 49 { 47 50 unsigned long flags; 48 51 spin_lock_irqsave(&list_lock, flags); ··· 125 122 spin_unlock_irqrestore(&list_lock, flags); 126 123 127 124 if (needs_update) 128 - update_irq_unlocked(mdp_kms); 125 + mdp_irq_update(mdp_kms); 129 126 } 130 127 131 128 void mdp_irq_unregister(struct mdp_kms *mdp_kms, struct mdp_irq *irq) ··· 144 141 spin_unlock_irqrestore(&list_lock, flags); 145 142 146 143 if (needs_update) 147 - update_irq_unlocked(mdp_kms); 144 + mdp_irq_update(mdp_kms); 148 145 }
+1 -1
drivers/gpu/drm/msm/mdp/mdp_kms.h
··· 75 75 void mdp_irq_wait(struct mdp_kms *mdp_kms, uint32_t irqmask); 76 76 void mdp_irq_register(struct mdp_kms *mdp_kms, struct mdp_irq *irq); 77 77 void mdp_irq_unregister(struct mdp_kms *mdp_kms, struct mdp_irq *irq); 78 - 78 + void mdp_irq_update(struct mdp_kms *mdp_kms); 79 79 80 80 /* 81 81 * pixel format helpers:
+68 -1
drivers/gpu/drm/msm/msm_atomic.c
··· 23 23 struct drm_atomic_state *state; 24 24 uint32_t fence; 25 25 struct msm_fence_cb fence_cb; 26 + uint32_t crtc_mask; 26 27 }; 27 28 28 29 static void fence_cb(struct msm_fence_cb *cb); 30 + 31 + /* block until specified crtcs are no longer pending update, and 32 + * atomically mark them as pending update 33 + */ 34 + static int start_atomic(struct msm_drm_private *priv, uint32_t crtc_mask) 35 + { 36 + int ret; 37 + 38 + spin_lock(&priv->pending_crtcs_event.lock); 39 + ret = wait_event_interruptible_locked(priv->pending_crtcs_event, 40 + !(priv->pending_crtcs & crtc_mask)); 41 + if (ret == 0) { 42 + DBG("start: %08x", crtc_mask); 43 + priv->pending_crtcs |= crtc_mask; 44 + } 45 + spin_unlock(&priv->pending_crtcs_event.lock); 46 + 47 + return ret; 48 + } 49 + 50 + /* clear specified crtcs (no longer pending update) 51 + */ 52 + static void end_atomic(struct msm_drm_private *priv, uint32_t crtc_mask) 53 + { 54 + spin_lock(&priv->pending_crtcs_event.lock); 55 + DBG("end: %08x", crtc_mask); 56 + priv->pending_crtcs &= ~crtc_mask; 57 + wake_up_all_locked(&priv->pending_crtcs_event); 58 + spin_unlock(&priv->pending_crtcs_event.lock); 59 + } 29 60 30 61 static struct msm_commit *new_commit(struct drm_atomic_state *state) 31 62 { ··· 89 58 90 59 drm_atomic_helper_commit_post_planes(dev, state); 91 60 61 + /* NOTE: _wait_for_vblanks() only waits for vblank on 62 + * enabled CRTCs. So we end up faulting when disabling 63 + * due to (potentially) unref'ing the outgoing fb's 64 + * before the vblank when the disable has latched. 65 + * 66 + * But if it did wait on disabled (or newly disabled) 67 + * CRTCs, that would be racy (ie. we could have missed 68 + * the irq. We need some way to poll for pipe shut 69 + * down. Or just live with occasionally hitting the 70 + * timeout in the CRTC disable path (which really should 71 + * not be critical path) 72 + */ 73 + 92 74 drm_atomic_helper_wait_for_vblanks(dev, state); 93 75 94 76 drm_atomic_helper_cleanup_planes(dev, state); 95 77 96 78 drm_atomic_state_free(state); 79 + 80 + end_atomic(dev->dev_private, c->crtc_mask); 97 81 98 82 kfree(c); 99 83 } ··· 143 97 int msm_atomic_commit(struct drm_device *dev, 144 98 struct drm_atomic_state *state, bool async) 145 99 { 146 - struct msm_commit *c; 147 100 int nplanes = dev->mode_config.num_total_plane; 101 + int ncrtcs = dev->mode_config.num_crtc; 102 + struct msm_commit *c; 148 103 int i, ret; 149 104 150 105 ret = drm_atomic_helper_prepare_planes(dev, state); ··· 153 106 return ret; 154 107 155 108 c = new_commit(state); 109 + if (!c) 110 + return -ENOMEM; 111 + 112 + /* 113 + * Figure out what crtcs we have: 114 + */ 115 + for (i = 0; i < ncrtcs; i++) { 116 + struct drm_crtc *crtc = state->crtcs[i]; 117 + if (!crtc) 118 + continue; 119 + c->crtc_mask |= (1 << drm_crtc_index(crtc)); 120 + } 156 121 157 122 /* 158 123 * Figure out what fence to wait for: ··· 179 120 if ((plane->state->fb != new_state->fb) && new_state->fb) 180 121 add_fb(c, new_state->fb); 181 122 } 123 + 124 + /* 125 + * Wait for pending updates on any of the same crtc's and then 126 + * mark our set of crtc's as busy: 127 + */ 128 + ret = start_atomic(dev->dev_private, c->crtc_mask); 129 + if (ret) 130 + return ret; 182 131 183 132 /* 184 133 * This is the point of no return - everything below never fails except
+1
drivers/gpu/drm/msm/msm_drv.c
··· 193 193 194 194 priv->wq = alloc_ordered_workqueue("msm", 0); 195 195 init_waitqueue_head(&priv->fence_event); 196 + init_waitqueue_head(&priv->pending_crtcs_event); 196 197 197 198 INIT_LIST_HEAD(&priv->inactive_list); 198 199 INIT_LIST_HEAD(&priv->fence_cbs);
+4
drivers/gpu/drm/msm/msm_drv.h
··· 96 96 /* callbacks deferred until bo is inactive: */ 97 97 struct list_head fence_cbs; 98 98 99 + /* crtcs pending async atomic updates: */ 100 + uint32_t pending_crtcs; 101 + wait_queue_head_t pending_crtcs_event; 102 + 99 103 /* registered MMUs: */ 100 104 unsigned int num_mmus; 101 105 struct msm_mmu *mmus[NUM_DOMAINS];
+1 -2
drivers/gpu/drm/msm/msm_fbdev.c
··· 190 190 fail: 191 191 192 192 if (ret) { 193 - if (fbi) 194 - framebuffer_release(fbi); 193 + framebuffer_release(fbi); 195 194 if (fb) { 196 195 drm_framebuffer_unregister_private(fb); 197 196 drm_framebuffer_remove(fb);
+1 -2
drivers/gpu/drm/msm/msm_gem.c
··· 535 535 drm_free_large(msm_obj->pages); 536 536 537 537 } else { 538 - if (msm_obj->vaddr) 539 - vunmap(msm_obj->vaddr); 538 + vunmap(msm_obj->vaddr); 540 539 put_pages(obj); 541 540 } 542 541
-9
drivers/gpu/drm/nouveau/nouveau_display.c
··· 876 876 if (ret) 877 877 return ret; 878 878 879 - bo->gem.dumb = true; 880 879 ret = drm_gem_handle_create(file_priv, &bo->gem, &args->handle); 881 880 drm_gem_object_unreference_unlocked(&bo->gem); 882 881 return ret; ··· 891 892 gem = drm_gem_object_lookup(dev, file_priv, handle); 892 893 if (gem) { 893 894 struct nouveau_bo *bo = nouveau_gem_object(gem); 894 - 895 - /* 896 - * We don't allow dumb mmaps on objects created using another 897 - * interface. 898 - */ 899 - WARN_ONCE(!(gem->dumb || gem->import_attach), 900 - "Illegal dumb map of accelerated buffer.\n"); 901 - 902 895 *poffset = drm_vma_node_offset_addr(&bo->bo.vma_node); 903 896 drm_gem_object_unreference_unlocked(gem); 904 897 return 0;
-3
drivers/gpu/drm/nouveau/nouveau_gem.c
··· 444 444 list_for_each_entry(nvbo, list, entry) { 445 445 struct drm_nouveau_gem_pushbuf_bo *b = &pbbo[nvbo->pbbo_index]; 446 446 447 - WARN_ONCE(nvbo->gem.dumb, 448 - "GPU use of dumb buffer is illegal.\n"); 449 - 450 447 ret = nouveau_gem_set_domain(&nvbo->gem, b->read_domains, 451 448 b->write_domains, 452 449 b->valid_domains);
+2 -1
drivers/gpu/drm/nouveau/nouveau_ttm.c
··· 28 28 #include "nouveau_ttm.h" 29 29 #include "nouveau_gem.h" 30 30 31 + #include "drm_legacy.h" 31 32 static int 32 33 nouveau_vram_manager_init(struct ttm_mem_type_manager *man, unsigned long psize) 33 34 { ··· 282 281 struct nouveau_drm *drm = nouveau_drm(file_priv->minor->dev); 283 282 284 283 if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET)) 285 - return -EINVAL; 284 + return drm_legacy_mmap(filp, vma); 286 285 287 286 return ttm_bo_mmap(filp, vma, &drm->ttm.bdev); 288 287 }
+4 -22
drivers/gpu/drm/radeon/radeon_gem.c
··· 394 394 return r; 395 395 } 396 396 397 - static int radeon_mode_mmap(struct drm_file *filp, 398 - struct drm_device *dev, 399 - uint32_t handle, bool dumb, 400 - uint64_t *offset_p) 397 + int radeon_mode_dumb_mmap(struct drm_file *filp, 398 + struct drm_device *dev, 399 + uint32_t handle, uint64_t *offset_p) 401 400 { 402 401 struct drm_gem_object *gobj; 403 402 struct radeon_bo *robj; ··· 405 406 if (gobj == NULL) { 406 407 return -ENOENT; 407 408 } 408 - 409 - /* 410 - * We don't allow dumb mmaps on objects created using another 411 - * interface. 412 - */ 413 - WARN_ONCE(dumb && !(gobj->dumb || gobj->import_attach), 414 - "Illegal dumb map of GPU buffer.\n"); 415 - 416 409 robj = gem_to_radeon_bo(gobj); 417 410 if (radeon_ttm_tt_has_userptr(robj->tbo.ttm)) { 418 411 drm_gem_object_unreference_unlocked(gobj); ··· 415 424 return 0; 416 425 } 417 426 418 - int radeon_mode_dumb_mmap(struct drm_file *filp, 419 - struct drm_device *dev, 420 - uint32_t handle, uint64_t *offset_p) 421 - { 422 - return radeon_mode_mmap(filp, dev, handle, true, offset_p); 423 - } 424 - 425 427 int radeon_gem_mmap_ioctl(struct drm_device *dev, void *data, 426 428 struct drm_file *filp) 427 429 { 428 430 struct drm_radeon_gem_mmap *args = data; 429 431 430 - return radeon_mode_mmap(filp, dev, args->handle, false, 431 - &args->addr_ptr); 432 + return radeon_mode_dumb_mmap(filp, dev, args->handle, &args->addr_ptr); 432 433 } 433 434 434 435 int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, ··· 746 763 return -ENOMEM; 747 764 748 765 r = drm_gem_handle_create(file_priv, gobj, &handle); 749 - gobj->dumb = true; 750 766 /* drop reference from allocate - handle holds it now */ 751 767 drm_gem_object_unreference_unlocked(gobj); 752 768 if (r) {
+53
drivers/gpu/drm/radeon/radeon_kfd.c
··· 28 28 #include "cikd.h" 29 29 #include "cik_reg.h" 30 30 #include "radeon_kfd.h" 31 + #include "radeon_ucode.h" 32 + #include <linux/firmware.h> 31 33 32 34 #define CIK_PIPE_PER_MEC (4) 33 35 ··· 51 49 static uint64_t get_gpu_clock_counter(struct kgd_dev *kgd); 52 50 53 51 static uint32_t get_max_engine_clock_in_mhz(struct kgd_dev *kgd); 52 + static uint16_t get_fw_version(struct kgd_dev *kgd, enum kgd_engine_type type); 54 53 55 54 /* 56 55 * Register access functions ··· 94 91 .hqd_load = kgd_hqd_load, 95 92 .hqd_is_occupies = kgd_hqd_is_occupies, 96 93 .hqd_destroy = kgd_hqd_destroy, 94 + .get_fw_version = get_fw_version 97 95 }; 98 96 99 97 static const struct kgd2kfd_calls *kgd2kfd; ··· 564 560 565 561 release_queue(kgd); 566 562 return 0; 563 + } 564 + 565 + static uint16_t get_fw_version(struct kgd_dev *kgd, enum kgd_engine_type type) 566 + { 567 + struct radeon_device *rdev = (struct radeon_device *) kgd; 568 + const union radeon_firmware_header *hdr; 569 + 570 + BUG_ON(kgd == NULL || rdev->mec_fw == NULL); 571 + 572 + switch (type) { 573 + case KGD_ENGINE_PFP: 574 + hdr = (const union radeon_firmware_header *) rdev->pfp_fw->data; 575 + break; 576 + 577 + case KGD_ENGINE_ME: 578 + hdr = (const union radeon_firmware_header *) rdev->me_fw->data; 579 + break; 580 + 581 + case KGD_ENGINE_CE: 582 + hdr = (const union radeon_firmware_header *) rdev->ce_fw->data; 583 + break; 584 + 585 + case KGD_ENGINE_MEC1: 586 + hdr = (const union radeon_firmware_header *) rdev->mec_fw->data; 587 + break; 588 + 589 + case KGD_ENGINE_MEC2: 590 + hdr = (const union radeon_firmware_header *) 591 + rdev->mec2_fw->data; 592 + break; 593 + 594 + case KGD_ENGINE_RLC: 595 + hdr = (const union radeon_firmware_header *) rdev->rlc_fw->data; 596 + break; 597 + 598 + case KGD_ENGINE_SDMA: 599 + hdr = (const union radeon_firmware_header *) 600 + rdev->sdma_fw->data; 601 + break; 602 + 603 + default: 604 + return 0; 605 + } 606 + 607 + if (hdr == NULL) 608 + return 0; 609 + 610 + /* Only 12 bit in use*/ 611 + return hdr->common.ucode_version; 567 612 }
-3
drivers/gpu/drm/radeon/radeon_object.c
··· 529 529 u32 current_domain = 530 530 radeon_mem_type_to_domain(bo->tbo.mem.mem_type); 531 531 532 - WARN_ONCE(bo->gem_base.dumb, 533 - "GPU use of dumb buffer is illegal.\n"); 534 - 535 532 /* Check if this buffer will be moved and don't move it 536 533 * if we have moved too many buffers for this IB already. 537 534 *
+36 -12
drivers/gpu/drm/tegra/dc.c
··· 168 168 const struct tegra_dc_window *window) 169 169 { 170 170 unsigned h_offset, v_offset, h_size, v_size, h_dda, v_dda, bpp; 171 - unsigned long value; 171 + unsigned long value, flags; 172 172 bool yuv, planar; 173 173 174 174 /* ··· 180 180 bpp = window->bits_per_pixel / 8; 181 181 else 182 182 bpp = planar ? 1 : 2; 183 + 184 + spin_lock_irqsave(&dc->lock, flags); 183 185 184 186 value = WINDOW_A_SELECT << index; 185 187 tegra_dc_writel(dc, value, DC_CMD_DISPLAY_WINDOW_HEADER); ··· 275 273 276 274 case TEGRA_BO_TILING_MODE_BLOCK: 277 275 DRM_ERROR("hardware doesn't support block linear mode\n"); 276 + spin_unlock_irqrestore(&dc->lock, flags); 278 277 return -EINVAL; 279 278 } 280 279 ··· 334 331 335 332 tegra_dc_window_commit(dc, index); 336 333 334 + spin_unlock_irqrestore(&dc->lock, flags); 335 + 337 336 return 0; 338 337 } 339 338 ··· 343 338 { 344 339 struct tegra_dc *dc = to_tegra_dc(plane->crtc); 345 340 struct tegra_plane *p = to_tegra_plane(plane); 341 + unsigned long flags; 346 342 u32 value; 347 343 348 344 if (!plane->crtc) 349 345 return 0; 346 + 347 + spin_lock_irqsave(&dc->lock, flags); 350 348 351 349 value = WINDOW_A_SELECT << p->index; 352 350 tegra_dc_writel(dc, value, DC_CMD_DISPLAY_WINDOW_HEADER); ··· 359 351 tegra_dc_writel(dc, value, DC_WIN_WIN_OPTIONS); 360 352 361 353 tegra_dc_window_commit(dc, p->index); 354 + 355 + spin_unlock_irqrestore(&dc->lock, flags); 362 356 363 357 return 0; 364 358 } ··· 709 699 struct tegra_bo *bo = tegra_fb_get_plane(fb, 0); 710 700 unsigned int h_offset = 0, v_offset = 0; 711 701 struct tegra_bo_tiling tiling; 702 + unsigned long value, flags; 712 703 unsigned int format, swap; 713 - unsigned long value; 714 704 int err; 715 705 716 706 err = tegra_fb_get_tiling(fb, &tiling); 717 707 if (err < 0) 718 708 return err; 709 + 710 + spin_lock_irqsave(&dc->lock, flags); 719 711 720 712 tegra_dc_writel(dc, WINDOW_A_SELECT, DC_CMD_DISPLAY_WINDOW_HEADER); 721 713 ··· 764 752 765 753 case TEGRA_BO_TILING_MODE_BLOCK: 766 754 DRM_ERROR("hardware doesn't support block linear mode\n"); 755 + spin_unlock_irqrestore(&dc->lock, flags); 767 756 return -EINVAL; 768 757 } 769 758 ··· 790 777 value = GENERAL_ACT_REQ | WIN_A_ACT_REQ; 791 778 tegra_dc_writel(dc, value << 8, DC_CMD_STATE_CONTROL); 792 779 tegra_dc_writel(dc, value, DC_CMD_STATE_CONTROL); 780 + 781 + spin_unlock_irqrestore(&dc->lock, flags); 793 782 794 783 return 0; 795 784 } ··· 829 814 unsigned long flags, base; 830 815 struct tegra_bo *bo; 831 816 832 - if (!dc->event) 817 + spin_lock_irqsave(&drm->event_lock, flags); 818 + 819 + if (!dc->event) { 820 + spin_unlock_irqrestore(&drm->event_lock, flags); 833 821 return; 822 + } 834 823 835 824 bo = tegra_fb_get_plane(crtc->primary->fb, 0); 836 825 826 + spin_lock_irqsave(&dc->lock, flags); 827 + 837 828 /* check if new start address has been latched */ 829 + tegra_dc_writel(dc, WINDOW_A_SELECT, DC_CMD_DISPLAY_WINDOW_HEADER); 838 830 tegra_dc_writel(dc, READ_MUX, DC_CMD_STATE_ACCESS); 839 831 base = tegra_dc_readl(dc, DC_WINBUF_START_ADDR); 840 832 tegra_dc_writel(dc, 0, DC_CMD_STATE_ACCESS); 841 833 834 + spin_unlock_irqrestore(&dc->lock, flags); 835 + 842 836 if (base == bo->paddr + crtc->primary->fb->offsets[0]) { 843 - spin_lock_irqsave(&drm->event_lock, flags); 844 - drm_send_vblank_event(drm, dc->pipe, dc->event); 845 - drm_vblank_put(drm, dc->pipe); 837 + drm_crtc_send_vblank_event(crtc, dc->event); 838 + drm_crtc_vblank_put(crtc); 846 839 dc->event = NULL; 847 - spin_unlock_irqrestore(&drm->event_lock, flags); 848 840 } 841 + 842 + spin_unlock_irqrestore(&drm->event_lock, flags); 849 843 } 850 844 851 845 void tegra_dc_cancel_page_flip(struct drm_crtc *crtc, struct drm_file *file) ··· 867 843 868 844 if (dc->event && dc->event->base.file_priv == file) { 869 845 dc->event->base.destroy(&dc->event->base); 870 - drm_vblank_put(drm, dc->pipe); 846 + drm_crtc_vblank_put(crtc); 871 847 dc->event = NULL; 872 848 } 873 849 ··· 877 853 static int tegra_dc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, 878 854 struct drm_pending_vblank_event *event, uint32_t page_flip_flags) 879 855 { 856 + unsigned int pipe = drm_crtc_index(crtc); 880 857 struct tegra_dc *dc = to_tegra_dc(crtc); 881 - struct drm_device *drm = crtc->dev; 882 858 883 859 if (dc->event) 884 860 return -EBUSY; 885 861 886 862 if (event) { 887 - event->pipe = dc->pipe; 863 + event->pipe = pipe; 888 864 dc->event = event; 889 - drm_vblank_get(drm, dc->pipe); 865 + drm_crtc_vblank_get(crtc); 890 866 } 891 867 892 868 tegra_dc_set_base(dc, 0, 0, fb); ··· 1151 1127 /* 1152 1128 dev_dbg(dc->dev, "%s(): vertical blank\n", __func__); 1153 1129 */ 1154 - drm_handle_vblank(dc->base.dev, dc->pipe); 1130 + drm_crtc_handle_vblank(&dc->base); 1155 1131 tegra_dc_finish_page_flip(dc); 1156 1132 } 1157 1133
+10 -6
drivers/gpu/drm/tegra/drm.c
··· 694 694 .llseek = noop_llseek, 695 695 }; 696 696 697 - static struct drm_crtc *tegra_crtc_from_pipe(struct drm_device *drm, int pipe) 697 + static struct drm_crtc *tegra_crtc_from_pipe(struct drm_device *drm, 698 + unsigned int pipe) 698 699 { 699 700 struct drm_crtc *crtc; 700 701 701 702 list_for_each_entry(crtc, &drm->mode_config.crtc_list, head) { 702 - struct tegra_dc *dc = to_tegra_dc(crtc); 703 - 704 - if (dc->pipe == pipe) 703 + if (pipe == drm_crtc_index(crtc)) 705 704 return crtc; 706 705 } 707 706 708 707 return NULL; 709 708 } 710 709 711 - static u32 tegra_drm_get_vblank_counter(struct drm_device *dev, int crtc) 710 + static u32 tegra_drm_get_vblank_counter(struct drm_device *drm, int pipe) 712 711 { 712 + struct drm_crtc *crtc = tegra_crtc_from_pipe(drm, pipe); 713 + 714 + if (!crtc) 715 + return 0; 716 + 713 717 /* TODO: implement real hardware counter using syncpoints */ 714 - return drm_vblank_count(dev, crtc); 718 + return drm_crtc_vblank_count(crtc); 715 719 } 716 720 717 721 static int tegra_drm_enable_vblank(struct drm_device *drm, int pipe)
+39 -11
drivers/gpu/drm/tegra/gem.c
··· 216 216 } 217 217 } 218 218 219 - static int tegra_bo_get_pages(struct drm_device *drm, struct tegra_bo *bo, 220 - size_t size) 219 + static int tegra_bo_get_pages(struct drm_device *drm, struct tegra_bo *bo) 221 220 { 221 + struct scatterlist *s; 222 + struct sg_table *sgt; 223 + unsigned int i; 224 + 222 225 bo->pages = drm_gem_get_pages(&bo->gem); 223 226 if (IS_ERR(bo->pages)) 224 227 return PTR_ERR(bo->pages); 225 228 226 - bo->num_pages = size >> PAGE_SHIFT; 229 + bo->num_pages = bo->gem.size >> PAGE_SHIFT; 227 230 228 - bo->sgt = drm_prime_pages_to_sg(bo->pages, bo->num_pages); 229 - if (IS_ERR(bo->sgt)) { 230 - drm_gem_put_pages(&bo->gem, bo->pages, false, false); 231 - return PTR_ERR(bo->sgt); 231 + sgt = drm_prime_pages_to_sg(bo->pages, bo->num_pages); 232 + if (IS_ERR(sgt)) 233 + goto put_pages; 234 + 235 + /* 236 + * Fake up the SG table so that dma_map_sg() can be used to flush the 237 + * pages associated with it. Note that this relies on the fact that 238 + * the DMA API doesn't hook into IOMMU on Tegra, therefore mapping is 239 + * only cache maintenance. 240 + * 241 + * TODO: Replace this by drm_clflash_sg() once it can be implemented 242 + * without relying on symbols that are not exported. 243 + */ 244 + for_each_sg(sgt->sgl, s, sgt->nents, i) 245 + sg_dma_address(s) = sg_phys(s); 246 + 247 + if (dma_map_sg(drm->dev, sgt->sgl, sgt->nents, DMA_TO_DEVICE) == 0) { 248 + sgt = ERR_PTR(-ENOMEM); 249 + goto release_sgt; 232 250 } 233 251 252 + bo->sgt = sgt; 253 + 234 254 return 0; 255 + 256 + release_sgt: 257 + sg_free_table(sgt); 258 + kfree(sgt); 259 + put_pages: 260 + drm_gem_put_pages(&bo->gem, bo->pages, false, false); 261 + return PTR_ERR(sgt); 235 262 } 236 263 237 - static int tegra_bo_alloc(struct drm_device *drm, struct tegra_bo *bo, 238 - size_t size) 264 + static int tegra_bo_alloc(struct drm_device *drm, struct tegra_bo *bo) 239 265 { 240 266 struct tegra_drm *tegra = drm->dev_private; 241 267 int err; 242 268 243 269 if (tegra->domain) { 244 - err = tegra_bo_get_pages(drm, bo, size); 270 + err = tegra_bo_get_pages(drm, bo); 245 271 if (err < 0) 246 272 return err; 247 273 ··· 277 251 return err; 278 252 } 279 253 } else { 254 + size_t size = bo->gem.size; 255 + 280 256 bo->vaddr = dma_alloc_writecombine(drm->dev, size, &bo->paddr, 281 257 GFP_KERNEL | __GFP_NOWARN); 282 258 if (!bo->vaddr) { ··· 302 274 if (IS_ERR(bo)) 303 275 return bo; 304 276 305 - err = tegra_bo_alloc(drm, bo, size); 277 + err = tegra_bo_alloc(drm, bo); 306 278 if (err < 0) 307 279 goto release; 308 280
+44 -16
drivers/input/evdev.c
··· 28 28 #include <linux/cdev.h> 29 29 #include "input-compat.h" 30 30 31 + enum evdev_clock_type { 32 + EV_CLK_REAL = 0, 33 + EV_CLK_MONO, 34 + EV_CLK_BOOT, 35 + EV_CLK_MAX 36 + }; 37 + 31 38 struct evdev { 32 39 int open; 33 40 struct input_handle handle; ··· 56 49 struct fasync_struct *fasync; 57 50 struct evdev *evdev; 58 51 struct list_head node; 59 - int clkid; 52 + int clk_type; 60 53 bool revoked; 61 54 unsigned int bufsize; 62 55 struct input_event buffer[]; 63 56 }; 57 + 58 + static int evdev_set_clk_type(struct evdev_client *client, unsigned int clkid) 59 + { 60 + switch (clkid) { 61 + 62 + case CLOCK_REALTIME: 63 + client->clk_type = EV_CLK_REAL; 64 + break; 65 + case CLOCK_MONOTONIC: 66 + client->clk_type = EV_CLK_MONO; 67 + break; 68 + case CLOCK_BOOTTIME: 69 + client->clk_type = EV_CLK_BOOT; 70 + break; 71 + default: 72 + return -EINVAL; 73 + } 74 + 75 + return 0; 76 + } 64 77 65 78 /* flush queued events of type @type, caller must hold client->buffer_lock */ 66 79 static void __evdev_flush_queue(struct evdev_client *client, unsigned int type) ··· 135 108 struct input_event ev; 136 109 ktime_t time; 137 110 138 - time = (client->clkid == CLOCK_MONOTONIC) ? 139 - ktime_get() : ktime_get_real(); 111 + time = client->clk_type == EV_CLK_REAL ? 112 + ktime_get_real() : 113 + client->clk_type == EV_CLK_MONO ? 114 + ktime_get() : 115 + ktime_get_boottime(); 140 116 141 117 ev.time = ktime_to_timeval(time); 142 118 ev.type = EV_SYN; ··· 189 159 190 160 static void evdev_pass_values(struct evdev_client *client, 191 161 const struct input_value *vals, unsigned int count, 192 - ktime_t mono, ktime_t real) 162 + ktime_t *ev_time) 193 163 { 194 164 struct evdev *evdev = client->evdev; 195 165 const struct input_value *v; ··· 199 169 if (client->revoked) 200 170 return; 201 171 202 - event.time = ktime_to_timeval(client->clkid == CLOCK_MONOTONIC ? 203 - mono : real); 172 + event.time = ktime_to_timeval(ev_time[client->clk_type]); 204 173 205 174 /* Interrupts are disabled, just acquire the lock. */ 206 175 spin_lock(&client->buffer_lock); ··· 227 198 { 228 199 struct evdev *evdev = handle->private; 229 200 struct evdev_client *client; 230 - ktime_t time_mono, time_real; 201 + ktime_t ev_time[EV_CLK_MAX]; 231 202 232 - time_mono = ktime_get(); 233 - time_real = ktime_mono_to_real(time_mono); 203 + ev_time[EV_CLK_MONO] = ktime_get(); 204 + ev_time[EV_CLK_REAL] = ktime_mono_to_real(ev_time[EV_CLK_MONO]); 205 + ev_time[EV_CLK_BOOT] = ktime_mono_to_any(ev_time[EV_CLK_MONO], 206 + TK_OFFS_BOOT); 234 207 235 208 rcu_read_lock(); 236 209 237 210 client = rcu_dereference(evdev->grab); 238 211 239 212 if (client) 240 - evdev_pass_values(client, vals, count, time_mono, time_real); 213 + evdev_pass_values(client, vals, count, ev_time); 241 214 else 242 215 list_for_each_entry_rcu(client, &evdev->client_list, node) 243 - evdev_pass_values(client, vals, count, 244 - time_mono, time_real); 216 + evdev_pass_values(client, vals, count, ev_time); 245 217 246 218 rcu_read_unlock(); 247 219 } ··· 907 877 case EVIOCSCLOCKID: 908 878 if (copy_from_user(&i, p, sizeof(unsigned int))) 909 879 return -EFAULT; 910 - if (i != CLOCK_MONOTONIC && i != CLOCK_REALTIME) 911 - return -EINVAL; 912 - client->clkid = i; 913 - return 0; 880 + 881 + return evdev_set_clk_type(client, i); 914 882 915 883 case EVIOCGKEYCODE: 916 884 return evdev_handle_get_keycode(dev, p);
+13 -9
drivers/input/input.c
··· 1974 1974 1975 1975 events = mt_slots + 1; /* count SYN_MT_REPORT and SYN_REPORT */ 1976 1976 1977 - for (i = 0; i < ABS_CNT; i++) { 1978 - if (test_bit(i, dev->absbit)) { 1979 - if (input_is_mt_axis(i)) 1980 - events += mt_slots; 1981 - else 1982 - events++; 1977 + if (test_bit(EV_ABS, dev->evbit)) { 1978 + for (i = 0; i < ABS_CNT; i++) { 1979 + if (test_bit(i, dev->absbit)) { 1980 + if (input_is_mt_axis(i)) 1981 + events += mt_slots; 1982 + else 1983 + events++; 1984 + } 1983 1985 } 1984 1986 } 1985 1987 1986 - for (i = 0; i < REL_CNT; i++) 1987 - if (test_bit(i, dev->relbit)) 1988 - events++; 1988 + if (test_bit(EV_REL, dev->evbit)) { 1989 + for (i = 0; i < REL_CNT; i++) 1990 + if (test_bit(i, dev->relbit)) 1991 + events++; 1992 + } 1989 1993 1990 1994 /* Make room for KEY and MSC events */ 1991 1995 events += 7;
+1
drivers/input/keyboard/Kconfig
··· 559 559 config KEYBOARD_STMPE 560 560 tristate "STMPE keypad support" 561 561 depends on MFD_STMPE 562 + depends on OF 562 563 select INPUT_MATRIXKMAP 563 564 help 564 565 Say Y here if you want to use the keypad controller on STMPE I/O
+57 -57
drivers/input/keyboard/gpio_keys.c
··· 35 35 struct gpio_button_data { 36 36 const struct gpio_keys_button *button; 37 37 struct input_dev *input; 38 - struct timer_list timer; 39 - struct work_struct work; 40 - unsigned int timer_debounce; /* in msecs */ 38 + 39 + struct timer_list release_timer; 40 + unsigned int release_delay; /* in msecs, for IRQ-only buttons */ 41 + 42 + struct delayed_work work; 43 + unsigned int software_debounce; /* in msecs, for GPIO-driven buttons */ 44 + 41 45 unsigned int irq; 42 46 spinlock_t lock; 43 47 bool disabled; ··· 120 116 { 121 117 if (!bdata->disabled) { 122 118 /* 123 - * Disable IRQ and possible debouncing timer. 119 + * Disable IRQ and associated timer/work structure. 124 120 */ 125 121 disable_irq(bdata->irq); 126 - if (bdata->timer_debounce) 127 - del_timer_sync(&bdata->timer); 122 + 123 + if (gpio_is_valid(bdata->button->gpio)) 124 + cancel_delayed_work_sync(&bdata->work); 125 + else 126 + del_timer_sync(&bdata->release_timer); 128 127 129 128 bdata->disabled = true; 130 129 } ··· 350 343 static void gpio_keys_gpio_work_func(struct work_struct *work) 351 344 { 352 345 struct gpio_button_data *bdata = 353 - container_of(work, struct gpio_button_data, work); 346 + container_of(work, struct gpio_button_data, work.work); 354 347 355 348 gpio_keys_gpio_report_event(bdata); 356 349 357 350 if (bdata->button->wakeup) 358 351 pm_relax(bdata->input->dev.parent); 359 - } 360 - 361 - static void gpio_keys_gpio_timer(unsigned long _data) 362 - { 363 - struct gpio_button_data *bdata = (struct gpio_button_data *)_data; 364 - 365 - schedule_work(&bdata->work); 366 352 } 367 353 368 354 static irqreturn_t gpio_keys_gpio_isr(int irq, void *dev_id) ··· 366 366 367 367 if (bdata->button->wakeup) 368 368 pm_stay_awake(bdata->input->dev.parent); 369 - if (bdata->timer_debounce) 370 - mod_timer(&bdata->timer, 371 - jiffies + msecs_to_jiffies(bdata->timer_debounce)); 372 - else 373 - schedule_work(&bdata->work); 369 + 370 + mod_delayed_work(system_wq, 371 + &bdata->work, 372 + msecs_to_jiffies(bdata->software_debounce)); 374 373 375 374 return IRQ_HANDLED; 376 375 } ··· 407 408 input_event(input, EV_KEY, button->code, 1); 408 409 input_sync(input); 409 410 410 - if (!bdata->timer_debounce) { 411 + if (!bdata->release_delay) { 411 412 input_event(input, EV_KEY, button->code, 0); 412 413 input_sync(input); 413 414 goto out; ··· 416 417 bdata->key_pressed = true; 417 418 } 418 419 419 - if (bdata->timer_debounce) 420 - mod_timer(&bdata->timer, 421 - jiffies + msecs_to_jiffies(bdata->timer_debounce)); 420 + if (bdata->release_delay) 421 + mod_timer(&bdata->release_timer, 422 + jiffies + msecs_to_jiffies(bdata->release_delay)); 422 423 out: 423 424 spin_unlock_irqrestore(&bdata->lock, flags); 424 425 return IRQ_HANDLED; ··· 428 429 { 429 430 struct gpio_button_data *bdata = data; 430 431 431 - if (bdata->timer_debounce) 432 - del_timer_sync(&bdata->timer); 433 - 434 - cancel_work_sync(&bdata->work); 432 + if (gpio_is_valid(bdata->button->gpio)) 433 + cancel_delayed_work_sync(&bdata->work); 434 + else 435 + del_timer_sync(&bdata->release_timer); 435 436 } 436 437 437 438 static int gpio_keys_setup_key(struct platform_device *pdev, ··· 465 466 button->debounce_interval * 1000); 466 467 /* use timer if gpiolib doesn't provide debounce */ 467 468 if (error < 0) 468 - bdata->timer_debounce = 469 + bdata->software_debounce = 469 470 button->debounce_interval; 470 471 } 471 472 472 - irq = gpio_to_irq(button->gpio); 473 - if (irq < 0) { 474 - error = irq; 475 - dev_err(dev, 476 - "Unable to get irq number for GPIO %d, error %d\n", 477 - button->gpio, error); 478 - return error; 473 + if (button->irq) { 474 + bdata->irq = button->irq; 475 + } else { 476 + irq = gpio_to_irq(button->gpio); 477 + if (irq < 0) { 478 + error = irq; 479 + dev_err(dev, 480 + "Unable to get irq number for GPIO %d, error %d\n", 481 + button->gpio, error); 482 + return error; 483 + } 484 + bdata->irq = irq; 479 485 } 480 - bdata->irq = irq; 481 486 482 - INIT_WORK(&bdata->work, gpio_keys_gpio_work_func); 483 - setup_timer(&bdata->timer, 484 - gpio_keys_gpio_timer, (unsigned long)bdata); 487 + INIT_DELAYED_WORK(&bdata->work, gpio_keys_gpio_work_func); 485 488 486 489 isr = gpio_keys_gpio_isr; 487 490 irqflags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING; ··· 500 499 return -EINVAL; 501 500 } 502 501 503 - bdata->timer_debounce = button->debounce_interval; 504 - setup_timer(&bdata->timer, 502 + bdata->release_delay = button->debounce_interval; 503 + setup_timer(&bdata->release_timer, 505 504 gpio_keys_irq_timer, (unsigned long)bdata); 506 505 507 506 isr = gpio_keys_irq_isr; ··· 511 510 input_set_capability(input, button->type ?: EV_KEY, button->code); 512 511 513 512 /* 514 - * Install custom action to cancel debounce timer and 513 + * Install custom action to cancel release timer and 515 514 * workqueue item. 516 515 */ 517 516 error = devm_add_action(&pdev->dev, gpio_keys_quiesce_key, bdata); ··· 619 618 620 619 i = 0; 621 620 for_each_child_of_node(node, pp) { 622 - int gpio = -1; 623 621 enum of_gpio_flags flags; 624 622 625 623 button = &pdata->buttons[i++]; 626 624 627 - if (!of_find_property(pp, "gpios", NULL)) { 628 - button->irq = irq_of_parse_and_map(pp, 0); 629 - if (button->irq == 0) { 630 - i--; 631 - pdata->nbuttons--; 632 - dev_warn(dev, "Found button without gpios or irqs\n"); 633 - continue; 634 - } 635 - } else { 636 - gpio = of_get_gpio_flags(pp, 0, &flags); 637 - if (gpio < 0) { 638 - error = gpio; 625 + button->gpio = of_get_gpio_flags(pp, 0, &flags); 626 + if (button->gpio < 0) { 627 + error = button->gpio; 628 + if (error != -ENOENT) { 639 629 if (error != -EPROBE_DEFER) 640 630 dev_err(dev, 641 631 "Failed to get gpio flags, error: %d\n", 642 632 error); 643 633 return ERR_PTR(error); 644 634 } 635 + } else { 636 + button->active_low = flags & OF_GPIO_ACTIVE_LOW; 645 637 } 646 638 647 - button->gpio = gpio; 648 - button->active_low = flags & OF_GPIO_ACTIVE_LOW; 639 + button->irq = irq_of_parse_and_map(pp, 0); 640 + 641 + if (!gpio_is_valid(button->gpio) && !button->irq) { 642 + dev_err(dev, "Found button without gpios or irqs\n"); 643 + return ERR_PTR(-EINVAL); 644 + } 649 645 650 646 if (of_property_read_u32(pp, "linux,code", &button->code)) { 651 647 dev_err(dev, "Button without keycode: 0x%x\n", ··· 656 658 button->type = EV_KEY; 657 659 658 660 button->wakeup = !!of_get_property(pp, "gpio-key,wakeup", NULL); 661 + 662 + button->can_disable = !!of_get_property(pp, "linux,can-disable", NULL); 659 663 660 664 if (of_property_read_u32(pp, "debounce-interval", 661 665 &button->debounce_interval))
+3 -3
drivers/input/keyboard/hil_kbd.c
··· 473 473 if (error) 474 474 goto bail1; 475 475 476 - init_completion(&dev->cmd_done); 476 + reinit_completion(&dev->cmd_done); 477 477 serio_write(serio, 0); 478 478 serio_write(serio, 0); 479 479 serio_write(serio, HIL_PKT_CMD >> 8); ··· 482 482 if (error) 483 483 goto bail1; 484 484 485 - init_completion(&dev->cmd_done); 485 + reinit_completion(&dev->cmd_done); 486 486 serio_write(serio, 0); 487 487 serio_write(serio, 0); 488 488 serio_write(serio, HIL_PKT_CMD >> 8); ··· 491 491 if (error) 492 492 goto bail1; 493 493 494 - init_completion(&dev->cmd_done); 494 + reinit_completion(&dev->cmd_done); 495 495 serio_write(serio, 0); 496 496 serio_write(serio, 0); 497 497 serio_write(serio, HIL_PKT_CMD >> 8);
+80 -61
drivers/input/keyboard/stmpe-keypad.c
··· 45 45 #define STMPE_KEYPAD_MAX_ROWS 8 46 46 #define STMPE_KEYPAD_MAX_COLS 8 47 47 #define STMPE_KEYPAD_ROW_SHIFT 3 48 - #define STMPE_KEYPAD_KEYMAP_SIZE \ 48 + #define STMPE_KEYPAD_KEYMAP_MAX_SIZE \ 49 49 (STMPE_KEYPAD_MAX_ROWS * STMPE_KEYPAD_MAX_COLS) 50 50 51 51 /** 52 52 * struct stmpe_keypad_variant - model-specific attributes 53 53 * @auto_increment: whether the KPC_DATA_BYTE register address 54 54 * auto-increments on multiple read 55 + * @set_pullup: whether the pins need to have their pull-ups set 55 56 * @num_data: number of data bytes 56 57 * @num_normal_data: number of normal keys' data bytes 57 58 * @max_cols: maximum number of columns supported ··· 62 61 */ 63 62 struct stmpe_keypad_variant { 64 63 bool auto_increment; 64 + bool set_pullup; 65 65 int num_data; 66 66 int num_normal_data; 67 67 int max_cols; ··· 83 81 }, 84 82 [STMPE2401] = { 85 83 .auto_increment = false, 84 + .set_pullup = true, 86 85 .num_data = 3, 87 86 .num_normal_data = 2, 88 87 .max_cols = 8, ··· 93 90 }, 94 91 [STMPE2403] = { 95 92 .auto_increment = true, 93 + .set_pullup = true, 96 94 .num_data = 5, 97 95 .num_normal_data = 3, 98 96 .max_cols = 8, ··· 103 99 }, 104 100 }; 105 101 102 + /** 103 + * struct stmpe_keypad - STMPE keypad state container 104 + * @stmpe: pointer to parent STMPE device 105 + * @input: spawned input device 106 + * @variant: STMPE variant 107 + * @debounce_ms: debounce interval, in ms. Maximum is 108 + * %STMPE_KEYPAD_MAX_DEBOUNCE. 109 + * @scan_count: number of key scanning cycles to confirm key data. 110 + * Maximum is %STMPE_KEYPAD_MAX_SCAN_COUNT. 111 + * @no_autorepeat: disable key autorepeat 112 + * @rows: bitmask for the rows 113 + * @cols: bitmask for the columns 114 + * @keymap: the keymap 115 + */ 106 116 struct stmpe_keypad { 107 117 struct stmpe *stmpe; 108 118 struct input_dev *input; 109 119 const struct stmpe_keypad_variant *variant; 110 - const struct stmpe_keypad_platform_data *plat; 111 - 120 + unsigned int debounce_ms; 121 + unsigned int scan_count; 122 + bool no_autorepeat; 112 123 unsigned int rows; 113 124 unsigned int cols; 114 - 115 - unsigned short keymap[STMPE_KEYPAD_KEYMAP_SIZE]; 125 + unsigned short keymap[STMPE_KEYPAD_KEYMAP_MAX_SIZE]; 116 126 }; 117 127 118 128 static int stmpe_keypad_read_data(struct stmpe_keypad *keypad, u8 *data) ··· 189 171 unsigned int col_gpios = variant->col_gpios; 190 172 unsigned int row_gpios = variant->row_gpios; 191 173 struct stmpe *stmpe = keypad->stmpe; 174 + u8 pureg = stmpe->regs[STMPE_IDX_GPPUR_LSB]; 192 175 unsigned int pins = 0; 176 + unsigned int pu_pins = 0; 177 + int ret; 193 178 int i; 194 179 195 180 /* ··· 209 188 for (i = 0; i < variant->max_cols; i++) { 210 189 int num = __ffs(col_gpios); 211 190 212 - if (keypad->cols & (1 << i)) 191 + if (keypad->cols & (1 << i)) { 213 192 pins |= 1 << num; 193 + pu_pins |= 1 << num; 194 + } 214 195 215 196 col_gpios &= ~(1 << num); 216 197 } ··· 226 203 row_gpios &= ~(1 << num); 227 204 } 228 205 229 - return stmpe_set_altfunc(stmpe, pins, STMPE_BLOCK_KEYPAD); 206 + ret = stmpe_set_altfunc(stmpe, pins, STMPE_BLOCK_KEYPAD); 207 + if (ret) 208 + return ret; 209 + 210 + /* 211 + * On STMPE24xx, set pin bias to pull-up on all keypad input 212 + * pins (columns), this incidentally happen to be maximum 8 pins 213 + * and placed at GPIO0-7 so only the LSB of the pull up register 214 + * ever needs to be written. 215 + */ 216 + if (variant->set_pullup) { 217 + u8 val; 218 + 219 + ret = stmpe_reg_read(stmpe, pureg); 220 + if (ret) 221 + return ret; 222 + 223 + /* Do not touch unused pins, may be used for GPIO */ 224 + val = ret & ~pu_pins; 225 + val |= pu_pins; 226 + 227 + ret = stmpe_reg_write(stmpe, pureg, val); 228 + } 229 + 230 + return 0; 230 231 } 231 232 232 233 static int stmpe_keypad_chip_init(struct stmpe_keypad *keypad) 233 234 { 234 - const struct stmpe_keypad_platform_data *plat = keypad->plat; 235 235 const struct stmpe_keypad_variant *variant = keypad->variant; 236 236 struct stmpe *stmpe = keypad->stmpe; 237 237 int ret; 238 238 239 - if (plat->debounce_ms > STMPE_KEYPAD_MAX_DEBOUNCE) 239 + if (keypad->debounce_ms > STMPE_KEYPAD_MAX_DEBOUNCE) 240 240 return -EINVAL; 241 241 242 - if (plat->scan_count > STMPE_KEYPAD_MAX_SCAN_COUNT) 242 + if (keypad->scan_count > STMPE_KEYPAD_MAX_SCAN_COUNT) 243 243 return -EINVAL; 244 244 245 245 ret = stmpe_enable(stmpe, STMPE_BLOCK_KEYPAD); ··· 291 245 292 246 ret = stmpe_set_bits(stmpe, STMPE_KPC_CTRL_MSB, 293 247 STMPE_KPC_CTRL_MSB_SCAN_COUNT, 294 - plat->scan_count << 4); 248 + keypad->scan_count << 4); 295 249 if (ret < 0) 296 250 return ret; 297 251 ··· 299 253 STMPE_KPC_CTRL_LSB_SCAN | 300 254 STMPE_KPC_CTRL_LSB_DEBOUNCE, 301 255 STMPE_KPC_CTRL_LSB_SCAN | 302 - (plat->debounce_ms << 1)); 256 + (keypad->debounce_ms << 1)); 303 257 } 304 258 305 - static void stmpe_keypad_fill_used_pins(struct stmpe_keypad *keypad) 259 + static void stmpe_keypad_fill_used_pins(struct stmpe_keypad *keypad, 260 + u32 used_rows, u32 used_cols) 306 261 { 307 262 int row, col; 308 263 309 - for (row = 0; row < STMPE_KEYPAD_MAX_ROWS; row++) { 310 - for (col = 0; col < STMPE_KEYPAD_MAX_COLS; col++) { 264 + for (row = 0; row < used_rows; row++) { 265 + for (col = 0; col < used_cols; col++) { 311 266 int code = MATRIX_SCAN_CODE(row, col, 312 - STMPE_KEYPAD_ROW_SHIFT); 267 + STMPE_KEYPAD_ROW_SHIFT); 313 268 if (keypad->keymap[code] != KEY_RESERVED) { 314 269 keypad->rows |= 1 << row; 315 270 keypad->cols |= 1 << col; ··· 319 272 } 320 273 } 321 274 322 - #ifdef CONFIG_OF 323 - static const struct stmpe_keypad_platform_data * 324 - stmpe_keypad_of_probe(struct device *dev) 325 - { 326 - struct device_node *np = dev->of_node; 327 - struct stmpe_keypad_platform_data *plat; 328 - 329 - if (!np) 330 - return ERR_PTR(-ENODEV); 331 - 332 - plat = devm_kzalloc(dev, sizeof(*plat), GFP_KERNEL); 333 - if (!plat) 334 - return ERR_PTR(-ENOMEM); 335 - 336 - of_property_read_u32(np, "debounce-interval", &plat->debounce_ms); 337 - of_property_read_u32(np, "st,scan-count", &plat->scan_count); 338 - 339 - plat->no_autorepeat = of_property_read_bool(np, "st,no-autorepeat"); 340 - 341 - return plat; 342 - } 343 - #else 344 - static inline const struct stmpe_keypad_platform_data * 345 - stmpe_keypad_of_probe(struct device *dev) 346 - { 347 - return ERR_PTR(-EINVAL); 348 - } 349 - #endif 350 - 351 275 static int stmpe_keypad_probe(struct platform_device *pdev) 352 276 { 353 277 struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent); 354 - const struct stmpe_keypad_platform_data *plat; 278 + struct device_node *np = pdev->dev.of_node; 355 279 struct stmpe_keypad *keypad; 356 280 struct input_dev *input; 281 + u32 rows; 282 + u32 cols; 357 283 int error; 358 284 int irq; 359 - 360 - plat = stmpe->pdata->keypad; 361 - if (!plat) { 362 - plat = stmpe_keypad_of_probe(&pdev->dev); 363 - if (IS_ERR(plat)) 364 - return PTR_ERR(plat); 365 - } 366 285 367 286 irq = platform_get_irq(pdev, 0); 368 287 if (irq < 0) ··· 339 326 if (!keypad) 340 327 return -ENOMEM; 341 328 329 + keypad->stmpe = stmpe; 330 + keypad->variant = &stmpe_keypad_variants[stmpe->partnum]; 331 + 332 + of_property_read_u32(np, "debounce-interval", &keypad->debounce_ms); 333 + of_property_read_u32(np, "st,scan-count", &keypad->scan_count); 334 + keypad->no_autorepeat = of_property_read_bool(np, "st,no-autorepeat"); 335 + 342 336 input = devm_input_allocate_device(&pdev->dev); 343 337 if (!input) 344 338 return -ENOMEM; ··· 354 334 input->id.bustype = BUS_I2C; 355 335 input->dev.parent = &pdev->dev; 356 336 357 - error = matrix_keypad_build_keymap(plat->keymap_data, NULL, 358 - STMPE_KEYPAD_MAX_ROWS, 359 - STMPE_KEYPAD_MAX_COLS, 337 + error = matrix_keypad_parse_of_params(&pdev->dev, &rows, &cols); 338 + if (error) 339 + return error; 340 + 341 + error = matrix_keypad_build_keymap(NULL, NULL, rows, cols, 360 342 keypad->keymap, input); 361 343 if (error) 362 344 return error; 363 345 364 346 input_set_capability(input, EV_MSC, MSC_SCAN); 365 - if (!plat->no_autorepeat) 347 + if (!keypad->no_autorepeat) 366 348 __set_bit(EV_REP, input->evbit); 367 349 368 - stmpe_keypad_fill_used_pins(keypad); 350 + stmpe_keypad_fill_used_pins(keypad, rows, cols); 369 351 370 - keypad->stmpe = stmpe; 371 - keypad->plat = plat; 372 352 keypad->input = input; 373 - keypad->variant = &stmpe_keypad_variants[stmpe->partnum]; 374 353 375 354 error = stmpe_keypad_chip_init(keypad); 376 355 if (error < 0)
+74 -10
drivers/input/mouse/alps.c
··· 881 881 unsigned char *pkt, 882 882 unsigned char pkt_id) 883 883 { 884 + /* 885 + * packet-fmt b7 b6 b5 b4 b3 b2 b1 b0 886 + * Byte0 TWO & MULTI L 1 R M 1 Y0-2 Y0-1 Y0-0 887 + * Byte0 NEW L 1 X1-5 1 1 Y0-2 Y0-1 Y0-0 888 + * Byte1 Y0-10 Y0-9 Y0-8 Y0-7 Y0-6 Y0-5 Y0-4 Y0-3 889 + * Byte2 X0-11 1 X0-10 X0-9 X0-8 X0-7 X0-6 X0-5 890 + * Byte3 X1-11 1 X0-4 X0-3 1 X0-2 X0-1 X0-0 891 + * Byte4 TWO X1-10 TWO X1-9 X1-8 X1-7 X1-6 X1-5 X1-4 892 + * Byte4 MULTI X1-10 TWO X1-9 X1-8 X1-7 X1-6 Y1-5 1 893 + * Byte4 NEW X1-10 TWO X1-9 X1-8 X1-7 X1-6 0 0 894 + * Byte5 TWO & NEW Y1-10 0 Y1-9 Y1-8 Y1-7 Y1-6 Y1-5 Y1-4 895 + * Byte5 MULTI Y1-10 0 Y1-9 Y1-8 Y1-7 Y1-6 F-1 F-0 896 + * L: Left button 897 + * R / M: Non-clickpads: Right / Middle button 898 + * Clickpads: When > 2 fingers are down, and some fingers 899 + * are in the button area, then the 2 coordinates reported 900 + * are for fingers outside the button area and these report 901 + * extra fingers being present in the right / left button 902 + * area. Note these fingers are not added to the F field! 903 + * so if a TWO packet is received and R = 1 then there are 904 + * 3 fingers down, etc. 905 + * TWO: 1: Two touches present, byte 0/4/5 are in TWO fmt 906 + * 0: If byte 4 bit 0 is 1, then byte 0/4/5 are in MULTI fmt 907 + * otherwise byte 0 bit 4 must be set and byte 0/4/5 are 908 + * in NEW fmt 909 + * F: Number of fingers - 3, 0 means 3 fingers, 1 means 4 ... 910 + */ 911 + 884 912 mt[0].x = ((pkt[2] & 0x80) << 4); 885 913 mt[0].x |= ((pkt[2] & 0x3F) << 5); 886 914 mt[0].x |= ((pkt[3] & 0x30) >> 1); ··· 947 919 948 920 static int alps_get_mt_count(struct input_mt_pos *mt) 949 921 { 950 - int i; 922 + int i, fingers = 0; 951 923 952 - for (i = 0; i < MAX_TOUCHES && mt[i].x != 0 && mt[i].y != 0; i++) 953 - /* empty */; 924 + for (i = 0; i < MAX_TOUCHES; i++) { 925 + if (mt[i].x != 0 || mt[i].y != 0) 926 + fingers++; 927 + } 954 928 955 - return i; 929 + return fingers; 956 930 } 957 931 958 932 static int alps_decode_packet_v7(struct alps_fields *f, 959 933 unsigned char *p, 960 934 struct psmouse *psmouse) 961 935 { 936 + struct alps_data *priv = psmouse->private; 962 937 unsigned char pkt_id; 963 938 964 939 pkt_id = alps_get_packet_id_v7(p); ··· 969 938 return 0; 970 939 if (pkt_id == V7_PACKET_ID_UNKNOWN) 971 940 return -1; 941 + /* 942 + * NEW packets are send to indicate a discontinuity in the finger 943 + * coordinate reporting. Specifically a finger may have moved from 944 + * slot 0 to 1 or vice versa. INPUT_MT_TRACK takes care of this for 945 + * us. 946 + * 947 + * NEW packets have 3 problems: 948 + * 1) They do not contain middle / right button info (on non clickpads) 949 + * this can be worked around by preserving the old button state 950 + * 2) They do not contain an accurate fingercount, and they are 951 + * typically send when the number of fingers changes. We cannot use 952 + * the old finger count as that may mismatch with the amount of 953 + * touch coordinates we've available in the NEW packet 954 + * 3) Their x data for the second touch is inaccurate leading to 955 + * a possible jump of the x coordinate by 16 units when the first 956 + * non NEW packet comes in 957 + * Since problems 2 & 3 cannot be worked around, just ignore them. 958 + */ 959 + if (pkt_id == V7_PACKET_ID_NEW) 960 + return 1; 972 961 973 962 alps_get_finger_coordinate_v7(f->mt, p, pkt_id); 974 963 975 - if (pkt_id == V7_PACKET_ID_TWO || pkt_id == V7_PACKET_ID_MULTI) { 976 - f->left = (p[0] & 0x80) >> 7; 964 + if (pkt_id == V7_PACKET_ID_TWO) 965 + f->fingers = alps_get_mt_count(f->mt); 966 + else /* pkt_id == V7_PACKET_ID_MULTI */ 967 + f->fingers = 3 + (p[5] & 0x03); 968 + 969 + f->left = (p[0] & 0x80) >> 7; 970 + if (priv->flags & ALPS_BUTTONPAD) { 971 + if (p[0] & 0x20) 972 + f->fingers++; 973 + if (p[0] & 0x10) 974 + f->fingers++; 975 + } else { 977 976 f->right = (p[0] & 0x20) >> 5; 978 977 f->middle = (p[0] & 0x10) >> 4; 979 978 } 980 979 981 - if (pkt_id == V7_PACKET_ID_TWO) 982 - f->fingers = alps_get_mt_count(f->mt); 983 - else if (pkt_id == V7_PACKET_ID_MULTI) 984 - f->fingers = 3 + (p[5] & 0x03); 980 + /* Sometimes a single touch is reported in mt[1] rather then mt[0] */ 981 + if (f->fingers == 1 && f->mt[0].x == 0 && f->mt[0].y == 0) { 982 + f->mt[0].x = f->mt[1].x; 983 + f->mt[0].y = f->mt[1].y; 984 + f->mt[1].x = 0; 985 + f->mt[1].y = 0; 986 + } 985 987 986 988 return 0; 987 989 }
+4
drivers/input/mouse/trackpoint.c
··· 227 227 TRACKPOINT_INT_ATTR(upthresh, TP_UP_THRESH, TP_DEF_UP_THRESH); 228 228 TRACKPOINT_INT_ATTR(ztime, TP_Z_TIME, TP_DEF_Z_TIME); 229 229 TRACKPOINT_INT_ATTR(jenks, TP_JENKS_CURV, TP_DEF_JENKS_CURV); 230 + TRACKPOINT_INT_ATTR(drift_time, TP_DRIFT_TIME, TP_DEF_DRIFT_TIME); 230 231 231 232 TRACKPOINT_BIT_ATTR(press_to_select, TP_TOGGLE_PTSON, TP_MASK_PTSON, 0, 232 233 TP_DEF_PTSON); ··· 247 246 &psmouse_attr_upthresh.dattr.attr, 248 247 &psmouse_attr_ztime.dattr.attr, 249 248 &psmouse_attr_jenks.dattr.attr, 249 + &psmouse_attr_drift_time.dattr.attr, 250 250 &psmouse_attr_press_to_select.dattr.attr, 251 251 &psmouse_attr_skipback.dattr.attr, 252 252 &psmouse_attr_ext_dev.dattr.attr, ··· 314 312 TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, upthresh); 315 313 TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, ztime); 316 314 TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, jenks); 315 + TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, drift_time); 317 316 318 317 /* toggles */ 319 318 TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, press_to_select); ··· 335 332 TRACKPOINT_SET_POWER_ON_DEFAULT(tp, upthresh); 336 333 TRACKPOINT_SET_POWER_ON_DEFAULT(tp, ztime); 337 334 TRACKPOINT_SET_POWER_ON_DEFAULT(tp, jenks); 335 + TRACKPOINT_SET_POWER_ON_DEFAULT(tp, drift_time); 338 336 TRACKPOINT_SET_POWER_ON_DEFAULT(tp, inertia); 339 337 340 338 /* toggles */
+5
drivers/input/mouse/trackpoint.h
··· 70 70 #define TP_UP_THRESH 0x5A /* Used to generate a 'click' on Z-axis */ 71 71 #define TP_Z_TIME 0x5E /* How sharp of a press */ 72 72 #define TP_JENKS_CURV 0x5D /* Minimum curvature for double click */ 73 + #define TP_DRIFT_TIME 0x5F /* How long a 'hands off' condition */ 74 + /* must last (x*107ms) for drift */ 75 + /* correction to occur */ 73 76 74 77 /* 75 78 * Toggling Flag bits ··· 123 120 #define TP_DEF_UP_THRESH 0xFF 124 121 #define TP_DEF_Z_TIME 0x26 125 122 #define TP_DEF_JENKS_CURV 0x87 123 + #define TP_DEF_DRIFT_TIME 0x05 126 124 127 125 /* Toggles */ 128 126 #define TP_DEF_MB 0x00 ··· 141 137 unsigned char draghys, mindrag; 142 138 unsigned char thresh, upthresh; 143 139 unsigned char ztime, jenks; 140 + unsigned char drift_time; 144 141 145 142 /* toggles */ 146 143 unsigned char press_to_select;
+26 -73
drivers/input/touchscreen/atmel_mxt_ts.c
··· 99 99 #define MXT_T6_STATUS_COMSERR (1 << 2) 100 100 101 101 /* MXT_GEN_POWER_T7 field */ 102 - struct t7_config { 103 - u8 idle; 104 - u8 active; 105 - } __packed; 106 - 107 - #define MXT_POWER_CFG_RUN 0 108 - #define MXT_POWER_CFG_DEEPSLEEP 1 102 + #define MXT_POWER_IDLEACQINT 0 103 + #define MXT_POWER_ACTVACQINT 1 104 + #define MXT_POWER_ACTV2IDLETO 2 109 105 110 106 /* MXT_GEN_ACQUIRE_T8 field */ 111 107 #define MXT_ACQUIRE_CHRGTIME 0 ··· 113 117 #define MXT_ACQUIRE_ATCHCALSTHR 7 114 118 115 119 /* MXT_TOUCH_MULTI_T9 field */ 120 + #define MXT_TOUCH_CTRL 0 116 121 #define MXT_T9_ORIENT 9 117 122 #define MXT_T9_RANGE 18 118 123 ··· 253 256 bool update_input; 254 257 u8 last_message_count; 255 258 u8 num_touchids; 256 - struct t7_config t7_cfg; 257 259 258 260 /* Cached parameters from object table */ 259 261 u16 T5_address; ··· 666 670 667 671 /* Save current status */ 668 672 data->t6_status = status; 673 + } 674 + 675 + static int mxt_write_object(struct mxt_data *data, 676 + u8 type, u8 offset, u8 val) 677 + { 678 + struct mxt_object *object; 679 + u16 reg; 680 + 681 + object = mxt_get_object(data, type); 682 + if (!object || offset >= mxt_obj_size(object)) 683 + return -EINVAL; 684 + 685 + reg = object->start_address; 686 + return mxt_write_reg(data->client, reg + offset, val); 669 687 } 670 688 671 689 static void mxt_input_button(struct mxt_data *data, u8 *message) ··· 1752 1742 return error; 1753 1743 } 1754 1744 1755 - static int mxt_set_t7_power_cfg(struct mxt_data *data, u8 sleep) 1756 - { 1757 - struct device *dev = &data->client->dev; 1758 - int error; 1759 - struct t7_config *new_config; 1760 - struct t7_config deepsleep = { .active = 0, .idle = 0 }; 1761 - 1762 - if (sleep == MXT_POWER_CFG_DEEPSLEEP) 1763 - new_config = &deepsleep; 1764 - else 1765 - new_config = &data->t7_cfg; 1766 - 1767 - error = __mxt_write_reg(data->client, data->T7_address, 1768 - sizeof(data->t7_cfg), new_config); 1769 - if (error) 1770 - return error; 1771 - 1772 - dev_dbg(dev, "Set T7 ACTV:%d IDLE:%d\n", 1773 - new_config->active, new_config->idle); 1774 - 1775 - return 0; 1776 - } 1777 - 1778 - static int mxt_init_t7_power_cfg(struct mxt_data *data) 1779 - { 1780 - struct device *dev = &data->client->dev; 1781 - int error; 1782 - bool retry = false; 1783 - 1784 - recheck: 1785 - error = __mxt_read_reg(data->client, data->T7_address, 1786 - sizeof(data->t7_cfg), &data->t7_cfg); 1787 - if (error) 1788 - return error; 1789 - 1790 - if (data->t7_cfg.active == 0 || data->t7_cfg.idle == 0) { 1791 - if (!retry) { 1792 - dev_dbg(dev, "T7 cfg zero, resetting\n"); 1793 - mxt_soft_reset(data); 1794 - retry = true; 1795 - goto recheck; 1796 - } else { 1797 - dev_dbg(dev, "T7 cfg zero after reset, overriding\n"); 1798 - data->t7_cfg.active = 20; 1799 - data->t7_cfg.idle = 100; 1800 - return mxt_set_t7_power_cfg(data, MXT_POWER_CFG_RUN); 1801 - } 1802 - } 1803 - 1804 - dev_dbg(dev, "Initialized power cfg: ACTV %d, IDLE %d\n", 1805 - data->t7_cfg.active, data->t7_cfg.idle); 1806 - return 0; 1807 - } 1808 - 1809 1745 static int mxt_configure_objects(struct mxt_data *data, 1810 1746 const struct firmware *cfg) 1811 1747 { ··· 1763 1807 error = mxt_update_cfg(data, cfg); 1764 1808 if (error) 1765 1809 dev_warn(dev, "Error %d updating config\n", error); 1766 - } 1767 - 1768 - error = mxt_init_t7_power_cfg(data); 1769 - if (error) { 1770 - dev_err(dev, "Failed to initialize power cfg\n"); 1771 - return error; 1772 1810 } 1773 1811 1774 1812 error = mxt_initialize_t9_input_device(data); ··· 2043 2093 2044 2094 static void mxt_start(struct mxt_data *data) 2045 2095 { 2046 - mxt_set_t7_power_cfg(data, MXT_POWER_CFG_RUN); 2047 - 2048 - /* Recalibrate since chip has been in deep sleep */ 2049 - mxt_t6_command(data, MXT_COMMAND_CALIBRATE, 1, false); 2096 + /* Touch enable */ 2097 + mxt_write_object(data, 2098 + MXT_TOUCH_MULTI_T9, MXT_TOUCH_CTRL, 0x83); 2050 2099 } 2051 2100 2052 2101 static void mxt_stop(struct mxt_data *data) 2053 2102 { 2054 - mxt_set_t7_power_cfg(data, MXT_POWER_CFG_DEEPSLEEP); 2103 + /* Touch disable */ 2104 + mxt_write_object(data, 2105 + MXT_TOUCH_MULTI_T9, MXT_TOUCH_CTRL, 0); 2055 2106 } 2056 2107 2057 2108 static int mxt_input_open(struct input_dev *dev) ··· 2216 2265 struct i2c_client *client = to_i2c_client(dev); 2217 2266 struct mxt_data *data = i2c_get_clientdata(client); 2218 2267 struct input_dev *input_dev = data->input_dev; 2268 + 2269 + mxt_soft_reset(data); 2219 2270 2220 2271 mutex_lock(&input_dev->mutex); 2221 2272
+3 -1
drivers/input/touchscreen/edt-ft5x06.c
··· 850 850 } 851 851 852 852 #define EDT_ATTR_CHECKSET(name, reg) \ 853 + do { \ 853 854 if (pdata->name >= edt_ft5x06_attr_##name.limit_low && \ 854 855 pdata->name <= edt_ft5x06_attr_##name.limit_high) \ 855 - edt_ft5x06_register_write(tsdata, reg, pdata->name) 856 + edt_ft5x06_register_write(tsdata, reg, pdata->name); \ 857 + } while (0) 856 858 857 859 #define EDT_GET_PROP(name, reg) { \ 858 860 u32 val; \
+23 -6
drivers/md/dm-thin.c
··· 1127 1127 schedule_zero(tc, virt_block, data_dest, cell, bio); 1128 1128 } 1129 1129 1130 + static void set_pool_mode(struct pool *pool, enum pool_mode new_mode); 1131 + 1132 + static void check_for_space(struct pool *pool) 1133 + { 1134 + int r; 1135 + dm_block_t nr_free; 1136 + 1137 + if (get_pool_mode(pool) != PM_OUT_OF_DATA_SPACE) 1138 + return; 1139 + 1140 + r = dm_pool_get_free_block_count(pool->pmd, &nr_free); 1141 + if (r) 1142 + return; 1143 + 1144 + if (nr_free) 1145 + set_pool_mode(pool, PM_WRITE); 1146 + } 1147 + 1130 1148 /* 1131 1149 * A non-zero return indicates read_only or fail_io mode. 1132 1150 * Many callers don't care about the return value. ··· 1159 1141 r = dm_pool_commit_metadata(pool->pmd); 1160 1142 if (r) 1161 1143 metadata_operation_failed(pool, "dm_pool_commit_metadata", r); 1144 + else 1145 + check_for_space(pool); 1162 1146 1163 1147 return r; 1164 1148 } ··· 1178 1158 dm_table_event(pool->ti->table); 1179 1159 } 1180 1160 } 1181 - 1182 - static void set_pool_mode(struct pool *pool, enum pool_mode new_mode); 1183 1161 1184 1162 static int alloc_data_block(struct thin_c *tc, dm_block_t *result) 1185 1163 { ··· 2173 2155 pool->process_cell = process_cell_read_only; 2174 2156 pool->process_discard_cell = process_discard_cell; 2175 2157 pool->process_prepared_mapping = process_prepared_mapping; 2176 - pool->process_prepared_discard = process_prepared_discard_passdown; 2158 + pool->process_prepared_discard = process_prepared_discard; 2177 2159 2178 2160 if (!pool->pf.error_if_no_space && no_space_timeout) 2179 2161 queue_delayed_work(pool->wq, &pool->no_space_timeout, no_space_timeout); ··· 3832 3814 r = -EINVAL; 3833 3815 goto bad; 3834 3816 } 3817 + atomic_set(&tc->refcount, 1); 3818 + init_completion(&tc->can_destroy); 3835 3819 list_add_tail_rcu(&tc->list, &tc->pool->active_thins); 3836 3820 spin_unlock_irqrestore(&tc->pool->lock, flags); 3837 3821 /* ··· 3845 3825 synchronize_rcu(); 3846 3826 3847 3827 dm_put(pool_md); 3848 - 3849 - atomic_set(&tc->refcount, 1); 3850 - init_completion(&tc->can_destroy); 3851 3828 3852 3829 return 0; 3853 3830
+1 -1
drivers/md/dm.c
··· 899 899 900 900 static void clone_endio(struct bio *bio, int error) 901 901 { 902 - int r = 0; 902 + int r = error; 903 903 struct dm_target_io *tio = container_of(bio, struct dm_target_io, clone); 904 904 struct dm_io *io = tio->io; 905 905 struct mapped_device *md = tio->io->md;
+4
drivers/mfd/stmpe.c
··· 519 519 [STMPE_IDX_GPDR_LSB] = STMPE1601_REG_GPIO_SET_DIR_LSB, 520 520 [STMPE_IDX_GPRER_LSB] = STMPE1601_REG_GPIO_RE_LSB, 521 521 [STMPE_IDX_GPFER_LSB] = STMPE1601_REG_GPIO_FE_LSB, 522 + [STMPE_IDX_GPPUR_LSB] = STMPE1601_REG_GPIO_PU_LSB, 522 523 [STMPE_IDX_GPAFR_U_MSB] = STMPE1601_REG_GPIO_AF_U_MSB, 523 524 [STMPE_IDX_IEGPIOR_LSB] = STMPE1601_REG_INT_EN_GPIO_MASK_LSB, 524 525 [STMPE_IDX_ISGPIOR_MSB] = STMPE1601_REG_INT_STA_GPIO_MSB, ··· 668 667 [STMPE_IDX_GPDR_LSB] = STMPE1801_REG_GPIO_SET_DIR_LOW, 669 668 [STMPE_IDX_GPRER_LSB] = STMPE1801_REG_GPIO_RE_LOW, 670 669 [STMPE_IDX_GPFER_LSB] = STMPE1801_REG_GPIO_FE_LOW, 670 + [STMPE_IDX_GPPUR_LSB] = STMPE1801_REG_GPIO_PULL_UP_LOW, 671 671 [STMPE_IDX_IEGPIOR_LSB] = STMPE1801_REG_INT_EN_GPIO_MASK_LOW, 672 672 [STMPE_IDX_ISGPIOR_LSB] = STMPE1801_REG_INT_STA_GPIO_LOW, 673 673 }; ··· 752 750 [STMPE_IDX_GPDR_LSB] = STMPE24XX_REG_GPDR_LSB, 753 751 [STMPE_IDX_GPRER_LSB] = STMPE24XX_REG_GPRER_LSB, 754 752 [STMPE_IDX_GPFER_LSB] = STMPE24XX_REG_GPFER_LSB, 753 + [STMPE_IDX_GPPUR_LSB] = STMPE24XX_REG_GPPUR_LSB, 754 + [STMPE_IDX_GPPDR_LSB] = STMPE24XX_REG_GPPDR_LSB, 755 755 [STMPE_IDX_GPAFR_U_MSB] = STMPE24XX_REG_GPAFR_U_MSB, 756 756 [STMPE_IDX_IEGPIOR_LSB] = STMPE24XX_REG_IEGPIOR_LSB, 757 757 [STMPE_IDX_ISGPIOR_MSB] = STMPE24XX_REG_ISGPIOR_MSB,
+3
drivers/mfd/stmpe.h
··· 188 188 #define STMPE1601_REG_GPIO_ED_MSB 0x8A 189 189 #define STMPE1601_REG_GPIO_RE_LSB 0x8D 190 190 #define STMPE1601_REG_GPIO_FE_LSB 0x8F 191 + #define STMPE1601_REG_GPIO_PU_LSB 0x91 191 192 #define STMPE1601_REG_GPIO_AF_U_MSB 0x92 192 193 193 194 #define STMPE1601_SYS_CTRL_ENABLE_GPIO (1 << 3) ··· 277 276 #define STMPE24XX_REG_GPEDR_MSB 0x8C 278 277 #define STMPE24XX_REG_GPRER_LSB 0x91 279 278 #define STMPE24XX_REG_GPFER_LSB 0x94 279 + #define STMPE24XX_REG_GPPUR_LSB 0x97 280 + #define STMPE24XX_REG_GPPDR_LSB 0x9a 280 281 #define STMPE24XX_REG_GPAFR_U_MSB 0x9B 281 282 282 283 #define STMPE24XX_SYS_CTRL_ENABLE_GPIO (1 << 3)
+1 -1
drivers/mmc/core/mmc.c
··· 886 886 unsigned idx, bus_width = 0; 887 887 int err = 0; 888 888 889 - if (!mmc_can_ext_csd(card) && 889 + if (!mmc_can_ext_csd(card) || 890 890 !(host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) 891 891 return 0; 892 892
+1 -1
drivers/net/bonding/bond_main.c
··· 1648 1648 /* slave is not a slave or master is not master of this slave */ 1649 1649 if (!(slave_dev->flags & IFF_SLAVE) || 1650 1650 !netdev_has_upper_dev(slave_dev, bond_dev)) { 1651 - netdev_err(bond_dev, "cannot release %s\n", 1651 + netdev_dbg(bond_dev, "cannot release %s\n", 1652 1652 slave_dev->name); 1653 1653 return -EINVAL; 1654 1654 }
-2
drivers/net/caif/caif_virtio.c
··· 257 257 struct vringh_kiov *riov = &cfv->ctx.riov; 258 258 unsigned int skb_len; 259 259 260 - again: 261 260 do { 262 261 skb = NULL; 263 262 ··· 321 322 napi_schedule_prep(napi)) { 322 323 vringh_notify_disable_kern(cfv->vr_rx); 323 324 __napi_schedule(napi); 324 - goto again; 325 325 } 326 326 break; 327 327
+4 -2
drivers/net/ethernet/8390/ne2k-pci.c
··· 246 246 247 247 if (!ioaddr || ((pci_resource_flags (pdev, 0) & IORESOURCE_IO) == 0)) { 248 248 dev_err(&pdev->dev, "no I/O resource at PCI BAR #0\n"); 249 - return -ENODEV; 249 + goto err_out; 250 250 } 251 251 252 252 if (request_region (ioaddr, NE_IO_EXTENT, DRV_NAME) == NULL) { 253 253 dev_err(&pdev->dev, "I/O resource 0x%x @ 0x%lx busy\n", 254 254 NE_IO_EXTENT, ioaddr); 255 - return -EBUSY; 255 + goto err_out; 256 256 } 257 257 258 258 reg0 = inb(ioaddr); ··· 392 392 free_netdev (dev); 393 393 err_out_free_res: 394 394 release_region (ioaddr, NE_IO_EXTENT); 395 + err_out: 396 + pci_disable_device(pdev); 395 397 return -ENODEV; 396 398 } 397 399
-12
drivers/net/ethernet/Kconfig
··· 156 156 source "drivers/net/ethernet/renesas/Kconfig" 157 157 source "drivers/net/ethernet/rdc/Kconfig" 158 158 source "drivers/net/ethernet/rocker/Kconfig" 159 - 160 - config S6GMAC 161 - tristate "S6105 GMAC ethernet support" 162 - depends on XTENSA_VARIANT_S6000 163 - select PHYLIB 164 - ---help--- 165 - This driver supports the on chip ethernet device on the 166 - S6105 xtensa processor. 167 - 168 - To compile this driver as a module, choose M here. The module 169 - will be called s6gmac. 170 - 171 159 source "drivers/net/ethernet/samsung/Kconfig" 172 160 source "drivers/net/ethernet/seeq/Kconfig" 173 161 source "drivers/net/ethernet/silan/Kconfig"
-1
drivers/net/ethernet/Makefile
··· 66 66 obj-$(CONFIG_SH_ETH) += renesas/ 67 67 obj-$(CONFIG_NET_VENDOR_RDC) += rdc/ 68 68 obj-$(CONFIG_NET_VENDOR_ROCKER) += rocker/ 69 - obj-$(CONFIG_S6GMAC) += s6gmac.o 70 69 obj-$(CONFIG_NET_VENDOR_SAMSUNG) += samsung/ 71 70 obj-$(CONFIG_NET_VENDOR_SEEQ) += seeq/ 72 71 obj-$(CONFIG_NET_VENDOR_SILAN) += silan/
+5 -3
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
··· 12553 12553 return 0; 12554 12554 } 12555 12555 12556 - static bool bnx2x_gso_check(struct sk_buff *skb, struct net_device *dev) 12556 + static netdev_features_t bnx2x_features_check(struct sk_buff *skb, 12557 + struct net_device *dev, 12558 + netdev_features_t features) 12557 12559 { 12558 - return vxlan_gso_check(skb); 12560 + return vxlan_features_check(skb, features); 12559 12561 } 12560 12562 12561 12563 static const struct net_device_ops bnx2x_netdev_ops = { ··· 12591 12589 #endif 12592 12590 .ndo_get_phys_port_id = bnx2x_get_phys_port_id, 12593 12591 .ndo_set_vf_link_state = bnx2x_set_vf_link_state, 12594 - .ndo_gso_check = bnx2x_gso_check, 12592 + .ndo_features_check = bnx2x_features_check, 12595 12593 }; 12596 12594 12597 12595 static int bnx2x_set_coherency_mask(struct bnx2x *bp)
+17 -17
drivers/net/ethernet/broadcom/tg3.c
··· 17800 17800 goto err_out_apeunmap; 17801 17801 } 17802 17802 17803 - /* 17804 - * Reset chip in case UNDI or EFI driver did not shutdown 17805 - * DMA self test will enable WDMAC and we'll see (spurious) 17806 - * pending DMA on the PCI bus at that point. 17807 - */ 17808 - if ((tr32(HOSTCC_MODE) & HOSTCC_MODE_ENABLE) || 17809 - (tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) { 17810 - tw32(MEMARB_MODE, MEMARB_MODE_ENABLE); 17811 - tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); 17812 - } 17813 - 17814 - err = tg3_test_dma(tp); 17815 - if (err) { 17816 - dev_err(&pdev->dev, "DMA engine test failed, aborting\n"); 17817 - goto err_out_apeunmap; 17818 - } 17819 - 17820 17803 intmbx = MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW; 17821 17804 rcvmbx = MAILBOX_RCVRET_CON_IDX_0 + TG3_64BIT_REG_LOW; 17822 17805 sndmbx = MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW; ··· 17842 17859 sndmbx -= 0x4; 17843 17860 else 17844 17861 sndmbx += 0xc; 17862 + } 17863 + 17864 + /* 17865 + * Reset chip in case UNDI or EFI driver did not shutdown 17866 + * DMA self test will enable WDMAC and we'll see (spurious) 17867 + * pending DMA on the PCI bus at that point. 17868 + */ 17869 + if ((tr32(HOSTCC_MODE) & HOSTCC_MODE_ENABLE) || 17870 + (tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) { 17871 + tw32(MEMARB_MODE, MEMARB_MODE_ENABLE); 17872 + tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); 17873 + } 17874 + 17875 + err = tg3_test_dma(tp); 17876 + if (err) { 17877 + dev_err(&pdev->dev, "DMA engine test failed, aborting\n"); 17878 + goto err_out_apeunmap; 17845 17879 } 17846 17880 17847 17881 tg3_init_coal(tp);
+1 -1
drivers/net/ethernet/brocade/bna/bnad_debugfs.c
··· 172 172 173 173 /* Retrieve flash partition info */ 174 174 fcomp.comp_status = 0; 175 - init_completion(&fcomp.comp); 175 + reinit_completion(&fcomp.comp); 176 176 spin_lock_irqsave(&bnad->bna_lock, flags); 177 177 ret = bfa_nw_flash_get_attr(&bnad->bna.flash, &drvinfo->flash_attr, 178 178 bnad_cb_completion, &fcomp);
+4
drivers/net/ethernet/chelsio/cxgb4vf/adapter.h
··· 96 96 s16 xact_addr_filt; /* index of our MAC address filter */ 97 97 u16 rss_size; /* size of VI's RSS table slice */ 98 98 u8 pidx; /* index into adapter port[] */ 99 + s8 mdio_addr; 100 + u8 port_type; /* firmware port type */ 101 + u8 mod_type; /* firmware module type */ 99 102 u8 port_id; /* physical port ID */ 100 103 u8 nqsets; /* # of "Queue Sets" */ 101 104 u8 first_qset; /* index of first "Queue Set" */ ··· 525 522 * is "contracted" to provide for the common code. 526 523 */ 527 524 void t4vf_os_link_changed(struct adapter *, int, int); 525 + void t4vf_os_portmod_changed(struct adapter *, int); 528 526 529 527 /* 530 528 * SGE function prototype declarations.
+126 -14
drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
··· 44 44 #include <linux/etherdevice.h> 45 45 #include <linux/debugfs.h> 46 46 #include <linux/ethtool.h> 47 + #include <linux/mdio.h> 47 48 48 49 #include "t4vf_common.h" 49 50 #include "t4vf_defs.h" ··· 208 207 netif_carrier_off(dev); 209 208 netdev_info(dev, "link down\n"); 210 209 } 210 + } 211 + 212 + /* 213 + * THe port module type has changed on the indicated "port" (Virtual 214 + * Interface). 215 + */ 216 + void t4vf_os_portmod_changed(struct adapter *adapter, int pidx) 217 + { 218 + static const char * const mod_str[] = { 219 + NULL, "LR", "SR", "ER", "passive DA", "active DA", "LRM" 220 + }; 221 + const struct net_device *dev = adapter->port[pidx]; 222 + const struct port_info *pi = netdev_priv(dev); 223 + 224 + if (pi->mod_type == FW_PORT_MOD_TYPE_NONE) 225 + dev_info(adapter->pdev_dev, "%s: port module unplugged\n", 226 + dev->name); 227 + else if (pi->mod_type < ARRAY_SIZE(mod_str)) 228 + dev_info(adapter->pdev_dev, "%s: %s port module inserted\n", 229 + dev->name, mod_str[pi->mod_type]); 230 + else if (pi->mod_type == FW_PORT_MOD_TYPE_NOTSUPPORTED) 231 + dev_info(adapter->pdev_dev, "%s: unsupported optical port " 232 + "module inserted\n", dev->name); 233 + else if (pi->mod_type == FW_PORT_MOD_TYPE_UNKNOWN) 234 + dev_info(adapter->pdev_dev, "%s: unknown port module inserted," 235 + "forcing TWINAX\n", dev->name); 236 + else if (pi->mod_type == FW_PORT_MOD_TYPE_ERROR) 237 + dev_info(adapter->pdev_dev, "%s: transceiver module error\n", 238 + dev->name); 239 + else 240 + dev_info(adapter->pdev_dev, "%s: unknown module type %d " 241 + "inserted\n", dev->name, pi->mod_type); 211 242 } 212 243 213 244 /* ··· 1226 1193 * state of the port to which we're linked. 1227 1194 */ 1228 1195 1229 - /* 1230 - * Return current port link settings. 1231 - */ 1232 - static int cxgb4vf_get_settings(struct net_device *dev, 1233 - struct ethtool_cmd *cmd) 1196 + static unsigned int t4vf_from_fw_linkcaps(enum fw_port_type type, 1197 + unsigned int caps) 1234 1198 { 1235 - const struct port_info *pi = netdev_priv(dev); 1199 + unsigned int v = 0; 1236 1200 1237 - cmd->supported = pi->link_cfg.supported; 1238 - cmd->advertising = pi->link_cfg.advertising; 1201 + if (type == FW_PORT_TYPE_BT_SGMII || type == FW_PORT_TYPE_BT_XFI || 1202 + type == FW_PORT_TYPE_BT_XAUI) { 1203 + v |= SUPPORTED_TP; 1204 + if (caps & FW_PORT_CAP_SPEED_100M) 1205 + v |= SUPPORTED_100baseT_Full; 1206 + if (caps & FW_PORT_CAP_SPEED_1G) 1207 + v |= SUPPORTED_1000baseT_Full; 1208 + if (caps & FW_PORT_CAP_SPEED_10G) 1209 + v |= SUPPORTED_10000baseT_Full; 1210 + } else if (type == FW_PORT_TYPE_KX4 || type == FW_PORT_TYPE_KX) { 1211 + v |= SUPPORTED_Backplane; 1212 + if (caps & FW_PORT_CAP_SPEED_1G) 1213 + v |= SUPPORTED_1000baseKX_Full; 1214 + if (caps & FW_PORT_CAP_SPEED_10G) 1215 + v |= SUPPORTED_10000baseKX4_Full; 1216 + } else if (type == FW_PORT_TYPE_KR) 1217 + v |= SUPPORTED_Backplane | SUPPORTED_10000baseKR_Full; 1218 + else if (type == FW_PORT_TYPE_BP_AP) 1219 + v |= SUPPORTED_Backplane | SUPPORTED_10000baseR_FEC | 1220 + SUPPORTED_10000baseKR_Full | SUPPORTED_1000baseKX_Full; 1221 + else if (type == FW_PORT_TYPE_BP4_AP) 1222 + v |= SUPPORTED_Backplane | SUPPORTED_10000baseR_FEC | 1223 + SUPPORTED_10000baseKR_Full | SUPPORTED_1000baseKX_Full | 1224 + SUPPORTED_10000baseKX4_Full; 1225 + else if (type == FW_PORT_TYPE_FIBER_XFI || 1226 + type == FW_PORT_TYPE_FIBER_XAUI || 1227 + type == FW_PORT_TYPE_SFP || 1228 + type == FW_PORT_TYPE_QSFP_10G || 1229 + type == FW_PORT_TYPE_QSA) { 1230 + v |= SUPPORTED_FIBRE; 1231 + if (caps & FW_PORT_CAP_SPEED_1G) 1232 + v |= SUPPORTED_1000baseT_Full; 1233 + if (caps & FW_PORT_CAP_SPEED_10G) 1234 + v |= SUPPORTED_10000baseT_Full; 1235 + } else if (type == FW_PORT_TYPE_BP40_BA || 1236 + type == FW_PORT_TYPE_QSFP) { 1237 + v |= SUPPORTED_40000baseSR4_Full; 1238 + v |= SUPPORTED_FIBRE; 1239 + } 1240 + 1241 + if (caps & FW_PORT_CAP_ANEG) 1242 + v |= SUPPORTED_Autoneg; 1243 + return v; 1244 + } 1245 + 1246 + static int cxgb4vf_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) 1247 + { 1248 + const struct port_info *p = netdev_priv(dev); 1249 + 1250 + if (p->port_type == FW_PORT_TYPE_BT_SGMII || 1251 + p->port_type == FW_PORT_TYPE_BT_XFI || 1252 + p->port_type == FW_PORT_TYPE_BT_XAUI) 1253 + cmd->port = PORT_TP; 1254 + else if (p->port_type == FW_PORT_TYPE_FIBER_XFI || 1255 + p->port_type == FW_PORT_TYPE_FIBER_XAUI) 1256 + cmd->port = PORT_FIBRE; 1257 + else if (p->port_type == FW_PORT_TYPE_SFP || 1258 + p->port_type == FW_PORT_TYPE_QSFP_10G || 1259 + p->port_type == FW_PORT_TYPE_QSA || 1260 + p->port_type == FW_PORT_TYPE_QSFP) { 1261 + if (p->mod_type == FW_PORT_MOD_TYPE_LR || 1262 + p->mod_type == FW_PORT_MOD_TYPE_SR || 1263 + p->mod_type == FW_PORT_MOD_TYPE_ER || 1264 + p->mod_type == FW_PORT_MOD_TYPE_LRM) 1265 + cmd->port = PORT_FIBRE; 1266 + else if (p->mod_type == FW_PORT_MOD_TYPE_TWINAX_PASSIVE || 1267 + p->mod_type == FW_PORT_MOD_TYPE_TWINAX_ACTIVE) 1268 + cmd->port = PORT_DA; 1269 + else 1270 + cmd->port = PORT_OTHER; 1271 + } else 1272 + cmd->port = PORT_OTHER; 1273 + 1274 + if (p->mdio_addr >= 0) { 1275 + cmd->phy_address = p->mdio_addr; 1276 + cmd->transceiver = XCVR_EXTERNAL; 1277 + cmd->mdio_support = p->port_type == FW_PORT_TYPE_BT_SGMII ? 1278 + MDIO_SUPPORTS_C22 : MDIO_SUPPORTS_C45; 1279 + } else { 1280 + cmd->phy_address = 0; /* not really, but no better option */ 1281 + cmd->transceiver = XCVR_INTERNAL; 1282 + cmd->mdio_support = 0; 1283 + } 1284 + 1285 + cmd->supported = t4vf_from_fw_linkcaps(p->port_type, 1286 + p->link_cfg.supported); 1287 + cmd->advertising = t4vf_from_fw_linkcaps(p->port_type, 1288 + p->link_cfg.advertising); 1239 1289 ethtool_cmd_speed_set(cmd, 1240 - netif_carrier_ok(dev) ? pi->link_cfg.speed : -1); 1290 + netif_carrier_ok(dev) ? p->link_cfg.speed : 0); 1241 1291 cmd->duplex = DUPLEX_FULL; 1242 - 1243 - cmd->port = (cmd->supported & SUPPORTED_TP) ? PORT_TP : PORT_FIBRE; 1244 - cmd->phy_address = pi->port_id; 1245 - cmd->transceiver = XCVR_EXTERNAL; 1246 - cmd->autoneg = pi->link_cfg.autoneg; 1292 + cmd->autoneg = p->link_cfg.autoneg; 1247 1293 cmd->maxtxpkt = 0; 1248 1294 cmd->maxrxpkt = 0; 1249 1295 return 0;
+1 -1
drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h
··· 230 230 231 231 static inline bool is_10g_port(const struct link_config *lc) 232 232 { 233 - return (lc->supported & SUPPORTED_10000baseT_Full) != 0; 233 + return (lc->supported & FW_PORT_CAP_SPEED_10G) != 0; 234 234 } 235 235 236 236 static inline bool is_x_10g_port(const struct link_config *lc)
+29 -25
drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c
··· 245 245 return a & 0x3f; 246 246 } 247 247 248 + #define ADVERT_MASK (FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G |\ 249 + FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_SPEED_40G | \ 250 + FW_PORT_CAP_SPEED_100G | FW_PORT_CAP_ANEG) 251 + 248 252 /** 249 253 * init_link_config - initialize a link's SW state 250 254 * @lc: structure holding the link state ··· 263 259 lc->requested_speed = 0; 264 260 lc->speed = 0; 265 261 lc->requested_fc = lc->fc = PAUSE_RX | PAUSE_TX; 266 - if (lc->supported & SUPPORTED_Autoneg) { 267 - lc->advertising = lc->supported; 262 + if (lc->supported & FW_PORT_CAP_ANEG) { 263 + lc->advertising = lc->supported & ADVERT_MASK; 268 264 lc->autoneg = AUTONEG_ENABLE; 269 265 lc->requested_fc |= PAUSE_AUTONEG; 270 266 } else { ··· 284 280 struct fw_vi_cmd vi_cmd, vi_rpl; 285 281 struct fw_port_cmd port_cmd, port_rpl; 286 282 int v; 287 - u32 word; 288 283 289 284 /* 290 285 * Execute a VI Read command to get our Virtual Interface information ··· 322 319 if (v) 323 320 return v; 324 321 325 - v = 0; 326 - word = be16_to_cpu(port_rpl.u.info.pcap); 327 - if (word & FW_PORT_CAP_SPEED_100M) 328 - v |= SUPPORTED_100baseT_Full; 329 - if (word & FW_PORT_CAP_SPEED_1G) 330 - v |= SUPPORTED_1000baseT_Full; 331 - if (word & FW_PORT_CAP_SPEED_10G) 332 - v |= SUPPORTED_10000baseT_Full; 333 - if (word & FW_PORT_CAP_SPEED_40G) 334 - v |= SUPPORTED_40000baseSR4_Full; 335 - if (word & FW_PORT_CAP_ANEG) 336 - v |= SUPPORTED_Autoneg; 337 - init_link_config(&pi->link_cfg, v); 322 + v = be32_to_cpu(port_rpl.u.info.lstatus_to_modtype); 323 + pi->port_type = FW_PORT_CMD_PTYPE_G(v); 324 + pi->mod_type = FW_PORT_MOD_TYPE_NA; 325 + 326 + init_link_config(&pi->link_cfg, be16_to_cpu(port_rpl.u.info.pcap)); 338 327 339 328 return 0; 340 329 } ··· 1486 1491 */ 1487 1492 const struct fw_port_cmd *port_cmd = 1488 1493 (const struct fw_port_cmd *)rpl; 1489 - u32 word; 1494 + u32 stat, mod; 1490 1495 int action, port_id, link_ok, speed, fc, pidx; 1491 1496 1492 1497 /* ··· 1504 1509 port_id = FW_PORT_CMD_PORTID_G( 1505 1510 be32_to_cpu(port_cmd->op_to_portid)); 1506 1511 1507 - word = be32_to_cpu(port_cmd->u.info.lstatus_to_modtype); 1508 - link_ok = (word & FW_PORT_CMD_LSTATUS_F) != 0; 1512 + stat = be32_to_cpu(port_cmd->u.info.lstatus_to_modtype); 1513 + link_ok = (stat & FW_PORT_CMD_LSTATUS_F) != 0; 1509 1514 speed = 0; 1510 1515 fc = 0; 1511 - if (word & FW_PORT_CMD_RXPAUSE_F) 1516 + if (stat & FW_PORT_CMD_RXPAUSE_F) 1512 1517 fc |= PAUSE_RX; 1513 - if (word & FW_PORT_CMD_TXPAUSE_F) 1518 + if (stat & FW_PORT_CMD_TXPAUSE_F) 1514 1519 fc |= PAUSE_TX; 1515 - if (word & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_100M)) 1520 + if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_100M)) 1516 1521 speed = 100; 1517 - else if (word & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_1G)) 1522 + else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_1G)) 1518 1523 speed = 1000; 1519 - else if (word & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_10G)) 1524 + else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_10G)) 1520 1525 speed = 10000; 1521 - else if (word & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_40G)) 1526 + else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_40G)) 1522 1527 speed = 40000; 1523 1528 1524 1529 /* ··· 1535 1540 continue; 1536 1541 1537 1542 lc = &pi->link_cfg; 1543 + 1544 + mod = FW_PORT_CMD_MODTYPE_G(stat); 1545 + if (mod != pi->mod_type) { 1546 + pi->mod_type = mod; 1547 + t4vf_os_portmod_changed(adapter, pidx); 1548 + } 1549 + 1538 1550 if (link_ok != lc->link_ok || speed != lc->speed || 1539 1551 fc != lc->fc) { 1540 1552 /* something changed */ 1541 1553 lc->link_ok = link_ok; 1542 1554 lc->speed = speed; 1543 1555 lc->fc = fc; 1556 + lc->supported = 1557 + be16_to_cpu(port_cmd->u.info.pcap); 1544 1558 t4vf_os_link_changed(adapter, pidx, link_ok); 1545 1559 } 1546 1560 }
+8 -4
drivers/net/ethernet/cisco/enic/enic_main.c
··· 1060 1060 PKT_HASH_TYPE_L4 : PKT_HASH_TYPE_L3); 1061 1061 } 1062 1062 1063 - if ((netdev->features & NETIF_F_RXCSUM) && !csum_not_calc) { 1064 - skb->csum = htons(checksum); 1065 - skb->ip_summed = CHECKSUM_COMPLETE; 1066 - } 1063 + /* Hardware does not provide whole packet checksum. It only 1064 + * provides pseudo checksum. Since hw validates the packet 1065 + * checksum but not provide us the checksum value. use 1066 + * CHECSUM_UNNECESSARY. 1067 + */ 1068 + if ((netdev->features & NETIF_F_RXCSUM) && tcp_udp_csum_ok && 1069 + ipv4_csum_ok) 1070 + skb->ip_summed = CHECKSUM_UNNECESSARY; 1067 1071 1068 1072 if (vlan_stripped) 1069 1073 __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tci);
+5 -3
drivers/net/ethernet/emulex/benet/be_main.c
··· 4459 4459 adapter->vxlan_port_count--; 4460 4460 } 4461 4461 4462 - static bool be_gso_check(struct sk_buff *skb, struct net_device *dev) 4462 + static netdev_features_t be_features_check(struct sk_buff *skb, 4463 + struct net_device *dev, 4464 + netdev_features_t features) 4463 4465 { 4464 - return vxlan_gso_check(skb); 4466 + return vxlan_features_check(skb, features); 4465 4467 } 4466 4468 #endif 4467 4469 ··· 4494 4492 #ifdef CONFIG_BE2NET_VXLAN 4495 4493 .ndo_add_vxlan_port = be_add_vxlan_port, 4496 4494 .ndo_del_vxlan_port = be_del_vxlan_port, 4497 - .ndo_gso_check = be_gso_check, 4495 + .ndo_features_check = be_features_check, 4498 4496 #endif 4499 4497 }; 4500 4498
+6 -4
drivers/net/ethernet/mellanox/mlx4/en_netdev.c
··· 2365 2365 queue_work(priv->mdev->workqueue, &priv->vxlan_del_task); 2366 2366 } 2367 2367 2368 - static bool mlx4_en_gso_check(struct sk_buff *skb, struct net_device *dev) 2368 + static netdev_features_t mlx4_en_features_check(struct sk_buff *skb, 2369 + struct net_device *dev, 2370 + netdev_features_t features) 2369 2371 { 2370 - return vxlan_gso_check(skb); 2372 + return vxlan_features_check(skb, features); 2371 2373 } 2372 2374 #endif 2373 2375 ··· 2402 2400 #ifdef CONFIG_MLX4_EN_VXLAN 2403 2401 .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, 2404 2402 .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, 2405 - .ndo_gso_check = mlx4_en_gso_check, 2403 + .ndo_features_check = mlx4_en_features_check, 2406 2404 #endif 2407 2405 }; 2408 2406 ··· 2436 2434 #ifdef CONFIG_MLX4_EN_VXLAN 2437 2435 .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, 2438 2436 .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, 2439 - .ndo_gso_check = mlx4_en_gso_check, 2437 + .ndo_features_check = mlx4_en_features_check, 2440 2438 #endif 2441 2439 }; 2442 2440
+11 -1
drivers/net/ethernet/mellanox/mlx4/en_tx.c
··· 962 962 tx_desc->ctrl.owner_opcode = op_own; 963 963 if (send_doorbell) { 964 964 wmb(); 965 - iowrite32(ring->doorbell_qpn, 965 + /* Since there is no iowrite*_native() that writes the 966 + * value as is, without byteswapping - using the one 967 + * the doesn't do byteswapping in the relevant arch 968 + * endianness. 969 + */ 970 + #if defined(__LITTLE_ENDIAN) 971 + iowrite32( 972 + #else 973 + iowrite32be( 974 + #endif 975 + ring->doorbell_qpn, 966 976 ring->bf.uar->map + MLX4_SEND_DOORBELL); 967 977 } else { 968 978 ring->xmit_more++;
-6
drivers/net/ethernet/micrel/ksz884x.c
··· 2303 2303 2304 2304 /* Spanning Tree */ 2305 2305 2306 - static inline void port_cfg_dis_learn(struct ksz_hw *hw, int p, int set) 2307 - { 2308 - port_cfg(hw, p, 2309 - KS8842_PORT_CTRL_2_OFFSET, PORT_LEARN_DISABLE, set); 2310 - } 2311 - 2312 2306 static inline void port_cfg_rx(struct ksz_hw *hw, int p, int set) 2313 2307 { 2314 2308 port_cfg(hw, p,
+5 -3
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
··· 505 505 adapter->flags |= QLCNIC_DEL_VXLAN_PORT; 506 506 } 507 507 508 - static bool qlcnic_gso_check(struct sk_buff *skb, struct net_device *dev) 508 + static netdev_features_t qlcnic_features_check(struct sk_buff *skb, 509 + struct net_device *dev, 510 + netdev_features_t features) 509 511 { 510 - return vxlan_gso_check(skb); 512 + return vxlan_features_check(skb, features); 511 513 } 512 514 #endif 513 515 ··· 534 532 #ifdef CONFIG_QLCNIC_VXLAN 535 533 .ndo_add_vxlan_port = qlcnic_add_vxlan_port, 536 534 .ndo_del_vxlan_port = qlcnic_del_vxlan_port, 537 - .ndo_gso_check = qlcnic_gso_check, 535 + .ndo_features_check = qlcnic_features_check, 538 536 #endif 539 537 #ifdef CONFIG_NET_POLL_CONTROLLER 540 538 .ndo_poll_controller = qlcnic_poll_controller,
+3 -1
drivers/net/ethernet/realtek/8139too.c
··· 787 787 if (rc) 788 788 goto err_out; 789 789 790 + disable_dev_on_err = 1; 790 791 rc = pci_request_regions (pdev, DRV_NAME); 791 792 if (rc) 792 793 goto err_out; 793 - disable_dev_on_err = 1; 794 794 795 795 pci_set_master (pdev); 796 796 ··· 1110 1110 return 0; 1111 1111 1112 1112 err_out: 1113 + netif_napi_del(&tp->napi); 1113 1114 __rtl8139_cleanup_dev (dev); 1114 1115 pci_disable_device (pdev); 1115 1116 return i; ··· 1125 1124 assert (dev != NULL); 1126 1125 1127 1126 cancel_delayed_work_sync(&tp->thread); 1127 + netif_napi_del(&tp->napi); 1128 1128 1129 1129 unregister_netdev (dev); 1130 1130
-1058
drivers/net/ethernet/s6gmac.c
··· 1 - /* 2 - * Ethernet driver for S6105 on chip network device 3 - * (c)2008 emlix GmbH http://www.emlix.com 4 - * Authors: Oskar Schirmer <oskar@scara.com> 5 - * Daniel Gloeckner <dg@emlix.com> 6 - * 7 - * This program is free software; you can redistribute it and/or 8 - * modify it under the terms of the GNU General Public License 9 - * as published by the Free Software Foundation; either version 10 - * 2 of the License, or (at your option) any later version. 11 - */ 12 - #include <linux/kernel.h> 13 - #include <linux/module.h> 14 - #include <linux/interrupt.h> 15 - #include <linux/types.h> 16 - #include <linux/delay.h> 17 - #include <linux/spinlock.h> 18 - #include <linux/netdevice.h> 19 - #include <linux/etherdevice.h> 20 - #include <linux/if.h> 21 - #include <linux/stddef.h> 22 - #include <linux/mii.h> 23 - #include <linux/phy.h> 24 - #include <linux/platform_device.h> 25 - #include <variant/hardware.h> 26 - #include <variant/dmac.h> 27 - 28 - #define DRV_NAME "s6gmac" 29 - #define DRV_PRMT DRV_NAME ": " 30 - 31 - 32 - /* register declarations */ 33 - 34 - #define S6_GMAC_MACCONF1 0x000 35 - #define S6_GMAC_MACCONF1_TXENA 0 36 - #define S6_GMAC_MACCONF1_SYNCTX 1 37 - #define S6_GMAC_MACCONF1_RXENA 2 38 - #define S6_GMAC_MACCONF1_SYNCRX 3 39 - #define S6_GMAC_MACCONF1_TXFLOWCTRL 4 40 - #define S6_GMAC_MACCONF1_RXFLOWCTRL 5 41 - #define S6_GMAC_MACCONF1_LOOPBACK 8 42 - #define S6_GMAC_MACCONF1_RESTXFUNC 16 43 - #define S6_GMAC_MACCONF1_RESRXFUNC 17 44 - #define S6_GMAC_MACCONF1_RESTXMACCTRL 18 45 - #define S6_GMAC_MACCONF1_RESRXMACCTRL 19 46 - #define S6_GMAC_MACCONF1_SIMULRES 30 47 - #define S6_GMAC_MACCONF1_SOFTRES 31 48 - #define S6_GMAC_MACCONF2 0x004 49 - #define S6_GMAC_MACCONF2_FULL 0 50 - #define S6_GMAC_MACCONF2_CRCENA 1 51 - #define S6_GMAC_MACCONF2_PADCRCENA 2 52 - #define S6_GMAC_MACCONF2_LENGTHFCHK 4 53 - #define S6_GMAC_MACCONF2_HUGEFRAMENA 5 54 - #define S6_GMAC_MACCONF2_IFMODE 8 55 - #define S6_GMAC_MACCONF2_IFMODE_NIBBLE 1 56 - #define S6_GMAC_MACCONF2_IFMODE_BYTE 2 57 - #define S6_GMAC_MACCONF2_IFMODE_MASK 3 58 - #define S6_GMAC_MACCONF2_PREAMBLELEN 12 59 - #define S6_GMAC_MACCONF2_PREAMBLELEN_MASK 0x0F 60 - #define S6_GMAC_MACIPGIFG 0x008 61 - #define S6_GMAC_MACIPGIFG_B2BINTERPGAP 0 62 - #define S6_GMAC_MACIPGIFG_B2BINTERPGAP_MASK 0x7F 63 - #define S6_GMAC_MACIPGIFG_MINIFGENFORCE 8 64 - #define S6_GMAC_MACIPGIFG_B2BINTERPGAP2 16 65 - #define S6_GMAC_MACIPGIFG_B2BINTERPGAP1 24 66 - #define S6_GMAC_MACHALFDUPLEX 0x00C 67 - #define S6_GMAC_MACHALFDUPLEX_COLLISWIN 0 68 - #define S6_GMAC_MACHALFDUPLEX_COLLISWIN_MASK 0x3F 69 - #define S6_GMAC_MACHALFDUPLEX_RETXMAX 12 70 - #define S6_GMAC_MACHALFDUPLEX_RETXMAX_MASK 0x0F 71 - #define S6_GMAC_MACHALFDUPLEX_EXCESSDEF 16 72 - #define S6_GMAC_MACHALFDUPLEX_NOBACKOFF 17 73 - #define S6_GMAC_MACHALFDUPLEX_BPNOBCKOF 18 74 - #define S6_GMAC_MACHALFDUPLEX_ALTBEBENA 19 75 - #define S6_GMAC_MACHALFDUPLEX_ALTBEBTRN 20 76 - #define S6_GMAC_MACHALFDUPLEX_ALTBEBTR_MASK 0x0F 77 - #define S6_GMAC_MACMAXFRAMELEN 0x010 78 - #define S6_GMAC_MACMIICONF 0x020 79 - #define S6_GMAC_MACMIICONF_CSEL 0 80 - #define S6_GMAC_MACMIICONF_CSEL_DIV10 0 81 - #define S6_GMAC_MACMIICONF_CSEL_DIV12 1 82 - #define S6_GMAC_MACMIICONF_CSEL_DIV14 2 83 - #define S6_GMAC_MACMIICONF_CSEL_DIV18 3 84 - #define S6_GMAC_MACMIICONF_CSEL_DIV24 4 85 - #define S6_GMAC_MACMIICONF_CSEL_DIV34 5 86 - #define S6_GMAC_MACMIICONF_CSEL_DIV68 6 87 - #define S6_GMAC_MACMIICONF_CSEL_DIV168 7 88 - #define S6_GMAC_MACMIICONF_CSEL_MASK 7 89 - #define S6_GMAC_MACMIICONF_PREAMBLESUPR 4 90 - #define S6_GMAC_MACMIICONF_SCANAUTOINCR 5 91 - #define S6_GMAC_MACMIICMD 0x024 92 - #define S6_GMAC_MACMIICMD_READ 0 93 - #define S6_GMAC_MACMIICMD_SCAN 1 94 - #define S6_GMAC_MACMIIADDR 0x028 95 - #define S6_GMAC_MACMIIADDR_REG 0 96 - #define S6_GMAC_MACMIIADDR_REG_MASK 0x1F 97 - #define S6_GMAC_MACMIIADDR_PHY 8 98 - #define S6_GMAC_MACMIIADDR_PHY_MASK 0x1F 99 - #define S6_GMAC_MACMIICTRL 0x02C 100 - #define S6_GMAC_MACMIISTAT 0x030 101 - #define S6_GMAC_MACMIIINDI 0x034 102 - #define S6_GMAC_MACMIIINDI_BUSY 0 103 - #define S6_GMAC_MACMIIINDI_SCAN 1 104 - #define S6_GMAC_MACMIIINDI_INVAL 2 105 - #define S6_GMAC_MACINTERFSTAT 0x03C 106 - #define S6_GMAC_MACINTERFSTAT_LINKFAIL 3 107 - #define S6_GMAC_MACINTERFSTAT_EXCESSDEF 9 108 - #define S6_GMAC_MACSTATADDR1 0x040 109 - #define S6_GMAC_MACSTATADDR2 0x044 110 - 111 - #define S6_GMAC_FIFOCONF0 0x048 112 - #define S6_GMAC_FIFOCONF0_HSTRSTWT 0 113 - #define S6_GMAC_FIFOCONF0_HSTRSTSR 1 114 - #define S6_GMAC_FIFOCONF0_HSTRSTFR 2 115 - #define S6_GMAC_FIFOCONF0_HSTRSTST 3 116 - #define S6_GMAC_FIFOCONF0_HSTRSTFT 4 117 - #define S6_GMAC_FIFOCONF0_WTMENREQ 8 118 - #define S6_GMAC_FIFOCONF0_SRFENREQ 9 119 - #define S6_GMAC_FIFOCONF0_FRFENREQ 10 120 - #define S6_GMAC_FIFOCONF0_STFENREQ 11 121 - #define S6_GMAC_FIFOCONF0_FTFENREQ 12 122 - #define S6_GMAC_FIFOCONF0_WTMENRPLY 16 123 - #define S6_GMAC_FIFOCONF0_SRFENRPLY 17 124 - #define S6_GMAC_FIFOCONF0_FRFENRPLY 18 125 - #define S6_GMAC_FIFOCONF0_STFENRPLY 19 126 - #define S6_GMAC_FIFOCONF0_FTFENRPLY 20 127 - #define S6_GMAC_FIFOCONF1 0x04C 128 - #define S6_GMAC_FIFOCONF2 0x050 129 - #define S6_GMAC_FIFOCONF2_CFGLWM 0 130 - #define S6_GMAC_FIFOCONF2_CFGHWM 16 131 - #define S6_GMAC_FIFOCONF3 0x054 132 - #define S6_GMAC_FIFOCONF3_CFGFTTH 0 133 - #define S6_GMAC_FIFOCONF3_CFGHWMFT 16 134 - #define S6_GMAC_FIFOCONF4 0x058 135 - #define S6_GMAC_FIFOCONF_RSV_PREVDROP 0 136 - #define S6_GMAC_FIFOCONF_RSV_RUNT 1 137 - #define S6_GMAC_FIFOCONF_RSV_FALSECAR 2 138 - #define S6_GMAC_FIFOCONF_RSV_CODEERR 3 139 - #define S6_GMAC_FIFOCONF_RSV_CRCERR 4 140 - #define S6_GMAC_FIFOCONF_RSV_LENGTHERR 5 141 - #define S6_GMAC_FIFOCONF_RSV_LENRANGE 6 142 - #define S6_GMAC_FIFOCONF_RSV_OK 7 143 - #define S6_GMAC_FIFOCONF_RSV_MULTICAST 8 144 - #define S6_GMAC_FIFOCONF_RSV_BROADCAST 9 145 - #define S6_GMAC_FIFOCONF_RSV_DRIBBLE 10 146 - #define S6_GMAC_FIFOCONF_RSV_CTRLFRAME 11 147 - #define S6_GMAC_FIFOCONF_RSV_PAUSECTRL 12 148 - #define S6_GMAC_FIFOCONF_RSV_UNOPCODE 13 149 - #define S6_GMAC_FIFOCONF_RSV_VLANTAG 14 150 - #define S6_GMAC_FIFOCONF_RSV_LONGEVENT 15 151 - #define S6_GMAC_FIFOCONF_RSV_TRUNCATED 16 152 - #define S6_GMAC_FIFOCONF_RSV_MASK 0x3FFFF 153 - #define S6_GMAC_FIFOCONF5 0x05C 154 - #define S6_GMAC_FIFOCONF5_DROPLT64 18 155 - #define S6_GMAC_FIFOCONF5_CFGBYTM 19 156 - #define S6_GMAC_FIFOCONF5_RXDROPSIZE 20 157 - #define S6_GMAC_FIFOCONF5_RXDROPSIZE_MASK 0xF 158 - 159 - #define S6_GMAC_STAT_REGS 0x080 160 - #define S6_GMAC_STAT_SIZE_MIN 12 161 - #define S6_GMAC_STATTR64 0x080 162 - #define S6_GMAC_STATTR64_SIZE 18 163 - #define S6_GMAC_STATTR127 0x084 164 - #define S6_GMAC_STATTR127_SIZE 18 165 - #define S6_GMAC_STATTR255 0x088 166 - #define S6_GMAC_STATTR255_SIZE 18 167 - #define S6_GMAC_STATTR511 0x08C 168 - #define S6_GMAC_STATTR511_SIZE 18 169 - #define S6_GMAC_STATTR1K 0x090 170 - #define S6_GMAC_STATTR1K_SIZE 18 171 - #define S6_GMAC_STATTRMAX 0x094 172 - #define S6_GMAC_STATTRMAX_SIZE 18 173 - #define S6_GMAC_STATTRMGV 0x098 174 - #define S6_GMAC_STATTRMGV_SIZE 18 175 - #define S6_GMAC_STATRBYT 0x09C 176 - #define S6_GMAC_STATRBYT_SIZE 24 177 - #define S6_GMAC_STATRPKT 0x0A0 178 - #define S6_GMAC_STATRPKT_SIZE 18 179 - #define S6_GMAC_STATRFCS 0x0A4 180 - #define S6_GMAC_STATRFCS_SIZE 12 181 - #define S6_GMAC_STATRMCA 0x0A8 182 - #define S6_GMAC_STATRMCA_SIZE 18 183 - #define S6_GMAC_STATRBCA 0x0AC 184 - #define S6_GMAC_STATRBCA_SIZE 22 185 - #define S6_GMAC_STATRXCF 0x0B0 186 - #define S6_GMAC_STATRXCF_SIZE 18 187 - #define S6_GMAC_STATRXPF 0x0B4 188 - #define S6_GMAC_STATRXPF_SIZE 12 189 - #define S6_GMAC_STATRXUO 0x0B8 190 - #define S6_GMAC_STATRXUO_SIZE 12 191 - #define S6_GMAC_STATRALN 0x0BC 192 - #define S6_GMAC_STATRALN_SIZE 12 193 - #define S6_GMAC_STATRFLR 0x0C0 194 - #define S6_GMAC_STATRFLR_SIZE 16 195 - #define S6_GMAC_STATRCDE 0x0C4 196 - #define S6_GMAC_STATRCDE_SIZE 12 197 - #define S6_GMAC_STATRCSE 0x0C8 198 - #define S6_GMAC_STATRCSE_SIZE 12 199 - #define S6_GMAC_STATRUND 0x0CC 200 - #define S6_GMAC_STATRUND_SIZE 12 201 - #define S6_GMAC_STATROVR 0x0D0 202 - #define S6_GMAC_STATROVR_SIZE 12 203 - #define S6_GMAC_STATRFRG 0x0D4 204 - #define S6_GMAC_STATRFRG_SIZE 12 205 - #define S6_GMAC_STATRJBR 0x0D8 206 - #define S6_GMAC_STATRJBR_SIZE 12 207 - #define S6_GMAC_STATRDRP 0x0DC 208 - #define S6_GMAC_STATRDRP_SIZE 12 209 - #define S6_GMAC_STATTBYT 0x0E0 210 - #define S6_GMAC_STATTBYT_SIZE 24 211 - #define S6_GMAC_STATTPKT 0x0E4 212 - #define S6_GMAC_STATTPKT_SIZE 18 213 - #define S6_GMAC_STATTMCA 0x0E8 214 - #define S6_GMAC_STATTMCA_SIZE 18 215 - #define S6_GMAC_STATTBCA 0x0EC 216 - #define S6_GMAC_STATTBCA_SIZE 18 217 - #define S6_GMAC_STATTXPF 0x0F0 218 - #define S6_GMAC_STATTXPF_SIZE 12 219 - #define S6_GMAC_STATTDFR 0x0F4 220 - #define S6_GMAC_STATTDFR_SIZE 12 221 - #define S6_GMAC_STATTEDF 0x0F8 222 - #define S6_GMAC_STATTEDF_SIZE 12 223 - #define S6_GMAC_STATTSCL 0x0FC 224 - #define S6_GMAC_STATTSCL_SIZE 12 225 - #define S6_GMAC_STATTMCL 0x100 226 - #define S6_GMAC_STATTMCL_SIZE 12 227 - #define S6_GMAC_STATTLCL 0x104 228 - #define S6_GMAC_STATTLCL_SIZE 12 229 - #define S6_GMAC_STATTXCL 0x108 230 - #define S6_GMAC_STATTXCL_SIZE 12 231 - #define S6_GMAC_STATTNCL 0x10C 232 - #define S6_GMAC_STATTNCL_SIZE 13 233 - #define S6_GMAC_STATTPFH 0x110 234 - #define S6_GMAC_STATTPFH_SIZE 12 235 - #define S6_GMAC_STATTDRP 0x114 236 - #define S6_GMAC_STATTDRP_SIZE 12 237 - #define S6_GMAC_STATTJBR 0x118 238 - #define S6_GMAC_STATTJBR_SIZE 12 239 - #define S6_GMAC_STATTFCS 0x11C 240 - #define S6_GMAC_STATTFCS_SIZE 12 241 - #define S6_GMAC_STATTXCF 0x120 242 - #define S6_GMAC_STATTXCF_SIZE 12 243 - #define S6_GMAC_STATTOVR 0x124 244 - #define S6_GMAC_STATTOVR_SIZE 12 245 - #define S6_GMAC_STATTUND 0x128 246 - #define S6_GMAC_STATTUND_SIZE 12 247 - #define S6_GMAC_STATTFRG 0x12C 248 - #define S6_GMAC_STATTFRG_SIZE 12 249 - #define S6_GMAC_STATCARRY(n) (0x130 + 4*(n)) 250 - #define S6_GMAC_STATCARRYMSK(n) (0x138 + 4*(n)) 251 - #define S6_GMAC_STATCARRY1_RDRP 0 252 - #define S6_GMAC_STATCARRY1_RJBR 1 253 - #define S6_GMAC_STATCARRY1_RFRG 2 254 - #define S6_GMAC_STATCARRY1_ROVR 3 255 - #define S6_GMAC_STATCARRY1_RUND 4 256 - #define S6_GMAC_STATCARRY1_RCSE 5 257 - #define S6_GMAC_STATCARRY1_RCDE 6 258 - #define S6_GMAC_STATCARRY1_RFLR 7 259 - #define S6_GMAC_STATCARRY1_RALN 8 260 - #define S6_GMAC_STATCARRY1_RXUO 9 261 - #define S6_GMAC_STATCARRY1_RXPF 10 262 - #define S6_GMAC_STATCARRY1_RXCF 11 263 - #define S6_GMAC_STATCARRY1_RBCA 12 264 - #define S6_GMAC_STATCARRY1_RMCA 13 265 - #define S6_GMAC_STATCARRY1_RFCS 14 266 - #define S6_GMAC_STATCARRY1_RPKT 15 267 - #define S6_GMAC_STATCARRY1_RBYT 16 268 - #define S6_GMAC_STATCARRY1_TRMGV 25 269 - #define S6_GMAC_STATCARRY1_TRMAX 26 270 - #define S6_GMAC_STATCARRY1_TR1K 27 271 - #define S6_GMAC_STATCARRY1_TR511 28 272 - #define S6_GMAC_STATCARRY1_TR255 29 273 - #define S6_GMAC_STATCARRY1_TR127 30 274 - #define S6_GMAC_STATCARRY1_TR64 31 275 - #define S6_GMAC_STATCARRY2_TDRP 0 276 - #define S6_GMAC_STATCARRY2_TPFH 1 277 - #define S6_GMAC_STATCARRY2_TNCL 2 278 - #define S6_GMAC_STATCARRY2_TXCL 3 279 - #define S6_GMAC_STATCARRY2_TLCL 4 280 - #define S6_GMAC_STATCARRY2_TMCL 5 281 - #define S6_GMAC_STATCARRY2_TSCL 6 282 - #define S6_GMAC_STATCARRY2_TEDF 7 283 - #define S6_GMAC_STATCARRY2_TDFR 8 284 - #define S6_GMAC_STATCARRY2_TXPF 9 285 - #define S6_GMAC_STATCARRY2_TBCA 10 286 - #define S6_GMAC_STATCARRY2_TMCA 11 287 - #define S6_GMAC_STATCARRY2_TPKT 12 288 - #define S6_GMAC_STATCARRY2_TBYT 13 289 - #define S6_GMAC_STATCARRY2_TFRG 14 290 - #define S6_GMAC_STATCARRY2_TUND 15 291 - #define S6_GMAC_STATCARRY2_TOVR 16 292 - #define S6_GMAC_STATCARRY2_TXCF 17 293 - #define S6_GMAC_STATCARRY2_TFCS 18 294 - #define S6_GMAC_STATCARRY2_TJBR 19 295 - 296 - #define S6_GMAC_HOST_PBLKCTRL 0x140 297 - #define S6_GMAC_HOST_PBLKCTRL_TXENA 0 298 - #define S6_GMAC_HOST_PBLKCTRL_RXENA 1 299 - #define S6_GMAC_HOST_PBLKCTRL_TXSRES 2 300 - #define S6_GMAC_HOST_PBLKCTRL_RXSRES 3 301 - #define S6_GMAC_HOST_PBLKCTRL_TXBSIZ 8 302 - #define S6_GMAC_HOST_PBLKCTRL_RXBSIZ 12 303 - #define S6_GMAC_HOST_PBLKCTRL_SIZ_16 4 304 - #define S6_GMAC_HOST_PBLKCTRL_SIZ_32 5 305 - #define S6_GMAC_HOST_PBLKCTRL_SIZ_64 6 306 - #define S6_GMAC_HOST_PBLKCTRL_SIZ_128 7 307 - #define S6_GMAC_HOST_PBLKCTRL_SIZ_MASK 0xF 308 - #define S6_GMAC_HOST_PBLKCTRL_STATENA 16 309 - #define S6_GMAC_HOST_PBLKCTRL_STATAUTOZ 17 310 - #define S6_GMAC_HOST_PBLKCTRL_STATCLEAR 18 311 - #define S6_GMAC_HOST_PBLKCTRL_RGMII 19 312 - #define S6_GMAC_HOST_INTMASK 0x144 313 - #define S6_GMAC_HOST_INTSTAT 0x148 314 - #define S6_GMAC_HOST_INT_TXBURSTOVER 3 315 - #define S6_GMAC_HOST_INT_TXPREWOVER 4 316 - #define S6_GMAC_HOST_INT_RXBURSTUNDER 5 317 - #define S6_GMAC_HOST_INT_RXPOSTRFULL 6 318 - #define S6_GMAC_HOST_INT_RXPOSTRUNDER 7 319 - #define S6_GMAC_HOST_RXFIFOHWM 0x14C 320 - #define S6_GMAC_HOST_CTRLFRAMXP 0x150 321 - #define S6_GMAC_HOST_DSTADDRLO(n) (0x160 + 8*(n)) 322 - #define S6_GMAC_HOST_DSTADDRHI(n) (0x164 + 8*(n)) 323 - #define S6_GMAC_HOST_DSTMASKLO(n) (0x180 + 8*(n)) 324 - #define S6_GMAC_HOST_DSTMASKHI(n) (0x184 + 8*(n)) 325 - 326 - #define S6_GMAC_BURST_PREWR 0x1B0 327 - #define S6_GMAC_BURST_PREWR_LEN 0 328 - #define S6_GMAC_BURST_PREWR_LEN_MASK ((1 << 20) - 1) 329 - #define S6_GMAC_BURST_PREWR_CFE 20 330 - #define S6_GMAC_BURST_PREWR_PPE 21 331 - #define S6_GMAC_BURST_PREWR_FCS 22 332 - #define S6_GMAC_BURST_PREWR_PAD 23 333 - #define S6_GMAC_BURST_POSTRD 0x1D0 334 - #define S6_GMAC_BURST_POSTRD_LEN 0 335 - #define S6_GMAC_BURST_POSTRD_LEN_MASK ((1 << 20) - 1) 336 - #define S6_GMAC_BURST_POSTRD_DROP 20 337 - 338 - 339 - /* data handling */ 340 - 341 - #define S6_NUM_TX_SKB 8 /* must be larger than TX fifo size */ 342 - #define S6_NUM_RX_SKB 16 343 - #define S6_MAX_FRLEN 1536 344 - 345 - struct s6gmac { 346 - u32 reg; 347 - u32 tx_dma; 348 - u32 rx_dma; 349 - u32 io; 350 - u8 tx_chan; 351 - u8 rx_chan; 352 - spinlock_t lock; 353 - u8 tx_skb_i, tx_skb_o; 354 - u8 rx_skb_i, rx_skb_o; 355 - struct sk_buff *tx_skb[S6_NUM_TX_SKB]; 356 - struct sk_buff *rx_skb[S6_NUM_RX_SKB]; 357 - unsigned long carry[sizeof(struct net_device_stats) / sizeof(long)]; 358 - unsigned long stats[sizeof(struct net_device_stats) / sizeof(long)]; 359 - struct phy_device *phydev; 360 - struct { 361 - struct mii_bus *bus; 362 - int irq[PHY_MAX_ADDR]; 363 - } mii; 364 - struct { 365 - unsigned int mbit; 366 - u8 giga; 367 - u8 isup; 368 - u8 full; 369 - } link; 370 - }; 371 - 372 - static void s6gmac_rx_fillfifo(struct net_device *dev) 373 - { 374 - struct s6gmac *pd = netdev_priv(dev); 375 - struct sk_buff *skb; 376 - while ((((u8)(pd->rx_skb_i - pd->rx_skb_o)) < S6_NUM_RX_SKB) && 377 - (!s6dmac_fifo_full(pd->rx_dma, pd->rx_chan)) && 378 - (skb = netdev_alloc_skb(dev, S6_MAX_FRLEN + 2))) { 379 - pd->rx_skb[(pd->rx_skb_i++) % S6_NUM_RX_SKB] = skb; 380 - s6dmac_put_fifo_cache(pd->rx_dma, pd->rx_chan, 381 - pd->io, (u32)skb->data, S6_MAX_FRLEN); 382 - } 383 - } 384 - 385 - static void s6gmac_rx_interrupt(struct net_device *dev) 386 - { 387 - struct s6gmac *pd = netdev_priv(dev); 388 - u32 pfx; 389 - struct sk_buff *skb; 390 - while (((u8)(pd->rx_skb_i - pd->rx_skb_o)) > 391 - s6dmac_pending_count(pd->rx_dma, pd->rx_chan)) { 392 - skb = pd->rx_skb[(pd->rx_skb_o++) % S6_NUM_RX_SKB]; 393 - pfx = readl(pd->reg + S6_GMAC_BURST_POSTRD); 394 - if (pfx & (1 << S6_GMAC_BURST_POSTRD_DROP)) { 395 - dev_kfree_skb_irq(skb); 396 - } else { 397 - skb_put(skb, (pfx >> S6_GMAC_BURST_POSTRD_LEN) 398 - & S6_GMAC_BURST_POSTRD_LEN_MASK); 399 - skb->protocol = eth_type_trans(skb, dev); 400 - skb->ip_summed = CHECKSUM_UNNECESSARY; 401 - netif_rx(skb); 402 - } 403 - } 404 - } 405 - 406 - static void s6gmac_tx_interrupt(struct net_device *dev) 407 - { 408 - struct s6gmac *pd = netdev_priv(dev); 409 - while (((u8)(pd->tx_skb_i - pd->tx_skb_o)) > 410 - s6dmac_pending_count(pd->tx_dma, pd->tx_chan)) { 411 - dev_kfree_skb_irq(pd->tx_skb[(pd->tx_skb_o++) % S6_NUM_TX_SKB]); 412 - } 413 - if (!s6dmac_fifo_full(pd->tx_dma, pd->tx_chan)) 414 - netif_wake_queue(dev); 415 - } 416 - 417 - struct s6gmac_statinf { 418 - unsigned reg_size : 4; /* 0: unused */ 419 - unsigned reg_off : 6; 420 - unsigned net_index : 6; 421 - }; 422 - 423 - #define S6_STATS_B (8 * sizeof(u32)) 424 - #define S6_STATS_C(b, r, f) [b] = { \ 425 - BUILD_BUG_ON_ZERO(r##_SIZE < S6_GMAC_STAT_SIZE_MIN) + \ 426 - BUILD_BUG_ON_ZERO((r##_SIZE - (S6_GMAC_STAT_SIZE_MIN - 1)) \ 427 - >= (1<<4)) + \ 428 - r##_SIZE - (S6_GMAC_STAT_SIZE_MIN - 1), \ 429 - BUILD_BUG_ON_ZERO(((unsigned)((r - S6_GMAC_STAT_REGS) / sizeof(u32))) \ 430 - >= ((1<<6)-1)) + \ 431 - (r - S6_GMAC_STAT_REGS) / sizeof(u32), \ 432 - BUILD_BUG_ON_ZERO((offsetof(struct net_device_stats, f)) \ 433 - % sizeof(unsigned long)) + \ 434 - BUILD_BUG_ON_ZERO((((unsigned)(offsetof(struct net_device_stats, f)) \ 435 - / sizeof(unsigned long)) >= (1<<6))) + \ 436 - BUILD_BUG_ON_ZERO((sizeof(((struct net_device_stats *)0)->f) \ 437 - != sizeof(unsigned long))) + \ 438 - (offsetof(struct net_device_stats, f)) / sizeof(unsigned long)}, 439 - 440 - static const struct s6gmac_statinf statinf[2][S6_STATS_B] = { { 441 - S6_STATS_C(S6_GMAC_STATCARRY1_RBYT, S6_GMAC_STATRBYT, rx_bytes) 442 - S6_STATS_C(S6_GMAC_STATCARRY1_RPKT, S6_GMAC_STATRPKT, rx_packets) 443 - S6_STATS_C(S6_GMAC_STATCARRY1_RFCS, S6_GMAC_STATRFCS, rx_crc_errors) 444 - S6_STATS_C(S6_GMAC_STATCARRY1_RMCA, S6_GMAC_STATRMCA, multicast) 445 - S6_STATS_C(S6_GMAC_STATCARRY1_RALN, S6_GMAC_STATRALN, rx_frame_errors) 446 - S6_STATS_C(S6_GMAC_STATCARRY1_RFLR, S6_GMAC_STATRFLR, rx_length_errors) 447 - S6_STATS_C(S6_GMAC_STATCARRY1_RCDE, S6_GMAC_STATRCDE, rx_missed_errors) 448 - S6_STATS_C(S6_GMAC_STATCARRY1_RUND, S6_GMAC_STATRUND, rx_length_errors) 449 - S6_STATS_C(S6_GMAC_STATCARRY1_ROVR, S6_GMAC_STATROVR, rx_length_errors) 450 - S6_STATS_C(S6_GMAC_STATCARRY1_RFRG, S6_GMAC_STATRFRG, rx_crc_errors) 451 - S6_STATS_C(S6_GMAC_STATCARRY1_RJBR, S6_GMAC_STATRJBR, rx_crc_errors) 452 - S6_STATS_C(S6_GMAC_STATCARRY1_RDRP, S6_GMAC_STATRDRP, rx_dropped) 453 - }, { 454 - S6_STATS_C(S6_GMAC_STATCARRY2_TBYT, S6_GMAC_STATTBYT, tx_bytes) 455 - S6_STATS_C(S6_GMAC_STATCARRY2_TPKT, S6_GMAC_STATTPKT, tx_packets) 456 - S6_STATS_C(S6_GMAC_STATCARRY2_TEDF, S6_GMAC_STATTEDF, tx_aborted_errors) 457 - S6_STATS_C(S6_GMAC_STATCARRY2_TXCL, S6_GMAC_STATTXCL, tx_aborted_errors) 458 - S6_STATS_C(S6_GMAC_STATCARRY2_TNCL, S6_GMAC_STATTNCL, collisions) 459 - S6_STATS_C(S6_GMAC_STATCARRY2_TDRP, S6_GMAC_STATTDRP, tx_dropped) 460 - S6_STATS_C(S6_GMAC_STATCARRY2_TJBR, S6_GMAC_STATTJBR, tx_errors) 461 - S6_STATS_C(S6_GMAC_STATCARRY2_TFCS, S6_GMAC_STATTFCS, tx_errors) 462 - S6_STATS_C(S6_GMAC_STATCARRY2_TOVR, S6_GMAC_STATTOVR, tx_errors) 463 - S6_STATS_C(S6_GMAC_STATCARRY2_TUND, S6_GMAC_STATTUND, tx_errors) 464 - S6_STATS_C(S6_GMAC_STATCARRY2_TFRG, S6_GMAC_STATTFRG, tx_errors) 465 - } }; 466 - 467 - static void s6gmac_stats_collect(struct s6gmac *pd, 468 - const struct s6gmac_statinf *inf) 469 - { 470 - int b; 471 - for (b = 0; b < S6_STATS_B; b++) { 472 - if (inf[b].reg_size) { 473 - pd->stats[inf[b].net_index] += 474 - readl(pd->reg + S6_GMAC_STAT_REGS 475 - + sizeof(u32) * inf[b].reg_off); 476 - } 477 - } 478 - } 479 - 480 - static void s6gmac_stats_carry(struct s6gmac *pd, 481 - const struct s6gmac_statinf *inf, u32 mask) 482 - { 483 - int b; 484 - while (mask) { 485 - b = fls(mask) - 1; 486 - mask &= ~(1 << b); 487 - pd->carry[inf[b].net_index] += (1 << inf[b].reg_size); 488 - } 489 - } 490 - 491 - static inline u32 s6gmac_stats_pending(struct s6gmac *pd, int carry) 492 - { 493 - int r = readl(pd->reg + S6_GMAC_STATCARRY(carry)) & 494 - ~readl(pd->reg + S6_GMAC_STATCARRYMSK(carry)); 495 - return r; 496 - } 497 - 498 - static inline void s6gmac_stats_interrupt(struct s6gmac *pd, int carry) 499 - { 500 - u32 mask; 501 - mask = s6gmac_stats_pending(pd, carry); 502 - if (mask) { 503 - writel(mask, pd->reg + S6_GMAC_STATCARRY(carry)); 504 - s6gmac_stats_carry(pd, &statinf[carry][0], mask); 505 - } 506 - } 507 - 508 - static irqreturn_t s6gmac_interrupt(int irq, void *dev_id) 509 - { 510 - struct net_device *dev = (struct net_device *)dev_id; 511 - struct s6gmac *pd = netdev_priv(dev); 512 - if (!dev) 513 - return IRQ_NONE; 514 - spin_lock(&pd->lock); 515 - if (s6dmac_termcnt_irq(pd->rx_dma, pd->rx_chan)) 516 - s6gmac_rx_interrupt(dev); 517 - s6gmac_rx_fillfifo(dev); 518 - if (s6dmac_termcnt_irq(pd->tx_dma, pd->tx_chan)) 519 - s6gmac_tx_interrupt(dev); 520 - s6gmac_stats_interrupt(pd, 0); 521 - s6gmac_stats_interrupt(pd, 1); 522 - spin_unlock(&pd->lock); 523 - return IRQ_HANDLED; 524 - } 525 - 526 - static inline void s6gmac_set_dstaddr(struct s6gmac *pd, int n, 527 - u32 addrlo, u32 addrhi, u32 masklo, u32 maskhi) 528 - { 529 - writel(addrlo, pd->reg + S6_GMAC_HOST_DSTADDRLO(n)); 530 - writel(addrhi, pd->reg + S6_GMAC_HOST_DSTADDRHI(n)); 531 - writel(masklo, pd->reg + S6_GMAC_HOST_DSTMASKLO(n)); 532 - writel(maskhi, pd->reg + S6_GMAC_HOST_DSTMASKHI(n)); 533 - } 534 - 535 - static inline void s6gmac_stop_device(struct net_device *dev) 536 - { 537 - struct s6gmac *pd = netdev_priv(dev); 538 - writel(0, pd->reg + S6_GMAC_MACCONF1); 539 - } 540 - 541 - static inline void s6gmac_init_device(struct net_device *dev) 542 - { 543 - struct s6gmac *pd = netdev_priv(dev); 544 - int is_rgmii = !!(pd->phydev->supported 545 - & (SUPPORTED_1000baseT_Full | SUPPORTED_1000baseT_Half)); 546 - #if 0 547 - writel(1 << S6_GMAC_MACCONF1_SYNCTX | 548 - 1 << S6_GMAC_MACCONF1_SYNCRX | 549 - 1 << S6_GMAC_MACCONF1_TXFLOWCTRL | 550 - 1 << S6_GMAC_MACCONF1_RXFLOWCTRL | 551 - 1 << S6_GMAC_MACCONF1_RESTXFUNC | 552 - 1 << S6_GMAC_MACCONF1_RESRXFUNC | 553 - 1 << S6_GMAC_MACCONF1_RESTXMACCTRL | 554 - 1 << S6_GMAC_MACCONF1_RESRXMACCTRL, 555 - pd->reg + S6_GMAC_MACCONF1); 556 - #endif 557 - writel(1 << S6_GMAC_MACCONF1_SOFTRES, pd->reg + S6_GMAC_MACCONF1); 558 - udelay(1000); 559 - writel(1 << S6_GMAC_MACCONF1_TXENA | 1 << S6_GMAC_MACCONF1_RXENA, 560 - pd->reg + S6_GMAC_MACCONF1); 561 - writel(1 << S6_GMAC_HOST_PBLKCTRL_TXSRES | 562 - 1 << S6_GMAC_HOST_PBLKCTRL_RXSRES, 563 - pd->reg + S6_GMAC_HOST_PBLKCTRL); 564 - writel(S6_GMAC_HOST_PBLKCTRL_SIZ_128 << S6_GMAC_HOST_PBLKCTRL_TXBSIZ | 565 - S6_GMAC_HOST_PBLKCTRL_SIZ_128 << S6_GMAC_HOST_PBLKCTRL_RXBSIZ | 566 - 1 << S6_GMAC_HOST_PBLKCTRL_STATENA | 567 - 1 << S6_GMAC_HOST_PBLKCTRL_STATCLEAR | 568 - is_rgmii << S6_GMAC_HOST_PBLKCTRL_RGMII, 569 - pd->reg + S6_GMAC_HOST_PBLKCTRL); 570 - writel(1 << S6_GMAC_MACCONF1_TXENA | 571 - 1 << S6_GMAC_MACCONF1_RXENA | 572 - (dev->flags & IFF_LOOPBACK ? 1 : 0) 573 - << S6_GMAC_MACCONF1_LOOPBACK, 574 - pd->reg + S6_GMAC_MACCONF1); 575 - writel(dev->mtu && (dev->mtu < (S6_MAX_FRLEN - ETH_HLEN-ETH_FCS_LEN)) ? 576 - dev->mtu+ETH_HLEN+ETH_FCS_LEN : S6_MAX_FRLEN, 577 - pd->reg + S6_GMAC_MACMAXFRAMELEN); 578 - writel((pd->link.full ? 1 : 0) << S6_GMAC_MACCONF2_FULL | 579 - 1 << S6_GMAC_MACCONF2_PADCRCENA | 580 - 1 << S6_GMAC_MACCONF2_LENGTHFCHK | 581 - (pd->link.giga ? 582 - S6_GMAC_MACCONF2_IFMODE_BYTE : 583 - S6_GMAC_MACCONF2_IFMODE_NIBBLE) 584 - << S6_GMAC_MACCONF2_IFMODE | 585 - 7 << S6_GMAC_MACCONF2_PREAMBLELEN, 586 - pd->reg + S6_GMAC_MACCONF2); 587 - writel(0, pd->reg + S6_GMAC_MACSTATADDR1); 588 - writel(0, pd->reg + S6_GMAC_MACSTATADDR2); 589 - writel(1 << S6_GMAC_FIFOCONF0_WTMENREQ | 590 - 1 << S6_GMAC_FIFOCONF0_SRFENREQ | 591 - 1 << S6_GMAC_FIFOCONF0_FRFENREQ | 592 - 1 << S6_GMAC_FIFOCONF0_STFENREQ | 593 - 1 << S6_GMAC_FIFOCONF0_FTFENREQ, 594 - pd->reg + S6_GMAC_FIFOCONF0); 595 - writel(128 << S6_GMAC_FIFOCONF3_CFGFTTH | 596 - 128 << S6_GMAC_FIFOCONF3_CFGHWMFT, 597 - pd->reg + S6_GMAC_FIFOCONF3); 598 - writel((S6_GMAC_FIFOCONF_RSV_MASK & ~( 599 - 1 << S6_GMAC_FIFOCONF_RSV_RUNT | 600 - 1 << S6_GMAC_FIFOCONF_RSV_CRCERR | 601 - 1 << S6_GMAC_FIFOCONF_RSV_OK | 602 - 1 << S6_GMAC_FIFOCONF_RSV_DRIBBLE | 603 - 1 << S6_GMAC_FIFOCONF_RSV_CTRLFRAME | 604 - 1 << S6_GMAC_FIFOCONF_RSV_PAUSECTRL | 605 - 1 << S6_GMAC_FIFOCONF_RSV_UNOPCODE | 606 - 1 << S6_GMAC_FIFOCONF_RSV_TRUNCATED)) | 607 - 1 << S6_GMAC_FIFOCONF5_DROPLT64 | 608 - pd->link.giga << S6_GMAC_FIFOCONF5_CFGBYTM | 609 - 1 << S6_GMAC_FIFOCONF5_RXDROPSIZE, 610 - pd->reg + S6_GMAC_FIFOCONF5); 611 - writel(1 << S6_GMAC_FIFOCONF_RSV_RUNT | 612 - 1 << S6_GMAC_FIFOCONF_RSV_CRCERR | 613 - 1 << S6_GMAC_FIFOCONF_RSV_DRIBBLE | 614 - 1 << S6_GMAC_FIFOCONF_RSV_CTRLFRAME | 615 - 1 << S6_GMAC_FIFOCONF_RSV_PAUSECTRL | 616 - 1 << S6_GMAC_FIFOCONF_RSV_UNOPCODE | 617 - 1 << S6_GMAC_FIFOCONF_RSV_TRUNCATED, 618 - pd->reg + S6_GMAC_FIFOCONF4); 619 - s6gmac_set_dstaddr(pd, 0, 620 - 0xFFFFFFFF, 0x0000FFFF, 0xFFFFFFFF, 0x0000FFFF); 621 - s6gmac_set_dstaddr(pd, 1, 622 - dev->dev_addr[5] | 623 - dev->dev_addr[4] << 8 | 624 - dev->dev_addr[3] << 16 | 625 - dev->dev_addr[2] << 24, 626 - dev->dev_addr[1] | 627 - dev->dev_addr[0] << 8, 628 - 0xFFFFFFFF, 0x0000FFFF); 629 - s6gmac_set_dstaddr(pd, 2, 630 - 0x00000000, 0x00000100, 0x00000000, 0x00000100); 631 - s6gmac_set_dstaddr(pd, 3, 632 - 0x00000000, 0x00000000, 0x00000000, 0x00000000); 633 - writel(1 << S6_GMAC_HOST_PBLKCTRL_TXENA | 634 - 1 << S6_GMAC_HOST_PBLKCTRL_RXENA | 635 - S6_GMAC_HOST_PBLKCTRL_SIZ_128 << S6_GMAC_HOST_PBLKCTRL_TXBSIZ | 636 - S6_GMAC_HOST_PBLKCTRL_SIZ_128 << S6_GMAC_HOST_PBLKCTRL_RXBSIZ | 637 - 1 << S6_GMAC_HOST_PBLKCTRL_STATENA | 638 - 1 << S6_GMAC_HOST_PBLKCTRL_STATCLEAR | 639 - is_rgmii << S6_GMAC_HOST_PBLKCTRL_RGMII, 640 - pd->reg + S6_GMAC_HOST_PBLKCTRL); 641 - } 642 - 643 - static void s6mii_enable(struct s6gmac *pd) 644 - { 645 - writel(readl(pd->reg + S6_GMAC_MACCONF1) & 646 - ~(1 << S6_GMAC_MACCONF1_SOFTRES), 647 - pd->reg + S6_GMAC_MACCONF1); 648 - writel((readl(pd->reg + S6_GMAC_MACMIICONF) 649 - & ~(S6_GMAC_MACMIICONF_CSEL_MASK << S6_GMAC_MACMIICONF_CSEL)) 650 - | (S6_GMAC_MACMIICONF_CSEL_DIV168 << S6_GMAC_MACMIICONF_CSEL), 651 - pd->reg + S6_GMAC_MACMIICONF); 652 - } 653 - 654 - static int s6mii_busy(struct s6gmac *pd, int tmo) 655 - { 656 - while (readl(pd->reg + S6_GMAC_MACMIIINDI)) { 657 - if (--tmo == 0) 658 - return -ETIME; 659 - udelay(64); 660 - } 661 - return 0; 662 - } 663 - 664 - static int s6mii_read(struct mii_bus *bus, int phy_addr, int regnum) 665 - { 666 - struct s6gmac *pd = bus->priv; 667 - s6mii_enable(pd); 668 - if (s6mii_busy(pd, 256)) 669 - return -ETIME; 670 - writel(phy_addr << S6_GMAC_MACMIIADDR_PHY | 671 - regnum << S6_GMAC_MACMIIADDR_REG, 672 - pd->reg + S6_GMAC_MACMIIADDR); 673 - writel(1 << S6_GMAC_MACMIICMD_READ, pd->reg + S6_GMAC_MACMIICMD); 674 - writel(0, pd->reg + S6_GMAC_MACMIICMD); 675 - if (s6mii_busy(pd, 256)) 676 - return -ETIME; 677 - return (u16)readl(pd->reg + S6_GMAC_MACMIISTAT); 678 - } 679 - 680 - static int s6mii_write(struct mii_bus *bus, int phy_addr, int regnum, u16 value) 681 - { 682 - struct s6gmac *pd = bus->priv; 683 - s6mii_enable(pd); 684 - if (s6mii_busy(pd, 256)) 685 - return -ETIME; 686 - writel(phy_addr << S6_GMAC_MACMIIADDR_PHY | 687 - regnum << S6_GMAC_MACMIIADDR_REG, 688 - pd->reg + S6_GMAC_MACMIIADDR); 689 - writel(value, pd->reg + S6_GMAC_MACMIICTRL); 690 - if (s6mii_busy(pd, 256)) 691 - return -ETIME; 692 - return 0; 693 - } 694 - 695 - static int s6mii_reset(struct mii_bus *bus) 696 - { 697 - struct s6gmac *pd = bus->priv; 698 - s6mii_enable(pd); 699 - if (s6mii_busy(pd, PHY_INIT_TIMEOUT)) 700 - return -ETIME; 701 - return 0; 702 - } 703 - 704 - static void s6gmac_set_rgmii_txclock(struct s6gmac *pd) 705 - { 706 - u32 pllsel = readl(S6_REG_GREG1 + S6_GREG1_PLLSEL); 707 - pllsel &= ~(S6_GREG1_PLLSEL_GMAC_MASK << S6_GREG1_PLLSEL_GMAC); 708 - switch (pd->link.mbit) { 709 - case 10: 710 - pllsel |= S6_GREG1_PLLSEL_GMAC_2500KHZ << S6_GREG1_PLLSEL_GMAC; 711 - break; 712 - case 100: 713 - pllsel |= S6_GREG1_PLLSEL_GMAC_25MHZ << S6_GREG1_PLLSEL_GMAC; 714 - break; 715 - case 1000: 716 - pllsel |= S6_GREG1_PLLSEL_GMAC_125MHZ << S6_GREG1_PLLSEL_GMAC; 717 - break; 718 - default: 719 - return; 720 - } 721 - writel(pllsel, S6_REG_GREG1 + S6_GREG1_PLLSEL); 722 - } 723 - 724 - static inline void s6gmac_linkisup(struct net_device *dev, int isup) 725 - { 726 - struct s6gmac *pd = netdev_priv(dev); 727 - struct phy_device *phydev = pd->phydev; 728 - 729 - pd->link.full = phydev->duplex; 730 - pd->link.giga = (phydev->speed == 1000); 731 - if (pd->link.mbit != phydev->speed) { 732 - pd->link.mbit = phydev->speed; 733 - s6gmac_set_rgmii_txclock(pd); 734 - } 735 - pd->link.isup = isup; 736 - if (isup) 737 - netif_carrier_on(dev); 738 - phy_print_status(phydev); 739 - } 740 - 741 - static void s6gmac_adjust_link(struct net_device *dev) 742 - { 743 - struct s6gmac *pd = netdev_priv(dev); 744 - struct phy_device *phydev = pd->phydev; 745 - if (pd->link.isup && 746 - (!phydev->link || 747 - (pd->link.mbit != phydev->speed) || 748 - (pd->link.full != phydev->duplex))) { 749 - pd->link.isup = 0; 750 - netif_tx_disable(dev); 751 - if (!phydev->link) { 752 - netif_carrier_off(dev); 753 - phy_print_status(phydev); 754 - } 755 - } 756 - if (!pd->link.isup && phydev->link) { 757 - if (pd->link.full != phydev->duplex) { 758 - u32 maccfg = readl(pd->reg + S6_GMAC_MACCONF2); 759 - if (phydev->duplex) 760 - maccfg |= 1 << S6_GMAC_MACCONF2_FULL; 761 - else 762 - maccfg &= ~(1 << S6_GMAC_MACCONF2_FULL); 763 - writel(maccfg, pd->reg + S6_GMAC_MACCONF2); 764 - } 765 - 766 - if (pd->link.giga != (phydev->speed == 1000)) { 767 - u32 fifocfg = readl(pd->reg + S6_GMAC_FIFOCONF5); 768 - u32 maccfg = readl(pd->reg + S6_GMAC_MACCONF2); 769 - maccfg &= ~(S6_GMAC_MACCONF2_IFMODE_MASK 770 - << S6_GMAC_MACCONF2_IFMODE); 771 - if (phydev->speed == 1000) { 772 - fifocfg |= 1 << S6_GMAC_FIFOCONF5_CFGBYTM; 773 - maccfg |= S6_GMAC_MACCONF2_IFMODE_BYTE 774 - << S6_GMAC_MACCONF2_IFMODE; 775 - } else { 776 - fifocfg &= ~(1 << S6_GMAC_FIFOCONF5_CFGBYTM); 777 - maccfg |= S6_GMAC_MACCONF2_IFMODE_NIBBLE 778 - << S6_GMAC_MACCONF2_IFMODE; 779 - } 780 - writel(fifocfg, pd->reg + S6_GMAC_FIFOCONF5); 781 - writel(maccfg, pd->reg + S6_GMAC_MACCONF2); 782 - } 783 - 784 - if (!s6dmac_fifo_full(pd->tx_dma, pd->tx_chan)) 785 - netif_wake_queue(dev); 786 - s6gmac_linkisup(dev, 1); 787 - } 788 - } 789 - 790 - static inline int s6gmac_phy_start(struct net_device *dev) 791 - { 792 - struct s6gmac *pd = netdev_priv(dev); 793 - int i = 0; 794 - struct phy_device *p = NULL; 795 - while ((i < PHY_MAX_ADDR) && (!(p = pd->mii.bus->phy_map[i]))) 796 - i++; 797 - p = phy_connect(dev, dev_name(&p->dev), &s6gmac_adjust_link, 798 - PHY_INTERFACE_MODE_RGMII); 799 - if (IS_ERR(p)) { 800 - printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); 801 - return PTR_ERR(p); 802 - } 803 - p->supported &= PHY_GBIT_FEATURES; 804 - p->advertising = p->supported; 805 - pd->phydev = p; 806 - return 0; 807 - } 808 - 809 - static inline void s6gmac_init_stats(struct net_device *dev) 810 - { 811 - struct s6gmac *pd = netdev_priv(dev); 812 - u32 mask; 813 - mask = 1 << S6_GMAC_STATCARRY1_RDRP | 814 - 1 << S6_GMAC_STATCARRY1_RJBR | 815 - 1 << S6_GMAC_STATCARRY1_RFRG | 816 - 1 << S6_GMAC_STATCARRY1_ROVR | 817 - 1 << S6_GMAC_STATCARRY1_RUND | 818 - 1 << S6_GMAC_STATCARRY1_RCDE | 819 - 1 << S6_GMAC_STATCARRY1_RFLR | 820 - 1 << S6_GMAC_STATCARRY1_RALN | 821 - 1 << S6_GMAC_STATCARRY1_RMCA | 822 - 1 << S6_GMAC_STATCARRY1_RFCS | 823 - 1 << S6_GMAC_STATCARRY1_RPKT | 824 - 1 << S6_GMAC_STATCARRY1_RBYT; 825 - writel(mask, pd->reg + S6_GMAC_STATCARRY(0)); 826 - writel(~mask, pd->reg + S6_GMAC_STATCARRYMSK(0)); 827 - mask = 1 << S6_GMAC_STATCARRY2_TDRP | 828 - 1 << S6_GMAC_STATCARRY2_TNCL | 829 - 1 << S6_GMAC_STATCARRY2_TXCL | 830 - 1 << S6_GMAC_STATCARRY2_TEDF | 831 - 1 << S6_GMAC_STATCARRY2_TPKT | 832 - 1 << S6_GMAC_STATCARRY2_TBYT | 833 - 1 << S6_GMAC_STATCARRY2_TFRG | 834 - 1 << S6_GMAC_STATCARRY2_TUND | 835 - 1 << S6_GMAC_STATCARRY2_TOVR | 836 - 1 << S6_GMAC_STATCARRY2_TFCS | 837 - 1 << S6_GMAC_STATCARRY2_TJBR; 838 - writel(mask, pd->reg + S6_GMAC_STATCARRY(1)); 839 - writel(~mask, pd->reg + S6_GMAC_STATCARRYMSK(1)); 840 - } 841 - 842 - static inline void s6gmac_init_dmac(struct net_device *dev) 843 - { 844 - struct s6gmac *pd = netdev_priv(dev); 845 - s6dmac_disable_chan(pd->tx_dma, pd->tx_chan); 846 - s6dmac_disable_chan(pd->rx_dma, pd->rx_chan); 847 - s6dmac_disable_error_irqs(pd->tx_dma, 1 << S6_HIFDMA_GMACTX); 848 - s6dmac_disable_error_irqs(pd->rx_dma, 1 << S6_HIFDMA_GMACRX); 849 - } 850 - 851 - static int s6gmac_tx(struct sk_buff *skb, struct net_device *dev) 852 - { 853 - struct s6gmac *pd = netdev_priv(dev); 854 - unsigned long flags; 855 - 856 - spin_lock_irqsave(&pd->lock, flags); 857 - writel(skb->len << S6_GMAC_BURST_PREWR_LEN | 858 - 0 << S6_GMAC_BURST_PREWR_CFE | 859 - 1 << S6_GMAC_BURST_PREWR_PPE | 860 - 1 << S6_GMAC_BURST_PREWR_FCS | 861 - ((skb->len < ETH_ZLEN) ? 1 : 0) << S6_GMAC_BURST_PREWR_PAD, 862 - pd->reg + S6_GMAC_BURST_PREWR); 863 - s6dmac_put_fifo_cache(pd->tx_dma, pd->tx_chan, 864 - (u32)skb->data, pd->io, skb->len); 865 - if (s6dmac_fifo_full(pd->tx_dma, pd->tx_chan)) 866 - netif_stop_queue(dev); 867 - if (((u8)(pd->tx_skb_i - pd->tx_skb_o)) >= S6_NUM_TX_SKB) { 868 - printk(KERN_ERR "GMAC BUG: skb tx ring overflow [%x, %x]\n", 869 - pd->tx_skb_o, pd->tx_skb_i); 870 - BUG(); 871 - } 872 - pd->tx_skb[(pd->tx_skb_i++) % S6_NUM_TX_SKB] = skb; 873 - spin_unlock_irqrestore(&pd->lock, flags); 874 - return 0; 875 - } 876 - 877 - static void s6gmac_tx_timeout(struct net_device *dev) 878 - { 879 - struct s6gmac *pd = netdev_priv(dev); 880 - unsigned long flags; 881 - spin_lock_irqsave(&pd->lock, flags); 882 - s6gmac_tx_interrupt(dev); 883 - spin_unlock_irqrestore(&pd->lock, flags); 884 - } 885 - 886 - static int s6gmac_open(struct net_device *dev) 887 - { 888 - struct s6gmac *pd = netdev_priv(dev); 889 - unsigned long flags; 890 - phy_read_status(pd->phydev); 891 - spin_lock_irqsave(&pd->lock, flags); 892 - pd->link.mbit = 0; 893 - s6gmac_linkisup(dev, pd->phydev->link); 894 - s6gmac_init_device(dev); 895 - s6gmac_init_stats(dev); 896 - s6gmac_init_dmac(dev); 897 - s6gmac_rx_fillfifo(dev); 898 - s6dmac_enable_chan(pd->rx_dma, pd->rx_chan, 899 - 2, 1, 0, 1, 0, 0, 0, 7, -1, 2, 0, 1); 900 - s6dmac_enable_chan(pd->tx_dma, pd->tx_chan, 901 - 2, 0, 1, 0, 0, 0, 0, 7, -1, 2, 0, 1); 902 - writel(0 << S6_GMAC_HOST_INT_TXBURSTOVER | 903 - 0 << S6_GMAC_HOST_INT_TXPREWOVER | 904 - 0 << S6_GMAC_HOST_INT_RXBURSTUNDER | 905 - 0 << S6_GMAC_HOST_INT_RXPOSTRFULL | 906 - 0 << S6_GMAC_HOST_INT_RXPOSTRUNDER, 907 - pd->reg + S6_GMAC_HOST_INTMASK); 908 - spin_unlock_irqrestore(&pd->lock, flags); 909 - phy_start(pd->phydev); 910 - netif_start_queue(dev); 911 - return 0; 912 - } 913 - 914 - static int s6gmac_stop(struct net_device *dev) 915 - { 916 - struct s6gmac *pd = netdev_priv(dev); 917 - unsigned long flags; 918 - netif_stop_queue(dev); 919 - phy_stop(pd->phydev); 920 - spin_lock_irqsave(&pd->lock, flags); 921 - s6gmac_init_dmac(dev); 922 - s6gmac_stop_device(dev); 923 - while (pd->tx_skb_i != pd->tx_skb_o) 924 - dev_kfree_skb(pd->tx_skb[(pd->tx_skb_o++) % S6_NUM_TX_SKB]); 925 - while (pd->rx_skb_i != pd->rx_skb_o) 926 - dev_kfree_skb(pd->rx_skb[(pd->rx_skb_o++) % S6_NUM_RX_SKB]); 927 - spin_unlock_irqrestore(&pd->lock, flags); 928 - return 0; 929 - } 930 - 931 - static struct net_device_stats *s6gmac_stats(struct net_device *dev) 932 - { 933 - struct s6gmac *pd = netdev_priv(dev); 934 - struct net_device_stats *st = (struct net_device_stats *)&pd->stats; 935 - int i; 936 - do { 937 - unsigned long flags; 938 - spin_lock_irqsave(&pd->lock, flags); 939 - for (i = 0; i < ARRAY_SIZE(pd->stats); i++) 940 - pd->stats[i] = 941 - pd->carry[i] << (S6_GMAC_STAT_SIZE_MIN - 1); 942 - s6gmac_stats_collect(pd, &statinf[0][0]); 943 - s6gmac_stats_collect(pd, &statinf[1][0]); 944 - i = s6gmac_stats_pending(pd, 0) | 945 - s6gmac_stats_pending(pd, 1); 946 - spin_unlock_irqrestore(&pd->lock, flags); 947 - } while (i); 948 - st->rx_errors = st->rx_crc_errors + 949 - st->rx_frame_errors + 950 - st->rx_length_errors + 951 - st->rx_missed_errors; 952 - st->tx_errors += st->tx_aborted_errors; 953 - return st; 954 - } 955 - 956 - static int s6gmac_probe(struct platform_device *pdev) 957 - { 958 - struct net_device *dev; 959 - struct s6gmac *pd; 960 - int res; 961 - unsigned long i; 962 - struct mii_bus *mb; 963 - 964 - dev = alloc_etherdev(sizeof(*pd)); 965 - if (!dev) 966 - return -ENOMEM; 967 - 968 - dev->open = s6gmac_open; 969 - dev->stop = s6gmac_stop; 970 - dev->hard_start_xmit = s6gmac_tx; 971 - dev->tx_timeout = s6gmac_tx_timeout; 972 - dev->watchdog_timeo = HZ; 973 - dev->get_stats = s6gmac_stats; 974 - dev->irq = platform_get_irq(pdev, 0); 975 - pd = netdev_priv(dev); 976 - memset(pd, 0, sizeof(*pd)); 977 - spin_lock_init(&pd->lock); 978 - pd->reg = platform_get_resource(pdev, IORESOURCE_MEM, 0)->start; 979 - i = platform_get_resource(pdev, IORESOURCE_DMA, 0)->start; 980 - pd->tx_dma = DMA_MASK_DMAC(i); 981 - pd->tx_chan = DMA_INDEX_CHNL(i); 982 - i = platform_get_resource(pdev, IORESOURCE_DMA, 1)->start; 983 - pd->rx_dma = DMA_MASK_DMAC(i); 984 - pd->rx_chan = DMA_INDEX_CHNL(i); 985 - pd->io = platform_get_resource(pdev, IORESOURCE_IO, 0)->start; 986 - res = request_irq(dev->irq, s6gmac_interrupt, 0, dev->name, dev); 987 - if (res) { 988 - printk(KERN_ERR DRV_PRMT "irq request failed: %d\n", dev->irq); 989 - goto errirq; 990 - } 991 - res = register_netdev(dev); 992 - if (res) { 993 - printk(KERN_ERR DRV_PRMT "error registering device %s\n", 994 - dev->name); 995 - goto errdev; 996 - } 997 - mb = mdiobus_alloc(); 998 - if (!mb) { 999 - printk(KERN_ERR DRV_PRMT "error allocating mii bus\n"); 1000 - res = -ENOMEM; 1001 - goto errmii; 1002 - } 1003 - mb->name = "s6gmac_mii"; 1004 - mb->read = s6mii_read; 1005 - mb->write = s6mii_write; 1006 - mb->reset = s6mii_reset; 1007 - mb->priv = pd; 1008 - snprintf(mb->id, MII_BUS_ID_SIZE, "%s-%x", pdev->name, pdev->id); 1009 - mb->phy_mask = ~(1 << 0); 1010 - mb->irq = &pd->mii.irq[0]; 1011 - for (i = 0; i < PHY_MAX_ADDR; i++) { 1012 - int n = platform_get_irq(pdev, i + 1); 1013 - if (n < 0) 1014 - n = PHY_POLL; 1015 - pd->mii.irq[i] = n; 1016 - } 1017 - mdiobus_register(mb); 1018 - pd->mii.bus = mb; 1019 - res = s6gmac_phy_start(dev); 1020 - if (res) 1021 - return res; 1022 - platform_set_drvdata(pdev, dev); 1023 - return 0; 1024 - errmii: 1025 - unregister_netdev(dev); 1026 - errdev: 1027 - free_irq(dev->irq, dev); 1028 - errirq: 1029 - free_netdev(dev); 1030 - return res; 1031 - } 1032 - 1033 - static int s6gmac_remove(struct platform_device *pdev) 1034 - { 1035 - struct net_device *dev = platform_get_drvdata(pdev); 1036 - if (dev) { 1037 - struct s6gmac *pd = netdev_priv(dev); 1038 - mdiobus_unregister(pd->mii.bus); 1039 - unregister_netdev(dev); 1040 - free_irq(dev->irq, dev); 1041 - free_netdev(dev); 1042 - } 1043 - return 0; 1044 - } 1045 - 1046 - static struct platform_driver s6gmac_driver = { 1047 - .probe = s6gmac_probe, 1048 - .remove = s6gmac_remove, 1049 - .driver = { 1050 - .name = "s6gmac", 1051 - }, 1052 - }; 1053 - 1054 - module_platform_driver(s6gmac_driver); 1055 - 1056 - MODULE_LICENSE("GPL"); 1057 - MODULE_DESCRIPTION("S6105 on chip Ethernet driver"); 1058 - MODULE_AUTHOR("Oskar Schirmer <oskar@scara.com>");
+8 -6
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 1671 1671 * 0 on success and an appropriate (-)ve integer as defined in errno.h 1672 1672 * file on failure. 1673 1673 */ 1674 - static int stmmac_hw_setup(struct net_device *dev) 1674 + static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) 1675 1675 { 1676 1676 struct stmmac_priv *priv = netdev_priv(dev); 1677 1677 int ret; ··· 1708 1708 1709 1709 stmmac_mmc_setup(priv); 1710 1710 1711 - ret = stmmac_init_ptp(priv); 1712 - if (ret && ret != -EOPNOTSUPP) 1713 - pr_warn("%s: failed PTP initialisation\n", __func__); 1711 + if (init_ptp) { 1712 + ret = stmmac_init_ptp(priv); 1713 + if (ret && ret != -EOPNOTSUPP) 1714 + pr_warn("%s: failed PTP initialisation\n", __func__); 1715 + } 1714 1716 1715 1717 #ifdef CONFIG_DEBUG_FS 1716 1718 ret = stmmac_init_fs(dev); ··· 1789 1787 goto init_error; 1790 1788 } 1791 1789 1792 - ret = stmmac_hw_setup(dev); 1790 + ret = stmmac_hw_setup(dev, true); 1793 1791 if (ret < 0) { 1794 1792 pr_err("%s: Hw setup failed\n", __func__); 1795 1793 goto init_error; ··· 3038 3036 netif_device_attach(ndev); 3039 3037 3040 3038 init_dma_desc_rings(ndev, GFP_ATOMIC); 3041 - stmmac_hw_setup(ndev); 3039 + stmmac_hw_setup(ndev, false); 3042 3040 stmmac_init_tx_coalesce(priv); 3043 3041 3044 3042 napi_enable(&priv->napi);
-1
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
··· 430 430 .remove = stmmac_pltfr_remove, 431 431 .driver = { 432 432 .name = STMMAC_RESOURCE_NAME, 433 - .owner = THIS_MODULE, 434 433 .pm = &stmmac_pltfr_pm_ops, 435 434 .of_match_table = of_match_ptr(stmmac_dt_ids), 436 435 },
+1
drivers/net/ethernet/sun/sunvnet.c
··· 1201 1201 segs = skb_gso_segment(skb, dev->features & ~NETIF_F_TSO); 1202 1202 if (IS_ERR(segs)) { 1203 1203 dev->stats.tx_dropped++; 1204 + dev_kfree_skb_any(skb); 1204 1205 return NETDEV_TX_OK; 1205 1206 } 1206 1207
-2
drivers/net/ethernet/xilinx/xilinx_axienet.h
··· 388 388 * @dma_err_tasklet: Tasklet structure to process Axi DMA errors 389 389 * @tx_irq: Axidma TX IRQ number 390 390 * @rx_irq: Axidma RX IRQ number 391 - * @temac_type: axienet type to identify between soft and hard temac 392 391 * @phy_type: Phy type to identify between MII/GMII/RGMII/SGMII/1000 Base-X 393 392 * @options: AxiEthernet option word 394 393 * @last_link: Phy link state in which the PHY was negotiated earlier ··· 430 431 431 432 int tx_irq; 432 433 int rx_irq; 433 - u32 temac_type; 434 434 u32 phy_type; 435 435 436 436 u32 options; /* Current options word */
-4
drivers/net/ethernet/xilinx/xilinx_axienet_main.c
··· 1555 1555 if ((be32_to_cpup(p)) >= 0x4000) 1556 1556 lp->jumbo_support = 1; 1557 1557 } 1558 - p = (__be32 *) of_get_property(op->dev.of_node, "xlnx,temac-type", 1559 - NULL); 1560 - if (p) 1561 - lp->temac_type = be32_to_cpup(p); 1562 1558 p = (__be32 *) of_get_property(op->dev.of_node, "xlnx,phy-type", NULL); 1563 1559 if (p) 1564 1560 lp->phy_type = be32_to_cpup(p);
+1
drivers/net/hyperv/hyperv_net.h
··· 590 590 591 591 592 592 #define NETVSC_RECEIVE_BUFFER_ID 0xcafe 593 + #define NETVSC_SEND_BUFFER_ID 0 593 594 594 595 #define NETVSC_PACKET_SIZE 4096 595 596
+8 -7
drivers/net/hyperv/netvsc.c
··· 161 161 162 162 /* Deal with the send buffer we may have setup. 163 163 * If we got a send section size, it means we received a 164 - * SendsendBufferComplete msg (ie sent 165 - * NvspMessage1TypeSendReceiveBuffer msg) therefore, we need 164 + * NVSP_MSG1_TYPE_SEND_SEND_BUF_COMPLETE msg (ie sent 165 + * NVSP_MSG1_TYPE_SEND_SEND_BUF msg) therefore, we need 166 166 * to send a revoke msg here 167 167 */ 168 168 if (net_device->send_section_size) { ··· 172 172 173 173 revoke_packet->hdr.msg_type = 174 174 NVSP_MSG1_TYPE_REVOKE_SEND_BUF; 175 - revoke_packet->msg.v1_msg.revoke_recv_buf.id = 0; 175 + revoke_packet->msg.v1_msg.revoke_send_buf.id = 176 + NETVSC_SEND_BUFFER_ID; 176 177 177 178 ret = vmbus_sendpacket(net_device->dev->channel, 178 179 revoke_packet, ··· 205 204 net_device->send_buf_gpadl_handle = 0; 206 205 } 207 206 if (net_device->send_buf) { 208 - /* Free up the receive buffer */ 207 + /* Free up the send buffer */ 209 208 vfree(net_device->send_buf); 210 209 net_device->send_buf = NULL; 211 210 } ··· 340 339 init_packet = &net_device->channel_init_pkt; 341 340 memset(init_packet, 0, sizeof(struct nvsp_message)); 342 341 init_packet->hdr.msg_type = NVSP_MSG1_TYPE_SEND_SEND_BUF; 343 - init_packet->msg.v1_msg.send_recv_buf.gpadl_handle = 342 + init_packet->msg.v1_msg.send_send_buf.gpadl_handle = 344 343 net_device->send_buf_gpadl_handle; 345 - init_packet->msg.v1_msg.send_recv_buf.id = 0; 344 + init_packet->msg.v1_msg.send_send_buf.id = NETVSC_SEND_BUFFER_ID; 346 345 347 346 /* Send the gpadl notification request */ 348 347 ret = vmbus_sendpacket(device->channel, init_packet, ··· 365 364 netdev_err(ndev, "Unable to complete send buffer " 366 365 "initialization with NetVsp - status %d\n", 367 366 init_packet->msg.v1_msg. 368 - send_recv_buf_complete.status); 367 + send_send_buf_complete.status); 369 368 ret = -EINVAL; 370 369 goto cleanup; 371 370 }
+3 -15
drivers/net/phy/micrel.c
··· 88 88 89 89 static const struct kszphy_type ksz8021_type = { 90 90 .led_mode_reg = MII_KSZPHY_CTRL_2, 91 + .has_broadcast_disable = true, 91 92 .has_rmii_ref_clk_sel = true, 92 93 }; 93 94 ··· 257 256 kszphy_setup_led(phydev, type->led_mode_reg, priv->led_mode); 258 257 259 258 return 0; 260 - } 261 - 262 - static int ksz8021_config_init(struct phy_device *phydev) 263 - { 264 - int rc; 265 - 266 - rc = kszphy_config_init(phydev); 267 - if (rc) 268 - return rc; 269 - 270 - rc = kszphy_broadcast_disable(phydev); 271 - 272 - return rc < 0 ? rc : 0; 273 259 } 274 260 275 261 static int ksz9021_load_values_from_of(struct phy_device *phydev, ··· 572 584 .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, 573 585 .driver_data = &ksz8021_type, 574 586 .probe = kszphy_probe, 575 - .config_init = ksz8021_config_init, 587 + .config_init = kszphy_config_init, 576 588 .config_aneg = genphy_config_aneg, 577 589 .read_status = genphy_read_status, 578 590 .ack_interrupt = kszphy_ack_interrupt, ··· 589 601 .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, 590 602 .driver_data = &ksz8021_type, 591 603 .probe = kszphy_probe, 592 - .config_init = ksz8021_config_init, 604 + .config_init = kszphy_config_init, 593 605 .config_aneg = genphy_config_aneg, 594 606 .read_status = genphy_read_status, 595 607 .ack_interrupt = kszphy_ack_interrupt,
-2
drivers/net/virtio_net.c
··· 760 760 container_of(napi, struct receive_queue, napi); 761 761 unsigned int r, received = 0; 762 762 763 - again: 764 763 received += virtnet_receive(rq, budget - received); 765 764 766 765 /* Out of packets? */ ··· 770 771 napi_schedule_prep(napi)) { 771 772 virtqueue_disable_cb(rq->vq); 772 773 __napi_schedule(napi); 773 - goto again; 774 774 } 775 775 } 776 776
+24 -10
drivers/net/vxlan.c
··· 1579 1579 bool udp_sum = !udp_get_no_check6_tx(vs->sock->sk); 1580 1580 1581 1581 skb = udp_tunnel_handle_offloads(skb, udp_sum); 1582 - if (IS_ERR(skb)) 1583 - return -EINVAL; 1582 + if (IS_ERR(skb)) { 1583 + err = -EINVAL; 1584 + goto err; 1585 + } 1584 1586 1585 1587 skb_scrub_packet(skb, xnet); 1586 1588 ··· 1592 1590 1593 1591 /* Need space for new headers (invalidates iph ptr) */ 1594 1592 err = skb_cow_head(skb, min_headroom); 1595 - if (unlikely(err)) 1596 - return err; 1593 + if (unlikely(err)) { 1594 + kfree_skb(skb); 1595 + goto err; 1596 + } 1597 1597 1598 1598 skb = vlan_hwaccel_push_inside(skb); 1599 - if (WARN_ON(!skb)) 1600 - return -ENOMEM; 1599 + if (WARN_ON(!skb)) { 1600 + err = -ENOMEM; 1601 + goto err; 1602 + } 1601 1603 1602 1604 vxh = (struct vxlanhdr *) __skb_push(skb, sizeof(*vxh)); 1603 1605 vxh->vx_flags = htonl(VXLAN_FLAGS); ··· 1612 1606 udp_tunnel6_xmit_skb(vs->sock, dst, skb, dev, saddr, daddr, prio, 1613 1607 ttl, src_port, dst_port); 1614 1608 return 0; 1609 + err: 1610 + dst_release(dst); 1611 + return err; 1615 1612 } 1616 1613 #endif 1617 1614 ··· 1630 1621 1631 1622 skb = udp_tunnel_handle_offloads(skb, udp_sum); 1632 1623 if (IS_ERR(skb)) 1633 - return -EINVAL; 1624 + return PTR_ERR(skb); 1634 1625 1635 1626 min_headroom = LL_RESERVED_SPACE(rt->dst.dev) + rt->dst.header_len 1636 1627 + VXLAN_HLEN + sizeof(struct iphdr) ··· 1638 1629 1639 1630 /* Need space for new headers (invalidates iph ptr) */ 1640 1631 err = skb_cow_head(skb, min_headroom); 1641 - if (unlikely(err)) 1632 + if (unlikely(err)) { 1633 + kfree_skb(skb); 1642 1634 return err; 1635 + } 1643 1636 1644 1637 skb = vlan_hwaccel_push_inside(skb); 1645 1638 if (WARN_ON(!skb)) ··· 1787 1776 tos, ttl, df, src_port, dst_port, 1788 1777 htonl(vni << 8), 1789 1778 !net_eq(vxlan->net, dev_net(vxlan->dev))); 1790 - 1791 - if (err < 0) 1779 + if (err < 0) { 1780 + /* skb is already freed. */ 1781 + skb = NULL; 1792 1782 goto rt_tx_error; 1783 + } 1784 + 1793 1785 iptunnel_xmit_stats(err, &dev->stats, dev->tstats); 1794 1786 #if IS_ENABLED(CONFIG_IPV6) 1795 1787 } else {
+2 -2
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
··· 1070 1070 */ 1071 1071 if ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_KEEP_POWER) && 1072 1072 ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_WAKE_SDIO_IRQ) || 1073 - (sdiodev->pdata->oob_irq_supported))) 1073 + (sdiodev->pdata && sdiodev->pdata->oob_irq_supported))) 1074 1074 bus_if->wowl_supported = true; 1075 1075 #endif 1076 1076 ··· 1167 1167 struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; 1168 1168 1169 1169 brcmf_dbg(SDIO, "Enter\n"); 1170 - if (sdiodev->pdata->oob_irq_supported) 1170 + if (sdiodev->pdata && sdiodev->pdata->oob_irq_supported) 1171 1171 disable_irq_wake(sdiodev->pdata->oob_irq_nr); 1172 1172 brcmf_sdio_wd_timer(sdiodev->bus, BRCMF_WD_POLL_MS); 1173 1173 atomic_set(&sdiodev->suspend, false);
+2 -1
drivers/net/wireless/ipw2x00/Kconfig
··· 65 65 66 66 config IPW2200 67 67 tristate "Intel PRO/Wireless 2200BG and 2915ABG Network Connection" 68 - depends on PCI && CFG80211 && CFG80211_WEXT 68 + depends on PCI && CFG80211 69 + select CFG80211_WEXT 69 70 select WIRELESS_EXT 70 71 select WEXT_SPY 71 72 select WEXT_PRIV
+1 -1
drivers/net/wireless/iwlwifi/iwl-drv.c
··· 1323 1323 1324 1324 try_again: 1325 1325 /* try next, if any */ 1326 - kfree(pieces); 1327 1326 release_firmware(ucode_raw); 1328 1327 if (iwl_request_firmware(drv, false)) 1329 1328 goto out_unbind; 1329 + kfree(pieces); 1330 1330 return; 1331 1331 1332 1332 out_free_fw:
+1
drivers/net/wireless/iwlwifi/iwl-fh.h
··· 310 310 #define FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000) 311 311 312 312 #define FH_MEM_TFDIB_REG1_ADDR_BITSHIFT 28 313 + #define FH_MEM_TB_MAX_LENGTH (0x00020000) 313 314 314 315 /* TFDB Area - TFDs buffer table */ 315 316 #define FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK (0xFFFFFFFF)
+13 -2
drivers/net/wireless/iwlwifi/mvm/mac80211.c
··· 1004 1004 { 1005 1005 lockdep_assert_held(&mvm->mutex); 1006 1006 1007 - /* disallow low power states when the FW is down */ 1008 - iwl_mvm_ref(mvm, IWL_MVM_REF_UCODE_DOWN); 1007 + /* 1008 + * Disallow low power states when the FW is down by taking 1009 + * the UCODE_DOWN ref. in case of ongoing hw restart the 1010 + * ref is already taken, so don't take it again. 1011 + */ 1012 + if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) 1013 + iwl_mvm_ref(mvm, IWL_MVM_REF_UCODE_DOWN); 1009 1014 1010 1015 /* async_handlers_wk is now blocked */ 1011 1016 ··· 1027 1022 1028 1023 /* the fw is stopped, the aux sta is dead: clean up driver state */ 1029 1024 iwl_mvm_del_aux_sta(mvm); 1025 + 1026 + /* 1027 + * Clear IN_HW_RESTART flag when stopping the hw (as restart_complete() 1028 + * won't be called in this case). 1029 + */ 1030 + clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); 1030 1031 1031 1032 mvm->ucode_loaded = false; 1032 1033 }
+4
drivers/net/wireless/iwlwifi/pcie/drv.c
··· 367 367 368 368 /* 3165 Series */ 369 369 {IWL_PCI_DEVICE(0x3165, 0x4010, iwl3165_2ac_cfg)}, 370 + {IWL_PCI_DEVICE(0x3165, 0x4012, iwl3165_2ac_cfg)}, 371 + {IWL_PCI_DEVICE(0x3165, 0x4110, iwl3165_2ac_cfg)}, 370 372 {IWL_PCI_DEVICE(0x3165, 0x4210, iwl3165_2ac_cfg)}, 373 + {IWL_PCI_DEVICE(0x3165, 0x4410, iwl3165_2ac_cfg)}, 374 + {IWL_PCI_DEVICE(0x3165, 0x4510, iwl3165_2ac_cfg)}, 371 375 372 376 /* 7265 Series */ 373 377 {IWL_PCI_DEVICE(0x095A, 0x5010, iwl7265_2ac_cfg)},
+11 -6
drivers/net/wireless/iwlwifi/pcie/trans.c
··· 614 614 { 615 615 u8 *v_addr; 616 616 dma_addr_t p_addr; 617 - u32 offset, chunk_sz = section->len; 617 + u32 offset, chunk_sz = min_t(u32, FH_MEM_TB_MAX_LENGTH, section->len); 618 618 int ret = 0; 619 619 620 620 IWL_DEBUG_FW(trans, "[%d] uCode section being loaded...\n", ··· 1012 1012 /* Stop the device, and put it in low power state */ 1013 1013 iwl_pcie_apm_stop(trans); 1014 1014 1015 - /* Upon stop, the APM issues an interrupt if HW RF kill is set. 1016 - * Clean again the interrupt here 1015 + /* stop and reset the on-board processor */ 1016 + iwl_write32(trans, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); 1017 + udelay(20); 1018 + 1019 + /* 1020 + * Upon stop, the APM issues an interrupt if HW RF kill is set. 1021 + * This is a bug in certain verions of the hardware. 1022 + * Certain devices also keep sending HW RF kill interrupt all 1023 + * the time, unless the interrupt is ACKed even if the interrupt 1024 + * should be masked. Re-ACK all the interrupts here. 1017 1025 */ 1018 1026 spin_lock(&trans_pcie->irq_lock); 1019 1027 iwl_disable_interrupts(trans); 1020 1028 spin_unlock(&trans_pcie->irq_lock); 1021 1029 1022 - /* stop and reset the on-board processor */ 1023 - iwl_write32(trans, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); 1024 - udelay(20); 1025 1030 1026 1031 /* clear all status bits */ 1027 1032 clear_bit(STATUS_SYNC_HCMD_ACTIVE, &trans->status);
+1
drivers/powercap/intel_rapl.c
··· 1041 1041 RAPL_CPU(0x45, rapl_defaults_core),/* Haswell ULT */ 1042 1042 RAPL_CPU(0x4C, rapl_defaults_atom),/* Braswell */ 1043 1043 RAPL_CPU(0x4A, rapl_defaults_atom),/* Tangier */ 1044 + RAPL_CPU(0x56, rapl_defaults_core),/* Future Xeon */ 1044 1045 RAPL_CPU(0x5A, rapl_defaults_atom),/* Annidale */ 1045 1046 {} 1046 1047 };
+12 -7
drivers/regulator/s2mps11.c
··· 570 570 .enable_mask = S2MPS14_ENABLE_MASK \ 571 571 } 572 572 573 - #define regulator_desc_s2mps14_buck(num, min, step) { \ 573 + #define regulator_desc_s2mps14_buck(num, min, step, min_sel) { \ 574 574 .name = "BUCK"#num, \ 575 575 .id = S2MPS14_BUCK##num, \ 576 576 .ops = &s2mps14_reg_ops, \ ··· 579 579 .min_uV = min, \ 580 580 .uV_step = step, \ 581 581 .n_voltages = S2MPS14_BUCK_N_VOLTAGES, \ 582 - .linear_min_sel = S2MPS14_BUCK1235_START_SEL, \ 582 + .linear_min_sel = min_sel, \ 583 583 .ramp_delay = S2MPS14_BUCK_RAMP_DELAY, \ 584 584 .vsel_reg = S2MPS14_REG_B1CTRL2 + (num - 1) * 2, \ 585 585 .vsel_mask = S2MPS14_BUCK_VSEL_MASK, \ ··· 613 613 regulator_desc_s2mps14_ldo(23, MIN_800_MV, STEP_25_MV), 614 614 regulator_desc_s2mps14_ldo(24, MIN_1800_MV, STEP_25_MV), 615 615 regulator_desc_s2mps14_ldo(25, MIN_1800_MV, STEP_25_MV), 616 - regulator_desc_s2mps14_buck(1, MIN_600_MV, STEP_6_25_MV), 617 - regulator_desc_s2mps14_buck(2, MIN_600_MV, STEP_6_25_MV), 618 - regulator_desc_s2mps14_buck(3, MIN_600_MV, STEP_6_25_MV), 619 - regulator_desc_s2mps14_buck(4, MIN_1400_MV, STEP_12_5_MV), 620 - regulator_desc_s2mps14_buck(5, MIN_600_MV, STEP_6_25_MV), 616 + regulator_desc_s2mps14_buck(1, MIN_600_MV, STEP_6_25_MV, 617 + S2MPS14_BUCK1235_START_SEL), 618 + regulator_desc_s2mps14_buck(2, MIN_600_MV, STEP_6_25_MV, 619 + S2MPS14_BUCK1235_START_SEL), 620 + regulator_desc_s2mps14_buck(3, MIN_600_MV, STEP_6_25_MV, 621 + S2MPS14_BUCK1235_START_SEL), 622 + regulator_desc_s2mps14_buck(4, MIN_1400_MV, STEP_12_5_MV, 623 + S2MPS14_BUCK4_START_SEL), 624 + regulator_desc_s2mps14_buck(5, MIN_600_MV, STEP_6_25_MV, 625 + S2MPS14_BUCK1235_START_SEL), 621 626 }; 622 627 623 628 static int s2mps14_pmic_enable_ext_control(struct s2mps11_info *s2mps11,
+1 -1
drivers/scsi/fnic/fnic.h
··· 39 39 40 40 #define DRV_NAME "fnic" 41 41 #define DRV_DESCRIPTION "Cisco FCoE HBA Driver" 42 - #define DRV_VERSION "1.6.0.16" 42 + #define DRV_VERSION "1.6.0.17" 43 43 #define PFX DRV_NAME ": " 44 44 #define DFX DRV_NAME "%d: " 45 45
+15
drivers/scsi/fnic/fnic_scsi.c
··· 1892 1892 goto fnic_abort_cmd_end; 1893 1893 } 1894 1894 1895 + /* IO out of order */ 1896 + 1897 + if (!(CMD_FLAGS(sc) & (FNIC_IO_ABORTED | FNIC_IO_DONE))) { 1898 + spin_unlock_irqrestore(io_lock, flags); 1899 + FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, 1900 + "Issuing Host reset due to out of order IO\n"); 1901 + 1902 + if (fnic_host_reset(sc) == FAILED) { 1903 + FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, 1904 + "fnic_host_reset failed.\n"); 1905 + } 1906 + ret = FAILED; 1907 + goto fnic_abort_cmd_end; 1908 + } 1909 + 1895 1910 CMD_STATE(sc) = FNIC_IOREQ_ABTS_COMPLETE; 1896 1911 1897 1912 /*
+2 -2
drivers/scsi/scsi_error.c
··· 1041 1041 } 1042 1042 /* signal not to enter either branch of the if () below */ 1043 1043 timeleft = 0; 1044 - rtn = NEEDS_RETRY; 1044 + rtn = FAILED; 1045 1045 } else { 1046 1046 timeleft = wait_for_completion_timeout(&done, timeout); 1047 1047 rtn = SUCCESS; ··· 1081 1081 rtn = FAILED; 1082 1082 break; 1083 1083 } 1084 - } else if (!rtn) { 1084 + } else if (rtn != FAILED) { 1085 1085 scsi_abort_eh_cmnd(scmd); 1086 1086 rtn = FAILED; 1087 1087 }
+3 -2
drivers/scsi/sd.c
··· 2623 2623 sd_config_discard(sdkp, SD_LBP_WS16); 2624 2624 2625 2625 } else { /* LBP VPD page tells us what to use */ 2626 - 2627 - if (sdkp->lbpws) 2626 + if (sdkp->lbpu && sdkp->max_unmap_blocks && !sdkp->lbprz) 2627 + sd_config_discard(sdkp, SD_LBP_UNMAP); 2628 + else if (sdkp->lbpws) 2628 2629 sd_config_discard(sdkp, SD_LBP_WS16); 2629 2630 else if (sdkp->lbpws10) 2630 2631 sd_config_discard(sdkp, SD_LBP_WS10);
+4 -4
drivers/spi/spi-img-spfi.c
··· 341 341 default: 342 342 rxconf.src_addr = spfi->phys + SPFI_RX_8BIT_VALID_DATA; 343 343 rxconf.src_addr_width = 1; 344 - rxconf.src_maxburst = 1; 344 + rxconf.src_maxburst = 4; 345 345 } 346 346 dmaengine_slave_config(spfi->rx_ch, &rxconf); 347 347 ··· 368 368 default: 369 369 txconf.dst_addr = spfi->phys + SPFI_TX_8BIT_VALID_DATA; 370 370 txconf.dst_addr_width = 1; 371 - txconf.dst_maxburst = 1; 371 + txconf.dst_maxburst = 4; 372 372 break; 373 373 } 374 374 dmaengine_slave_config(spfi->tx_ch, &txconf); ··· 390 390 dma_async_issue_pending(spfi->rx_ch); 391 391 } 392 392 393 + spfi_start(spfi); 394 + 393 395 if (xfer->tx_buf) { 394 396 spfi->tx_dma_busy = true; 395 397 dmaengine_submit(txdesc); 396 398 dma_async_issue_pending(spfi->tx_ch); 397 399 } 398 - 399 - spfi_start(spfi); 400 400 401 401 return 1; 402 402
+5
drivers/spi/spi-sh-msiof.c
··· 525 525 struct device_node *np = spi->master->dev.of_node; 526 526 struct sh_msiof_spi_priv *p = spi_master_get_devdata(spi->master); 527 527 528 + pm_runtime_get_sync(&p->pdev->dev); 529 + 528 530 if (!np) { 529 531 /* 530 532 * Use spi->controller_data for CS (same strategy as spi_gpio), ··· 544 542 545 543 if (spi->cs_gpio >= 0) 546 544 gpio_set_value(spi->cs_gpio, !(spi->mode & SPI_CS_HIGH)); 545 + 546 + 547 + pm_runtime_put_sync(&p->pdev->dev); 547 548 548 549 return 0; 549 550 }
+1 -1
drivers/staging/lustre/lustre/llite/namei.c
··· 264 264 265 265 if ((bits & (MDS_INODELOCK_LOOKUP | MDS_INODELOCK_PERM)) && 266 266 inode->i_sb->s_root != NULL && 267 - is_root_inode(inode)) 267 + !is_root_inode(inode)) 268 268 ll_invalidate_aliases(inode); 269 269 270 270 iput(inode);
+136 -224
drivers/thermal/cpu_cooling.c
··· 4 4 * Copyright (C) 2012 Samsung Electronics Co., Ltd(http://www.samsung.com) 5 5 * Copyright (C) 2012 Amit Daniel <amit.kachhap@linaro.org> 6 6 * 7 + * Copyright (C) 2014 Viresh Kumar <viresh.kumar@linaro.org> 8 + * 7 9 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 8 10 * This program is free software; you can redistribute it and/or modify 9 11 * it under the terms of the GNU General Public License as published by ··· 30 28 #include <linux/cpu.h> 31 29 #include <linux/cpu_cooling.h> 32 30 31 + /* 32 + * Cooling state <-> CPUFreq frequency 33 + * 34 + * Cooling states are translated to frequencies throughout this driver and this 35 + * is the relation between them. 36 + * 37 + * Highest cooling state corresponds to lowest possible frequency. 38 + * 39 + * i.e. 40 + * level 0 --> 1st Max Freq 41 + * level 1 --> 2nd Max Freq 42 + * ... 43 + */ 44 + 33 45 /** 34 46 * struct cpufreq_cooling_device - data for cooling device with cpufreq 35 47 * @id: unique integer value corresponding to each cpufreq_cooling_device ··· 54 38 * cooling devices. 55 39 * @cpufreq_val: integer value representing the absolute value of the clipped 56 40 * frequency. 41 + * @max_level: maximum cooling level. One less than total number of valid 42 + * cpufreq frequencies. 57 43 * @allowed_cpus: all the cpus involved for this cpufreq_cooling_device. 44 + * @node: list_head to link all cpufreq_cooling_device together. 58 45 * 59 - * This structure is required for keeping information of each 60 - * cpufreq_cooling_device registered. In order to prevent corruption of this a 61 - * mutex lock cooling_cpufreq_lock is used. 46 + * This structure is required for keeping information of each registered 47 + * cpufreq_cooling_device. 62 48 */ 63 49 struct cpufreq_cooling_device { 64 50 int id; 65 51 struct thermal_cooling_device *cool_dev; 66 52 unsigned int cpufreq_state; 67 53 unsigned int cpufreq_val; 54 + unsigned int max_level; 55 + unsigned int *freq_table; /* In descending order */ 68 56 struct cpumask allowed_cpus; 69 57 struct list_head node; 70 58 }; 71 59 static DEFINE_IDR(cpufreq_idr); 72 60 static DEFINE_MUTEX(cooling_cpufreq_lock); 73 - 74 - static unsigned int cpufreq_dev_count; 75 61 76 62 static LIST_HEAD(cpufreq_dev_list); 77 63 ··· 116 98 /* Below code defines functions to be used for cpufreq as cooling device */ 117 99 118 100 /** 119 - * is_cpufreq_valid - function to check frequency transitioning capability. 120 - * @cpu: cpu for which check is needed. 101 + * get_level: Find the level for a particular frequency 102 + * @cpufreq_dev: cpufreq_dev for which the property is required 103 + * @freq: Frequency 121 104 * 122 - * This function will check the current state of the system if 123 - * it is capable of changing the frequency for a given @cpu. 124 - * 125 - * Return: 0 if the system is not currently capable of changing 126 - * the frequency of given cpu. !0 in case the frequency is changeable. 105 + * Return: level on success, THERMAL_CSTATE_INVALID on error. 127 106 */ 128 - static int is_cpufreq_valid(int cpu) 107 + static unsigned long get_level(struct cpufreq_cooling_device *cpufreq_dev, 108 + unsigned int freq) 129 109 { 130 - struct cpufreq_policy policy; 110 + unsigned long level; 131 111 132 - return !cpufreq_get_policy(&policy, cpu); 133 - } 112 + for (level = 0; level <= cpufreq_dev->max_level; level++) { 113 + if (freq == cpufreq_dev->freq_table[level]) 114 + return level; 134 115 135 - enum cpufreq_cooling_property { 136 - GET_LEVEL, 137 - GET_FREQ, 138 - GET_MAXL, 139 - }; 140 - 141 - /** 142 - * get_property - fetch a property of interest for a give cpu. 143 - * @cpu: cpu for which the property is required 144 - * @input: query parameter 145 - * @output: query return 146 - * @property: type of query (frequency, level, max level) 147 - * 148 - * This is the common function to 149 - * 1. get maximum cpu cooling states 150 - * 2. translate frequency to cooling state 151 - * 3. translate cooling state to frequency 152 - * Note that the code may be not in good shape 153 - * but it is written in this way in order to: 154 - * a) reduce duplicate code as most of the code can be shared. 155 - * b) make sure the logic is consistent when translating between 156 - * cooling states and frequencies. 157 - * 158 - * Return: 0 on success, -EINVAL when invalid parameters are passed. 159 - */ 160 - static int get_property(unsigned int cpu, unsigned long input, 161 - unsigned int *output, 162 - enum cpufreq_cooling_property property) 163 - { 164 - int i; 165 - unsigned long max_level = 0, level = 0; 166 - unsigned int freq = CPUFREQ_ENTRY_INVALID; 167 - int descend = -1; 168 - struct cpufreq_frequency_table *pos, *table = 169 - cpufreq_frequency_get_table(cpu); 170 - 171 - if (!output) 172 - return -EINVAL; 173 - 174 - if (!table) 175 - return -EINVAL; 176 - 177 - cpufreq_for_each_valid_entry(pos, table) { 178 - /* ignore duplicate entry */ 179 - if (freq == pos->frequency) 180 - continue; 181 - 182 - /* get the frequency order */ 183 - if (freq != CPUFREQ_ENTRY_INVALID && descend == -1) 184 - descend = freq > pos->frequency; 185 - 186 - freq = pos->frequency; 187 - max_level++; 116 + if (freq > cpufreq_dev->freq_table[level]) 117 + break; 188 118 } 189 119 190 - /* No valid cpu frequency entry */ 191 - if (max_level == 0) 192 - return -EINVAL; 193 - 194 - /* max_level is an index, not a counter */ 195 - max_level--; 196 - 197 - /* get max level */ 198 - if (property == GET_MAXL) { 199 - *output = (unsigned int)max_level; 200 - return 0; 201 - } 202 - 203 - if (property == GET_FREQ) 204 - level = descend ? input : (max_level - input); 205 - 206 - i = 0; 207 - cpufreq_for_each_valid_entry(pos, table) { 208 - /* ignore duplicate entry */ 209 - if (freq == pos->frequency) 210 - continue; 211 - 212 - /* now we have a valid frequency entry */ 213 - freq = pos->frequency; 214 - 215 - if (property == GET_LEVEL && (unsigned int)input == freq) { 216 - /* get level by frequency */ 217 - *output = descend ? i : (max_level - i); 218 - return 0; 219 - } 220 - if (property == GET_FREQ && level == i) { 221 - /* get frequency by level */ 222 - *output = freq; 223 - return 0; 224 - } 225 - i++; 226 - } 227 - 228 - return -EINVAL; 120 + return THERMAL_CSTATE_INVALID; 229 121 } 230 122 231 123 /** 232 - * cpufreq_cooling_get_level - for a give cpu, return the cooling level. 124 + * cpufreq_cooling_get_level - for a given cpu, return the cooling level. 233 125 * @cpu: cpu for which the level is required 234 126 * @freq: the frequency of interest 235 127 * ··· 151 223 */ 152 224 unsigned long cpufreq_cooling_get_level(unsigned int cpu, unsigned int freq) 153 225 { 154 - unsigned int val; 226 + struct cpufreq_cooling_device *cpufreq_dev; 155 227 156 - if (get_property(cpu, (unsigned long)freq, &val, GET_LEVEL)) 157 - return THERMAL_CSTATE_INVALID; 228 + mutex_lock(&cooling_cpufreq_lock); 229 + list_for_each_entry(cpufreq_dev, &cpufreq_dev_list, node) { 230 + if (cpumask_test_cpu(cpu, &cpufreq_dev->allowed_cpus)) { 231 + mutex_unlock(&cooling_cpufreq_lock); 232 + return get_level(cpufreq_dev, freq); 233 + } 234 + } 235 + mutex_unlock(&cooling_cpufreq_lock); 158 236 159 - return (unsigned long)val; 237 + pr_err("%s: cpu:%d not part of any cooling device\n", __func__, cpu); 238 + return THERMAL_CSTATE_INVALID; 160 239 } 161 240 EXPORT_SYMBOL_GPL(cpufreq_cooling_get_level); 162 - 163 - /** 164 - * get_cpu_frequency - get the absolute value of frequency from level. 165 - * @cpu: cpu for which frequency is fetched. 166 - * @level: cooling level 167 - * 168 - * This function matches cooling level with frequency. Based on a cooling level 169 - * of frequency, equals cooling state of cpu cooling device, it will return 170 - * the corresponding frequency. 171 - * e.g level=0 --> 1st MAX FREQ, level=1 ---> 2nd MAX FREQ, .... etc 172 - * 173 - * Return: 0 on error, the corresponding frequency otherwise. 174 - */ 175 - static unsigned int get_cpu_frequency(unsigned int cpu, unsigned long level) 176 - { 177 - int ret = 0; 178 - unsigned int freq; 179 - 180 - ret = get_property(cpu, level, &freq, GET_FREQ); 181 - if (ret) 182 - return 0; 183 - 184 - return freq; 185 - } 186 - 187 - /** 188 - * cpufreq_apply_cooling - function to apply frequency clipping. 189 - * @cpufreq_device: cpufreq_cooling_device pointer containing frequency 190 - * clipping data. 191 - * @cooling_state: value of the cooling state. 192 - * 193 - * Function used to make sure the cpufreq layer is aware of current thermal 194 - * limits. The limits are applied by updating the cpufreq policy. 195 - * 196 - * Return: 0 on success, an error code otherwise (-EINVAL in case wrong 197 - * cooling state). 198 - */ 199 - static int cpufreq_apply_cooling(struct cpufreq_cooling_device *cpufreq_device, 200 - unsigned long cooling_state) 201 - { 202 - unsigned int cpuid, clip_freq; 203 - struct cpumask *mask = &cpufreq_device->allowed_cpus; 204 - unsigned int cpu = cpumask_any(mask); 205 - 206 - 207 - /* Check if the old cooling action is same as new cooling action */ 208 - if (cpufreq_device->cpufreq_state == cooling_state) 209 - return 0; 210 - 211 - clip_freq = get_cpu_frequency(cpu, cooling_state); 212 - if (!clip_freq) 213 - return -EINVAL; 214 - 215 - cpufreq_device->cpufreq_state = cooling_state; 216 - cpufreq_device->cpufreq_val = clip_freq; 217 - 218 - for_each_cpu(cpuid, mask) { 219 - if (is_cpufreq_valid(cpuid)) 220 - cpufreq_update_policy(cpuid); 221 - } 222 - 223 - return 0; 224 - } 225 241 226 242 /** 227 243 * cpufreq_thermal_notifier - notifier callback for cpufreq policy change. ··· 195 323 &cpufreq_dev->allowed_cpus)) 196 324 continue; 197 325 198 - if (!cpufreq_dev->cpufreq_val) 199 - cpufreq_dev->cpufreq_val = get_cpu_frequency( 200 - cpumask_any(&cpufreq_dev->allowed_cpus), 201 - cpufreq_dev->cpufreq_state); 202 - 203 326 max_freq = cpufreq_dev->cpufreq_val; 204 327 205 328 if (policy->max != max_freq) ··· 221 354 unsigned long *state) 222 355 { 223 356 struct cpufreq_cooling_device *cpufreq_device = cdev->devdata; 224 - struct cpumask *mask = &cpufreq_device->allowed_cpus; 225 - unsigned int cpu; 226 - unsigned int count = 0; 227 - int ret; 228 357 229 - cpu = cpumask_any(mask); 230 - 231 - ret = get_property(cpu, 0, &count, GET_MAXL); 232 - 233 - if (count > 0) 234 - *state = count; 235 - 236 - return ret; 358 + *state = cpufreq_device->max_level; 359 + return 0; 237 360 } 238 361 239 362 /** ··· 260 403 unsigned long state) 261 404 { 262 405 struct cpufreq_cooling_device *cpufreq_device = cdev->devdata; 406 + unsigned int cpu = cpumask_any(&cpufreq_device->allowed_cpus); 407 + unsigned int clip_freq; 263 408 264 - return cpufreq_apply_cooling(cpufreq_device, state); 409 + /* Request state should be less than max_level */ 410 + if (WARN_ON(state > cpufreq_device->max_level)) 411 + return -EINVAL; 412 + 413 + /* Check if the old cooling action is same as new cooling action */ 414 + if (cpufreq_device->cpufreq_state == state) 415 + return 0; 416 + 417 + clip_freq = cpufreq_device->freq_table[state]; 418 + cpufreq_device->cpufreq_state = state; 419 + cpufreq_device->cpufreq_val = clip_freq; 420 + 421 + cpufreq_update_policy(cpu); 422 + 423 + return 0; 265 424 } 266 425 267 426 /* Bind cpufreq callbacks to thermal cooling device ops */ ··· 292 419 .notifier_call = cpufreq_thermal_notifier, 293 420 }; 294 421 422 + static unsigned int find_next_max(struct cpufreq_frequency_table *table, 423 + unsigned int prev_max) 424 + { 425 + struct cpufreq_frequency_table *pos; 426 + unsigned int max = 0; 427 + 428 + cpufreq_for_each_valid_entry(pos, table) { 429 + if (pos->frequency > max && pos->frequency < prev_max) 430 + max = pos->frequency; 431 + } 432 + 433 + return max; 434 + } 435 + 295 436 /** 296 437 * __cpufreq_cooling_register - helper function to create cpufreq cooling device 297 438 * @np: a valid struct device_node to the cooling device device tree node 298 439 * @clip_cpus: cpumask of cpus where the frequency constraints will happen. 440 + * Normally this should be same as cpufreq policy->related_cpus. 299 441 * 300 442 * This interface function registers the cpufreq cooling device with the name 301 443 * "thermal-cpufreq-%x". This api can support multiple instances of cpufreq ··· 325 437 const struct cpumask *clip_cpus) 326 438 { 327 439 struct thermal_cooling_device *cool_dev; 328 - struct cpufreq_cooling_device *cpufreq_dev = NULL; 329 - unsigned int min = 0, max = 0; 440 + struct cpufreq_cooling_device *cpufreq_dev; 330 441 char dev_name[THERMAL_NAME_LENGTH]; 331 - int ret = 0, i; 332 - struct cpufreq_policy policy; 442 + struct cpufreq_frequency_table *pos, *table; 443 + unsigned int freq, i; 444 + int ret; 333 445 334 - /* Verify that all the clip cpus have same freq_min, freq_max limit */ 335 - for_each_cpu(i, clip_cpus) { 336 - /* continue if cpufreq policy not found and not return error */ 337 - if (!cpufreq_get_policy(&policy, i)) 338 - continue; 339 - if (min == 0 && max == 0) { 340 - min = policy.cpuinfo.min_freq; 341 - max = policy.cpuinfo.max_freq; 342 - } else { 343 - if (min != policy.cpuinfo.min_freq || 344 - max != policy.cpuinfo.max_freq) 345 - return ERR_PTR(-EINVAL); 346 - } 446 + table = cpufreq_frequency_get_table(cpumask_first(clip_cpus)); 447 + if (!table) { 448 + pr_debug("%s: CPUFreq table not found\n", __func__); 449 + return ERR_PTR(-EPROBE_DEFER); 347 450 } 348 - cpufreq_dev = kzalloc(sizeof(struct cpufreq_cooling_device), 349 - GFP_KERNEL); 451 + 452 + cpufreq_dev = kzalloc(sizeof(*cpufreq_dev), GFP_KERNEL); 350 453 if (!cpufreq_dev) 351 454 return ERR_PTR(-ENOMEM); 455 + 456 + /* Find max levels */ 457 + cpufreq_for_each_valid_entry(pos, table) 458 + cpufreq_dev->max_level++; 459 + 460 + cpufreq_dev->freq_table = kmalloc(sizeof(*cpufreq_dev->freq_table) * 461 + cpufreq_dev->max_level, GFP_KERNEL); 462 + if (!cpufreq_dev->freq_table) { 463 + cool_dev = ERR_PTR(-ENOMEM); 464 + goto free_cdev; 465 + } 466 + 467 + /* max_level is an index, not a counter */ 468 + cpufreq_dev->max_level--; 352 469 353 470 cpumask_copy(&cpufreq_dev->allowed_cpus, clip_cpus); 354 471 355 472 ret = get_idr(&cpufreq_idr, &cpufreq_dev->id); 356 473 if (ret) { 357 - kfree(cpufreq_dev); 358 - return ERR_PTR(-EINVAL); 474 + cool_dev = ERR_PTR(ret); 475 + goto free_table; 359 476 } 360 477 361 478 snprintf(dev_name, sizeof(dev_name), "thermal-cpufreq-%d", ··· 368 475 369 476 cool_dev = thermal_of_cooling_device_register(np, dev_name, cpufreq_dev, 370 477 &cpufreq_cooling_ops); 371 - if (IS_ERR(cool_dev)) { 372 - release_idr(&cpufreq_idr, cpufreq_dev->id); 373 - kfree(cpufreq_dev); 374 - return cool_dev; 478 + if (IS_ERR(cool_dev)) 479 + goto remove_idr; 480 + 481 + /* Fill freq-table in descending order of frequencies */ 482 + for (i = 0, freq = -1; i <= cpufreq_dev->max_level; i++) { 483 + freq = find_next_max(table, freq); 484 + cpufreq_dev->freq_table[i] = freq; 485 + 486 + /* Warn for duplicate entries */ 487 + if (!freq) 488 + pr_warn("%s: table has duplicate entries\n", __func__); 489 + else 490 + pr_debug("%s: freq:%u KHz\n", __func__, freq); 375 491 } 492 + 493 + cpufreq_dev->cpufreq_val = cpufreq_dev->freq_table[0]; 376 494 cpufreq_dev->cool_dev = cool_dev; 377 - cpufreq_dev->cpufreq_state = 0; 495 + 378 496 mutex_lock(&cooling_cpufreq_lock); 379 497 380 498 /* Register the notifier for first cpufreq cooling device */ 381 - if (cpufreq_dev_count == 0) 499 + if (list_empty(&cpufreq_dev_list)) 382 500 cpufreq_register_notifier(&thermal_cpufreq_notifier_block, 383 501 CPUFREQ_POLICY_NOTIFIER); 384 - cpufreq_dev_count++; 385 502 list_add(&cpufreq_dev->node, &cpufreq_dev_list); 386 503 387 504 mutex_unlock(&cooling_cpufreq_lock); 505 + 506 + return cool_dev; 507 + 508 + remove_idr: 509 + release_idr(&cpufreq_idr, cpufreq_dev->id); 510 + free_table: 511 + kfree(cpufreq_dev->freq_table); 512 + free_cdev: 513 + kfree(cpufreq_dev); 388 514 389 515 return cool_dev; 390 516 } ··· 466 554 cpufreq_dev = cdev->devdata; 467 555 mutex_lock(&cooling_cpufreq_lock); 468 556 list_del(&cpufreq_dev->node); 469 - cpufreq_dev_count--; 470 557 471 558 /* Unregister the notifier for the last cpufreq cooling device */ 472 - if (cpufreq_dev_count == 0) 559 + if (list_empty(&cpufreq_dev_list)) 473 560 cpufreq_unregister_notifier(&thermal_cpufreq_notifier_block, 474 561 CPUFREQ_POLICY_NOTIFIER); 475 562 mutex_unlock(&cooling_cpufreq_lock); 476 563 477 564 thermal_cooling_device_unregister(cpufreq_dev->cool_dev); 478 565 release_idr(&cpufreq_idr, cpufreq_dev->id); 566 + kfree(cpufreq_dev->freq_table); 479 567 kfree(cpufreq_dev); 480 568 } 481 569 EXPORT_SYMBOL_GPL(cpufreq_cooling_unregister);
+9 -11
drivers/thermal/db8500_cpufreq_cooling.c
··· 18 18 */ 19 19 20 20 #include <linux/cpu_cooling.h> 21 - #include <linux/cpufreq.h> 22 21 #include <linux/err.h> 23 22 #include <linux/module.h> 24 23 #include <linux/of.h> ··· 27 28 static int db8500_cpufreq_cooling_probe(struct platform_device *pdev) 28 29 { 29 30 struct thermal_cooling_device *cdev; 30 - struct cpumask mask_val; 31 31 32 - /* make sure cpufreq driver has been initialized */ 33 - if (!cpufreq_frequency_get_table(0)) 34 - return -EPROBE_DEFER; 35 - 36 - cpumask_set_cpu(0, &mask_val); 37 - cdev = cpufreq_cooling_register(&mask_val); 38 - 32 + cdev = cpufreq_cooling_register(cpu_present_mask); 39 33 if (IS_ERR(cdev)) { 40 - dev_err(&pdev->dev, "Failed to register cooling device\n"); 41 - return PTR_ERR(cdev); 34 + int ret = PTR_ERR(cdev); 35 + 36 + if (ret != -EPROBE_DEFER) 37 + dev_err(&pdev->dev, 38 + "Failed to register cooling device %d\n", 39 + ret); 40 + 41 + return ret; 42 42 } 43 43 44 44 platform_set_drvdata(pdev, cdev);
+5 -10
drivers/thermal/imx_thermal.c
··· 9 9 10 10 #include <linux/clk.h> 11 11 #include <linux/cpu_cooling.h> 12 - #include <linux/cpufreq.h> 13 12 #include <linux/delay.h> 14 13 #include <linux/device.h> 15 14 #include <linux/init.h> ··· 453 454 const struct of_device_id *of_id = 454 455 of_match_device(of_imx_thermal_match, &pdev->dev); 455 456 struct imx_thermal_data *data; 456 - struct cpumask clip_cpus; 457 457 struct regmap *map; 458 458 int measure_freq; 459 459 int ret; 460 460 461 - if (!cpufreq_get_current_driver()) { 462 - dev_dbg(&pdev->dev, "no cpufreq driver!"); 463 - return -EPROBE_DEFER; 464 - } 465 461 data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); 466 462 if (!data) 467 463 return -ENOMEM; ··· 510 516 regmap_write(map, MISC0 + REG_SET, MISC0_REFTOP_SELBIASOFF); 511 517 regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_POWER_DOWN); 512 518 513 - cpumask_set_cpu(0, &clip_cpus); 514 - data->cdev = cpufreq_cooling_register(&clip_cpus); 519 + data->cdev = cpufreq_cooling_register(cpu_present_mask); 515 520 if (IS_ERR(data->cdev)) { 516 521 ret = PTR_ERR(data->cdev); 517 - dev_err(&pdev->dev, 518 - "failed to register cpufreq cooling device: %d\n", ret); 522 + if (ret != -EPROBE_DEFER) 523 + dev_err(&pdev->dev, 524 + "failed to register cpufreq cooling device: %d\n", 525 + ret); 519 526 return ret; 520 527 } 521 528
+1
drivers/thermal/int340x_thermal/Makefile
··· 1 1 obj-$(CONFIG_INT340X_THERMAL) += int3400_thermal.o 2 2 obj-$(CONFIG_INT340X_THERMAL) += int3402_thermal.o 3 3 obj-$(CONFIG_INT340X_THERMAL) += int3403_thermal.o 4 + obj-$(CONFIG_INT340X_THERMAL) += processor_thermal_device.o 4 5 obj-$(CONFIG_ACPI_THERMAL_REL) += acpi_thermal_rel.o
+4 -4
drivers/thermal/int340x_thermal/acpi_thermal_rel.c
··· 82 82 struct acpi_buffer trt_format = { sizeof("RRNNNNNN"), "RRNNNNNN" }; 83 83 84 84 if (!acpi_has_method(handle, "_TRT")) 85 - return 0; 85 + return -ENODEV; 86 86 87 87 status = acpi_evaluate_object(handle, "_TRT", NULL, &buffer); 88 88 if (ACPI_FAILURE(status)) ··· 167 167 sizeof("RRNNNNNNNNNNN"), "RRNNNNNNNNNNN" }; 168 168 169 169 if (!acpi_has_method(handle, "_ART")) 170 - return 0; 170 + return -ENODEV; 171 171 172 172 status = acpi_evaluate_object(handle, "_ART", NULL, &buffer); 173 173 if (ACPI_FAILURE(status)) ··· 321 321 unsigned long length = 0; 322 322 int count = 0; 323 323 char __user *arg = (void __user *)__arg; 324 - struct trt *trts; 325 - struct art *arts; 324 + struct trt *trts = NULL; 325 + struct art *arts = NULL; 326 326 327 327 switch (cmd) { 328 328 case ACPI_THERMAL_GET_TRT_COUNT:
-1
drivers/thermal/int340x_thermal/int3400_thermal.c
··· 335 335 .remove = int3400_thermal_remove, 336 336 .driver = { 337 337 .name = "int3400 thermal", 338 - .owner = THIS_MODULE, 339 338 .acpi_match_table = ACPI_PTR(int3400_thermal_match), 340 339 }, 341 340 };
-1
drivers/thermal/int340x_thermal/int3402_thermal.c
··· 231 231 .remove = int3402_thermal_remove, 232 232 .driver = { 233 233 .name = "int3402 thermal", 234 - .owner = THIS_MODULE, 235 234 .acpi_match_table = int3402_thermal_match, 236 235 }, 237 236 };
+4
drivers/thermal/int340x_thermal/int3403_thermal.c
··· 301 301 { 302 302 struct int3403_sensor *obj = priv->priv; 303 303 304 + acpi_remove_notify_handler(priv->adev->handle, 305 + ACPI_DEVICE_NOTIFY, int3403_notify); 304 306 thermal_zone_device_unregister(obj->tzone); 305 307 return 0; 306 308 } ··· 371 369 p = buf.pointer; 372 370 if (!p || (p->type != ACPI_TYPE_PACKAGE)) { 373 371 printk(KERN_WARNING "Invalid PPSS data\n"); 372 + kfree(buf.pointer); 374 373 return -EFAULT; 375 374 } 376 375 ··· 384 381 385 382 priv->priv = obj; 386 383 384 + kfree(buf.pointer); 387 385 /* TODO: add ACPI notification support */ 388 386 389 387 return result;
+309
drivers/thermal/int340x_thermal/processor_thermal_device.c
··· 1 + /* 2 + * processor_thermal_device.c 3 + * Copyright (c) 2014, Intel Corporation. 4 + * 5 + * This program is free software; you can redistribute it and/or modify it 6 + * under the terms and conditions of the GNU General Public License, 7 + * version 2, as published by the Free Software Foundation. 8 + * 9 + * This program is distributed in the hope it will be useful, but WITHOUT 10 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 + * more details. 13 + * 14 + */ 15 + #include <linux/kernel.h> 16 + #include <linux/module.h> 17 + #include <linux/init.h> 18 + #include <linux/pci.h> 19 + #include <linux/platform_device.h> 20 + #include <linux/acpi.h> 21 + 22 + /* Broadwell-U/HSB thermal reporting device */ 23 + #define PCI_DEVICE_ID_PROC_BDW_THERMAL 0x1603 24 + #define PCI_DEVICE_ID_PROC_HSB_THERMAL 0x0A03 25 + 26 + /* Braswell thermal reporting device */ 27 + #define PCI_DEVICE_ID_PROC_BSW_THERMAL 0x22DC 28 + 29 + struct power_config { 30 + u32 index; 31 + u32 min_uw; 32 + u32 max_uw; 33 + u32 tmin_us; 34 + u32 tmax_us; 35 + u32 step_uw; 36 + }; 37 + 38 + struct proc_thermal_device { 39 + struct device *dev; 40 + struct acpi_device *adev; 41 + struct power_config power_limits[2]; 42 + }; 43 + 44 + enum proc_thermal_emum_mode_type { 45 + PROC_THERMAL_NONE, 46 + PROC_THERMAL_PCI, 47 + PROC_THERMAL_PLATFORM_DEV 48 + }; 49 + 50 + /* 51 + * We can have only one type of enumeration, PCI or Platform, 52 + * not both. So we don't need instance specific data. 53 + */ 54 + static enum proc_thermal_emum_mode_type proc_thermal_emum_mode = 55 + PROC_THERMAL_NONE; 56 + 57 + #define POWER_LIMIT_SHOW(index, suffix) \ 58 + static ssize_t power_limit_##index##_##suffix##_show(struct device *dev, \ 59 + struct device_attribute *attr, \ 60 + char *buf) \ 61 + { \ 62 + struct pci_dev *pci_dev; \ 63 + struct platform_device *pdev; \ 64 + struct proc_thermal_device *proc_dev; \ 65 + \ 66 + if (proc_thermal_emum_mode == PROC_THERMAL_PLATFORM_DEV) { \ 67 + pdev = to_platform_device(dev); \ 68 + proc_dev = platform_get_drvdata(pdev); \ 69 + } else { \ 70 + pci_dev = to_pci_dev(dev); \ 71 + proc_dev = pci_get_drvdata(pci_dev); \ 72 + } \ 73 + return sprintf(buf, "%lu\n",\ 74 + (unsigned long)proc_dev->power_limits[index].suffix * 1000); \ 75 + } 76 + 77 + POWER_LIMIT_SHOW(0, min_uw) 78 + POWER_LIMIT_SHOW(0, max_uw) 79 + POWER_LIMIT_SHOW(0, step_uw) 80 + POWER_LIMIT_SHOW(0, tmin_us) 81 + POWER_LIMIT_SHOW(0, tmax_us) 82 + 83 + POWER_LIMIT_SHOW(1, min_uw) 84 + POWER_LIMIT_SHOW(1, max_uw) 85 + POWER_LIMIT_SHOW(1, step_uw) 86 + POWER_LIMIT_SHOW(1, tmin_us) 87 + POWER_LIMIT_SHOW(1, tmax_us) 88 + 89 + static DEVICE_ATTR_RO(power_limit_0_min_uw); 90 + static DEVICE_ATTR_RO(power_limit_0_max_uw); 91 + static DEVICE_ATTR_RO(power_limit_0_step_uw); 92 + static DEVICE_ATTR_RO(power_limit_0_tmin_us); 93 + static DEVICE_ATTR_RO(power_limit_0_tmax_us); 94 + 95 + static DEVICE_ATTR_RO(power_limit_1_min_uw); 96 + static DEVICE_ATTR_RO(power_limit_1_max_uw); 97 + static DEVICE_ATTR_RO(power_limit_1_step_uw); 98 + static DEVICE_ATTR_RO(power_limit_1_tmin_us); 99 + static DEVICE_ATTR_RO(power_limit_1_tmax_us); 100 + 101 + static struct attribute *power_limit_attrs[] = { 102 + &dev_attr_power_limit_0_min_uw.attr, 103 + &dev_attr_power_limit_1_min_uw.attr, 104 + &dev_attr_power_limit_0_max_uw.attr, 105 + &dev_attr_power_limit_1_max_uw.attr, 106 + &dev_attr_power_limit_0_step_uw.attr, 107 + &dev_attr_power_limit_1_step_uw.attr, 108 + &dev_attr_power_limit_0_tmin_us.attr, 109 + &dev_attr_power_limit_1_tmin_us.attr, 110 + &dev_attr_power_limit_0_tmax_us.attr, 111 + &dev_attr_power_limit_1_tmax_us.attr, 112 + NULL 113 + }; 114 + 115 + static struct attribute_group power_limit_attribute_group = { 116 + .attrs = power_limit_attrs, 117 + .name = "power_limits" 118 + }; 119 + 120 + static int proc_thermal_add(struct device *dev, 121 + struct proc_thermal_device **priv) 122 + { 123 + struct proc_thermal_device *proc_priv; 124 + struct acpi_device *adev; 125 + acpi_status status; 126 + struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL }; 127 + union acpi_object *elements, *ppcc; 128 + union acpi_object *p; 129 + int i; 130 + int ret; 131 + 132 + adev = ACPI_COMPANION(dev); 133 + 134 + status = acpi_evaluate_object(adev->handle, "PPCC", NULL, &buf); 135 + if (ACPI_FAILURE(status)) 136 + return -ENODEV; 137 + 138 + p = buf.pointer; 139 + if (!p || (p->type != ACPI_TYPE_PACKAGE)) { 140 + dev_err(dev, "Invalid PPCC data\n"); 141 + ret = -EFAULT; 142 + goto free_buffer; 143 + } 144 + if (!p->package.count) { 145 + dev_err(dev, "Invalid PPCC package size\n"); 146 + ret = -EFAULT; 147 + goto free_buffer; 148 + } 149 + 150 + proc_priv = devm_kzalloc(dev, sizeof(*proc_priv), GFP_KERNEL); 151 + if (!proc_priv) { 152 + ret = -ENOMEM; 153 + goto free_buffer; 154 + } 155 + 156 + proc_priv->dev = dev; 157 + proc_priv->adev = adev; 158 + 159 + for (i = 0; i < min((int)p->package.count - 1, 2); ++i) { 160 + elements = &(p->package.elements[i+1]); 161 + if (elements->type != ACPI_TYPE_PACKAGE || 162 + elements->package.count != 6) { 163 + ret = -EFAULT; 164 + goto free_buffer; 165 + } 166 + ppcc = elements->package.elements; 167 + proc_priv->power_limits[i].index = ppcc[0].integer.value; 168 + proc_priv->power_limits[i].min_uw = ppcc[1].integer.value; 169 + proc_priv->power_limits[i].max_uw = ppcc[2].integer.value; 170 + proc_priv->power_limits[i].tmin_us = ppcc[3].integer.value; 171 + proc_priv->power_limits[i].tmax_us = ppcc[4].integer.value; 172 + proc_priv->power_limits[i].step_uw = ppcc[5].integer.value; 173 + } 174 + 175 + *priv = proc_priv; 176 + 177 + ret = sysfs_create_group(&dev->kobj, 178 + &power_limit_attribute_group); 179 + 180 + free_buffer: 181 + kfree(buf.pointer); 182 + 183 + return ret; 184 + } 185 + 186 + void proc_thermal_remove(struct proc_thermal_device *proc_priv) 187 + { 188 + sysfs_remove_group(&proc_priv->dev->kobj, 189 + &power_limit_attribute_group); 190 + } 191 + 192 + static int int3401_add(struct platform_device *pdev) 193 + { 194 + struct proc_thermal_device *proc_priv; 195 + int ret; 196 + 197 + if (proc_thermal_emum_mode == PROC_THERMAL_PCI) { 198 + dev_err(&pdev->dev, "error: enumerated as PCI dev\n"); 199 + return -ENODEV; 200 + } 201 + 202 + ret = proc_thermal_add(&pdev->dev, &proc_priv); 203 + if (ret) 204 + return ret; 205 + 206 + platform_set_drvdata(pdev, proc_priv); 207 + proc_thermal_emum_mode = PROC_THERMAL_PLATFORM_DEV; 208 + 209 + return 0; 210 + } 211 + 212 + static int int3401_remove(struct platform_device *pdev) 213 + { 214 + proc_thermal_remove(platform_get_drvdata(pdev)); 215 + 216 + return 0; 217 + } 218 + 219 + static int proc_thermal_pci_probe(struct pci_dev *pdev, 220 + const struct pci_device_id *unused) 221 + { 222 + struct proc_thermal_device *proc_priv; 223 + int ret; 224 + 225 + if (proc_thermal_emum_mode == PROC_THERMAL_PLATFORM_DEV) { 226 + dev_err(&pdev->dev, "error: enumerated as platform dev\n"); 227 + return -ENODEV; 228 + } 229 + 230 + ret = pci_enable_device(pdev); 231 + if (ret < 0) { 232 + dev_err(&pdev->dev, "error: could not enable device\n"); 233 + return ret; 234 + } 235 + 236 + ret = proc_thermal_add(&pdev->dev, &proc_priv); 237 + if (ret) { 238 + pci_disable_device(pdev); 239 + return ret; 240 + } 241 + 242 + pci_set_drvdata(pdev, proc_priv); 243 + proc_thermal_emum_mode = PROC_THERMAL_PCI; 244 + 245 + return 0; 246 + } 247 + 248 + static void proc_thermal_pci_remove(struct pci_dev *pdev) 249 + { 250 + proc_thermal_remove(pci_get_drvdata(pdev)); 251 + pci_disable_device(pdev); 252 + } 253 + 254 + static const struct pci_device_id proc_thermal_pci_ids[] = { 255 + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_BDW_THERMAL)}, 256 + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_HSB_THERMAL)}, 257 + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_BSW_THERMAL)}, 258 + { 0, }, 259 + }; 260 + 261 + MODULE_DEVICE_TABLE(pci, proc_thermal_pci_ids); 262 + 263 + static struct pci_driver proc_thermal_pci_driver = { 264 + .name = "proc_thermal", 265 + .probe = proc_thermal_pci_probe, 266 + .remove = proc_thermal_pci_remove, 267 + .id_table = proc_thermal_pci_ids, 268 + }; 269 + 270 + static const struct acpi_device_id int3401_device_ids[] = { 271 + {"INT3401", 0}, 272 + {"", 0}, 273 + }; 274 + MODULE_DEVICE_TABLE(acpi, int3401_device_ids); 275 + 276 + static struct platform_driver int3401_driver = { 277 + .probe = int3401_add, 278 + .remove = int3401_remove, 279 + .driver = { 280 + .name = "int3401 thermal", 281 + .acpi_match_table = int3401_device_ids, 282 + }, 283 + }; 284 + 285 + static int __init proc_thermal_init(void) 286 + { 287 + int ret; 288 + 289 + ret = platform_driver_register(&int3401_driver); 290 + if (ret) 291 + return ret; 292 + 293 + ret = pci_register_driver(&proc_thermal_pci_driver); 294 + 295 + return ret; 296 + } 297 + 298 + static void __exit proc_thermal_exit(void) 299 + { 300 + platform_driver_unregister(&int3401_driver); 301 + pci_unregister_driver(&proc_thermal_pci_driver); 302 + } 303 + 304 + module_init(proc_thermal_init); 305 + module_exit(proc_thermal_exit); 306 + 307 + MODULE_AUTHOR("Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>"); 308 + MODULE_DESCRIPTION("Processor Thermal Reporting Device Driver"); 309 + MODULE_LICENSE("GPL v2");
+1
drivers/thermal/intel_powerclamp.c
··· 688 688 { X86_VENDOR_INTEL, 6, 0x45}, 689 689 { X86_VENDOR_INTEL, 6, 0x46}, 690 690 { X86_VENDOR_INTEL, 6, 0x4c}, 691 + { X86_VENDOR_INTEL, 6, 0x56}, 691 692 {} 692 693 }; 693 694 MODULE_DEVICE_TABLE(x86cpu, intel_powerclamp_ids);
-1
drivers/thermal/rockchip_thermal.c
··· 677 677 static struct platform_driver rockchip_thermal_driver = { 678 678 .driver = { 679 679 .name = "rockchip-thermal", 680 - .owner = THIS_MODULE, 681 680 .pm = &rockchip_thermal_pm_ops, 682 681 .of_match_table = of_rockchip_thermal_match, 683 682 },
+1 -1
drivers/thermal/samsung/Kconfig
··· 1 1 config EXYNOS_THERMAL 2 2 tristate "Exynos thermal management unit driver" 3 - depends on ARCH_HAS_BANDGAP && OF 3 + depends on OF 4 4 help 5 5 If you say yes here you get support for the TMU (Thermal Management 6 6 Unit) driver for SAMSUNG EXYNOS series of SoCs. This driver initialises
+6 -6
drivers/thermal/samsung/exynos_thermal_common.c
··· 347 347 int exynos_register_thermal(struct thermal_sensor_conf *sensor_conf) 348 348 { 349 349 int ret; 350 - struct cpumask mask_val; 351 350 struct exynos_thermal_zone *th_zone; 352 351 353 352 if (!sensor_conf || !sensor_conf->read_temperature) { ··· 366 367 * sensor 367 368 */ 368 369 if (sensor_conf->cooling_data.freq_clip_count > 0) { 369 - cpumask_set_cpu(0, &mask_val); 370 370 th_zone->cool_dev[th_zone->cool_dev_size] = 371 - cpufreq_cooling_register(&mask_val); 371 + cpufreq_cooling_register(cpu_present_mask); 372 372 if (IS_ERR(th_zone->cool_dev[th_zone->cool_dev_size])) { 373 - dev_err(sensor_conf->dev, 374 - "Failed to register cpufreq cooling device\n"); 375 - ret = -EINVAL; 373 + ret = PTR_ERR(th_zone->cool_dev[th_zone->cool_dev_size]); 374 + if (ret != -EPROBE_DEFER) 375 + dev_err(sensor_conf->dev, 376 + "Failed to register cpufreq cooling device: %d\n", 377 + ret); 376 378 goto err_unregister; 377 379 } 378 380 th_zone->cool_dev_size++;
+4 -1
drivers/thermal/samsung/exynos_tmu.c
··· 927 927 /* Register the sensor with thermal management interface */ 928 928 ret = exynos_register_thermal(sensor_conf); 929 929 if (ret) { 930 - dev_err(&pdev->dev, "Failed to register thermal interface\n"); 930 + if (ret != -EPROBE_DEFER) 931 + dev_err(&pdev->dev, 932 + "Failed to register thermal interface: %d\n", 933 + ret); 931 934 goto err_clk; 932 935 } 933 936 data->reg_conf = sensor_conf;
+4 -2
drivers/thermal/thermal_core.c
··· 930 930 struct thermal_zone_device *pos1; 931 931 struct thermal_cooling_device *pos2; 932 932 unsigned long max_state; 933 - int result; 933 + int result, ret; 934 934 935 935 if (trip >= tz->trips || (trip < 0 && trip != THERMAL_TRIPS_NONE)) 936 936 return -EINVAL; ··· 947 947 if (tz != pos1 || cdev != pos2) 948 948 return -EINVAL; 949 949 950 - cdev->ops->get_max_state(cdev, &max_state); 950 + ret = cdev->ops->get_max_state(cdev, &max_state); 951 + if (ret) 952 + return ret; 951 953 952 954 /* lower default 0, upper default max_state */ 953 955 lower = lower == THERMAL_NO_LIMIT ? 0 : lower;
+8 -9
drivers/thermal/ti-soc-thermal/ti-thermal-common.c
··· 28 28 #include <linux/kernel.h> 29 29 #include <linux/workqueue.h> 30 30 #include <linux/thermal.h> 31 - #include <linux/cpufreq.h> 32 31 #include <linux/cpumask.h> 33 32 #include <linux/cpu_cooling.h> 34 33 #include <linux/of.h> ··· 406 407 if (!data) 407 408 return -EINVAL; 408 409 409 - if (!cpufreq_get_current_driver()) { 410 - dev_dbg(bgp->dev, "no cpufreq driver yet\n"); 411 - return -EPROBE_DEFER; 412 - } 413 - 414 410 /* Register cooling device */ 415 411 data->cool_dev = cpufreq_cooling_register(cpu_present_mask); 416 412 if (IS_ERR(data->cool_dev)) { 417 - dev_err(bgp->dev, 418 - "Failed to register cpufreq cooling device\n"); 419 - return PTR_ERR(data->cool_dev); 413 + int ret = PTR_ERR(data->cool_dev); 414 + 415 + if (ret != -EPROBE_DEFER) 416 + dev_err(bgp->dev, 417 + "Failed to register cpu cooling device %d\n", 418 + ret); 419 + 420 + return ret; 420 421 } 421 422 ti_bandgap_set_sensor_data(bgp, id, data); 422 423
+7 -3
drivers/vhost/vhost.c
··· 713 713 r = -EFAULT; 714 714 break; 715 715 } 716 - if ((a.avail_user_addr & (sizeof *vq->avail->ring - 1)) || 717 - (a.used_user_addr & (sizeof *vq->used->ring - 1)) || 718 - (a.log_guest_addr & (sizeof *vq->used->ring - 1))) { 716 + 717 + /* Make sure it's safe to cast pointers to vring types. */ 718 + BUILD_BUG_ON(__alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE); 719 + BUILD_BUG_ON(__alignof__ *vq->used > VRING_USED_ALIGN_SIZE); 720 + if ((a.avail_user_addr & (VRING_AVAIL_ALIGN_SIZE - 1)) || 721 + (a.used_user_addr & (VRING_USED_ALIGN_SIZE - 1)) || 722 + (a.log_guest_addr & (sizeof(u64) - 1))) { 719 723 r = -EINVAL; 720 724 break; 721 725 }
+3 -2
drivers/video/fbdev/core/fb_defio.c
··· 83 83 cancel_delayed_work_sync(&info->deferred_work); 84 84 85 85 /* Run it immediately */ 86 - err = schedule_delayed_work(&info->deferred_work, 0); 86 + schedule_delayed_work(&info->deferred_work, 0); 87 87 mutex_unlock(&inode->i_mutex); 88 - return err; 88 + 89 + return 0; 89 90 } 90 91 EXPORT_SYMBOL_GPL(fb_deferred_io_fsync); 91 92
-2
drivers/video/fbdev/omap2/dss/hdmi_pll.c
··· 132 132 .mX_max = 127, 133 133 .fint_min = 500000, 134 134 .fint_max = 2500000, 135 - .clkdco_max = 1800000000, 136 135 137 136 .clkdco_min = 500000000, 138 137 .clkdco_low = 1000000000, ··· 155 156 .mX_max = 127, 156 157 .fint_min = 620000, 157 158 .fint_max = 2500000, 158 - .clkdco_max = 1800000000, 159 159 160 160 .clkdco_min = 750000000, 161 161 .clkdco_low = 1500000000,
+2 -1
drivers/video/fbdev/omap2/dss/pll.c
··· 97 97 return 0; 98 98 99 99 err_enable: 100 - regulator_disable(pll->regulator); 100 + if (pll->regulator) 101 + regulator_disable(pll->regulator); 101 102 err_reg: 102 103 clk_disable_unprepare(pll->clkin); 103 104 return r;
+2
drivers/video/fbdev/omap2/dss/sdi.c
··· 342 342 out->output_type = OMAP_DISPLAY_TYPE_SDI; 343 343 out->name = "sdi.0"; 344 344 out->dispc_channel = OMAP_DSS_CHANNEL_LCD; 345 + /* We have SDI only on OMAP3, where it's on port 1 */ 346 + out->port_num = 1; 345 347 out->ops.sdi = &sdi_ops; 346 348 out->owner = THIS_MODULE; 347 349
+16 -1
drivers/video/logo/logo.c
··· 21 21 module_param(nologo, bool, 0); 22 22 MODULE_PARM_DESC(nologo, "Disables startup logo"); 23 23 24 + /* 25 + * Logos are located in the initdata, and will be freed in kernel_init. 26 + * Use late_init to mark the logos as freed to prevent any further use. 27 + */ 28 + 29 + static bool logos_freed; 30 + 31 + static int __init fb_logo_late_init(void) 32 + { 33 + logos_freed = true; 34 + return 0; 35 + } 36 + 37 + late_initcall(fb_logo_late_init); 38 + 24 39 /* logo's are marked __initdata. Use __init_refok to tell 25 40 * modpost that it is intended that this function uses data 26 41 * marked __initdata. ··· 44 29 { 45 30 const struct linux_logo *logo = NULL; 46 31 47 - if (nologo) 32 + if (nologo || logos_freed) 48 33 return NULL; 49 34 50 35 if (depth >= 1) {
+3 -3
fs/cifs/cifsglob.h
··· 661 661 server->ops->set_credits(server, val); 662 662 } 663 663 664 - static inline __u64 664 + static inline __le64 665 665 get_next_mid64(struct TCP_Server_Info *server) 666 666 { 667 - return server->ops->get_next_mid(server); 667 + return cpu_to_le64(server->ops->get_next_mid(server)); 668 668 } 669 669 670 670 static inline __le16 671 671 get_next_mid(struct TCP_Server_Info *server) 672 672 { 673 - __u16 mid = get_next_mid64(server); 673 + __u16 mid = server->ops->get_next_mid(server); 674 674 /* 675 675 * The value in the SMB header should be little endian for easy 676 676 * on-the-wire decoding.
+7 -5
fs/cifs/netmisc.c
··· 926 926 927 927 /* Subtract the NTFS time offset, then convert to 1s intervals. */ 928 928 s64 t = le64_to_cpu(ntutc) - NTFS_TIME_OFFSET; 929 + u64 abs_t; 929 930 930 931 /* 931 932 * Unfortunately can not use normal 64 bit division on 32 bit arch, but ··· 934 933 * to special case them 935 934 */ 936 935 if (t < 0) { 937 - t = -t; 938 - ts.tv_nsec = (long)(do_div(t, 10000000) * 100); 936 + abs_t = -t; 937 + ts.tv_nsec = (long)(do_div(abs_t, 10000000) * 100); 939 938 ts.tv_nsec = -ts.tv_nsec; 940 - ts.tv_sec = -t; 939 + ts.tv_sec = -abs_t; 941 940 } else { 942 - ts.tv_nsec = (long)do_div(t, 10000000) * 100; 943 - ts.tv_sec = t; 941 + abs_t = t; 942 + ts.tv_nsec = (long)do_div(abs_t, 10000000) * 100; 943 + ts.tv_sec = abs_t; 944 944 } 945 945 946 946 return ts;
+7 -3
fs/cifs/readdir.c
··· 69 69 * Attempt to preload the dcache with the results from the FIND_FIRST/NEXT 70 70 * 71 71 * Find the dentry that matches "name". If there isn't one, create one. If it's 72 - * a negative dentry or the uniqueid changed, then drop it and recreate it. 72 + * a negative dentry or the uniqueid or filetype(mode) changed, 73 + * then drop it and recreate it. 73 74 */ 74 75 static void 75 76 cifs_prime_dcache(struct dentry *parent, struct qstr *name, ··· 98 97 if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)) 99 98 fattr->cf_uniqueid = CIFS_I(inode)->uniqueid; 100 99 101 - /* update inode in place if i_ino didn't change */ 102 - if (CIFS_I(inode)->uniqueid == fattr->cf_uniqueid) { 100 + /* update inode in place 101 + * if both i_ino and i_mode didn't change */ 102 + if (CIFS_I(inode)->uniqueid == fattr->cf_uniqueid && 103 + (inode->i_mode & S_IFMT) == 104 + (fattr->cf_mode & S_IFMT)) { 103 105 cifs_fattr_to_inode(inode, fattr); 104 106 goto out; 105 107 }
+7 -5
fs/cifs/smb2misc.c
··· 32 32 static int 33 33 check_smb2_hdr(struct smb2_hdr *hdr, __u64 mid) 34 34 { 35 + __u64 wire_mid = le64_to_cpu(hdr->MessageId); 36 + 35 37 /* 36 38 * Make sure that this really is an SMB, that it is a response, 37 39 * and that the message ids match. 38 40 */ 39 41 if ((*(__le32 *)hdr->ProtocolId == SMB2_PROTO_NUMBER) && 40 - (mid == hdr->MessageId)) { 42 + (mid == wire_mid)) { 41 43 if (hdr->Flags & SMB2_FLAGS_SERVER_TO_REDIR) 42 44 return 0; 43 45 else { ··· 53 51 if (*(__le32 *)hdr->ProtocolId != SMB2_PROTO_NUMBER) 54 52 cifs_dbg(VFS, "Bad protocol string signature header %x\n", 55 53 *(unsigned int *) hdr->ProtocolId); 56 - if (mid != hdr->MessageId) 54 + if (mid != wire_mid) 57 55 cifs_dbg(VFS, "Mids do not match: %llu and %llu\n", 58 - mid, hdr->MessageId); 56 + mid, wire_mid); 59 57 } 60 - cifs_dbg(VFS, "Bad SMB detected. The Mid=%llu\n", hdr->MessageId); 58 + cifs_dbg(VFS, "Bad SMB detected. The Mid=%llu\n", wire_mid); 61 59 return 1; 62 60 } 63 61 ··· 97 95 { 98 96 struct smb2_hdr *hdr = (struct smb2_hdr *)buf; 99 97 struct smb2_pdu *pdu = (struct smb2_pdu *)hdr; 100 - __u64 mid = hdr->MessageId; 98 + __u64 mid = le64_to_cpu(hdr->MessageId); 101 99 __u32 len = get_rfc1002_length(buf); 102 100 __u32 clc_len; /* calculated length */ 103 101 int command;
+2 -1
fs/cifs/smb2ops.c
··· 176 176 { 177 177 struct mid_q_entry *mid; 178 178 struct smb2_hdr *hdr = (struct smb2_hdr *)buf; 179 + __u64 wire_mid = le64_to_cpu(hdr->MessageId); 179 180 180 181 spin_lock(&GlobalMid_Lock); 181 182 list_for_each_entry(mid, &server->pending_mid_q, qhead) { 182 - if ((mid->mid == hdr->MessageId) && 183 + if ((mid->mid == wire_mid) && 183 184 (mid->mid_state == MID_REQUEST_SUBMITTED) && 184 185 (mid->command == hdr->Command)) { 185 186 spin_unlock(&GlobalMid_Lock);
+1 -1
fs/cifs/smb2pdu.h
··· 110 110 __le16 CreditRequest; /* CreditResponse */ 111 111 __le32 Flags; 112 112 __le32 NextCommand; 113 - __u64 MessageId; /* opaque - so can stay little endian */ 113 + __le64 MessageId; 114 114 __le32 ProcessId; 115 115 __u32 TreeId; /* opaque - so do not make little endian */ 116 116 __u64 SessionId; /* opaque - so do not make little endian */
+1 -1
fs/cifs/smb2transport.c
··· 490 490 return temp; 491 491 else { 492 492 memset(temp, 0, sizeof(struct mid_q_entry)); 493 - temp->mid = smb_buffer->MessageId; /* always LE */ 493 + temp->mid = le64_to_cpu(smb_buffer->MessageId); 494 494 temp->pid = current->pid; 495 495 temp->command = smb_buffer->Command; /* Always LE */ 496 496 temp->when_alloc = jiffies;
+3
fs/isofs/rock.c
··· 362 362 rs.cont_size = isonum_733(rr->u.CE.size); 363 363 break; 364 364 case SIG('E', 'R'): 365 + /* Invalid length of ER tag id? */ 366 + if (rr->u.ER.len_id + offsetof(struct rock_ridge, u.ER.data) > rr->len) 367 + goto out; 365 368 ISOFS_SB(inode->i_sb)->s_rock = 1; 366 369 printk(KERN_DEBUG "ISO 9660 Extensions: "); 367 370 {
+16 -15
fs/udf/dir.c
··· 57 57 sector_t offset; 58 58 int i, num, ret = 0; 59 59 struct extent_position epos = { NULL, 0, {0, 0} }; 60 + struct super_block *sb = dir->i_sb; 60 61 61 62 if (ctx->pos == 0) { 62 63 if (!dir_emit_dot(file, ctx)) ··· 77 76 if (nf_pos == 0) 78 77 nf_pos = udf_ext0_offset(dir); 79 78 80 - fibh.soffset = fibh.eoffset = nf_pos & (dir->i_sb->s_blocksize - 1); 79 + fibh.soffset = fibh.eoffset = nf_pos & (sb->s_blocksize - 1); 81 80 if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) { 82 - if (inode_bmap(dir, nf_pos >> dir->i_sb->s_blocksize_bits, 81 + if (inode_bmap(dir, nf_pos >> sb->s_blocksize_bits, 83 82 &epos, &eloc, &elen, &offset) 84 83 != (EXT_RECORDED_ALLOCATED >> 30)) { 85 84 ret = -ENOENT; 86 85 goto out; 87 86 } 88 - block = udf_get_lb_pblock(dir->i_sb, &eloc, offset); 89 - if ((++offset << dir->i_sb->s_blocksize_bits) < elen) { 87 + block = udf_get_lb_pblock(sb, &eloc, offset); 88 + if ((++offset << sb->s_blocksize_bits) < elen) { 90 89 if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) 91 90 epos.offset -= sizeof(struct short_ad); 92 91 else if (iinfo->i_alloc_type == ··· 96 95 offset = 0; 97 96 } 98 97 99 - if (!(fibh.sbh = fibh.ebh = udf_tread(dir->i_sb, block))) { 98 + if (!(fibh.sbh = fibh.ebh = udf_tread(sb, block))) { 100 99 ret = -EIO; 101 100 goto out; 102 101 } 103 102 104 - if (!(offset & ((16 >> (dir->i_sb->s_blocksize_bits - 9)) - 1))) { 105 - i = 16 >> (dir->i_sb->s_blocksize_bits - 9); 106 - if (i + offset > (elen >> dir->i_sb->s_blocksize_bits)) 107 - i = (elen >> dir->i_sb->s_blocksize_bits) - offset; 103 + if (!(offset & ((16 >> (sb->s_blocksize_bits - 9)) - 1))) { 104 + i = 16 >> (sb->s_blocksize_bits - 9); 105 + if (i + offset > (elen >> sb->s_blocksize_bits)) 106 + i = (elen >> sb->s_blocksize_bits) - offset; 108 107 for (num = 0; i > 0; i--) { 109 - block = udf_get_lb_pblock(dir->i_sb, &eloc, offset + i); 110 - tmp = udf_tgetblk(dir->i_sb, block); 108 + block = udf_get_lb_pblock(sb, &eloc, offset + i); 109 + tmp = udf_tgetblk(sb, block); 111 110 if (tmp && !buffer_uptodate(tmp) && !buffer_locked(tmp)) 112 111 bha[num++] = tmp; 113 112 else ··· 153 152 } 154 153 155 154 if ((cfi.fileCharacteristics & FID_FILE_CHAR_DELETED) != 0) { 156 - if (!UDF_QUERY_FLAG(dir->i_sb, UDF_FLAG_UNDELETE)) 155 + if (!UDF_QUERY_FLAG(sb, UDF_FLAG_UNDELETE)) 157 156 continue; 158 157 } 159 158 160 159 if ((cfi.fileCharacteristics & FID_FILE_CHAR_HIDDEN) != 0) { 161 - if (!UDF_QUERY_FLAG(dir->i_sb, UDF_FLAG_UNHIDE)) 160 + if (!UDF_QUERY_FLAG(sb, UDF_FLAG_UNHIDE)) 162 161 continue; 163 162 } 164 163 ··· 168 167 continue; 169 168 } 170 169 171 - flen = udf_get_filename(dir->i_sb, nameptr, fname, lfi); 170 + flen = udf_get_filename(sb, nameptr, lfi, fname, UDF_NAME_LEN); 172 171 if (!flen) 173 172 continue; 174 173 175 174 tloc = lelb_to_cpu(cfi.icb.extLocation); 176 - iblock = udf_get_lb_pblock(dir->i_sb, &tloc, 0); 175 + iblock = udf_get_lb_pblock(sb, &tloc, 0); 177 176 if (!dir_emit(ctx, fname, flen, iblock, DT_UNKNOWN)) 178 177 goto out; 179 178 } /* end while */
+14
fs/udf/inode.c
··· 1489 1489 } 1490 1490 inode->i_generation = iinfo->i_unique; 1491 1491 1492 + /* Sanity checks for files in ICB so that we don't get confused later */ 1493 + if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { 1494 + /* 1495 + * For file in ICB data is stored in allocation descriptor 1496 + * so sizes should match 1497 + */ 1498 + if (iinfo->i_lenAlloc != inode->i_size) 1499 + goto out; 1500 + /* File in ICB has to fit in there... */ 1501 + if (inode->i_size > inode->i_sb->s_blocksize - 1502 + udf_file_entry_alloc_offset(inode)) 1503 + goto out; 1504 + } 1505 + 1492 1506 switch (fe->icbTag.fileType) { 1493 1507 case ICBTAG_FILE_TYPE_DIRECTORY: 1494 1508 inode->i_op = &udf_dir_inode_operations;
+9 -8
fs/udf/namei.c
··· 159 159 struct udf_inode_info *dinfo = UDF_I(dir); 160 160 int isdotdot = child->len == 2 && 161 161 child->name[0] == '.' && child->name[1] == '.'; 162 + struct super_block *sb = dir->i_sb; 162 163 163 164 size = udf_ext0_offset(dir) + dir->i_size; 164 165 f_pos = udf_ext0_offset(dir); 165 166 166 167 fibh->sbh = fibh->ebh = NULL; 167 - fibh->soffset = fibh->eoffset = f_pos & (dir->i_sb->s_blocksize - 1); 168 + fibh->soffset = fibh->eoffset = f_pos & (sb->s_blocksize - 1); 168 169 if (dinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) { 169 - if (inode_bmap(dir, f_pos >> dir->i_sb->s_blocksize_bits, &epos, 170 + if (inode_bmap(dir, f_pos >> sb->s_blocksize_bits, &epos, 170 171 &eloc, &elen, &offset) != (EXT_RECORDED_ALLOCATED >> 30)) 171 172 goto out_err; 172 - block = udf_get_lb_pblock(dir->i_sb, &eloc, offset); 173 - if ((++offset << dir->i_sb->s_blocksize_bits) < elen) { 173 + block = udf_get_lb_pblock(sb, &eloc, offset); 174 + if ((++offset << sb->s_blocksize_bits) < elen) { 174 175 if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) 175 176 epos.offset -= sizeof(struct short_ad); 176 177 else if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) ··· 179 178 } else 180 179 offset = 0; 181 180 182 - fibh->sbh = fibh->ebh = udf_tread(dir->i_sb, block); 181 + fibh->sbh = fibh->ebh = udf_tread(sb, block); 183 182 if (!fibh->sbh) 184 183 goto out_err; 185 184 } ··· 218 217 } 219 218 220 219 if ((cfi->fileCharacteristics & FID_FILE_CHAR_DELETED) != 0) { 221 - if (!UDF_QUERY_FLAG(dir->i_sb, UDF_FLAG_UNDELETE)) 220 + if (!UDF_QUERY_FLAG(sb, UDF_FLAG_UNDELETE)) 222 221 continue; 223 222 } 224 223 225 224 if ((cfi->fileCharacteristics & FID_FILE_CHAR_HIDDEN) != 0) { 226 - if (!UDF_QUERY_FLAG(dir->i_sb, UDF_FLAG_UNHIDE)) 225 + if (!UDF_QUERY_FLAG(sb, UDF_FLAG_UNHIDE)) 227 226 continue; 228 227 } 229 228 ··· 234 233 if (!lfi) 235 234 continue; 236 235 237 - flen = udf_get_filename(dir->i_sb, nameptr, fname, lfi); 236 + flen = udf_get_filename(sb, nameptr, lfi, fname, UDF_NAME_LEN); 238 237 if (flen && udf_match(flen, fname, child->len, child->name)) 239 238 goto out_ok; 240 239 }
+46 -11
fs/udf/symlink.c
··· 30 30 #include <linux/buffer_head.h> 31 31 #include "udf_i.h" 32 32 33 - static void udf_pc_to_char(struct super_block *sb, unsigned char *from, 34 - int fromlen, unsigned char *to) 33 + static int udf_pc_to_char(struct super_block *sb, unsigned char *from, 34 + int fromlen, unsigned char *to, int tolen) 35 35 { 36 36 struct pathComponent *pc; 37 37 int elen = 0; 38 + int comp_len; 38 39 unsigned char *p = to; 39 40 41 + /* Reserve one byte for terminating \0 */ 42 + tolen--; 40 43 while (elen < fromlen) { 41 44 pc = (struct pathComponent *)(from + elen); 45 + elen += sizeof(struct pathComponent); 42 46 switch (pc->componentType) { 43 47 case 1: 44 48 /* 45 49 * Symlink points to some place which should be agreed 46 50 * upon between originator and receiver of the media. Ignore. 47 51 */ 48 - if (pc->lengthComponentIdent > 0) 52 + if (pc->lengthComponentIdent > 0) { 53 + elen += pc->lengthComponentIdent; 49 54 break; 55 + } 50 56 /* Fall through */ 51 57 case 2: 58 + if (tolen == 0) 59 + return -ENAMETOOLONG; 52 60 p = to; 53 61 *p++ = '/'; 62 + tolen--; 54 63 break; 55 64 case 3: 65 + if (tolen < 3) 66 + return -ENAMETOOLONG; 56 67 memcpy(p, "../", 3); 57 68 p += 3; 69 + tolen -= 3; 58 70 break; 59 71 case 4: 72 + if (tolen < 2) 73 + return -ENAMETOOLONG; 60 74 memcpy(p, "./", 2); 61 75 p += 2; 76 + tolen -= 2; 62 77 /* that would be . - just ignore */ 63 78 break; 64 79 case 5: 65 - p += udf_get_filename(sb, pc->componentIdent, p, 66 - pc->lengthComponentIdent); 80 + elen += pc->lengthComponentIdent; 81 + if (elen > fromlen) 82 + return -EIO; 83 + comp_len = udf_get_filename(sb, pc->componentIdent, 84 + pc->lengthComponentIdent, 85 + p, tolen); 86 + p += comp_len; 87 + tolen -= comp_len; 88 + if (tolen == 0) 89 + return -ENAMETOOLONG; 67 90 *p++ = '/'; 91 + tolen--; 68 92 break; 69 93 } 70 - elen += sizeof(struct pathComponent) + pc->lengthComponentIdent; 71 94 } 72 95 if (p > to + 1) 73 96 p[-1] = '\0'; 74 97 else 75 98 p[0] = '\0'; 99 + return 0; 76 100 } 77 101 78 102 static int udf_symlink_filler(struct file *file, struct page *page) ··· 104 80 struct inode *inode = page->mapping->host; 105 81 struct buffer_head *bh = NULL; 106 82 unsigned char *symlink; 107 - int err = -EIO; 83 + int err; 108 84 unsigned char *p = kmap(page); 109 85 struct udf_inode_info *iinfo; 110 86 uint32_t pos; 87 + 88 + /* We don't support symlinks longer than one block */ 89 + if (inode->i_size > inode->i_sb->s_blocksize) { 90 + err = -ENAMETOOLONG; 91 + goto out_unmap; 92 + } 111 93 112 94 iinfo = UDF_I(inode); 113 95 pos = udf_block_map(inode, 0); ··· 124 94 } else { 125 95 bh = sb_bread(inode->i_sb, pos); 126 96 127 - if (!bh) 128 - goto out; 97 + if (!bh) { 98 + err = -EIO; 99 + goto out_unlock_inode; 100 + } 129 101 130 102 symlink = bh->b_data; 131 103 } 132 104 133 - udf_pc_to_char(inode->i_sb, symlink, inode->i_size, p); 105 + err = udf_pc_to_char(inode->i_sb, symlink, inode->i_size, p, PAGE_SIZE); 134 106 brelse(bh); 107 + if (err) 108 + goto out_unlock_inode; 135 109 136 110 up_read(&iinfo->i_data_sem); 137 111 SetPageUptodate(page); ··· 143 109 unlock_page(page); 144 110 return 0; 145 111 146 - out: 112 + out_unlock_inode: 147 113 up_read(&iinfo->i_data_sem); 148 114 SetPageError(page); 115 + out_unmap: 149 116 kunmap(page); 150 117 unlock_page(page); 151 118 return err;
+2 -1
fs/udf/udfdecl.h
··· 211 211 } 212 212 213 213 /* unicode.c */ 214 - extern int udf_get_filename(struct super_block *, uint8_t *, uint8_t *, int); 214 + extern int udf_get_filename(struct super_block *, uint8_t *, int, uint8_t *, 215 + int); 215 216 extern int udf_put_filename(struct super_block *, const uint8_t *, uint8_t *, 216 217 int); 217 218 extern int udf_build_ustr(struct ustr *, dstring *, int);
+16 -12
fs/udf/unicode.c
··· 28 28 29 29 #include "udf_sb.h" 30 30 31 - static int udf_translate_to_linux(uint8_t *, uint8_t *, int, uint8_t *, int); 31 + static int udf_translate_to_linux(uint8_t *, int, uint8_t *, int, uint8_t *, 32 + int); 32 33 33 34 static int udf_char_to_ustr(struct ustr *dest, const uint8_t *src, int strlen) 34 35 { ··· 334 333 return u_len + 1; 335 334 } 336 335 337 - int udf_get_filename(struct super_block *sb, uint8_t *sname, uint8_t *dname, 338 - int flen) 336 + int udf_get_filename(struct super_block *sb, uint8_t *sname, int slen, 337 + uint8_t *dname, int dlen) 339 338 { 340 339 struct ustr *filename, *unifilename; 341 340 int len = 0; ··· 348 347 if (!unifilename) 349 348 goto out1; 350 349 351 - if (udf_build_ustr_exact(unifilename, sname, flen)) 350 + if (udf_build_ustr_exact(unifilename, sname, slen)) 352 351 goto out2; 353 352 354 353 if (UDF_QUERY_FLAG(sb, UDF_FLAG_UTF8)) { ··· 367 366 } else 368 367 goto out2; 369 368 370 - len = udf_translate_to_linux(dname, filename->u_name, filename->u_len, 369 + len = udf_translate_to_linux(dname, dlen, 370 + filename->u_name, filename->u_len, 371 371 unifilename->u_name, unifilename->u_len); 372 372 out2: 373 373 kfree(unifilename); ··· 405 403 #define EXT_MARK '.' 406 404 #define CRC_MARK '#' 407 405 #define EXT_SIZE 5 406 + /* Number of chars we need to store generated CRC to make filename unique */ 407 + #define CRC_LEN 5 408 408 409 - static int udf_translate_to_linux(uint8_t *newName, uint8_t *udfName, 410 - int udfLen, uint8_t *fidName, 411 - int fidNameLen) 409 + static int udf_translate_to_linux(uint8_t *newName, int newLen, 410 + uint8_t *udfName, int udfLen, 411 + uint8_t *fidName, int fidNameLen) 412 412 { 413 413 int index, newIndex = 0, needsCRC = 0; 414 414 int extIndex = 0, newExtIndex = 0, hasExt = 0; ··· 443 439 newExtIndex = newIndex; 444 440 } 445 441 } 446 - if (newIndex < 256) 442 + if (newIndex < newLen) 447 443 newName[newIndex++] = curr; 448 444 else 449 445 needsCRC = 1; ··· 471 467 } 472 468 ext[localExtIndex++] = curr; 473 469 } 474 - maxFilenameLen = 250 - localExtIndex; 470 + maxFilenameLen = newLen - CRC_LEN - localExtIndex; 475 471 if (newIndex > maxFilenameLen) 476 472 newIndex = maxFilenameLen; 477 473 else 478 474 newIndex = newExtIndex; 479 - } else if (newIndex > 250) 480 - newIndex = 250; 475 + } else if (newIndex > newLen - CRC_LEN) 476 + newIndex = newLen - CRC_LEN; 481 477 newName[newIndex++] = CRC_MARK; 482 478 valueCRC = crc_itu_t(0, fidName, fidNameLen); 483 479 newName[newIndex++] = hex_asc_upper_hi(valueCRC >> 8);
+4
include/drm/drmP.h
··· 901 901 extern int drm_wait_vblank(struct drm_device *dev, void *data, 902 902 struct drm_file *filp); 903 903 extern u32 drm_vblank_count(struct drm_device *dev, int crtc); 904 + extern u32 drm_crtc_vblank_count(struct drm_crtc *crtc); 904 905 extern u32 drm_vblank_count_and_time(struct drm_device *dev, int crtc, 905 906 struct timeval *vblanktime); 906 907 extern void drm_send_vblank_event(struct drm_device *dev, int crtc, 907 908 struct drm_pending_vblank_event *e); 909 + extern void drm_crtc_send_vblank_event(struct drm_crtc *crtc, 910 + struct drm_pending_vblank_event *e); 908 911 extern bool drm_handle_vblank(struct drm_device *dev, int crtc); 912 + extern bool drm_crtc_handle_vblank(struct drm_crtc *crtc); 909 913 extern int drm_vblank_get(struct drm_device *dev, int crtc); 910 914 extern void drm_vblank_put(struct drm_device *dev, int crtc); 911 915 extern int drm_crtc_vblank_get(struct drm_crtc *crtc);
-7
include/drm/drm_gem.h
··· 119 119 * simply leave it as NULL. 120 120 */ 121 121 struct dma_buf_attachment *import_attach; 122 - 123 - /** 124 - * dumb - created as dumb buffer 125 - * Whether the gem object was created using the dumb buffer interface 126 - * as such it may not be used for GPU rendering. 127 - */ 128 - bool dumb; 129 122 }; 130 123 131 124 void drm_gem_object_release(struct drm_gem_object *obj);
+1 -1
include/dt-bindings/thermal/thermal.h
··· 11 11 #define _DT_BINDINGS_THERMAL_THERMAL_H 12 12 13 13 /* On cooling devices upper and lower limits */ 14 - #define THERMAL_NO_LIMIT (-1UL) 14 + #define THERMAL_NO_LIMIT (~0) 15 15 16 16 #endif 17 17
+4
include/linux/audit.h
··· 47 47 48 48 struct audit_krule { 49 49 int vers_ops; 50 + u32 pflags; 50 51 u32 flags; 51 52 u32 listnr; 52 53 u32 action; ··· 64 63 struct list_head list; /* for AUDIT_LIST* purposes only */ 65 64 u64 prio; 66 65 }; 66 + 67 + /* Flag to indicate legacy AUDIT_LOGINUID unset usage */ 68 + #define AUDIT_LOGINUID_LEGACY 0x1 67 69 68 70 struct audit_field { 69 71 u32 type;
+3 -3
include/linux/cpu_cooling.h
··· 50 50 of_cpufreq_cooling_register(struct device_node *np, 51 51 const struct cpumask *clip_cpus) 52 52 { 53 - return NULL; 53 + return ERR_PTR(-ENOSYS); 54 54 } 55 55 #endif 56 56 ··· 65 65 static inline struct thermal_cooling_device * 66 66 cpufreq_cooling_register(const struct cpumask *clip_cpus) 67 67 { 68 - return NULL; 68 + return ERR_PTR(-ENOSYS); 69 69 } 70 70 static inline struct thermal_cooling_device * 71 71 of_cpufreq_cooling_register(struct device_node *np, 72 72 const struct cpumask *clip_cpus) 73 73 { 74 - return NULL; 74 + return ERR_PTR(-ENOSYS); 75 75 } 76 76 static inline 77 77 void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
-3
include/linux/cpuidle.h
··· 53 53 }; 54 54 55 55 /* Idle State Flags */ 56 - #define CPUIDLE_FLAG_TIME_INVALID (0x01) /* is residency time measurable? */ 57 56 #define CPUIDLE_FLAG_COUPLED (0x02) /* state applies to multiple cpus */ 58 57 #define CPUIDLE_FLAG_TIMER_STOP (0x04) /* timer is stopped on this state */ 59 58 ··· 88 89 /** 89 90 * cpuidle_get_last_residency - retrieves the last state's residency time 90 91 * @dev: the target CPU 91 - * 92 - * NOTE: this value is invalid if CPUIDLE_FLAG_TIME_INVALID is set 93 92 */ 94 93 static inline int cpuidle_get_last_residency(struct cpuidle_device *dev) 95 94 {
+2 -20
include/linux/mfd/stmpe.h
··· 50 50 STMPE_IDX_GPEDR_MSB, 51 51 STMPE_IDX_GPRER_LSB, 52 52 STMPE_IDX_GPFER_LSB, 53 + STMPE_IDX_GPPUR_LSB, 54 + STMPE_IDX_GPPDR_LSB, 53 55 STMPE_IDX_GPAFR_U_MSB, 54 56 STMPE_IDX_IEGPIOR_LSB, 55 57 STMPE_IDX_ISGPIOR_LSB, ··· 114 112 enum stmpe_block block); 115 113 extern int stmpe_enable(struct stmpe *stmpe, unsigned int blocks); 116 114 extern int stmpe_disable(struct stmpe *stmpe, unsigned int blocks); 117 - 118 - struct matrix_keymap_data; 119 - 120 - /** 121 - * struct stmpe_keypad_platform_data - STMPE keypad platform data 122 - * @keymap_data: key map table and size 123 - * @debounce_ms: debounce interval, in ms. Maximum is 124 - * %STMPE_KEYPAD_MAX_DEBOUNCE. 125 - * @scan_count: number of key scanning cycles to confirm key data. 126 - * Maximum is %STMPE_KEYPAD_MAX_SCAN_COUNT. 127 - * @no_autorepeat: disable key autorepeat 128 - */ 129 - struct stmpe_keypad_platform_data { 130 - const struct matrix_keymap_data *keymap_data; 131 - unsigned int debounce_ms; 132 - unsigned int scan_count; 133 - bool no_autorepeat; 134 - }; 135 115 136 116 #define STMPE_GPIO_NOREQ_811_TOUCH (0xf0) 137 117 ··· 183 199 * @irq_gpio: gpio number over which irq will be requested (significant only if 184 200 * irq_over_gpio is true) 185 201 * @gpio: GPIO-specific platform data 186 - * @keypad: keypad-specific platform data 187 202 * @ts: touchscreen-specific platform data 188 203 */ 189 204 struct stmpe_platform_data { ··· 195 212 int autosleep_timeout; 196 213 197 214 struct stmpe_gpio_platform_data *gpio; 198 - struct stmpe_keypad_platform_data *keypad; 199 215 struct stmpe_ts_platform_data *ts; 200 216 }; 201 217
+11 -9
include/linux/netdevice.h
··· 1012 1012 * Callback to use for xmit over the accelerated station. This 1013 1013 * is used in place of ndo_start_xmit on accelerated net 1014 1014 * devices. 1015 - * bool (*ndo_gso_check) (struct sk_buff *skb, 1016 - * struct net_device *dev); 1015 + * netdev_features_t (*ndo_features_check) (struct sk_buff *skb, 1016 + * struct net_device *dev 1017 + * netdev_features_t features); 1017 1018 * Called by core transmit path to determine if device is capable of 1018 - * performing GSO on a packet. The device returns true if it is 1019 - * able to GSO the packet, false otherwise. If the return value is 1020 - * false the stack will do software GSO. 1019 + * performing offload operations on a given packet. This is to give 1020 + * the device an opportunity to implement any restrictions that cannot 1021 + * be otherwise expressed by feature flags. The check is called with 1022 + * the set of features that the stack has calculated and it returns 1023 + * those the driver believes to be appropriate. 1021 1024 * 1022 1025 * int (*ndo_switch_parent_id_get)(struct net_device *dev, 1023 1026 * struct netdev_phys_item_id *psid); ··· 1181 1178 struct net_device *dev, 1182 1179 void *priv); 1183 1180 int (*ndo_get_lock_subclass)(struct net_device *dev); 1184 - bool (*ndo_gso_check) (struct sk_buff *skb, 1185 - struct net_device *dev); 1181 + netdev_features_t (*ndo_features_check) (struct sk_buff *skb, 1182 + struct net_device *dev, 1183 + netdev_features_t features); 1186 1184 #ifdef CONFIG_NET_SWITCHDEV 1187 1185 int (*ndo_switch_parent_id_get)(struct net_device *dev, 1188 1186 struct netdev_phys_item_id *psid); ··· 3615 3611 netdev_features_t features) 3616 3612 { 3617 3613 return skb_is_gso(skb) && (!skb_gso_ok(skb, features) || 3618 - (dev->netdev_ops->ndo_gso_check && 3619 - !dev->netdev_ops->ndo_gso_check(skb, dev)) || 3620 3614 unlikely((skb->ip_summed != CHECKSUM_PARTIAL) && 3621 3615 (skb->ip_summed != CHECKSUM_UNNECESSARY))); 3622 3616 }
+2 -2
include/linux/netlink.h
··· 46 46 unsigned int flags; 47 47 void (*input)(struct sk_buff *skb); 48 48 struct mutex *cb_mutex; 49 - int (*bind)(int group); 50 - void (*unbind)(int group); 49 + int (*bind)(struct net *net, int group); 50 + void (*unbind)(struct net *net, int group); 51 51 bool (*compare)(struct net *net, struct sock *sk); 52 52 }; 53 53
+6 -7
include/linux/pagemap.h
··· 251 251 #define FGP_NOWAIT 0x00000020 252 252 253 253 struct page *pagecache_get_page(struct address_space *mapping, pgoff_t offset, 254 - int fgp_flags, gfp_t cache_gfp_mask, gfp_t radix_gfp_mask); 254 + int fgp_flags, gfp_t cache_gfp_mask); 255 255 256 256 /** 257 257 * find_get_page - find and get a page reference ··· 266 266 static inline struct page *find_get_page(struct address_space *mapping, 267 267 pgoff_t offset) 268 268 { 269 - return pagecache_get_page(mapping, offset, 0, 0, 0); 269 + return pagecache_get_page(mapping, offset, 0, 0); 270 270 } 271 271 272 272 static inline struct page *find_get_page_flags(struct address_space *mapping, 273 273 pgoff_t offset, int fgp_flags) 274 274 { 275 - return pagecache_get_page(mapping, offset, fgp_flags, 0, 0); 275 + return pagecache_get_page(mapping, offset, fgp_flags, 0); 276 276 } 277 277 278 278 /** ··· 292 292 static inline struct page *find_lock_page(struct address_space *mapping, 293 293 pgoff_t offset) 294 294 { 295 - return pagecache_get_page(mapping, offset, FGP_LOCK, 0, 0); 295 + return pagecache_get_page(mapping, offset, FGP_LOCK, 0); 296 296 } 297 297 298 298 /** ··· 319 319 { 320 320 return pagecache_get_page(mapping, offset, 321 321 FGP_LOCK|FGP_ACCESSED|FGP_CREAT, 322 - gfp_mask, gfp_mask & GFP_RECLAIM_MASK); 322 + gfp_mask); 323 323 } 324 324 325 325 /** ··· 340 340 { 341 341 return pagecache_get_page(mapping, index, 342 342 FGP_LOCK|FGP_CREAT|FGP_NOFS|FGP_NOWAIT, 343 - mapping_gfp_mask(mapping), 344 - GFP_NOFS); 343 + mapping_gfp_mask(mapping)); 345 344 } 346 345 347 346 struct page *find_get_entry(struct address_space *mapping, pgoff_t offset);
+8
include/linux/pm_domain.h
··· 271 271 int __of_genpd_add_provider(struct device_node *np, genpd_xlate_t xlate, 272 272 void *data); 273 273 void of_genpd_del_provider(struct device_node *np); 274 + struct generic_pm_domain *of_genpd_get_from_provider( 275 + struct of_phandle_args *genpdspec); 274 276 275 277 struct generic_pm_domain *__of_genpd_xlate_simple( 276 278 struct of_phandle_args *genpdspec, ··· 289 287 return 0; 290 288 } 291 289 static inline void of_genpd_del_provider(struct device_node *np) {} 290 + 291 + static inline struct generic_pm_domain *of_genpd_get_from_provider( 292 + struct of_phandle_args *genpdspec) 293 + { 294 + return NULL; 295 + } 292 296 293 297 #define __of_genpd_xlate_simple NULL 294 298 #define __of_genpd_xlate_onecell NULL
+1 -1
include/linux/thermal.h
··· 38 38 #define THERMAL_CSTATE_INVALID -1UL 39 39 40 40 /* No upper/lower limit requirement */ 41 - #define THERMAL_NO_LIMIT THERMAL_CSTATE_INVALID 41 + #define THERMAL_NO_LIMIT ((u32)~0) 42 42 43 43 /* Unit conversion macros */ 44 44 #define KELVIN_TO_CELSIUS(t) (long)(((long)t-2732 >= 0) ? \
+7 -2
include/net/genetlink.h
··· 31 31 * do additional, common, filtering and return an error 32 32 * @post_doit: called after an operation's doit callback, it may 33 33 * undo operations done by pre_doit, for example release locks 34 + * @mcast_bind: a socket bound to the given multicast group (which 35 + * is given as the offset into the groups array) 36 + * @mcast_unbind: a socket was unbound from the given multicast group 34 37 * @attrbuf: buffer to store parsed attributes 35 38 * @family_list: family list 36 39 * @mcgrps: multicast groups used by this family (private) ··· 56 53 void (*post_doit)(const struct genl_ops *ops, 57 54 struct sk_buff *skb, 58 55 struct genl_info *info); 56 + int (*mcast_bind)(struct net *net, int group); 57 + void (*mcast_unbind)(struct net *net, int group); 59 58 struct nlattr ** attrbuf; /* private */ 60 59 const struct genl_ops * ops; /* private */ 61 60 const struct genl_multicast_group *mcgrps; /* private */ ··· 400 395 } 401 396 402 397 static inline int genl_has_listeners(struct genl_family *family, 403 - struct sock *sk, unsigned int group) 398 + struct net *net, unsigned int group) 404 399 { 405 400 if (WARN_ON_ONCE(group >= family->n_mcgrps)) 406 401 return -EINVAL; 407 402 group = family->mcgrp_offset + group; 408 - return netlink_has_listeners(sk, group); 403 + return netlink_has_listeners(net->genl_sock, group); 409 404 } 410 405 #endif /* __NET_GENERIC_NETLINK_H */
-1
include/net/neighbour.h
··· 190 190 191 191 192 192 struct neigh_table { 193 - struct neigh_table *next; 194 193 int family; 195 194 int entry_size; 196 195 int key_len;
+24 -4
include/net/vxlan.h
··· 1 1 #ifndef __NET_VXLAN_H 2 2 #define __NET_VXLAN_H 1 3 3 4 + #include <linux/ip.h> 5 + #include <linux/ipv6.h> 6 + #include <linux/if_vlan.h> 4 7 #include <linux/skbuff.h> 5 8 #include <linux/netdevice.h> 6 9 #include <linux/udp.h> ··· 54 51 __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df, 55 52 __be16 src_port, __be16 dst_port, __be32 vni, bool xnet); 56 53 57 - static inline bool vxlan_gso_check(struct sk_buff *skb) 54 + static inline netdev_features_t vxlan_features_check(struct sk_buff *skb, 55 + netdev_features_t features) 58 56 { 59 - if ((skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL) && 57 + u8 l4_hdr = 0; 58 + 59 + if (!skb->encapsulation) 60 + return features; 61 + 62 + switch (vlan_get_protocol(skb)) { 63 + case htons(ETH_P_IP): 64 + l4_hdr = ip_hdr(skb)->protocol; 65 + break; 66 + case htons(ETH_P_IPV6): 67 + l4_hdr = ipv6_hdr(skb)->nexthdr; 68 + break; 69 + default: 70 + return features;; 71 + } 72 + 73 + if ((l4_hdr == IPPROTO_UDP) && 60 74 (skb->inner_protocol_type != ENCAP_TYPE_ETHER || 61 75 skb->inner_protocol != htons(ETH_P_TEB) || 62 76 (skb_inner_mac_header(skb) - skb_transport_header(skb) != 63 77 sizeof(struct udphdr) + sizeof(struct vxlanhdr)))) 64 - return false; 78 + return features & ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK); 65 79 66 - return true; 80 + return features; 67 81 } 68 82 69 83 /* IP header + UDP + VXLAN + Ethernet header */
+5 -5
include/sound/pcm.h
··· 857 857 } 858 858 859 859 /** 860 - * params_channels - Get the sample rate from the hw params 860 + * params_rate - Get the sample rate from the hw params 861 861 * @p: hw params 862 862 */ 863 863 static inline unsigned int params_rate(const struct snd_pcm_hw_params *p) ··· 866 866 } 867 867 868 868 /** 869 - * params_channels - Get the period size (in frames) from the hw params 869 + * params_period_size - Get the period size (in frames) from the hw params 870 870 * @p: hw params 871 871 */ 872 872 static inline unsigned int params_period_size(const struct snd_pcm_hw_params *p) ··· 875 875 } 876 876 877 877 /** 878 - * params_channels - Get the number of periods from the hw params 878 + * params_periods - Get the number of periods from the hw params 879 879 * @p: hw params 880 880 */ 881 881 static inline unsigned int params_periods(const struct snd_pcm_hw_params *p) ··· 884 884 } 885 885 886 886 /** 887 - * params_channels - Get the buffer size (in frames) from the hw params 887 + * params_buffer_size - Get the buffer size (in frames) from the hw params 888 888 * @p: hw params 889 889 */ 890 890 static inline unsigned int params_buffer_size(const struct snd_pcm_hw_params *p) ··· 893 893 } 894 894 895 895 /** 896 - * params_channels - Get the buffer size (in bytes) from the hw params 896 + * params_buffer_bytes - Get the buffer size (in bytes) from the hw params 897 897 * @p: hw params 898 898 */ 899 899 static inline unsigned int params_buffer_bytes(const struct snd_pcm_hw_params *p)
+2 -1
include/uapi/linux/in6.h
··· 149 149 /* 150 150 * IPV6 socket options 151 151 */ 152 - 152 + #if __UAPI_DEF_IPV6_OPTIONS 153 153 #define IPV6_ADDRFORM 1 154 154 #define IPV6_2292PKTINFO 2 155 155 #define IPV6_2292HOPOPTS 3 ··· 196 196 197 197 #define IPV6_IPSEC_POLICY 34 198 198 #define IPV6_XFRM_POLICY 35 199 + #endif 199 200 200 201 /* 201 202 * Multicast:
+3
include/uapi/linux/libc-compat.h
··· 69 69 #define __UAPI_DEF_SOCKADDR_IN6 0 70 70 #define __UAPI_DEF_IPV6_MREQ 0 71 71 #define __UAPI_DEF_IPPROTO_V6 0 72 + #define __UAPI_DEF_IPV6_OPTIONS 0 72 73 73 74 #else 74 75 ··· 83 82 #define __UAPI_DEF_SOCKADDR_IN6 1 84 83 #define __UAPI_DEF_IPV6_MREQ 1 85 84 #define __UAPI_DEF_IPPROTO_V6 1 85 + #define __UAPI_DEF_IPV6_OPTIONS 1 86 86 87 87 #endif /* _NETINET_IN_H */ 88 88 ··· 105 103 #define __UAPI_DEF_SOCKADDR_IN6 1 106 104 #define __UAPI_DEF_IPV6_MREQ 1 107 105 #define __UAPI_DEF_IPPROTO_V6 1 106 + #define __UAPI_DEF_IPV6_OPTIONS 1 108 107 109 108 /* Definitions for xattr.h */ 110 109 #define __UAPI_DEF_XATTR 1
+7
include/uapi/linux/virtio_ring.h
··· 101 101 struct vring_used *used; 102 102 }; 103 103 104 + /* Alignment requirements for vring elements. 105 + * When using pre-virtio 1.0 layout, these fall out naturally. 106 + */ 107 + #define VRING_AVAIL_ALIGN_SIZE 2 108 + #define VRING_USED_ALIGN_SIZE 4 109 + #define VRING_DESC_ALIGN_SIZE 16 110 + 104 111 /* The standard layout for the ring is a continuous chunk of memory which looks 105 112 * like this. We assume num is a power of 2. 106 113 *
+5 -5
kernel/audit.c
··· 429 429 * This function doesn't consume an skb as might be expected since it has to 430 430 * copy it anyways. 431 431 */ 432 - static void kauditd_send_multicast_skb(struct sk_buff *skb) 432 + static void kauditd_send_multicast_skb(struct sk_buff *skb, gfp_t gfp_mask) 433 433 { 434 434 struct sk_buff *copy; 435 435 struct audit_net *aunet = net_generic(&init_net, audit_net_id); ··· 448 448 * no reason for new multicast clients to continue with this 449 449 * non-compliance. 450 450 */ 451 - copy = skb_copy(skb, GFP_KERNEL); 451 + copy = skb_copy(skb, gfp_mask); 452 452 if (!copy) 453 453 return; 454 454 455 - nlmsg_multicast(sock, copy, 0, AUDIT_NLGRP_READLOG, GFP_KERNEL); 455 + nlmsg_multicast(sock, copy, 0, AUDIT_NLGRP_READLOG, gfp_mask); 456 456 } 457 457 458 458 /* ··· 1100 1100 } 1101 1101 1102 1102 /* Run custom bind function on netlink socket group connect or bind requests. */ 1103 - static int audit_bind(int group) 1103 + static int audit_bind(struct net *net, int group) 1104 1104 { 1105 1105 if (!capable(CAP_AUDIT_READ)) 1106 1106 return -EPERM; ··· 1940 1940 struct nlmsghdr *nlh = nlmsg_hdr(ab->skb); 1941 1941 1942 1942 nlh->nlmsg_len = ab->skb->len; 1943 - kauditd_send_multicast_skb(ab->skb); 1943 + kauditd_send_multicast_skb(ab->skb, ab->gfp_mask); 1944 1944 1945 1945 /* 1946 1946 * The original kaudit unicast socket sends up messages with
+10 -13
kernel/auditfilter.c
··· 442 442 if ((f->type == AUDIT_LOGINUID) && (f->val == AUDIT_UID_UNSET)) { 443 443 f->type = AUDIT_LOGINUID_SET; 444 444 f->val = 0; 445 - } 446 - 447 - if ((f->type == AUDIT_PID) || (f->type == AUDIT_PPID)) { 448 - struct pid *pid; 449 - rcu_read_lock(); 450 - pid = find_vpid(f->val); 451 - if (!pid) { 452 - rcu_read_unlock(); 453 - err = -ESRCH; 454 - goto exit_free; 455 - } 456 - f->val = pid_nr(pid); 457 - rcu_read_unlock(); 445 + entry->rule.pflags |= AUDIT_LOGINUID_LEGACY; 458 446 } 459 447 460 448 err = audit_field_valid(entry, f); ··· 618 630 data->buflen += data->values[i] = 619 631 audit_pack_string(&bufp, krule->filterkey); 620 632 break; 633 + case AUDIT_LOGINUID_SET: 634 + if (krule->pflags & AUDIT_LOGINUID_LEGACY && !f->val) { 635 + data->fields[i] = AUDIT_LOGINUID; 636 + data->values[i] = AUDIT_UID_UNSET; 637 + break; 638 + } 639 + /* fallthrough if set */ 621 640 default: 622 641 data->values[i] = f->val; 623 642 } ··· 641 646 int i; 642 647 643 648 if (a->flags != b->flags || 649 + a->pflags != b->pflags || 644 650 a->listnr != b->listnr || 645 651 a->action != b->action || 646 652 a->field_count != b->field_count) ··· 760 764 new = &entry->rule; 761 765 new->vers_ops = old->vers_ops; 762 766 new->flags = old->flags; 767 + new->pflags = old->pflags; 763 768 new->listnr = old->listnr; 764 769 new->action = old->action; 765 770 for (i = 0; i < AUDIT_BITMASK_SIZE; i++)
+43 -6
kernel/auditsc.c
··· 72 72 #include <linux/fs_struct.h> 73 73 #include <linux/compat.h> 74 74 #include <linux/ctype.h> 75 + #include <linux/string.h> 76 + #include <uapi/linux/limits.h> 75 77 76 78 #include "audit.h" 77 79 ··· 1863 1861 } 1864 1862 1865 1863 list_for_each_entry_reverse(n, &context->names_list, list) { 1866 - /* does the name pointer match? */ 1867 - if (!n->name || n->name->name != name->name) 1864 + if (!n->name || strcmp(n->name->name, name->name)) 1868 1865 continue; 1869 1866 1870 1867 /* match the correct record type */ ··· 1878 1877 } 1879 1878 1880 1879 out_alloc: 1881 - /* unable to find the name from a previous getname(). Allocate a new 1882 - * anonymous entry. 1883 - */ 1884 - n = audit_alloc_name(context, AUDIT_TYPE_NORMAL); 1880 + /* unable to find an entry with both a matching name and type */ 1881 + n = audit_alloc_name(context, AUDIT_TYPE_UNKNOWN); 1885 1882 if (!n) 1886 1883 return; 1884 + /* unfortunately, while we may have a path name to record with the 1885 + * inode, we can't always rely on the string lasting until the end of 1886 + * the syscall so we need to create our own copy, it may fail due to 1887 + * memory allocation issues, but we do our best */ 1888 + if (name) { 1889 + /* we can't use getname_kernel() due to size limits */ 1890 + size_t len = strlen(name->name) + 1; 1891 + struct filename *new = __getname(); 1892 + 1893 + if (unlikely(!new)) 1894 + goto out; 1895 + 1896 + if (len <= (PATH_MAX - sizeof(*new))) { 1897 + new->name = (char *)(new) + sizeof(*new); 1898 + new->separate = false; 1899 + } else if (len <= PATH_MAX) { 1900 + /* this looks odd, but is due to final_putname() */ 1901 + struct filename *new2; 1902 + 1903 + new2 = kmalloc(sizeof(*new2), GFP_KERNEL); 1904 + if (unlikely(!new2)) { 1905 + __putname(new); 1906 + goto out; 1907 + } 1908 + new2->name = (char *)new; 1909 + new2->separate = true; 1910 + new = new2; 1911 + } else { 1912 + /* we should never get here, but let's be safe */ 1913 + __putname(new); 1914 + goto out; 1915 + } 1916 + strlcpy((char *)new->name, name->name, len); 1917 + new->uptr = NULL; 1918 + new->aname = n; 1919 + n->name = new; 1920 + n->name_put = true; 1921 + } 1887 1922 out: 1888 1923 if (parent) { 1889 1924 n->name_len = n->name ? parent_len(n->name->name) : AUDIT_NAME_FULL;
+12 -17
mm/filemap.c
··· 1046 1046 * @mapping: the address_space to search 1047 1047 * @offset: the page index 1048 1048 * @fgp_flags: PCG flags 1049 - * @cache_gfp_mask: gfp mask to use for the page cache data page allocation 1050 - * @radix_gfp_mask: gfp mask to use for radix tree node allocation 1049 + * @gfp_mask: gfp mask to use for the page cache data page allocation 1051 1050 * 1052 1051 * Looks up the page cache slot at @mapping & @offset. 1053 1052 * ··· 1055 1056 * FGP_ACCESSED: the page will be marked accessed 1056 1057 * FGP_LOCK: Page is return locked 1057 1058 * FGP_CREAT: If page is not present then a new page is allocated using 1058 - * @cache_gfp_mask and added to the page cache and the VM's LRU 1059 - * list. If radix tree nodes are allocated during page cache 1060 - * insertion then @radix_gfp_mask is used. The page is returned 1061 - * locked and with an increased refcount. Otherwise, %NULL is 1062 - * returned. 1059 + * @gfp_mask and added to the page cache and the VM's LRU 1060 + * list. The page is returned locked and with an increased 1061 + * refcount. Otherwise, %NULL is returned. 1063 1062 * 1064 1063 * If FGP_LOCK or FGP_CREAT are specified then the function may sleep even 1065 1064 * if the GFP flags specified for FGP_CREAT are atomic. ··· 1065 1068 * If there is a page cache page, it is returned with an increased refcount. 1066 1069 */ 1067 1070 struct page *pagecache_get_page(struct address_space *mapping, pgoff_t offset, 1068 - int fgp_flags, gfp_t cache_gfp_mask, gfp_t radix_gfp_mask) 1071 + int fgp_flags, gfp_t gfp_mask) 1069 1072 { 1070 1073 struct page *page; 1071 1074 ··· 1102 1105 if (!page && (fgp_flags & FGP_CREAT)) { 1103 1106 int err; 1104 1107 if ((fgp_flags & FGP_WRITE) && mapping_cap_account_dirty(mapping)) 1105 - cache_gfp_mask |= __GFP_WRITE; 1106 - if (fgp_flags & FGP_NOFS) { 1107 - cache_gfp_mask &= ~__GFP_FS; 1108 - radix_gfp_mask &= ~__GFP_FS; 1109 - } 1108 + gfp_mask |= __GFP_WRITE; 1109 + if (fgp_flags & FGP_NOFS) 1110 + gfp_mask &= ~__GFP_FS; 1110 1111 1111 - page = __page_cache_alloc(cache_gfp_mask); 1112 + page = __page_cache_alloc(gfp_mask); 1112 1113 if (!page) 1113 1114 return NULL; 1114 1115 ··· 1117 1122 if (fgp_flags & FGP_ACCESSED) 1118 1123 __SetPageReferenced(page); 1119 1124 1120 - err = add_to_page_cache_lru(page, mapping, offset, radix_gfp_mask); 1125 + err = add_to_page_cache_lru(page, mapping, offset, 1126 + gfp_mask & GFP_RECLAIM_MASK); 1121 1127 if (unlikely(err)) { 1122 1128 page_cache_release(page); 1123 1129 page = NULL; ··· 2439 2443 fgp_flags |= FGP_NOFS; 2440 2444 2441 2445 page = pagecache_get_page(mapping, index, fgp_flags, 2442 - mapping_gfp_mask(mapping), 2443 - GFP_KERNEL); 2446 + mapping_gfp_mask(mapping)); 2444 2447 if (page) 2445 2448 wait_for_stable_page(page); 2446 2449
+2 -2
mm/memory.c
··· 2378 2378 details.last_index = ULONG_MAX; 2379 2379 2380 2380 2381 - i_mmap_lock_read(mapping); 2381 + i_mmap_lock_write(mapping); 2382 2382 if (unlikely(!RB_EMPTY_ROOT(&mapping->i_mmap))) 2383 2383 unmap_mapping_range_tree(&mapping->i_mmap, &details); 2384 2384 if (unlikely(!list_empty(&mapping->i_mmap_nonlinear))) 2385 2385 unmap_mapping_range_list(&mapping->i_mmap_nonlinear, &details); 2386 - i_mmap_unlock_read(mapping); 2386 + i_mmap_unlock_write(mapping); 2387 2387 } 2388 2388 EXPORT_SYMBOL(unmap_mapping_range); 2389 2389
+2 -2
net/batman-adv/fragmentation.c
··· 251 251 kfree(entry); 252 252 253 253 /* Make room for the rest of the fragments. */ 254 - if (pskb_expand_head(skb_out, 0, size - skb->len, GFP_ATOMIC) < 0) { 254 + if (pskb_expand_head(skb_out, 0, size - skb_out->len, GFP_ATOMIC) < 0) { 255 255 kfree_skb(skb_out); 256 256 skb_out = NULL; 257 257 goto free; ··· 434 434 * fragments larger than BATADV_FRAG_MAX_FRAG_SIZE 435 435 */ 436 436 mtu = min_t(unsigned, mtu, BATADV_FRAG_MAX_FRAG_SIZE); 437 - max_fragment_size = (mtu - header_size - ETH_HLEN); 437 + max_fragment_size = mtu - header_size; 438 438 max_packet_size = max_fragment_size * BATADV_FRAG_MAX_FRAGMENTS; 439 439 440 440 /* Don't even try to fragment, if we need more than 16 fragments */
+1 -1
net/batman-adv/gateway_client.c
··· 810 810 goto out; 811 811 812 812 gw_node = batadv_gw_node_get(bat_priv, orig_dst_node); 813 - if (!gw_node->bandwidth_down == 0) 813 + if (!gw_node) 814 814 goto out; 815 815 816 816 switch (atomic_read(&bat_priv->gw_mode)) {
-1
net/bluetooth/6lowpan.c
··· 390 390 391 391 drop: 392 392 dev->stats.rx_dropped++; 393 - kfree_skb(skb); 394 393 return NET_RX_DROP; 395 394 } 396 395
+3
net/bluetooth/bnep/core.c
··· 533 533 534 534 BT_DBG(""); 535 535 536 + if (!l2cap_is_socket(sock)) 537 + return -EBADFD; 538 + 536 539 baswap((void *) dst, &l2cap_pi(sock->sk)->chan->dst); 537 540 baswap((void *) src, &l2cap_pi(sock->sk)->chan->src); 538 541
+3
net/bluetooth/cmtp/core.c
··· 334 334 335 335 BT_DBG(""); 336 336 337 + if (!l2cap_is_socket(sock)) 338 + return -EBADFD; 339 + 337 340 session = kzalloc(sizeof(struct cmtp_session), GFP_KERNEL); 338 341 if (!session) 339 342 return -ENOMEM;
+12 -4
net/bluetooth/hci_event.c
··· 242 242 if (rp->status) 243 243 return; 244 244 245 - if (test_bit(HCI_SETUP, &hdev->dev_flags)) 245 + if (test_bit(HCI_SETUP, &hdev->dev_flags) || 246 + test_bit(HCI_CONFIG, &hdev->dev_flags)) 246 247 memcpy(hdev->dev_name, rp->name, HCI_MAX_NAME_LENGTH); 247 248 } 248 249 ··· 510 509 if (rp->status) 511 510 return; 512 511 513 - if (test_bit(HCI_SETUP, &hdev->dev_flags)) { 512 + if (test_bit(HCI_SETUP, &hdev->dev_flags) || 513 + test_bit(HCI_CONFIG, &hdev->dev_flags)) { 514 514 hdev->hci_ver = rp->hci_ver; 515 515 hdev->hci_rev = __le16_to_cpu(rp->hci_rev); 516 516 hdev->lmp_ver = rp->lmp_ver; ··· 530 528 if (rp->status) 531 529 return; 532 530 533 - if (test_bit(HCI_SETUP, &hdev->dev_flags)) 531 + if (test_bit(HCI_SETUP, &hdev->dev_flags) || 532 + test_bit(HCI_CONFIG, &hdev->dev_flags)) 534 533 memcpy(hdev->commands, rp->commands, sizeof(hdev->commands)); 535 534 } 536 535 ··· 2197 2194 return; 2198 2195 } 2199 2196 2200 - if (!test_bit(HCI_CONNECTABLE, &hdev->dev_flags) && 2197 + /* Require HCI_CONNECTABLE or a whitelist entry to accept the 2198 + * connection. These features are only touched through mgmt so 2199 + * only do the checks if HCI_MGMT is set. 2200 + */ 2201 + if (test_bit(HCI_MGMT, &hdev->dev_flags) && 2202 + !test_bit(HCI_CONNECTABLE, &hdev->dev_flags) && 2201 2203 !hci_bdaddr_list_lookup(&hdev->whitelist, &ev->bdaddr, 2202 2204 BDADDR_BREDR)) { 2203 2205 hci_reject_conn(hdev, &ev->bdaddr);
+2 -1
net/bluetooth/hidp/core.c
··· 1314 1314 { 1315 1315 struct hidp_session *session; 1316 1316 struct l2cap_conn *conn; 1317 - struct l2cap_chan *chan = l2cap_pi(ctrl_sock->sk)->chan; 1317 + struct l2cap_chan *chan; 1318 1318 int ret; 1319 1319 1320 1320 ret = hidp_verify_sockets(ctrl_sock, intr_sock); 1321 1321 if (ret) 1322 1322 return ret; 1323 1323 1324 + chan = l2cap_pi(ctrl_sock->sk)->chan; 1324 1325 conn = NULL; 1325 1326 l2cap_chan_lock(chan); 1326 1327 if (chan->conn)
+100 -75
net/core/dev.c
··· 1694 1694 1695 1695 skb_scrub_packet(skb, true); 1696 1696 skb->protocol = eth_type_trans(skb, dev); 1697 + skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN); 1697 1698 1698 1699 return 0; 1699 1700 } ··· 2523 2522 /* If MPLS offload request, verify we are testing hardware MPLS features 2524 2523 * instead of standard features for the netdev. 2525 2524 */ 2526 - #ifdef CONFIG_NET_MPLS_GSO 2525 + #if IS_ENABLED(CONFIG_NET_MPLS_GSO) 2527 2526 static netdev_features_t net_mpls_features(struct sk_buff *skb, 2528 2527 netdev_features_t features, 2529 2528 __be16 type) ··· 2563 2562 2564 2563 netdev_features_t netif_skb_features(struct sk_buff *skb) 2565 2564 { 2566 - const struct net_device *dev = skb->dev; 2565 + struct net_device *dev = skb->dev; 2567 2566 netdev_features_t features = dev->features; 2568 2567 u16 gso_segs = skb_shinfo(skb)->gso_segs; 2569 2568 __be16 protocol = skb->protocol; ··· 2571 2570 if (gso_segs > dev->gso_max_segs || gso_segs < dev->gso_min_segs) 2572 2571 features &= ~NETIF_F_GSO_MASK; 2573 2572 2574 - if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD)) { 2575 - struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; 2576 - protocol = veh->h_vlan_encapsulated_proto; 2577 - } else if (!vlan_tx_tag_present(skb)) { 2578 - return harmonize_features(skb, features); 2573 + /* If encapsulation offload request, verify we are testing 2574 + * hardware encapsulation features instead of standard 2575 + * features for the netdev 2576 + */ 2577 + if (skb->encapsulation) 2578 + features &= dev->hw_enc_features; 2579 + 2580 + if (!vlan_tx_tag_present(skb)) { 2581 + if (unlikely(protocol == htons(ETH_P_8021Q) || 2582 + protocol == htons(ETH_P_8021AD))) { 2583 + struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; 2584 + protocol = veh->h_vlan_encapsulated_proto; 2585 + } else { 2586 + goto finalize; 2587 + } 2579 2588 } 2580 2589 2581 2590 features = netdev_intersect_features(features, ··· 2601 2590 NETIF_F_GEN_CSUM | 2602 2591 NETIF_F_HW_VLAN_CTAG_TX | 2603 2592 NETIF_F_HW_VLAN_STAG_TX); 2593 + 2594 + finalize: 2595 + if (dev->netdev_ops->ndo_features_check) 2596 + features &= dev->netdev_ops->ndo_features_check(skb, dev, 2597 + features); 2604 2598 2605 2599 return harmonize_features(skb, features); 2606 2600 } ··· 2677 2661 if (unlikely(!skb)) 2678 2662 goto out_null; 2679 2663 2680 - /* If encapsulation offload request, verify we are testing 2681 - * hardware encapsulation features instead of standard 2682 - * features for the netdev 2683 - */ 2684 - if (skb->encapsulation) 2685 - features &= dev->hw_enc_features; 2686 - 2687 2664 if (netif_needs_gso(dev, skb, features)) { 2688 2665 struct sk_buff *segs; 2689 2666 2690 2667 segs = skb_gso_segment(skb, features); 2691 2668 if (IS_ERR(segs)) { 2692 - segs = NULL; 2669 + goto out_kfree_skb; 2693 2670 } else if (segs) { 2694 2671 consume_skb(skb); 2695 2672 skb = segs; ··· 4566 4557 } 4567 4558 EXPORT_SYMBOL(netif_napi_del); 4568 4559 4560 + static int napi_poll(struct napi_struct *n, struct list_head *repoll) 4561 + { 4562 + void *have; 4563 + int work, weight; 4564 + 4565 + list_del_init(&n->poll_list); 4566 + 4567 + have = netpoll_poll_lock(n); 4568 + 4569 + weight = n->weight; 4570 + 4571 + /* This NAPI_STATE_SCHED test is for avoiding a race 4572 + * with netpoll's poll_napi(). Only the entity which 4573 + * obtains the lock and sees NAPI_STATE_SCHED set will 4574 + * actually make the ->poll() call. Therefore we avoid 4575 + * accidentally calling ->poll() when NAPI is not scheduled. 4576 + */ 4577 + work = 0; 4578 + if (test_bit(NAPI_STATE_SCHED, &n->state)) { 4579 + work = n->poll(n, weight); 4580 + trace_napi_poll(n); 4581 + } 4582 + 4583 + WARN_ON_ONCE(work > weight); 4584 + 4585 + if (likely(work < weight)) 4586 + goto out_unlock; 4587 + 4588 + /* Drivers must not modify the NAPI state if they 4589 + * consume the entire weight. In such cases this code 4590 + * still "owns" the NAPI instance and therefore can 4591 + * move the instance around on the list at-will. 4592 + */ 4593 + if (unlikely(napi_disable_pending(n))) { 4594 + napi_complete(n); 4595 + goto out_unlock; 4596 + } 4597 + 4598 + if (n->gro_list) { 4599 + /* flush too old packets 4600 + * If HZ < 1000, flush all packets. 4601 + */ 4602 + napi_gro_flush(n, HZ >= 1000); 4603 + } 4604 + 4605 + /* Some drivers may have called napi_schedule 4606 + * prior to exhausting their budget. 4607 + */ 4608 + if (unlikely(!list_empty(&n->poll_list))) { 4609 + pr_warn_once("%s: Budget exhausted after napi rescheduled\n", 4610 + n->dev ? n->dev->name : "backlog"); 4611 + goto out_unlock; 4612 + } 4613 + 4614 + list_add_tail(&n->poll_list, repoll); 4615 + 4616 + out_unlock: 4617 + netpoll_poll_unlock(have); 4618 + 4619 + return work; 4620 + } 4621 + 4569 4622 static void net_rx_action(struct softirq_action *h) 4570 4623 { 4571 4624 struct softnet_data *sd = this_cpu_ptr(&softnet_data); ··· 4635 4564 int budget = netdev_budget; 4636 4565 LIST_HEAD(list); 4637 4566 LIST_HEAD(repoll); 4638 - void *have; 4639 4567 4640 4568 local_irq_disable(); 4641 4569 list_splice_init(&sd->poll_list, &list); 4642 4570 local_irq_enable(); 4643 4571 4644 - while (!list_empty(&list)) { 4572 + for (;;) { 4645 4573 struct napi_struct *n; 4646 - int work, weight; 4574 + 4575 + if (list_empty(&list)) { 4576 + if (!sd_has_rps_ipi_waiting(sd) && list_empty(&repoll)) 4577 + return; 4578 + break; 4579 + } 4580 + 4581 + n = list_first_entry(&list, struct napi_struct, poll_list); 4582 + budget -= napi_poll(n, &repoll); 4647 4583 4648 4584 /* If softirq window is exhausted then punt. 4649 4585 * Allow this to run for 2 jiffies since which will allow 4650 4586 * an average latency of 1.5/HZ. 4651 4587 */ 4652 - if (unlikely(budget <= 0 || time_after_eq(jiffies, time_limit))) 4653 - goto softnet_break; 4654 - 4655 - 4656 - n = list_first_entry(&list, struct napi_struct, poll_list); 4657 - list_del_init(&n->poll_list); 4658 - 4659 - have = netpoll_poll_lock(n); 4660 - 4661 - weight = n->weight; 4662 - 4663 - /* This NAPI_STATE_SCHED test is for avoiding a race 4664 - * with netpoll's poll_napi(). Only the entity which 4665 - * obtains the lock and sees NAPI_STATE_SCHED set will 4666 - * actually make the ->poll() call. Therefore we avoid 4667 - * accidentally calling ->poll() when NAPI is not scheduled. 4668 - */ 4669 - work = 0; 4670 - if (test_bit(NAPI_STATE_SCHED, &n->state)) { 4671 - work = n->poll(n, weight); 4672 - trace_napi_poll(n); 4588 + if (unlikely(budget <= 0 || 4589 + time_after_eq(jiffies, time_limit))) { 4590 + sd->time_squeeze++; 4591 + break; 4673 4592 } 4674 - 4675 - WARN_ON_ONCE(work > weight); 4676 - 4677 - budget -= work; 4678 - 4679 - /* Drivers must not modify the NAPI state if they 4680 - * consume the entire weight. In such cases this code 4681 - * still "owns" the NAPI instance and therefore can 4682 - * move the instance around on the list at-will. 4683 - */ 4684 - if (unlikely(work == weight)) { 4685 - if (unlikely(napi_disable_pending(n))) { 4686 - napi_complete(n); 4687 - } else { 4688 - if (n->gro_list) { 4689 - /* flush too old packets 4690 - * If HZ < 1000, flush all packets. 4691 - */ 4692 - napi_gro_flush(n, HZ >= 1000); 4693 - } 4694 - list_add_tail(&n->poll_list, &repoll); 4695 - } 4696 - } 4697 - 4698 - netpoll_poll_unlock(have); 4699 4593 } 4700 4594 4701 - if (!sd_has_rps_ipi_waiting(sd) && 4702 - list_empty(&list) && 4703 - list_empty(&repoll)) 4704 - return; 4705 - out: 4706 4595 local_irq_disable(); 4707 4596 4708 4597 list_splice_tail_init(&sd->poll_list, &list); ··· 4672 4641 __raise_softirq_irqoff(NET_RX_SOFTIRQ); 4673 4642 4674 4643 net_rps_action_and_irq_enable(sd); 4675 - 4676 - return; 4677 - 4678 - softnet_break: 4679 - sd->time_squeeze++; 4680 - goto out; 4681 4644 } 4682 4645 4683 4646 struct netdev_adjacent {
+1
net/core/skbuff.c
··· 4148 4148 skb->ignore_df = 0; 4149 4149 skb_dst_drop(skb); 4150 4150 skb->mark = 0; 4151 + skb_init_secmark(skb); 4151 4152 secpath_reset(skb); 4152 4153 nf_reset(skb); 4153 4154 nf_reset_trace(skb);
+5 -1
net/ipv4/geneve.c
··· 122 122 int err; 123 123 124 124 skb = udp_tunnel_handle_offloads(skb, !gs->sock->sk->sk_no_check_tx); 125 + if (IS_ERR(skb)) 126 + return PTR_ERR(skb); 125 127 126 128 min_headroom = LL_RESERVED_SPACE(rt->dst.dev) + rt->dst.header_len 127 129 + GENEVE_BASE_HLEN + opt_len + sizeof(struct iphdr) 128 130 + (vlan_tx_tag_present(skb) ? VLAN_HLEN : 0); 129 131 130 132 err = skb_cow_head(skb, min_headroom); 131 - if (unlikely(err)) 133 + if (unlikely(err)) { 134 + kfree_skb(skb); 132 135 return err; 136 + } 133 137 134 138 skb = vlan_hwaccel_push_inside(skb); 135 139 if (unlikely(!skb))
+29 -16
net/ipv6/tcp_ipv6.c
··· 1387 1387 return 0; 1388 1388 } 1389 1389 1390 + static void tcp_v6_fill_cb(struct sk_buff *skb, const struct ipv6hdr *hdr, 1391 + const struct tcphdr *th) 1392 + { 1393 + /* This is tricky: we move IP6CB at its correct location into 1394 + * TCP_SKB_CB(). It must be done after xfrm6_policy_check(), because 1395 + * _decode_session6() uses IP6CB(). 1396 + * barrier() makes sure compiler won't play aliasing games. 1397 + */ 1398 + memmove(&TCP_SKB_CB(skb)->header.h6, IP6CB(skb), 1399 + sizeof(struct inet6_skb_parm)); 1400 + barrier(); 1401 + 1402 + TCP_SKB_CB(skb)->seq = ntohl(th->seq); 1403 + TCP_SKB_CB(skb)->end_seq = (TCP_SKB_CB(skb)->seq + th->syn + th->fin + 1404 + skb->len - th->doff*4); 1405 + TCP_SKB_CB(skb)->ack_seq = ntohl(th->ack_seq); 1406 + TCP_SKB_CB(skb)->tcp_flags = tcp_flag_byte(th); 1407 + TCP_SKB_CB(skb)->tcp_tw_isn = 0; 1408 + TCP_SKB_CB(skb)->ip_dsfield = ipv6_get_dsfield(hdr); 1409 + TCP_SKB_CB(skb)->sacked = 0; 1410 + } 1411 + 1390 1412 static int tcp_v6_rcv(struct sk_buff *skb) 1391 1413 { 1392 1414 const struct tcphdr *th; ··· 1440 1418 1441 1419 th = tcp_hdr(skb); 1442 1420 hdr = ipv6_hdr(skb); 1443 - /* This is tricky : We move IPCB at its correct location into TCP_SKB_CB() 1444 - * barrier() makes sure compiler wont play fool^Waliasing games. 1445 - */ 1446 - memmove(&TCP_SKB_CB(skb)->header.h6, IP6CB(skb), 1447 - sizeof(struct inet6_skb_parm)); 1448 - barrier(); 1449 - 1450 - TCP_SKB_CB(skb)->seq = ntohl(th->seq); 1451 - TCP_SKB_CB(skb)->end_seq = (TCP_SKB_CB(skb)->seq + th->syn + th->fin + 1452 - skb->len - th->doff*4); 1453 - TCP_SKB_CB(skb)->ack_seq = ntohl(th->ack_seq); 1454 - TCP_SKB_CB(skb)->tcp_flags = tcp_flag_byte(th); 1455 - TCP_SKB_CB(skb)->tcp_tw_isn = 0; 1456 - TCP_SKB_CB(skb)->ip_dsfield = ipv6_get_dsfield(hdr); 1457 - TCP_SKB_CB(skb)->sacked = 0; 1458 1421 1459 1422 sk = __inet6_lookup_skb(&tcp_hashinfo, skb, th->source, th->dest, 1460 - tcp_v6_iif(skb)); 1423 + inet6_iif(skb)); 1461 1424 if (!sk) 1462 1425 goto no_tcp_socket; 1463 1426 ··· 1457 1450 1458 1451 if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb)) 1459 1452 goto discard_and_relse; 1453 + 1454 + tcp_v6_fill_cb(skb, hdr, th); 1460 1455 1461 1456 #ifdef CONFIG_TCP_MD5SIG 1462 1457 if (tcp_v6_inbound_md5_hash(sk, skb)) ··· 1491 1482 if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) 1492 1483 goto discard_it; 1493 1484 1485 + tcp_v6_fill_cb(skb, hdr, th); 1486 + 1494 1487 if (skb->len < (th->doff<<2) || tcp_checksum_complete(skb)) { 1495 1488 csum_error: 1496 1489 TCP_INC_STATS_BH(net, TCP_MIB_CSUMERRORS); ··· 1515 1504 inet_twsk_put(inet_twsk(sk)); 1516 1505 goto discard_it; 1517 1506 } 1507 + 1508 + tcp_v6_fill_cb(skb, hdr, th); 1518 1509 1519 1510 if (skb->len < (th->doff<<2)) { 1520 1511 inet_twsk_put(inet_twsk(sk));
+1 -4
net/mpls/mpls_gso.c
··· 31 31 SKB_GSO_TCPV6 | 32 32 SKB_GSO_UDP | 33 33 SKB_GSO_DODGY | 34 - SKB_GSO_TCP_ECN | 35 - SKB_GSO_GRE | 36 - SKB_GSO_GRE_CSUM | 37 - SKB_GSO_IPIP))) 34 + SKB_GSO_TCP_ECN))) 38 35 goto out; 39 36 40 37 /* Setup inner SKB. */
+1 -1
net/netfilter/nfnetlink.c
··· 463 463 } 464 464 465 465 #ifdef CONFIG_MODULES 466 - static int nfnetlink_bind(int group) 466 + static int nfnetlink_bind(struct net *net, int group) 467 467 { 468 468 const struct nfnetlink_subsystem *ss; 469 469 int type;
+23 -15
net/netlink/af_netlink.c
··· 1091 1091 mutex_unlock(&nl_sk_hash_lock); 1092 1092 1093 1093 netlink_table_grab(); 1094 - if (nlk_sk(sk)->subscriptions) 1094 + if (nlk_sk(sk)->subscriptions) { 1095 1095 __sk_del_bind_node(sk); 1096 + netlink_update_listeners(sk); 1097 + } 1096 1098 netlink_table_ungrab(); 1097 1099 } 1098 1100 ··· 1141 1139 struct module *module = NULL; 1142 1140 struct mutex *cb_mutex; 1143 1141 struct netlink_sock *nlk; 1144 - int (*bind)(int group); 1145 - void (*unbind)(int group); 1142 + int (*bind)(struct net *net, int group); 1143 + void (*unbind)(struct net *net, int group); 1146 1144 int err = 0; 1147 1145 1148 1146 sock->state = SS_UNCONNECTED; ··· 1228 1226 1229 1227 module_put(nlk->module); 1230 1228 1231 - netlink_table_grab(); 1232 1229 if (netlink_is_kernel(sk)) { 1230 + netlink_table_grab(); 1233 1231 BUG_ON(nl_table[sk->sk_protocol].registered == 0); 1234 1232 if (--nl_table[sk->sk_protocol].registered == 0) { 1235 1233 struct listeners *old; ··· 1243 1241 nl_table[sk->sk_protocol].flags = 0; 1244 1242 nl_table[sk->sk_protocol].registered = 0; 1245 1243 } 1246 - } else if (nlk->subscriptions) { 1247 - netlink_update_listeners(sk); 1244 + netlink_table_ungrab(); 1248 1245 } 1249 - netlink_table_ungrab(); 1250 1246 1247 + if (nlk->netlink_unbind) { 1248 + int i; 1249 + 1250 + for (i = 0; i < nlk->ngroups; i++) 1251 + if (test_bit(i, nlk->groups)) 1252 + nlk->netlink_unbind(sock_net(sk), i + 1); 1253 + } 1251 1254 kfree(nlk->groups); 1252 1255 nlk->groups = NULL; 1253 1256 ··· 1417 1410 return err; 1418 1411 } 1419 1412 1420 - static void netlink_unbind(int group, long unsigned int groups, 1421 - struct netlink_sock *nlk) 1413 + static void netlink_undo_bind(int group, long unsigned int groups, 1414 + struct sock *sk) 1422 1415 { 1416 + struct netlink_sock *nlk = nlk_sk(sk); 1423 1417 int undo; 1424 1418 1425 1419 if (!nlk->netlink_unbind) ··· 1428 1420 1429 1421 for (undo = 0; undo < group; undo++) 1430 1422 if (test_bit(undo, &groups)) 1431 - nlk->netlink_unbind(undo); 1423 + nlk->netlink_unbind(sock_net(sk), undo); 1432 1424 } 1433 1425 1434 1426 static int netlink_bind(struct socket *sock, struct sockaddr *addr, ··· 1466 1458 for (group = 0; group < nlk->ngroups; group++) { 1467 1459 if (!test_bit(group, &groups)) 1468 1460 continue; 1469 - err = nlk->netlink_bind(group); 1461 + err = nlk->netlink_bind(net, group); 1470 1462 if (!err) 1471 1463 continue; 1472 - netlink_unbind(group, groups, nlk); 1464 + netlink_undo_bind(group, groups, sk); 1473 1465 return err; 1474 1466 } 1475 1467 } ··· 1479 1471 netlink_insert(sk, net, nladdr->nl_pid) : 1480 1472 netlink_autobind(sock); 1481 1473 if (err) { 1482 - netlink_unbind(nlk->ngroups, groups, nlk); 1474 + netlink_undo_bind(nlk->ngroups, groups, sk); 1483 1475 return err; 1484 1476 } 1485 1477 } ··· 2130 2122 if (!val || val - 1 >= nlk->ngroups) 2131 2123 return -EINVAL; 2132 2124 if (optname == NETLINK_ADD_MEMBERSHIP && nlk->netlink_bind) { 2133 - err = nlk->netlink_bind(val); 2125 + err = nlk->netlink_bind(sock_net(sk), val); 2134 2126 if (err) 2135 2127 return err; 2136 2128 } ··· 2139 2131 optname == NETLINK_ADD_MEMBERSHIP); 2140 2132 netlink_table_ungrab(); 2141 2133 if (optname == NETLINK_DROP_MEMBERSHIP && nlk->netlink_unbind) 2142 - nlk->netlink_unbind(val); 2134 + nlk->netlink_unbind(sock_net(sk), val); 2143 2135 2144 2136 err = 0; 2145 2137 break;
+4 -4
net/netlink/af_netlink.h
··· 39 39 struct mutex *cb_mutex; 40 40 struct mutex cb_def_mutex; 41 41 void (*netlink_rcv)(struct sk_buff *skb); 42 - int (*netlink_bind)(int group); 43 - void (*netlink_unbind)(int group); 42 + int (*netlink_bind)(struct net *net, int group); 43 + void (*netlink_unbind)(struct net *net, int group); 44 44 struct module *module; 45 45 #ifdef CONFIG_NETLINK_MMAP 46 46 struct mutex pg_vec_lock; ··· 65 65 unsigned int groups; 66 66 struct mutex *cb_mutex; 67 67 struct module *module; 68 - int (*bind)(int group); 69 - void (*unbind)(int group); 68 + int (*bind)(struct net *net, int group); 69 + void (*unbind)(struct net *net, int group); 70 70 bool (*compare)(struct net *net, struct sock *sock); 71 71 int registered; 72 72 };
+56
net/netlink/genetlink.c
··· 983 983 { .name = "notify", }, 984 984 }; 985 985 986 + static int genl_bind(struct net *net, int group) 987 + { 988 + int i, err = 0; 989 + 990 + down_read(&cb_lock); 991 + for (i = 0; i < GENL_FAM_TAB_SIZE; i++) { 992 + struct genl_family *f; 993 + 994 + list_for_each_entry(f, genl_family_chain(i), family_list) { 995 + if (group >= f->mcgrp_offset && 996 + group < f->mcgrp_offset + f->n_mcgrps) { 997 + int fam_grp = group - f->mcgrp_offset; 998 + 999 + if (!f->netnsok && net != &init_net) 1000 + err = -ENOENT; 1001 + else if (f->mcast_bind) 1002 + err = f->mcast_bind(net, fam_grp); 1003 + else 1004 + err = 0; 1005 + break; 1006 + } 1007 + } 1008 + } 1009 + up_read(&cb_lock); 1010 + 1011 + return err; 1012 + } 1013 + 1014 + static void genl_unbind(struct net *net, int group) 1015 + { 1016 + int i; 1017 + bool found = false; 1018 + 1019 + down_read(&cb_lock); 1020 + for (i = 0; i < GENL_FAM_TAB_SIZE; i++) { 1021 + struct genl_family *f; 1022 + 1023 + list_for_each_entry(f, genl_family_chain(i), family_list) { 1024 + if (group >= f->mcgrp_offset && 1025 + group < f->mcgrp_offset + f->n_mcgrps) { 1026 + int fam_grp = group - f->mcgrp_offset; 1027 + 1028 + if (f->mcast_unbind) 1029 + f->mcast_unbind(net, fam_grp); 1030 + found = true; 1031 + break; 1032 + } 1033 + } 1034 + } 1035 + up_read(&cb_lock); 1036 + 1037 + WARN_ON(!found); 1038 + } 1039 + 986 1040 static int __net_init genl_pernet_init(struct net *net) 987 1041 { 988 1042 struct netlink_kernel_cfg cfg = { 989 1043 .input = genl_rcv, 990 1044 .flags = NL_CFG_F_NONROOT_RECV, 1045 + .bind = genl_bind, 1046 + .unbind = genl_unbind, 991 1047 }; 992 1048 993 1049 /* we'll bump the group number right afterwards */
+2 -1
net/openvswitch/actions.c
··· 147 147 hdr = eth_hdr(skb); 148 148 hdr->h_proto = mpls->mpls_ethertype; 149 149 150 - skb_set_inner_protocol(skb, skb->protocol); 150 + if (!skb->inner_protocol) 151 + skb_set_inner_protocol(skb, skb->protocol); 151 152 skb->protocol = mpls->mpls_ethertype; 152 153 153 154 invalidate_flow_key(key);
+1 -2
net/openvswitch/datapath.c
··· 83 83 unsigned int group) 84 84 { 85 85 return info->nlhdr->nlmsg_flags & NLM_F_ECHO || 86 - genl_has_listeners(family, genl_info_net(info)->genl_sock, 87 - group); 86 + genl_has_listeners(family, genl_info_net(info), group); 88 87 } 89 88 90 89 static void ovs_notify(struct genl_family *family,
+1 -12
net/openvswitch/flow_netlink.c
··· 1753 1753 __be16 eth_type, __be16 vlan_tci, bool log) 1754 1754 { 1755 1755 const struct nlattr *a; 1756 - bool out_tnl_port = false; 1757 1756 int rem, err; 1758 1757 1759 1758 if (depth >= SAMPLE_ACTION_DEPTH) ··· 1795 1796 case OVS_ACTION_ATTR_OUTPUT: 1796 1797 if (nla_get_u32(a) >= DP_MAX_PORTS) 1797 1798 return -EINVAL; 1798 - out_tnl_port = false; 1799 - 1800 1799 break; 1801 1800 1802 1801 case OVS_ACTION_ATTR_HASH: { ··· 1828 1831 1829 1832 case OVS_ACTION_ATTR_PUSH_MPLS: { 1830 1833 const struct ovs_action_push_mpls *mpls = nla_data(a); 1831 - 1832 - /* Networking stack do not allow simultaneous Tunnel 1833 - * and MPLS GSO. 1834 - */ 1835 - if (out_tnl_port) 1836 - return -EINVAL; 1837 1834 1838 1835 if (!eth_p_mpls(mpls->mpls_ethertype)) 1839 1836 return -EINVAL; ··· 1864 1873 1865 1874 case OVS_ACTION_ATTR_SET: 1866 1875 err = validate_set(a, key, sfa, 1867 - &out_tnl_port, eth_type, log); 1876 + &skip_copy, eth_type, log); 1868 1877 if (err) 1869 1878 return err; 1870 - 1871 - skip_copy = out_tnl_port; 1872 1879 break; 1873 1880 1874 1881 case OVS_ACTION_ATTR_SAMPLE:
+3
net/openvswitch/vport-geneve.c
··· 219 219 false); 220 220 if (err < 0) 221 221 ip_rt_put(rt); 222 + return err; 223 + 222 224 error: 225 + kfree_skb(skb); 223 226 return err; 224 227 } 225 228
+11 -7
net/openvswitch/vport-gre.c
··· 73 73 74 74 skb = gre_handle_offloads(skb, !!(tun_key->tun_flags & TUNNEL_CSUM)); 75 75 if (IS_ERR(skb)) 76 - return NULL; 76 + return skb; 77 77 78 78 tpi.flags = filter_tnl_flags(tun_key->tun_flags); 79 79 tpi.proto = htons(ETH_P_TEB); ··· 144 144 145 145 if (unlikely(!OVS_CB(skb)->egress_tun_info)) { 146 146 err = -EINVAL; 147 - goto error; 147 + goto err_free_skb; 148 148 } 149 149 150 150 tun_key = &OVS_CB(skb)->egress_tun_info->tunnel; ··· 157 157 fl.flowi4_proto = IPPROTO_GRE; 158 158 159 159 rt = ip_route_output_key(net, &fl); 160 - if (IS_ERR(rt)) 161 - return PTR_ERR(rt); 160 + if (IS_ERR(rt)) { 161 + err = PTR_ERR(rt); 162 + goto err_free_skb; 163 + } 162 164 163 165 tunnel_hlen = ip_gre_calc_hlen(tun_key->tun_flags); 164 166 ··· 185 183 186 184 /* Push Tunnel header. */ 187 185 skb = __build_header(skb, tunnel_hlen); 188 - if (unlikely(!skb)) { 189 - err = 0; 186 + if (IS_ERR(skb)) { 187 + err = PTR_ERR(skb); 188 + skb = NULL; 190 189 goto err_free_rt; 191 190 } 192 191 ··· 201 198 tun_key->ipv4_tos, tun_key->ipv4_ttl, df, false); 202 199 err_free_rt: 203 200 ip_rt_put(rt); 204 - error: 201 + err_free_skb: 202 + kfree_skb(skb); 205 203 return err; 206 204 } 207 205
+2
net/openvswitch/vport-vxlan.c
··· 187 187 false); 188 188 if (err < 0) 189 189 ip_rt_put(rt); 190 + return err; 190 191 error: 192 + kfree_skb(skb); 191 193 return err; 192 194 } 193 195
+2 -3
net/openvswitch/vport.c
··· 519 519 u64_stats_update_end(&stats->syncp); 520 520 } else if (sent < 0) { 521 521 ovs_vport_record_error(vport, VPORT_E_TX_ERROR); 522 - kfree_skb(skb); 523 - } else 522 + } else { 524 523 ovs_vport_record_error(vport, VPORT_E_TX_DROPPED); 525 - 524 + } 526 525 return sent; 527 526 } 528 527
+7 -4
net/packet/af_packet.c
··· 785 785 786 786 struct tpacket3_hdr *last_pkt; 787 787 struct tpacket_hdr_v1 *h1 = &pbd1->hdr.bh1; 788 + struct sock *sk = &po->sk; 788 789 789 790 if (po->stats.stats3.tp_drops) 790 791 status |= TP_STATUS_LOSING; ··· 809 808 810 809 /* Flush the block */ 811 810 prb_flush_block(pkc1, pbd1, status); 811 + 812 + sk->sk_data_ready(sk); 812 813 813 814 pkc1->kactive_blk_num = GET_NEXT_PRB_BLK_NUM(pkc1); 814 815 } ··· 2055 2052 smp_wmb(); 2056 2053 #endif 2057 2054 2058 - if (po->tp_version <= TPACKET_V2) 2055 + if (po->tp_version <= TPACKET_V2) { 2059 2056 __packet_set_status(po, h.raw, status); 2060 - else 2057 + sk->sk_data_ready(sk); 2058 + } else { 2061 2059 prb_clear_blk_fill_status(&po->rx_ring); 2062 - 2063 - sk->sk_data_ready(sk); 2060 + } 2064 2061 2065 2062 drop_n_restore: 2066 2063 if (skb_head != skb->data && skb_shared(skb)) {
+1 -1
net/wireless/Kconfig
··· 175 175 Most distributions have a CRDA package. So if unsure, say N. 176 176 177 177 config CFG80211_WEXT 178 - bool 178 + bool "cfg80211 wireless extensions compatibility" 179 179 depends on CFG80211 180 180 select WEXT_CORE 181 181 help
+22 -2
sound/pci/hda/hda_controller.c
··· 1922 1922 EXPORT_SYMBOL_GPL(azx_mixer_create); 1923 1923 1924 1924 1925 + static bool is_input_stream(struct azx *chip, unsigned char index) 1926 + { 1927 + return (index >= chip->capture_index_offset && 1928 + index < chip->capture_index_offset + chip->capture_streams); 1929 + } 1930 + 1925 1931 /* initialize SD streams */ 1926 1932 int azx_init_stream(struct azx *chip) 1927 1933 { 1928 1934 int i; 1935 + int in_stream_tag = 0; 1936 + int out_stream_tag = 0; 1929 1937 1930 1938 /* initialize each stream (aka device) 1931 1939 * assign the starting bdl address to each stream (device) ··· 1946 1938 azx_dev->sd_addr = chip->remap_addr + (0x20 * i + 0x80); 1947 1939 /* int mask: SDI0=0x01, SDI1=0x02, ... SDO3=0x80 */ 1948 1940 azx_dev->sd_int_sta_mask = 1 << i; 1949 - /* stream tag: must be non-zero and unique */ 1950 1941 azx_dev->index = i; 1951 - azx_dev->stream_tag = i + 1; 1942 + 1943 + /* stream tag must be unique throughout 1944 + * the stream direction group, 1945 + * valid values 1...15 1946 + * use separate stream tag if the flag 1947 + * AZX_DCAPS_SEPARATE_STREAM_TAG is used 1948 + */ 1949 + if (chip->driver_caps & AZX_DCAPS_SEPARATE_STREAM_TAG) 1950 + azx_dev->stream_tag = 1951 + is_input_stream(chip, i) ? 1952 + ++in_stream_tag : 1953 + ++out_stream_tag; 1954 + else 1955 + azx_dev->stream_tag = i + 1; 1952 1956 } 1953 1957 1954 1958 return 0;
+4 -1
sound/pci/hda/hda_intel.c
··· 299 299 AZX_DCAPS_PM_RUNTIME | AZX_DCAPS_I915_POWERWELL |\ 300 300 AZX_DCAPS_SNOOP_TYPE(SCH)) 301 301 302 + #define AZX_DCAPS_INTEL_SKYLAKE \ 303 + (AZX_DCAPS_INTEL_PCH | AZX_DCAPS_SEPARATE_STREAM_TAG) 304 + 302 305 /* quirks for ATI SB / AMD Hudson */ 303 306 #define AZX_DCAPS_PRESET_ATI_SB \ 304 307 (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_POSFIX_LPIB |\ ··· 2030 2027 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, 2031 2028 /* Sunrise Point-LP */ 2032 2029 { PCI_DEVICE(0x8086, 0x9d70), 2033 - .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, 2030 + .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_SKYLAKE }, 2034 2031 /* Haswell */ 2035 2032 { PCI_DEVICE(0x8086, 0x0a0c), 2036 2033 .driver_data = AZX_DRIVER_HDMI | AZX_DCAPS_INTEL_HASWELL },
+1
sound/pci/hda/hda_priv.h
··· 171 171 #define AZX_DCAPS_I915_POWERWELL (1 << 27) /* HSW i915 powerwell support */ 172 172 #define AZX_DCAPS_CORBRP_SELF_CLEAR (1 << 28) /* CORBRP clears itself after reset */ 173 173 #define AZX_DCAPS_NO_MSI64 (1 << 29) /* Stick to 32-bit MSIs */ 174 + #define AZX_DCAPS_SEPARATE_STREAM_TAG (1 << 30) /* capture and playback use separate stream tag */ 174 175 175 176 enum { 176 177 AZX_SNOOP_TYPE_NONE ,
+5 -4
sound/soc/codecs/rt5677.c
··· 784 784 static int rt5677_dsp_vad_get(struct snd_kcontrol *kcontrol, 785 785 struct snd_ctl_elem_value *ucontrol) 786 786 { 787 - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 788 - struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); 787 + struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); 788 + struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); 789 789 790 790 ucontrol->value.integer.value[0] = rt5677->dsp_vad_en; 791 791 ··· 795 795 static int rt5677_dsp_vad_put(struct snd_kcontrol *kcontrol, 796 796 struct snd_ctl_elem_value *ucontrol) 797 797 { 798 - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 799 - struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); 798 + struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); 799 + struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); 800 + struct snd_soc_codec *codec = snd_soc_component_to_codec(component); 800 801 801 802 rt5677->dsp_vad_en = !!ucontrol->value.integer.value[0]; 802 803
+30 -19
sound/soc/dwc/designware_i2s.c
··· 209 209 210 210 switch (config->chan_nr) { 211 211 case EIGHT_CHANNEL_SUPPORT: 212 - ch_reg = 3; 213 - break; 214 212 case SIX_CHANNEL_SUPPORT: 215 - ch_reg = 2; 216 - break; 217 213 case FOUR_CHANNEL_SUPPORT: 218 - ch_reg = 1; 219 - break; 220 214 case TWO_CHANNEL_SUPPORT: 221 - ch_reg = 0; 222 215 break; 223 216 default: 224 217 dev_err(dev->dev, "channel not supported\n"); ··· 220 227 221 228 i2s_disable_channels(dev, substream->stream); 222 229 223 - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 224 - i2s_write_reg(dev->i2s_base, TCR(ch_reg), xfer_resolution); 225 - i2s_write_reg(dev->i2s_base, TFCR(ch_reg), 0x02); 226 - irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg)); 227 - i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x30); 228 - i2s_write_reg(dev->i2s_base, TER(ch_reg), 1); 229 - } else { 230 - i2s_write_reg(dev->i2s_base, RCR(ch_reg), xfer_resolution); 231 - i2s_write_reg(dev->i2s_base, RFCR(ch_reg), 0x07); 232 - irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg)); 233 - i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x03); 234 - i2s_write_reg(dev->i2s_base, RER(ch_reg), 1); 230 + for (ch_reg = 0; ch_reg < (config->chan_nr / 2); ch_reg++) { 231 + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 232 + i2s_write_reg(dev->i2s_base, TCR(ch_reg), 233 + xfer_resolution); 234 + i2s_write_reg(dev->i2s_base, TFCR(ch_reg), 0x02); 235 + irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg)); 236 + i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x30); 237 + i2s_write_reg(dev->i2s_base, TER(ch_reg), 1); 238 + } else { 239 + i2s_write_reg(dev->i2s_base, RCR(ch_reg), 240 + xfer_resolution); 241 + i2s_write_reg(dev->i2s_base, RFCR(ch_reg), 0x07); 242 + irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg)); 243 + i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x03); 244 + i2s_write_reg(dev->i2s_base, RER(ch_reg), 1); 245 + } 235 246 } 236 247 237 248 i2s_write_reg(dev->i2s_base, CCR, ccr); ··· 258 261 struct snd_soc_dai *dai) 259 262 { 260 263 snd_soc_dai_set_dma_data(dai, substream, NULL); 264 + } 265 + 266 + static int dw_i2s_prepare(struct snd_pcm_substream *substream, 267 + struct snd_soc_dai *dai) 268 + { 269 + struct dw_i2s_dev *dev = snd_soc_dai_get_drvdata(dai); 270 + 271 + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 272 + i2s_write_reg(dev->i2s_base, TXFFR, 1); 273 + else 274 + i2s_write_reg(dev->i2s_base, RXFFR, 1); 275 + 276 + return 0; 261 277 } 262 278 263 279 static int dw_i2s_trigger(struct snd_pcm_substream *substream, ··· 304 294 .startup = dw_i2s_startup, 305 295 .shutdown = dw_i2s_shutdown, 306 296 .hw_params = dw_i2s_hw_params, 297 + .prepare = dw_i2s_prepare, 307 298 .trigger = dw_i2s_trigger, 308 299 }; 309 300
+2 -2
sound/soc/intel/Kconfig
··· 89 89 90 90 config SND_SOC_INTEL_BYTCR_RT5640_MACH 91 91 tristate "ASoC Audio DSP Support for MID BYT Platform" 92 - depends on X86 92 + depends on X86 && I2C 93 93 select SND_SOC_RT5640 94 94 select SND_SST_MFLD_PLATFORM 95 95 select SND_SST_IPC_ACPI ··· 101 101 102 102 config SND_SOC_INTEL_CHT_BSW_RT5672_MACH 103 103 tristate "ASoC Audio driver for Intel Cherrytrail & Braswell with RT5672 codec" 104 - depends on X86_INTEL_LPSS 104 + depends on X86_INTEL_LPSS && I2C 105 105 select SND_SOC_RT5670 106 106 select SND_SST_MFLD_PLATFORM 107 107 select SND_SST_IPC_ACPI
+1 -1
sound/soc/intel/bytcr_dpcm_rt5640.c
··· 227 227 MODULE_DESCRIPTION("ASoC Intel(R) Baytrail CR Machine driver"); 228 228 MODULE_AUTHOR("Subhransu S. Prusty <subhransu.s.prusty@intel.com>"); 229 229 MODULE_LICENSE("GPL v2"); 230 - MODULE_ALIAS("platform:bytrt5640-audio"); 230 + MODULE_ALIAS("platform:bytt100_rt5640");
+5 -1
sound/soc/intel/sst-firmware.c
··· 763 763 /* does block span more than 1 section */ 764 764 if (ba->offset >= block->offset && ba->offset < block_end) { 765 765 766 + /* add block */ 767 + list_move(&block->list, &dsp->used_block_list); 768 + list_add(&block->module_list, block_list); 766 769 /* align ba to block boundary */ 767 - ba->offset = block->offset; 770 + ba->size -= block_end - ba->offset; 771 + ba->offset = block_end; 768 772 769 773 err = block_alloc_contiguous(dsp, ba, block_list); 770 774 if (err < 0)
+1 -1
sound/soc/intel/sst/sst_acpi.c
··· 343 343 } 344 344 345 345 static struct sst_machines sst_acpi_bytcr[] = { 346 - {"10EC5640", "T100", "bytt100_rt5640", NULL, "fw_sst_0f28.bin", 346 + {"10EC5640", "T100", "bytt100_rt5640", NULL, "intel/fw_sst_0f28.bin", 347 347 &byt_rvp_platform_data }, 348 348 {}, 349 349 };
+2 -2
sound/soc/rockchip/rockchip_i2s.c
··· 454 454 455 455 i2s->playback_dma_data.addr = res->start + I2S_TXDR; 456 456 i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; 457 - i2s->playback_dma_data.maxburst = 16; 457 + i2s->playback_dma_data.maxburst = 4; 458 458 459 459 i2s->capture_dma_data.addr = res->start + I2S_RXDR; 460 460 i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; 461 - i2s->capture_dma_data.maxburst = 16; 461 + i2s->capture_dma_data.maxburst = 4; 462 462 463 463 i2s->dev = &pdev->dev; 464 464 dev_set_drvdata(&pdev->dev, i2s);
+1 -1
sound/soc/rockchip/rockchip_i2s.h
··· 127 127 #define I2S_DMACR_TDE_DISABLE (0 << I2S_DMACR_TDE_SHIFT) 128 128 #define I2S_DMACR_TDE_ENABLE (1 << I2S_DMACR_TDE_SHIFT) 129 129 #define I2S_DMACR_TDL_SHIFT 0 130 - #define I2S_DMACR_TDL(x) ((x - 1) << I2S_DMACR_TDL_SHIFT) 130 + #define I2S_DMACR_TDL(x) ((x) << I2S_DMACR_TDL_SHIFT) 131 131 #define I2S_DMACR_TDL_MASK (0x1f << I2S_DMACR_TDL_SHIFT) 132 132 133 133 /*
+5 -9
sound/soc/soc-core.c
··· 3230 3230 const char *propname) 3231 3231 { 3232 3232 struct device_node *np = card->dev->of_node; 3233 - int num_routes, old_routes; 3233 + int num_routes; 3234 3234 struct snd_soc_dapm_route *routes; 3235 3235 int i, ret; 3236 3236 ··· 3248 3248 return -EINVAL; 3249 3249 } 3250 3250 3251 - old_routes = card->num_dapm_routes; 3252 - routes = devm_kzalloc(card->dev, 3253 - (old_routes + num_routes) * sizeof(*routes), 3251 + routes = devm_kzalloc(card->dev, num_routes * sizeof(*routes), 3254 3252 GFP_KERNEL); 3255 3253 if (!routes) { 3256 3254 dev_err(card->dev, ··· 3256 3258 return -EINVAL; 3257 3259 } 3258 3260 3259 - memcpy(routes, card->dapm_routes, old_routes * sizeof(*routes)); 3260 - 3261 3261 for (i = 0; i < num_routes; i++) { 3262 3262 ret = of_property_read_string_index(np, propname, 3263 - 2 * i, &routes[old_routes + i].sink); 3263 + 2 * i, &routes[i].sink); 3264 3264 if (ret) { 3265 3265 dev_err(card->dev, 3266 3266 "ASoC: Property '%s' index %d could not be read: %d\n", ··· 3266 3270 return -EINVAL; 3267 3271 } 3268 3272 ret = of_property_read_string_index(np, propname, 3269 - (2 * i) + 1, &routes[old_routes + i].source); 3273 + (2 * i) + 1, &routes[i].source); 3270 3274 if (ret) { 3271 3275 dev_err(card->dev, 3272 3276 "ASoC: Property '%s' index %d could not be read: %d\n", ··· 3275 3279 } 3276 3280 } 3277 3281 3278 - card->num_dapm_routes += num_routes; 3282 + card->num_dapm_routes = num_routes; 3279 3283 card->dapm_routes = routes; 3280 3284 3281 3285 return 0;
+1 -1
tools/power/cpupower/utils/cpupower.c
··· 199 199 } 200 200 201 201 get_cpu_info(0, &cpupower_cpu_info); 202 - run_as_root = !getuid(); 202 + run_as_root = !geteuid(); 203 203 if (run_as_root) { 204 204 ret = uname(&uts); 205 205 if (!ret && !strcmp(uts.machine, "x86_64") &&
+1 -1
tools/power/cpupower/utils/helpers/sysfs.c
··· 361 361 362 362 snprintf(file, SYSFS_PATH_MAX, PATH_TO_CPU "cpuidle"); 363 363 if (stat(file, &statbuf) != 0 || !S_ISDIR(statbuf.st_mode)) 364 - return -ENODEV; 364 + return 0; 365 365 366 366 snprintf(file, SYSFS_PATH_MAX, PATH_TO_CPU "cpu%u/cpuidle/state0", cpu); 367 367 if (stat(file, &statbuf) != 0 || !S_ISDIR(statbuf.st_mode))
+2 -2
tools/testing/selftests/exec/execveat.c
··· 179 179 */ 180 180 fd = open(longpath, O_RDONLY); 181 181 if (fd > 0) { 182 - printf("Invoke copy of '%s' via filename of length %lu:\n", 182 + printf("Invoke copy of '%s' via filename of length %zu:\n", 183 183 src, strlen(longpath)); 184 184 fail += check_execveat(fd, "", AT_EMPTY_PATH); 185 185 } else { 186 - printf("Failed to open length %lu filename, errno=%d (%s)\n", 186 + printf("Failed to open length %zu filename, errno=%d (%s)\n", 187 187 strlen(longpath), errno, strerror(errno)); 188 188 fail++; 189 189 }
+20 -6
virt/kvm/kvm_main.c
··· 671 671 672 672 WARN_ON(mslots[i].id != id); 673 673 if (!new->npages) { 674 + WARN_ON(!mslots[i].npages); 674 675 new->base_gfn = 0; 675 676 if (mslots[i].npages) 676 677 slots->used_slots--; ··· 688 687 slots->id_to_index[mslots[i].id] = i; 689 688 i++; 690 689 } 691 - while (i > 0 && 692 - new->base_gfn > mslots[i - 1].base_gfn) { 693 - mslots[i] = mslots[i - 1]; 694 - slots->id_to_index[mslots[i].id] = i; 695 - i--; 696 - } 690 + 691 + /* 692 + * The ">=" is needed when creating a slot with base_gfn == 0, 693 + * so that it moves before all those with base_gfn == npages == 0. 694 + * 695 + * On the other hand, if new->npages is zero, the above loop has 696 + * already left i pointing to the beginning of the empty part of 697 + * mslots, and the ">=" would move the hole backwards in this 698 + * case---which is wrong. So skip the loop when deleting a slot. 699 + */ 700 + if (new->npages) { 701 + while (i > 0 && 702 + new->base_gfn >= mslots[i - 1].base_gfn) { 703 + mslots[i] = mslots[i - 1]; 704 + slots->id_to_index[mslots[i].id] = i; 705 + i--; 706 + } 707 + } else 708 + WARN_ON_ONCE(i != slots->used_slots); 697 709 698 710 mslots[i] = *new; 699 711 slots->id_to_index[mslots[i].id] = i;