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

Merge tag 'v5.15-rc3' into spi-5.15

Linux 5.15-rc3

+3356 -1815
+3 -2
Documentation/core-api/irq/irq-domain.rst
··· 175 175 case the Linux IRQ numbers cannot be dynamically assigned and the legacy 176 176 mapping should be used. 177 177 178 - As the name implies, the *_legacy() functions are deprecated and only 178 + As the name implies, the \*_legacy() functions are deprecated and only 179 179 exist to ease the support of ancient platforms. No new users should be 180 - added. 180 + added. Same goes for the \*_simple() functions when their use results 181 + in the legacy behaviour. 181 182 182 183 The legacy map assumes a contiguous range of IRQ numbers has already 183 184 been allocated for the controller and that the IRQ number can be
+1 -1
Documentation/networking/device_drivers/ethernet/intel/ice.rst
··· 851 851 - 0x88A8 traffic will not be received unless VLAN stripping is disabled with 852 852 the following command:: 853 853 854 - # ethool -K <ethX> rxvlan off 854 + # ethtool -K <ethX> rxvlan off 855 855 856 856 - 0x88A8/0x8100 double VLANs cannot be used with 0x8100 or 0x8100/0x8100 VLANS 857 857 configured on the same port. 0x88a8/0x8100 traffic will not be received if
+13 -22
MAINTAINERS
··· 977 977 S: Maintained 978 978 F: drivers/platform/x86/amd-pmc.* 979 979 980 - AMD POWERPLAY 980 + AMD POWERPLAY AND SWSMU 981 981 M: Evan Quan <evan.quan@amd.com> 982 982 L: amd-gfx@lists.freedesktop.org 983 983 S: Supported 984 984 T: git https://gitlab.freedesktop.org/agd5f/linux.git 985 - F: drivers/gpu/drm/amd/pm/powerplay/ 985 + F: drivers/gpu/drm/amd/pm/ 986 986 987 987 AMD PTDMA DRIVER 988 988 M: Sanjay R Mehta <sanju.mehta@amd.com> ··· 2804 2804 F: arch/arm/mach-pxa/vpac270.c 2805 2805 2806 2806 ARM/VT8500 ARM ARCHITECTURE 2807 - M: Tony Prisk <linux@prisktech.co.nz> 2808 2807 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 2809 - S: Maintained 2808 + S: Orphan 2810 2809 F: Documentation/devicetree/bindings/i2c/i2c-wmt.txt 2811 2810 F: arch/arm/mach-vt8500/ 2812 2811 F: drivers/clocksource/timer-vt8500.c ··· 13254 13255 F: drivers/scsi/nsp32* 13255 13256 13256 13257 NIOS2 ARCHITECTURE 13257 - M: Ley Foon Tan <ley.foon.tan@intel.com> 13258 + M: Dinh Nguyen <dinguyen@kernel.org> 13258 13259 S: Maintained 13259 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/lftan/nios2.git 13260 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/dinguyen/linux.git 13260 13261 F: arch/nios2/ 13261 13262 13262 13263 NITRO ENCLAVES (NE) ··· 16650 16651 S: Supported 16651 16652 F: drivers/char/pcmcia/scr24x_cs.c 16652 16653 16653 - SCSI CDROM DRIVER 16654 - M: Jens Axboe <axboe@kernel.dk> 16655 - L: linux-scsi@vger.kernel.org 16656 - S: Maintained 16657 - W: http://www.kernel.dk 16658 - F: drivers/scsi/sr* 16659 - 16660 16654 SCSI RDMA PROTOCOL (SRP) INITIATOR 16661 16655 M: Bart Van Assche <bvanassche@acm.org> 16662 16656 L: linux-rdma@vger.kernel.org ··· 16948 16956 16949 16957 SHARED MEMORY COMMUNICATIONS (SMC) SOCKETS 16950 16958 M: Karsten Graul <kgraul@linux.ibm.com> 16951 - M: Guvenc Gulce <guvenc@linux.ibm.com> 16952 16959 L: linux-s390@vger.kernel.org 16953 16960 S: Supported 16954 16961 W: http://www.ibm.com/developerworks/linux/linux390/ ··· 17960 17969 F: arch/x86/boot/video* 17961 17970 17962 17971 SWIOTLB SUBSYSTEM 17963 - M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> 17972 + M: Christoph Hellwig <hch@infradead.org> 17964 17973 L: iommu@lists.linux-foundation.org 17965 17974 S: Supported 17966 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb.git 17975 + W: http://git.infradead.org/users/hch/dma-mapping.git 17976 + T: git git://git.infradead.org/users/hch/dma-mapping.git 17967 17977 F: arch/*/kernel/pci-swiotlb.c 17968 17978 F: include/linux/swiotlb.h 17969 17979 F: kernel/dma/swiotlb.c ··· 19281 19289 F: drivers/usb/misc/chaoskey.c 19282 19290 19283 19291 USB CYPRESS C67X00 DRIVER 19284 - M: Peter Korsgaard <jacmet@sunsite.dk> 19285 19292 L: linux-usb@vger.kernel.org 19286 - S: Maintained 19293 + S: Orphan 19287 19294 F: drivers/usb/c67x00/ 19288 19295 19289 19296 USB DAVICOM DM9601 DRIVER 19290 - M: Peter Korsgaard <jacmet@sunsite.dk> 19297 + M: Peter Korsgaard <peter@korsgaard.com> 19291 19298 L: netdev@vger.kernel.org 19292 19299 S: Maintained 19293 19300 W: http://www.linux-usb.org/usbnet ··· 20466 20475 F: tools/lib/bpf/xsk* 20467 20476 20468 20477 XEN BLOCK SUBSYSTEM 20469 - M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> 20470 20478 M: Roger Pau Monné <roger.pau@citrix.com> 20471 20479 L: xen-devel@lists.xenproject.org (moderated for non-subscribers) 20472 20480 S: Supported ··· 20513 20523 F: drivers/net/xen-netback/* 20514 20524 20515 20525 XEN PCI SUBSYSTEM 20516 - M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> 20526 + M: Juergen Gross <jgross@suse.com> 20517 20527 L: xen-devel@lists.xenproject.org (moderated for non-subscribers) 20518 20528 S: Supported 20519 20529 F: arch/x86/pci/*xen* ··· 20536 20546 F: sound/xen/* 20537 20547 20538 20548 XEN SWIOTLB SUBSYSTEM 20539 - M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> 20549 + M: Juergen Gross <jgross@suse.com> 20550 + M: Stefano Stabellini <sstabellini@kernel.org> 20540 20551 L: xen-devel@lists.xenproject.org (moderated for non-subscribers) 20541 20552 L: iommu@lists.linux-foundation.org 20542 20553 S: Supported
+1 -1
Makefile
··· 2 2 VERSION = 5 3 3 PATCHLEVEL = 15 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc2 5 + EXTRAVERSION = -rc3 6 6 NAME = Opossums on Parade 7 7 8 8 # *DOCUMENTATION*
-1
arch/arm/kernel/signal.c
··· 628 628 uprobe_notify_resume(regs); 629 629 } else { 630 630 tracehook_notify_resume(regs); 631 - rseq_handle_notify_resume(NULL, regs); 632 631 } 633 632 } 634 633 local_irq_disable();
-2
arch/arm64/boot/dts/qcom/ipq8074.dtsi
··· 487 487 interrupts = <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>; 488 488 phys = <&qusb_phy_0>, <&usb0_ssphy>; 489 489 phy-names = "usb2-phy", "usb3-phy"; 490 - tx-fifo-resize; 491 490 snps,is-utmi-l1-suspend; 492 491 snps,hird-threshold = /bits/ 8 <0x0>; 493 492 snps,dis_u2_susphy_quirk; ··· 527 528 interrupts = <GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>; 528 529 phys = <&qusb_phy_1>, <&usb1_ssphy>; 529 530 phy-names = "usb2-phy", "usb3-phy"; 530 - tx-fifo-resize; 531 531 snps,is-utmi-l1-suspend; 532 532 snps,hird-threshold = /bits/ 8 <0x0>; 533 533 snps,dis_u2_susphy_quirk;
-3
arch/arm64/include/asm/acpi.h
··· 50 50 void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size); 51 51 #define acpi_os_ioremap acpi_os_ioremap 52 52 53 - void __iomem *acpi_os_memmap(acpi_physical_address phys, acpi_size size); 54 - #define acpi_os_memmap acpi_os_memmap 55 - 56 53 typedef u64 phys_cpuid_t; 57 54 #define PHYS_CPUID_INVALID INVALID_HWID 58 55
+5
arch/arm64/include/asm/assembler.h
··· 525 525 #define EXPORT_SYMBOL_NOKASAN(name) EXPORT_SYMBOL(name) 526 526 #endif 527 527 528 + #ifdef CONFIG_KASAN_HW_TAGS 529 + #define EXPORT_SYMBOL_NOHWKASAN(name) 530 + #else 531 + #define EXPORT_SYMBOL_NOHWKASAN(name) EXPORT_SYMBOL_NOKASAN(name) 532 + #endif 528 533 /* 529 534 * Emit a 64-bit absolute little endian symbol reference in a way that 530 535 * ensures that it will be resolved at build time, even when building a
+6
arch/arm64/include/asm/mte.h
··· 99 99 100 100 static inline void mte_check_tfsr_entry(void) 101 101 { 102 + if (!system_supports_mte()) 103 + return; 104 + 102 105 mte_check_tfsr_el1(); 103 106 } 104 107 105 108 static inline void mte_check_tfsr_exit(void) 106 109 { 110 + if (!system_supports_mte()) 111 + return; 112 + 107 113 /* 108 114 * The asynchronous faults are sync'ed automatically with 109 115 * TFSR_EL1 on kernel entry but for exit an explicit dsb()
+2
arch/arm64/include/asm/string.h
··· 12 12 #define __HAVE_ARCH_STRCHR 13 13 extern char *strchr(const char *, int c); 14 14 15 + #ifndef CONFIG_KASAN_HW_TAGS 15 16 #define __HAVE_ARCH_STRCMP 16 17 extern int strcmp(const char *, const char *); 17 18 18 19 #define __HAVE_ARCH_STRNCMP 19 20 extern int strncmp(const char *, const char *, __kernel_size_t); 21 + #endif 20 22 21 23 #define __HAVE_ARCH_STRLEN 22 24 extern __kernel_size_t strlen(const char *);
+3 -16
arch/arm64/kernel/acpi.c
··· 273 273 return __pgprot(PROT_DEVICE_nGnRnE); 274 274 } 275 275 276 - static void __iomem *__acpi_os_ioremap(acpi_physical_address phys, 277 - acpi_size size, bool memory) 276 + void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size) 278 277 { 279 278 efi_memory_desc_t *md, *region = NULL; 280 279 pgprot_t prot; ··· 299 300 * It is fine for AML to remap regions that are not represented in the 300 301 * EFI memory map at all, as it only describes normal memory, and MMIO 301 302 * regions that require a virtual mapping to make them accessible to 302 - * the EFI runtime services. Determine the region default 303 - * attributes by checking the requested memory semantics. 303 + * the EFI runtime services. 304 304 */ 305 - prot = memory ? __pgprot(PROT_NORMAL_NC) : 306 - __pgprot(PROT_DEVICE_nGnRnE); 305 + prot = __pgprot(PROT_DEVICE_nGnRnE); 307 306 if (region) { 308 307 switch (region->type) { 309 308 case EFI_LOADER_CODE: ··· 359 362 } 360 363 } 361 364 return __ioremap(phys, size, prot); 362 - } 363 - 364 - void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size) 365 - { 366 - return __acpi_os_ioremap(phys, size, false); 367 - } 368 - 369 - void __iomem *acpi_os_memmap(acpi_physical_address phys, acpi_size size) 370 - { 371 - return __acpi_os_ioremap(phys, size, true); 372 365 } 373 366 374 367 /*
+6 -2
arch/arm64/kernel/cpufeature.c
··· 1526 1526 /* 1527 1527 * For reasons that aren't entirely clear, enabling KPTI on Cavium 1528 1528 * ThunderX leads to apparent I-cache corruption of kernel text, which 1529 - * ends as well as you might imagine. Don't even try. 1529 + * ends as well as you might imagine. Don't even try. We cannot rely 1530 + * on the cpus_have_*cap() helpers here to detect the CPU erratum 1531 + * because cpucap detection order may change. However, since we know 1532 + * affected CPUs are always in a homogeneous configuration, it is 1533 + * safe to rely on this_cpu_has_cap() here. 1530 1534 */ 1531 - if (cpus_have_const_cap(ARM64_WORKAROUND_CAVIUM_27456)) { 1535 + if (this_cpu_has_cap(ARM64_WORKAROUND_CAVIUM_27456)) { 1532 1536 str = "ARM64_WORKAROUND_CAVIUM_27456"; 1533 1537 __kpti_forced = -1; 1534 1538 }
+4 -6
arch/arm64/kernel/mte.c
··· 142 142 #ifdef CONFIG_KASAN_HW_TAGS 143 143 void mte_check_tfsr_el1(void) 144 144 { 145 - u64 tfsr_el1; 146 - 147 - if (!system_supports_mte()) 148 - return; 149 - 150 - tfsr_el1 = read_sysreg_s(SYS_TFSR_EL1); 145 + u64 tfsr_el1 = read_sysreg_s(SYS_TFSR_EL1); 151 146 152 147 if (unlikely(tfsr_el1 & SYS_TFSR_EL1_TF1)) { 153 148 /* ··· 194 199 195 200 void mte_thread_switch(struct task_struct *next) 196 201 { 202 + if (!system_supports_mte()) 203 + return; 204 + 197 205 mte_update_sctlr_user(next); 198 206 199 207 /*
+1 -3
arch/arm64/kernel/signal.c
··· 940 940 if (thread_flags & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL)) 941 941 do_signal(regs); 942 942 943 - if (thread_flags & _TIF_NOTIFY_RESUME) { 943 + if (thread_flags & _TIF_NOTIFY_RESUME) 944 944 tracehook_notify_resume(regs); 945 - rseq_handle_notify_resume(NULL, regs); 946 - } 947 945 948 946 if (thread_flags & _TIF_FOREIGN_FPSTATE) 949 947 fpsimd_restore_current_state();
+1 -1
arch/arm64/lib/strcmp.S
··· 173 173 ret 174 174 175 175 SYM_FUNC_END_PI(strcmp) 176 - EXPORT_SYMBOL_NOKASAN(strcmp) 176 + EXPORT_SYMBOL_NOHWKASAN(strcmp)
+1 -1
arch/arm64/lib/strncmp.S
··· 258 258 ret 259 259 260 260 SYM_FUNC_END_PI(strncmp) 261 - EXPORT_SYMBOL_NOKASAN(strncmp) 261 + EXPORT_SYMBOL_NOHWKASAN(strncmp)
+1 -3
arch/csky/kernel/signal.c
··· 260 260 if (thread_info_flags & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL)) 261 261 do_signal(regs); 262 262 263 - if (thread_info_flags & _TIF_NOTIFY_RESUME) { 263 + if (thread_info_flags & _TIF_NOTIFY_RESUME) 264 264 tracehook_notify_resume(regs); 265 - rseq_handle_notify_resume(NULL, regs); 266 - } 267 265 }
+1 -3
arch/mips/kernel/signal.c
··· 906 906 if (thread_info_flags & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL)) 907 907 do_signal(regs); 908 908 909 - if (thread_info_flags & _TIF_NOTIFY_RESUME) { 909 + if (thread_info_flags & _TIF_NOTIFY_RESUME) 910 910 tracehook_notify_resume(regs); 911 - rseq_handle_notify_resume(NULL, regs); 912 - } 913 911 914 912 user_enter(); 915 913 }
+1 -3
arch/powerpc/kernel/signal.c
··· 293 293 do_signal(current); 294 294 } 295 295 296 - if (thread_info_flags & _TIF_NOTIFY_RESUME) { 296 + if (thread_info_flags & _TIF_NOTIFY_RESUME) 297 297 tracehook_notify_resume(regs); 298 - rseq_handle_notify_resume(NULL, regs); 299 - } 300 298 } 301 299 302 300 static unsigned long get_tm_stackpointer(struct task_struct *tsk)
+1 -1
arch/s390/include/asm/ccwgroup.h
··· 55 55 int num_devices, const char *buf); 56 56 57 57 extern int ccwgroup_set_online(struct ccwgroup_device *gdev); 58 - extern int ccwgroup_set_offline(struct ccwgroup_device *gdev); 58 + int ccwgroup_set_offline(struct ccwgroup_device *gdev, bool call_gdrv); 59 59 60 60 extern int ccwgroup_probe_ccwdev(struct ccw_device *cdev); 61 61 extern void ccwgroup_remove_ccwdev(struct ccw_device *cdev);
+38 -32
arch/s390/net/bpf_jit_comp.c
··· 248 248 249 249 #define EMIT6_PCREL(op1, op2, b1, b2, i, off, mask) \ 250 250 ({ \ 251 - /* Branch instruction needs 6 bytes */ \ 252 - int rel = (addrs[(i) + (off) + 1] - (addrs[(i) + 1] - 6)) / 2;\ 251 + int rel = (addrs[(i) + (off) + 1] - jit->prg) / 2; \ 253 252 _EMIT6((op1) | reg(b1, b2) << 16 | (rel & 0xffff), (op2) | (mask));\ 254 253 REG_SET_SEEN(b1); \ 255 254 REG_SET_SEEN(b2); \ ··· 760 761 EMIT4(0xb9080000, dst_reg, src_reg); 761 762 break; 762 763 case BPF_ALU | BPF_ADD | BPF_K: /* dst = (u32) dst + (u32) imm */ 763 - if (!imm) 764 - break; 765 - /* alfi %dst,imm */ 766 - EMIT6_IMM(0xc20b0000, dst_reg, imm); 764 + if (imm != 0) { 765 + /* alfi %dst,imm */ 766 + EMIT6_IMM(0xc20b0000, dst_reg, imm); 767 + } 767 768 EMIT_ZERO(dst_reg); 768 769 break; 769 770 case BPF_ALU64 | BPF_ADD | BPF_K: /* dst = dst + imm */ ··· 785 786 EMIT4(0xb9090000, dst_reg, src_reg); 786 787 break; 787 788 case BPF_ALU | BPF_SUB | BPF_K: /* dst = (u32) dst - (u32) imm */ 788 - if (!imm) 789 - break; 790 - /* alfi %dst,-imm */ 791 - EMIT6_IMM(0xc20b0000, dst_reg, -imm); 789 + if (imm != 0) { 790 + /* alfi %dst,-imm */ 791 + EMIT6_IMM(0xc20b0000, dst_reg, -imm); 792 + } 792 793 EMIT_ZERO(dst_reg); 793 794 break; 794 795 case BPF_ALU64 | BPF_SUB | BPF_K: /* dst = dst - imm */ 795 796 if (!imm) 796 797 break; 797 - /* agfi %dst,-imm */ 798 - EMIT6_IMM(0xc2080000, dst_reg, -imm); 798 + if (imm == -0x80000000) { 799 + /* algfi %dst,0x80000000 */ 800 + EMIT6_IMM(0xc20a0000, dst_reg, 0x80000000); 801 + } else { 802 + /* agfi %dst,-imm */ 803 + EMIT6_IMM(0xc2080000, dst_reg, -imm); 804 + } 799 805 break; 800 806 /* 801 807 * BPF_MUL ··· 815 811 EMIT4(0xb90c0000, dst_reg, src_reg); 816 812 break; 817 813 case BPF_ALU | BPF_MUL | BPF_K: /* dst = (u32) dst * (u32) imm */ 818 - if (imm == 1) 819 - break; 820 - /* msfi %r5,imm */ 821 - EMIT6_IMM(0xc2010000, dst_reg, imm); 814 + if (imm != 1) { 815 + /* msfi %r5,imm */ 816 + EMIT6_IMM(0xc2010000, dst_reg, imm); 817 + } 822 818 EMIT_ZERO(dst_reg); 823 819 break; 824 820 case BPF_ALU64 | BPF_MUL | BPF_K: /* dst = dst * imm */ ··· 871 867 if (BPF_OP(insn->code) == BPF_MOD) 872 868 /* lhgi %dst,0 */ 873 869 EMIT4_IMM(0xa7090000, dst_reg, 0); 870 + else 871 + EMIT_ZERO(dst_reg); 874 872 break; 875 873 } 876 874 /* lhi %w0,0 */ ··· 1005 999 EMIT4(0xb9820000, dst_reg, src_reg); 1006 1000 break; 1007 1001 case BPF_ALU | BPF_XOR | BPF_K: /* dst = (u32) dst ^ (u32) imm */ 1008 - if (!imm) 1009 - break; 1010 - /* xilf %dst,imm */ 1011 - EMIT6_IMM(0xc0070000, dst_reg, imm); 1002 + if (imm != 0) { 1003 + /* xilf %dst,imm */ 1004 + EMIT6_IMM(0xc0070000, dst_reg, imm); 1005 + } 1012 1006 EMIT_ZERO(dst_reg); 1013 1007 break; 1014 1008 case BPF_ALU64 | BPF_XOR | BPF_K: /* dst = dst ^ imm */ ··· 1039 1033 EMIT6_DISP_LH(0xeb000000, 0x000d, dst_reg, dst_reg, src_reg, 0); 1040 1034 break; 1041 1035 case BPF_ALU | BPF_LSH | BPF_K: /* dst = (u32) dst << (u32) imm */ 1042 - if (imm == 0) 1043 - break; 1044 - /* sll %dst,imm(%r0) */ 1045 - EMIT4_DISP(0x89000000, dst_reg, REG_0, imm); 1036 + if (imm != 0) { 1037 + /* sll %dst,imm(%r0) */ 1038 + EMIT4_DISP(0x89000000, dst_reg, REG_0, imm); 1039 + } 1046 1040 EMIT_ZERO(dst_reg); 1047 1041 break; 1048 1042 case BPF_ALU64 | BPF_LSH | BPF_K: /* dst = dst << imm */ ··· 1064 1058 EMIT6_DISP_LH(0xeb000000, 0x000c, dst_reg, dst_reg, src_reg, 0); 1065 1059 break; 1066 1060 case BPF_ALU | BPF_RSH | BPF_K: /* dst = (u32) dst >> (u32) imm */ 1067 - if (imm == 0) 1068 - break; 1069 - /* srl %dst,imm(%r0) */ 1070 - EMIT4_DISP(0x88000000, dst_reg, REG_0, imm); 1061 + if (imm != 0) { 1062 + /* srl %dst,imm(%r0) */ 1063 + EMIT4_DISP(0x88000000, dst_reg, REG_0, imm); 1064 + } 1071 1065 EMIT_ZERO(dst_reg); 1072 1066 break; 1073 1067 case BPF_ALU64 | BPF_RSH | BPF_K: /* dst = dst >> imm */ ··· 1089 1083 EMIT6_DISP_LH(0xeb000000, 0x000a, dst_reg, dst_reg, src_reg, 0); 1090 1084 break; 1091 1085 case BPF_ALU | BPF_ARSH | BPF_K: /* ((s32) dst >> imm */ 1092 - if (imm == 0) 1093 - break; 1094 - /* sra %dst,imm(%r0) */ 1095 - EMIT4_DISP(0x8a000000, dst_reg, REG_0, imm); 1086 + if (imm != 0) { 1087 + /* sra %dst,imm(%r0) */ 1088 + EMIT4_DISP(0x8a000000, dst_reg, REG_0, imm); 1089 + } 1096 1090 EMIT_ZERO(dst_reg); 1097 1091 break; 1098 1092 case BPF_ALU64 | BPF_ARSH | BPF_K: /* ((s64) dst) >>= imm */
+1 -1
arch/sh/include/asm/pgtable-3level.h
··· 34 34 35 35 static inline pmd_t *pud_pgtable(pud_t pud) 36 36 { 37 - return (pmd_t *)pud_val(pud); 37 + return (pmd_t *)(unsigned long)pud_val(pud); 38 38 } 39 39 40 40 /* only used by the stubbed out hugetlb gup code, should never be called */
+2
arch/sparc/lib/iomap.c
··· 19 19 EXPORT_SYMBOL(ioport_map); 20 20 EXPORT_SYMBOL(ioport_unmap); 21 21 22 + #ifdef CONFIG_PCI 22 23 void pci_iounmap(struct pci_dev *dev, void __iomem * addr) 23 24 { 24 25 /* nothing to do */ 25 26 } 26 27 EXPORT_SYMBOL(pci_iounmap); 28 + #endif
-1
arch/x86/Kconfig
··· 2610 2610 config PCI_XEN 2611 2611 def_bool y 2612 2612 depends on PCI && XEN 2613 - select SWIOTLB_XEN 2614 2613 2615 2614 config MMCONF_FAM10H 2616 2615 def_bool y
-2
arch/x86/include/asm/pkeys.h
··· 2 2 #ifndef _ASM_X86_PKEYS_H 3 3 #define _ASM_X86_PKEYS_H 4 4 5 - #define ARCH_DEFAULT_PKEY 0 6 - 7 5 /* 8 6 * If more than 16 keys are ever supported, a thorough audit 9 7 * will be necessary to ensure that the types that store key
+1 -1
arch/x86/include/asm/special_insns.h
··· 275 275 { 276 276 const struct { char _[64]; } *__src = src; 277 277 struct { char _[64]; } __iomem *__dst = dst; 278 - int zf; 278 + bool zf; 279 279 280 280 /* 281 281 * ENQCMDS %(rdx), rax
+1 -5
arch/x86/include/asm/xen/swiotlb-xen.h
··· 3 3 #define _ASM_X86_SWIOTLB_XEN_H 4 4 5 5 #ifdef CONFIG_SWIOTLB_XEN 6 - extern int xen_swiotlb; 7 6 extern int __init pci_xen_swiotlb_detect(void); 8 - extern void __init pci_xen_swiotlb_init(void); 9 7 extern int pci_xen_swiotlb_init_late(void); 10 8 #else 11 - #define xen_swiotlb (0) 12 - static inline int __init pci_xen_swiotlb_detect(void) { return 0; } 13 - static inline void __init pci_xen_swiotlb_init(void) { } 9 + #define pci_xen_swiotlb_detect NULL 14 10 static inline int pci_xen_swiotlb_init_late(void) { return -ENXIO; } 15 11 #endif 16 12
+14 -12
arch/x86/kernel/setup.c
··· 830 830 831 831 x86_init.oem.arch_setup(); 832 832 833 + /* 834 + * Do some memory reservations *before* memory is added to memblock, so 835 + * memblock allocations won't overwrite it. 836 + * 837 + * After this point, everything still needed from the boot loader or 838 + * firmware or kernel text should be early reserved or marked not RAM in 839 + * e820. All other memory is free game. 840 + * 841 + * This call needs to happen before e820__memory_setup() which calls the 842 + * xen_memory_setup() on Xen dom0 which relies on the fact that those 843 + * early reservations have happened already. 844 + */ 845 + early_reserve_memory(); 846 + 833 847 iomem_resource.end = (1ULL << boot_cpu_data.x86_phys_bits) - 1; 834 848 e820__memory_setup(); 835 849 parse_setup_data(); ··· 889 875 x86_configure_nx(); 890 876 891 877 parse_early_param(); 892 - 893 - /* 894 - * Do some memory reservations *before* memory is added to 895 - * memblock, so memblock allocations won't overwrite it. 896 - * Do it after early param, so we could get (unlikely) panic from 897 - * serial. 898 - * 899 - * After this point everything still needed from the boot loader or 900 - * firmware or kernel text should be early reserved or marked not 901 - * RAM in e820. All other memory is free game. 902 - */ 903 - early_reserve_memory(); 904 878 905 879 #ifdef CONFIG_MEMORY_HOTPLUG 906 880 /*
+2 -2
arch/x86/lib/insn.c
··· 37 37 ((insn)->next_byte + sizeof(t) + n <= (insn)->end_kaddr) 38 38 39 39 #define __get_next(t, insn) \ 40 - ({ t r = *(t*)insn->next_byte; insn->next_byte += sizeof(t); leXX_to_cpu(t, r); }) 40 + ({ t r; memcpy(&r, insn->next_byte, sizeof(t)); insn->next_byte += sizeof(t); leXX_to_cpu(t, r); }) 41 41 42 42 #define __peek_nbyte_next(t, insn, n) \ 43 - ({ t r = *(t*)((insn)->next_byte + n); leXX_to_cpu(t, r); }) 43 + ({ t r; memcpy(&r, (insn)->next_byte + n, sizeof(t)); leXX_to_cpu(t, r); }) 44 44 45 45 #define get_next(t, insn) \ 46 46 ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
+18 -8
arch/x86/mm/fault.c
··· 710 710 711 711 static noinline void 712 712 kernelmode_fixup_or_oops(struct pt_regs *regs, unsigned long error_code, 713 - unsigned long address, int signal, int si_code) 713 + unsigned long address, int signal, int si_code, 714 + u32 pkey) 714 715 { 715 716 WARN_ON_ONCE(user_mode(regs)); 716 717 ··· 736 735 737 736 set_signal_archinfo(address, error_code); 738 737 739 - /* XXX: hwpoison faults will set the wrong code. */ 740 - force_sig_fault(signal, si_code, (void __user *)address); 738 + if (si_code == SEGV_PKUERR) { 739 + force_sig_pkuerr((void __user *)address, pkey); 740 + } else { 741 + /* XXX: hwpoison faults will set the wrong code. */ 742 + force_sig_fault(signal, si_code, (void __user *)address); 743 + } 741 744 } 742 745 743 746 /* ··· 803 798 struct task_struct *tsk = current; 804 799 805 800 if (!user_mode(regs)) { 806 - kernelmode_fixup_or_oops(regs, error_code, address, pkey, si_code); 801 + kernelmode_fixup_or_oops(regs, error_code, address, 802 + SIGSEGV, si_code, pkey); 807 803 return; 808 804 } 809 805 ··· 936 930 { 937 931 /* Kernel mode? Handle exceptions or die: */ 938 932 if (!user_mode(regs)) { 939 - kernelmode_fixup_or_oops(regs, error_code, address, SIGBUS, BUS_ADRERR); 933 + kernelmode_fixup_or_oops(regs, error_code, address, 934 + SIGBUS, BUS_ADRERR, ARCH_DEFAULT_PKEY); 940 935 return; 941 936 } 942 937 ··· 1403 1396 */ 1404 1397 if (!user_mode(regs)) 1405 1398 kernelmode_fixup_or_oops(regs, error_code, address, 1406 - SIGBUS, BUS_ADRERR); 1399 + SIGBUS, BUS_ADRERR, 1400 + ARCH_DEFAULT_PKEY); 1407 1401 return; 1408 1402 } 1409 1403 ··· 1424 1416 return; 1425 1417 1426 1418 if (fatal_signal_pending(current) && !user_mode(regs)) { 1427 - kernelmode_fixup_or_oops(regs, error_code, address, 0, 0); 1419 + kernelmode_fixup_or_oops(regs, error_code, address, 1420 + 0, 0, ARCH_DEFAULT_PKEY); 1428 1421 return; 1429 1422 } 1430 1423 ··· 1433 1424 /* Kernel mode? Handle exceptions or die: */ 1434 1425 if (!user_mode(regs)) { 1435 1426 kernelmode_fixup_or_oops(regs, error_code, address, 1436 - SIGSEGV, SEGV_MAPERR); 1427 + SIGSEGV, SEGV_MAPERR, 1428 + ARCH_DEFAULT_PKEY); 1437 1429 return; 1438 1430 } 1439 1431
+9 -6
arch/x86/xen/enlighten_pv.c
··· 755 755 preempt_enable(); 756 756 } 757 757 758 - static void xen_convert_trap_info(const struct desc_ptr *desc, 759 - struct trap_info *traps) 758 + static unsigned xen_convert_trap_info(const struct desc_ptr *desc, 759 + struct trap_info *traps, bool full) 760 760 { 761 761 unsigned in, out, count; 762 762 ··· 766 766 for (in = out = 0; in < count; in++) { 767 767 gate_desc *entry = (gate_desc *)(desc->address) + in; 768 768 769 - if (cvt_gate_to_trap(in, entry, &traps[out])) 769 + if (cvt_gate_to_trap(in, entry, &traps[out]) || full) 770 770 out++; 771 771 } 772 - traps[out].address = 0; 772 + 773 + return out; 773 774 } 774 775 775 776 void xen_copy_trap_info(struct trap_info *traps) 776 777 { 777 778 const struct desc_ptr *desc = this_cpu_ptr(&idt_desc); 778 779 779 - xen_convert_trap_info(desc, traps); 780 + xen_convert_trap_info(desc, traps, true); 780 781 } 781 782 782 783 /* Load a new IDT into Xen. In principle this can be per-CPU, so we ··· 787 786 { 788 787 static DEFINE_SPINLOCK(lock); 789 788 static struct trap_info traps[257]; 789 + unsigned out; 790 790 791 791 trace_xen_cpu_load_idt(desc); 792 792 ··· 795 793 796 794 memcpy(this_cpu_ptr(&idt_desc), desc, sizeof(idt_desc)); 797 795 798 - xen_convert_trap_info(desc, traps); 796 + out = xen_convert_trap_info(desc, traps, false); 797 + memset(&traps[out], 0, sizeof(traps[0])); 799 798 800 799 xen_mc_flush(); 801 800 if (HYPERVISOR_set_trap_table(traps))
+2 -2
arch/x86/xen/pci-swiotlb-xen.c
··· 18 18 #endif 19 19 #include <linux/export.h> 20 20 21 - int xen_swiotlb __read_mostly; 21 + static int xen_swiotlb __read_mostly; 22 22 23 23 /* 24 24 * pci_xen_swiotlb_detect - set xen_swiotlb to 1 if necessary ··· 56 56 return xen_swiotlb; 57 57 } 58 58 59 - void __init pci_xen_swiotlb_init(void) 59 + static void __init pci_xen_swiotlb_init(void) 60 60 { 61 61 if (xen_swiotlb) { 62 62 xen_swiotlb_init_early();
-4
arch/x86/xen/smp_pv.c
··· 290 290 291 291 gdt = get_cpu_gdt_rw(cpu); 292 292 293 - memset(&ctxt->fpu_ctxt, 0, sizeof(ctxt->fpu_ctxt)); 294 - 295 293 /* 296 294 * Bring up the CPU in cpu_bringup_and_idle() with the stack 297 295 * pointing just below where pt_regs would be if it were a normal ··· 305 307 ctxt->user_regs.esp = (unsigned long)task_pt_regs(idle); 306 308 307 309 xen_copy_trap_info(ctxt->trap_ctxt); 308 - 309 - ctxt->ldt_ents = 0; 310 310 311 311 BUG_ON((unsigned long)gdt & ~PAGE_MASK); 312 312
+1 -1
block/bio.c
··· 1466 1466 if (!bio_integrity_endio(bio)) 1467 1467 return; 1468 1468 1469 - if (bio->bi_bdev) 1469 + if (bio->bi_bdev && bio_flagged(bio, BIO_TRACKED)) 1470 1470 rq_qos_done_bio(bio->bi_bdev->bd_disk->queue, bio); 1471 1471 1472 1472 if (bio->bi_bdev && bio_flagged(bio, BIO_TRACE_COMPLETION)) {
+15 -8
block/bsg.c
··· 165 165 .llseek = default_llseek, 166 166 }; 167 167 168 + static void bsg_device_release(struct device *dev) 169 + { 170 + struct bsg_device *bd = container_of(dev, struct bsg_device, device); 171 + 172 + ida_simple_remove(&bsg_minor_ida, MINOR(bd->device.devt)); 173 + kfree(bd); 174 + } 175 + 168 176 void bsg_unregister_queue(struct bsg_device *bd) 169 177 { 170 178 if (bd->queue->kobj.sd) 171 179 sysfs_remove_link(&bd->queue->kobj, "bsg"); 172 180 cdev_device_del(&bd->cdev, &bd->device); 173 - ida_simple_remove(&bsg_minor_ida, MINOR(bd->device.devt)); 174 - kfree(bd); 181 + put_device(&bd->device); 175 182 } 176 183 EXPORT_SYMBOL_GPL(bsg_unregister_queue); 177 184 ··· 200 193 if (ret < 0) { 201 194 if (ret == -ENOSPC) 202 195 dev_err(parent, "bsg: too many bsg devices\n"); 203 - goto out_kfree; 196 + kfree(bd); 197 + return ERR_PTR(ret); 204 198 } 205 199 bd->device.devt = MKDEV(bsg_major, ret); 206 200 bd->device.class = bsg_class; 207 201 bd->device.parent = parent; 202 + bd->device.release = bsg_device_release; 208 203 dev_set_name(&bd->device, "%s", name); 209 204 device_initialize(&bd->device); 210 205 ··· 214 205 bd->cdev.owner = THIS_MODULE; 215 206 ret = cdev_device_add(&bd->cdev, &bd->device); 216 207 if (ret) 217 - goto out_ida_remove; 208 + goto out_put_device; 218 209 219 210 if (q->kobj.sd) { 220 211 ret = sysfs_create_link(&q->kobj, &bd->device.kobj, "bsg"); ··· 226 217 227 218 out_device_del: 228 219 cdev_device_del(&bd->cdev, &bd->device); 229 - out_ida_remove: 230 - ida_simple_remove(&bsg_minor_ida, MINOR(bd->device.devt)); 231 - out_kfree: 232 - kfree(bd); 220 + out_put_device: 221 + put_device(&bd->device); 233 222 return ERR_PTR(ret); 234 223 } 235 224 EXPORT_SYMBOL_GPL(bsg_register_queue);
+10 -11
block/fops.c
··· 14 14 #include <linux/task_io_accounting_ops.h> 15 15 #include <linux/falloc.h> 16 16 #include <linux/suspend.h> 17 + #include <linux/fs.h> 17 18 #include "blk.h" 18 19 19 20 static struct inode *bdev_file_inode(struct file *file) ··· 554 553 static long blkdev_fallocate(struct file *file, int mode, loff_t start, 555 554 loff_t len) 556 555 { 557 - struct block_device *bdev = I_BDEV(bdev_file_inode(file)); 556 + struct inode *inode = bdev_file_inode(file); 557 + struct block_device *bdev = I_BDEV(inode); 558 558 loff_t end = start + len - 1; 559 559 loff_t isize; 560 560 int error; ··· 582 580 if ((start | len) & (bdev_logical_block_size(bdev) - 1)) 583 581 return -EINVAL; 584 582 583 + filemap_invalidate_lock(inode->i_mapping); 584 + 585 585 /* Invalidate the page cache, including dirty pages. */ 586 586 error = truncate_bdev_range(bdev, file->f_mode, start, end); 587 587 if (error) 588 - return error; 588 + goto fail; 589 589 590 590 switch (mode) { 591 591 case FALLOC_FL_ZERO_RANGE: ··· 604 600 GFP_KERNEL, 0); 605 601 break; 606 602 default: 607 - return -EOPNOTSUPP; 603 + error = -EOPNOTSUPP; 608 604 } 609 - if (error) 610 - return error; 611 605 612 - /* 613 - * Invalidate the page cache again; if someone wandered in and dirtied 614 - * a page, we just discard it - userspace has no way of knowing whether 615 - * the write happened before or after discard completing... 616 - */ 617 - return truncate_bdev_range(bdev, file->f_mode, start, end); 606 + fail: 607 + filemap_invalidate_unlock(inode->i_mapping); 608 + return error; 618 609 } 619 610 620 611 const struct file_operations def_blk_fops = {
+7 -16
drivers/acpi/osl.c
··· 284 284 #define should_use_kmap(pfn) page_is_ram(pfn) 285 285 #endif 286 286 287 - static void __iomem *acpi_map(acpi_physical_address pg_off, unsigned long pg_sz, 288 - bool memory) 287 + static void __iomem *acpi_map(acpi_physical_address pg_off, unsigned long pg_sz) 289 288 { 290 289 unsigned long pfn; 291 290 ··· 294 295 return NULL; 295 296 return (void __iomem __force *)kmap(pfn_to_page(pfn)); 296 297 } else 297 - return memory ? acpi_os_memmap(pg_off, pg_sz) : 298 - acpi_os_ioremap(pg_off, pg_sz); 298 + return acpi_os_ioremap(pg_off, pg_sz); 299 299 } 300 300 301 301 static void acpi_unmap(acpi_physical_address pg_off, void __iomem *vaddr) ··· 309 311 } 310 312 311 313 /** 312 - * __acpi_os_map_iomem - Get a virtual address for a given physical address range. 314 + * acpi_os_map_iomem - Get a virtual address for a given physical address range. 313 315 * @phys: Start of the physical address range to map. 314 316 * @size: Size of the physical address range to map. 315 - * @memory: true if remapping memory, false if IO 316 317 * 317 318 * Look up the given physical address range in the list of existing ACPI memory 318 319 * mappings. If found, get a reference to it and return a pointer to it (its ··· 321 324 * During early init (when acpi_permanent_mmap has not been set yet) this 322 325 * routine simply calls __acpi_map_table() to get the job done. 323 326 */ 324 - static void __iomem __ref 325 - *__acpi_os_map_iomem(acpi_physical_address phys, acpi_size size, bool memory) 327 + void __iomem __ref 328 + *acpi_os_map_iomem(acpi_physical_address phys, acpi_size size) 326 329 { 327 330 struct acpi_ioremap *map; 328 331 void __iomem *virt; ··· 353 356 354 357 pg_off = round_down(phys, PAGE_SIZE); 355 358 pg_sz = round_up(phys + size, PAGE_SIZE) - pg_off; 356 - virt = acpi_map(phys, size, memory); 359 + virt = acpi_map(phys, size); 357 360 if (!virt) { 358 361 mutex_unlock(&acpi_ioremap_lock); 359 362 kfree(map); ··· 372 375 mutex_unlock(&acpi_ioremap_lock); 373 376 return map->virt + (phys - map->phys); 374 377 } 375 - 376 - void __iomem *__ref 377 - acpi_os_map_iomem(acpi_physical_address phys, acpi_size size) 378 - { 379 - return __acpi_os_map_iomem(phys, size, false); 380 - } 381 378 EXPORT_SYMBOL_GPL(acpi_os_map_iomem); 382 379 383 380 void *__ref acpi_os_map_memory(acpi_physical_address phys, acpi_size size) 384 381 { 385 - return (void *)__acpi_os_map_iomem(phys, size, true); 382 + return (void *)acpi_os_map_iomem(phys, size); 386 383 } 387 384 EXPORT_SYMBOL_GPL(acpi_os_map_memory); 388 385
+46 -12
drivers/android/binder.c
··· 1852 1852 } 1853 1853 1854 1854 static void binder_transaction_buffer_release(struct binder_proc *proc, 1855 + struct binder_thread *thread, 1855 1856 struct binder_buffer *buffer, 1856 1857 binder_size_t failed_at, 1857 1858 bool is_failure) ··· 2012 2011 &proc->alloc, &fd, buffer, 2013 2012 offset, sizeof(fd)); 2014 2013 WARN_ON(err); 2015 - if (!err) 2014 + if (!err) { 2016 2015 binder_deferred_fd_close(fd); 2016 + /* 2017 + * Need to make sure the thread goes 2018 + * back to userspace to complete the 2019 + * deferred close 2020 + */ 2021 + if (thread) 2022 + thread->looper_need_return = true; 2023 + } 2017 2024 } 2018 2025 } break; 2019 2026 default: ··· 3047 3038 if (reply) { 3048 3039 binder_enqueue_thread_work(thread, tcomplete); 3049 3040 binder_inner_proc_lock(target_proc); 3050 - if (target_thread->is_dead || target_proc->is_frozen) { 3051 - return_error = target_thread->is_dead ? 3052 - BR_DEAD_REPLY : BR_FROZEN_REPLY; 3041 + if (target_thread->is_dead) { 3042 + return_error = BR_DEAD_REPLY; 3053 3043 binder_inner_proc_unlock(target_proc); 3054 3044 goto err_dead_proc_or_thread; 3055 3045 } ··· 3113 3105 err_copy_data_failed: 3114 3106 binder_free_txn_fixups(t); 3115 3107 trace_binder_transaction_failed_buffer_release(t->buffer); 3116 - binder_transaction_buffer_release(target_proc, t->buffer, 3108 + binder_transaction_buffer_release(target_proc, NULL, t->buffer, 3117 3109 buffer_offset, true); 3118 3110 if (target_node) 3119 3111 binder_dec_node_tmpref(target_node); ··· 3192 3184 * Cleanup buffer and free it. 3193 3185 */ 3194 3186 static void 3195 - binder_free_buf(struct binder_proc *proc, struct binder_buffer *buffer) 3187 + binder_free_buf(struct binder_proc *proc, 3188 + struct binder_thread *thread, 3189 + struct binder_buffer *buffer) 3196 3190 { 3197 3191 binder_inner_proc_lock(proc); 3198 3192 if (buffer->transaction) { ··· 3222 3212 binder_node_inner_unlock(buf_node); 3223 3213 } 3224 3214 trace_binder_transaction_buffer_release(buffer); 3225 - binder_transaction_buffer_release(proc, buffer, 0, false); 3215 + binder_transaction_buffer_release(proc, thread, buffer, 0, false); 3226 3216 binder_alloc_free_buf(&proc->alloc, buffer); 3227 3217 } 3228 3218 ··· 3424 3414 proc->pid, thread->pid, (u64)data_ptr, 3425 3415 buffer->debug_id, 3426 3416 buffer->transaction ? "active" : "finished"); 3427 - binder_free_buf(proc, buffer); 3417 + binder_free_buf(proc, thread, buffer); 3428 3418 break; 3429 3419 } 3430 3420 ··· 4117 4107 buffer->transaction = NULL; 4118 4108 binder_cleanup_transaction(t, "fd fixups failed", 4119 4109 BR_FAILED_REPLY); 4120 - binder_free_buf(proc, buffer); 4110 + binder_free_buf(proc, thread, buffer); 4121 4111 binder_debug(BINDER_DEBUG_FAILED_TRANSACTION, 4122 4112 "%d:%d %stransaction %d fd fixups failed %d/%d, line %d\n", 4123 4113 proc->pid, thread->pid, ··· 4658 4648 return 0; 4659 4649 } 4660 4650 4651 + static bool binder_txns_pending_ilocked(struct binder_proc *proc) 4652 + { 4653 + struct rb_node *n; 4654 + struct binder_thread *thread; 4655 + 4656 + if (proc->outstanding_txns > 0) 4657 + return true; 4658 + 4659 + for (n = rb_first(&proc->threads); n; n = rb_next(n)) { 4660 + thread = rb_entry(n, struct binder_thread, rb_node); 4661 + if (thread->transaction_stack) 4662 + return true; 4663 + } 4664 + return false; 4665 + } 4666 + 4661 4667 static int binder_ioctl_freeze(struct binder_freeze_info *info, 4662 4668 struct binder_proc *target_proc) 4663 4669 { ··· 4705 4679 (!target_proc->outstanding_txns), 4706 4680 msecs_to_jiffies(info->timeout_ms)); 4707 4681 4708 - if (!ret && target_proc->outstanding_txns) 4709 - ret = -EAGAIN; 4682 + /* Check pending transactions that wait for reply */ 4683 + if (ret >= 0) { 4684 + binder_inner_proc_lock(target_proc); 4685 + if (binder_txns_pending_ilocked(target_proc)) 4686 + ret = -EAGAIN; 4687 + binder_inner_proc_unlock(target_proc); 4688 + } 4710 4689 4711 4690 if (ret < 0) { 4712 4691 binder_inner_proc_lock(target_proc); ··· 4727 4696 { 4728 4697 struct binder_proc *target_proc; 4729 4698 bool found = false; 4699 + __u32 txns_pending; 4730 4700 4731 4701 info->sync_recv = 0; 4732 4702 info->async_recv = 0; ··· 4737 4705 if (target_proc->pid == info->pid) { 4738 4706 found = true; 4739 4707 binder_inner_proc_lock(target_proc); 4740 - info->sync_recv |= target_proc->sync_recv; 4708 + txns_pending = binder_txns_pending_ilocked(target_proc); 4709 + info->sync_recv |= target_proc->sync_recv | 4710 + (txns_pending << 1); 4741 4711 info->async_recv |= target_proc->async_recv; 4742 4712 binder_inner_proc_unlock(target_proc); 4743 4713 }
+2
drivers/android/binder_internal.h
··· 378 378 * binder transactions 379 379 * (protected by @inner_lock) 380 380 * @sync_recv: process received sync transactions since last frozen 381 + * bit 0: received sync transaction after being frozen 382 + * bit 1: new pending sync transaction during freezing 381 383 * (protected by @inner_lock) 382 384 * @async_recv: process received async transactions since last frozen 383 385 * (protected by @inner_lock)
+3
drivers/base/swnode.c
··· 1116 1116 to_swnode(fwnode)->managed = true; 1117 1117 set_secondary_fwnode(dev, fwnode); 1118 1118 1119 + if (device_is_registered(dev)) 1120 + software_node_notify(dev); 1121 + 1119 1122 return 0; 1120 1123 } 1121 1124 EXPORT_SYMBOL_GPL(device_create_managed_software_node);
+1
drivers/comedi/comedi_fops.c
··· 3090 3090 mutex_lock(&dev->mutex); 3091 3091 rc = do_insnlist_ioctl(dev, insns, insnlist32.n_insns, file); 3092 3092 mutex_unlock(&dev->mutex); 3093 + kfree(insns); 3093 3094 return rc; 3094 3095 } 3095 3096
+1 -1
drivers/edac/dmc520_edac.c
··· 464 464 dimm->grain = pvt->mem_width_in_bytes; 465 465 dimm->dtype = dt; 466 466 dimm->mtype = mt; 467 - dimm->edac_mode = EDAC_FLAG_SECDED; 467 + dimm->edac_mode = EDAC_SECDED; 468 468 dimm->nr_pages = pages_per_rank / csi->nr_channels; 469 469 } 470 470 }
+1 -1
drivers/edac/synopsys_edac.c
··· 782 782 783 783 for (j = 0; j < csi->nr_channels; j++) { 784 784 dimm = csi->channels[j]->dimm; 785 - dimm->edac_mode = EDAC_FLAG_SECDED; 785 + dimm->edac_mode = EDAC_SECDED; 786 786 dimm->mtype = p_data->get_mtype(priv->baseaddr); 787 787 dimm->nr_pages = (size >> PAGE_SHIFT) / csi->nr_channels; 788 788 dimm->grain = SYNPS_EDAC_ERR_GRAIN;
+8 -6
drivers/fpga/dfl.c
··· 1019 1019 { 1020 1020 unsigned int irq_base, nr_irqs; 1021 1021 struct dfl_feature_info *finfo; 1022 + u8 revision = 0; 1022 1023 int ret; 1023 - u8 revision; 1024 1024 u64 v; 1025 1025 1026 - v = readq(binfo->ioaddr + ofst); 1027 - revision = FIELD_GET(DFH_REVISION, v); 1026 + if (fid != FEATURE_ID_AFU) { 1027 + v = readq(binfo->ioaddr + ofst); 1028 + revision = FIELD_GET(DFH_REVISION, v); 1028 1029 1029 - /* read feature size and id if inputs are invalid */ 1030 - size = size ? size : feature_size(v); 1031 - fid = fid ? fid : feature_id(v); 1030 + /* read feature size and id if inputs are invalid */ 1031 + size = size ? size : feature_size(v); 1032 + fid = fid ? fid : feature_id(v); 1033 + } 1032 1034 1033 1035 if (binfo->len - ofst < size) 1034 1036 return -EINVAL;
+5 -1
drivers/fpga/machxo2-spi.c
··· 225 225 goto fail; 226 226 227 227 get_status(spi, &status); 228 - if (test_bit(FAIL, &status)) 228 + if (test_bit(FAIL, &status)) { 229 + ret = -EINVAL; 229 230 goto fail; 231 + } 230 232 dump_status_reg(&status); 231 233 232 234 spi_message_init(&msg); ··· 315 313 dump_status_reg(&status); 316 314 if (!test_bit(DONE, &status)) { 317 315 machxo2_cleanup(mgr); 316 + ret = -EINVAL; 318 317 goto fail; 319 318 } 320 319 ··· 338 335 break; 339 336 if (++refreshloop == MACHXO2_MAX_REFRESH_LOOP) { 340 337 machxo2_cleanup(mgr); 338 + ret = -EINVAL; 341 339 goto fail; 342 340 } 343 341 } while (1);
+1 -1
drivers/gpio/gpio-aspeed-sgpio.c
··· 395 395 reg = ioread32(bank_reg(data, bank, reg_irq_status)); 396 396 397 397 for_each_set_bit(p, &reg, 32) 398 - generic_handle_domain_irq(gc->irq.domain, i * 32 + p); 398 + generic_handle_domain_irq(gc->irq.domain, i * 32 + p * 2); 399 399 } 400 400 401 401 chained_irq_exit(ic, desc);
+2 -2
drivers/gpio/gpio-rockchip.c
··· 141 141 u32 data; 142 142 143 143 data = rockchip_gpio_readl_bit(bank, offset, bank->gpio_regs->port_ddr); 144 - if (data & BIT(offset)) 144 + if (data) 145 145 return GPIO_LINE_DIRECTION_OUT; 146 146 147 147 return GPIO_LINE_DIRECTION_IN; ··· 195 195 unsigned int cur_div_reg; 196 196 u64 div; 197 197 198 - if (!IS_ERR(bank->db_clk)) { 198 + if (bank->gpio_type == GPIO_TYPE_V2 && !IS_ERR(bank->db_clk)) { 199 199 div_debounce_support = true; 200 200 freq = clk_get_rate(bank->db_clk); 201 201 max_debounce = (GENMASK(23, 0) + 1) * 2 * 1000000 / freq;
+2 -2
drivers/gpio/gpio-uniphier.c
··· 184 184 185 185 uniphier_gpio_reg_update(priv, UNIPHIER_GPIO_IRQ_EN, mask, 0); 186 186 187 - return irq_chip_mask_parent(data); 187 + irq_chip_mask_parent(data); 188 188 } 189 189 190 190 static void uniphier_gpio_irq_unmask(struct irq_data *data) ··· 194 194 195 195 uniphier_gpio_reg_update(priv, UNIPHIER_GPIO_IRQ_EN, mask, mask); 196 196 197 - return irq_chip_unmask_parent(data); 197 + irq_chip_unmask_parent(data); 198 198 } 199 199 200 200 static int uniphier_gpio_irq_set_type(struct irq_data *data, unsigned int type)
+4 -2
drivers/gpio/gpiolib-acpi.c
··· 313 313 314 314 ret = gpio_set_debounce_timeout(desc, agpio->debounce_timeout); 315 315 if (ret) 316 - gpiochip_free_own_desc(desc); 316 + dev_warn(chip->parent, 317 + "Failed to set debounce-timeout for pin 0x%04X, err %d\n", 318 + pin, ret); 317 319 318 - return ret ? ERR_PTR(ret) : desc; 320 + return desc; 319 321 } 320 322 321 323 static bool acpi_gpio_in_ignore_list(const char *controller_in, int pin_in)
-1
drivers/gpu/drm/amd/amdkfd/kfd_device.c
··· 971 971 void kgd2kfd_device_exit(struct kfd_dev *kfd) 972 972 { 973 973 if (kfd->init_complete) { 974 - svm_migrate_fini((struct amdgpu_device *)kfd->kgd); 975 974 device_queue_manager_uninit(kfd->dqm); 976 975 kfd_interrupt_exit(kfd); 977 976 kfd_topology_remove_device(kfd);
+7 -9
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
··· 891 891 pgmap->ops = &svm_migrate_pgmap_ops; 892 892 pgmap->owner = SVM_ADEV_PGMAP_OWNER(adev); 893 893 pgmap->flags = MIGRATE_VMA_SELECT_DEVICE_PRIVATE; 894 + 895 + /* Device manager releases device-specific resources, memory region and 896 + * pgmap when driver disconnects from device. 897 + */ 894 898 r = devm_memremap_pages(adev->dev, pgmap); 895 899 if (IS_ERR(r)) { 896 900 pr_err("failed to register HMM device memory\n"); 901 + 902 + /* Disable SVM support capability */ 903 + pgmap->type = 0; 897 904 devm_release_mem_region(adev->dev, res->start, 898 905 res->end - res->start + 1); 899 906 return PTR_ERR(r); ··· 914 907 pr_info("HMM registered %ldMB device memory\n", size >> 20); 915 908 916 909 return 0; 917 - } 918 - 919 - void svm_migrate_fini(struct amdgpu_device *adev) 920 - { 921 - struct dev_pagemap *pgmap = &adev->kfd.dev->pgmap; 922 - 923 - devm_memunmap_pages(adev->dev, pgmap); 924 - devm_release_mem_region(adev->dev, pgmap->range.start, 925 - pgmap->range.end - pgmap->range.start + 1); 926 910 }
-5
drivers/gpu/drm/amd/amdkfd/kfd_migrate.h
··· 47 47 svm_migrate_addr_to_pfn(struct amdgpu_device *adev, unsigned long addr); 48 48 49 49 int svm_migrate_init(struct amdgpu_device *adev); 50 - void svm_migrate_fini(struct amdgpu_device *adev); 51 50 52 51 #else 53 52 54 53 static inline int svm_migrate_init(struct amdgpu_device *adev) 55 54 { 56 55 return 0; 57 - } 58 - static inline void svm_migrate_fini(struct amdgpu_device *adev) 59 - { 60 - /* empty */ 61 56 } 62 57 63 58 #endif /* IS_ENABLED(CONFIG_HSA_AMD_SVM) */
+19 -5
drivers/gpu/drm/amd/amdkfd/kfd_svm.c
··· 118 118 mmu_interval_notifier_remove(&prange->notifier); 119 119 } 120 120 121 + static bool 122 + svm_is_valid_dma_mapping_addr(struct device *dev, dma_addr_t dma_addr) 123 + { 124 + return dma_addr && !dma_mapping_error(dev, dma_addr) && 125 + !(dma_addr & SVM_RANGE_VRAM_DOMAIN); 126 + } 127 + 121 128 static int 122 129 svm_range_dma_map_dev(struct amdgpu_device *adev, struct svm_range *prange, 123 130 unsigned long offset, unsigned long npages, ··· 146 139 147 140 addr += offset; 148 141 for (i = 0; i < npages; i++) { 149 - if (WARN_ONCE(addr[i] && !dma_mapping_error(dev, addr[i]), 150 - "leaking dma mapping\n")) 142 + if (svm_is_valid_dma_mapping_addr(dev, addr[i])) 151 143 dma_unmap_page(dev, addr[i], PAGE_SIZE, dir); 152 144 153 145 page = hmm_pfn_to_page(hmm_pfns[i]); ··· 215 209 return; 216 210 217 211 for (i = offset; i < offset + npages; i++) { 218 - if (!dma_addr[i] || dma_mapping_error(dev, dma_addr[i])) 212 + if (!svm_is_valid_dma_mapping_addr(dev, dma_addr[i])) 219 213 continue; 220 214 pr_debug("dma unmapping 0x%llx\n", dma_addr[i] >> PAGE_SHIFT); 221 215 dma_unmap_page(dev, dma_addr[i], PAGE_SIZE, dir); ··· 1171 1165 unsigned long last_start; 1172 1166 int last_domain; 1173 1167 int r = 0; 1174 - int64_t i; 1168 + int64_t i, j; 1175 1169 1176 1170 last_start = prange->start + offset; 1177 1171 ··· 1184 1178 for (i = offset; i < offset + npages; i++) { 1185 1179 last_domain = dma_addr[i] & SVM_RANGE_VRAM_DOMAIN; 1186 1180 dma_addr[i] &= ~SVM_RANGE_VRAM_DOMAIN; 1187 - if ((prange->start + i) < prange->last && 1181 + 1182 + /* Collect all pages in the same address range and memory domain 1183 + * that can be mapped with a single call to update mapping. 1184 + */ 1185 + if (i < offset + npages - 1 && 1188 1186 last_domain == (dma_addr[i + 1] & SVM_RANGE_VRAM_DOMAIN)) 1189 1187 continue; 1190 1188 ··· 1211 1201 NULL, dma_addr, 1212 1202 &vm->last_update, 1213 1203 &table_freed); 1204 + 1205 + for (j = last_start - prange->start; j <= i; j++) 1206 + dma_addr[j] |= last_domain; 1207 + 1214 1208 if (r) { 1215 1209 pr_debug("failed %d to map to gpu 0x%lx\n", r, prange->start); 1216 1210 goto out;
+2 -2
drivers/gpu/drm/amd/display/dc/dce/dce_aux.c
··· 42 42 #define DC_LOGGER \ 43 43 engine->ctx->logger 44 44 45 - #define DC_TRACE_LEVEL_MESSAGE(...) /* do nothing */ 45 + #define DC_TRACE_LEVEL_MESSAGE(...) do { } while (0) 46 46 #define IS_DC_I2CAUX_LOGGING_ENABLED() (false) 47 47 #define LOG_FLAG_Error_I2cAux LOG_ERROR 48 48 #define LOG_FLAG_I2cAux_DceAux LOG_I2C_AUX ··· 76 76 #define DEFAULT_AUX_ENGINE_MULT 0 77 77 #define DEFAULT_AUX_ENGINE_LENGTH 69 78 78 79 - #define DC_TRACE_LEVEL_MESSAGE(...) /* do nothing */ 79 + #define DC_TRACE_LEVEL_MESSAGE(...) do { } while (0) 80 80 81 81 static void release_engine( 82 82 struct dce_aux *engine)
+2
drivers/gpu/drm/amd/pm/powerplay/si_dpm.c
··· 6867 6867 si_enable_auto_throttle_source(adev, AMDGPU_DPM_AUTO_THROTTLE_SRC_THERMAL, true); 6868 6868 si_thermal_start_thermal_controller(adev); 6869 6869 6870 + ni_update_current_ps(adev, boot_ps); 6871 + 6870 6872 return 0; 6871 6873 } 6872 6874
+16 -3
drivers/gpu/drm/i915/display/intel_bw.c
··· 222 222 223 223 struct intel_sa_info { 224 224 u16 displayrtids; 225 - u8 deburst, deprogbwlimit; 225 + u8 deburst, deprogbwlimit, derating; 226 226 }; 227 227 228 228 static const struct intel_sa_info icl_sa_info = { 229 229 .deburst = 8, 230 230 .deprogbwlimit = 25, /* GB/s */ 231 231 .displayrtids = 128, 232 + .derating = 10, 232 233 }; 233 234 234 235 static const struct intel_sa_info tgl_sa_info = { 235 236 .deburst = 16, 236 237 .deprogbwlimit = 34, /* GB/s */ 237 238 .displayrtids = 256, 239 + .derating = 10, 238 240 }; 239 241 240 242 static const struct intel_sa_info rkl_sa_info = { 241 243 .deburst = 16, 242 244 .deprogbwlimit = 20, /* GB/s */ 243 245 .displayrtids = 128, 246 + .derating = 10, 244 247 }; 245 248 246 249 static const struct intel_sa_info adls_sa_info = { 247 250 .deburst = 16, 248 251 .deprogbwlimit = 38, /* GB/s */ 249 252 .displayrtids = 256, 253 + .derating = 10, 254 + }; 255 + 256 + static const struct intel_sa_info adlp_sa_info = { 257 + .deburst = 16, 258 + .deprogbwlimit = 38, /* GB/s */ 259 + .displayrtids = 256, 260 + .derating = 20, 250 261 }; 251 262 252 263 static int icl_get_bw_info(struct drm_i915_private *dev_priv, const struct intel_sa_info *sa) ··· 313 302 bw = icl_calc_bw(sp->dclk, clpchgroup * 32 * num_channels, ct); 314 303 315 304 bi->deratedbw[j] = min(maxdebw, 316 - bw * 9 / 10); /* 90% */ 305 + bw * (100 - sa->derating) / 100); 317 306 318 307 drm_dbg_kms(&dev_priv->drm, 319 308 "BW%d / QGV %d: num_planes=%d deratedbw=%u\n", ··· 411 400 412 401 if (IS_DG2(dev_priv)) 413 402 dg2_get_bw_info(dev_priv); 414 - else if (IS_ALDERLAKE_S(dev_priv) || IS_ALDERLAKE_P(dev_priv)) 403 + else if (IS_ALDERLAKE_P(dev_priv)) 404 + icl_get_bw_info(dev_priv, &adlp_sa_info); 405 + else if (IS_ALDERLAKE_S(dev_priv)) 415 406 icl_get_bw_info(dev_priv, &adls_sa_info); 416 407 else if (IS_ROCKETLAKE(dev_priv)) 417 408 icl_get_bw_info(dev_priv, &rkl_sa_info);
+4 -1
drivers/gpu/drm/i915/display/intel_dmc.c
··· 805 805 */ 806 806 void intel_dmc_ucode_fini(struct drm_i915_private *dev_priv) 807 807 { 808 + int id; 809 + 808 810 if (!HAS_DMC(dev_priv)) 809 811 return; 810 812 811 813 intel_dmc_ucode_suspend(dev_priv); 812 814 drm_WARN_ON(&dev_priv->drm, dev_priv->dmc.wakeref); 813 815 814 - kfree(dev_priv->dmc.dmc_info[DMC_FW_MAIN].payload); 816 + for (id = 0; id < DMC_FW_MAX; id++) 817 + kfree(dev_priv->dmc.dmc_info[id].payload); 815 818 }
+5 -4
drivers/gpu/drm/i915/gem/i915_gem_ttm.c
··· 356 356 { 357 357 struct drm_i915_gem_object *obj = i915_ttm_to_gem(bo); 358 358 359 - if (likely(obj)) { 360 - /* This releases all gem object bindings to the backend. */ 359 + if (likely(obj)) 361 360 i915_ttm_free_cached_io_st(obj); 362 - __i915_gem_free_object(obj); 363 - } 364 361 } 365 362 366 363 static struct intel_memory_region * ··· 872 875 { 873 876 struct drm_i915_gem_object *obj = i915_ttm_to_gem(bo); 874 877 878 + /* This releases all gem object bindings to the backend. */ 879 + __i915_gem_free_object(obj); 880 + 875 881 i915_gem_object_release_memory_region(obj); 876 882 mutex_destroy(&obj->ttm.get_io_page.lock); 883 + 877 884 if (obj->ttm.created) 878 885 call_rcu(&obj->rcu, __i915_gem_free_object_rcu); 879 886 }
+1 -1
drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.c
··· 57 57 args->v0.count = 0; 58 58 args->v0.ustate_ac = NVIF_CONTROL_PSTATE_INFO_V0_USTATE_DISABLE; 59 59 args->v0.ustate_dc = NVIF_CONTROL_PSTATE_INFO_V0_USTATE_DISABLE; 60 - args->v0.pwrsrc = -ENOSYS; 60 + args->v0.pwrsrc = -ENODEV; 61 61 args->v0.pstate = NVIF_CONTROL_PSTATE_INFO_V0_PSTATE_UNKNOWN; 62 62 } 63 63
+1
drivers/hwtracing/coresight/coresight-syscfg.c
··· 5 5 */ 6 6 7 7 #include <linux/platform_device.h> 8 + #include <linux/slab.h> 8 9 9 10 #include "coresight-config.h" 10 11 #include "coresight-etm-perf.h"
+1
drivers/irqchip/Kconfig
··· 409 409 config GOLDFISH_PIC 410 410 bool "Goldfish programmable interrupt controller" 411 411 depends on MIPS && (GOLDFISH || COMPILE_TEST) 412 + select GENERIC_IRQ_CHIP 412 413 select IRQ_DOMAIN 413 414 help 414 415 Say yes here to enable Goldfish interrupt controller driver used
+2 -2
drivers/irqchip/irq-armada-370-xp.c
··· 359 359 ARMADA_370_XP_SW_TRIG_INT_OFFS); 360 360 } 361 361 362 - static void armada_370_xp_ipi_eoi(struct irq_data *d) 362 + static void armada_370_xp_ipi_ack(struct irq_data *d) 363 363 { 364 364 writel(~BIT(d->hwirq), per_cpu_int_base + ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS); 365 365 } 366 366 367 367 static struct irq_chip ipi_irqchip = { 368 368 .name = "IPI", 369 + .irq_ack = armada_370_xp_ipi_ack, 369 370 .irq_mask = armada_370_xp_ipi_mask, 370 371 .irq_unmask = armada_370_xp_ipi_unmask, 371 - .irq_eoi = armada_370_xp_ipi_eoi, 372 372 .ipi_send_mask = armada_370_xp_ipi_send_mask, 373 373 }; 374 374
+1 -1
drivers/irqchip/irq-gic-v3-its.c
··· 4501 4501 4502 4502 if (err) { 4503 4503 if (i > 0) 4504 - its_vpe_irq_domain_free(domain, virq, i - 1); 4504 + its_vpe_irq_domain_free(domain, virq, i); 4505 4505 4506 4506 its_lpi_free(bitmap, base, nr_ids); 4507 4507 its_free_prop_table(vprop_page);
+51 -1
drivers/irqchip/irq-gic.c
··· 107 107 108 108 #endif 109 109 110 + static DEFINE_STATIC_KEY_FALSE(needs_rmw_access); 111 + 110 112 /* 111 113 * The GIC mapping of CPU interfaces does not necessarily match 112 114 * the logical CPU numbering. Let's use a mapping as returned ··· 776 774 #endif 777 775 778 776 #ifdef CONFIG_SMP 777 + static void rmw_writeb(u8 bval, void __iomem *addr) 778 + { 779 + static DEFINE_RAW_SPINLOCK(rmw_lock); 780 + unsigned long offset = (unsigned long)addr & 3UL; 781 + unsigned long shift = offset * 8; 782 + unsigned long flags; 783 + u32 val; 784 + 785 + raw_spin_lock_irqsave(&rmw_lock, flags); 786 + 787 + addr -= offset; 788 + val = readl_relaxed(addr); 789 + val &= ~GENMASK(shift + 7, shift); 790 + val |= bval << shift; 791 + writel_relaxed(val, addr); 792 + 793 + raw_spin_unlock_irqrestore(&rmw_lock, flags); 794 + } 795 + 779 796 static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val, 780 797 bool force) 781 798 { ··· 809 788 if (cpu >= NR_GIC_CPU_IF || cpu >= nr_cpu_ids) 810 789 return -EINVAL; 811 790 812 - writeb_relaxed(gic_cpu_map[cpu], reg); 791 + if (static_branch_unlikely(&needs_rmw_access)) 792 + rmw_writeb(gic_cpu_map[cpu], reg); 793 + else 794 + writeb_relaxed(gic_cpu_map[cpu], reg); 813 795 irq_data_update_effective_affinity(d, cpumask_of(cpu)); 814 796 815 797 return IRQ_SET_MASK_OK_DONE; ··· 1399 1375 return true; 1400 1376 } 1401 1377 1378 + static bool gic_enable_rmw_access(void *data) 1379 + { 1380 + /* 1381 + * The EMEV2 class of machines has a broken interconnect, and 1382 + * locks up on accesses that are less than 32bit. So far, only 1383 + * the affinity setting requires it. 1384 + */ 1385 + if (of_machine_is_compatible("renesas,emev2")) { 1386 + static_branch_enable(&needs_rmw_access); 1387 + return true; 1388 + } 1389 + 1390 + return false; 1391 + } 1392 + 1393 + static const struct gic_quirk gic_quirks[] = { 1394 + { 1395 + .desc = "broken byte access", 1396 + .compatible = "arm,pl390", 1397 + .init = gic_enable_rmw_access, 1398 + }, 1399 + { }, 1400 + }; 1401 + 1402 1402 static int gic_of_setup(struct gic_chip_data *gic, struct device_node *node) 1403 1403 { 1404 1404 if (!gic || !node) ··· 1438 1390 1439 1391 if (of_property_read_u32(node, "cpu-offset", &gic->percpu_offset)) 1440 1392 gic->percpu_offset = 0; 1393 + 1394 + gic_enable_of_quirks(node, gic_quirks, gic); 1441 1395 1442 1396 return 0; 1443 1397
+3 -3
drivers/irqchip/irq-mbigen.c
··· 25 25 /* The maximum IRQ pin number of mbigen chip(start from 0) */ 26 26 #define MAXIMUM_IRQ_PIN_NUM 1407 27 27 28 - /** 28 + /* 29 29 * In mbigen vector register 30 30 * bit[21:12]: event id value 31 31 * bit[11:0]: device id ··· 39 39 /* offset of vector register in mbigen node */ 40 40 #define REG_MBIGEN_VEC_OFFSET 0x200 41 41 42 - /** 42 + /* 43 43 * offset of clear register in mbigen node 44 44 * This register is used to clear the status 45 45 * of interrupt 46 46 */ 47 47 #define REG_MBIGEN_CLEAR_OFFSET 0xa000 48 48 49 - /** 49 + /* 50 50 * offset of interrupt type register 51 51 * This register is used to configure interrupt 52 52 * trigger type
+6 -6
drivers/irqchip/irq-renesas-rza1.c
··· 223 223 goto out_put_node; 224 224 } 225 225 226 - priv->chip.name = "rza1-irqc", 227 - priv->chip.irq_mask = irq_chip_mask_parent, 228 - priv->chip.irq_unmask = irq_chip_unmask_parent, 229 - priv->chip.irq_eoi = rza1_irqc_eoi, 230 - priv->chip.irq_retrigger = irq_chip_retrigger_hierarchy, 231 - priv->chip.irq_set_type = rza1_irqc_set_type, 226 + priv->chip.name = "rza1-irqc"; 227 + priv->chip.irq_mask = irq_chip_mask_parent; 228 + priv->chip.irq_unmask = irq_chip_unmask_parent; 229 + priv->chip.irq_eoi = rza1_irqc_eoi; 230 + priv->chip.irq_retrigger = irq_chip_retrigger_hierarchy; 231 + priv->chip.irq_set_type = rza1_irqc_set_type; 232 232 priv->chip.flags = IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_SKIP_SET_WAKE; 233 233 234 234 priv->irq_domain = irq_domain_add_hierarchy(parent, 0, IRQC_NUM_IRQ,
+6 -6
drivers/mcb/mcb-core.c
··· 275 275 276 276 bus_nr = ida_simple_get(&mcb_ida, 0, 0, GFP_KERNEL); 277 277 if (bus_nr < 0) { 278 - rc = bus_nr; 279 - goto err_free; 278 + kfree(bus); 279 + return ERR_PTR(bus_nr); 280 280 } 281 281 282 282 bus->bus_nr = bus_nr; ··· 291 291 dev_set_name(&bus->dev, "mcb:%d", bus_nr); 292 292 rc = device_add(&bus->dev); 293 293 if (rc) 294 - goto err_free; 294 + goto err_put; 295 295 296 296 return bus; 297 - err_free: 298 - put_device(carrier); 299 - kfree(bus); 297 + 298 + err_put: 299 + put_device(&bus->dev); 300 300 return ERR_PTR(rc); 301 301 } 302 302 EXPORT_SYMBOL_NS_GPL(mcb_alloc_bus, MCB);
-5
drivers/md/md.c
··· 5700 5700 disk->flags |= GENHD_FL_EXT_DEVT; 5701 5701 disk->events |= DISK_EVENT_MEDIA_CHANGE; 5702 5702 mddev->gendisk = disk; 5703 - /* As soon as we call add_disk(), another thread could get 5704 - * through to md_open, so make sure it doesn't get too far 5705 - */ 5706 - mutex_lock(&mddev->open_mutex); 5707 5703 add_disk(disk); 5708 5704 5709 5705 error = kobject_add(&mddev->kobj, &disk_to_dev(disk)->kobj, "%s", "md"); ··· 5714 5718 if (mddev->kobj.sd && 5715 5719 sysfs_create_group(&mddev->kobj, &md_bitmap_group)) 5716 5720 pr_debug("pointless warning\n"); 5717 - mutex_unlock(&mddev->open_mutex); 5718 5721 abort: 5719 5722 mutex_unlock(&disks_mutex); 5720 5723 if (!error && mddev->kobj.sd) {
+3 -3
drivers/misc/bcm-vk/bcm_vk_tty.c
··· 267 267 struct device *tty_dev; 268 268 269 269 tty_port_init(&vk->tty[i].port); 270 - tty_dev = tty_port_register_device(&vk->tty[i].port, tty_drv, 271 - i, dev); 270 + tty_dev = tty_port_register_device_attr(&vk->tty[i].port, 271 + tty_drv, i, dev, vk, 272 + NULL); 272 273 if (IS_ERR(tty_dev)) { 273 274 err = PTR_ERR(tty_dev); 274 275 goto unwind; 275 276 } 276 - dev_set_drvdata(tty_dev, vk); 277 277 vk->tty[i].is_opened = false; 278 278 } 279 279
+1 -1
drivers/misc/genwqe/card_base.c
··· 1090 1090 1091 1091 /* check for 64-bit DMA address supported (DAC) */ 1092 1092 /* check for 32-bit DMA address supported (SAC) */ 1093 - if (dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(64)) || 1093 + if (dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(64)) && 1094 1094 dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(32))) { 1095 1095 dev_err(&pci_dev->dev, 1096 1096 "err: neither DMA32 nor DMA64 supported\n");
+51 -20
drivers/misc/habanalabs/common/command_submission.c
··· 405 405 static void cs_handle_tdr(struct hl_device *hdev, struct hl_cs *cs) 406 406 { 407 407 bool next_entry_found = false; 408 - struct hl_cs *next; 408 + struct hl_cs *next, *first_cs; 409 409 410 410 if (!cs_needs_timeout(cs)) 411 411 return; ··· 415 415 /* We need to handle tdr only once for the complete staged submission. 416 416 * Hence, we choose the CS that reaches this function first which is 417 417 * the CS marked as 'staged_last'. 418 + * In case single staged cs was submitted which has both first and last 419 + * indications, then "cs_find_first" below will return NULL, since we 420 + * removed the cs node from the list before getting here, 421 + * in such cases just continue with the cs to cancel it's TDR work. 418 422 */ 419 - if (cs->staged_cs && cs->staged_last) 420 - cs = hl_staged_cs_find_first(hdev, cs->staged_sequence); 423 + if (cs->staged_cs && cs->staged_last) { 424 + first_cs = hl_staged_cs_find_first(hdev, cs->staged_sequence); 425 + if (first_cs) 426 + cs = first_cs; 427 + } 421 428 422 429 spin_unlock(&hdev->cs_mirror_lock); 423 430 ··· 1295 1288 if (rc) 1296 1289 goto free_cs_object; 1297 1290 1291 + /* If this is a staged submission we must return the staged sequence 1292 + * rather than the internal CS sequence 1293 + */ 1294 + if (cs->staged_cs) 1295 + *cs_seq = cs->staged_sequence; 1296 + 1298 1297 /* Validate ALL the CS chunks before submitting the CS */ 1299 1298 for (i = 0 ; i < num_chunks ; i++) { 1300 1299 struct hl_cs_chunk *chunk = &cs_chunk_array[i]; ··· 2001 1988 goto free_cs_chunk_array; 2002 1989 } 2003 1990 1991 + if (!hdev->nic_ports_mask) { 1992 + atomic64_inc(&ctx->cs_counters.validation_drop_cnt); 1993 + atomic64_inc(&cntr->validation_drop_cnt); 1994 + dev_err(hdev->dev, 1995 + "Collective operations not supported when NIC ports are disabled"); 1996 + rc = -EINVAL; 1997 + goto free_cs_chunk_array; 1998 + } 1999 + 2004 2000 collective_engine_id = chunk->collective_engine_id; 2005 2001 } 2006 2002 ··· 2048 2026 spin_unlock(&ctx->sig_mgr.lock); 2049 2027 2050 2028 if (!handle_found) { 2051 - dev_err(hdev->dev, "Cannot find encapsulated signals handle for seq 0x%llx\n", 2029 + /* treat as signal CS already finished */ 2030 + dev_dbg(hdev->dev, "Cannot find encapsulated signals handle for seq 0x%llx\n", 2052 2031 signal_seq); 2053 - rc = -EINVAL; 2032 + rc = 0; 2054 2033 goto free_cs_chunk_array; 2055 2034 } 2056 2035 ··· 2636 2613 * completed after the poll function. 2637 2614 */ 2638 2615 if (!mcs_data.completion_bitmap) { 2639 - dev_err(hdev->dev, "Multi-CS got completion on wait but no CS completed\n"); 2616 + dev_warn_ratelimited(hdev->dev, 2617 + "Multi-CS got completion on wait but no CS completed\n"); 2640 2618 rc = -EFAULT; 2641 2619 } 2642 2620 } ··· 2764 2740 else 2765 2741 interrupt = &hdev->user_interrupt[interrupt_offset]; 2766 2742 2743 + /* Add pending user interrupt to relevant list for the interrupt 2744 + * handler to monitor 2745 + */ 2746 + spin_lock_irqsave(&interrupt->wait_list_lock, flags); 2747 + list_add_tail(&pend->wait_list_node, &interrupt->wait_list_head); 2748 + spin_unlock_irqrestore(&interrupt->wait_list_lock, flags); 2749 + 2750 + /* We check for completion value as interrupt could have been received 2751 + * before we added the node to the wait list 2752 + */ 2767 2753 if (copy_from_user(&completion_value, u64_to_user_ptr(user_address), 4)) { 2768 2754 dev_err(hdev->dev, "Failed to copy completion value from user\n"); 2769 2755 rc = -EFAULT; 2770 - goto free_fence; 2756 + goto remove_pending_user_interrupt; 2771 2757 } 2772 2758 2773 2759 if (completion_value >= target_value) ··· 2786 2752 *status = CS_WAIT_STATUS_BUSY; 2787 2753 2788 2754 if (!timeout_us || (*status == CS_WAIT_STATUS_COMPLETED)) 2789 - goto free_fence; 2790 - 2791 - /* Add pending user interrupt to relevant list for the interrupt 2792 - * handler to monitor 2793 - */ 2794 - spin_lock_irqsave(&interrupt->wait_list_lock, flags); 2795 - list_add_tail(&pend->wait_list_node, &interrupt->wait_list_head); 2796 - spin_unlock_irqrestore(&interrupt->wait_list_lock, flags); 2755 + goto remove_pending_user_interrupt; 2797 2756 2798 2757 wait_again: 2799 2758 /* Wait for interrupt handler to signal completion */ ··· 2797 2770 * If comparison fails, keep waiting until timeout expires 2798 2771 */ 2799 2772 if (completion_rc > 0) { 2773 + spin_lock_irqsave(&interrupt->wait_list_lock, flags); 2774 + /* reinit_completion must be called before we check for user 2775 + * completion value, otherwise, if interrupt is received after 2776 + * the comparison and before the next wait_for_completion, 2777 + * we will reach timeout and fail 2778 + */ 2779 + reinit_completion(&pend->fence.completion); 2780 + spin_unlock_irqrestore(&interrupt->wait_list_lock, flags); 2781 + 2800 2782 if (copy_from_user(&completion_value, u64_to_user_ptr(user_address), 4)) { 2801 2783 dev_err(hdev->dev, "Failed to copy completion value from user\n"); 2802 2784 rc = -EFAULT; ··· 2816 2780 if (completion_value >= target_value) { 2817 2781 *status = CS_WAIT_STATUS_COMPLETED; 2818 2782 } else { 2819 - spin_lock_irqsave(&interrupt->wait_list_lock, flags); 2820 - reinit_completion(&pend->fence.completion); 2821 2783 timeout = completion_rc; 2822 - 2823 - spin_unlock_irqrestore(&interrupt->wait_list_lock, flags); 2824 2784 goto wait_again; 2825 2785 } 2826 2786 } else if (completion_rc == -ERESTARTSYS) { ··· 2834 2802 list_del(&pend->wait_list_node); 2835 2803 spin_unlock_irqrestore(&interrupt->wait_list_lock, flags); 2836 2804 2837 - free_fence: 2838 2805 kfree(pend); 2839 2806 hl_ctx_put(ctx); 2840 2807
+7 -2
drivers/misc/habanalabs/common/hw_queue.c
··· 437 437 struct hl_cs_compl *cs_cmpl) 438 438 { 439 439 struct hl_cs_encaps_sig_handle *handle = cs->encaps_sig_hdl; 440 + u32 offset = 0; 440 441 441 442 cs_cmpl->hw_sob = handle->hw_sob; 442 443 ··· 447 446 * set offset 1 for example he mean to wait only for the first 448 447 * signal only, which will be pre_sob_val, and if he set offset 2 449 448 * then the value required is (pre_sob_val + 1) and so on... 449 + * if user set wait offset to 0, then treat it as legacy wait cs, 450 + * wait for the next signal. 450 451 */ 451 - cs_cmpl->sob_val = handle->pre_sob_val + 452 - (job->encaps_sig_wait_offset - 1); 452 + if (job->encaps_sig_wait_offset) 453 + offset = job->encaps_sig_wait_offset - 1; 454 + 455 + cs_cmpl->sob_val = handle->pre_sob_val + offset; 453 456 } 454 457 455 458 static int init_wait_cs(struct hl_device *hdev, struct hl_cs *cs,
+7 -4
drivers/misc/habanalabs/gaudi/gaudi.c
··· 395 395 396 396 static struct hl_hw_obj_name_entry gaudi_monitor_id_to_str[] = { 397 397 { .id = 200, .name = "MON_OBJ_DMA_DOWN_FEEDBACK_RESET" }, 398 - { .id = 201, .name = "MON_OBJ_DMA_UP_FEADBACK_RESET" }, 398 + { .id = 201, .name = "MON_OBJ_DMA_UP_FEEDBACK_RESET" }, 399 399 { .id = 203, .name = "MON_OBJ_DRAM_TO_SRAM_QUEUE_FENCE" }, 400 400 { .id = 204, .name = "MON_OBJ_TPC_0_CLK_GATE" }, 401 401 { .id = 205, .name = "MON_OBJ_TPC_1_CLK_GATE" }, ··· 5802 5802 { 5803 5803 struct gaudi_device *gaudi = hdev->asic_specific; 5804 5804 struct packet_msg_prot *cq_pkt; 5805 + u64 msi_addr; 5805 5806 u32 tmp; 5806 5807 5807 5808 cq_pkt = kernel_address + len - (sizeof(struct packet_msg_prot) * 2); ··· 5824 5823 cq_pkt->ctl = cpu_to_le32(tmp); 5825 5824 cq_pkt->value = cpu_to_le32(1); 5826 5825 5827 - if (!gaudi->multi_msi_mode) 5828 - msi_vec = 0; 5826 + if (gaudi->multi_msi_mode) 5827 + msi_addr = mmPCIE_MSI_INTR_0 + msi_vec * 4; 5828 + else 5829 + msi_addr = mmPCIE_CORE_MSI_REQ; 5829 5830 5830 - cq_pkt->addr = cpu_to_le64(CFG_BASE + mmPCIE_MSI_INTR_0 + msi_vec * 4); 5831 + cq_pkt->addr = cpu_to_le64(CFG_BASE + msi_addr); 5831 5832 } 5832 5833 5833 5834 static void gaudi_update_eq_ci(struct hl_device *hdev, u32 val)
+67 -48
drivers/misc/habanalabs/gaudi/gaudi_security.c
··· 8 8 #include "gaudiP.h" 9 9 #include "../include/gaudi/asic_reg/gaudi_regs.h" 10 10 11 - #define GAUDI_NUMBER_OF_RR_REGS 24 12 - #define GAUDI_NUMBER_OF_LBW_RANGES 12 11 + #define GAUDI_NUMBER_OF_LBW_RR_REGS 28 12 + #define GAUDI_NUMBER_OF_HBW_RR_REGS 24 13 + #define GAUDI_NUMBER_OF_LBW_RANGES 10 13 14 14 - static u64 gaudi_rr_lbw_hit_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { 15 + static u64 gaudi_rr_lbw_hit_aw_regs[GAUDI_NUMBER_OF_LBW_RR_REGS] = { 16 + mmDMA_IF_W_S_SOB_HIT_WPROT, 15 17 mmDMA_IF_W_S_DMA0_HIT_WPROT, 16 18 mmDMA_IF_W_S_DMA1_HIT_WPROT, 19 + mmDMA_IF_E_S_SOB_HIT_WPROT, 17 20 mmDMA_IF_E_S_DMA0_HIT_WPROT, 18 21 mmDMA_IF_E_S_DMA1_HIT_WPROT, 22 + mmDMA_IF_W_N_SOB_HIT_WPROT, 19 23 mmDMA_IF_W_N_DMA0_HIT_WPROT, 20 24 mmDMA_IF_W_N_DMA1_HIT_WPROT, 25 + mmDMA_IF_E_N_SOB_HIT_WPROT, 21 26 mmDMA_IF_E_N_DMA0_HIT_WPROT, 22 27 mmDMA_IF_E_N_DMA1_HIT_WPROT, 23 28 mmSIF_RTR_0_LBW_RANGE_PROT_HIT_AW, ··· 43 38 mmNIF_RTR_7_LBW_RANGE_PROT_HIT_AW, 44 39 }; 45 40 46 - static u64 gaudi_rr_lbw_hit_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { 41 + static u64 gaudi_rr_lbw_hit_ar_regs[GAUDI_NUMBER_OF_LBW_RR_REGS] = { 42 + mmDMA_IF_W_S_SOB_HIT_RPROT, 47 43 mmDMA_IF_W_S_DMA0_HIT_RPROT, 48 44 mmDMA_IF_W_S_DMA1_HIT_RPROT, 45 + mmDMA_IF_E_S_SOB_HIT_RPROT, 49 46 mmDMA_IF_E_S_DMA0_HIT_RPROT, 50 47 mmDMA_IF_E_S_DMA1_HIT_RPROT, 48 + mmDMA_IF_W_N_SOB_HIT_RPROT, 51 49 mmDMA_IF_W_N_DMA0_HIT_RPROT, 52 50 mmDMA_IF_W_N_DMA1_HIT_RPROT, 51 + mmDMA_IF_E_N_SOB_HIT_RPROT, 53 52 mmDMA_IF_E_N_DMA0_HIT_RPROT, 54 53 mmDMA_IF_E_N_DMA1_HIT_RPROT, 55 54 mmSIF_RTR_0_LBW_RANGE_PROT_HIT_AR, ··· 74 65 mmNIF_RTR_7_LBW_RANGE_PROT_HIT_AR, 75 66 }; 76 67 77 - static u64 gaudi_rr_lbw_min_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { 68 + static u64 gaudi_rr_lbw_min_aw_regs[GAUDI_NUMBER_OF_LBW_RR_REGS] = { 69 + mmDMA_IF_W_S_SOB_MIN_WPROT_0, 78 70 mmDMA_IF_W_S_DMA0_MIN_WPROT_0, 79 71 mmDMA_IF_W_S_DMA1_MIN_WPROT_0, 72 + mmDMA_IF_E_S_SOB_MIN_WPROT_0, 80 73 mmDMA_IF_E_S_DMA0_MIN_WPROT_0, 81 74 mmDMA_IF_E_S_DMA1_MIN_WPROT_0, 75 + mmDMA_IF_W_N_SOB_MIN_WPROT_0, 82 76 mmDMA_IF_W_N_DMA0_MIN_WPROT_0, 83 77 mmDMA_IF_W_N_DMA1_MIN_WPROT_0, 78 + mmDMA_IF_E_N_SOB_MIN_WPROT_0, 84 79 mmDMA_IF_E_N_DMA0_MIN_WPROT_0, 85 80 mmDMA_IF_E_N_DMA1_MIN_WPROT_0, 86 81 mmSIF_RTR_0_LBW_RANGE_PROT_MIN_AW_0, ··· 105 92 mmNIF_RTR_7_LBW_RANGE_PROT_MIN_AW_0, 106 93 }; 107 94 108 - static u64 gaudi_rr_lbw_max_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { 95 + static u64 gaudi_rr_lbw_max_aw_regs[GAUDI_NUMBER_OF_LBW_RR_REGS] = { 96 + mmDMA_IF_W_S_SOB_MAX_WPROT_0, 109 97 mmDMA_IF_W_S_DMA0_MAX_WPROT_0, 110 98 mmDMA_IF_W_S_DMA1_MAX_WPROT_0, 99 + mmDMA_IF_E_S_SOB_MAX_WPROT_0, 111 100 mmDMA_IF_E_S_DMA0_MAX_WPROT_0, 112 101 mmDMA_IF_E_S_DMA1_MAX_WPROT_0, 102 + mmDMA_IF_W_N_SOB_MAX_WPROT_0, 113 103 mmDMA_IF_W_N_DMA0_MAX_WPROT_0, 114 104 mmDMA_IF_W_N_DMA1_MAX_WPROT_0, 105 + mmDMA_IF_E_N_SOB_MAX_WPROT_0, 115 106 mmDMA_IF_E_N_DMA0_MAX_WPROT_0, 116 107 mmDMA_IF_E_N_DMA1_MAX_WPROT_0, 117 108 mmSIF_RTR_0_LBW_RANGE_PROT_MAX_AW_0, ··· 136 119 mmNIF_RTR_7_LBW_RANGE_PROT_MAX_AW_0, 137 120 }; 138 121 139 - static u64 gaudi_rr_lbw_min_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { 122 + static u64 gaudi_rr_lbw_min_ar_regs[GAUDI_NUMBER_OF_LBW_RR_REGS] = { 123 + mmDMA_IF_W_S_SOB_MIN_RPROT_0, 140 124 mmDMA_IF_W_S_DMA0_MIN_RPROT_0, 141 125 mmDMA_IF_W_S_DMA1_MIN_RPROT_0, 126 + mmDMA_IF_E_S_SOB_MIN_RPROT_0, 142 127 mmDMA_IF_E_S_DMA0_MIN_RPROT_0, 143 128 mmDMA_IF_E_S_DMA1_MIN_RPROT_0, 129 + mmDMA_IF_W_N_SOB_MIN_RPROT_0, 144 130 mmDMA_IF_W_N_DMA0_MIN_RPROT_0, 145 131 mmDMA_IF_W_N_DMA1_MIN_RPROT_0, 132 + mmDMA_IF_E_N_SOB_MIN_RPROT_0, 146 133 mmDMA_IF_E_N_DMA0_MIN_RPROT_0, 147 134 mmDMA_IF_E_N_DMA1_MIN_RPROT_0, 148 135 mmSIF_RTR_0_LBW_RANGE_PROT_MIN_AR_0, ··· 167 146 mmNIF_RTR_7_LBW_RANGE_PROT_MIN_AR_0, 168 147 }; 169 148 170 - static u64 gaudi_rr_lbw_max_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { 149 + static u64 gaudi_rr_lbw_max_ar_regs[GAUDI_NUMBER_OF_LBW_RR_REGS] = { 150 + mmDMA_IF_W_S_SOB_MAX_RPROT_0, 171 151 mmDMA_IF_W_S_DMA0_MAX_RPROT_0, 172 152 mmDMA_IF_W_S_DMA1_MAX_RPROT_0, 153 + mmDMA_IF_E_S_SOB_MAX_RPROT_0, 173 154 mmDMA_IF_E_S_DMA0_MAX_RPROT_0, 174 155 mmDMA_IF_E_S_DMA1_MAX_RPROT_0, 156 + mmDMA_IF_W_N_SOB_MAX_RPROT_0, 175 157 mmDMA_IF_W_N_DMA0_MAX_RPROT_0, 176 158 mmDMA_IF_W_N_DMA1_MAX_RPROT_0, 159 + mmDMA_IF_E_N_SOB_MAX_RPROT_0, 177 160 mmDMA_IF_E_N_DMA0_MAX_RPROT_0, 178 161 mmDMA_IF_E_N_DMA1_MAX_RPROT_0, 179 162 mmSIF_RTR_0_LBW_RANGE_PROT_MAX_AR_0, ··· 198 173 mmNIF_RTR_7_LBW_RANGE_PROT_MAX_AR_0, 199 174 }; 200 175 201 - static u64 gaudi_rr_hbw_hit_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { 176 + static u64 gaudi_rr_hbw_hit_aw_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { 202 177 mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_HIT_AW, 203 178 mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_HIT_AW, 204 179 mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_HIT_AW, ··· 225 200 mmNIF_RTR_CTRL_7_RANGE_SEC_HIT_AW 226 201 }; 227 202 228 - static u64 gaudi_rr_hbw_hit_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { 203 + static u64 gaudi_rr_hbw_hit_ar_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { 229 204 mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_HIT_AR, 230 205 mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_HIT_AR, 231 206 mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_HIT_AR, ··· 252 227 mmNIF_RTR_CTRL_7_RANGE_SEC_HIT_AR 253 228 }; 254 229 255 - static u64 gaudi_rr_hbw_base_low_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { 230 + static u64 gaudi_rr_hbw_base_low_aw_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { 256 231 mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_BASE_LOW_AW_0, 257 232 mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_BASE_LOW_AW_0, 258 233 mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_BASE_LOW_AW_0, ··· 279 254 mmNIF_RTR_CTRL_7_RANGE_SEC_BASE_LOW_AW_0 280 255 }; 281 256 282 - static u64 gaudi_rr_hbw_base_high_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { 257 + static u64 gaudi_rr_hbw_base_high_aw_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { 283 258 mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_BASE_HIGH_AW_0, 284 259 mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_BASE_HIGH_AW_0, 285 260 mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_BASE_HIGH_AW_0, ··· 306 281 mmNIF_RTR_CTRL_7_RANGE_SEC_BASE_HIGH_AW_0 307 282 }; 308 283 309 - static u64 gaudi_rr_hbw_mask_low_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { 284 + static u64 gaudi_rr_hbw_mask_low_aw_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { 310 285 mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_MASK_LOW_AW_0, 311 286 mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_MASK_LOW_AW_0, 312 287 mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_MASK_LOW_AW_0, ··· 333 308 mmNIF_RTR_CTRL_7_RANGE_SEC_MASK_LOW_AW_0 334 309 }; 335 310 336 - static u64 gaudi_rr_hbw_mask_high_aw_regs[GAUDI_NUMBER_OF_RR_REGS] = { 311 + static u64 gaudi_rr_hbw_mask_high_aw_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { 337 312 mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_MASK_HIGH_AW_0, 338 313 mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_MASK_HIGH_AW_0, 339 314 mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_MASK_HIGH_AW_0, ··· 360 335 mmNIF_RTR_CTRL_7_RANGE_SEC_MASK_HIGH_AW_0 361 336 }; 362 337 363 - static u64 gaudi_rr_hbw_base_low_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { 338 + static u64 gaudi_rr_hbw_base_low_ar_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { 364 339 mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_BASE_LOW_AR_0, 365 340 mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_BASE_LOW_AR_0, 366 341 mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_BASE_LOW_AR_0, ··· 387 362 mmNIF_RTR_CTRL_7_RANGE_SEC_BASE_LOW_AR_0 388 363 }; 389 364 390 - static u64 gaudi_rr_hbw_base_high_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { 365 + static u64 gaudi_rr_hbw_base_high_ar_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { 391 366 mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_BASE_HIGH_AR_0, 392 367 mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_BASE_HIGH_AR_0, 393 368 mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_BASE_HIGH_AR_0, ··· 414 389 mmNIF_RTR_CTRL_7_RANGE_SEC_BASE_HIGH_AR_0 415 390 }; 416 391 417 - static u64 gaudi_rr_hbw_mask_low_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { 392 + static u64 gaudi_rr_hbw_mask_low_ar_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { 418 393 mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_MASK_LOW_AR_0, 419 394 mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_MASK_LOW_AR_0, 420 395 mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_MASK_LOW_AR_0, ··· 441 416 mmNIF_RTR_CTRL_7_RANGE_SEC_MASK_LOW_AR_0 442 417 }; 443 418 444 - static u64 gaudi_rr_hbw_mask_high_ar_regs[GAUDI_NUMBER_OF_RR_REGS] = { 419 + static u64 gaudi_rr_hbw_mask_high_ar_regs[GAUDI_NUMBER_OF_HBW_RR_REGS] = { 445 420 mmDMA_IF_W_S_DOWN_CH0_RANGE_SEC_MASK_HIGH_AR_0, 446 421 mmDMA_IF_W_S_DOWN_CH1_RANGE_SEC_MASK_HIGH_AR_0, 447 422 mmDMA_IF_E_S_DOWN_CH0_RANGE_SEC_MASK_HIGH_AR_0, ··· 12874 12849 u32 lbw_rng_end[GAUDI_NUMBER_OF_LBW_RANGES]; 12875 12850 int i, j; 12876 12851 12877 - lbw_rng_start[0] = (0xFBFE0000 & 0x3FFFFFF) - 1; 12878 - lbw_rng_end[0] = (0xFBFFF000 & 0x3FFFFFF) + 1; 12852 + lbw_rng_start[0] = (0xFC0E8000 & 0x3FFFFFF) - 1; /* 0x000E7FFF */ 12853 + lbw_rng_end[0] = (0xFC11FFFF & 0x3FFFFFF) + 1; /* 0x00120000 */ 12879 12854 12880 - lbw_rng_start[1] = (0xFC0E8000 & 0x3FFFFFF) - 1; 12881 - lbw_rng_end[1] = (0xFC120000 & 0x3FFFFFF) + 1; 12855 + lbw_rng_start[1] = (0xFC1E8000 & 0x3FFFFFF) - 1; /* 0x001E7FFF */ 12856 + lbw_rng_end[1] = (0xFC48FFFF & 0x3FFFFFF) + 1; /* 0x00490000 */ 12882 12857 12883 - lbw_rng_start[2] = (0xFC1E8000 & 0x3FFFFFF) - 1; 12884 - lbw_rng_end[2] = (0xFC48FFFF & 0x3FFFFFF) + 1; 12858 + lbw_rng_start[2] = (0xFC600000 & 0x3FFFFFF) - 1; /* 0x005FFFFF */ 12859 + lbw_rng_end[2] = (0xFCC48FFF & 0x3FFFFFF) + 1; /* 0x00C49000 */ 12885 12860 12886 - lbw_rng_start[3] = (0xFC600000 & 0x3FFFFFF) - 1; 12887 - lbw_rng_end[3] = (0xFCC48FFF & 0x3FFFFFF) + 1; 12861 + lbw_rng_start[3] = (0xFCC4A000 & 0x3FFFFFF) - 1; /* 0x00C49FFF */ 12862 + lbw_rng_end[3] = (0xFCCDFFFF & 0x3FFFFFF) + 1; /* 0x00CE0000 */ 12888 12863 12889 - lbw_rng_start[4] = (0xFCC4A000 & 0x3FFFFFF) - 1; 12890 - lbw_rng_end[4] = (0xFCCDFFFF & 0x3FFFFFF) + 1; 12864 + lbw_rng_start[4] = (0xFCCE4000 & 0x3FFFFFF) - 1; /* 0x00CE3FFF */ 12865 + lbw_rng_end[4] = (0xFCD1FFFF & 0x3FFFFFF) + 1; /* 0x00D20000 */ 12891 12866 12892 - lbw_rng_start[5] = (0xFCCE4000 & 0x3FFFFFF) - 1; 12893 - lbw_rng_end[5] = (0xFCD1FFFF & 0x3FFFFFF) + 1; 12867 + lbw_rng_start[5] = (0xFCD24000 & 0x3FFFFFF) - 1; /* 0x00D23FFF */ 12868 + lbw_rng_end[5] = (0xFCD5FFFF & 0x3FFFFFF) + 1; /* 0x00D60000 */ 12894 12869 12895 - lbw_rng_start[6] = (0xFCD24000 & 0x3FFFFFF) - 1; 12896 - lbw_rng_end[6] = (0xFCD5FFFF & 0x3FFFFFF) + 1; 12870 + lbw_rng_start[6] = (0xFCD64000 & 0x3FFFFFF) - 1; /* 0x00D63FFF */ 12871 + lbw_rng_end[6] = (0xFCD9FFFF & 0x3FFFFFF) + 1; /* 0x00DA0000 */ 12897 12872 12898 - lbw_rng_start[7] = (0xFCD64000 & 0x3FFFFFF) - 1; 12899 - lbw_rng_end[7] = (0xFCD9FFFF & 0x3FFFFFF) + 1; 12873 + lbw_rng_start[7] = (0xFCDA4000 & 0x3FFFFFF) - 1; /* 0x00DA3FFF */ 12874 + lbw_rng_end[7] = (0xFCDDFFFF & 0x3FFFFFF) + 1; /* 0x00DE0000 */ 12900 12875 12901 - lbw_rng_start[8] = (0xFCDA4000 & 0x3FFFFFF) - 1; 12902 - lbw_rng_end[8] = (0xFCDDFFFF & 0x3FFFFFF) + 1; 12876 + lbw_rng_start[8] = (0xFCDE4000 & 0x3FFFFFF) - 1; /* 0x00DE3FFF */ 12877 + lbw_rng_end[8] = (0xFCE05FFF & 0x3FFFFFF) + 1; /* 0x00E06000 */ 12903 12878 12904 - lbw_rng_start[9] = (0xFCDE4000 & 0x3FFFFFF) - 1; 12905 - lbw_rng_end[9] = (0xFCE05FFF & 0x3FFFFFF) + 1; 12879 + lbw_rng_start[9] = (0xFCFC9000 & 0x3FFFFFF) - 1; /* 0x00FC8FFF */ 12880 + lbw_rng_end[9] = (0xFFFFFFFE & 0x3FFFFFF) + 1; /* 0x03FFFFFF */ 12906 12881 12907 - lbw_rng_start[10] = (0xFEC43000 & 0x3FFFFFF) - 1; 12908 - lbw_rng_end[10] = (0xFEC43FFF & 0x3FFFFFF) + 1; 12909 - 12910 - lbw_rng_start[11] = (0xFE484000 & 0x3FFFFFF) - 1; 12911 - lbw_rng_end[11] = (0xFE484FFF & 0x3FFFFFF) + 1; 12912 - 12913 - for (i = 0 ; i < GAUDI_NUMBER_OF_RR_REGS ; i++) { 12882 + for (i = 0 ; i < GAUDI_NUMBER_OF_LBW_RR_REGS ; i++) { 12914 12883 WREG32(gaudi_rr_lbw_hit_aw_regs[i], 12915 12884 (1 << GAUDI_NUMBER_OF_LBW_RANGES) - 1); 12916 12885 WREG32(gaudi_rr_lbw_hit_ar_regs[i], 12917 12886 (1 << GAUDI_NUMBER_OF_LBW_RANGES) - 1); 12918 12887 } 12919 12888 12920 - for (i = 0 ; i < GAUDI_NUMBER_OF_RR_REGS ; i++) 12889 + for (i = 0 ; i < GAUDI_NUMBER_OF_LBW_RR_REGS ; i++) 12921 12890 for (j = 0 ; j < GAUDI_NUMBER_OF_LBW_RANGES ; j++) { 12922 12891 WREG32(gaudi_rr_lbw_min_aw_regs[i] + (j << 2), 12923 12892 lbw_rng_start[j]); ··· 12958 12939 * 6th range is the host 12959 12940 */ 12960 12941 12961 - for (i = 0 ; i < GAUDI_NUMBER_OF_RR_REGS ; i++) { 12942 + for (i = 0 ; i < GAUDI_NUMBER_OF_HBW_RR_REGS ; i++) { 12962 12943 WREG32(gaudi_rr_hbw_hit_aw_regs[i], 0x1F); 12963 12944 WREG32(gaudi_rr_hbw_hit_ar_regs[i], 0x1D); 12964 12945 } 12965 12946 12966 - for (i = 0 ; i < GAUDI_NUMBER_OF_RR_REGS ; i++) { 12947 + for (i = 0 ; i < GAUDI_NUMBER_OF_HBW_RR_REGS ; i++) { 12967 12948 WREG32(gaudi_rr_hbw_base_low_aw_regs[i], dram_addr_lo); 12968 12949 WREG32(gaudi_rr_hbw_base_low_ar_regs[i], dram_addr_lo); 12969 12950
+2
drivers/misc/habanalabs/include/gaudi/asic_reg/gaudi_regs.h
··· 308 308 #define mmPCIE_AUX_FLR_CTRL 0xC07394 309 309 #define mmPCIE_AUX_DBI 0xC07490 310 310 311 + #define mmPCIE_CORE_MSI_REQ 0xC04100 312 + 311 313 #define mmPSOC_PCI_PLL_NR 0xC72100 312 314 #define mmSRAM_W_PLL_NR 0x4C8100 313 315 #define mmPSOC_HBM_PLL_NR 0xC74100
+19 -2
drivers/net/dsa/b53/b53_mdio.c
··· 351 351 static void b53_mdio_remove(struct mdio_device *mdiodev) 352 352 { 353 353 struct b53_device *dev = dev_get_drvdata(&mdiodev->dev); 354 - struct dsa_switch *ds = dev->ds; 355 354 356 - dsa_unregister_switch(ds); 355 + if (!dev) 356 + return; 357 + 358 + b53_switch_remove(dev); 359 + 360 + dev_set_drvdata(&mdiodev->dev, NULL); 361 + } 362 + 363 + static void b53_mdio_shutdown(struct mdio_device *mdiodev) 364 + { 365 + struct b53_device *dev = dev_get_drvdata(&mdiodev->dev); 366 + 367 + if (!dev) 368 + return; 369 + 370 + b53_switch_shutdown(dev); 371 + 372 + dev_set_drvdata(&mdiodev->dev, NULL); 357 373 } 358 374 359 375 static const struct of_device_id b53_of_match[] = { ··· 389 373 static struct mdio_driver b53_mdio_driver = { 390 374 .probe = b53_mdio_probe, 391 375 .remove = b53_mdio_remove, 376 + .shutdown = b53_mdio_shutdown, 392 377 .mdiodrv.driver = { 393 378 .name = "bcm53xx", 394 379 .of_match_table = b53_of_match,
+13
drivers/net/dsa/b53/b53_mmap.c
··· 316 316 if (dev) 317 317 b53_switch_remove(dev); 318 318 319 + platform_set_drvdata(pdev, NULL); 320 + 319 321 return 0; 322 + } 323 + 324 + static void b53_mmap_shutdown(struct platform_device *pdev) 325 + { 326 + struct b53_device *dev = platform_get_drvdata(pdev); 327 + 328 + if (dev) 329 + b53_switch_shutdown(dev); 330 + 331 + platform_set_drvdata(pdev, NULL); 320 332 } 321 333 322 334 static const struct of_device_id b53_mmap_of_table[] = { ··· 343 331 static struct platform_driver b53_mmap_driver = { 344 332 .probe = b53_mmap_probe, 345 333 .remove = b53_mmap_remove, 334 + .shutdown = b53_mmap_shutdown, 346 335 .driver = { 347 336 .name = "b53-switch", 348 337 .of_match_table = b53_mmap_of_table,
+5
drivers/net/dsa/b53/b53_priv.h
··· 228 228 dsa_unregister_switch(dev->ds); 229 229 } 230 230 231 + static inline void b53_switch_shutdown(struct b53_device *dev) 232 + { 233 + dsa_switch_shutdown(dev->ds); 234 + } 235 + 231 236 #define b53_build_op(type_op_size, val_type) \ 232 237 static inline int b53_##type_op_size(struct b53_device *dev, u8 page, \ 233 238 u8 reg, val_type val) \
+13
drivers/net/dsa/b53/b53_spi.c
··· 321 321 if (dev) 322 322 b53_switch_remove(dev); 323 323 324 + spi_set_drvdata(spi, NULL); 325 + 324 326 return 0; 327 + } 328 + 329 + static void b53_spi_shutdown(struct spi_device *spi) 330 + { 331 + struct b53_device *dev = spi_get_drvdata(spi); 332 + 333 + if (dev) 334 + b53_switch_shutdown(dev); 335 + 336 + spi_set_drvdata(spi, NULL); 325 337 } 326 338 327 339 static const struct of_device_id b53_spi_of_match[] = { ··· 356 344 }, 357 345 .probe = b53_spi_probe, 358 346 .remove = b53_spi_remove, 347 + .shutdown = b53_spi_shutdown, 359 348 }; 360 349 361 350 module_spi_driver(b53_spi_driver);
+19 -2
drivers/net/dsa/b53/b53_srab.c
··· 629 629 static int b53_srab_remove(struct platform_device *pdev) 630 630 { 631 631 struct b53_device *dev = platform_get_drvdata(pdev); 632 - struct b53_srab_priv *priv = dev->priv; 633 632 634 - b53_srab_intr_set(priv, false); 633 + if (!dev) 634 + return 0; 635 + 636 + b53_srab_intr_set(dev->priv, false); 635 637 b53_switch_remove(dev); 636 638 639 + platform_set_drvdata(pdev, NULL); 640 + 637 641 return 0; 642 + } 643 + 644 + static void b53_srab_shutdown(struct platform_device *pdev) 645 + { 646 + struct b53_device *dev = platform_get_drvdata(pdev); 647 + 648 + if (!dev) 649 + return; 650 + 651 + b53_switch_shutdown(dev); 652 + 653 + platform_set_drvdata(pdev, NULL); 638 654 } 639 655 640 656 static struct platform_driver b53_srab_driver = { 641 657 .probe = b53_srab_probe, 642 658 .remove = b53_srab_remove, 659 + .shutdown = b53_srab_shutdown, 643 660 .driver = { 644 661 .name = "b53-srab-switch", 645 662 .of_match_table = b53_srab_of_match,
+13 -1
drivers/net/dsa/bcm_sf2.c
··· 68 68 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); 69 69 unsigned int port, count = 0; 70 70 71 - for (port = 0; port < ARRAY_SIZE(priv->port_sts); port++) { 71 + for (port = 0; port < ds->num_ports; port++) { 72 72 if (dsa_is_cpu_port(ds, port)) 73 73 continue; 74 74 if (priv->port_sts[port].enabled) ··· 1512 1512 { 1513 1513 struct bcm_sf2_priv *priv = platform_get_drvdata(pdev); 1514 1514 1515 + if (!priv) 1516 + return 0; 1517 + 1515 1518 priv->wol_ports_mask = 0; 1516 1519 /* Disable interrupts */ 1517 1520 bcm_sf2_intr_disable(priv); ··· 1526 1523 if (priv->type == BCM7278_DEVICE_ID) 1527 1524 reset_control_assert(priv->rcdev); 1528 1525 1526 + platform_set_drvdata(pdev, NULL); 1527 + 1529 1528 return 0; 1530 1529 } 1531 1530 1532 1531 static void bcm_sf2_sw_shutdown(struct platform_device *pdev) 1533 1532 { 1534 1533 struct bcm_sf2_priv *priv = platform_get_drvdata(pdev); 1534 + 1535 + if (!priv) 1536 + return; 1535 1537 1536 1538 /* For a kernel about to be kexec'd we want to keep the GPHY on for a 1537 1539 * successful MDIO bus scan to occur. If we did turn off the GPHY ··· 1546 1538 */ 1547 1539 if (priv->hw_params.num_gphy == 1) 1548 1540 bcm_sf2_gphy_enable_set(priv->dev->ds, true); 1541 + 1542 + dsa_switch_shutdown(priv->dev->ds); 1543 + 1544 + platform_set_drvdata(pdev, NULL); 1549 1545 } 1550 1546 1551 1547 #ifdef CONFIG_PM_SLEEP
+21 -1
drivers/net/dsa/dsa_loop.c
··· 340 340 static void dsa_loop_drv_remove(struct mdio_device *mdiodev) 341 341 { 342 342 struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev); 343 - struct dsa_loop_priv *ps = ds->priv; 343 + struct dsa_loop_priv *ps; 344 + 345 + if (!ds) 346 + return; 347 + 348 + ps = ds->priv; 344 349 345 350 dsa_unregister_switch(ds); 346 351 dev_put(ps->netdev); 352 + 353 + dev_set_drvdata(&mdiodev->dev, NULL); 354 + } 355 + 356 + static void dsa_loop_drv_shutdown(struct mdio_device *mdiodev) 357 + { 358 + struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev); 359 + 360 + if (!ds) 361 + return; 362 + 363 + dsa_switch_shutdown(ds); 364 + 365 + dev_set_drvdata(&mdiodev->dev, NULL); 347 366 } 348 367 349 368 static struct mdio_driver dsa_loop_drv = { ··· 371 352 }, 372 353 .probe = dsa_loop_drv_probe, 373 354 .remove = dsa_loop_drv_remove, 355 + .shutdown = dsa_loop_drv_shutdown, 374 356 }; 375 357 376 358 #define NUM_FIXED_PHYS (DSA_LOOP_NUM_PORTS - 2)
+16
drivers/net/dsa/hirschmann/hellcreek.c
··· 1916 1916 { 1917 1917 struct hellcreek *hellcreek = platform_get_drvdata(pdev); 1918 1918 1919 + if (!hellcreek) 1920 + return 0; 1921 + 1919 1922 hellcreek_hwtstamp_free(hellcreek); 1920 1923 hellcreek_ptp_free(hellcreek); 1921 1924 dsa_unregister_switch(hellcreek->ds); 1922 1925 platform_set_drvdata(pdev, NULL); 1923 1926 1924 1927 return 0; 1928 + } 1929 + 1930 + static void hellcreek_shutdown(struct platform_device *pdev) 1931 + { 1932 + struct hellcreek *hellcreek = platform_get_drvdata(pdev); 1933 + 1934 + if (!hellcreek) 1935 + return; 1936 + 1937 + dsa_switch_shutdown(hellcreek->ds); 1938 + 1939 + platform_set_drvdata(pdev, NULL); 1925 1940 } 1926 1941 1927 1942 static const struct hellcreek_platform_data de1soc_r1_pdata = { ··· 1961 1946 static struct platform_driver hellcreek_driver = { 1962 1947 .probe = hellcreek_probe, 1963 1948 .remove = hellcreek_remove, 1949 + .shutdown = hellcreek_shutdown, 1964 1950 .driver = { 1965 1951 .name = "hellcreek", 1966 1952 .of_match_table = hellcreek_of_match,
+6
drivers/net/dsa/lan9303-core.c
··· 1379 1379 } 1380 1380 EXPORT_SYMBOL(lan9303_remove); 1381 1381 1382 + void lan9303_shutdown(struct lan9303 *chip) 1383 + { 1384 + dsa_switch_shutdown(chip->ds); 1385 + } 1386 + EXPORT_SYMBOL(lan9303_shutdown); 1387 + 1382 1388 MODULE_AUTHOR("Juergen Borleis <kernel@pengutronix.de>"); 1383 1389 MODULE_DESCRIPTION("Core driver for SMSC/Microchip LAN9303 three port ethernet switch"); 1384 1390 MODULE_LICENSE("GPL v2");
+1
drivers/net/dsa/lan9303.h
··· 10 10 11 11 int lan9303_probe(struct lan9303 *chip, struct device_node *np); 12 12 int lan9303_remove(struct lan9303 *chip); 13 + void lan9303_shutdown(struct lan9303 *chip);
+20 -4
drivers/net/dsa/lan9303_i2c.c
··· 67 67 68 68 static int lan9303_i2c_remove(struct i2c_client *client) 69 69 { 70 - struct lan9303_i2c *sw_dev; 70 + struct lan9303_i2c *sw_dev = i2c_get_clientdata(client); 71 71 72 - sw_dev = i2c_get_clientdata(client); 73 72 if (!sw_dev) 74 - return -ENODEV; 73 + return 0; 75 74 76 - return lan9303_remove(&sw_dev->chip); 75 + lan9303_remove(&sw_dev->chip); 76 + 77 + i2c_set_clientdata(client, NULL); 78 + 79 + return 0; 80 + } 81 + 82 + static void lan9303_i2c_shutdown(struct i2c_client *client) 83 + { 84 + struct lan9303_i2c *sw_dev = i2c_get_clientdata(client); 85 + 86 + if (!sw_dev) 87 + return; 88 + 89 + lan9303_shutdown(&sw_dev->chip); 90 + 91 + i2c_set_clientdata(client, NULL); 77 92 } 78 93 79 94 /*-------------------------------------------------------------------------*/ ··· 112 97 }, 113 98 .probe = lan9303_i2c_probe, 114 99 .remove = lan9303_i2c_remove, 100 + .shutdown = lan9303_i2c_shutdown, 115 101 .id_table = lan9303_i2c_id, 116 102 }; 117 103 module_i2c_driver(lan9303_i2c_driver);
+15
drivers/net/dsa/lan9303_mdio.c
··· 138 138 return; 139 139 140 140 lan9303_remove(&sw_dev->chip); 141 + 142 + dev_set_drvdata(&mdiodev->dev, NULL); 143 + } 144 + 145 + static void lan9303_mdio_shutdown(struct mdio_device *mdiodev) 146 + { 147 + struct lan9303_mdio *sw_dev = dev_get_drvdata(&mdiodev->dev); 148 + 149 + if (!sw_dev) 150 + return; 151 + 152 + lan9303_shutdown(&sw_dev->chip); 153 + 154 + dev_set_drvdata(&mdiodev->dev, NULL); 141 155 } 142 156 143 157 /*-------------------------------------------------------------------------*/ ··· 169 155 }, 170 156 .probe = lan9303_mdio_probe, 171 157 .remove = lan9303_mdio_remove, 158 + .shutdown = lan9303_mdio_shutdown, 172 159 }; 173 160 mdio_module_driver(lan9303_mdio_driver); 174 161
+18
drivers/net/dsa/lantiq_gswip.c
··· 2184 2184 struct gswip_priv *priv = platform_get_drvdata(pdev); 2185 2185 int i; 2186 2186 2187 + if (!priv) 2188 + return 0; 2189 + 2187 2190 /* disable the switch */ 2188 2191 gswip_mdio_mask(priv, GSWIP_MDIO_GLOB_ENABLE, 0, GSWIP_MDIO_GLOB); 2189 2192 ··· 2200 2197 for (i = 0; i < priv->num_gphy_fw; i++) 2201 2198 gswip_gphy_fw_remove(priv, &priv->gphy_fw[i]); 2202 2199 2200 + platform_set_drvdata(pdev, NULL); 2201 + 2203 2202 return 0; 2203 + } 2204 + 2205 + static void gswip_shutdown(struct platform_device *pdev) 2206 + { 2207 + struct gswip_priv *priv = platform_get_drvdata(pdev); 2208 + 2209 + if (!priv) 2210 + return; 2211 + 2212 + dsa_switch_shutdown(priv->ds); 2213 + 2214 + platform_set_drvdata(pdev, NULL); 2204 2215 } 2205 2216 2206 2217 static const struct gswip_hw_info gswip_xrx200 = { ··· 2240 2223 static struct platform_driver gswip_driver = { 2241 2224 .probe = gswip_probe, 2242 2225 .remove = gswip_remove, 2226 + .shutdown = gswip_shutdown, 2243 2227 .driver = { 2244 2228 .name = "gswip", 2245 2229 .of_match_table = gswip_of_match,
+10 -1
drivers/net/dsa/microchip/ksz8795_spi.c
··· 94 94 if (dev) 95 95 ksz_switch_remove(dev); 96 96 97 + spi_set_drvdata(spi, NULL); 98 + 97 99 return 0; 98 100 } 99 101 ··· 103 101 { 104 102 struct ksz_device *dev = spi_get_drvdata(spi); 105 103 106 - if (dev && dev->dev_ops->shutdown) 104 + if (!dev) 105 + return; 106 + 107 + if (dev->dev_ops->shutdown) 107 108 dev->dev_ops->shutdown(dev); 109 + 110 + dsa_switch_shutdown(dev->ds); 111 + 112 + spi_set_drvdata(spi, NULL); 108 113 } 109 114 110 115 static const struct of_device_id ksz8795_dt_ids[] = {
+13
drivers/net/dsa/microchip/ksz8863_smi.c
··· 191 191 192 192 if (dev) 193 193 ksz_switch_remove(dev); 194 + 195 + dev_set_drvdata(&mdiodev->dev, NULL); 196 + } 197 + 198 + static void ksz8863_smi_shutdown(struct mdio_device *mdiodev) 199 + { 200 + struct ksz_device *dev = dev_get_drvdata(&mdiodev->dev); 201 + 202 + if (dev) 203 + dsa_switch_shutdown(dev->ds); 204 + 205 + dev_set_drvdata(&mdiodev->dev, NULL); 194 206 } 195 207 196 208 static const struct of_device_id ksz8863_dt_ids[] = { ··· 215 203 static struct mdio_driver ksz8863_driver = { 216 204 .probe = ksz8863_smi_probe, 217 205 .remove = ksz8863_smi_remove, 206 + .shutdown = ksz8863_smi_shutdown, 218 207 .mdiodrv.driver = { 219 208 .name = "ksz8863-switch", 220 209 .of_match_table = ksz8863_dt_ids,
+12 -2
drivers/net/dsa/microchip/ksz9477_i2c.c
··· 56 56 { 57 57 struct ksz_device *dev = i2c_get_clientdata(i2c); 58 58 59 - ksz_switch_remove(dev); 59 + if (dev) 60 + ksz_switch_remove(dev); 61 + 62 + i2c_set_clientdata(i2c, NULL); 60 63 61 64 return 0; 62 65 } ··· 68 65 { 69 66 struct ksz_device *dev = i2c_get_clientdata(i2c); 70 67 71 - if (dev && dev->dev_ops->shutdown) 68 + if (!dev) 69 + return; 70 + 71 + if (dev->dev_ops->shutdown) 72 72 dev->dev_ops->shutdown(dev); 73 + 74 + dsa_switch_shutdown(dev->ds); 75 + 76 + i2c_set_clientdata(i2c, NULL); 73 77 } 74 78 75 79 static const struct i2c_device_id ksz9477_i2c_id[] = {
+6 -2
drivers/net/dsa/microchip/ksz9477_spi.c
··· 72 72 if (dev) 73 73 ksz_switch_remove(dev); 74 74 75 + spi_set_drvdata(spi, NULL); 76 + 75 77 return 0; 76 78 } 77 79 ··· 81 79 { 82 80 struct ksz_device *dev = spi_get_drvdata(spi); 83 81 84 - if (dev && dev->dev_ops->shutdown) 85 - dev->dev_ops->shutdown(dev); 82 + if (dev) 83 + dsa_switch_shutdown(dev->ds); 84 + 85 + spi_set_drvdata(spi, NULL); 86 86 } 87 87 88 88 static const struct of_device_id ksz9477_dt_ids[] = {
+18
drivers/net/dsa/mt7530.c
··· 3286 3286 struct mt7530_priv *priv = dev_get_drvdata(&mdiodev->dev); 3287 3287 int ret = 0; 3288 3288 3289 + if (!priv) 3290 + return; 3291 + 3289 3292 ret = regulator_disable(priv->core_pwr); 3290 3293 if (ret < 0) 3291 3294 dev_err(priv->dev, ··· 3304 3301 3305 3302 dsa_unregister_switch(priv->ds); 3306 3303 mutex_destroy(&priv->reg_mutex); 3304 + 3305 + dev_set_drvdata(&mdiodev->dev, NULL); 3306 + } 3307 + 3308 + static void mt7530_shutdown(struct mdio_device *mdiodev) 3309 + { 3310 + struct mt7530_priv *priv = dev_get_drvdata(&mdiodev->dev); 3311 + 3312 + if (!priv) 3313 + return; 3314 + 3315 + dsa_switch_shutdown(priv->ds); 3316 + 3317 + dev_set_drvdata(&mdiodev->dev, NULL); 3307 3318 } 3308 3319 3309 3320 static struct mdio_driver mt7530_mdio_driver = { 3310 3321 .probe = mt7530_probe, 3311 3322 .remove = mt7530_remove, 3323 + .shutdown = mt7530_shutdown, 3312 3324 .mdiodrv.driver = { 3313 3325 .name = "mt7530", 3314 3326 .of_match_table = mt7530_of_match,
+18
drivers/net/dsa/mv88e6060.c
··· 290 290 { 291 291 struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev); 292 292 293 + if (!ds) 294 + return; 295 + 293 296 dsa_unregister_switch(ds); 297 + 298 + dev_set_drvdata(&mdiodev->dev, NULL); 299 + } 300 + 301 + static void mv88e6060_shutdown(struct mdio_device *mdiodev) 302 + { 303 + struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev); 304 + 305 + if (!ds) 306 + return; 307 + 308 + dsa_switch_shutdown(ds); 309 + 310 + dev_set_drvdata(&mdiodev->dev, NULL); 294 311 } 295 312 296 313 static const struct of_device_id mv88e6060_of_match[] = { ··· 320 303 static struct mdio_driver mv88e6060_driver = { 321 304 .probe = mv88e6060_probe, 322 305 .remove = mv88e6060_remove, 306 + .shutdown = mv88e6060_shutdown, 323 307 .mdiodrv.driver = { 324 308 .name = "mv88e6060", 325 309 .of_match_table = mv88e6060_of_match,
+35 -3
drivers/net/dsa/mv88e6xxx/chip.c
··· 3071 3071 { 3072 3072 mv88e6xxx_teardown_devlink_params(ds); 3073 3073 dsa_devlink_resources_unregister(ds); 3074 - mv88e6xxx_teardown_devlink_regions(ds); 3074 + mv88e6xxx_teardown_devlink_regions_global(ds); 3075 3075 } 3076 3076 3077 3077 static int mv88e6xxx_setup(struct dsa_switch *ds) ··· 3215 3215 if (err) 3216 3216 goto out_resources; 3217 3217 3218 - err = mv88e6xxx_setup_devlink_regions(ds); 3218 + err = mv88e6xxx_setup_devlink_regions_global(ds); 3219 3219 if (err) 3220 3220 goto out_params; 3221 3221 ··· 3227 3227 dsa_devlink_resources_unregister(ds); 3228 3228 3229 3229 return err; 3230 + } 3231 + 3232 + static int mv88e6xxx_port_setup(struct dsa_switch *ds, int port) 3233 + { 3234 + return mv88e6xxx_setup_devlink_regions_port(ds, port); 3235 + } 3236 + 3237 + static void mv88e6xxx_port_teardown(struct dsa_switch *ds, int port) 3238 + { 3239 + mv88e6xxx_teardown_devlink_regions_port(ds, port); 3230 3240 } 3231 3241 3232 3242 /* prod_id for switch families which do not have a PHY model number */ ··· 6126 6116 .change_tag_protocol = mv88e6xxx_change_tag_protocol, 6127 6117 .setup = mv88e6xxx_setup, 6128 6118 .teardown = mv88e6xxx_teardown, 6119 + .port_setup = mv88e6xxx_port_setup, 6120 + .port_teardown = mv88e6xxx_port_teardown, 6129 6121 .phylink_validate = mv88e6xxx_validate, 6130 6122 .phylink_mac_link_state = mv88e6xxx_serdes_pcs_get_state, 6131 6123 .phylink_mac_config = mv88e6xxx_mac_config, ··· 6401 6389 static void mv88e6xxx_remove(struct mdio_device *mdiodev) 6402 6390 { 6403 6391 struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev); 6404 - struct mv88e6xxx_chip *chip = ds->priv; 6392 + struct mv88e6xxx_chip *chip; 6393 + 6394 + if (!ds) 6395 + return; 6396 + 6397 + chip = ds->priv; 6405 6398 6406 6399 if (chip->info->ptp_support) { 6407 6400 mv88e6xxx_hwtstamp_free(chip); ··· 6427 6410 mv88e6xxx_g1_irq_free(chip); 6428 6411 else 6429 6412 mv88e6xxx_irq_poll_free(chip); 6413 + 6414 + dev_set_drvdata(&mdiodev->dev, NULL); 6415 + } 6416 + 6417 + static void mv88e6xxx_shutdown(struct mdio_device *mdiodev) 6418 + { 6419 + struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev); 6420 + 6421 + if (!ds) 6422 + return; 6423 + 6424 + dsa_switch_shutdown(ds); 6425 + 6426 + dev_set_drvdata(&mdiodev->dev, NULL); 6430 6427 } 6431 6428 6432 6429 static const struct of_device_id mv88e6xxx_of_match[] = { ··· 6464 6433 static struct mdio_driver mv88e6xxx_driver = { 6465 6434 .probe = mv88e6xxx_probe, 6466 6435 .remove = mv88e6xxx_remove, 6436 + .shutdown = mv88e6xxx_shutdown, 6467 6437 .mdiodrv.driver = { 6468 6438 .name = "mv88e6085", 6469 6439 .of_match_table = mv88e6xxx_of_match,
+9 -64
drivers/net/dsa/mv88e6xxx/devlink.c
··· 647 647 }, 648 648 }; 649 649 650 - static void 651 - mv88e6xxx_teardown_devlink_regions_global(struct mv88e6xxx_chip *chip) 650 + void mv88e6xxx_teardown_devlink_regions_global(struct dsa_switch *ds) 652 651 { 652 + struct mv88e6xxx_chip *chip = ds->priv; 653 653 int i; 654 654 655 655 for (i = 0; i < ARRAY_SIZE(mv88e6xxx_regions); i++) 656 656 dsa_devlink_region_destroy(chip->regions[i]); 657 657 } 658 658 659 - static void 660 - mv88e6xxx_teardown_devlink_regions_port(struct mv88e6xxx_chip *chip, 661 - int port) 659 + void mv88e6xxx_teardown_devlink_regions_port(struct dsa_switch *ds, int port) 662 660 { 661 + struct mv88e6xxx_chip *chip = ds->priv; 662 + 663 663 dsa_devlink_region_destroy(chip->ports[port].region); 664 664 } 665 665 666 - static int mv88e6xxx_setup_devlink_regions_port(struct dsa_switch *ds, 667 - struct mv88e6xxx_chip *chip, 668 - int port) 666 + int mv88e6xxx_setup_devlink_regions_port(struct dsa_switch *ds, int port) 669 667 { 668 + struct mv88e6xxx_chip *chip = ds->priv; 670 669 struct devlink_region *region; 671 670 672 671 region = dsa_devlink_port_region_create(ds, ··· 680 681 return 0; 681 682 } 682 683 683 - static void 684 - mv88e6xxx_teardown_devlink_regions_ports(struct mv88e6xxx_chip *chip) 685 - { 686 - int port; 687 - 688 - for (port = 0; port < mv88e6xxx_num_ports(chip); port++) 689 - mv88e6xxx_teardown_devlink_regions_port(chip, port); 690 - } 691 - 692 - static int mv88e6xxx_setup_devlink_regions_ports(struct dsa_switch *ds, 693 - struct mv88e6xxx_chip *chip) 694 - { 695 - int port; 696 - int err; 697 - 698 - for (port = 0; port < mv88e6xxx_num_ports(chip); port++) { 699 - err = mv88e6xxx_setup_devlink_regions_port(ds, chip, port); 700 - if (err) 701 - goto out; 702 - } 703 - 704 - return 0; 705 - 706 - out: 707 - while (port-- > 0) 708 - mv88e6xxx_teardown_devlink_regions_port(chip, port); 709 - 710 - return err; 711 - } 712 - 713 - static int mv88e6xxx_setup_devlink_regions_global(struct dsa_switch *ds, 714 - struct mv88e6xxx_chip *chip) 684 + int mv88e6xxx_setup_devlink_regions_global(struct dsa_switch *ds) 715 685 { 716 686 bool (*cond)(struct mv88e6xxx_chip *chip); 687 + struct mv88e6xxx_chip *chip = ds->priv; 717 688 struct devlink_region_ops *ops; 718 689 struct devlink_region *region; 719 690 u64 size; ··· 720 751 dsa_devlink_region_destroy(chip->regions[j]); 721 752 722 753 return PTR_ERR(region); 723 - } 724 - 725 - int mv88e6xxx_setup_devlink_regions(struct dsa_switch *ds) 726 - { 727 - struct mv88e6xxx_chip *chip = ds->priv; 728 - int err; 729 - 730 - err = mv88e6xxx_setup_devlink_regions_global(ds, chip); 731 - if (err) 732 - return err; 733 - 734 - err = mv88e6xxx_setup_devlink_regions_ports(ds, chip); 735 - if (err) 736 - mv88e6xxx_teardown_devlink_regions_global(chip); 737 - 738 - return err; 739 - } 740 - 741 - void mv88e6xxx_teardown_devlink_regions(struct dsa_switch *ds) 742 - { 743 - struct mv88e6xxx_chip *chip = ds->priv; 744 - 745 - mv88e6xxx_teardown_devlink_regions_ports(chip); 746 - mv88e6xxx_teardown_devlink_regions_global(chip); 747 754 } 748 755 749 756 int mv88e6xxx_devlink_info_get(struct dsa_switch *ds,
+4 -2
drivers/net/dsa/mv88e6xxx/devlink.h
··· 12 12 struct devlink_param_gset_ctx *ctx); 13 13 int mv88e6xxx_devlink_param_set(struct dsa_switch *ds, u32 id, 14 14 struct devlink_param_gset_ctx *ctx); 15 - int mv88e6xxx_setup_devlink_regions(struct dsa_switch *ds); 16 - void mv88e6xxx_teardown_devlink_regions(struct dsa_switch *ds); 15 + int mv88e6xxx_setup_devlink_regions_global(struct dsa_switch *ds); 16 + void mv88e6xxx_teardown_devlink_regions_global(struct dsa_switch *ds); 17 + int mv88e6xxx_setup_devlink_regions_port(struct dsa_switch *ds, int port); 18 + void mv88e6xxx_teardown_devlink_regions_port(struct dsa_switch *ds, int port); 17 19 18 20 int mv88e6xxx_devlink_info_get(struct dsa_switch *ds, 19 21 struct devlink_info_req *req,
+1 -1
drivers/net/dsa/ocelot/felix.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 - /* Copyright 2019-2021 NXP Semiconductors 2 + /* Copyright 2019-2021 NXP 3 3 * 4 4 * This is an umbrella module for all network switches that are 5 5 * register-compatible with Ocelot and that perform I/O to their host CPU
+1 -1
drivers/net/dsa/ocelot/felix.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* Copyright 2019 NXP Semiconductors 2 + /* Copyright 2019 NXP 3 3 */ 4 4 #ifndef _MSCC_FELIX_H 5 5 #define _MSCC_FELIX_H
+19 -3
drivers/net/dsa/ocelot/felix_vsc9959.c
··· 1 1 // SPDX-License-Identifier: (GPL-2.0 OR MIT) 2 2 /* Copyright 2017 Microsemi Corporation 3 - * Copyright 2018-2019 NXP Semiconductors 3 + * Copyright 2018-2019 NXP 4 4 */ 5 5 #include <linux/fsl/enetc_mdio.h> 6 6 #include <soc/mscc/ocelot_qsys.h> ··· 1472 1472 1473 1473 static void felix_pci_remove(struct pci_dev *pdev) 1474 1474 { 1475 - struct felix *felix; 1475 + struct felix *felix = pci_get_drvdata(pdev); 1476 1476 1477 - felix = pci_get_drvdata(pdev); 1477 + if (!felix) 1478 + return; 1478 1479 1479 1480 dsa_unregister_switch(felix->ds); 1480 1481 ··· 1483 1482 kfree(felix); 1484 1483 1485 1484 pci_disable_device(pdev); 1485 + 1486 + pci_set_drvdata(pdev, NULL); 1487 + } 1488 + 1489 + static void felix_pci_shutdown(struct pci_dev *pdev) 1490 + { 1491 + struct felix *felix = pci_get_drvdata(pdev); 1492 + 1493 + if (!felix) 1494 + return; 1495 + 1496 + dsa_switch_shutdown(felix->ds); 1497 + 1498 + pci_set_drvdata(pdev, NULL); 1486 1499 } 1487 1500 1488 1501 static struct pci_device_id felix_ids[] = { ··· 1513 1498 .id_table = felix_ids, 1514 1499 .probe = felix_pci_probe, 1515 1500 .remove = felix_pci_remove, 1501 + .shutdown = felix_pci_shutdown, 1516 1502 }; 1517 1503 module_pci_driver(felix_vsc9959_pci_driver); 1518 1504
+18 -2
drivers/net/dsa/ocelot/seville_vsc9953.c
··· 1245 1245 1246 1246 static int seville_remove(struct platform_device *pdev) 1247 1247 { 1248 - struct felix *felix; 1248 + struct felix *felix = platform_get_drvdata(pdev); 1249 1249 1250 - felix = platform_get_drvdata(pdev); 1250 + if (!felix) 1251 + return 0; 1251 1252 1252 1253 dsa_unregister_switch(felix->ds); 1253 1254 1254 1255 kfree(felix->ds); 1255 1256 kfree(felix); 1256 1257 1258 + platform_set_drvdata(pdev, NULL); 1259 + 1257 1260 return 0; 1261 + } 1262 + 1263 + static void seville_shutdown(struct platform_device *pdev) 1264 + { 1265 + struct felix *felix = platform_get_drvdata(pdev); 1266 + 1267 + if (!felix) 1268 + return; 1269 + 1270 + dsa_switch_shutdown(felix->ds); 1271 + 1272 + platform_set_drvdata(pdev, NULL); 1258 1273 } 1259 1274 1260 1275 static const struct of_device_id seville_of_match[] = { ··· 1281 1266 static struct platform_driver seville_vsc9953_driver = { 1282 1267 .probe = seville_probe, 1283 1268 .remove = seville_remove, 1269 + .shutdown = seville_shutdown, 1284 1270 .driver = { 1285 1271 .name = "mscc_seville", 1286 1272 .of_match_table = of_match_ptr(seville_of_match),
+18
drivers/net/dsa/qca/ar9331.c
··· 1083 1083 struct ar9331_sw_priv *priv = dev_get_drvdata(&mdiodev->dev); 1084 1084 unsigned int i; 1085 1085 1086 + if (!priv) 1087 + return; 1088 + 1086 1089 for (i = 0; i < ARRAY_SIZE(priv->port); i++) { 1087 1090 struct ar9331_sw_port *port = &priv->port[i]; 1088 1091 ··· 1097 1094 dsa_unregister_switch(&priv->ds); 1098 1095 1099 1096 reset_control_assert(priv->sw_reset); 1097 + 1098 + dev_set_drvdata(&mdiodev->dev, NULL); 1099 + } 1100 + 1101 + static void ar9331_sw_shutdown(struct mdio_device *mdiodev) 1102 + { 1103 + struct ar9331_sw_priv *priv = dev_get_drvdata(&mdiodev->dev); 1104 + 1105 + if (!priv) 1106 + return; 1107 + 1108 + dsa_switch_shutdown(&priv->ds); 1109 + 1110 + dev_set_drvdata(&mdiodev->dev, NULL); 1100 1111 } 1101 1112 1102 1113 static const struct of_device_id ar9331_sw_of_match[] = { ··· 1121 1104 static struct mdio_driver ar9331_sw_mdio_driver = { 1122 1105 .probe = ar9331_sw_probe, 1123 1106 .remove = ar9331_sw_remove, 1107 + .shutdown = ar9331_sw_shutdown, 1124 1108 .mdiodrv.driver = { 1125 1109 .name = AR9331_SW_NAME, 1126 1110 .of_match_table = ar9331_sw_of_match,
+18
drivers/net/dsa/qca8k.c
··· 1880 1880 struct qca8k_priv *priv = dev_get_drvdata(&mdiodev->dev); 1881 1881 int i; 1882 1882 1883 + if (!priv) 1884 + return; 1885 + 1883 1886 for (i = 0; i < QCA8K_NUM_PORTS; i++) 1884 1887 qca8k_port_set_status(priv, i, 0); 1885 1888 1886 1889 dsa_unregister_switch(priv->ds); 1890 + 1891 + dev_set_drvdata(&mdiodev->dev, NULL); 1892 + } 1893 + 1894 + static void qca8k_sw_shutdown(struct mdio_device *mdiodev) 1895 + { 1896 + struct qca8k_priv *priv = dev_get_drvdata(&mdiodev->dev); 1897 + 1898 + if (!priv) 1899 + return; 1900 + 1901 + dsa_switch_shutdown(priv->ds); 1902 + 1903 + dev_set_drvdata(&mdiodev->dev, NULL); 1887 1904 } 1888 1905 1889 1906 #ifdef CONFIG_PM_SLEEP ··· 1957 1940 static struct mdio_driver qca8kmdio_driver = { 1958 1941 .probe = qca8k_sw_probe, 1959 1942 .remove = qca8k_sw_remove, 1943 + .shutdown = qca8k_sw_shutdown, 1960 1944 .mdiodrv.driver = { 1961 1945 .name = "qca8k", 1962 1946 .of_match_table = qca8k_of_match,
+20 -2
drivers/net/dsa/realtek-smi-core.c
··· 368 368 smi->slave_mii_bus->parent = smi->dev; 369 369 smi->ds->slave_mii_bus = smi->slave_mii_bus; 370 370 371 - ret = of_mdiobus_register(smi->slave_mii_bus, mdio_np); 371 + ret = devm_of_mdiobus_register(smi->dev, smi->slave_mii_bus, mdio_np); 372 372 if (ret) { 373 373 dev_err(smi->dev, "unable to register MDIO bus %s\n", 374 374 smi->slave_mii_bus->id); ··· 464 464 465 465 static int realtek_smi_remove(struct platform_device *pdev) 466 466 { 467 - struct realtek_smi *smi = dev_get_drvdata(&pdev->dev); 467 + struct realtek_smi *smi = platform_get_drvdata(pdev); 468 + 469 + if (!smi) 470 + return 0; 468 471 469 472 dsa_unregister_switch(smi->ds); 470 473 if (smi->slave_mii_bus) 471 474 of_node_put(smi->slave_mii_bus->dev.of_node); 472 475 gpiod_set_value(smi->reset, 1); 473 476 477 + platform_set_drvdata(pdev, NULL); 478 + 474 479 return 0; 480 + } 481 + 482 + static void realtek_smi_shutdown(struct platform_device *pdev) 483 + { 484 + struct realtek_smi *smi = platform_get_drvdata(pdev); 485 + 486 + if (!smi) 487 + return; 488 + 489 + dsa_switch_shutdown(smi->ds); 490 + 491 + platform_set_drvdata(pdev, NULL); 475 492 } 476 493 477 494 static const struct of_device_id realtek_smi_of_match[] = { ··· 512 495 }, 513 496 .probe = realtek_smi_probe, 514 497 .remove = realtek_smi_remove, 498 + .shutdown = realtek_smi_shutdown, 515 499 }; 516 500 module_platform_driver(realtek_smi_driver); 517 501
+1 -1
drivers/net/dsa/sja1105/sja1105_clocking.c
··· 1 1 // SPDX-License-Identifier: BSD-3-Clause 2 - /* Copyright (c) 2016-2018, NXP Semiconductors 2 + /* Copyright 2016-2018 NXP 3 3 * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> 4 4 */ 5 5 #include <linux/packing.h>
+1 -1
drivers/net/dsa/sja1105/sja1105_devlink.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /* Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> 3 - * Copyright 2020 NXP Semiconductors 3 + * Copyright 2020 NXP 4 4 */ 5 5 #include "sja1105.h" 6 6
+1 -1
drivers/net/dsa/sja1105/sja1105_flower.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 - /* Copyright 2020, NXP Semiconductors 2 + /* Copyright 2020 NXP 3 3 */ 4 4 #include "sja1105.h" 5 5 #include "sja1105_vl.h"
+19 -2
drivers/net/dsa/sja1105/sja1105_main.c
··· 3335 3335 static int sja1105_remove(struct spi_device *spi) 3336 3336 { 3337 3337 struct sja1105_private *priv = spi_get_drvdata(spi); 3338 - struct dsa_switch *ds = priv->ds; 3339 3338 3340 - dsa_unregister_switch(ds); 3339 + if (!priv) 3340 + return 0; 3341 + 3342 + dsa_unregister_switch(priv->ds); 3343 + 3344 + spi_set_drvdata(spi, NULL); 3341 3345 3342 3346 return 0; 3347 + } 3348 + 3349 + static void sja1105_shutdown(struct spi_device *spi) 3350 + { 3351 + struct sja1105_private *priv = spi_get_drvdata(spi); 3352 + 3353 + if (!priv) 3354 + return; 3355 + 3356 + dsa_switch_shutdown(priv->ds); 3357 + 3358 + spi_set_drvdata(spi, NULL); 3343 3359 } 3344 3360 3345 3361 static const struct of_device_id sja1105_dt_ids[] = { ··· 3381 3365 }, 3382 3366 .probe = sja1105_probe, 3383 3367 .remove = sja1105_remove, 3368 + .shutdown = sja1105_shutdown, 3384 3369 }; 3385 3370 3386 3371 module_spi_driver(sja1105_driver);
+1 -1
drivers/net/dsa/sja1105/sja1105_mdio.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 - /* Copyright 2021, NXP Semiconductors 2 + /* Copyright 2021 NXP 3 3 */ 4 4 #include <linux/pcs/pcs-xpcs.h> 5 5 #include <linux/of_mdio.h>
+1 -1
drivers/net/dsa/sja1105/sja1105_spi.c
··· 1 1 // SPDX-License-Identifier: BSD-3-Clause 2 - /* Copyright (c) 2016-2018, NXP Semiconductors 2 + /* Copyright 2016-2018 NXP 3 3 * Copyright (c) 2018, Sensor-Technik Wiedemann GmbH 4 4 * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> 5 5 */
+1 -1
drivers/net/dsa/sja1105/sja1105_static_config.c
··· 1 1 // SPDX-License-Identifier: BSD-3-Clause 2 - /* Copyright (c) 2016-2018, NXP Semiconductors 2 + /* Copyright 2016-2018 NXP 3 3 * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> 4 4 */ 5 5 #include "sja1105_static_config.h"
+1 -1
drivers/net/dsa/sja1105/sja1105_static_config.h
··· 1 1 /* SPDX-License-Identifier: BSD-3-Clause */ 2 - /* Copyright (c) 2016-2018, NXP Semiconductors 2 + /* Copyright 2016-2018 NXP 3 3 * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> 4 4 */ 5 5 #ifndef _SJA1105_STATIC_CONFIG_H
+1 -1
drivers/net/dsa/sja1105/sja1105_vl.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 - /* Copyright 2020, NXP Semiconductors 2 + /* Copyright 2020 NXP 3 3 */ 4 4 #include <net/tc_act/tc_gate.h> 5 5 #include <linux/dsa/8021q.h>
+1 -1
drivers/net/dsa/sja1105/sja1105_vl.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* Copyright 2020, NXP Semiconductors 2 + /* Copyright 2020 NXP 3 3 */ 4 4 #ifndef _SJA1105_VL_H 5 5 #define _SJA1105_VL_H
+6
drivers/net/dsa/vitesse-vsc73xx-core.c
··· 1225 1225 } 1226 1226 EXPORT_SYMBOL(vsc73xx_remove); 1227 1227 1228 + void vsc73xx_shutdown(struct vsc73xx *vsc) 1229 + { 1230 + dsa_switch_shutdown(vsc->ds); 1231 + } 1232 + EXPORT_SYMBOL(vsc73xx_shutdown); 1233 + 1228 1234 MODULE_AUTHOR("Linus Walleij <linus.walleij@linaro.org>"); 1229 1235 MODULE_DESCRIPTION("Vitesse VSC7385/7388/7395/7398 driver"); 1230 1236 MODULE_LICENSE("GPL v2");
+21 -1
drivers/net/dsa/vitesse-vsc73xx-platform.c
··· 116 116 { 117 117 struct vsc73xx_platform *vsc_platform = platform_get_drvdata(pdev); 118 118 119 - return vsc73xx_remove(&vsc_platform->vsc); 119 + if (!vsc_platform) 120 + return 0; 121 + 122 + vsc73xx_remove(&vsc_platform->vsc); 123 + 124 + platform_set_drvdata(pdev, NULL); 125 + 126 + return 0; 127 + } 128 + 129 + static void vsc73xx_platform_shutdown(struct platform_device *pdev) 130 + { 131 + struct vsc73xx_platform *vsc_platform = platform_get_drvdata(pdev); 132 + 133 + if (!vsc_platform) 134 + return; 135 + 136 + vsc73xx_shutdown(&vsc_platform->vsc); 137 + 138 + platform_set_drvdata(pdev, NULL); 120 139 } 121 140 122 141 static const struct vsc73xx_ops vsc73xx_platform_ops = { ··· 163 144 static struct platform_driver vsc73xx_platform_driver = { 164 145 .probe = vsc73xx_platform_probe, 165 146 .remove = vsc73xx_platform_remove, 147 + .shutdown = vsc73xx_platform_shutdown, 166 148 .driver = { 167 149 .name = "vsc73xx-platform", 168 150 .of_match_table = vsc73xx_of_match,
+21 -1
drivers/net/dsa/vitesse-vsc73xx-spi.c
··· 163 163 { 164 164 struct vsc73xx_spi *vsc_spi = spi_get_drvdata(spi); 165 165 166 - return vsc73xx_remove(&vsc_spi->vsc); 166 + if (!vsc_spi) 167 + return 0; 168 + 169 + vsc73xx_remove(&vsc_spi->vsc); 170 + 171 + spi_set_drvdata(spi, NULL); 172 + 173 + return 0; 174 + } 175 + 176 + static void vsc73xx_spi_shutdown(struct spi_device *spi) 177 + { 178 + struct vsc73xx_spi *vsc_spi = spi_get_drvdata(spi); 179 + 180 + if (!vsc_spi) 181 + return; 182 + 183 + vsc73xx_shutdown(&vsc_spi->vsc); 184 + 185 + spi_set_drvdata(spi, NULL); 167 186 } 168 187 169 188 static const struct vsc73xx_ops vsc73xx_spi_ops = { ··· 210 191 static struct spi_driver vsc73xx_spi_driver = { 211 192 .probe = vsc73xx_spi_probe, 212 193 .remove = vsc73xx_spi_remove, 194 + .shutdown = vsc73xx_spi_shutdown, 213 195 .driver = { 214 196 .name = "vsc73xx-spi", 215 197 .of_match_table = vsc73xx_of_match,
+1
drivers/net/dsa/vitesse-vsc73xx.h
··· 27 27 int vsc73xx_is_addr_valid(u8 block, u8 subblock); 28 28 int vsc73xx_probe(struct vsc73xx *vsc); 29 29 int vsc73xx_remove(struct vsc73xx *vsc); 30 + void vsc73xx_shutdown(struct vsc73xx *vsc);
+6
drivers/net/dsa/xrs700x/xrs700x.c
··· 822 822 } 823 823 EXPORT_SYMBOL(xrs700x_switch_remove); 824 824 825 + void xrs700x_switch_shutdown(struct xrs700x *priv) 826 + { 827 + dsa_switch_shutdown(priv->ds); 828 + } 829 + EXPORT_SYMBOL(xrs700x_switch_shutdown); 830 + 825 831 MODULE_AUTHOR("George McCollister <george.mccollister@gmail.com>"); 826 832 MODULE_DESCRIPTION("Arrow SpeedChips XRS700x DSA driver"); 827 833 MODULE_LICENSE("GPL v2");
+1
drivers/net/dsa/xrs700x/xrs700x.h
··· 40 40 struct xrs700x *xrs700x_switch_alloc(struct device *base, void *devpriv); 41 41 int xrs700x_switch_register(struct xrs700x *priv); 42 42 void xrs700x_switch_remove(struct xrs700x *priv); 43 + void xrs700x_switch_shutdown(struct xrs700x *priv);
+18
drivers/net/dsa/xrs700x/xrs700x_i2c.c
··· 109 109 { 110 110 struct xrs700x *priv = i2c_get_clientdata(i2c); 111 111 112 + if (!priv) 113 + return 0; 114 + 112 115 xrs700x_switch_remove(priv); 113 116 117 + i2c_set_clientdata(i2c, NULL); 118 + 114 119 return 0; 120 + } 121 + 122 + static void xrs700x_i2c_shutdown(struct i2c_client *i2c) 123 + { 124 + struct xrs700x *priv = i2c_get_clientdata(i2c); 125 + 126 + if (!priv) 127 + return; 128 + 129 + xrs700x_switch_shutdown(priv); 130 + 131 + i2c_set_clientdata(i2c, NULL); 115 132 } 116 133 117 134 static const struct i2c_device_id xrs700x_i2c_id[] = { ··· 154 137 }, 155 138 .probe = xrs700x_i2c_probe, 156 139 .remove = xrs700x_i2c_remove, 140 + .shutdown = xrs700x_i2c_shutdown, 157 141 .id_table = xrs700x_i2c_id, 158 142 }; 159 143
+18
drivers/net/dsa/xrs700x/xrs700x_mdio.c
··· 136 136 { 137 137 struct xrs700x *priv = dev_get_drvdata(&mdiodev->dev); 138 138 139 + if (!priv) 140 + return; 141 + 139 142 xrs700x_switch_remove(priv); 143 + 144 + dev_set_drvdata(&mdiodev->dev, NULL); 145 + } 146 + 147 + static void xrs700x_mdio_shutdown(struct mdio_device *mdiodev) 148 + { 149 + struct xrs700x *priv = dev_get_drvdata(&mdiodev->dev); 150 + 151 + if (!priv) 152 + return; 153 + 154 + xrs700x_switch_shutdown(priv); 155 + 156 + dev_set_drvdata(&mdiodev->dev, NULL); 140 157 } 141 158 142 159 static const struct of_device_id __maybe_unused xrs700x_mdio_dt_ids[] = { ··· 172 155 }, 173 156 .probe = xrs700x_mdio_probe, 174 157 .remove = xrs700x_mdio_remove, 158 + .shutdown = xrs700x_mdio_shutdown, 175 159 }; 176 160 177 161 mdio_module_driver(xrs700x_mdio_driver);
+4 -4
drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
··· 413 413 if (deep) { 414 414 /* Reinitialize Nic/Vecs objects */ 415 415 aq_nic_deinit(nic, !nic->aq_hw->aq_nic_cfg->wol); 416 - 417 - ret = aq_nic_init(nic); 418 - if (ret) 419 - goto err_exit; 420 416 } 421 417 422 418 if (netif_running(nic->ndev)) { 419 + ret = aq_nic_init(nic); 420 + if (ret) 421 + goto err_exit; 422 + 423 423 ret = aq_nic_start(nic); 424 424 if (ret) 425 425 goto err_exit;
+2
drivers/net/ethernet/broadcom/bgmac-bcma.c
··· 129 129 bcma_set_drvdata(core, bgmac); 130 130 131 131 err = of_get_mac_address(bgmac->dev->of_node, bgmac->net_dev->dev_addr); 132 + if (err == -EPROBE_DEFER) 133 + return err; 132 134 133 135 /* If no MAC address assigned via device tree, check SPROM */ 134 136 if (err) {
+4 -4
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 391 391 * netif_tx_queue_stopped(). 392 392 */ 393 393 smp_mb(); 394 - if (bnxt_tx_avail(bp, txr) > bp->tx_wake_thresh) { 394 + if (bnxt_tx_avail(bp, txr) >= bp->tx_wake_thresh) { 395 395 netif_tx_wake_queue(txq); 396 396 return false; 397 397 } ··· 764 764 smp_mb(); 765 765 766 766 if (unlikely(netif_tx_queue_stopped(txq)) && 767 - bnxt_tx_avail(bp, txr) > bp->tx_wake_thresh && 767 + bnxt_tx_avail(bp, txr) >= bp->tx_wake_thresh && 768 768 READ_ONCE(txr->dev_state) != BNXT_DEV_STATE_CLOSING) 769 769 netif_tx_wake_queue(txq); 770 770 } ··· 2416 2416 if (TX_CMP_TYPE(txcmp) == CMP_TYPE_TX_L2_CMP) { 2417 2417 tx_pkts++; 2418 2418 /* return full budget so NAPI will complete. */ 2419 - if (unlikely(tx_pkts > bp->tx_wake_thresh)) { 2419 + if (unlikely(tx_pkts >= bp->tx_wake_thresh)) { 2420 2420 rx_pkts = budget; 2421 2421 raw_cons = NEXT_RAW_CMP(raw_cons); 2422 2422 if (budget) ··· 3640 3640 u16 i; 3641 3641 3642 3642 bp->tx_wake_thresh = max_t(int, bp->tx_ring_size / 2, 3643 - MAX_SKB_FRAGS + 1); 3643 + BNXT_MIN_TX_DESC_CNT); 3644 3644 3645 3645 for (i = 0; i < bp->tx_nr_rings; i++) { 3646 3646 struct bnxt_tx_ring_info *txr = &bp->tx_ring[i];
+5
drivers/net/ethernet/broadcom/bnxt/bnxt.h
··· 629 629 #define BNXT_MAX_RX_JUM_DESC_CNT (RX_DESC_CNT * MAX_RX_AGG_PAGES - 1) 630 630 #define BNXT_MAX_TX_DESC_CNT (TX_DESC_CNT * MAX_TX_PAGES - 1) 631 631 632 + /* Minimum TX BDs for a TX packet with MAX_SKB_FRAGS + 1. We need one extra 633 + * BD because the first TX BD is always a long BD. 634 + */ 635 + #define BNXT_MIN_TX_DESC_CNT (MAX_SKB_FRAGS + 2) 636 + 632 637 #define RX_RING(x) (((x) & ~(RX_DESC_CNT - 1)) >> (BNXT_PAGE_SHIFT - 4)) 633 638 #define RX_IDX(x) ((x) & (RX_DESC_CNT - 1)) 634 639
+1 -1
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
··· 798 798 799 799 if ((ering->rx_pending > BNXT_MAX_RX_DESC_CNT) || 800 800 (ering->tx_pending > BNXT_MAX_TX_DESC_CNT) || 801 - (ering->tx_pending <= MAX_SKB_FRAGS)) 801 + (ering->tx_pending < BNXT_MIN_TX_DESC_CNT)) 802 802 return -EINVAL; 803 803 804 804 if (netif_running(dev))
+2 -5
drivers/net/ethernet/freescale/enetc/enetc.c
··· 419 419 420 420 static void enetc_rx_net_dim(struct enetc_int_vector *v) 421 421 { 422 - struct dim_sample dim_sample; 422 + struct dim_sample dim_sample = {}; 423 423 424 424 v->comp_cnt++; 425 425 ··· 1879 1879 static int enetc_setup_irqs(struct enetc_ndev_priv *priv) 1880 1880 { 1881 1881 struct pci_dev *pdev = priv->si->pdev; 1882 - cpumask_t cpu_mask; 1883 1882 int i, j, err; 1884 1883 1885 1884 for (i = 0; i < priv->bdr_int_num; i++) { ··· 1907 1908 1908 1909 enetc_wr(hw, ENETC_SIMSITRV(idx), entry); 1909 1910 } 1910 - cpumask_clear(&cpu_mask); 1911 - cpumask_set_cpu(i % num_online_cpus(), &cpu_mask); 1912 - irq_set_affinity_hint(irq, &cpu_mask); 1911 + irq_set_affinity_hint(irq, get_cpu_mask(i % num_online_cpus())); 1913 1912 } 1914 1913 1915 1914 return 0;
+1 -1
drivers/net/ethernet/freescale/enetc/enetc_ierb.c
··· 1 1 // SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) 2 - /* Copyright 2021 NXP Semiconductors 2 + /* Copyright 2021 NXP 3 3 * 4 4 * The Integrated Endpoint Register Block (IERB) is configured by pre-boot 5 5 * software and is supposed to be to ENETC what a NVRAM is to a 'real' PCIe
+1 -1
drivers/net/ethernet/freescale/enetc/enetc_ierb.h
··· 1 1 /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ 2 - /* Copyright 2021 NXP Semiconductors */ 2 + /* Copyright 2021 NXP */ 3 3 4 4 #include <linux/pci.h> 5 5 #include <linux/platform_device.h>
-1
drivers/net/ethernet/freescale/fec_main.c
··· 4176 4176 4177 4177 module_platform_driver(fec_driver); 4178 4178 4179 - MODULE_ALIAS("platform:"DRIVER_NAME); 4180 4179 MODULE_LICENSE("GPL");
+4 -4
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c
··· 2445 2445 return; 2446 2446 } 2447 2447 2448 - dev_err(dev, "PPU_PF_ABNORMAL_INT_ST over_8bd_no_fe found, vf_id(%u), queue_id(%u)\n", 2448 + dev_err(dev, "PPU_PF_ABNORMAL_INT_ST over_8bd_no_fe found, vport(%u), queue_id(%u)\n", 2449 2449 vf_id, q_id); 2450 2450 2451 2451 if (vf_id) { 2452 2452 if (vf_id >= hdev->num_alloc_vport) { 2453 - dev_err(dev, "invalid vf id(%u)\n", vf_id); 2453 + dev_err(dev, "invalid vport(%u)\n", vf_id); 2454 2454 return; 2455 2455 } 2456 2456 ··· 2463 2463 2464 2464 ret = hclge_inform_reset_assert_to_vf(&hdev->vport[vf_id]); 2465 2465 if (ret) 2466 - dev_err(dev, "inform reset to vf(%u) failed %d!\n", 2467 - hdev->vport->vport_id, ret); 2466 + dev_err(dev, "inform reset to vport(%u) failed %d!\n", 2467 + vf_id, ret); 2468 2468 } else { 2469 2469 set_bit(HNAE3_FUNC_RESET, reset_requests); 2470 2470 }
+55 -25
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
··· 3661 3661 if (ret) { 3662 3662 dev_err(&hdev->pdev->dev, 3663 3663 "set vf(%u) rst failed %d!\n", 3664 - vport->vport_id, ret); 3664 + vport->vport_id - HCLGE_VF_VPORT_START_NUM, 3665 + ret); 3665 3666 return ret; 3666 3667 } 3667 3668 ··· 3677 3676 if (ret) 3678 3677 dev_warn(&hdev->pdev->dev, 3679 3678 "inform reset to vf(%u) failed %d!\n", 3680 - vport->vport_id, ret); 3679 + vport->vport_id - HCLGE_VF_VPORT_START_NUM, 3680 + ret); 3681 3681 } 3682 3682 3683 3683 return 0; ··· 4743 4741 return 0; 4744 4742 } 4745 4743 4744 + static int hclge_parse_rss_hfunc(struct hclge_vport *vport, const u8 hfunc, 4745 + u8 *hash_algo) 4746 + { 4747 + switch (hfunc) { 4748 + case ETH_RSS_HASH_TOP: 4749 + *hash_algo = HCLGE_RSS_HASH_ALGO_TOEPLITZ; 4750 + return 0; 4751 + case ETH_RSS_HASH_XOR: 4752 + *hash_algo = HCLGE_RSS_HASH_ALGO_SIMPLE; 4753 + return 0; 4754 + case ETH_RSS_HASH_NO_CHANGE: 4755 + *hash_algo = vport->rss_algo; 4756 + return 0; 4757 + default: 4758 + return -EINVAL; 4759 + } 4760 + } 4761 + 4746 4762 static int hclge_set_rss(struct hnae3_handle *handle, const u32 *indir, 4747 4763 const u8 *key, const u8 hfunc) 4748 4764 { ··· 4770 4750 u8 hash_algo; 4771 4751 int ret, i; 4772 4752 4753 + ret = hclge_parse_rss_hfunc(vport, hfunc, &hash_algo); 4754 + if (ret) { 4755 + dev_err(&hdev->pdev->dev, "invalid hfunc type %u\n", hfunc); 4756 + return ret; 4757 + } 4758 + 4773 4759 /* Set the RSS Hash Key if specififed by the user */ 4774 4760 if (key) { 4775 - switch (hfunc) { 4776 - case ETH_RSS_HASH_TOP: 4777 - hash_algo = HCLGE_RSS_HASH_ALGO_TOEPLITZ; 4778 - break; 4779 - case ETH_RSS_HASH_XOR: 4780 - hash_algo = HCLGE_RSS_HASH_ALGO_SIMPLE; 4781 - break; 4782 - case ETH_RSS_HASH_NO_CHANGE: 4783 - hash_algo = vport->rss_algo; 4784 - break; 4785 - default: 4786 - return -EINVAL; 4787 - } 4788 - 4789 4761 ret = hclge_set_rss_algo_key(hdev, hash_algo, key); 4790 4762 if (ret) 4791 4763 return ret; 4792 4764 4793 4765 /* Update the shadow RSS key with user specified qids */ 4794 4766 memcpy(vport->rss_hash_key, key, HCLGE_RSS_KEY_SIZE); 4795 - vport->rss_algo = hash_algo; 4767 + } else { 4768 + ret = hclge_set_rss_algo_key(hdev, hash_algo, 4769 + vport->rss_hash_key); 4770 + if (ret) 4771 + return ret; 4796 4772 } 4773 + vport->rss_algo = hash_algo; 4797 4774 4798 4775 /* Update the shadow RSS table with user specified qids */ 4799 4776 for (i = 0; i < ae_dev->dev_specs.rss_ind_tbl_size; i++) ··· 6644 6627 u8 vf = ethtool_get_flow_spec_ring_vf(ring_cookie); 6645 6628 u16 tqps; 6646 6629 6630 + /* To keep consistent with user's configuration, minus 1 when 6631 + * printing 'vf', because vf id from ethtool is added 1 for vf. 6632 + */ 6647 6633 if (vf > hdev->num_req_vfs) { 6648 6634 dev_err(&hdev->pdev->dev, 6649 - "Error: vf id (%u) > max vf num (%u)\n", 6650 - vf, hdev->num_req_vfs); 6635 + "Error: vf id (%u) should be less than %u\n", 6636 + vf - 1, hdev->num_req_vfs); 6651 6637 return -EINVAL; 6652 6638 } 6653 6639 ··· 9817 9797 if (is_kill && !vlan_id) 9818 9798 return 0; 9819 9799 9800 + if (vlan_id >= VLAN_N_VID) 9801 + return -EINVAL; 9802 + 9820 9803 ret = hclge_set_vf_vlan_common(hdev, vport_id, is_kill, vlan_id); 9821 9804 if (ret) { 9822 9805 dev_err(&hdev->pdev->dev, ··· 10726 10703 return 0; 10727 10704 } 10728 10705 10729 - static int hclge_get_reset_status(struct hclge_dev *hdev, u16 queue_id) 10706 + static int hclge_get_reset_status(struct hclge_dev *hdev, u16 queue_id, 10707 + u8 *reset_status) 10730 10708 { 10731 10709 struct hclge_reset_tqp_queue_cmd *req; 10732 10710 struct hclge_desc desc; ··· 10745 10721 return ret; 10746 10722 } 10747 10723 10748 - return hnae3_get_bit(req->ready_to_reset, HCLGE_TQP_RESET_B); 10724 + *reset_status = hnae3_get_bit(req->ready_to_reset, HCLGE_TQP_RESET_B); 10725 + 10726 + return 0; 10749 10727 } 10750 10728 10751 10729 u16 hclge_covert_handle_qid_global(struct hnae3_handle *handle, u16 queue_id) ··· 10766 10740 struct hclge_vport *vport = hclge_get_vport(handle); 10767 10741 struct hclge_dev *hdev = vport->back; 10768 10742 u16 reset_try_times = 0; 10769 - int reset_status; 10743 + u8 reset_status; 10770 10744 u16 queue_gid; 10771 10745 int ret; 10772 10746 u16 i; ··· 10782 10756 } 10783 10757 10784 10758 while (reset_try_times++ < HCLGE_TQP_RESET_TRY_TIMES) { 10785 - reset_status = hclge_get_reset_status(hdev, queue_gid); 10759 + ret = hclge_get_reset_status(hdev, queue_gid, 10760 + &reset_status); 10761 + if (ret) 10762 + return ret; 10763 + 10786 10764 if (reset_status) 10787 10765 break; 10788 10766 ··· 11479 11449 struct hclge_vport *vport = &hdev->vport[i]; 11480 11450 int ret; 11481 11451 11482 - /* Send cmd to clear VF's FUNC_RST_ING */ 11452 + /* Send cmd to clear vport's FUNC_RST_ING */ 11483 11453 ret = hclge_set_vf_rst(hdev, vport->vport_id, false); 11484 11454 if (ret) 11485 11455 dev_warn(&hdev->pdev->dev, 11486 - "clear vf(%u) rst failed %d!\n", 11456 + "clear vport(%u) rst failed %d!\n", 11487 11457 vport->vport_id, ret); 11488 11458 } 11489 11459 }
+9 -1
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
··· 566 566 struct hclge_dev *hdev = vport->back; 567 567 568 568 dev_warn(&hdev->pdev->dev, "PF received VF reset request from VF %u!", 569 - vport->vport_id); 569 + vport->vport_id - HCLGE_VF_VPORT_START_NUM); 570 570 571 571 return hclge_func_reset_cmd(hdev, vport->vport_id); 572 572 } ··· 590 590 struct hclge_mbx_vf_to_pf_cmd *mbx_req, 591 591 struct hclge_respond_to_vf_msg *resp_msg) 592 592 { 593 + struct hnae3_handle *handle = &vport->nic; 594 + struct hclge_dev *hdev = vport->back; 593 595 u16 queue_id, qid_in_pf; 594 596 595 597 memcpy(&queue_id, mbx_req->msg.data, sizeof(queue_id)); 598 + if (queue_id >= handle->kinfo.num_tqps) { 599 + dev_err(&hdev->pdev->dev, "Invalid queue id(%u) from VF %u\n", 600 + queue_id, mbx_req->mbx_src_vfid); 601 + return; 602 + } 603 + 596 604 qid_in_pf = hclge_covert_handle_qid_global(&vport->nic, queue_id); 597 605 memcpy(resp_msg->data, &qid_in_pf, sizeof(qid_in_pf)); 598 606 resp_msg->len = sizeof(qid_in_pf);
+1 -1
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
··· 581 581 ret = hclge_cmd_send(&hdev->hw, &desc, 1); 582 582 if (ret) { 583 583 dev_err(&hdev->pdev->dev, 584 - "vf%u, qs%u failed to set tx_rate:%d, ret=%d\n", 584 + "vport%u, qs%u failed to set tx_rate:%d, ret=%d\n", 585 585 vport->vport_id, shap_cfg_cmd->qs_id, 586 586 max_tx_rate, ret); 587 587 return ret;
+34 -18
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
··· 816 816 return 0; 817 817 } 818 818 819 + static int hclgevf_parse_rss_hfunc(struct hclgevf_dev *hdev, const u8 hfunc, 820 + u8 *hash_algo) 821 + { 822 + switch (hfunc) { 823 + case ETH_RSS_HASH_TOP: 824 + *hash_algo = HCLGEVF_RSS_HASH_ALGO_TOEPLITZ; 825 + return 0; 826 + case ETH_RSS_HASH_XOR: 827 + *hash_algo = HCLGEVF_RSS_HASH_ALGO_SIMPLE; 828 + return 0; 829 + case ETH_RSS_HASH_NO_CHANGE: 830 + *hash_algo = hdev->rss_cfg.hash_algo; 831 + return 0; 832 + default: 833 + return -EINVAL; 834 + } 835 + } 836 + 819 837 static int hclgevf_set_rss(struct hnae3_handle *handle, const u32 *indir, 820 838 const u8 *key, const u8 hfunc) 821 839 { 822 840 struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); 823 841 struct hclgevf_rss_cfg *rss_cfg = &hdev->rss_cfg; 842 + u8 hash_algo; 824 843 int ret, i; 825 844 826 845 if (hdev->ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2) { 846 + ret = hclgevf_parse_rss_hfunc(hdev, hfunc, &hash_algo); 847 + if (ret) 848 + return ret; 849 + 827 850 /* Set the RSS Hash Key if specififed by the user */ 828 851 if (key) { 829 - switch (hfunc) { 830 - case ETH_RSS_HASH_TOP: 831 - rss_cfg->hash_algo = 832 - HCLGEVF_RSS_HASH_ALGO_TOEPLITZ; 833 - break; 834 - case ETH_RSS_HASH_XOR: 835 - rss_cfg->hash_algo = 836 - HCLGEVF_RSS_HASH_ALGO_SIMPLE; 837 - break; 838 - case ETH_RSS_HASH_NO_CHANGE: 839 - break; 840 - default: 841 - return -EINVAL; 842 - } 843 - 844 - ret = hclgevf_set_rss_algo_key(hdev, rss_cfg->hash_algo, 845 - key); 846 - if (ret) 852 + ret = hclgevf_set_rss_algo_key(hdev, hash_algo, key); 853 + if (ret) { 854 + dev_err(&hdev->pdev->dev, 855 + "invalid hfunc type %u\n", hfunc); 847 856 return ret; 857 + } 848 858 849 859 /* Update the shadow RSS key with user specified qids */ 850 860 memcpy(rss_cfg->rss_hash_key, key, 851 861 HCLGEVF_RSS_KEY_SIZE); 862 + } else { 863 + ret = hclgevf_set_rss_algo_key(hdev, hash_algo, 864 + rss_cfg->rss_hash_key); 865 + if (ret) 866 + return ret; 852 867 } 868 + rss_cfg->hash_algo = hash_algo; 853 869 } 854 870 855 871 /* update the shadow RSS table with user specified qids */
+1
drivers/net/ethernet/intel/Kconfig
··· 335 335 tristate "Intel(R) Ethernet Controller I225-LM/I225-V support" 336 336 default n 337 337 depends on PCI 338 + depends on PTP_1588_CLOCK_OPTIONAL 338 339 help 339 340 This driver supports Intel(R) Ethernet Controller I225-LM/I225-V 340 341 family of adapters.
+3
drivers/net/ethernet/mediatek/mtk_ppe_offload.c
··· 186 186 int hash; 187 187 int i; 188 188 189 + if (rhashtable_lookup(&eth->flow_table, &f->cookie, mtk_flow_ht_params)) 190 + return -EEXIST; 191 + 189 192 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_META)) { 190 193 struct flow_match_meta match; 191 194
+32 -18
drivers/net/ethernet/mellanox/mlx4/en_netdev.c
··· 372 372 int nhoff = skb_network_offset(skb); 373 373 int ret = 0; 374 374 375 + if (skb->encapsulation) 376 + return -EPROTONOSUPPORT; 377 + 375 378 if (skb->protocol != htons(ETH_P_IP)) 376 379 return -EPROTONOSUPPORT; 377 380 ··· 1272 1269 if (!netif_carrier_ok(dev)) { 1273 1270 if (!mlx4_en_QUERY_PORT(mdev, priv->port)) { 1274 1271 if (priv->port_state.link_state) { 1275 - priv->last_link_state = MLX4_DEV_EVENT_PORT_UP; 1276 1272 netif_carrier_on(dev); 1277 1273 en_dbg(LINK, priv, "Link Up\n"); 1278 1274 } ··· 1559 1557 mutex_unlock(&mdev->state_lock); 1560 1558 } 1561 1559 1562 - static void mlx4_en_linkstate(struct work_struct *work) 1560 + static void mlx4_en_linkstate(struct mlx4_en_priv *priv) 1561 + { 1562 + struct mlx4_en_port_state *port_state = &priv->port_state; 1563 + struct mlx4_en_dev *mdev = priv->mdev; 1564 + struct net_device *dev = priv->dev; 1565 + bool up; 1566 + 1567 + if (mlx4_en_QUERY_PORT(mdev, priv->port)) 1568 + port_state->link_state = MLX4_PORT_STATE_DEV_EVENT_PORT_DOWN; 1569 + 1570 + up = port_state->link_state == MLX4_PORT_STATE_DEV_EVENT_PORT_UP; 1571 + if (up == netif_carrier_ok(dev)) 1572 + netif_carrier_event(dev); 1573 + if (!up) { 1574 + en_info(priv, "Link Down\n"); 1575 + netif_carrier_off(dev); 1576 + } else { 1577 + en_info(priv, "Link Up\n"); 1578 + netif_carrier_on(dev); 1579 + } 1580 + } 1581 + 1582 + static void mlx4_en_linkstate_work(struct work_struct *work) 1563 1583 { 1564 1584 struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv, 1565 1585 linkstate_task); 1566 1586 struct mlx4_en_dev *mdev = priv->mdev; 1567 - int linkstate = priv->link_state; 1568 1587 1569 1588 mutex_lock(&mdev->state_lock); 1570 - /* If observable port state changed set carrier state and 1571 - * report to system log */ 1572 - if (priv->last_link_state != linkstate) { 1573 - if (linkstate == MLX4_DEV_EVENT_PORT_DOWN) { 1574 - en_info(priv, "Link Down\n"); 1575 - netif_carrier_off(priv->dev); 1576 - } else { 1577 - en_info(priv, "Link Up\n"); 1578 - netif_carrier_on(priv->dev); 1579 - } 1580 - } 1581 - priv->last_link_state = linkstate; 1589 + mlx4_en_linkstate(priv); 1582 1590 mutex_unlock(&mdev->state_lock); 1583 1591 } 1584 1592 ··· 2091 2079 mlx4_en_clear_stats(dev); 2092 2080 2093 2081 err = mlx4_en_start_port(dev); 2094 - if (err) 2082 + if (err) { 2095 2083 en_err(priv, "Failed starting port:%d\n", priv->port); 2096 - 2084 + goto out; 2085 + } 2086 + mlx4_en_linkstate(priv); 2097 2087 out: 2098 2088 mutex_unlock(&mdev->state_lock); 2099 2089 return err; ··· 3182 3168 spin_lock_init(&priv->stats_lock); 3183 3169 INIT_WORK(&priv->rx_mode_task, mlx4_en_do_set_rx_mode); 3184 3170 INIT_WORK(&priv->restart_task, mlx4_en_restart); 3185 - INIT_WORK(&priv->linkstate_task, mlx4_en_linkstate); 3171 + INIT_WORK(&priv->linkstate_task, mlx4_en_linkstate_work); 3186 3172 INIT_DELAYED_WORK(&priv->stats_task, mlx4_en_do_get_stats); 3187 3173 INIT_DELAYED_WORK(&priv->service_task, mlx4_en_service_task); 3188 3174 #ifdef CONFIG_RFS_ACCEL
-1
drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
··· 552 552 553 553 struct mlx4_hwq_resources res; 554 554 int link_state; 555 - int last_link_state; 556 555 bool port_up; 557 556 int port; 558 557 int registered;
+8 -13
drivers/net/ethernet/mscc/ocelot.c
··· 563 563 ocelot_port_writel(ocelot_port, DEV_MAC_ENA_CFG_RX_ENA | 564 564 DEV_MAC_ENA_CFG_TX_ENA, DEV_MAC_ENA_CFG); 565 565 566 - /* Take MAC, Port, Phy (intern) and PCS (SGMII/Serdes) clock out of 567 - * reset 568 - */ 569 - ocelot_port_writel(ocelot_port, DEV_CLOCK_CFG_LINK_SPEED(speed), 570 - DEV_CLOCK_CFG); 571 - 572 - /* No PFC */ 573 - ocelot_write_gix(ocelot, ANA_PFC_PFC_CFG_FC_LINK_SPEED(speed), 574 - ANA_PFC_PFC_CFG, port); 575 - 576 566 /* Core: Enable port for frame transfer */ 577 567 ocelot_fields_write(ocelot, port, 578 568 QSYS_SWITCH_PORT_MODE_PORT_ENA, 1); ··· 1293 1303 return mask; 1294 1304 } 1295 1305 1296 - static u32 ocelot_get_bridge_fwd_mask(struct ocelot *ocelot, 1306 + static u32 ocelot_get_bridge_fwd_mask(struct ocelot *ocelot, int src_port, 1297 1307 struct net_device *bridge) 1298 1308 { 1309 + struct ocelot_port *ocelot_port = ocelot->ports[src_port]; 1299 1310 u32 mask = 0; 1300 1311 int port; 1301 1312 1313 + if (!ocelot_port || ocelot_port->bridge != bridge || 1314 + ocelot_port->stp_state != BR_STATE_FORWARDING) 1315 + return 0; 1316 + 1302 1317 for (port = 0; port < ocelot->num_phys_ports; port++) { 1303 - struct ocelot_port *ocelot_port = ocelot->ports[port]; 1318 + ocelot_port = ocelot->ports[port]; 1304 1319 1305 1320 if (!ocelot_port) 1306 1321 continue; ··· 1371 1376 struct net_device *bridge = ocelot_port->bridge; 1372 1377 struct net_device *bond = ocelot_port->bond; 1373 1378 1374 - mask = ocelot_get_bridge_fwd_mask(ocelot, bridge); 1379 + mask = ocelot_get_bridge_fwd_mask(ocelot, port, bridge); 1375 1380 mask |= cpu_fwd_mask; 1376 1381 mask &= ~BIT(port); 1377 1382 if (bond) {
+1 -1
drivers/net/ethernet/mscc/ocelot_devlink.c
··· 1 1 // SPDX-License-Identifier: (GPL-2.0 OR MIT) 2 - /* Copyright 2020-2021 NXP Semiconductors 2 + /* Copyright 2020-2021 NXP 3 3 */ 4 4 #include <net/devlink.h> 5 5 #include "ocelot.h"
+1 -1
drivers/net/ethernet/mscc/ocelot_mrp.c
··· 2 2 /* Microsemi Ocelot Switch driver 3 3 * 4 4 * Copyright (c) 2017, 2019 Microsemi Corporation 5 - * Copyright 2020-2021 NXP Semiconductors 5 + * Copyright 2020-2021 NXP 6 6 */ 7 7 8 8 #include <linux/if_bridge.h>
+1 -1
drivers/net/ethernet/mscc/ocelot_net.c
··· 5 5 * mscc_ocelot_switch_lib. 6 6 * 7 7 * Copyright (c) 2017, 2019 Microsemi Corporation 8 - * Copyright 2020-2021 NXP Semiconductors 8 + * Copyright 2020-2021 NXP 9 9 */ 10 10 11 11 #include <linux/if_bridge.h>
+8
drivers/net/ethernet/qlogic/qed/qed_iwarp.c
··· 1297 1297 prev_weight = weight; 1298 1298 1299 1299 while (weight) { 1300 + /* If the HW device is during recovery, all resources are 1301 + * immediately reset without receiving a per-cid indication 1302 + * from HW. In this case we don't expect the cid_map to be 1303 + * cleared. 1304 + */ 1305 + if (p_hwfn->cdev->recov_in_prog) 1306 + return 0; 1307 + 1300 1308 msleep(QED_IWARP_MAX_CID_CLEAN_TIME); 1301 1309 1302 1310 weight = bitmap_weight(bmap->bitmap, bmap->max_count);
+8
drivers/net/ethernet/qlogic/qed/qed_roce.c
··· 77 77 * Beyond the added delay we clear the bitmap anyway. 78 78 */ 79 79 while (bitmap_weight(rcid_map->bitmap, rcid_map->max_count)) { 80 + /* If the HW device is during recovery, all resources are 81 + * immediately reset without receiving a per-cid indication 82 + * from HW. In this case we don't expect the cid bitmap to be 83 + * cleared. 84 + */ 85 + if (p_hwfn->cdev->recov_in_prog) 86 + return; 87 + 80 88 msleep(100); 81 89 if (wait_count++ > 20) { 82 90 DP_NOTICE(p_hwfn, "cid bitmap wait timed out\n");
+1 -1
drivers/net/pcs/pcs-xpcs-nxp.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 - /* Copyright 2021 NXP Semiconductors 2 + /* Copyright 2021 NXP 3 3 */ 4 4 #include <linux/pcs/pcs-xpcs.h> 5 5 #include "pcs-xpcs.h"
+11
drivers/net/phy/mdio_device.c
··· 179 179 return 0; 180 180 } 181 181 182 + static void mdio_shutdown(struct device *dev) 183 + { 184 + struct mdio_device *mdiodev = to_mdio_device(dev); 185 + struct device_driver *drv = mdiodev->dev.driver; 186 + struct mdio_driver *mdiodrv = to_mdio_driver(drv); 187 + 188 + if (mdiodrv->shutdown) 189 + mdiodrv->shutdown(mdiodev); 190 + } 191 + 182 192 /** 183 193 * mdio_driver_register - register an mdio_driver with the MDIO layer 184 194 * @drv: new mdio_driver to register ··· 203 193 mdiodrv->driver.bus = &mdio_bus_type; 204 194 mdiodrv->driver.probe = mdio_probe; 205 195 mdiodrv->driver.remove = mdio_remove; 196 + mdiodrv->driver.shutdown = mdio_shutdown; 206 197 207 198 retval = driver_register(&mdiodrv->driver); 208 199 if (retval) {
+5 -7
drivers/net/usb/hso.c
··· 2719 2719 2720 2720 serial = kzalloc(sizeof(*serial), GFP_KERNEL); 2721 2721 if (!serial) 2722 - goto exit; 2722 + goto err_free_dev; 2723 2723 2724 2724 hso_dev->port_data.dev_serial = serial; 2725 2725 serial->parent = hso_dev; 2726 2726 2727 2727 if (hso_serial_common_create 2728 2728 (serial, 1, CTRL_URB_RX_SIZE, CTRL_URB_TX_SIZE)) 2729 - goto exit; 2729 + goto err_free_serial; 2730 2730 2731 2731 serial->tx_data_length--; 2732 2732 serial->write_data = hso_mux_serial_write_data; ··· 2742 2742 /* done, return it */ 2743 2743 return hso_dev; 2744 2744 2745 - exit: 2746 - if (serial) { 2747 - tty_unregister_device(tty_drv, serial->minor); 2748 - kfree(serial); 2749 - } 2745 + err_free_serial: 2746 + kfree(serial); 2747 + err_free_dev: 2750 2748 kfree(hso_dev); 2751 2749 return NULL; 2752 2750
+4
drivers/net/virtio_net.c
··· 423 423 424 424 skb_reserve(skb, p - buf); 425 425 skb_put(skb, len); 426 + 427 + page = (struct page *)page->private; 428 + if (page) 429 + give_pages(rq, page); 426 430 goto ok; 427 431 } 428 432
+1 -1
drivers/net/vxlan.c
··· 4756 4756 LIST_HEAD(list); 4757 4757 unsigned int h; 4758 4758 4759 - rtnl_lock(); 4760 4759 list_for_each_entry(net, net_list, exit_list) { 4761 4760 struct vxlan_net *vn = net_generic(net, vxlan_net_id); 4762 4761 4763 4762 unregister_nexthop_notifier(net, &vn->nexthop_notifier_block); 4764 4763 } 4764 + rtnl_lock(); 4765 4765 list_for_each_entry(net, net_list, exit_list) 4766 4766 vxlan_destroy_tunnels(net, &list); 4767 4767
+1 -1
drivers/net/xen-netback/netback.c
··· 499 499 * the header's copy failed, and they are 500 500 * sharing a slot, send an error 501 501 */ 502 - if (i == 0 && sharedslot) 502 + if (i == 0 && !first_shinfo && sharedslot) 503 503 xenvif_idx_release(queue, pending_idx, 504 504 XEN_NETIF_RSP_ERROR); 505 505 else
+1
drivers/nfc/st-nci/spi.c
··· 278 278 279 279 static struct spi_device_id st_nci_spi_id_table[] = { 280 280 {ST_NCI_SPI_DRIVER_NAME, 0}, 281 + {"st21nfcb-spi", 0}, 281 282 {} 282 283 }; 283 284 MODULE_DEVICE_TABLE(spi, st_nci_spi_id_table);
+17 -16
drivers/nvme/host/core.c
··· 13 13 #include <linux/kernel.h> 14 14 #include <linux/module.h> 15 15 #include <linux/backing-dev.h> 16 - #include <linux/list_sort.h> 17 16 #include <linux/slab.h> 18 17 #include <linux/types.h> 19 18 #include <linux/pr.h> ··· 3715 3716 return ret; 3716 3717 } 3717 3718 3718 - static int ns_cmp(void *priv, const struct list_head *a, 3719 - const struct list_head *b) 3720 - { 3721 - struct nvme_ns *nsa = container_of(a, struct nvme_ns, list); 3722 - struct nvme_ns *nsb = container_of(b, struct nvme_ns, list); 3723 - 3724 - return nsa->head->ns_id - nsb->head->ns_id; 3725 - } 3726 - 3727 3719 struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid) 3728 3720 { 3729 3721 struct nvme_ns *ns, *ret = NULL; ··· 3734 3744 return ret; 3735 3745 } 3736 3746 EXPORT_SYMBOL_NS_GPL(nvme_find_get_ns, NVME_TARGET_PASSTHRU); 3747 + 3748 + /* 3749 + * Add the namespace to the controller list while keeping the list ordered. 3750 + */ 3751 + static void nvme_ns_add_to_ctrl_list(struct nvme_ns *ns) 3752 + { 3753 + struct nvme_ns *tmp; 3754 + 3755 + list_for_each_entry_reverse(tmp, &ns->ctrl->namespaces, list) { 3756 + if (tmp->head->ns_id < ns->head->ns_id) { 3757 + list_add(&ns->list, &tmp->list); 3758 + return; 3759 + } 3760 + } 3761 + list_add(&ns->list, &ns->ctrl->namespaces); 3762 + } 3737 3763 3738 3764 static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid, 3739 3765 struct nvme_ns_ids *ids) ··· 3801 3795 goto out_unlink_ns; 3802 3796 3803 3797 down_write(&ctrl->namespaces_rwsem); 3804 - list_add_tail(&ns->list, &ctrl->namespaces); 3798 + nvme_ns_add_to_ctrl_list(ns); 3805 3799 up_write(&ctrl->namespaces_rwsem); 3806 - 3807 3800 nvme_get_ctrl(ctrl); 3808 3801 3809 3802 if (device_add_disk(ctrl->device, ns->disk, nvme_ns_id_attr_groups)) ··· 4085 4080 if (nvme_scan_ns_list(ctrl) != 0) 4086 4081 nvme_scan_ns_sequential(ctrl); 4087 4082 mutex_unlock(&ctrl->scan_lock); 4088 - 4089 - down_write(&ctrl->namespaces_rwsem); 4090 - list_sort(NULL, &ctrl->namespaces, ns_cmp); 4091 - up_write(&ctrl->namespaces_rwsem); 4092 4083 } 4093 4084 4094 4085 /*
+9 -9
drivers/nvme/host/fc.c
··· 2487 2487 */ 2488 2488 if (ctrl->ctrl.queue_count > 1) { 2489 2489 nvme_stop_queues(&ctrl->ctrl); 2490 + nvme_sync_io_queues(&ctrl->ctrl); 2490 2491 blk_mq_tagset_busy_iter(&ctrl->tag_set, 2491 2492 nvme_fc_terminate_exchange, &ctrl->ctrl); 2492 2493 blk_mq_tagset_wait_completed_request(&ctrl->tag_set); ··· 2511 2510 * clean up the admin queue. Same thing as above. 2512 2511 */ 2513 2512 blk_mq_quiesce_queue(ctrl->ctrl.admin_q); 2513 + blk_sync_queue(ctrl->ctrl.admin_q); 2514 2514 blk_mq_tagset_busy_iter(&ctrl->admin_tag_set, 2515 2515 nvme_fc_terminate_exchange, &ctrl->ctrl); 2516 2516 blk_mq_tagset_wait_completed_request(&ctrl->admin_tag_set); ··· 2953 2951 if (ctrl->ctrl.queue_count == 1) 2954 2952 return 0; 2955 2953 2954 + if (prior_ioq_cnt != nr_io_queues) { 2955 + dev_info(ctrl->ctrl.device, 2956 + "reconnect: revising io queue count from %d to %d\n", 2957 + prior_ioq_cnt, nr_io_queues); 2958 + blk_mq_update_nr_hw_queues(&ctrl->tag_set, nr_io_queues); 2959 + } 2960 + 2956 2961 ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1); 2957 2962 if (ret) 2958 2963 goto out_free_io_queues; ··· 2967 2958 ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1); 2968 2959 if (ret) 2969 2960 goto out_delete_hw_queues; 2970 - 2971 - if (prior_ioq_cnt != nr_io_queues) { 2972 - dev_info(ctrl->ctrl.device, 2973 - "reconnect: revising io queue count from %d to %d\n", 2974 - prior_ioq_cnt, nr_io_queues); 2975 - nvme_wait_freeze(&ctrl->ctrl); 2976 - blk_mq_update_nr_hw_queues(&ctrl->tag_set, nr_io_queues); 2977 - nvme_unfreeze(&ctrl->ctrl); 2978 - } 2979 2961 2980 2962 return 0; 2981 2963
+10 -3
drivers/nvme/host/tcp.c
··· 620 620 cpu_to_le32(data->hdr.hlen + hdgst + req->pdu_len + ddgst); 621 621 data->ttag = pdu->ttag; 622 622 data->command_id = nvme_cid(rq); 623 - data->data_offset = cpu_to_le32(req->data_sent); 623 + data->data_offset = pdu->r2t_offset; 624 624 data->data_length = cpu_to_le32(req->pdu_len); 625 625 return 0; 626 626 } ··· 953 953 nvme_tcp_ddgst_update(queue->snd_hash, page, 954 954 offset, ret); 955 955 956 - /* fully successful last write*/ 956 + /* 957 + * update the request iterator except for the last payload send 958 + * in the request where we don't want to modify it as we may 959 + * compete with the RX path completing the request. 960 + */ 961 + if (req->data_sent + ret < req->data_len) 962 + nvme_tcp_advance_req(req, ret); 963 + 964 + /* fully successful last send in current PDU */ 957 965 if (last && ret == len) { 958 966 if (queue->data_digest) { 959 967 nvme_tcp_ddgst_final(queue->snd_hash, ··· 973 965 } 974 966 return 1; 975 967 } 976 - nvme_tcp_advance_req(req, ret); 977 968 } 978 969 return -EAGAIN; 979 970 }
+1
drivers/nvmem/Kconfig
··· 109 109 110 110 config NVMEM_NINTENDO_OTP 111 111 tristate "Nintendo Wii and Wii U OTP Support" 112 + depends on WII || COMPILE_TEST 112 113 help 113 114 This is a driver exposing the OTP of a Nintendo Wii or Wii U console. 114 115
+1 -1
drivers/pci/Kconfig
··· 110 110 111 111 config XEN_PCIDEV_FRONTEND 112 112 tristate "Xen PCI Frontend" 113 - depends on X86 && XEN 113 + depends on XEN_PV 114 114 select PCI_XEN 115 115 select XEN_XENBUS_FRONTEND 116 116 default y
+1 -1
drivers/platform/x86/amd-pmc.c
··· 71 71 #define AMD_CPU_ID_YC 0x14B5 72 72 73 73 #define PMC_MSG_DELAY_MIN_US 100 74 - #define RESPONSE_REGISTER_LOOP_MAX 200 74 + #define RESPONSE_REGISTER_LOOP_MAX 20000 75 75 76 76 #define SOC_SUBSYSTEM_IP_MAX 12 77 77 #define DELAY_MIN_US 2000
+1 -2
drivers/platform/x86/dell/Kconfig
··· 166 166 167 167 config DELL_WMI_PRIVACY 168 168 bool "Dell WMI Hardware Privacy Support" 169 - depends on DELL_WMI 170 - depends on LEDS_TRIGGER_AUDIO 169 + depends on LEDS_TRIGGER_AUDIO = y || DELL_WMI = LEDS_TRIGGER_AUDIO 171 170 help 172 171 This option adds integration with the "Dell Hardware Privacy" 173 172 feature of Dell laptops to the dell-wmi driver.
+1
drivers/platform/x86/gigabyte-wmi.c
··· 144 144 DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550 AORUS ELITE"), 145 145 DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550 AORUS ELITE V2"), 146 146 DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550 GAMING X V2"), 147 + DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550I AORUS PRO AX"), 147 148 DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550M AORUS PRO-P"), 148 149 DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550M DS3H"), 149 150 DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("Z390 I AORUS PRO WIFI-CF"),
+22 -5
drivers/platform/x86/intel/hid.c
··· 118 118 { } 119 119 }; 120 120 121 + /* 122 + * Some devices, even non convertible ones, can send incorrect SW_TABLET_MODE 123 + * reports. Accept such reports only from devices in this list. 124 + */ 125 + static const struct dmi_system_id dmi_auto_add_switch[] = { 126 + { 127 + .matches = { 128 + DMI_EXACT_MATCH(DMI_CHASSIS_TYPE, "31" /* Convertible */), 129 + }, 130 + }, 131 + { 132 + .matches = { 133 + DMI_EXACT_MATCH(DMI_CHASSIS_TYPE, "32" /* Detachable */), 134 + }, 135 + }, 136 + {} /* Array terminator */ 137 + }; 138 + 121 139 struct intel_hid_priv { 122 140 struct input_dev *input_dev; 123 141 struct input_dev *array; 124 142 struct input_dev *switches; 125 143 bool wakeup_mode; 126 - bool dual_accel; 144 + bool auto_add_switch; 127 145 }; 128 146 129 147 #define HID_EVENT_FILTER_UUID "eeec56b3-4442-408f-a792-4edd4d758054" ··· 470 452 * Some convertible have unreliable VGBS return which could cause incorrect 471 453 * SW_TABLET_MODE report, in these cases we enable support when receiving 472 454 * the first event instead of during driver setup. 473 - * 474 - * See dual_accel_detect.h for more info on the dual_accel check. 475 455 */ 476 - if (!priv->switches && !priv->dual_accel && (event == 0xcc || event == 0xcd)) { 456 + if (!priv->switches && priv->auto_add_switch && (event == 0xcc || event == 0xcd)) { 477 457 dev_info(&device->dev, "switch event received, enable switches supports\n"); 478 458 err = intel_hid_switches_setup(device); 479 459 if (err) ··· 612 596 return -ENOMEM; 613 597 dev_set_drvdata(&device->dev, priv); 614 598 615 - priv->dual_accel = dual_accel_detect(); 599 + /* See dual_accel_detect.h for more info on the dual_accel check. */ 600 + priv->auto_add_switch = dmi_check_system(dmi_auto_add_switch) && !dual_accel_detect(); 616 601 617 602 err = intel_hid_input_setup(device); 618 603 if (err) {
+1 -2
drivers/platform/x86/intel/punit_ipc.c
··· 8 8 * which provide mailbox interface for power management usage. 9 9 */ 10 10 11 - #include <linux/acpi.h> 12 11 #include <linux/bitops.h> 13 12 #include <linux/delay.h> 14 13 #include <linux/device.h> ··· 318 319 .remove = intel_punit_ipc_remove, 319 320 .driver = { 320 321 .name = "intel_punit_ipc", 321 - .acpi_match_table = ACPI_PTR(punit_ipc_acpi_ids), 322 + .acpi_match_table = punit_ipc_acpi_ids, 322 323 }, 323 324 }; 324 325
+1 -1
drivers/platform/x86/lg-laptop.c
··· 655 655 goto out_platform_registered; 656 656 } 657 657 product = dmi_get_system_info(DMI_PRODUCT_NAME); 658 - if (strlen(product) > 4) 658 + if (product && strlen(product) > 4) 659 659 switch (product[4]) { 660 660 case '5': 661 661 case '6':
+50 -4
drivers/platform/x86/touchscreen_dmi.c
··· 100 100 }; 101 101 102 102 static const struct property_entry chuwi_hi10_plus_props[] = { 103 - PROPERTY_ENTRY_U32("touchscreen-min-x", 0), 104 - PROPERTY_ENTRY_U32("touchscreen-min-y", 5), 105 - PROPERTY_ENTRY_U32("touchscreen-size-x", 1914), 106 - PROPERTY_ENTRY_U32("touchscreen-size-y", 1283), 103 + PROPERTY_ENTRY_U32("touchscreen-min-x", 12), 104 + PROPERTY_ENTRY_U32("touchscreen-min-y", 10), 105 + PROPERTY_ENTRY_U32("touchscreen-size-x", 1908), 106 + PROPERTY_ENTRY_U32("touchscreen-size-y", 1270), 107 107 PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-chuwi-hi10plus.fw"), 108 108 PROPERTY_ENTRY_U32("silead,max-fingers", 10), 109 109 PROPERTY_ENTRY_BOOL("silead,home-button"), ··· 111 111 }; 112 112 113 113 static const struct ts_dmi_data chuwi_hi10_plus_data = { 114 + .embedded_fw = { 115 + .name = "silead/gsl1680-chuwi-hi10plus.fw", 116 + .prefix = { 0xf0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 }, 117 + .length = 34056, 118 + .sha256 = { 0xfd, 0x0a, 0x08, 0x08, 0x3c, 0xa6, 0x34, 0x4e, 119 + 0x2c, 0x49, 0x9c, 0xcd, 0x7d, 0x44, 0x9d, 0x38, 120 + 0x10, 0x68, 0xb5, 0xbd, 0xb7, 0x2a, 0x63, 0xb5, 121 + 0x67, 0x0b, 0x96, 0xbd, 0x89, 0x67, 0x85, 0x09 }, 122 + }, 114 123 .acpi_name = "MSSL0017:00", 115 124 .properties = chuwi_hi10_plus_props, 116 125 }; ··· 148 139 }, 149 140 .acpi_name = "MSSL1680:00", 150 141 .properties = chuwi_hi10_pro_props, 142 + }; 143 + 144 + static const struct property_entry chuwi_hibook_props[] = { 145 + PROPERTY_ENTRY_U32("touchscreen-min-x", 30), 146 + PROPERTY_ENTRY_U32("touchscreen-min-y", 4), 147 + PROPERTY_ENTRY_U32("touchscreen-size-x", 1892), 148 + PROPERTY_ENTRY_U32("touchscreen-size-y", 1276), 149 + PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"), 150 + PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"), 151 + PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-chuwi-hibook.fw"), 152 + PROPERTY_ENTRY_U32("silead,max-fingers", 10), 153 + PROPERTY_ENTRY_BOOL("silead,home-button"), 154 + { } 155 + }; 156 + 157 + static const struct ts_dmi_data chuwi_hibook_data = { 158 + .embedded_fw = { 159 + .name = "silead/gsl1680-chuwi-hibook.fw", 160 + .prefix = { 0xf0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 }, 161 + .length = 40392, 162 + .sha256 = { 0xf7, 0xc0, 0xe8, 0x5a, 0x6c, 0xf2, 0xeb, 0x8d, 163 + 0x12, 0xc4, 0x45, 0xbf, 0x55, 0x13, 0x4c, 0x1a, 164 + 0x13, 0x04, 0x31, 0x08, 0x65, 0x73, 0xf7, 0xa8, 165 + 0x1b, 0x7d, 0x59, 0xc9, 0xe6, 0x97, 0xf7, 0x38 }, 166 + }, 167 + .acpi_name = "MSSL0017:00", 168 + .properties = chuwi_hibook_props, 151 169 }; 152 170 153 171 static const struct property_entry chuwi_vi8_props[] = { ··· 1013 977 DMI_MATCH(DMI_BOARD_VENDOR, "Hampoo"), 1014 978 DMI_MATCH(DMI_PRODUCT_NAME, "Hi10 pro tablet"), 1015 979 DMI_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"), 980 + }, 981 + }, 982 + { 983 + /* Chuwi HiBook (CWI514) */ 984 + .driver_data = (void *)&chuwi_hibook_data, 985 + .matches = { 986 + DMI_MATCH(DMI_BOARD_VENDOR, "Hampoo"), 987 + DMI_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"), 988 + /* Above matches are too generic, add bios-date match */ 989 + DMI_MATCH(DMI_BIOS_DATE, "05/07/2016"), 1016 990 }, 1017 991 }, 1018 992 {
+1
drivers/ptp/Kconfig
··· 174 174 depends on I2C && MTD 175 175 depends on SERIAL_8250 176 176 depends on !S390 177 + depends on COMMON_CLK 177 178 select NET_DEVLINK 178 179 help 179 180 This driver adds support for an OpenCompute time card.
-2
drivers/regulator/max14577-regulator.c
··· 269 269 MODULE_AUTHOR("Krzysztof Kozlowski <krzk@kernel.org>"); 270 270 MODULE_DESCRIPTION("Maxim 14577/77836 regulator driver"); 271 271 MODULE_LICENSE("GPL"); 272 - MODULE_ALIAS("platform:max14577-regulator"); 273 - MODULE_ALIAS("platform:max77836-regulator");
+1 -1
drivers/regulator/qcom-rpmh-regulator.c
··· 991 991 RPMH_VREG("ldo4", "ldo%s4", &pmic5_nldo, "vdd-l4"), 992 992 RPMH_VREG("ldo5", "ldo%s5", &pmic5_pldo, "vdd-l5-l6"), 993 993 RPMH_VREG("ldo6", "ldo%s6", &pmic5_pldo, "vdd-l5-l6"), 994 - RPMH_VREG("ldo7", "ldo%s6", &pmic5_pldo_lv, "vdd-l7"), 994 + RPMH_VREG("ldo7", "ldo%s7", &pmic5_pldo_lv, "vdd-l7"), 995 995 {} 996 996 }; 997 997
+8 -2
drivers/s390/cio/ccwgroup.c
··· 77 77 /** 78 78 * ccwgroup_set_offline() - disable a ccwgroup device 79 79 * @gdev: target ccwgroup device 80 + * @call_gdrv: Call the registered gdrv set_offline function 80 81 * 81 82 * This function attempts to put the ccwgroup device into the offline state. 82 83 * Returns: 83 84 * %0 on success and a negative error value on failure. 84 85 */ 85 - int ccwgroup_set_offline(struct ccwgroup_device *gdev) 86 + int ccwgroup_set_offline(struct ccwgroup_device *gdev, bool call_gdrv) 86 87 { 87 88 struct ccwgroup_driver *gdrv = to_ccwgroupdrv(gdev->dev.driver); 88 89 int ret = -EINVAL; ··· 92 91 return -EAGAIN; 93 92 if (gdev->state == CCWGROUP_OFFLINE) 94 93 goto out; 94 + if (!call_gdrv) { 95 + ret = 0; 96 + goto offline; 97 + } 95 98 if (gdrv->set_offline) 96 99 ret = gdrv->set_offline(gdev); 97 100 if (ret) 98 101 goto out; 99 102 103 + offline: 100 104 gdev->state = CCWGROUP_OFFLINE; 101 105 out: 102 106 atomic_set(&gdev->onoff, 0); ··· 130 124 if (value == 1) 131 125 ret = ccwgroup_set_online(gdev); 132 126 else if (value == 0) 133 - ret = ccwgroup_set_offline(gdev); 127 + ret = ccwgroup_set_offline(gdev, true); 134 128 else 135 129 ret = -EINVAL; 136 130 out:
-1
drivers/s390/net/qeth_core.h
··· 858 858 struct napi_struct napi; 859 859 struct qeth_rx rx; 860 860 struct delayed_work buffer_reclaim_work; 861 - struct work_struct close_dev_work; 862 861 }; 863 862 864 863 static inline bool qeth_card_hw_is_reachable(struct qeth_card *card)
+9 -13
drivers/s390/net/qeth_core_main.c
··· 70 70 static int qeth_qdio_establish(struct qeth_card *); 71 71 static void qeth_free_qdio_queues(struct qeth_card *card); 72 72 73 - static void qeth_close_dev_handler(struct work_struct *work) 74 - { 75 - struct qeth_card *card; 76 - 77 - card = container_of(work, struct qeth_card, close_dev_work); 78 - QETH_CARD_TEXT(card, 2, "cldevhdl"); 79 - ccwgroup_set_offline(card->gdev); 80 - } 81 - 82 73 static const char *qeth_get_cardname(struct qeth_card *card) 83 74 { 84 75 if (IS_VM_NIC(card)) { ··· 192 201 list_for_each_entry_safe(pool_entry, tmp, 193 202 &card->qdio.in_buf_pool.entry_list, list) 194 203 list_del(&pool_entry->list); 204 + 205 + if (!queue) 206 + return; 195 207 196 208 for (i = 0; i < ARRAY_SIZE(queue->bufs); i++) 197 209 queue->bufs[i].pool_entry = NULL; ··· 786 792 case IPA_CMD_STOPLAN: 787 793 if (cmd->hdr.return_code == IPA_RC_VEPA_TO_VEB_TRANSITION) { 788 794 dev_err(&card->gdev->dev, 789 - "Interface %s is down because the adjacent port is no longer in reflective relay mode\n", 795 + "Adjacent port of interface %s is no longer in reflective relay mode, trigger recovery\n", 790 796 netdev_name(card->dev)); 791 - schedule_work(&card->close_dev_work); 797 + /* Set offline, then probably fail to set online: */ 798 + qeth_schedule_recovery(card); 792 799 } else { 800 + /* stay online for subsequent STARTLAN */ 793 801 dev_warn(&card->gdev->dev, 794 802 "The link for interface %s on CHPID 0x%X failed\n", 795 803 netdev_name(card->dev), card->info.chpid); ··· 1533 1537 INIT_LIST_HEAD(&card->ipato.entries); 1534 1538 qeth_init_qdio_info(card); 1535 1539 INIT_DELAYED_WORK(&card->buffer_reclaim_work, qeth_buffer_reclaim_work); 1536 - INIT_WORK(&card->close_dev_work, qeth_close_dev_handler); 1537 1540 hash_init(card->rx_mode_addrs); 1538 1541 hash_init(card->local_addrs4); 1539 1542 hash_init(card->local_addrs6); ··· 5514 5519 dev_info(&card->gdev->dev, 5515 5520 "Device successfully recovered!\n"); 5516 5521 } else { 5517 - ccwgroup_set_offline(card->gdev); 5522 + qeth_set_offline(card, disc, true); 5523 + ccwgroup_set_offline(card->gdev, false); 5518 5524 dev_warn(&card->gdev->dev, 5519 5525 "The qeth device driver failed to recover an error on the device\n"); 5520 5526 }
-1
drivers/s390/net/qeth_l2_main.c
··· 2307 2307 if (gdev->state == CCWGROUP_ONLINE) 2308 2308 qeth_set_offline(card, card->discipline, false); 2309 2309 2310 - cancel_work_sync(&card->close_dev_work); 2311 2310 if (card->dev->reg_state == NETREG_REGISTERED) { 2312 2311 priv = netdev_priv(card->dev); 2313 2312 if (priv->brport_features & BR_LEARNING_SYNC) {
-1
drivers/s390/net/qeth_l3_main.c
··· 1969 1969 if (cgdev->state == CCWGROUP_ONLINE) 1970 1970 qeth_set_offline(card, card->discipline, false); 1971 1971 1972 - cancel_work_sync(&card->close_dev_work); 1973 1972 if (card->dev->reg_state == NETREG_REGISTERED) 1974 1973 unregister_netdev(card->dev); 1975 1974
-11
drivers/scsi/arm/Kconfig
··· 10 10 This enables support for the Acorn SCSI card (aka30). If you have an 11 11 Acorn system with one of these, say Y. If unsure, say N. 12 12 13 - config SCSI_ACORNSCSI_TAGGED_QUEUE 14 - bool "Support SCSI 2 Tagged queueing" 15 - depends on SCSI_ACORNSCSI_3 16 - help 17 - Say Y here to enable tagged queuing support on the Acorn SCSI card. 18 - 19 - This is a feature of SCSI-2 which improves performance: the host 20 - adapter can send several SCSI commands to a device's queue even if 21 - previous commands haven't finished yet. Some SCSI devices don't 22 - implement this properly, so the safe answer is N. 23 - 24 13 config SCSI_ACORNSCSI_SYNC 25 14 bool "Support SCSI 2 Synchronous Transfers" 26 15 depends on SCSI_ACORNSCSI_3
+22 -81
drivers/scsi/arm/acornscsi.c
··· 52 52 * You can tell if you have a device that supports tagged queueing my 53 53 * cating (eg) /proc/scsi/acornscsi/0 and see if the SCSI revision is reported 54 54 * as '2 TAG'. 55 - * 56 - * Also note that CONFIG_SCSI_ACORNSCSI_TAGGED_QUEUE is normally set in the config 57 - * scripts, but disabled here. Once debugged, remove the #undef, otherwise to debug, 58 - * comment out the undef. 59 55 */ 60 - #undef CONFIG_SCSI_ACORNSCSI_TAGGED_QUEUE 56 + 61 57 /* 62 58 * SCSI-II Synchronous transfer support. 63 59 * ··· 167 171 unsigned int result); 168 172 static int acornscsi_reconnect_finish(AS_Host *host); 169 173 static void acornscsi_dma_cleanup(AS_Host *host); 170 - static void acornscsi_abortcmd(AS_Host *host, unsigned char tag); 174 + static void acornscsi_abortcmd(AS_Host *host); 171 175 172 176 /* ==================================================================================== 173 177 * Miscellaneous ··· 737 741 #endif 738 742 739 743 if (from_queue) { 740 - #ifdef CONFIG_SCSI_ACORNSCSI_TAGGED_QUEUE 741 - /* 742 - * tagged queueing - allocate a new tag to this command 743 - */ 744 - if (SCpnt->device->simple_tags) { 745 - SCpnt->device->current_tag += 1; 746 - if (SCpnt->device->current_tag == 0) 747 - SCpnt->device->current_tag = 1; 748 - SCpnt->tag = SCpnt->device->current_tag; 749 - } else 750 - #endif 751 744 set_bit(SCpnt->device->id * 8 + 752 745 (u8)(SCpnt->device->lun & 0x07), host->busyluns); 753 746 ··· 1177 1192 * the device recognises the attention. 1178 1193 */ 1179 1194 if (dmac_read(host, DMAC_STATUS) & STATUS_RQ0) { 1180 - acornscsi_abortcmd(host, host->SCpnt->tag); 1195 + acornscsi_abortcmd(host); 1181 1196 1182 1197 dmac_write(host, DMAC_TXCNTLO, 0); 1183 1198 dmac_write(host, DMAC_TXCNTHI, 0); ··· 1545 1560 acornscsi_sbic_issuecmd(host, CMND_ASSERTATN); 1546 1561 1547 1562 switch (host->scsi.last_message) { 1548 - #ifdef CONFIG_SCSI_ACORNSCSI_TAGGED_QUEUE 1549 - case HEAD_OF_QUEUE_TAG: 1550 - case ORDERED_QUEUE_TAG: 1551 - case SIMPLE_QUEUE_TAG: 1552 - /* 1553 - * ANSI standard says: (Section SCSI-2 Rev. 10c Sect 5.6.17) 1554 - * If a target does not implement tagged queuing and a queue tag 1555 - * message is received, it shall respond with a MESSAGE REJECT 1556 - * message and accept the I/O process as if it were untagged. 1557 - */ 1558 - printk(KERN_NOTICE "scsi%d.%c: disabling tagged queueing\n", 1559 - host->host->host_no, acornscsi_target(host)); 1560 - host->SCpnt->device->simple_tags = 0; 1561 - set_bit(host->SCpnt->device->id * 8 + 1562 - (u8)(host->SCpnt->device->lun & 0x7), host->busyluns); 1563 - break; 1564 - #endif 1565 1563 case EXTENDED_MESSAGE | (EXTENDED_SDTR << 8): 1566 1564 /* 1567 1565 * Target can't handle synchronous transfers ··· 1655 1687 #if 0 1656 1688 /* does the device need the current command aborted */ 1657 1689 if (cmd_aborted) { 1658 - acornscsi_abortcmd(host->SCpnt->tag); 1690 + acornscsi_abortcmd(host); 1659 1691 return; 1660 1692 } 1661 1693 #endif 1662 1694 1663 - #ifdef CONFIG_SCSI_ACORNSCSI_TAGGED_QUEUE 1664 - if (host->SCpnt->tag) { 1665 - unsigned int tag_type; 1666 - 1667 - if (host->SCpnt->cmnd[0] == REQUEST_SENSE || 1668 - host->SCpnt->cmnd[0] == TEST_UNIT_READY || 1669 - host->SCpnt->cmnd[0] == INQUIRY) 1670 - tag_type = HEAD_OF_QUEUE_TAG; 1671 - else 1672 - tag_type = SIMPLE_QUEUE_TAG; 1673 - msgqueue_addmsg(&host->scsi.msgs, 2, tag_type, host->SCpnt->tag); 1674 - } 1675 - #endif 1676 1695 1677 1696 #ifdef CONFIG_SCSI_ACORNSCSI_SYNC 1678 1697 if (host->device[host->SCpnt->device->id].sync_state == SYNC_NEGOCIATE) { ··· 1753 1798 "to reconnect with\n", 1754 1799 host->host->host_no, '0' + target); 1755 1800 acornscsi_dumplog(host, target); 1756 - acornscsi_abortcmd(host, 0); 1801 + acornscsi_abortcmd(host); 1757 1802 if (host->SCpnt) { 1758 1803 queue_add_cmd_tail(&host->queues.disconnected, host->SCpnt); 1759 1804 host->SCpnt = NULL; ··· 1776 1821 host->scsi.disconnectable = 0; 1777 1822 if (host->SCpnt->device->id == host->scsi.reconnected.target && 1778 1823 host->SCpnt->device->lun == host->scsi.reconnected.lun && 1779 - host->SCpnt->tag == host->scsi.reconnected.tag) { 1824 + scsi_cmd_to_tag(host->SCpnt) == host->scsi.reconnected.tag) { 1780 1825 #if (DEBUG & (DEBUG_QUEUES|DEBUG_DISCON)) 1781 1826 DBG(host->SCpnt, printk("scsi%d.%c: reconnected", 1782 1827 host->host->host_no, acornscsi_target(host))); ··· 1803 1848 } 1804 1849 1805 1850 if (!host->SCpnt) 1806 - acornscsi_abortcmd(host, host->scsi.reconnected.tag); 1851 + acornscsi_abortcmd(host); 1807 1852 else { 1808 1853 /* 1809 1854 * Restore data pointer from SAVED pointers. ··· 1844 1889 * Function: void acornscsi_abortcmd(AS_host *host, unsigned char tag) 1845 1890 * Purpose : abort a currently executing command 1846 1891 * Params : host - host with connected command to abort 1847 - * tag - tag to abort 1848 1892 */ 1849 1893 static 1850 - void acornscsi_abortcmd(AS_Host *host, unsigned char tag) 1894 + void acornscsi_abortcmd(AS_Host *host) 1851 1895 { 1852 1896 host->scsi.phase = PHASE_ABORTED; 1853 1897 sbic_arm_write(host, SBIC_CMND, CMND_ASSERTATN); 1854 1898 1855 1899 msgqueue_flush(&host->scsi.msgs); 1856 - #ifdef CONFIG_SCSI_ACORNSCSI_TAGGED_QUEUE 1857 - if (tag) 1858 - msgqueue_addmsg(&host->scsi.msgs, 2, ABORT_TAG, tag); 1859 - else 1860 - #endif 1861 - msgqueue_addmsg(&host->scsi.msgs, 1, ABORT); 1900 + msgqueue_addmsg(&host->scsi.msgs, 1, ABORT); 1862 1901 } 1863 1902 1864 1903 /* ========================================================================================== ··· 1942 1993 printk(KERN_ERR "scsi%d.%c: PHASE_CONNECTING, SSR %02X?\n", 1943 1994 host->host->host_no, acornscsi_target(host), ssr); 1944 1995 acornscsi_dumplog(host, host->SCpnt ? host->SCpnt->device->id : 8); 1945 - acornscsi_abortcmd(host, host->SCpnt->tag); 1996 + acornscsi_abortcmd(host); 1946 1997 } 1947 1998 return INTR_PROCESSING; 1948 1999 ··· 1978 2029 printk(KERN_ERR "scsi%d.%c: PHASE_CONNECTED, SSR %02X?\n", 1979 2030 host->host->host_no, acornscsi_target(host), ssr); 1980 2031 acornscsi_dumplog(host, host->SCpnt ? host->SCpnt->device->id : 8); 1981 - acornscsi_abortcmd(host, host->SCpnt->tag); 2032 + acornscsi_abortcmd(host); 1982 2033 } 1983 2034 return INTR_PROCESSING; 1984 2035 ··· 2024 2075 case 0x18: /* -> PHASE_DATAOUT */ 2025 2076 /* COMMAND -> DATA OUT */ 2026 2077 if (host->scsi.SCp.sent_command != host->SCpnt->cmd_len) 2027 - acornscsi_abortcmd(host, host->SCpnt->tag); 2078 + acornscsi_abortcmd(host); 2028 2079 acornscsi_dma_setup(host, DMA_OUT); 2029 2080 if (!acornscsi_starttransfer(host)) 2030 - acornscsi_abortcmd(host, host->SCpnt->tag); 2081 + acornscsi_abortcmd(host); 2031 2082 host->scsi.phase = PHASE_DATAOUT; 2032 2083 return INTR_IDLE; 2033 2084 2034 2085 case 0x19: /* -> PHASE_DATAIN */ 2035 2086 /* COMMAND -> DATA IN */ 2036 2087 if (host->scsi.SCp.sent_command != host->SCpnt->cmd_len) 2037 - acornscsi_abortcmd(host, host->SCpnt->tag); 2088 + acornscsi_abortcmd(host); 2038 2089 acornscsi_dma_setup(host, DMA_IN); 2039 2090 if (!acornscsi_starttransfer(host)) 2040 - acornscsi_abortcmd(host, host->SCpnt->tag); 2091 + acornscsi_abortcmd(host); 2041 2092 host->scsi.phase = PHASE_DATAIN; 2042 2093 return INTR_IDLE; 2043 2094 ··· 2105 2156 /* MESSAGE IN -> DATA OUT */ 2106 2157 acornscsi_dma_setup(host, DMA_OUT); 2107 2158 if (!acornscsi_starttransfer(host)) 2108 - acornscsi_abortcmd(host, host->SCpnt->tag); 2159 + acornscsi_abortcmd(host); 2109 2160 host->scsi.phase = PHASE_DATAOUT; 2110 2161 return INTR_IDLE; 2111 2162 ··· 2114 2165 /* MESSAGE IN -> DATA IN */ 2115 2166 acornscsi_dma_setup(host, DMA_IN); 2116 2167 if (!acornscsi_starttransfer(host)) 2117 - acornscsi_abortcmd(host, host->SCpnt->tag); 2168 + acornscsi_abortcmd(host); 2118 2169 host->scsi.phase = PHASE_DATAIN; 2119 2170 return INTR_IDLE; 2120 2171 ··· 2155 2206 switch (ssr) { 2156 2207 case 0x19: /* -> PHASE_DATAIN */ 2157 2208 case 0x89: /* -> PHASE_DATAIN */ 2158 - acornscsi_abortcmd(host, host->SCpnt->tag); 2209 + acornscsi_abortcmd(host); 2159 2210 return INTR_IDLE; 2160 2211 2161 2212 case 0x1b: /* -> PHASE_STATUSIN */ ··· 2204 2255 switch (ssr) { 2205 2256 case 0x18: /* -> PHASE_DATAOUT */ 2206 2257 case 0x88: /* -> PHASE_DATAOUT */ 2207 - acornscsi_abortcmd(host, host->SCpnt->tag); 2258 + acornscsi_abortcmd(host); 2208 2259 return INTR_IDLE; 2209 2260 2210 2261 case 0x1b: /* -> PHASE_STATUSIN */ ··· 2431 2482 SCpnt->scsi_done = done; 2432 2483 SCpnt->host_scribble = NULL; 2433 2484 SCpnt->result = 0; 2434 - SCpnt->tag = 0; 2435 2485 SCpnt->SCp.phase = (int)acornscsi_datadirection(SCpnt->cmnd[0]); 2436 2486 SCpnt->SCp.sent_command = 0; 2437 2487 SCpnt->SCp.scsi_xferred = 0; ··· 2529 2581 break; 2530 2582 2531 2583 default: 2532 - acornscsi_abortcmd(host, host->SCpnt->tag); 2584 + acornscsi_abortcmd(host); 2533 2585 res = res_snooze; 2534 2586 } 2535 2587 local_irq_restore(flags); ··· 2695 2747 #ifdef CONFIG_SCSI_ACORNSCSI_SYNC 2696 2748 " SYNC" 2697 2749 #endif 2698 - #ifdef CONFIG_SCSI_ACORNSCSI_TAGGED_QUEUE 2699 - " TAG" 2700 - #endif 2701 2750 #if (DEBUG & DEBUG_NO_WRITE) 2702 2751 " NOWRITE (" __stringify(NO_WRITE) ")" 2703 2752 #endif ··· 2714 2769 seq_printf(m, "AcornSCSI driver v%d.%d.%d" 2715 2770 #ifdef CONFIG_SCSI_ACORNSCSI_SYNC 2716 2771 " SYNC" 2717 - #endif 2718 - #ifdef CONFIG_SCSI_ACORNSCSI_TAGGED_QUEUE 2719 - " TAG" 2720 2772 #endif 2721 2773 #if (DEBUG & DEBUG_NO_WRITE) 2722 2774 " NOWRITE (" __stringify(NO_WRITE) ")" ··· 2769 2827 seq_printf(m, "Device/Lun TaggedQ Sync\n"); 2770 2828 seq_printf(m, " %d/%llu ", scd->id, scd->lun); 2771 2829 if (scd->tagged_supported) 2772 - seq_printf(m, "%3sabled(%3d) ", 2773 - scd->simple_tags ? "en" : "dis", 2774 - scd->current_tag); 2830 + seq_printf(m, "%3sabled ", 2831 + scd->simple_tags ? "en" : "dis"); 2775 2832 else 2776 2833 seq_printf(m, "unsupported "); 2777 2834
+8 -23
drivers/scsi/arm/fas216.c
··· 77 77 * I was thinking that this was a good chip until I found this restriction ;( 78 78 */ 79 79 #define SCSI2_SYNC 80 - #undef SCSI2_TAG 81 80 82 81 #undef DEBUG_CONNECT 83 82 #undef DEBUG_MESSAGES ··· 989 990 info->scsi.disconnectable = 0; 990 991 if (info->SCpnt->device->id == target && 991 992 info->SCpnt->device->lun == lun && 992 - info->SCpnt->tag == tag) { 993 + scsi_cmd_to_rq(info->SCpnt)->tag == tag) { 993 994 fas216_log(info, LOG_CONNECT, "reconnected previously executing command"); 994 995 } else { 995 996 queue_add_cmd_tail(&info->queues.disconnected, info->SCpnt); ··· 1790 1791 /* 1791 1792 * add tag message if required 1792 1793 */ 1793 - if (SCpnt->tag) 1794 - msgqueue_addmsg(&info->scsi.msgs, 2, SIMPLE_QUEUE_TAG, SCpnt->tag); 1794 + if (SCpnt->device->simple_tags) 1795 + msgqueue_addmsg(&info->scsi.msgs, 2, SIMPLE_QUEUE_TAG, 1796 + scsi_cmd_to_rq(SCpnt)->tag); 1795 1797 1796 1798 do { 1797 1799 #ifdef SCSI2_SYNC ··· 1815 1815 1816 1816 static void fas216_allocate_tag(FAS216_Info *info, struct scsi_cmnd *SCpnt) 1817 1817 { 1818 - #ifdef SCSI2_TAG 1819 - /* 1820 - * tagged queuing - allocate a new tag to this command 1821 - */ 1822 - if (SCpnt->device->simple_tags && SCpnt->cmnd[0] != REQUEST_SENSE && 1823 - SCpnt->cmnd[0] != INQUIRY) { 1824 - SCpnt->device->current_tag += 1; 1825 - if (SCpnt->device->current_tag == 0) 1826 - SCpnt->device->current_tag = 1; 1827 - SCpnt->tag = SCpnt->device->current_tag; 1828 - } else 1829 - #endif 1830 - set_bit(SCpnt->device->id * 8 + 1831 - (u8)(SCpnt->device->lun & 0x7), info->busyluns); 1818 + set_bit(SCpnt->device->id * 8 + 1819 + (u8)(SCpnt->device->lun & 0x7), info->busyluns); 1832 1820 1833 1821 info->stats.removes += 1; 1834 1822 switch (SCpnt->cmnd[0]) { ··· 2105 2117 init_SCp(SCpnt); 2106 2118 SCpnt->SCp.Message = 0; 2107 2119 SCpnt->SCp.Status = 0; 2108 - SCpnt->tag = 0; 2109 2120 SCpnt->host_scribble = (void *)fas216_rq_sns_done; 2110 2121 2111 2122 /* ··· 2210 2223 init_SCp(SCpnt); 2211 2224 2212 2225 info->stats.queues += 1; 2213 - SCpnt->tag = 0; 2214 2226 2215 2227 spin_lock(&info->host_lock); 2216 2228 ··· 2989 3003 dev = &info->device[scd->id]; 2990 3004 seq_printf(m, " %d/%llu ", scd->id, scd->lun); 2991 3005 if (scd->tagged_supported) 2992 - seq_printf(m, "%3sabled(%3d) ", 2993 - scd->simple_tags ? "en" : "dis", 2994 - scd->current_tag); 3006 + seq_printf(m, "%3sabled ", 3007 + scd->simple_tags ? "en" : "dis"); 2995 3008 else 2996 3009 seq_puts(m, "unsupported "); 2997 3010
+1 -1
drivers/scsi/arm/queue.c
··· 214 214 list_for_each(l, &queue->head) { 215 215 QE_t *q = list_entry(l, QE_t, list); 216 216 if (q->SCpnt->device->id == target && q->SCpnt->device->lun == lun && 217 - q->SCpnt->tag == tag) { 217 + scsi_cmd_to_rq(q->SCpnt)->tag == tag) { 218 218 SCpnt = __queue_remove(queue, l); 219 219 break; 220 220 }
+2 -2
drivers/scsi/elx/efct/efct_lio.c
··· 880 880 struct efct *efct = lio_vport->efct; 881 881 unsigned long flags = 0; 882 882 883 - spin_lock_irqsave(&efct->tgt_efct.efct_lio_lock, flags); 884 - 885 883 if (lio_vport->fc_vport) 886 884 fc_vport_terminate(lio_vport->fc_vport); 885 + 886 + spin_lock_irqsave(&efct->tgt_efct.efct_lio_lock, flags); 887 887 888 888 list_for_each_entry_safe(vport, next_vport, &efct->tgt_efct.vport_list, 889 889 list_entry) {
+3 -4
drivers/scsi/elx/libefc/efc_device.c
··· 928 928 break; 929 929 930 930 case EFC_EVT_NPORT_TOPOLOGY_NOTIFY: { 931 - enum efc_nport_topology topology = 932 - (enum efc_nport_topology)arg; 931 + enum efc_nport_topology *topology = arg; 933 932 934 933 WARN_ON(node->nport->domain->attached); 935 934 936 935 WARN_ON(node->send_ls_acc != EFC_NODE_SEND_LS_ACC_PLOGI); 937 936 938 937 node_printf(node, "topology notification, topology=%d\n", 939 - topology); 938 + *topology); 940 939 941 940 /* At the time the PLOGI was received, the topology was unknown, 942 941 * so we didn't know which node would perform the domain attach: 943 942 * 1. The node from which the PLOGI was sent (p2p) or 944 943 * 2. The node to which the FLOGI was sent (fabric). 945 944 */ 946 - if (topology == EFC_NPORT_TOPO_P2P) { 945 + if (*topology == EFC_NPORT_TOPO_P2P) { 947 946 /* if this is p2p, need to attach to the domain using 948 947 * the d_id from the PLOGI received 949 948 */
+1 -2
drivers/scsi/elx/libefc/efc_fabric.c
··· 107 107 efc_fabric_notify_topology(struct efc_node *node) 108 108 { 109 109 struct efc_node *tmp_node; 110 - enum efc_nport_topology topology = node->nport->topology; 111 110 unsigned long index; 112 111 113 112 /* ··· 117 118 if (tmp_node != node) { 118 119 efc_node_post_event(tmp_node, 119 120 EFC_EVT_NPORT_TOPOLOGY_NOTIFY, 120 - (void *)topology); 121 + &node->nport->topology); 121 122 } 122 123 } 123 124 }
+4 -6
drivers/scsi/lpfc/lpfc_attr.c
··· 285 285 "6312 Catching potential buffer " 286 286 "overflow > PAGE_SIZE = %lu bytes\n", 287 287 PAGE_SIZE); 288 - strscpy(buf + PAGE_SIZE - 1 - 289 - strnlen(LPFC_INFO_MORE_STR, PAGE_SIZE - 1), 290 - LPFC_INFO_MORE_STR, 291 - strnlen(LPFC_INFO_MORE_STR, PAGE_SIZE - 1) 292 - + 1); 288 + strscpy(buf + PAGE_SIZE - 1 - sizeof(LPFC_INFO_MORE_STR), 289 + LPFC_INFO_MORE_STR, sizeof(LPFC_INFO_MORE_STR) + 1); 293 290 } 294 291 return len; 295 292 } ··· 6201 6204 len = scnprintf(buf, PAGE_SIZE, "SGL sz: %d total SGEs: %d\n", 6202 6205 phba->cfg_sg_dma_buf_size, phba->cfg_total_seg_cnt); 6203 6206 6204 - len += scnprintf(buf + len, PAGE_SIZE, "Cfg: %d SCSI: %d NVME: %d\n", 6207 + len += scnprintf(buf + len, PAGE_SIZE - len, 6208 + "Cfg: %d SCSI: %d NVME: %d\n", 6205 6209 phba->cfg_sg_seg_cnt, phba->cfg_scsi_seg_cnt, 6206 6210 phba->cfg_nvme_seg_cnt); 6207 6211 return len;
+5 -5
drivers/scsi/lpfc/lpfc_els.c
··· 4015 4015 be32_to_cpu(pcgd->desc_tag), 4016 4016 be32_to_cpu(pcgd->desc_len), 4017 4017 be32_to_cpu(pcgd->xmt_signal_capability), 4018 - be32_to_cpu(pcgd->xmt_signal_frequency.count), 4019 - be32_to_cpu(pcgd->xmt_signal_frequency.units), 4018 + be16_to_cpu(pcgd->xmt_signal_frequency.count), 4019 + be16_to_cpu(pcgd->xmt_signal_frequency.units), 4020 4020 be32_to_cpu(pcgd->rcv_signal_capability), 4021 - be32_to_cpu(pcgd->rcv_signal_frequency.count), 4022 - be32_to_cpu(pcgd->rcv_signal_frequency.units)); 4021 + be16_to_cpu(pcgd->rcv_signal_frequency.count), 4022 + be16_to_cpu(pcgd->rcv_signal_frequency.units)); 4023 4023 4024 4024 /* Compare driver and Fport capabilities and choose 4025 4025 * least common. ··· 9387 9387 /* Extract the next WWPN from the payload */ 9388 9388 wwn = *wwnlist++; 9389 9389 wwpn = be64_to_cpu(wwn); 9390 - len += scnprintf(buf + len, LPFC_FPIN_WWPN_LINE_SZ, 9390 + len += scnprintf(buf + len, LPFC_FPIN_WWPN_LINE_SZ - len, 9391 9391 " %016llx", wwpn); 9392 9392 9393 9393 /* Log a message if we are on the last WWPN
+1 -1
drivers/scsi/lpfc/lpfc_hw4.h
··· 1167 1167 #define lpfc_mbx_rd_object_rlen_MASK 0x00FFFFFF 1168 1168 #define lpfc_mbx_rd_object_rlen_WORD word0 1169 1169 uint32_t rd_object_offset; 1170 - uint32_t rd_object_name[LPFC_MBX_OBJECT_NAME_LEN_DW]; 1170 + __le32 rd_object_name[LPFC_MBX_OBJECT_NAME_LEN_DW]; 1171 1171 #define LPFC_OBJ_NAME_SZ 104 /* 26 x sizeof(uint32_t) is 104. */ 1172 1172 uint32_t rd_object_cnt; 1173 1173 struct lpfc_mbx_host_buf rd_object_hbuf[4];
+10 -10
drivers/scsi/lpfc/lpfc_init.c
··· 5518 5518 if (phba->cgn_fpin_frequency && 5519 5519 phba->cgn_fpin_frequency != LPFC_FPIN_INIT_FREQ) { 5520 5520 value = LPFC_CGN_TIMER_TO_MIN / phba->cgn_fpin_frequency; 5521 - cp->cgn_stat_npm = cpu_to_le32(value); 5521 + cp->cgn_stat_npm = value; 5522 5522 } 5523 5523 value = lpfc_cgn_calc_crc32(cp, LPFC_CGN_INFO_SZ, 5524 5524 LPFC_CGN_CRC32_SEED); ··· 5547 5547 uint32_t mbps; 5548 5548 uint32_t dvalue, wvalue, lvalue, avalue; 5549 5549 uint64_t latsum; 5550 - uint16_t *ptr; 5551 - uint32_t *lptr; 5552 - uint16_t *mptr; 5550 + __le16 *ptr; 5551 + __le32 *lptr; 5552 + __le16 *mptr; 5553 5553 5554 5554 /* Make sure we have a congestion info buffer */ 5555 5555 if (!phba->cgn_i) ··· 5570 5570 if (phba->cgn_fpin_frequency && 5571 5571 phba->cgn_fpin_frequency != LPFC_FPIN_INIT_FREQ) { 5572 5572 value = LPFC_CGN_TIMER_TO_MIN / phba->cgn_fpin_frequency; 5573 - cp->cgn_stat_npm = cpu_to_le32(value); 5573 + cp->cgn_stat_npm = value; 5574 5574 } 5575 5575 5576 5576 /* Read and clear the latency counters for this minute */ ··· 5753 5753 dvalue += le32_to_cpu(cp->cgn_drvr_hr[i]); 5754 5754 wvalue += le32_to_cpu(cp->cgn_warn_hr[i]); 5755 5755 lvalue += le32_to_cpu(cp->cgn_latency_hr[i]); 5756 - mbps += le32_to_cpu(cp->cgn_bw_hr[i]); 5756 + mbps += le16_to_cpu(cp->cgn_bw_hr[i]); 5757 5757 avalue += le32_to_cpu(cp->cgn_alarm_hr[i]); 5758 5758 } 5759 5759 if (lvalue) /* Avg of latency averages */ ··· 8277 8277 return 0; 8278 8278 8279 8279 out_free_hba_hdwq_info: 8280 - free_percpu(phba->sli4_hba.c_stat); 8281 8280 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS 8281 + free_percpu(phba->sli4_hba.c_stat); 8282 8282 out_free_hba_idle_stat: 8283 - kfree(phba->sli4_hba.idle_stat); 8284 8283 #endif 8284 + kfree(phba->sli4_hba.idle_stat); 8285 8285 out_free_hba_eq_info: 8286 8286 free_percpu(phba->sli4_hba.eq_info); 8287 8287 out_free_hba_cpu_map: ··· 13411 13411 13412 13412 /* last used Index initialized to 0xff already */ 13413 13413 13414 - cp->cgn_warn_freq = LPFC_FPIN_INIT_FREQ; 13415 - cp->cgn_alarm_freq = LPFC_FPIN_INIT_FREQ; 13414 + cp->cgn_warn_freq = cpu_to_le16(LPFC_FPIN_INIT_FREQ); 13415 + cp->cgn_alarm_freq = cpu_to_le16(LPFC_FPIN_INIT_FREQ); 13416 13416 crc = lpfc_cgn_calc_crc32(cp, LPFC_CGN_INFO_SZ, LPFC_CGN_CRC32_SEED); 13417 13417 cp->cgn_info_crc = cpu_to_le32(crc); 13418 13418
-2
drivers/scsi/lpfc/lpfc_nvme.c
··· 1489 1489 struct lpfc_nvme_qhandle *lpfc_queue_info; 1490 1490 struct lpfc_nvme_fcpreq_priv *freqpriv; 1491 1491 struct nvme_common_command *sqe; 1492 - #ifdef CONFIG_SCSI_LPFC_DEBUG_FS 1493 1492 uint64_t start = 0; 1494 - #endif 1495 1493 1496 1494 /* Validate pointers. LLDD fault handling with transport does 1497 1495 * have timing races.
+2 -7
drivers/scsi/lpfc/lpfc_scsi.c
··· 1495 1495 lpfc_bg_err_opcodes(struct lpfc_hba *phba, struct scsi_cmnd *sc, 1496 1496 uint8_t *txop, uint8_t *rxop) 1497 1497 { 1498 - uint8_t ret = 0; 1499 1498 1500 1499 if (sc->prot_flags & SCSI_PROT_IP_CHECKSUM) { 1501 1500 switch (scsi_get_prot_op(sc)) { ··· 1547 1548 } 1548 1549 } 1549 1550 1550 - return ret; 1551 + return 0; 1551 1552 } 1552 1553 #endif 1553 1554 ··· 5577 5578 struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device)); 5578 5579 int err, idx; 5579 5580 u8 *uuid = NULL; 5580 - #ifdef CONFIG_SCSI_LPFC_DEBUG_FS 5581 - uint64_t start = 0L; 5581 + uint64_t start; 5582 5582 5583 - if (phba->ktime_on) 5584 - start = ktime_get_ns(); 5585 - #endif 5586 5583 start = ktime_get_ns(); 5587 5584 rdata = lpfc_rport_data_from_scsi_device(cmnd->device); 5588 5585
+3 -2
drivers/scsi/lpfc/lpfc_sli.c
··· 22090 22090 uint32_t shdr_status, shdr_add_status; 22091 22091 union lpfc_sli4_cfg_shdr *shdr; 22092 22092 struct lpfc_dmabuf *pcmd; 22093 + u32 rd_object_name[LPFC_MBX_OBJECT_NAME_LEN_DW] = {0}; 22093 22094 22094 22095 /* sanity check on queue memory */ 22095 22096 if (!datap) ··· 22114 22113 22115 22114 memset((void *)read_object->u.request.rd_object_name, 0, 22116 22115 LPFC_OBJ_NAME_SZ); 22117 - sprintf((uint8_t *)read_object->u.request.rd_object_name, rdobject); 22116 + scnprintf((char *)rd_object_name, sizeof(rd_object_name), rdobject); 22118 22117 for (j = 0; j < strlen(rdobject); j++) 22119 22118 read_object->u.request.rd_object_name[j] = 22120 - cpu_to_le32(read_object->u.request.rd_object_name[j]); 22119 + cpu_to_le32(rd_object_name[j]); 22121 22120 22122 22121 pcmd = kmalloc(sizeof(*pcmd), GFP_KERNEL); 22123 22122 if (pcmd)
+3 -4
drivers/scsi/megaraid/megaraid_sas_base.c
··· 1916 1916 raid = MR_LdRaidGet(ld, local_map_ptr); 1917 1917 1918 1918 if (raid->capability.ldPiMode == MR_PROT_INFO_TYPE_CONTROLLER) 1919 - blk_queue_update_dma_alignment(sdev->request_queue, 0x7); 1919 + blk_queue_update_dma_alignment(sdev->request_queue, 0x7); 1920 1920 1921 1921 mr_device_priv_data->is_tm_capable = 1922 1922 raid->capability.tmCapable; ··· 8033 8033 8034 8034 if (instance->adapter_type != MFI_SERIES) { 8035 8035 megasas_release_fusion(instance); 8036 - pd_seq_map_sz = sizeof(struct MR_PD_CFG_SEQ_NUM_SYNC) + 8036 + pd_seq_map_sz = sizeof(struct MR_PD_CFG_SEQ_NUM_SYNC) + 8037 8037 (sizeof(struct MR_PD_CFG_SEQ) * 8038 8038 (MAX_PHYSICAL_DEVICES - 1)); 8039 8039 for (i = 0; i < 2 ; i++) { ··· 8773 8773 8774 8774 if (event_type & SCAN_VD_CHANNEL) { 8775 8775 if (!instance->requestorId || 8776 - (instance->requestorId && 8777 - megasas_get_ld_vf_affiliation(instance, 0))) { 8776 + megasas_get_ld_vf_affiliation(instance, 0)) { 8778 8777 dcmd_ret = megasas_ld_list_query(instance, 8779 8778 MR_LD_QUERY_TYPE_EXPOSED_TO_HOST); 8780 8779 if (dcmd_ret != DCMD_SUCCESS)
+3 -1
drivers/scsi/mpt3sas/mpt3sas_base.c
··· 1582 1582 * wait for current poll to complete. 1583 1583 */ 1584 1584 for (qid = 0; qid < iopoll_q_count; qid++) { 1585 - while (atomic_read(&ioc->io_uring_poll_queues[qid].busy)) 1585 + while (atomic_read(&ioc->io_uring_poll_queues[qid].busy)) { 1586 + cpu_relax(); 1586 1587 udelay(500); 1588 + } 1587 1589 } 1588 1590 } 1589 1591
+1 -1
drivers/scsi/mpt3sas/mpt3sas_ctl.c
··· 2178 2178 mpt3sas_check_cmd_timeout(ioc, 2179 2179 ioc->ctl_cmds.status, mpi_request, 2180 2180 sizeof(Mpi2DiagReleaseRequest_t)/4, reset_needed); 2181 - *issue_reset = reset_needed; 2181 + *issue_reset = reset_needed; 2182 2182 rc = -EFAULT; 2183 2183 goto out; 2184 2184 }
+1 -2
drivers/scsi/mpt3sas/mpt3sas_scsih.c
··· 10749 10749 case MPI2_EVENT_PCIE_TOPOLOGY_CHANGE_LIST: 10750 10750 _scsih_pcie_topology_change_event(ioc, fw_event); 10751 10751 ioc->current_event = NULL; 10752 - return; 10753 - break; 10752 + return; 10754 10753 } 10755 10754 out: 10756 10755 fw_event_work_put(fw_event);
-23
drivers/scsi/ncr53c8xx.c
··· 1939 1939 static void ncr_put_start_queue(struct ncb *np, struct ccb *cp); 1940 1940 1941 1941 static void insert_into_waiting_list(struct ncb *np, struct scsi_cmnd *cmd); 1942 - static struct scsi_cmnd *retrieve_from_waiting_list(int to_remove, struct ncb *np, struct scsi_cmnd *cmd); 1943 1942 static void process_waiting_list(struct ncb *np, int sts); 1944 1943 1945 - #define remove_from_waiting_list(np, cmd) \ 1946 - retrieve_from_waiting_list(1, (np), (cmd)) 1947 1944 #define requeue_waiting_list(np) process_waiting_list((np), DID_OK) 1948 1945 #define reset_waiting_list(np) process_waiting_list((np), DID_RESET) 1949 1946 ··· 7992 7995 wcmd = (struct scsi_cmnd *) wcmd->next_wcmd; 7993 7996 wcmd->next_wcmd = (char *) cmd; 7994 7997 } 7995 - } 7996 - 7997 - static struct scsi_cmnd *retrieve_from_waiting_list(int to_remove, struct ncb *np, struct scsi_cmnd *cmd) 7998 - { 7999 - struct scsi_cmnd **pcmd = &np->waiting_list; 8000 - 8001 - while (*pcmd) { 8002 - if (cmd == *pcmd) { 8003 - if (to_remove) { 8004 - *pcmd = (struct scsi_cmnd *) cmd->next_wcmd; 8005 - cmd->next_wcmd = NULL; 8006 - } 8007 - #ifdef DEBUG_WAITING_LIST 8008 - printk("%s: cmd %lx retrieved from waiting list\n", ncr_name(np), (u_long) cmd); 8009 - #endif 8010 - return cmd; 8011 - } 8012 - pcmd = (struct scsi_cmnd **) &(*pcmd)->next_wcmd; 8013 - } 8014 - return NULL; 8015 7998 } 8016 7999 8017 8000 static void process_waiting_list(struct ncb *np, int sts)
+2 -1
drivers/scsi/qla2xxx/qla_init.c
··· 7169 7169 return 0; 7170 7170 break; 7171 7171 case QLA2XXX_INI_MODE_DUAL: 7172 - if (!qla_dual_mode_enabled(vha)) 7172 + if (!qla_dual_mode_enabled(vha) && 7173 + !qla_ini_mode_enabled(vha)) 7173 7174 return 0; 7174 7175 break; 7175 7176 case QLA2XXX_INI_MODE_ENABLED:
+4 -4
drivers/scsi/scsi_transport_iscsi.c
··· 441 441 struct iscsi_transport *t = iface->transport; 442 442 int param = -1; 443 443 444 - if (attr == &dev_attr_iface_enabled.attr) 445 - param = ISCSI_NET_PARAM_IFACE_ENABLE; 446 - else if (attr == &dev_attr_iface_def_taskmgmt_tmo.attr) 444 + if (attr == &dev_attr_iface_def_taskmgmt_tmo.attr) 447 445 param = ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO; 448 446 else if (attr == &dev_attr_iface_header_digest.attr) 449 447 param = ISCSI_IFACE_PARAM_HDRDGST_EN; ··· 481 483 if (param != -1) 482 484 return t->attr_is_visible(ISCSI_IFACE_PARAM, param); 483 485 484 - if (attr == &dev_attr_iface_vlan_id.attr) 486 + if (attr == &dev_attr_iface_enabled.attr) 487 + param = ISCSI_NET_PARAM_IFACE_ENABLE; 488 + else if (attr == &dev_attr_iface_vlan_id.attr) 485 489 param = ISCSI_NET_PARAM_VLAN_ID; 486 490 else if (attr == &dev_attr_iface_vlan_priority.attr) 487 491 param = ISCSI_NET_PARAM_VLAN_PRIORITY;
+9 -5
drivers/scsi/sd.c
··· 2124 2124 retries = 0; 2125 2125 2126 2126 do { 2127 + bool media_was_present = sdkp->media_present; 2128 + 2127 2129 cmd[0] = TEST_UNIT_READY; 2128 2130 memset((void *) &cmd[1], 0, 9); 2129 2131 ··· 2140 2138 * with any more polling. 2141 2139 */ 2142 2140 if (media_not_present(sdkp, &sshdr)) { 2143 - sd_printk(KERN_NOTICE, sdkp, "Media removed, stopped polling\n"); 2141 + if (media_was_present) 2142 + sd_printk(KERN_NOTICE, sdkp, "Media removed, stopped polling\n"); 2144 2143 return; 2145 2144 } 2146 2145 ··· 3404 3401 } 3405 3402 3406 3403 device_initialize(&sdkp->dev); 3407 - sdkp->dev.parent = dev; 3404 + sdkp->dev.parent = get_device(dev); 3408 3405 sdkp->dev.class = &sd_disk_class; 3409 3406 dev_set_name(&sdkp->dev, "%s", dev_name(dev)); 3410 3407 3411 3408 error = device_add(&sdkp->dev); 3412 - if (error) 3413 - goto out_free_index; 3409 + if (error) { 3410 + put_device(&sdkp->dev); 3411 + goto out; 3412 + } 3414 3413 3415 - get_device(dev); 3416 3414 dev_set_drvdata(dev, sdkp); 3417 3415 3418 3416 gd->major = sd_major((index & 0xf0) >> 4);
+4 -4
drivers/scsi/sd_zbc.c
··· 154 154 155 155 /* 156 156 * Report zone buffer size should be at most 64B times the number of 157 - * zones requested plus the 64B reply header, but should be at least 158 - * SECTOR_SIZE for ATA devices. 157 + * zones requested plus the 64B reply header, but should be aligned 158 + * to SECTOR_SIZE for ATA devices. 159 159 * Make sure that this size does not exceed the hardware capabilities. 160 160 * Furthermore, since the report zone command cannot be split, make 161 161 * sure that the allocated buffer can always be mapped by limiting the ··· 174 174 *buflen = bufsize; 175 175 return buf; 176 176 } 177 - bufsize >>= 1; 177 + bufsize = rounddown(bufsize >> 1, SECTOR_SIZE); 178 178 } 179 179 180 180 return NULL; ··· 280 280 { 281 281 struct scsi_disk *sdkp; 282 282 unsigned long flags; 283 - unsigned int zno; 283 + sector_t zno; 284 284 int ret; 285 285 286 286 sdkp = container_of(work, struct scsi_disk, zone_wp_offset_work);
+18 -4
drivers/scsi/ses.c
··· 87 87 0 88 88 }; 89 89 unsigned char recv_page_code; 90 + unsigned int retries = SES_RETRIES; 91 + struct scsi_sense_hdr sshdr; 90 92 91 - ret = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, bufflen, 92 - NULL, SES_TIMEOUT, SES_RETRIES, NULL); 93 + do { 94 + ret = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, bufflen, 95 + &sshdr, SES_TIMEOUT, 1, NULL); 96 + } while (ret > 0 && --retries && scsi_sense_valid(&sshdr) && 97 + (sshdr.sense_key == NOT_READY || 98 + (sshdr.sense_key == UNIT_ATTENTION && sshdr.asc == 0x29))); 99 + 93 100 if (unlikely(ret)) 94 101 return ret; 95 102 ··· 128 121 bufflen & 0xff, 129 122 0 130 123 }; 124 + struct scsi_sense_hdr sshdr; 125 + unsigned int retries = SES_RETRIES; 131 126 132 - result = scsi_execute_req(sdev, cmd, DMA_TO_DEVICE, buf, bufflen, 133 - NULL, SES_TIMEOUT, SES_RETRIES, NULL); 127 + do { 128 + result = scsi_execute_req(sdev, cmd, DMA_TO_DEVICE, buf, bufflen, 129 + &sshdr, SES_TIMEOUT, 1, NULL); 130 + } while (result > 0 && --retries && scsi_sense_valid(&sshdr) && 131 + (sshdr.sense_key == NOT_READY || 132 + (sshdr.sense_key == UNIT_ATTENTION && sshdr.asc == 0x29))); 133 + 134 134 if (result) 135 135 sdev_printk(KERN_ERR, sdev, "SEND DIAGNOSTIC result: %8x\n", 136 136 result);
+1 -1
drivers/scsi/sr_ioctl.c
··· 523 523 return rc; 524 524 cd->readcd_known = 0; 525 525 sr_printk(KERN_INFO, cd, 526 - "CDROM does'nt support READ CD (0xbe) command\n"); 526 + "CDROM doesn't support READ CD (0xbe) command\n"); 527 527 /* fall & retry the other way */ 528 528 } 529 529 /* ... if this fails, we switch the blocksize using MODE SELECT */
+1
drivers/scsi/st.c
··· 3823 3823 case CDROM_SEND_PACKET: 3824 3824 if (!capable(CAP_SYS_RAWIO)) 3825 3825 return -EPERM; 3826 + break; 3826 3827 default: 3827 3828 break; 3828 3829 }
+78
drivers/scsi/ufs/ufshcd-pci.c
··· 128 128 return err; 129 129 } 130 130 131 + static int ufs_intel_set_lanes(struct ufs_hba *hba, u32 lanes) 132 + { 133 + struct ufs_pa_layer_attr pwr_info = hba->pwr_info; 134 + int ret; 135 + 136 + pwr_info.lane_rx = lanes; 137 + pwr_info.lane_tx = lanes; 138 + ret = ufshcd_config_pwr_mode(hba, &pwr_info); 139 + if (ret) 140 + dev_err(hba->dev, "%s: Setting %u lanes, err = %d\n", 141 + __func__, lanes, ret); 142 + return ret; 143 + } 144 + 145 + static int ufs_intel_lkf_pwr_change_notify(struct ufs_hba *hba, 146 + enum ufs_notify_change_status status, 147 + struct ufs_pa_layer_attr *dev_max_params, 148 + struct ufs_pa_layer_attr *dev_req_params) 149 + { 150 + int err = 0; 151 + 152 + switch (status) { 153 + case PRE_CHANGE: 154 + if (ufshcd_is_hs_mode(dev_max_params) && 155 + (hba->pwr_info.lane_rx != 2 || hba->pwr_info.lane_tx != 2)) 156 + ufs_intel_set_lanes(hba, 2); 157 + memcpy(dev_req_params, dev_max_params, sizeof(*dev_req_params)); 158 + break; 159 + case POST_CHANGE: 160 + if (ufshcd_is_hs_mode(dev_req_params)) { 161 + u32 peer_granularity; 162 + 163 + usleep_range(1000, 1250); 164 + err = ufshcd_dme_peer_get(hba, UIC_ARG_MIB(PA_GRANULARITY), 165 + &peer_granularity); 166 + } 167 + break; 168 + default: 169 + break; 170 + } 171 + 172 + return err; 173 + } 174 + 175 + static int ufs_intel_lkf_apply_dev_quirks(struct ufs_hba *hba) 176 + { 177 + u32 granularity, peer_granularity; 178 + u32 pa_tactivate, peer_pa_tactivate; 179 + int ret; 180 + 181 + ret = ufshcd_dme_get(hba, UIC_ARG_MIB(PA_GRANULARITY), &granularity); 182 + if (ret) 183 + goto out; 184 + 185 + ret = ufshcd_dme_peer_get(hba, UIC_ARG_MIB(PA_GRANULARITY), &peer_granularity); 186 + if (ret) 187 + goto out; 188 + 189 + ret = ufshcd_dme_get(hba, UIC_ARG_MIB(PA_TACTIVATE), &pa_tactivate); 190 + if (ret) 191 + goto out; 192 + 193 + ret = ufshcd_dme_peer_get(hba, UIC_ARG_MIB(PA_TACTIVATE), &peer_pa_tactivate); 194 + if (ret) 195 + goto out; 196 + 197 + if (granularity == peer_granularity) { 198 + u32 new_peer_pa_tactivate = pa_tactivate + 2; 199 + 200 + ret = ufshcd_dme_peer_set(hba, UIC_ARG_MIB(PA_TACTIVATE), new_peer_pa_tactivate); 201 + } 202 + out: 203 + return ret; 204 + } 205 + 131 206 #define INTEL_ACTIVELTR 0x804 132 207 #define INTEL_IDLELTR 0x808 133 208 ··· 426 351 struct ufs_host *ufs_host; 427 352 int err; 428 353 354 + hba->nop_out_timeout = 200; 429 355 hba->quirks |= UFSHCD_QUIRK_BROKEN_AUTO_HIBERN8; 430 356 hba->caps |= UFSHCD_CAP_CRYPTO; 431 357 err = ufs_intel_common_init(hba); ··· 457 381 .exit = ufs_intel_common_exit, 458 382 .hce_enable_notify = ufs_intel_hce_enable_notify, 459 383 .link_startup_notify = ufs_intel_link_startup_notify, 384 + .pwr_change_notify = ufs_intel_lkf_pwr_change_notify, 385 + .apply_dev_quirks = ufs_intel_lkf_apply_dev_quirks, 460 386 .resume = ufs_intel_resume, 461 387 .device_reset = ufs_intel_device_reset, 462 388 };
+57 -59
drivers/scsi/ufs/ufshcd.c
··· 17 17 #include <linux/blk-pm.h> 18 18 #include <linux/blkdev.h> 19 19 #include <scsi/scsi_driver.h> 20 - #include <scsi/scsi_transport.h> 21 - #include "../scsi_transport_api.h" 22 20 #include "ufshcd.h" 23 21 #include "ufs_quirks.h" 24 22 #include "unipro.h" ··· 235 237 static irqreturn_t ufshcd_intr(int irq, void *__hba); 236 238 static int ufshcd_change_power_mode(struct ufs_hba *hba, 237 239 struct ufs_pa_layer_attr *pwr_mode); 240 + static void ufshcd_schedule_eh_work(struct ufs_hba *hba); 238 241 static int ufshcd_setup_hba_vreg(struct ufs_hba *hba, bool on); 239 242 static int ufshcd_setup_vreg(struct ufs_hba *hba, bool on); 240 243 static inline int ufshcd_config_vreg_hpm(struct ufs_hba *hba, ··· 2758 2759 out: 2759 2760 up_read(&hba->clk_scaling_lock); 2760 2761 2761 - if (ufs_trigger_eh()) 2762 - scsi_schedule_eh(hba->host); 2762 + if (ufs_trigger_eh()) { 2763 + unsigned long flags; 2764 + 2765 + spin_lock_irqsave(hba->host->host_lock, flags); 2766 + ufshcd_schedule_eh_work(hba); 2767 + spin_unlock_irqrestore(hba->host->host_lock, flags); 2768 + } 2763 2769 2764 2770 return err; 2765 2771 } ··· 3923 3919 } 3924 3920 EXPORT_SYMBOL_GPL(ufshcd_dme_get_attr); 3925 3921 3926 - static inline bool ufshcd_is_saved_err_fatal(struct ufs_hba *hba) 3927 - { 3928 - lockdep_assert_held(hba->host->host_lock); 3929 - 3930 - return (hba->saved_uic_err & UFSHCD_UIC_DL_PA_INIT_ERROR) || 3931 - (hba->saved_err & (INT_FATAL_ERRORS | UFSHCD_UIC_HIBERN8_MASK)); 3932 - } 3933 - 3934 - static void ufshcd_schedule_eh(struct ufs_hba *hba) 3935 - { 3936 - bool schedule_eh = false; 3937 - unsigned long flags; 3938 - 3939 - spin_lock_irqsave(hba->host->host_lock, flags); 3940 - /* handle fatal errors only when link is not in error state */ 3941 - if (hba->ufshcd_state != UFSHCD_STATE_ERROR) { 3942 - if (hba->force_reset || ufshcd_is_link_broken(hba) || 3943 - ufshcd_is_saved_err_fatal(hba)) 3944 - hba->ufshcd_state = UFSHCD_STATE_EH_SCHEDULED_FATAL; 3945 - else 3946 - hba->ufshcd_state = UFSHCD_STATE_EH_SCHEDULED_NON_FATAL; 3947 - schedule_eh = true; 3948 - } 3949 - spin_unlock_irqrestore(hba->host->host_lock, flags); 3950 - 3951 - if (schedule_eh) 3952 - scsi_schedule_eh(hba->host); 3953 - } 3954 - 3955 3922 /** 3956 3923 * ufshcd_uic_pwr_ctrl - executes UIC commands (which affects the link power 3957 3924 * state) and waits for it to take effect. ··· 3943 3968 { 3944 3969 DECLARE_COMPLETION_ONSTACK(uic_async_done); 3945 3970 unsigned long flags; 3946 - bool schedule_eh = false; 3947 3971 u8 status; 3948 3972 int ret; 3949 3973 bool reenable_intr = false; ··· 4012 4038 ufshcd_enable_intr(hba, UIC_COMMAND_COMPL); 4013 4039 if (ret) { 4014 4040 ufshcd_set_link_broken(hba); 4015 - schedule_eh = true; 4041 + ufshcd_schedule_eh_work(hba); 4016 4042 } 4017 - 4018 4043 out_unlock: 4019 4044 spin_unlock_irqrestore(hba->host->host_lock, flags); 4020 - 4021 - if (schedule_eh) 4022 - ufshcd_schedule_eh(hba); 4023 4045 mutex_unlock(&hba->uic_cmd_mutex); 4024 4046 4025 4047 return ret; ··· 4746 4776 mutex_lock(&hba->dev_cmd.lock); 4747 4777 for (retries = NOP_OUT_RETRIES; retries > 0; retries--) { 4748 4778 err = ufshcd_exec_dev_cmd(hba, DEV_CMD_TYPE_NOP, 4749 - NOP_OUT_TIMEOUT); 4779 + hba->nop_out_timeout); 4750 4780 4751 4781 if (!err || err == -ETIMEDOUT) 4752 4782 break; ··· 5881 5911 return err_handling; 5882 5912 } 5883 5913 5914 + /* host lock must be held before calling this func */ 5915 + static inline bool ufshcd_is_saved_err_fatal(struct ufs_hba *hba) 5916 + { 5917 + return (hba->saved_uic_err & UFSHCD_UIC_DL_PA_INIT_ERROR) || 5918 + (hba->saved_err & (INT_FATAL_ERRORS | UFSHCD_UIC_HIBERN8_MASK)); 5919 + } 5920 + 5921 + /* host lock must be held before calling this func */ 5922 + static inline void ufshcd_schedule_eh_work(struct ufs_hba *hba) 5923 + { 5924 + /* handle fatal errors only when link is not in error state */ 5925 + if (hba->ufshcd_state != UFSHCD_STATE_ERROR) { 5926 + if (hba->force_reset || ufshcd_is_link_broken(hba) || 5927 + ufshcd_is_saved_err_fatal(hba)) 5928 + hba->ufshcd_state = UFSHCD_STATE_EH_SCHEDULED_FATAL; 5929 + else 5930 + hba->ufshcd_state = UFSHCD_STATE_EH_SCHEDULED_NON_FATAL; 5931 + queue_work(hba->eh_wq, &hba->eh_work); 5932 + } 5933 + } 5934 + 5884 5935 static void ufshcd_clk_scaling_allow(struct ufs_hba *hba, bool allow) 5885 5936 { 5886 5937 down_write(&hba->clk_scaling_lock); ··· 6035 6044 6036 6045 /** 6037 6046 * ufshcd_err_handler - handle UFS errors that require s/w attention 6038 - * @host: SCSI host pointer 6047 + * @work: pointer to work structure 6039 6048 */ 6040 - static void ufshcd_err_handler(struct Scsi_Host *host) 6049 + static void ufshcd_err_handler(struct work_struct *work) 6041 6050 { 6042 - struct ufs_hba *hba = shost_priv(host); 6051 + struct ufs_hba *hba; 6043 6052 unsigned long flags; 6044 6053 bool err_xfer = false; 6045 6054 bool err_tm = false; ··· 6047 6056 int tag; 6048 6057 bool needs_reset = false, needs_restore = false; 6049 6058 6059 + hba = container_of(work, struct ufs_hba, eh_work); 6060 + 6050 6061 down(&hba->host_sem); 6051 6062 spin_lock_irqsave(hba->host->host_lock, flags); 6052 - hba->host->host_eh_scheduled = 0; 6053 6063 if (ufshcd_err_handling_should_stop(hba)) { 6054 6064 if (hba->ufshcd_state != UFSHCD_STATE_ERROR) 6055 6065 hba->ufshcd_state = UFSHCD_STATE_OPERATIONAL; ··· 6363 6371 "host_regs: "); 6364 6372 ufshcd_print_pwr_info(hba); 6365 6373 } 6374 + ufshcd_schedule_eh_work(hba); 6366 6375 retval |= IRQ_HANDLED; 6367 6376 } 6368 6377 /* ··· 6375 6382 hba->errors = 0; 6376 6383 hba->uic_error = 0; 6377 6384 spin_unlock(hba->host->host_lock); 6378 - 6379 - if (queue_eh_work) 6380 - ufshcd_schedule_eh(hba); 6381 - 6382 6385 return retval; 6383 6386 } 6384 6387 ··· 6865 6876 err = ufshcd_clear_cmd(hba, pos); 6866 6877 if (err) 6867 6878 break; 6868 - __ufshcd_transfer_req_compl(hba, pos, /*retry_requests=*/true); 6879 + __ufshcd_transfer_req_compl(hba, 1U << pos, false); 6869 6880 } 6870 6881 } 6871 6882 ··· 7037 7048 * will be to send LU reset which, again, is a spec violation. 7038 7049 * To avoid these unnecessary/illegal steps, first we clean up 7039 7050 * the lrb taken by this cmd and re-set it in outstanding_reqs, 7040 - * then queue the error handler and bail. 7051 + * then queue the eh_work and bail. 7041 7052 */ 7042 7053 if (lrbp->lun == UFS_UPIU_UFS_DEVICE_WLUN) { 7043 7054 ufshcd_update_evt_hist(hba, UFS_EVT_ABORT, lrbp->lun); 7044 7055 7045 7056 spin_lock_irqsave(host->host_lock, flags); 7046 7057 hba->force_reset = true; 7058 + ufshcd_schedule_eh_work(hba); 7047 7059 spin_unlock_irqrestore(host->host_lock, flags); 7048 - 7049 - ufshcd_schedule_eh(hba); 7050 - 7051 7060 goto release; 7052 7061 } 7053 7062 ··· 7178 7191 7179 7192 spin_lock_irqsave(hba->host->host_lock, flags); 7180 7193 hba->force_reset = true; 7194 + ufshcd_schedule_eh_work(hba); 7181 7195 dev_err(hba->dev, "%s: reset in progress - 1\n", __func__); 7182 7196 spin_unlock_irqrestore(hba->host->host_lock, flags); 7183 7197 7184 - ufshcd_err_handler(hba->host); 7198 + flush_work(&hba->eh_work); 7185 7199 7186 7200 spin_lock_irqsave(hba->host->host_lock, flags); 7187 7201 if (hba->ufshcd_state == UFSHCD_STATE_ERROR) ··· 8592 8604 if (hba->is_powered) { 8593 8605 ufshcd_exit_clk_scaling(hba); 8594 8606 ufshcd_exit_clk_gating(hba); 8607 + if (hba->eh_wq) 8608 + destroy_workqueue(hba->eh_wq); 8595 8609 ufs_debugfs_hba_exit(hba); 8596 8610 ufshcd_variant_hba_exit(hba); 8597 8611 ufshcd_setup_vreg(hba, false); ··· 9438 9448 return dma_set_mask_and_coherent(hba->dev, DMA_BIT_MASK(32)); 9439 9449 } 9440 9450 9441 - static struct scsi_transport_template ufshcd_transport_template = { 9442 - .eh_strategy_handler = ufshcd_err_handler, 9443 - }; 9444 - 9445 9451 /** 9446 9452 * ufshcd_alloc_host - allocate Host Bus Adapter (HBA) 9447 9453 * @dev: pointer to device handle ··· 9464 9478 err = -ENOMEM; 9465 9479 goto out_error; 9466 9480 } 9467 - host->transportt = &ufshcd_transport_template; 9468 9481 hba = shost_priv(host); 9469 9482 hba->host = host; 9470 9483 hba->dev = dev; 9471 9484 hba->dev_ref_clk_freq = REF_CLK_FREQ_INVAL; 9485 + hba->nop_out_timeout = NOP_OUT_TIMEOUT; 9472 9486 INIT_LIST_HEAD(&hba->clk_list_head); 9473 9487 spin_lock_init(&hba->outstanding_lock); 9474 9488 ··· 9503 9517 int err; 9504 9518 struct Scsi_Host *host = hba->host; 9505 9519 struct device *dev = hba->dev; 9520 + char eh_wq_name[sizeof("ufs_eh_wq_00")]; 9506 9521 9507 9522 if (!mmio_base) { 9508 9523 dev_err(hba->dev, ··· 9557 9570 9558 9571 hba->max_pwr_info.is_valid = false; 9559 9572 9573 + /* Initialize work queues */ 9574 + snprintf(eh_wq_name, sizeof(eh_wq_name), "ufs_eh_wq_%d", 9575 + hba->host->host_no); 9576 + hba->eh_wq = create_singlethread_workqueue(eh_wq_name); 9577 + if (!hba->eh_wq) { 9578 + dev_err(hba->dev, "%s: failed to create eh workqueue\n", 9579 + __func__); 9580 + err = -ENOMEM; 9581 + goto out_disable; 9582 + } 9583 + INIT_WORK(&hba->eh_work, ufshcd_err_handler); 9560 9584 INIT_WORK(&hba->eeh_work, ufshcd_exception_event_handler); 9561 9585 9562 9586 sema_init(&hba->host_sem, 1);
+5
drivers/scsi/ufs/ufshcd.h
··· 741 741 * @is_powered: flag to check if HBA is powered 742 742 * @shutting_down: flag to check if shutdown has been invoked 743 743 * @host_sem: semaphore used to serialize concurrent contexts 744 + * @eh_wq: Workqueue that eh_work works on 745 + * @eh_work: Worker to handle UFS errors that require s/w attention 744 746 * @eeh_work: Worker to handle exception events 745 747 * @errors: HBA errors 746 748 * @uic_error: UFS interconnect layer error status ··· 845 843 struct semaphore host_sem; 846 844 847 845 /* Work Queues */ 846 + struct workqueue_struct *eh_wq; 847 + struct work_struct eh_work; 848 848 struct work_struct eeh_work; 849 849 850 850 /* HBA Errors */ ··· 862 858 /* Device management request data */ 863 859 struct ufs_dev_cmd dev_cmd; 864 860 ktime_t last_dme_cmd_tstamp; 861 + int nop_out_timeout; 865 862 866 863 /* Keeps information of the UFS device connected to this host */ 867 864 struct ufs_dev_info dev_info;
+3 -5
drivers/scsi/ufs/ufshpb.c
··· 333 333 } 334 334 335 335 static void 336 - ufshpb_set_hpb_read_to_upiu(struct ufs_hba *hba, struct ufshpb_lu *hpb, 337 - struct ufshcd_lrb *lrbp, u32 lpn, __be64 ppn, 338 - u8 transfer_len, int read_id) 336 + ufshpb_set_hpb_read_to_upiu(struct ufs_hba *hba, struct ufshcd_lrb *lrbp, 337 + __be64 ppn, u8 transfer_len, int read_id) 339 338 { 340 339 unsigned char *cdb = lrbp->cmd->cmnd; 341 340 __be64 ppn_tmp = ppn; ··· 702 703 } 703 704 } 704 705 705 - ufshpb_set_hpb_read_to_upiu(hba, hpb, lrbp, lpn, ppn, transfer_len, 706 - read_id); 706 + ufshpb_set_hpb_read_to_upiu(hba, lrbp, ppn, transfer_len, read_id); 707 707 708 708 hpb->stats.hit_cnt++; 709 709 return 0;
+1 -1
drivers/spi/spi-tegra20-slink.c
··· 1194 1194 return 0; 1195 1195 } 1196 1196 1197 - static int __maybe_unused tegra_slink_runtime_resume(struct device *dev) 1197 + static int tegra_slink_runtime_resume(struct device *dev) 1198 1198 { 1199 1199 struct spi_master *master = dev_get_drvdata(dev); 1200 1200 struct tegra_slink_data *tspi = spi_master_get_devdata(master);
-8
drivers/spi/spi.c
··· 58 58 const struct spi_device *spi = to_spi_device(dev); 59 59 int len; 60 60 61 - len = of_device_modalias(dev, buf, PAGE_SIZE); 62 - if (len != -ENODEV) 63 - return len; 64 - 65 61 len = acpi_device_modalias(dev, buf, PAGE_SIZE - 1); 66 62 if (len != -ENODEV) 67 63 return len; ··· 362 366 { 363 367 const struct spi_device *spi = to_spi_device(dev); 364 368 int rc; 365 - 366 - rc = of_device_uevent_modalias(dev, env); 367 - if (rc != -ENODEV) 368 - return rc; 369 369 370 370 rc = acpi_device_uevent_modalias(dev, env); 371 371 if (rc != -ENODEV)
+32 -30
drivers/staging/greybus/uart.c
··· 761 761 gbphy_runtime_put_autosuspend(gb_tty->gbphy_dev); 762 762 } 763 763 764 + static void gb_tty_port_destruct(struct tty_port *port) 765 + { 766 + struct gb_tty *gb_tty = container_of(port, struct gb_tty, port); 767 + 768 + if (gb_tty->minor != GB_NUM_MINORS) 769 + release_minor(gb_tty); 770 + kfifo_free(&gb_tty->write_fifo); 771 + kfree(gb_tty->buffer); 772 + kfree(gb_tty); 773 + } 774 + 764 775 static const struct tty_operations gb_ops = { 765 776 .install = gb_tty_install, 766 777 .open = gb_tty_open, ··· 797 786 .dtr_rts = gb_tty_dtr_rts, 798 787 .activate = gb_tty_port_activate, 799 788 .shutdown = gb_tty_port_shutdown, 789 + .destruct = gb_tty_port_destruct, 800 790 }; 801 791 802 792 static int gb_uart_probe(struct gbphy_device *gbphy_dev, ··· 810 798 int retval; 811 799 int minor; 812 800 813 - gb_tty = kzalloc(sizeof(*gb_tty), GFP_KERNEL); 814 - if (!gb_tty) 815 - return -ENOMEM; 816 - 817 801 connection = gb_connection_create(gbphy_dev->bundle, 818 802 le16_to_cpu(gbphy_dev->cport_desc->id), 819 803 gb_uart_request_handler); 820 - if (IS_ERR(connection)) { 821 - retval = PTR_ERR(connection); 822 - goto exit_tty_free; 823 - } 804 + if (IS_ERR(connection)) 805 + return PTR_ERR(connection); 824 806 825 807 max_payload = gb_operation_get_payload_size_max(connection); 826 808 if (max_payload < sizeof(struct gb_uart_send_data_request)) { ··· 822 816 goto exit_connection_destroy; 823 817 } 824 818 819 + gb_tty = kzalloc(sizeof(*gb_tty), GFP_KERNEL); 820 + if (!gb_tty) { 821 + retval = -ENOMEM; 822 + goto exit_connection_destroy; 823 + } 824 + 825 + tty_port_init(&gb_tty->port); 826 + gb_tty->port.ops = &gb_port_ops; 827 + gb_tty->minor = GB_NUM_MINORS; 828 + 825 829 gb_tty->buffer_payload_max = max_payload - 826 830 sizeof(struct gb_uart_send_data_request); 827 831 828 832 gb_tty->buffer = kzalloc(gb_tty->buffer_payload_max, GFP_KERNEL); 829 833 if (!gb_tty->buffer) { 830 834 retval = -ENOMEM; 831 - goto exit_connection_destroy; 835 + goto exit_put_port; 832 836 } 833 837 834 838 INIT_WORK(&gb_tty->tx_work, gb_uart_tx_write_work); ··· 846 830 retval = kfifo_alloc(&gb_tty->write_fifo, GB_UART_WRITE_FIFO_SIZE, 847 831 GFP_KERNEL); 848 832 if (retval) 849 - goto exit_buf_free; 833 + goto exit_put_port; 850 834 851 835 gb_tty->credits = GB_UART_FIRMWARE_CREDITS; 852 836 init_completion(&gb_tty->credits_complete); ··· 860 844 } else { 861 845 retval = minor; 862 846 } 863 - goto exit_kfifo_free; 847 + goto exit_put_port; 864 848 } 865 849 866 850 gb_tty->minor = minor; ··· 869 853 init_waitqueue_head(&gb_tty->wioctl); 870 854 mutex_init(&gb_tty->mutex); 871 855 872 - tty_port_init(&gb_tty->port); 873 - gb_tty->port.ops = &gb_port_ops; 874 - 875 856 gb_tty->connection = connection; 876 857 gb_tty->gbphy_dev = gbphy_dev; 877 858 gb_connection_set_data(connection, gb_tty); ··· 876 863 877 864 retval = gb_connection_enable_tx(connection); 878 865 if (retval) 879 - goto exit_release_minor; 866 + goto exit_put_port; 880 867 881 868 send_control(gb_tty, gb_tty->ctrlout); 882 869 ··· 903 890 904 891 exit_connection_disable: 905 892 gb_connection_disable(connection); 906 - exit_release_minor: 907 - release_minor(gb_tty); 908 - exit_kfifo_free: 909 - kfifo_free(&gb_tty->write_fifo); 910 - exit_buf_free: 911 - kfree(gb_tty->buffer); 893 + exit_put_port: 894 + tty_port_put(&gb_tty->port); 912 895 exit_connection_destroy: 913 896 gb_connection_destroy(connection); 914 - exit_tty_free: 915 - kfree(gb_tty); 916 897 917 898 return retval; 918 899 } ··· 937 930 gb_connection_disable_rx(connection); 938 931 tty_unregister_device(gb_tty_driver, gb_tty->minor); 939 932 940 - /* FIXME - free transmit / receive buffers */ 941 - 942 933 gb_connection_disable(connection); 943 - tty_port_destroy(&gb_tty->port); 944 934 gb_connection_destroy(connection); 945 - release_minor(gb_tty); 946 - kfifo_free(&gb_tty->write_fifo); 947 - kfree(gb_tty->buffer); 948 - kfree(gb_tty); 935 + 936 + tty_port_put(&gb_tty->port); 949 937 } 950 938 951 939 static int gb_tty_init(void)
+4 -4
drivers/staging/r8188eu/os_dep/ioctl_linux.c
··· 5372 5372 5373 5373 pnext++; 5374 5374 if (*pnext != '\0') { 5375 - strtout = simple_strtoul(pnext, &ptmp, 16); 5376 - sprintf(extra, "%s %d", extra, strtout); 5375 + strtout = simple_strtoul(pnext, &ptmp, 16); 5376 + sprintf(extra + strlen(extra), " %d", strtout); 5377 5377 } else { 5378 5378 break; 5379 5379 } ··· 5405 5405 pnext++; 5406 5406 if (*pnext != '\0') { 5407 5407 strtout = simple_strtoul(pnext, &ptmp, 16); 5408 - sprintf(extra, "%s %d", extra, strtout); 5408 + sprintf(extra + strlen(extra), " %d", strtout); 5409 5409 } else { 5410 5410 break; 5411 5411 } ··· 5512 5512 pnext++; 5513 5513 if (*pnext != '\0') { 5514 5514 strtou = simple_strtoul(pnext, &ptmp, 16); 5515 - sprintf(extra, "%s %d", extra, strtou); 5515 + sprintf(extra + strlen(extra), " %d", strtou); 5516 5516 } else { 5517 5517 break; 5518 5518 }
+20 -12
drivers/target/target_core_configfs.c
··· 1110 1110 { 1111 1111 struct se_dev_attrib *da = to_attrib(item); 1112 1112 struct se_device *dev = da->da_dev; 1113 - bool flag; 1113 + bool flag, oldflag; 1114 1114 int ret; 1115 + 1116 + ret = strtobool(page, &flag); 1117 + if (ret < 0) 1118 + return ret; 1119 + 1120 + oldflag = !(dev->transport_flags & TRANSPORT_FLAG_PASSTHROUGH_ALUA); 1121 + if (flag == oldflag) 1122 + return count; 1115 1123 1116 1124 if (!(dev->transport->transport_flags_changeable & 1117 1125 TRANSPORT_FLAG_PASSTHROUGH_ALUA)) { 1118 1126 pr_err("dev[%p]: Unable to change SE Device alua_support:" 1119 1127 " alua_support has fixed value\n", dev); 1120 - return -EINVAL; 1128 + return -ENOSYS; 1121 1129 } 1122 - 1123 - ret = strtobool(page, &flag); 1124 - if (ret < 0) 1125 - return ret; 1126 1130 1127 1131 if (flag) 1128 1132 dev->transport_flags &= ~TRANSPORT_FLAG_PASSTHROUGH_ALUA; ··· 1149 1145 { 1150 1146 struct se_dev_attrib *da = to_attrib(item); 1151 1147 struct se_device *dev = da->da_dev; 1152 - bool flag; 1148 + bool flag, oldflag; 1153 1149 int ret; 1150 + 1151 + ret = strtobool(page, &flag); 1152 + if (ret < 0) 1153 + return ret; 1154 + 1155 + oldflag = !(dev->transport_flags & TRANSPORT_FLAG_PASSTHROUGH_PGR); 1156 + if (flag == oldflag) 1157 + return count; 1154 1158 1155 1159 if (!(dev->transport->transport_flags_changeable & 1156 1160 TRANSPORT_FLAG_PASSTHROUGH_PGR)) { 1157 1161 pr_err("dev[%p]: Unable to change SE Device pgr_support:" 1158 1162 " pgr_support has fixed value\n", dev); 1159 - return -EINVAL; 1163 + return -ENOSYS; 1160 1164 } 1161 - 1162 - ret = strtobool(page, &flag); 1163 - if (ret < 0) 1164 - return ret; 1165 1165 1166 1166 if (flag) 1167 1167 dev->transport_flags &= ~TRANSPORT_FLAG_PASSTHROUGH_PGR;
+1 -1
drivers/target/target_core_pr.c
··· 269 269 spin_lock(&dev->dev_reservation_lock); 270 270 if (dev->reservation_holder && 271 271 dev->reservation_holder->se_node_acl != sess->se_node_acl) { 272 - pr_err("SCSI-2 RESERVATION CONFLIFT for %s fabric\n", 272 + pr_err("SCSI-2 RESERVATION CONFLICT for %s fabric\n", 273 273 tpg->se_tpg_tfo->fabric_name); 274 274 pr_err("Original reserver LUN: %llu %s\n", 275 275 cmd->se_lun->unpacked_lun,
+3 -2
drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
··· 107 107 return 0; 108 108 } 109 109 110 - static unsigned int tcc_offset_save; 110 + static int tcc_offset_save = -1; 111 111 112 112 static ssize_t tcc_offset_degree_celsius_store(struct device *dev, 113 113 struct device_attribute *attr, const char *buf, ··· 352 352 proc_dev = dev_get_drvdata(dev); 353 353 proc_thermal_read_ppcc(proc_dev); 354 354 355 - tcc_offset_update(tcc_offset_save); 355 + if (tcc_offset_save >= 0) 356 + tcc_offset_update(tcc_offset_save); 356 357 357 358 return 0; 358 359 }
+2 -2
drivers/thermal/qcom/tsens.c
··· 417 417 const struct tsens_sensor *s = &priv->sensor[i]; 418 418 u32 hw_id = s->hw_id; 419 419 420 - if (IS_ERR(s->tzd)) 420 + if (!s->tzd) 421 421 continue; 422 422 if (!tsens_threshold_violated(priv, hw_id, &d)) 423 423 continue; ··· 467 467 const struct tsens_sensor *s = &priv->sensor[i]; 468 468 u32 hw_id = s->hw_id; 469 469 470 - if (IS_ERR(s->tzd)) 470 + if (!s->tzd) 471 471 continue; 472 472 if (!tsens_threshold_violated(priv, hw_id, &d)) 473 473 continue;
+3 -4
drivers/thermal/thermal_core.c
··· 222 222 { 223 223 struct thermal_governor *pos; 224 224 ssize_t count = 0; 225 - ssize_t size = PAGE_SIZE; 226 225 227 226 mutex_lock(&thermal_governor_lock); 228 227 229 228 list_for_each_entry(pos, &thermal_governor_list, governor_list) { 230 - size = PAGE_SIZE - count; 231 - count += scnprintf(buf + count, size, "%s ", pos->name); 229 + count += scnprintf(buf + count, PAGE_SIZE - count, "%s ", 230 + pos->name); 232 231 } 233 - count += scnprintf(buf + count, size, "\n"); 232 + count += scnprintf(buf + count, PAGE_SIZE - count, "\n"); 234 233 235 234 mutex_unlock(&thermal_governor_lock); 236 235
+1 -1
drivers/tty/serial/8250/8250_omap.c
··· 106 106 #define UART_OMAP_EFR2_TIMEOUT_BEHAVE BIT(6) 107 107 108 108 /* RX FIFO occupancy indicator */ 109 - #define UART_OMAP_RX_LVL 0x64 109 + #define UART_OMAP_RX_LVL 0x19 110 110 111 111 struct omap8250_priv { 112 112 int line;
+1 -1
drivers/tty/serial/mvebu-uart.c
··· 163 163 st = readl(port->membase + UART_STAT); 164 164 spin_unlock_irqrestore(&port->lock, flags); 165 165 166 - return (st & STAT_TX_FIFO_EMP) ? TIOCSER_TEMT : 0; 166 + return (st & STAT_TX_EMP) ? TIOCSER_TEMT : 0; 167 167 } 168 168 169 169 static unsigned int mvebu_uart_get_mctrl(struct uart_port *port)
-1
drivers/tty/tty_ldisc.c
··· 812 812 813 813 tty_ldisc_debug(tty, "released\n"); 814 814 } 815 - EXPORT_SYMBOL_GPL(tty_ldisc_release); 816 815 817 816 /** 818 817 * tty_ldisc_init - ldisc setup for new tty
+14
drivers/usb/cdns3/cdns3-gadget.c
··· 1100 1100 return 0; 1101 1101 } 1102 1102 1103 + static void cdns3_rearm_drdy_if_needed(struct cdns3_endpoint *priv_ep) 1104 + { 1105 + struct cdns3_device *priv_dev = priv_ep->cdns3_dev; 1106 + 1107 + if (priv_dev->dev_ver < DEV_VER_V3) 1108 + return; 1109 + 1110 + if (readl(&priv_dev->regs->ep_sts) & EP_STS_TRBERR) { 1111 + writel(EP_STS_TRBERR, &priv_dev->regs->ep_sts); 1112 + writel(EP_CMD_DRDY, &priv_dev->regs->ep_cmd); 1113 + } 1114 + } 1115 + 1103 1116 /** 1104 1117 * cdns3_ep_run_transfer - start transfer on no-default endpoint hardware 1105 1118 * @priv_ep: endpoint object ··· 1364 1351 /*clearing TRBERR and EP_STS_DESCMIS before seting DRDY*/ 1365 1352 writel(EP_STS_TRBERR | EP_STS_DESCMIS, &priv_dev->regs->ep_sts); 1366 1353 writel(EP_CMD_DRDY, &priv_dev->regs->ep_cmd); 1354 + cdns3_rearm_drdy_if_needed(priv_ep); 1367 1355 trace_cdns3_doorbell_epx(priv_ep->name, 1368 1356 readl(&priv_dev->regs->ep_traddr)); 1369 1357 }
+5 -2
drivers/usb/class/cdc-acm.c
··· 726 726 { 727 727 struct acm *acm = container_of(port, struct acm, port); 728 728 729 - acm_release_minor(acm); 729 + if (acm->minor != ACM_MINOR_INVALID) 730 + acm_release_minor(acm); 730 731 usb_put_intf(acm->control); 731 732 kfree(acm->country_codes); 732 733 kfree(acm); ··· 1324 1323 usb_get_intf(acm->control); /* undone in destruct() */ 1325 1324 1326 1325 minor = acm_alloc_minor(acm); 1327 - if (minor < 0) 1326 + if (minor < 0) { 1327 + acm->minor = ACM_MINOR_INVALID; 1328 1328 goto err_put_port; 1329 + } 1329 1330 1330 1331 acm->minor = minor; 1331 1332 acm->dev = usb_dev;
+2
drivers/usb/class/cdc-acm.h
··· 22 22 #define ACM_TTY_MAJOR 166 23 23 #define ACM_TTY_MINORS 256 24 24 25 + #define ACM_MINOR_INVALID ACM_TTY_MINORS 26 + 25 27 /* 26 28 * Requests. 27 29 */
+46 -24
drivers/usb/core/hcd.c
··· 2761 2761 } 2762 2762 2763 2763 /** 2764 + * usb_stop_hcd - Halt the HCD 2765 + * @hcd: the usb_hcd that has to be halted 2766 + * 2767 + * Stop the root-hub polling timer and invoke the HCD's ->stop callback. 2768 + */ 2769 + static void usb_stop_hcd(struct usb_hcd *hcd) 2770 + { 2771 + hcd->rh_pollable = 0; 2772 + clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); 2773 + del_timer_sync(&hcd->rh_timer); 2774 + 2775 + hcd->driver->stop(hcd); 2776 + hcd->state = HC_STATE_HALT; 2777 + 2778 + /* In case the HCD restarted the timer, stop it again. */ 2779 + clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); 2780 + del_timer_sync(&hcd->rh_timer); 2781 + } 2782 + 2783 + /** 2764 2784 * usb_add_hcd - finish generic HCD structure initialization and register 2765 2785 * @hcd: the usb_hcd structure to initialize 2766 2786 * @irqnum: Interrupt line to allocate ··· 2795 2775 { 2796 2776 int retval; 2797 2777 struct usb_device *rhdev; 2778 + struct usb_hcd *shared_hcd; 2798 2779 2799 2780 if (!hcd->skip_phy_initialization && usb_hcd_is_primary_hcd(hcd)) { 2800 2781 hcd->phy_roothub = usb_phy_roothub_alloc(hcd->self.sysdev); ··· 2956 2935 goto err_hcd_driver_start; 2957 2936 } 2958 2937 2959 - /* starting here, usbcore will pay attention to this root hub */ 2960 - retval = register_root_hub(hcd); 2961 - if (retval != 0) 2962 - goto err_register_root_hub; 2938 + /* starting here, usbcore will pay attention to the shared HCD roothub */ 2939 + shared_hcd = hcd->shared_hcd; 2940 + if (!usb_hcd_is_primary_hcd(hcd) && shared_hcd && HCD_DEFER_RH_REGISTER(shared_hcd)) { 2941 + retval = register_root_hub(shared_hcd); 2942 + if (retval != 0) 2943 + goto err_register_root_hub; 2963 2944 2964 - if (hcd->uses_new_polling && HCD_POLL_RH(hcd)) 2965 - usb_hcd_poll_rh_status(hcd); 2945 + if (shared_hcd->uses_new_polling && HCD_POLL_RH(shared_hcd)) 2946 + usb_hcd_poll_rh_status(shared_hcd); 2947 + } 2948 + 2949 + /* starting here, usbcore will pay attention to this root hub */ 2950 + if (!HCD_DEFER_RH_REGISTER(hcd)) { 2951 + retval = register_root_hub(hcd); 2952 + if (retval != 0) 2953 + goto err_register_root_hub; 2954 + 2955 + if (hcd->uses_new_polling && HCD_POLL_RH(hcd)) 2956 + usb_hcd_poll_rh_status(hcd); 2957 + } 2966 2958 2967 2959 return retval; 2968 2960 2969 2961 err_register_root_hub: 2970 - hcd->rh_pollable = 0; 2971 - clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); 2972 - del_timer_sync(&hcd->rh_timer); 2973 - hcd->driver->stop(hcd); 2974 - hcd->state = HC_STATE_HALT; 2975 - clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); 2976 - del_timer_sync(&hcd->rh_timer); 2962 + usb_stop_hcd(hcd); 2977 2963 err_hcd_driver_start: 2978 2964 if (usb_hcd_is_primary_hcd(hcd) && hcd->irq > 0) 2979 2965 free_irq(irqnum, hcd); ··· 3013 2985 void usb_remove_hcd(struct usb_hcd *hcd) 3014 2986 { 3015 2987 struct usb_device *rhdev = hcd->self.root_hub; 2988 + bool rh_registered; 3016 2989 3017 2990 dev_info(hcd->self.controller, "remove, state %x\n", hcd->state); 3018 2991 ··· 3024 2995 3025 2996 dev_dbg(hcd->self.controller, "roothub graceful disconnect\n"); 3026 2997 spin_lock_irq (&hcd_root_hub_lock); 2998 + rh_registered = hcd->rh_registered; 3027 2999 hcd->rh_registered = 0; 3028 3000 spin_unlock_irq (&hcd_root_hub_lock); 3029 3001 ··· 3034 3004 cancel_work_sync(&hcd->died_work); 3035 3005 3036 3006 mutex_lock(&usb_bus_idr_lock); 3037 - usb_disconnect(&rhdev); /* Sets rhdev to NULL */ 3007 + if (rh_registered) 3008 + usb_disconnect(&rhdev); /* Sets rhdev to NULL */ 3038 3009 mutex_unlock(&usb_bus_idr_lock); 3039 3010 3040 3011 /* ··· 3053 3022 * interrupt occurs), but usb_hcd_poll_rh_status() won't invoke 3054 3023 * the hub_status_data() callback. 3055 3024 */ 3056 - hcd->rh_pollable = 0; 3057 - clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); 3058 - del_timer_sync(&hcd->rh_timer); 3059 - 3060 - hcd->driver->stop(hcd); 3061 - hcd->state = HC_STATE_HALT; 3062 - 3063 - /* In case the HCD restarted the timer, stop it again. */ 3064 - clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); 3065 - del_timer_sync(&hcd->rh_timer); 3025 + usb_stop_hcd(hcd); 3066 3026 3067 3027 if (usb_hcd_is_primary_hcd(hcd)) { 3068 3028 if (hcd->irq > 0)
+108 -87
drivers/usb/dwc2/gadget.c
··· 115 115 */ 116 116 static inline void dwc2_gadget_incr_frame_num(struct dwc2_hsotg_ep *hs_ep) 117 117 { 118 + struct dwc2_hsotg *hsotg = hs_ep->parent; 119 + u16 limit = DSTS_SOFFN_LIMIT; 120 + 121 + if (hsotg->gadget.speed != USB_SPEED_HIGH) 122 + limit >>= 3; 123 + 118 124 hs_ep->target_frame += hs_ep->interval; 119 - if (hs_ep->target_frame > DSTS_SOFFN_LIMIT) { 125 + if (hs_ep->target_frame > limit) { 120 126 hs_ep->frame_overrun = true; 121 - hs_ep->target_frame &= DSTS_SOFFN_LIMIT; 127 + hs_ep->target_frame &= limit; 122 128 } else { 123 129 hs_ep->frame_overrun = false; 124 130 } ··· 142 136 */ 143 137 static inline void dwc2_gadget_dec_frame_num_by_one(struct dwc2_hsotg_ep *hs_ep) 144 138 { 139 + struct dwc2_hsotg *hsotg = hs_ep->parent; 140 + u16 limit = DSTS_SOFFN_LIMIT; 141 + 142 + if (hsotg->gadget.speed != USB_SPEED_HIGH) 143 + limit >>= 3; 144 + 145 145 if (hs_ep->target_frame) 146 146 hs_ep->target_frame -= 1; 147 147 else 148 - hs_ep->target_frame = DSTS_SOFFN_LIMIT; 148 + hs_ep->target_frame = limit; 149 149 } 150 150 151 151 /** ··· 1030 1018 dwc2_writel(hsotg, ctrl, depctl); 1031 1019 } 1032 1020 1021 + static bool dwc2_gadget_target_frame_elapsed(struct dwc2_hsotg_ep *hs_ep); 1022 + static void dwc2_hsotg_complete_request(struct dwc2_hsotg *hsotg, 1023 + struct dwc2_hsotg_ep *hs_ep, 1024 + struct dwc2_hsotg_req *hs_req, 1025 + int result); 1026 + 1033 1027 /** 1034 1028 * dwc2_hsotg_start_req - start a USB request from an endpoint's queue 1035 1029 * @hsotg: The controller state. ··· 1188 1170 } 1189 1171 } 1190 1172 1191 - if (hs_ep->isochronous && hs_ep->interval == 1) { 1192 - hs_ep->target_frame = dwc2_hsotg_read_frameno(hsotg); 1193 - dwc2_gadget_incr_frame_num(hs_ep); 1194 - 1195 - if (hs_ep->target_frame & 0x1) 1196 - ctrl |= DXEPCTL_SETODDFR; 1197 - else 1198 - ctrl |= DXEPCTL_SETEVENFR; 1173 + if (hs_ep->isochronous) { 1174 + if (!dwc2_gadget_target_frame_elapsed(hs_ep)) { 1175 + if (hs_ep->interval == 1) { 1176 + if (hs_ep->target_frame & 0x1) 1177 + ctrl |= DXEPCTL_SETODDFR; 1178 + else 1179 + ctrl |= DXEPCTL_SETEVENFR; 1180 + } 1181 + ctrl |= DXEPCTL_CNAK; 1182 + } else { 1183 + dwc2_hsotg_complete_request(hsotg, hs_ep, hs_req, -ENODATA); 1184 + return; 1185 + } 1199 1186 } 1200 1187 1201 1188 ctrl |= DXEPCTL_EPENA; /* ensure ep enabled */ ··· 1348 1325 u32 target_frame = hs_ep->target_frame; 1349 1326 u32 current_frame = hsotg->frame_number; 1350 1327 bool frame_overrun = hs_ep->frame_overrun; 1328 + u16 limit = DSTS_SOFFN_LIMIT; 1329 + 1330 + if (hsotg->gadget.speed != USB_SPEED_HIGH) 1331 + limit >>= 3; 1351 1332 1352 1333 if (!frame_overrun && current_frame >= target_frame) 1353 1334 return true; 1354 1335 1355 1336 if (frame_overrun && current_frame >= target_frame && 1356 - ((current_frame - target_frame) < DSTS_SOFFN_LIMIT / 2)) 1337 + ((current_frame - target_frame) < limit / 2)) 1357 1338 return true; 1358 1339 1359 1340 return false; ··· 1740 1713 */ 1741 1714 static void dwc2_gadget_start_next_request(struct dwc2_hsotg_ep *hs_ep) 1742 1715 { 1743 - u32 mask; 1744 1716 struct dwc2_hsotg *hsotg = hs_ep->parent; 1745 1717 int dir_in = hs_ep->dir_in; 1746 1718 struct dwc2_hsotg_req *hs_req; 1747 - u32 epmsk_reg = dir_in ? DIEPMSK : DOEPMSK; 1748 1719 1749 1720 if (!list_empty(&hs_ep->queue)) { 1750 1721 hs_req = get_ep_head(hs_ep); ··· 1758 1733 } else { 1759 1734 dev_dbg(hsotg->dev, "%s: No more ISOC-OUT requests\n", 1760 1735 __func__); 1761 - mask = dwc2_readl(hsotg, epmsk_reg); 1762 - mask |= DOEPMSK_OUTTKNEPDISMSK; 1763 - dwc2_writel(hsotg, mask, epmsk_reg); 1764 1736 } 1765 1737 } 1766 1738 ··· 2328 2306 dwc2_hsotg_program_zlp(hsotg, hsotg->eps_out[0]); 2329 2307 } 2330 2308 2331 - static void dwc2_hsotg_change_ep_iso_parity(struct dwc2_hsotg *hsotg, 2332 - u32 epctl_reg) 2333 - { 2334 - u32 ctrl; 2335 - 2336 - ctrl = dwc2_readl(hsotg, epctl_reg); 2337 - if (ctrl & DXEPCTL_EOFRNUM) 2338 - ctrl |= DXEPCTL_SETEVENFR; 2339 - else 2340 - ctrl |= DXEPCTL_SETODDFR; 2341 - dwc2_writel(hsotg, ctrl, epctl_reg); 2342 - } 2343 - 2344 2309 /* 2345 2310 * dwc2_gadget_get_xfersize_ddma - get transferred bytes amount from desc 2346 2311 * @hs_ep - The endpoint on which transfer went ··· 2448 2439 dwc2_hsotg_ep0_zlp(hsotg, true); 2449 2440 } 2450 2441 2451 - /* 2452 - * Slave mode OUT transfers do not go through XferComplete so 2453 - * adjust the ISOC parity here. 2454 - */ 2455 - if (!using_dma(hsotg)) { 2456 - if (hs_ep->isochronous && hs_ep->interval == 1) 2457 - dwc2_hsotg_change_ep_iso_parity(hsotg, DOEPCTL(epnum)); 2458 - else if (hs_ep->isochronous && hs_ep->interval > 1) 2459 - dwc2_gadget_incr_frame_num(hs_ep); 2460 - } 2461 - 2462 2442 /* Set actual frame number for completed transfers */ 2463 - if (!using_desc_dma(hsotg) && hs_ep->isochronous) 2464 - req->frame_number = hsotg->frame_number; 2443 + if (!using_desc_dma(hsotg) && hs_ep->isochronous) { 2444 + req->frame_number = hs_ep->target_frame; 2445 + dwc2_gadget_incr_frame_num(hs_ep); 2446 + } 2465 2447 2466 2448 dwc2_hsotg_complete_request(hsotg, hs_ep, hs_req, result); 2467 2449 } ··· 2766 2766 return; 2767 2767 } 2768 2768 2769 + /* Set actual frame number for completed transfers */ 2770 + if (!using_desc_dma(hsotg) && hs_ep->isochronous) { 2771 + hs_req->req.frame_number = hs_ep->target_frame; 2772 + dwc2_gadget_incr_frame_num(hs_ep); 2773 + } 2774 + 2769 2775 dwc2_hsotg_complete_request(hsotg, hs_ep, hs_req, 0); 2770 2776 } 2771 2777 ··· 2832 2826 2833 2827 dwc2_hsotg_txfifo_flush(hsotg, hs_ep->fifo_index); 2834 2828 2835 - if (hs_ep->isochronous) { 2836 - dwc2_hsotg_complete_in(hsotg, hs_ep); 2837 - return; 2838 - } 2839 - 2840 2829 if ((epctl & DXEPCTL_STALL) && (epctl & DXEPCTL_EPTYPE_BULK)) { 2841 2830 int dctl = dwc2_readl(hsotg, DCTL); 2842 2831 2843 2832 dctl |= DCTL_CGNPINNAK; 2844 2833 dwc2_writel(hsotg, dctl, DCTL); 2845 2834 } 2846 - return; 2847 - } 2835 + } else { 2848 2836 2849 - if (dctl & DCTL_GOUTNAKSTS) { 2850 - dctl |= DCTL_CGOUTNAK; 2851 - dwc2_writel(hsotg, dctl, DCTL); 2837 + if (dctl & DCTL_GOUTNAKSTS) { 2838 + dctl |= DCTL_CGOUTNAK; 2839 + dwc2_writel(hsotg, dctl, DCTL); 2840 + } 2852 2841 } 2853 2842 2854 2843 if (!hs_ep->isochronous) ··· 2864 2863 /* Update current frame number value. */ 2865 2864 hsotg->frame_number = dwc2_hsotg_read_frameno(hsotg); 2866 2865 } while (dwc2_gadget_target_frame_elapsed(hs_ep)); 2867 - 2868 - dwc2_gadget_start_next_request(hs_ep); 2869 2866 } 2870 2867 2871 2868 /** ··· 2880 2881 static void dwc2_gadget_handle_out_token_ep_disabled(struct dwc2_hsotg_ep *ep) 2881 2882 { 2882 2883 struct dwc2_hsotg *hsotg = ep->parent; 2884 + struct dwc2_hsotg_req *hs_req; 2883 2885 int dir_in = ep->dir_in; 2884 - u32 doepmsk; 2885 2886 2886 2887 if (dir_in || !ep->isochronous) 2887 2888 return; ··· 2895 2896 return; 2896 2897 } 2897 2898 2898 - if (ep->interval > 1 && 2899 - ep->target_frame == TARGET_FRAME_INITIAL) { 2899 + if (ep->target_frame == TARGET_FRAME_INITIAL) { 2900 2900 u32 ctrl; 2901 2901 2902 2902 ep->target_frame = hsotg->frame_number; 2903 - dwc2_gadget_incr_frame_num(ep); 2903 + if (ep->interval > 1) { 2904 + ctrl = dwc2_readl(hsotg, DOEPCTL(ep->index)); 2905 + if (ep->target_frame & 0x1) 2906 + ctrl |= DXEPCTL_SETODDFR; 2907 + else 2908 + ctrl |= DXEPCTL_SETEVENFR; 2904 2909 2905 - ctrl = dwc2_readl(hsotg, DOEPCTL(ep->index)); 2906 - if (ep->target_frame & 0x1) 2907 - ctrl |= DXEPCTL_SETODDFR; 2908 - else 2909 - ctrl |= DXEPCTL_SETEVENFR; 2910 - 2911 - dwc2_writel(hsotg, ctrl, DOEPCTL(ep->index)); 2910 + dwc2_writel(hsotg, ctrl, DOEPCTL(ep->index)); 2911 + } 2912 2912 } 2913 2913 2914 - dwc2_gadget_start_next_request(ep); 2915 - doepmsk = dwc2_readl(hsotg, DOEPMSK); 2916 - doepmsk &= ~DOEPMSK_OUTTKNEPDISMSK; 2917 - dwc2_writel(hsotg, doepmsk, DOEPMSK); 2914 + while (dwc2_gadget_target_frame_elapsed(ep)) { 2915 + hs_req = get_ep_head(ep); 2916 + if (hs_req) 2917 + dwc2_hsotg_complete_request(hsotg, ep, hs_req, -ENODATA); 2918 + 2919 + dwc2_gadget_incr_frame_num(ep); 2920 + /* Update current frame number value. */ 2921 + hsotg->frame_number = dwc2_hsotg_read_frameno(hsotg); 2922 + } 2923 + 2924 + if (!ep->req) 2925 + dwc2_gadget_start_next_request(ep); 2926 + 2918 2927 } 2928 + 2929 + static void dwc2_hsotg_ep_stop_xfr(struct dwc2_hsotg *hsotg, 2930 + struct dwc2_hsotg_ep *hs_ep); 2919 2931 2920 2932 /** 2921 2933 * dwc2_gadget_handle_nak - handle NAK interrupt ··· 2945 2935 static void dwc2_gadget_handle_nak(struct dwc2_hsotg_ep *hs_ep) 2946 2936 { 2947 2937 struct dwc2_hsotg *hsotg = hs_ep->parent; 2938 + struct dwc2_hsotg_req *hs_req; 2948 2939 int dir_in = hs_ep->dir_in; 2940 + u32 ctrl; 2949 2941 2950 2942 if (!dir_in || !hs_ep->isochronous) 2951 2943 return; ··· 2989 2977 2990 2978 dwc2_writel(hsotg, ctrl, DIEPCTL(hs_ep->index)); 2991 2979 } 2992 - 2993 - dwc2_hsotg_complete_request(hsotg, hs_ep, 2994 - get_ep_head(hs_ep), 0); 2995 2980 } 2996 2981 2997 - if (!using_desc_dma(hsotg)) 2982 + if (using_desc_dma(hsotg)) 2983 + return; 2984 + 2985 + ctrl = dwc2_readl(hsotg, DIEPCTL(hs_ep->index)); 2986 + if (ctrl & DXEPCTL_EPENA) 2987 + dwc2_hsotg_ep_stop_xfr(hsotg, hs_ep); 2988 + else 2989 + dwc2_hsotg_txfifo_flush(hsotg, hs_ep->fifo_index); 2990 + 2991 + while (dwc2_gadget_target_frame_elapsed(hs_ep)) { 2992 + hs_req = get_ep_head(hs_ep); 2993 + if (hs_req) 2994 + dwc2_hsotg_complete_request(hsotg, hs_ep, hs_req, -ENODATA); 2995 + 2998 2996 dwc2_gadget_incr_frame_num(hs_ep); 2997 + /* Update current frame number value. */ 2998 + hsotg->frame_number = dwc2_hsotg_read_frameno(hsotg); 2999 + } 3000 + 3001 + if (!hs_ep->req) 3002 + dwc2_gadget_start_next_request(hs_ep); 2999 3003 } 3000 3004 3001 3005 /** ··· 3067 3039 3068 3040 /* In DDMA handle isochronous requests separately */ 3069 3041 if (using_desc_dma(hsotg) && hs_ep->isochronous) { 3070 - /* XferCompl set along with BNA */ 3071 - if (!(ints & DXEPINT_BNAINTR)) 3072 - dwc2_gadget_complete_isoc_request_ddma(hs_ep); 3042 + dwc2_gadget_complete_isoc_request_ddma(hs_ep); 3073 3043 } else if (dir_in) { 3074 3044 /* 3075 3045 * We get OutDone from the FIFO, so we only 3076 3046 * need to look at completing IN requests here 3077 3047 * if operating slave mode 3078 3048 */ 3079 - if (hs_ep->isochronous && hs_ep->interval > 1) 3080 - dwc2_gadget_incr_frame_num(hs_ep); 3081 - 3082 - dwc2_hsotg_complete_in(hsotg, hs_ep); 3083 - if (ints & DXEPINT_NAKINTRPT) 3084 - ints &= ~DXEPINT_NAKINTRPT; 3049 + if (!hs_ep->isochronous || !(ints & DXEPINT_NAKINTRPT)) 3050 + dwc2_hsotg_complete_in(hsotg, hs_ep); 3085 3051 3086 3052 if (idx == 0 && !hs_ep->req) 3087 3053 dwc2_hsotg_enqueue_setup(hsotg); ··· 3084 3062 * We're using DMA, we need to fire an OutDone here 3085 3063 * as we ignore the RXFIFO. 3086 3064 */ 3087 - if (hs_ep->isochronous && hs_ep->interval > 1) 3088 - dwc2_gadget_incr_frame_num(hs_ep); 3089 - 3090 - dwc2_hsotg_handle_outdone(hsotg, idx); 3065 + if (!hs_ep->isochronous || !(ints & DXEPINT_OUTTKNEPDIS)) 3066 + dwc2_hsotg_handle_outdone(hsotg, idx); 3091 3067 } 3092 3068 } 3093 3069 ··· 4105 4085 mask |= DIEPMSK_NAKMSK; 4106 4086 dwc2_writel(hsotg, mask, DIEPMSK); 4107 4087 } else { 4088 + epctrl |= DXEPCTL_SNAK; 4108 4089 mask = dwc2_readl(hsotg, DOEPMSK); 4109 4090 mask |= DOEPMSK_OUTTKNEPDISMSK; 4110 4091 dwc2_writel(hsotg, mask, DOEPMSK);
+4
drivers/usb/dwc2/hcd.c
··· 5191 5191 hcd->has_tt = 1; 5192 5192 5193 5193 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 5194 + if (!res) { 5195 + retval = -EINVAL; 5196 + goto error1; 5197 + } 5194 5198 hcd->rsrc_start = res->start; 5195 5199 hcd->rsrc_len = resource_size(res); 5196 5200
+13 -17
drivers/usb/dwc3/core.c
··· 264 264 { 265 265 u32 reg; 266 266 int retries = 1000; 267 - int ret; 268 - 269 - usb_phy_init(dwc->usb2_phy); 270 - usb_phy_init(dwc->usb3_phy); 271 - ret = phy_init(dwc->usb2_generic_phy); 272 - if (ret < 0) 273 - return ret; 274 - 275 - ret = phy_init(dwc->usb3_generic_phy); 276 - if (ret < 0) { 277 - phy_exit(dwc->usb2_generic_phy); 278 - return ret; 279 - } 280 267 281 268 /* 282 269 * We're resetting only the device side because, if we're in host mode, ··· 296 309 else 297 310 udelay(1); 298 311 } while (--retries); 299 - 300 - phy_exit(dwc->usb3_generic_phy); 301 - phy_exit(dwc->usb2_generic_phy); 302 312 303 313 return -ETIMEDOUT; 304 314 ··· 966 982 dwc->phys_ready = true; 967 983 } 968 984 985 + usb_phy_init(dwc->usb2_phy); 986 + usb_phy_init(dwc->usb3_phy); 987 + ret = phy_init(dwc->usb2_generic_phy); 988 + if (ret < 0) 989 + goto err0a; 990 + 991 + ret = phy_init(dwc->usb3_generic_phy); 992 + if (ret < 0) { 993 + phy_exit(dwc->usb2_generic_phy); 994 + goto err0a; 995 + } 996 + 969 997 ret = dwc3_core_soft_reset(dwc); 970 998 if (ret) 971 - goto err0a; 999 + goto err1; 972 1000 973 1001 if (hw_mode == DWC3_GHWPARAMS0_MODE_DRD && 974 1002 !DWC3_VER_IS_WITHIN(DWC3, ANY, 194A)) {
+18 -1
drivers/usb/gadget/function/f_uac2.c
··· 406 406 .bInterval = 4, 407 407 }; 408 408 409 + static struct usb_ss_ep_comp_descriptor ss_epin_fback_desc_comp = { 410 + .bLength = sizeof(ss_epin_fback_desc_comp), 411 + .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, 412 + .bMaxBurst = 0, 413 + .bmAttributes = 0, 414 + .wBytesPerInterval = cpu_to_le16(4), 415 + }; 416 + 409 417 410 418 /* Audio Streaming IN Interface - Alt0 */ 411 419 static struct usb_interface_descriptor std_as_in_if0_desc = { ··· 605 597 (struct usb_descriptor_header *)&ss_epout_desc_comp, 606 598 (struct usb_descriptor_header *)&as_iso_out_desc, 607 599 (struct usb_descriptor_header *)&ss_epin_fback_desc, 600 + (struct usb_descriptor_header *)&ss_epin_fback_desc_comp, 608 601 609 602 (struct usb_descriptor_header *)&std_as_in_if0_desc, 610 603 (struct usb_descriptor_header *)&std_as_in_if1_desc, ··· 714 705 { 715 706 struct usb_ss_ep_comp_descriptor *epout_desc_comp = NULL; 716 707 struct usb_ss_ep_comp_descriptor *epin_desc_comp = NULL; 708 + struct usb_ss_ep_comp_descriptor *epin_fback_desc_comp = NULL; 717 709 struct usb_endpoint_descriptor *epout_desc; 718 710 struct usb_endpoint_descriptor *epin_desc; 719 711 struct usb_endpoint_descriptor *epin_fback_desc; ··· 740 730 epout_desc_comp = &ss_epout_desc_comp; 741 731 epin_desc_comp = &ss_epin_desc_comp; 742 732 epin_fback_desc = &ss_epin_fback_desc; 733 + epin_fback_desc_comp = &ss_epin_fback_desc_comp; 743 734 ep_int_desc = &ss_ep_int_desc; 744 735 } 745 736 ··· 784 773 785 774 headers[i++] = USBDHDR(&as_iso_out_desc); 786 775 787 - if (EPOUT_FBACK_IN_EN(opts)) 776 + if (EPOUT_FBACK_IN_EN(opts)) { 788 777 headers[i++] = USBDHDR(epin_fback_desc); 778 + if (epin_fback_desc_comp) 779 + headers[i++] = USBDHDR(epin_fback_desc_comp); 780 + } 789 781 } 790 782 791 783 if (EPIN_EN(opts)) { ··· 1177 1163 le16_to_cpu(ss_epin_desc.wMaxPacketSize)); 1178 1164 agdev->out_ep_maxpsize = max_t(u16, agdev->out_ep_maxpsize, 1179 1165 le16_to_cpu(ss_epout_desc.wMaxPacketSize)); 1166 + 1167 + ss_epin_desc_comp.wBytesPerInterval = ss_epin_desc.wMaxPacketSize; 1168 + ss_epout_desc_comp.wBytesPerInterval = ss_epout_desc.wMaxPacketSize; 1180 1169 1181 1170 // HS and SS endpoint addresses are copied from autoconfigured FS descriptors 1182 1171 hs_ep_int_desc.bEndpointAddress = fs_ep_int_desc.bEndpointAddress;
+10 -3
drivers/usb/gadget/function/u_audio.c
··· 96 96 }; 97 97 98 98 static void u_audio_set_fback_frequency(enum usb_device_speed speed, 99 + struct usb_ep *out_ep, 99 100 unsigned long long freq, 100 101 unsigned int pitch, 101 102 void *buf) 102 103 { 103 104 u32 ff = 0; 105 + const struct usb_endpoint_descriptor *ep_desc; 104 106 105 107 /* 106 108 * Because the pitch base is 1000000, the final divider here ··· 130 128 * byte fromat (that is Q16.16) 131 129 * 132 130 * ff = (freq << 16) / 8000 131 + * 132 + * Win10 and OSX UAC2 drivers require number of samples per packet 133 + * in order to honor the feedback value. 134 + * Linux snd-usb-audio detects the applied bit-shift automatically. 133 135 */ 134 - freq <<= 4; 136 + ep_desc = out_ep->desc; 137 + freq <<= 4 + (ep_desc->bInterval - 1); 135 138 } 136 139 137 140 ff = DIV_ROUND_CLOSEST_ULL((freq * pitch), 1953125); ··· 274 267 pr_debug("%s: iso_complete status(%d) %d/%d\n", 275 268 __func__, status, req->actual, req->length); 276 269 277 - u_audio_set_fback_frequency(audio_dev->gadget->speed, 270 + u_audio_set_fback_frequency(audio_dev->gadget->speed, audio_dev->out_ep, 278 271 params->c_srate, prm->pitch, 279 272 req->buf); 280 273 ··· 533 526 * be meauserd at start of playback 534 527 */ 535 528 prm->pitch = 1000000; 536 - u_audio_set_fback_frequency(audio_dev->gadget->speed, 529 + u_audio_set_fback_frequency(audio_dev->gadget->speed, ep, 537 530 params->c_srate, prm->pitch, 538 531 req_fback->buf); 539 532
+1 -1
drivers/usb/gadget/udc/r8a66597-udc.c
··· 1250 1250 do { 1251 1251 tmp = r8a66597_read(r8a66597, INTSTS0) & CTSQ; 1252 1252 udelay(1); 1253 - } while (tmp != CS_IDST || timeout-- > 0); 1253 + } while (tmp != CS_IDST && timeout-- > 0); 1254 1254 1255 1255 if (tmp == CS_IDST) 1256 1256 r8a66597_bset(r8a66597,
+1 -4
drivers/usb/host/bcma-hcd.c
··· 406 406 return -ENOMEM; 407 407 usb_dev->core = core; 408 408 409 - if (core->dev.of_node) { 409 + if (core->dev.of_node) 410 410 usb_dev->gpio_desc = devm_gpiod_get(&core->dev, "vcc", 411 411 GPIOD_OUT_HIGH); 412 - if (IS_ERR(usb_dev->gpio_desc)) 413 - return PTR_ERR(usb_dev->gpio_desc); 414 - } 415 412 416 413 switch (core->id.id) { 417 414 case BCMA_CORE_USB20_HOST:
+27 -48
drivers/usb/host/ehci-hcd.c
··· 26 26 #include <linux/moduleparam.h> 27 27 #include <linux/dma-mapping.h> 28 28 #include <linux/debugfs.h> 29 + #include <linux/platform_device.h> 29 30 #include <linux/slab.h> 30 31 31 32 #include <asm/byteorder.h> ··· 1279 1278 1280 1279 #ifdef CONFIG_USB_EHCI_SH 1281 1280 #include "ehci-sh.c" 1282 - #define PLATFORM_DRIVER ehci_hcd_sh_driver 1283 1281 #endif 1284 1282 1285 1283 #ifdef CONFIG_PPC_PS3 1286 1284 #include "ehci-ps3.c" 1287 - #define PS3_SYSTEM_BUS_DRIVER ps3_ehci_driver 1288 1285 #endif 1289 1286 1290 1287 #ifdef CONFIG_USB_EHCI_HCD_PPC_OF 1291 1288 #include "ehci-ppc-of.c" 1292 - #define OF_PLATFORM_DRIVER ehci_hcd_ppc_of_driver 1293 1289 #endif 1294 1290 1295 1291 #ifdef CONFIG_XPS_USB_HCD_XILINX 1296 1292 #include "ehci-xilinx-of.c" 1297 - #define XILINX_OF_PLATFORM_DRIVER ehci_hcd_xilinx_of_driver 1298 1293 #endif 1299 1294 1300 1295 #ifdef CONFIG_SPARC_LEON 1301 1296 #include "ehci-grlib.c" 1302 - #define PLATFORM_DRIVER ehci_grlib_driver 1303 1297 #endif 1298 + 1299 + static struct platform_driver * const platform_drivers[] = { 1300 + #ifdef CONFIG_USB_EHCI_SH 1301 + &ehci_hcd_sh_driver, 1302 + #endif 1303 + #ifdef CONFIG_USB_EHCI_HCD_PPC_OF 1304 + &ehci_hcd_ppc_of_driver, 1305 + #endif 1306 + #ifdef CONFIG_XPS_USB_HCD_XILINX 1307 + &ehci_hcd_xilinx_of_driver, 1308 + #endif 1309 + #ifdef CONFIG_SPARC_LEON 1310 + &ehci_grlib_driver, 1311 + #endif 1312 + }; 1304 1313 1305 1314 static int __init ehci_hcd_init(void) 1306 1315 { ··· 1335 1324 ehci_debug_root = debugfs_create_dir("ehci", usb_debug_root); 1336 1325 #endif 1337 1326 1338 - #ifdef PLATFORM_DRIVER 1339 - retval = platform_driver_register(&PLATFORM_DRIVER); 1327 + retval = platform_register_drivers(platform_drivers, ARRAY_SIZE(platform_drivers)); 1340 1328 if (retval < 0) 1341 1329 goto clean0; 1342 - #endif 1343 1330 1344 - #ifdef PS3_SYSTEM_BUS_DRIVER 1345 - retval = ps3_ehci_driver_register(&PS3_SYSTEM_BUS_DRIVER); 1331 + #ifdef CONFIG_PPC_PS3 1332 + retval = ps3_ehci_driver_register(&ps3_ehci_driver); 1346 1333 if (retval < 0) 1347 - goto clean2; 1334 + goto clean1; 1348 1335 #endif 1349 1336 1350 - #ifdef OF_PLATFORM_DRIVER 1351 - retval = platform_driver_register(&OF_PLATFORM_DRIVER); 1352 - if (retval < 0) 1353 - goto clean3; 1354 - #endif 1337 + return 0; 1355 1338 1356 - #ifdef XILINX_OF_PLATFORM_DRIVER 1357 - retval = platform_driver_register(&XILINX_OF_PLATFORM_DRIVER); 1358 - if (retval < 0) 1359 - goto clean4; 1339 + #ifdef CONFIG_PPC_PS3 1340 + clean1: 1360 1341 #endif 1361 - return retval; 1362 - 1363 - #ifdef XILINX_OF_PLATFORM_DRIVER 1364 - /* platform_driver_unregister(&XILINX_OF_PLATFORM_DRIVER); */ 1365 - clean4: 1366 - #endif 1367 - #ifdef OF_PLATFORM_DRIVER 1368 - platform_driver_unregister(&OF_PLATFORM_DRIVER); 1369 - clean3: 1370 - #endif 1371 - #ifdef PS3_SYSTEM_BUS_DRIVER 1372 - ps3_ehci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER); 1373 - clean2: 1374 - #endif 1375 - #ifdef PLATFORM_DRIVER 1376 - platform_driver_unregister(&PLATFORM_DRIVER); 1342 + platform_unregister_drivers(platform_drivers, ARRAY_SIZE(platform_drivers)); 1377 1343 clean0: 1378 - #endif 1379 1344 #ifdef CONFIG_DYNAMIC_DEBUG 1380 1345 debugfs_remove(ehci_debug_root); 1381 1346 ehci_debug_root = NULL; ··· 1363 1376 1364 1377 static void __exit ehci_hcd_cleanup(void) 1365 1378 { 1366 - #ifdef XILINX_OF_PLATFORM_DRIVER 1367 - platform_driver_unregister(&XILINX_OF_PLATFORM_DRIVER); 1379 + #ifdef CONFIG_PPC_PS3 1380 + ps3_ehci_driver_unregister(&ps3_ehci_driver); 1368 1381 #endif 1369 - #ifdef OF_PLATFORM_DRIVER 1370 - platform_driver_unregister(&OF_PLATFORM_DRIVER); 1371 - #endif 1372 - #ifdef PLATFORM_DRIVER 1373 - platform_driver_unregister(&PLATFORM_DRIVER); 1374 - #endif 1375 - #ifdef PS3_SYSTEM_BUS_DRIVER 1376 - ps3_ehci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER); 1377 - #endif 1382 + platform_unregister_drivers(platform_drivers, ARRAY_SIZE(platform_drivers)); 1378 1383 #ifdef CONFIG_DYNAMIC_DEBUG 1379 1384 debugfs_remove(ehci_debug_root); 1380 1385 #endif
+1
drivers/usb/host/xhci.c
··· 692 692 if (ret) 693 693 xhci_free_command(xhci, command); 694 694 } 695 + set_bit(HCD_FLAG_DEFER_RH_REGISTER, &hcd->flags); 695 696 xhci_dbg_trace(xhci, trace_xhci_dbg_init, 696 697 "Finished xhci_run for USB2 roothub"); 697 698
+1
drivers/usb/musb/tusb6010.c
··· 190 190 } 191 191 if (len > 0) { 192 192 /* Write the rest 1 - 3 bytes to FIFO */ 193 + val = 0; 193 194 memcpy(&val, buf, len); 194 195 musb_writel(fifo, 0, val); 195 196 }
+38
drivers/usb/serial/cp210x.c
··· 233 233 { USB_DEVICE(0x1FB9, 0x0602) }, /* Lake Shore Model 648 Magnet Power Supply */ 234 234 { USB_DEVICE(0x1FB9, 0x0700) }, /* Lake Shore Model 737 VSM Controller */ 235 235 { USB_DEVICE(0x1FB9, 0x0701) }, /* Lake Shore Model 776 Hall Matrix */ 236 + { USB_DEVICE(0x2184, 0x0030) }, /* GW Instek GDM-834x Digital Multimeter */ 236 237 { USB_DEVICE(0x2626, 0xEA60) }, /* Aruba Networks 7xxx USB Serial Console */ 237 238 { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ 238 239 { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */ ··· 259 258 speed_t max_speed; 260 259 bool use_actual_rate; 261 260 bool no_flow_control; 261 + bool no_event_mode; 262 262 }; 263 263 264 264 enum cp210x_event_state { ··· 1115 1113 1116 1114 static void cp210x_enable_event_mode(struct usb_serial_port *port) 1117 1115 { 1116 + struct cp210x_serial_private *priv = usb_get_serial_data(port->serial); 1118 1117 struct cp210x_port_private *port_priv = usb_get_serial_port_data(port); 1119 1118 int ret; 1120 1119 1121 1120 if (port_priv->event_mode) 1121 + return; 1122 + 1123 + if (priv->no_event_mode) 1122 1124 return; 1123 1125 1124 1126 port_priv->event_state = ES_DATA; ··· 2080 2074 priv->use_actual_rate = use_actual_rate; 2081 2075 } 2082 2076 2077 + static void cp2102_determine_quirks(struct usb_serial *serial) 2078 + { 2079 + struct cp210x_serial_private *priv = usb_get_serial_data(serial); 2080 + u8 *buf; 2081 + int ret; 2082 + 2083 + buf = kmalloc(2, GFP_KERNEL); 2084 + if (!buf) 2085 + return; 2086 + /* 2087 + * Some (possibly counterfeit) CP2102 do not support event-insertion 2088 + * mode and respond differently to malformed vendor requests. 2089 + * Specifically, they return one instead of two bytes when sent a 2090 + * two-byte part-number request. 2091 + */ 2092 + ret = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), 2093 + CP210X_VENDOR_SPECIFIC, REQTYPE_DEVICE_TO_HOST, 2094 + CP210X_GET_PARTNUM, 0, buf, 2, USB_CTRL_GET_TIMEOUT); 2095 + if (ret == 1) { 2096 + dev_dbg(&serial->interface->dev, 2097 + "device does not support event-insertion mode\n"); 2098 + priv->no_event_mode = true; 2099 + } 2100 + 2101 + kfree(buf); 2102 + } 2103 + 2083 2104 static int cp210x_get_fw_version(struct usb_serial *serial, u16 value) 2084 2105 { 2085 2106 struct cp210x_serial_private *priv = usb_get_serial_data(serial); ··· 2141 2108 return; 2142 2109 } 2143 2110 2111 + dev_dbg(&serial->interface->dev, "partnum = 0x%02x\n", priv->partnum); 2112 + 2144 2113 switch (priv->partnum) { 2114 + case CP210X_PARTNUM_CP2102: 2115 + cp2102_determine_quirks(serial); 2116 + break; 2145 2117 case CP210X_PARTNUM_CP2105: 2146 2118 case CP210X_PARTNUM_CP2108: 2147 2119 cp210x_get_fw_version(serial, CP210X_GET_FW_VER);
-2
drivers/usb/serial/mos7840.c
··· 107 107 #define BANDB_DEVICE_ID_USOPTL4_2P 0xBC02 108 108 #define BANDB_DEVICE_ID_USOPTL4_4 0xAC44 109 109 #define BANDB_DEVICE_ID_USOPTL4_4P 0xBC03 110 - #define BANDB_DEVICE_ID_USOPTL2_4 0xAC24 111 110 112 111 /* Interrupt Routine Defines */ 113 112 ··· 185 186 { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2P) }, 186 187 { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4) }, 187 188 { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4P) }, 188 - { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL2_4) }, 189 189 {} /* terminating entry */ 190 190 }; 191 191 MODULE_DEVICE_TABLE(usb, id_table);
+10 -1
drivers/usb/serial/option.c
··· 1205 1205 .driver_info = NCTRL(0) | RSVD(1) }, 1206 1206 { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1056, 0xff), /* Telit FD980 */ 1207 1207 .driver_info = NCTRL(2) | RSVD(3) }, 1208 + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1060, 0xff), /* Telit LN920 (rmnet) */ 1209 + .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, 1210 + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1061, 0xff), /* Telit LN920 (MBIM) */ 1211 + .driver_info = NCTRL(0) | RSVD(1) }, 1212 + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1062, 0xff), /* Telit LN920 (RNDIS) */ 1213 + .driver_info = NCTRL(2) | RSVD(3) }, 1214 + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1063, 0xff), /* Telit LN920 (ECM) */ 1215 + .driver_info = NCTRL(0) | RSVD(1) }, 1208 1216 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910), 1209 1217 .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) }, 1210 1218 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM), ··· 1658 1650 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0060, 0xff, 0xff, 0xff) }, 1659 1651 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0070, 0xff, 0xff, 0xff) }, 1660 1652 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0073, 0xff, 0xff, 0xff) }, 1661 - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0094, 0xff, 0xff, 0xff) }, 1662 1653 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff), 1663 1654 .driver_info = RSVD(1) }, 1664 1655 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0133, 0xff, 0xff, 0xff), ··· 2075 2068 .driver_info = RSVD(0) | RSVD(1) | RSVD(6) }, 2076 2069 { USB_DEVICE(0x0489, 0xe0b5), /* Foxconn T77W968 ESIM */ 2077 2070 .driver_info = RSVD(0) | RSVD(1) | RSVD(6) }, 2071 + { USB_DEVICE_INTERFACE_CLASS(0x0489, 0xe0db, 0xff), /* Foxconn T99W265 MBIM */ 2072 + .driver_info = RSVD(3) }, 2078 2073 { USB_DEVICE(0x1508, 0x1001), /* Fibocom NL668 (IOT version) */ 2079 2074 .driver_info = RSVD(4) | RSVD(5) | RSVD(6) }, 2080 2075 { USB_DEVICE(0x2cb7, 0x0104), /* Fibocom NL678 series */
+8 -1
drivers/usb/storage/unusual_devs.h
··· 416 416 USB_SC_UFI, USB_PR_DEVICE, NULL, US_FL_FIX_INQUIRY | US_FL_SINGLE_LUN), 417 417 418 418 /* 419 - * Reported by Ondrej Zary <linux@rainbow-software.org> 419 + * Reported by Ondrej Zary <linux@zary.sk> 420 420 * The device reports one sector more and breaks when that sector is accessed 421 + * Firmwares older than 2.6c (the latest one and the only that claims Linux 422 + * support) have also broken tag handling 421 423 */ 424 + UNUSUAL_DEV( 0x04ce, 0x0002, 0x0000, 0x026b, 425 + "ScanLogic", 426 + "SL11R-IDE", 427 + USB_SC_DEVICE, USB_PR_DEVICE, NULL, 428 + US_FL_FIX_CAPACITY | US_FL_BULK_IGNORE_TAG), 422 429 UNUSUAL_DEV( 0x04ce, 0x0002, 0x026c, 0x026c, 423 430 "ScanLogic", 424 431 "SL11R-IDE",
+1 -1
drivers/usb/storage/unusual_uas.h
··· 50 50 "LaCie", 51 51 "Rugged USB3-FW", 52 52 USB_SC_DEVICE, USB_PR_DEVICE, NULL, 53 - US_FL_IGNORE_UAS), 53 + US_FL_NO_REPORT_OPCODES | US_FL_NO_SAME), 54 54 55 55 /* 56 56 * Apricorn USB3 dongle sometimes returns "USBSUSBSUSBS" in response to SCSI
+1
drivers/xen/Kconfig
··· 177 177 178 178 config SWIOTLB_XEN 179 179 def_bool y 180 + depends on XEN_PV || ARM || ARM64 180 181 select DMA_OPS 181 182 select SWIOTLB 182 183
+2 -2
drivers/xen/balloon.c
··· 522 522 timeout = 3600 * HZ; 523 523 credit = current_credit(); 524 524 525 - wait_event_interruptible_timeout(balloon_thread_wq, 526 - balloon_thread_cond(state, credit), timeout); 525 + wait_event_freezable_timeout(balloon_thread_wq, 526 + balloon_thread_cond(state, credit), timeout); 527 527 528 528 if (kthread_should_stop()) 529 529 return 0;
+8
drivers/xen/gntdev.c
··· 381 381 map->unmap_ops[offset+i].handle, 382 382 map->unmap_ops[offset+i].status); 383 383 map->unmap_ops[offset+i].handle = INVALID_GRANT_HANDLE; 384 + if (use_ptemod) { 385 + if (map->kunmap_ops[offset+i].status) 386 + err = -EINVAL; 387 + pr_debug("kunmap handle=%u st=%d\n", 388 + map->kunmap_ops[offset+i].handle, 389 + map->kunmap_ops[offset+i].status); 390 + map->kunmap_ops[offset+i].handle = INVALID_GRANT_HANDLE; 391 + } 384 392 } 385 393 return err; 386 394 }
+4 -3
drivers/xen/swiotlb-xen.c
··· 230 230 /* 231 231 * Get IO TLB memory from any location. 232 232 */ 233 - start = memblock_alloc(PAGE_ALIGN(bytes), PAGE_SIZE); 233 + start = memblock_alloc(PAGE_ALIGN(bytes), 234 + IO_TLB_SEGSIZE << IO_TLB_SHIFT); 234 235 if (!start) 235 - panic("%s: Failed to allocate %lu bytes align=0x%lx\n", 236 - __func__, PAGE_ALIGN(bytes), PAGE_SIZE); 236 + panic("%s: Failed to allocate %lu bytes\n", 237 + __func__, PAGE_ALIGN(bytes)); 237 238 238 239 /* 239 240 * And replace that memory with pages under 4GB.
+42 -2
fs/afs/callback.c
··· 21 21 #include "internal.h" 22 22 23 23 /* 24 + * Handle invalidation of an mmap'd file. We invalidate all the PTEs referring 25 + * to the pages in this file's pagecache, forcing the kernel to go through 26 + * ->fault() or ->page_mkwrite() - at which point we can handle invalidation 27 + * more fully. 28 + */ 29 + void afs_invalidate_mmap_work(struct work_struct *work) 30 + { 31 + struct afs_vnode *vnode = container_of(work, struct afs_vnode, cb_work); 32 + 33 + unmap_mapping_pages(vnode->vfs_inode.i_mapping, 0, 0, false); 34 + } 35 + 36 + void afs_server_init_callback_work(struct work_struct *work) 37 + { 38 + struct afs_server *server = container_of(work, struct afs_server, initcb_work); 39 + struct afs_vnode *vnode; 40 + struct afs_cell *cell = server->cell; 41 + 42 + down_read(&cell->fs_open_mmaps_lock); 43 + 44 + list_for_each_entry(vnode, &cell->fs_open_mmaps, cb_mmap_link) { 45 + if (vnode->cb_server == server) { 46 + clear_bit(AFS_VNODE_CB_PROMISED, &vnode->flags); 47 + queue_work(system_unbound_wq, &vnode->cb_work); 48 + } 49 + } 50 + 51 + up_read(&cell->fs_open_mmaps_lock); 52 + } 53 + 54 + /* 24 55 * Allow the fileserver to request callback state (re-)initialisation. 25 56 * Unfortunately, UUIDs are not guaranteed unique. 26 57 */ ··· 60 29 rcu_read_lock(); 61 30 do { 62 31 server->cb_s_break++; 63 - server = rcu_dereference(server->uuid_next); 64 - } while (0); 32 + atomic_inc(&server->cell->fs_s_break); 33 + if (!list_empty(&server->cell->fs_open_mmaps)) 34 + queue_work(system_unbound_wq, &server->initcb_work); 35 + 36 + } while ((server = rcu_dereference(server->uuid_next))); 65 37 rcu_read_unlock(); 66 38 } 67 39 ··· 78 44 clear_bit(AFS_VNODE_NEW_CONTENT, &vnode->flags); 79 45 if (test_and_clear_bit(AFS_VNODE_CB_PROMISED, &vnode->flags)) { 80 46 vnode->cb_break++; 47 + vnode->cb_v_break = vnode->volume->cb_v_break; 81 48 afs_clear_permits(vnode); 82 49 83 50 if (vnode->lock_state == AFS_VNODE_LOCK_WAITING_FOR_CB) 84 51 afs_lock_may_be_available(vnode); 52 + 53 + if (reason != afs_cb_break_for_deleted && 54 + vnode->status.type == AFS_FTYPE_FILE && 55 + atomic_read(&vnode->cb_nr_mmap)) 56 + queue_work(system_unbound_wq, &vnode->cb_work); 85 57 86 58 trace_afs_cb_break(&vnode->fid, vnode->cb_break, reason, true); 87 59 } else {
+2
fs/afs/cell.c
··· 166 166 seqlock_init(&cell->volume_lock); 167 167 cell->fs_servers = RB_ROOT; 168 168 seqlock_init(&cell->fs_lock); 169 + INIT_LIST_HEAD(&cell->fs_open_mmaps); 170 + init_rwsem(&cell->fs_open_mmaps_lock); 169 171 rwlock_init(&cell->vl_servers_lock); 170 172 cell->flags = (1 << AFS_CELL_FL_CHECK_ALIAS); 171 173
+18 -39
fs/afs/dir.c
··· 1077 1077 */ 1078 1078 static int afs_d_revalidate_rcu(struct dentry *dentry) 1079 1079 { 1080 - struct afs_vnode *dvnode, *vnode; 1080 + struct afs_vnode *dvnode; 1081 1081 struct dentry *parent; 1082 - struct inode *dir, *inode; 1082 + struct inode *dir; 1083 1083 long dir_version, de_version; 1084 1084 1085 1085 _enter("%p", dentry); ··· 1107 1107 dir_version = (long)READ_ONCE(dvnode->invalid_before); 1108 1108 if (de_version - dir_version < 0) 1109 1109 return -ECHILD; 1110 - } 1111 - 1112 - /* Check to see if the vnode referred to by the dentry still 1113 - * has a callback. 1114 - */ 1115 - if (d_really_is_positive(dentry)) { 1116 - inode = d_inode_rcu(dentry); 1117 - if (inode) { 1118 - vnode = AFS_FS_I(inode); 1119 - if (!afs_check_validity(vnode)) 1120 - return -ECHILD; 1121 - } 1122 1110 } 1123 1111 1124 1112 return 1; /* Still valid */ ··· 1144 1156 if (IS_ERR(key)) 1145 1157 key = NULL; 1146 1158 1147 - if (d_really_is_positive(dentry)) { 1148 - inode = d_inode(dentry); 1149 - if (inode) { 1150 - vnode = AFS_FS_I(inode); 1151 - afs_validate(vnode, key); 1152 - if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) 1153 - goto out_bad; 1154 - } 1155 - } 1156 - 1157 - /* lock down the parent dentry so we can peer at it */ 1159 + /* Hold the parent dentry so we can peer at it */ 1158 1160 parent = dget_parent(dentry); 1159 1161 dir = AFS_FS_I(d_inode(parent)); 1160 1162 ··· 1153 1175 1154 1176 if (test_bit(AFS_VNODE_DELETED, &dir->flags)) { 1155 1177 _debug("%pd: parent dir deleted", dentry); 1156 - goto out_bad_parent; 1178 + goto not_found; 1157 1179 } 1158 1180 1159 1181 /* We only need to invalidate a dentry if the server's copy changed ··· 1179 1201 case 0: 1180 1202 /* the filename maps to something */ 1181 1203 if (d_really_is_negative(dentry)) 1182 - goto out_bad_parent; 1204 + goto not_found; 1183 1205 inode = d_inode(dentry); 1184 1206 if (is_bad_inode(inode)) { 1185 1207 printk("kAFS: afs_d_revalidate: %pd2 has bad inode\n", 1186 1208 dentry); 1187 - goto out_bad_parent; 1209 + goto not_found; 1188 1210 } 1189 1211 1190 1212 vnode = AFS_FS_I(inode); ··· 1206 1228 dentry, fid.unique, 1207 1229 vnode->fid.unique, 1208 1230 vnode->vfs_inode.i_generation); 1209 - write_seqlock(&vnode->cb_lock); 1210 - set_bit(AFS_VNODE_DELETED, &vnode->flags); 1211 - write_sequnlock(&vnode->cb_lock); 1212 1231 goto not_found; 1213 1232 } 1214 1233 goto out_valid; ··· 1220 1245 default: 1221 1246 _debug("failed to iterate dir %pd: %d", 1222 1247 parent, ret); 1223 - goto out_bad_parent; 1248 + goto not_found; 1224 1249 } 1225 1250 1226 1251 out_valid: ··· 1231 1256 _leave(" = 1 [valid]"); 1232 1257 return 1; 1233 1258 1234 - /* the dirent, if it exists, now points to a different vnode */ 1235 1259 not_found: 1236 - spin_lock(&dentry->d_lock); 1237 - dentry->d_flags |= DCACHE_NFSFS_RENAMED; 1238 - spin_unlock(&dentry->d_lock); 1239 - 1240 - out_bad_parent: 1241 1260 _debug("dropping dentry %pd2", dentry); 1242 1261 dput(parent); 1243 - out_bad: 1244 1262 key_put(key); 1245 1263 1246 1264 _leave(" = 0 [bad]"); ··· 1760 1792 goto error; 1761 1793 } 1762 1794 1795 + ret = afs_validate(vnode, op->key); 1796 + if (ret < 0) 1797 + goto error_op; 1798 + 1763 1799 afs_op_set_vnode(op, 0, dvnode); 1764 1800 afs_op_set_vnode(op, 1, vnode); 1765 1801 op->file[0].dv_delta = 1; ··· 1777 1805 op->create.reason = afs_edit_dir_for_link; 1778 1806 return afs_do_sync_operation(op); 1779 1807 1808 + error_op: 1809 + afs_put_operation(op); 1780 1810 error: 1781 1811 d_drop(dentry); 1782 1812 _leave(" = %d", ret); ··· 1962 1988 op = afs_alloc_operation(NULL, orig_dvnode->volume); 1963 1989 if (IS_ERR(op)) 1964 1990 return PTR_ERR(op); 1991 + 1992 + ret = afs_validate(vnode, op->key); 1993 + op->error = ret; 1994 + if (ret < 0) 1995 + goto error; 1965 1996 1966 1997 afs_op_set_vnode(op, 0, orig_dvnode); 1967 1998 afs_op_set_vnode(op, 1, new_dvnode); /* May be same as orig_dvnode */
+2 -2
fs/afs/dir_edit.c
··· 263 263 if (b == nr_blocks) { 264 264 _debug("init %u", b); 265 265 afs_edit_init_block(meta, block, b); 266 - i_size_write(&vnode->vfs_inode, (b + 1) * AFS_DIR_BLOCK_SIZE); 266 + afs_set_i_size(vnode, (b + 1) * AFS_DIR_BLOCK_SIZE); 267 267 } 268 268 269 269 /* Only lower dir pages have a counter in the header. */ ··· 296 296 new_directory: 297 297 afs_edit_init_block(meta, meta, 0); 298 298 i_size = AFS_DIR_BLOCK_SIZE; 299 - i_size_write(&vnode->vfs_inode, i_size); 299 + afs_set_i_size(vnode, i_size); 300 300 slot = AFS_DIR_RESV_BLOCKS0; 301 301 page = page0; 302 302 block = meta;
+83 -3
fs/afs/file.c
··· 24 24 static int afs_releasepage(struct page *page, gfp_t gfp_flags); 25 25 26 26 static void afs_readahead(struct readahead_control *ractl); 27 + static ssize_t afs_file_read_iter(struct kiocb *iocb, struct iov_iter *iter); 28 + static void afs_vm_open(struct vm_area_struct *area); 29 + static void afs_vm_close(struct vm_area_struct *area); 30 + static vm_fault_t afs_vm_map_pages(struct vm_fault *vmf, pgoff_t start_pgoff, pgoff_t end_pgoff); 27 31 28 32 const struct file_operations afs_file_operations = { 29 33 .open = afs_open, 30 34 .release = afs_release, 31 35 .llseek = generic_file_llseek, 32 - .read_iter = generic_file_read_iter, 36 + .read_iter = afs_file_read_iter, 33 37 .write_iter = afs_file_write, 34 38 .mmap = afs_file_mmap, 35 39 .splice_read = generic_file_splice_read, ··· 63 59 }; 64 60 65 61 static const struct vm_operations_struct afs_vm_ops = { 62 + .open = afs_vm_open, 63 + .close = afs_vm_close, 66 64 .fault = filemap_fault, 67 - .map_pages = filemap_map_pages, 65 + .map_pages = afs_vm_map_pages, 68 66 .page_mkwrite = afs_page_mkwrite, 69 67 }; 70 68 ··· 301 295 fsreq->subreq = subreq; 302 296 fsreq->pos = subreq->start + subreq->transferred; 303 297 fsreq->len = subreq->len - subreq->transferred; 304 - fsreq->key = subreq->rreq->netfs_priv; 298 + fsreq->key = key_get(subreq->rreq->netfs_priv); 305 299 fsreq->vnode = vnode; 306 300 fsreq->iter = &fsreq->def_iter; 307 301 ··· 310 304 fsreq->pos, fsreq->len); 311 305 312 306 afs_fetch_data(fsreq->vnode, fsreq); 307 + afs_put_read(fsreq); 313 308 } 314 309 315 310 static int afs_symlink_readpage(struct page *page) ··· 497 490 return 1; 498 491 } 499 492 493 + static void afs_add_open_mmap(struct afs_vnode *vnode) 494 + { 495 + if (atomic_inc_return(&vnode->cb_nr_mmap) == 1) { 496 + down_write(&vnode->volume->cell->fs_open_mmaps_lock); 497 + 498 + list_add_tail(&vnode->cb_mmap_link, 499 + &vnode->volume->cell->fs_open_mmaps); 500 + 501 + up_write(&vnode->volume->cell->fs_open_mmaps_lock); 502 + } 503 + } 504 + 505 + static void afs_drop_open_mmap(struct afs_vnode *vnode) 506 + { 507 + if (!atomic_dec_and_test(&vnode->cb_nr_mmap)) 508 + return; 509 + 510 + down_write(&vnode->volume->cell->fs_open_mmaps_lock); 511 + 512 + if (atomic_read(&vnode->cb_nr_mmap) == 0) 513 + list_del_init(&vnode->cb_mmap_link); 514 + 515 + up_write(&vnode->volume->cell->fs_open_mmaps_lock); 516 + flush_work(&vnode->cb_work); 517 + } 518 + 500 519 /* 501 520 * Handle setting up a memory mapping on an AFS file. 502 521 */ 503 522 static int afs_file_mmap(struct file *file, struct vm_area_struct *vma) 504 523 { 524 + struct afs_vnode *vnode = AFS_FS_I(file_inode(file)); 505 525 int ret; 526 + 527 + afs_add_open_mmap(vnode); 506 528 507 529 ret = generic_file_mmap(file, vma); 508 530 if (ret == 0) 509 531 vma->vm_ops = &afs_vm_ops; 532 + else 533 + afs_drop_open_mmap(vnode); 510 534 return ret; 535 + } 536 + 537 + static void afs_vm_open(struct vm_area_struct *vma) 538 + { 539 + afs_add_open_mmap(AFS_FS_I(file_inode(vma->vm_file))); 540 + } 541 + 542 + static void afs_vm_close(struct vm_area_struct *vma) 543 + { 544 + afs_drop_open_mmap(AFS_FS_I(file_inode(vma->vm_file))); 545 + } 546 + 547 + static vm_fault_t afs_vm_map_pages(struct vm_fault *vmf, pgoff_t start_pgoff, pgoff_t end_pgoff) 548 + { 549 + struct afs_vnode *vnode = AFS_FS_I(file_inode(vmf->vma->vm_file)); 550 + struct afs_file *af = vmf->vma->vm_file->private_data; 551 + 552 + switch (afs_validate(vnode, af->key)) { 553 + case 0: 554 + return filemap_map_pages(vmf, start_pgoff, end_pgoff); 555 + case -ENOMEM: 556 + return VM_FAULT_OOM; 557 + case -EINTR: 558 + case -ERESTARTSYS: 559 + return VM_FAULT_RETRY; 560 + case -ESTALE: 561 + default: 562 + return VM_FAULT_SIGBUS; 563 + } 564 + } 565 + 566 + static ssize_t afs_file_read_iter(struct kiocb *iocb, struct iov_iter *iter) 567 + { 568 + struct afs_vnode *vnode = AFS_FS_I(file_inode(iocb->ki_filp)); 569 + struct afs_file *af = iocb->ki_filp->private_data; 570 + int ret; 571 + 572 + ret = afs_validate(vnode, af->key); 573 + if (ret < 0) 574 + return ret; 575 + 576 + return generic_file_read_iter(iocb, iter); 511 577 }
+7 -1
fs/afs/fs_probe.c
··· 9 9 #include <linux/slab.h> 10 10 #include "afs_fs.h" 11 11 #include "internal.h" 12 + #include "protocol_afs.h" 12 13 #include "protocol_yfs.h" 13 14 14 15 static unsigned int afs_fs_probe_fast_poll_interval = 30 * HZ; ··· 103 102 struct afs_addr_list *alist = call->alist; 104 103 struct afs_server *server = call->server; 105 104 unsigned int index = call->addr_ix; 106 - unsigned int rtt_us = 0; 105 + unsigned int rtt_us = 0, cap0; 107 106 int ret = call->error; 108 107 109 108 _enter("%pU,%u", &server->uuid, index); ··· 160 159 clear_bit(AFS_SERVER_FL_IS_YFS, &server->flags); 161 160 alist->addrs[index].srx_service = call->service_id; 162 161 } 162 + cap0 = ntohl(call->tmp); 163 + if (cap0 & AFS3_VICED_CAPABILITY_64BITFILES) 164 + set_bit(AFS_SERVER_FL_HAS_FS64, &server->flags); 165 + else 166 + clear_bit(AFS_SERVER_FL_HAS_FS64, &server->flags); 163 167 } 164 168 165 169 if (rxrpc_kernel_get_srtt(call->net->socket, call->rxcall, &rtt_us) &&
+20 -11
fs/afs/fsclient.c
··· 456 456 struct afs_read *req = op->fetch.req; 457 457 __be32 *bp; 458 458 459 - if (upper_32_bits(req->pos) || 460 - upper_32_bits(req->len) || 461 - upper_32_bits(req->pos + req->len)) 459 + if (test_bit(AFS_SERVER_FL_HAS_FS64, &op->server->flags)) 462 460 return afs_fs_fetch_data64(op); 463 461 464 462 _enter(""); ··· 1111 1113 (unsigned long long)op->store.pos, 1112 1114 (unsigned long long)op->store.i_size); 1113 1115 1114 - if (upper_32_bits(op->store.pos) || 1115 - upper_32_bits(op->store.size) || 1116 - upper_32_bits(op->store.i_size)) 1116 + if (test_bit(AFS_SERVER_FL_HAS_FS64, &op->server->flags)) 1117 1117 return afs_fs_store_data64(op); 1118 1118 1119 1119 call = afs_alloc_flat_call(op->net, &afs_RXFSStoreData, ··· 1225 1229 key_serial(op->key), vp->fid.vid, vp->fid.vnode); 1226 1230 1227 1231 ASSERT(attr->ia_valid & ATTR_SIZE); 1228 - if (upper_32_bits(attr->ia_size)) 1232 + if (test_bit(AFS_SERVER_FL_HAS_FS64, &op->server->flags)) 1229 1233 return afs_fs_setattr_size64(op); 1230 1234 1231 1235 call = afs_alloc_flat_call(op->net, &afs_RXFSStoreData_as_Status, ··· 1653 1657 return ret; 1654 1658 1655 1659 count = ntohl(call->tmp); 1656 - 1657 1660 call->count = count; 1658 1661 call->count2 = count; 1659 - afs_extract_discard(call, count * sizeof(__be32)); 1662 + if (count == 0) { 1663 + call->unmarshall = 4; 1664 + call->tmp = 0; 1665 + break; 1666 + } 1667 + 1668 + /* Extract the first word of the capabilities to call->tmp */ 1669 + afs_extract_to_tmp(call); 1660 1670 call->unmarshall++; 1661 1671 fallthrough; 1662 1672 1663 - /* Extract capabilities words */ 1664 1673 case 2: 1665 1674 ret = afs_extract_data(call, false); 1666 1675 if (ret < 0) 1667 1676 return ret; 1668 1677 1669 - /* TODO: Examine capabilities */ 1678 + afs_extract_discard(call, (count - 1) * sizeof(__be32)); 1679 + call->unmarshall++; 1680 + fallthrough; 1681 + 1682 + /* Extract remaining capabilities words */ 1683 + case 3: 1684 + ret = afs_extract_data(call, false); 1685 + if (ret < 0) 1686 + return ret; 1670 1687 1671 1688 call->unmarshall++; 1672 1689 break;
+43 -55
fs/afs/inode.c
··· 54 54 } 55 55 56 56 /* 57 - * Set the file size and block count. Estimate the number of 512 bytes blocks 58 - * used, rounded up to nearest 1K for consistency with other AFS clients. 59 - */ 60 - static void afs_set_i_size(struct afs_vnode *vnode, u64 size) 61 - { 62 - i_size_write(&vnode->vfs_inode, size); 63 - vnode->vfs_inode.i_blocks = ((size + 1023) >> 10) << 1; 64 - } 65 - 66 - /* 67 57 * Initialise an inode from the vnode status. 68 58 */ 69 59 static int afs_inode_init_from_status(struct afs_operation *op, ··· 577 587 } 578 588 579 589 /* 580 - * Get the server reinit counter for a vnode's current server. 590 + * Check to see if we have a server currently serving this volume and that it 591 + * hasn't been reinitialised or dropped from the list. 581 592 */ 582 - static bool afs_get_s_break_rcu(struct afs_vnode *vnode, unsigned int *_s_break) 593 + static bool afs_check_server_good(struct afs_vnode *vnode) 583 594 { 584 - struct afs_server_list *slist = rcu_dereference(vnode->volume->servers); 595 + struct afs_server_list *slist; 585 596 struct afs_server *server; 597 + bool good; 586 598 int i; 587 599 600 + if (vnode->cb_fs_s_break == atomic_read(&vnode->volume->cell->fs_s_break)) 601 + return true; 602 + 603 + rcu_read_lock(); 604 + 605 + slist = rcu_dereference(vnode->volume->servers); 588 606 for (i = 0; i < slist->nr_servers; i++) { 589 607 server = slist->servers[i].server; 590 608 if (server == vnode->cb_server) { 591 - *_s_break = READ_ONCE(server->cb_s_break); 592 - return true; 609 + good = (vnode->cb_s_break == server->cb_s_break); 610 + rcu_read_unlock(); 611 + return good; 593 612 } 594 613 } 595 614 615 + rcu_read_unlock(); 596 616 return false; 597 617 } 598 618 ··· 611 611 */ 612 612 bool afs_check_validity(struct afs_vnode *vnode) 613 613 { 614 - struct afs_volume *volume = vnode->volume; 615 614 enum afs_cb_break_reason need_clear = afs_cb_break_no_break; 616 615 time64_t now = ktime_get_real_seconds(); 617 - bool valid; 618 - unsigned int cb_break, cb_s_break, cb_v_break; 616 + unsigned int cb_break; 619 617 int seq = 0; 620 618 621 619 do { 622 620 read_seqbegin_or_lock(&vnode->cb_lock, &seq); 623 - cb_v_break = READ_ONCE(volume->cb_v_break); 624 621 cb_break = vnode->cb_break; 625 622 626 - if (test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags) && 627 - afs_get_s_break_rcu(vnode, &cb_s_break)) { 628 - if (vnode->cb_s_break != cb_s_break || 629 - vnode->cb_v_break != cb_v_break) { 630 - vnode->cb_s_break = cb_s_break; 631 - vnode->cb_v_break = cb_v_break; 632 - need_clear = afs_cb_break_for_vsbreak; 633 - valid = false; 634 - } else if (test_bit(AFS_VNODE_ZAP_DATA, &vnode->flags)) { 623 + if (test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags)) { 624 + if (vnode->cb_v_break != vnode->volume->cb_v_break) 625 + need_clear = afs_cb_break_for_v_break; 626 + else if (!afs_check_server_good(vnode)) 627 + need_clear = afs_cb_break_for_s_reinit; 628 + else if (test_bit(AFS_VNODE_ZAP_DATA, &vnode->flags)) 635 629 need_clear = afs_cb_break_for_zap; 636 - valid = false; 637 - } else if (vnode->cb_expires_at - 10 <= now) { 630 + else if (vnode->cb_expires_at - 10 <= now) 638 631 need_clear = afs_cb_break_for_lapsed; 639 - valid = false; 640 - } else { 641 - valid = true; 642 - } 643 632 } else if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) { 644 - valid = true; 633 + ; 645 634 } else { 646 - vnode->cb_v_break = cb_v_break; 647 - valid = false; 635 + need_clear = afs_cb_break_no_promise; 648 636 } 649 637 650 638 } while (need_seqretry(&vnode->cb_lock, seq)); 651 639 652 640 done_seqretry(&vnode->cb_lock, seq); 653 641 654 - if (need_clear != afs_cb_break_no_break) { 655 - write_seqlock(&vnode->cb_lock); 656 - if (cb_break == vnode->cb_break) 657 - __afs_break_callback(vnode, need_clear); 658 - else 659 - trace_afs_cb_miss(&vnode->fid, need_clear); 660 - write_sequnlock(&vnode->cb_lock); 661 - valid = false; 662 - } 642 + if (need_clear == afs_cb_break_no_break) 643 + return true; 663 644 664 - return valid; 645 + write_seqlock(&vnode->cb_lock); 646 + if (need_clear == afs_cb_break_no_promise) 647 + vnode->cb_v_break = vnode->volume->cb_v_break; 648 + else if (cb_break == vnode->cb_break) 649 + __afs_break_callback(vnode, need_clear); 650 + else 651 + trace_afs_cb_miss(&vnode->fid, need_clear); 652 + write_sequnlock(&vnode->cb_lock); 653 + return false; 665 654 } 666 655 667 656 /* ··· 664 675 */ 665 676 int afs_validate(struct afs_vnode *vnode, struct key *key) 666 677 { 667 - bool valid; 668 678 int ret; 669 679 670 680 _enter("{v={%llx:%llu} fl=%lx},%x", 671 681 vnode->fid.vid, vnode->fid.vnode, vnode->flags, 672 682 key_serial(key)); 673 683 674 - rcu_read_lock(); 675 - valid = afs_check_validity(vnode); 676 - rcu_read_unlock(); 684 + if (unlikely(test_bit(AFS_VNODE_DELETED, &vnode->flags))) { 685 + if (vnode->vfs_inode.i_nlink) 686 + clear_nlink(&vnode->vfs_inode); 687 + goto valid; 688 + } 677 689 678 - if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) 679 - clear_nlink(&vnode->vfs_inode); 680 - 681 - if (valid) 690 + if (test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags) && 691 + afs_check_validity(vnode)) 682 692 goto valid; 683 693 684 694 down_write(&vnode->validate_lock);
+21
fs/afs/internal.h
··· 390 390 /* Active fileserver interaction state. */ 391 391 struct rb_root fs_servers; /* afs_server (by server UUID) */ 392 392 seqlock_t fs_lock; /* For fs_servers */ 393 + struct rw_semaphore fs_open_mmaps_lock; 394 + struct list_head fs_open_mmaps; /* List of vnodes that are mmapped */ 395 + atomic_t fs_s_break; /* Counter of CB.InitCallBackState messages */ 393 396 394 397 /* VL server list. */ 395 398 rwlock_t vl_servers_lock; /* Lock on vl_servers */ ··· 506 503 struct hlist_node addr4_link; /* Link in net->fs_addresses4 */ 507 504 struct hlist_node addr6_link; /* Link in net->fs_addresses6 */ 508 505 struct hlist_node proc_link; /* Link in net->fs_proc */ 506 + struct work_struct initcb_work; /* Work for CB.InitCallBackState* */ 509 507 struct afs_server *gc_next; /* Next server in manager's list */ 510 508 time64_t unuse_time; /* Time at which last unused */ 511 509 unsigned long flags; ··· 520 516 #define AFS_SERVER_FL_IS_YFS 16 /* Server is YFS not AFS */ 521 517 #define AFS_SERVER_FL_NO_IBULK 17 /* Fileserver doesn't support FS.InlineBulkStatus */ 522 518 #define AFS_SERVER_FL_NO_RM2 18 /* Fileserver doesn't support YFS.RemoveFile2 */ 519 + #define AFS_SERVER_FL_HAS_FS64 19 /* Fileserver supports FS.{Fetch,Store}Data64 */ 523 520 atomic_t ref; /* Object refcount */ 524 521 atomic_t active; /* Active user count */ 525 522 u32 addr_version; /* Address list version */ ··· 662 657 afs_lock_type_t lock_type : 8; 663 658 664 659 /* outstanding callback notification on this file */ 660 + struct work_struct cb_work; /* Work for mmap'd files */ 661 + struct list_head cb_mmap_link; /* Link in cell->fs_open_mmaps */ 665 662 void *cb_server; /* Server with callback/filelock */ 663 + atomic_t cb_nr_mmap; /* Number of mmaps */ 664 + unsigned int cb_fs_s_break; /* Mass server break counter (cell->fs_s_break) */ 666 665 unsigned int cb_s_break; /* Mass break counter on ->server */ 667 666 unsigned int cb_v_break; /* Mass break counter on ->volume */ 668 667 unsigned int cb_break; /* Break counter on vnode */ ··· 974 965 /* 975 966 * callback.c 976 967 */ 968 + extern void afs_invalidate_mmap_work(struct work_struct *); 969 + extern void afs_server_init_callback_work(struct work_struct *work); 977 970 extern void afs_init_callback_state(struct afs_server *); 978 971 extern void __afs_break_callback(struct afs_vnode *, enum afs_cb_break_reason); 979 972 extern void afs_break_callback(struct afs_vnode *, enum afs_cb_break_reason); ··· 1594 1583 if (!op->error) 1595 1584 dentry->d_fsdata = 1596 1585 (void *)(unsigned long)dir_vp->scb.status.data_version; 1586 + } 1587 + 1588 + /* 1589 + * Set the file size and block count. Estimate the number of 512 bytes blocks 1590 + * used, rounded up to nearest 1K for consistency with other AFS clients. 1591 + */ 1592 + static inline void afs_set_i_size(struct afs_vnode *vnode, u64 size) 1593 + { 1594 + i_size_write(&vnode->vfs_inode, size); 1595 + vnode->vfs_inode.i_blocks = ((size + 1023) >> 10) << 1; 1597 1596 } 1598 1597 1599 1598 /*
+15
fs/afs/protocol_afs.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 + /* AFS protocol bits 3 + * 4 + * Copyright (C) 2021 Red Hat, Inc. All Rights Reserved. 5 + * Written by David Howells (dhowells@redhat.com) 6 + */ 7 + 8 + 9 + #define AFSCAPABILITIESMAX 196 /* Maximum number of words in a capability set */ 10 + 11 + /* AFS3 Fileserver capabilities word 0 */ 12 + #define AFS3_VICED_CAPABILITY_ERRORTRANS 0x0001 /* Uses UAE errors */ 13 + #define AFS3_VICED_CAPABILITY_64BITFILES 0x0002 /* FetchData64 & StoreData64 supported */ 14 + #define AFS3_VICED_CAPABILITY_WRITELOCKACL 0x0004 /* Can lock a file even without lock perm */ 15 + #define AFS3_VICED_CAPABILITY_SANEACLS 0x0008 /* ACLs reviewed for sanity - don't use */
+6
fs/afs/protocol_yfs.h
··· 168 168 yfs_LockMandatoryWrite = 0x101, 169 169 yfs_LockMandatoryExtend = 0x102, 170 170 }; 171 + 172 + /* RXYFS Viced Capability Flags */ 173 + #define YFS_VICED_CAPABILITY_ERRORTRANS 0x0001 /* Deprecated v0.195 */ 174 + #define YFS_VICED_CAPABILITY_64BITFILES 0x0002 /* Deprecated v0.195 */ 175 + #define YFS_VICED_CAPABILITY_WRITELOCKACL 0x0004 /* Can lock a file even without lock perm */ 176 + #define YFS_VICED_CAPABILITY_SANEACLS 0x0008 /* Deprecated v0.195 */
+1
fs/afs/rotate.c
··· 374 374 if (vnode->cb_server != server) { 375 375 vnode->cb_server = server; 376 376 vnode->cb_s_break = server->cb_s_break; 377 + vnode->cb_fs_s_break = atomic_read(&server->cell->fs_s_break); 377 378 vnode->cb_v_break = vnode->volume->cb_v_break; 378 379 clear_bit(AFS_VNODE_CB_PROMISED, &vnode->flags); 379 380 }
+2
fs/afs/server.c
··· 235 235 server->addr_version = alist->version; 236 236 server->uuid = *uuid; 237 237 rwlock_init(&server->fs_lock); 238 + INIT_WORK(&server->initcb_work, afs_server_init_callback_work); 238 239 init_waitqueue_head(&server->probe_wq); 239 240 INIT_LIST_HEAD(&server->probe_link); 240 241 spin_lock_init(&server->probe_lock); ··· 468 467 if (test_bit(AFS_SERVER_FL_MAY_HAVE_CB, &server->flags)) 469 468 afs_give_up_callbacks(net, server); 470 469 470 + flush_work(&server->initcb_work); 471 471 afs_put_server(net, server, afs_server_trace_destroy); 472 472 } 473 473
+1
fs/afs/super.c
··· 698 698 vnode->lock_state = AFS_VNODE_LOCK_NONE; 699 699 700 700 init_rwsem(&vnode->rmdir_lock); 701 + INIT_WORK(&vnode->cb_work, afs_invalidate_mmap_work); 701 702 702 703 _leave(" = %p", &vnode->vfs_inode); 703 704 return &vnode->vfs_inode;
+24 -5
fs/afs/write.c
··· 137 137 write_seqlock(&vnode->cb_lock); 138 138 i_size = i_size_read(&vnode->vfs_inode); 139 139 if (maybe_i_size > i_size) 140 - i_size_write(&vnode->vfs_inode, maybe_i_size); 140 + afs_set_i_size(vnode, maybe_i_size); 141 141 write_sequnlock(&vnode->cb_lock); 142 142 } 143 143 ··· 471 471 } 472 472 473 473 /* Has the page moved or been split? */ 474 - if (unlikely(page != xas_reload(&xas))) 474 + if (unlikely(page != xas_reload(&xas))) { 475 + put_page(page); 475 476 break; 477 + } 476 478 477 - if (!trylock_page(page)) 479 + if (!trylock_page(page)) { 480 + put_page(page); 478 481 break; 482 + } 479 483 if (!PageDirty(page) || PageWriteback(page)) { 480 484 unlock_page(page); 485 + put_page(page); 481 486 break; 482 487 } 483 488 ··· 492 487 t = afs_page_dirty_to(page, priv); 493 488 if (f != 0 && !new_content) { 494 489 unlock_page(page); 490 + put_page(page); 495 491 break; 496 492 } 497 493 ··· 807 801 ssize_t afs_file_write(struct kiocb *iocb, struct iov_iter *from) 808 802 { 809 803 struct afs_vnode *vnode = AFS_FS_I(file_inode(iocb->ki_filp)); 804 + struct afs_file *af = iocb->ki_filp->private_data; 810 805 ssize_t result; 811 806 size_t count = iov_iter_count(from); 812 807 ··· 823 816 if (!count) 824 817 return 0; 825 818 819 + result = afs_validate(vnode, af->key); 820 + if (result < 0) 821 + return result; 822 + 826 823 result = generic_file_write_iter(iocb, from); 827 824 828 825 _leave(" = %zd", result); ··· 840 829 */ 841 830 int afs_fsync(struct file *file, loff_t start, loff_t end, int datasync) 842 831 { 843 - struct inode *inode = file_inode(file); 844 - struct afs_vnode *vnode = AFS_FS_I(inode); 832 + struct afs_vnode *vnode = AFS_FS_I(file_inode(file)); 833 + struct afs_file *af = file->private_data; 834 + int ret; 845 835 846 836 _enter("{%llx:%llu},{n=%pD},%d", 847 837 vnode->fid.vid, vnode->fid.vnode, file, 848 838 datasync); 839 + 840 + ret = afs_validate(vnode, af->key); 841 + if (ret < 0) 842 + return ret; 849 843 850 844 return file_write_and_wait_range(file, start, end); 851 845 } ··· 865 849 struct file *file = vmf->vma->vm_file; 866 850 struct inode *inode = file_inode(file); 867 851 struct afs_vnode *vnode = AFS_FS_I(inode); 852 + struct afs_file *af = file->private_data; 868 853 unsigned long priv; 869 854 vm_fault_t ret = VM_FAULT_RETRY; 870 855 871 856 _enter("{{%llx:%llu}},{%lx}", vnode->fid.vid, vnode->fid.vnode, page->index); 857 + 858 + afs_validate(vnode, af->key); 872 859 873 860 sb_start_pagefault(inode->i_sb); 874 861
+12 -1
fs/btrfs/file-item.c
··· 665 665 666 666 if (!ordered) { 667 667 ordered = btrfs_lookup_ordered_extent(inode, offset); 668 - BUG_ON(!ordered); /* Logic error */ 668 + /* 669 + * The bio range is not covered by any ordered extent, 670 + * must be a code logic error. 671 + */ 672 + if (unlikely(!ordered)) { 673 + WARN(1, KERN_WARNING 674 + "no ordered extent for root %llu ino %llu offset %llu\n", 675 + inode->root->root_key.objectid, 676 + btrfs_ino(inode), offset); 677 + kvfree(sums); 678 + return BLK_STS_IOERR; 679 + } 669 680 } 670 681 671 682 nr_sectors = BTRFS_BYTES_TO_BLKS(fs_info,
+3 -2
fs/btrfs/space-info.c
··· 414 414 { 415 415 lockdep_assert_held(&info->lock); 416 416 417 - btrfs_info(fs_info, "space_info %llu has %llu free, is %sfull", 417 + /* The free space could be negative in case of overcommit */ 418 + btrfs_info(fs_info, "space_info %llu has %lld free, is %sfull", 418 419 info->flags, 419 - info->total_bytes - btrfs_space_info_used(info, true), 420 + (s64)(info->total_bytes - btrfs_space_info_used(info, true)), 420 421 info->full ? "" : "not "); 421 422 btrfs_info(fs_info, 422 423 "space_info total=%llu, used=%llu, pinned=%llu, reserved=%llu, may_use=%llu, readonly=%llu zone_unusable=%llu",
+4 -2
fs/btrfs/verity.c
··· 451 451 */ 452 452 static int rollback_verity(struct btrfs_inode *inode) 453 453 { 454 - struct btrfs_trans_handle *trans; 454 + struct btrfs_trans_handle *trans = NULL; 455 455 struct btrfs_root *root = inode->root; 456 456 int ret; 457 457 ··· 473 473 trans = btrfs_start_transaction(root, 2); 474 474 if (IS_ERR(trans)) { 475 475 ret = PTR_ERR(trans); 476 + trans = NULL; 476 477 btrfs_handle_fs_error(root->fs_info, ret, 477 478 "failed to start transaction in verity rollback %llu", 478 479 (u64)inode->vfs_inode.i_ino); ··· 491 490 btrfs_abort_transaction(trans, ret); 492 491 goto out; 493 492 } 494 - btrfs_end_transaction(trans); 495 493 out: 494 + if (trans) 495 + btrfs_end_transaction(trans); 496 496 return ret; 497 497 } 498 498
+13
fs/btrfs/volumes.c
··· 1137 1137 atomic_set(&device->dev_stats_ccnt, 0); 1138 1138 extent_io_tree_release(&device->alloc_state); 1139 1139 1140 + /* 1141 + * Reset the flush error record. We might have a transient flush error 1142 + * in this mount, and if so we aborted the current transaction and set 1143 + * the fs to an error state, guaranteeing no super blocks can be further 1144 + * committed. However that error might be transient and if we unmount the 1145 + * filesystem and mount it again, we should allow the mount to succeed 1146 + * (btrfs_check_rw_degradable() should not fail) - if after mounting the 1147 + * filesystem again we still get flush errors, then we will again abort 1148 + * any transaction and set the error state, guaranteeing no commits of 1149 + * unsafe super blocks. 1150 + */ 1151 + device->last_flush_error = 0; 1152 + 1140 1153 /* Verify the device is back in a pristine state */ 1141 1154 ASSERT(!test_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state)); 1142 1155 ASSERT(!test_bit(BTRFS_DEV_STATE_REPLACE_TGT, &device->dev_state));
+6 -2
fs/buffer.c
··· 1425 1425 } 1426 1426 EXPORT_SYMBOL_GPL(invalidate_bh_lrus); 1427 1427 1428 - void invalidate_bh_lrus_cpu(int cpu) 1428 + /* 1429 + * It's called from workqueue context so we need a bh_lru_lock to close 1430 + * the race with preemption/irq. 1431 + */ 1432 + void invalidate_bh_lrus_cpu(void) 1429 1433 { 1430 1434 struct bh_lru *b; 1431 1435 1432 1436 bh_lru_lock(); 1433 - b = per_cpu_ptr(&bh_lrus, cpu); 1437 + b = this_cpu_ptr(&bh_lrus); 1434 1438 __invalidate_bh_lrus(b); 1435 1439 bh_lru_unlock(); 1436 1440 }
+2 -2
fs/ceph/caps.c
··· 2263 2263 list_for_each_entry(req, &ci->i_unsafe_dirops, 2264 2264 r_unsafe_dir_item) { 2265 2265 s = req->r_session; 2266 - if (unlikely(s->s_mds > max)) { 2266 + if (unlikely(s->s_mds >= max)) { 2267 2267 spin_unlock(&ci->i_unsafe_lock); 2268 2268 goto retry; 2269 2269 } ··· 2277 2277 list_for_each_entry(req, &ci->i_unsafe_iops, 2278 2278 r_unsafe_target_item) { 2279 2279 s = req->r_session; 2280 - if (unlikely(s->s_mds > max)) { 2280 + if (unlikely(s->s_mds >= max)) { 2281 2281 spin_unlock(&ci->i_unsafe_lock); 2282 2282 goto retry; 2283 2283 }
+1 -1
fs/cifs/cache.c
··· 1 1 // SPDX-License-Identifier: LGPL-2.1 2 2 /* 3 - * fs/cifs/cache.c - CIFS filesystem cache index structure definitions 3 + * CIFS filesystem cache index structure definitions 4 4 * 5 5 * Copyright (c) 2010 Novell, Inc. 6 6 * Authors(s): Suresh Jayaraman (sjayaraman@suse.de>
-1
fs/cifs/cifs_debug.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-or-later 2 2 /* 3 - * fs/cifs_debug.c 4 3 * 5 4 * Copyright (C) International Business Machines Corp., 2000,2005 6 5 *
-1
fs/cifs/cifs_fs_sb.h
··· 1 1 /* SPDX-License-Identifier: LGPL-2.1 */ 2 2 /* 3 - * fs/cifs/cifs_fs_sb.h 4 3 * 5 4 * Copyright (c) International Business Machines Corp., 2002,2004 6 5 * Author(s): Steve French (sfrench@us.ibm.com)
-1
fs/cifs/cifs_ioctl.h
··· 1 1 /* SPDX-License-Identifier: LGPL-2.1 */ 2 2 /* 3 - * fs/cifs/cifs_ioctl.h 4 3 * 5 4 * Structure definitions for io control for cifs/smb3 6 5 *
+1 -1
fs/cifs/cifs_spnego.c
··· 1 1 // SPDX-License-Identifier: LGPL-2.1 2 2 /* 3 - * fs/cifs/cifs_spnego.c -- SPNEGO upcall management for CIFS 3 + * SPNEGO upcall management for CIFS 4 4 * 5 5 * Copyright (c) 2007 Red Hat, Inc. 6 6 * Author(s): Jeff Layton (jlayton@redhat.com)
+1 -1
fs/cifs/cifs_spnego.h
··· 1 1 /* SPDX-License-Identifier: LGPL-2.1 */ 2 2 /* 3 - * fs/cifs/cifs_spnego.h -- SPNEGO upcall management for CIFS 3 + * SPNEGO upcall management for CIFS 4 4 * 5 5 * Copyright (c) 2007 Red Hat, Inc. 6 6 * Author(s): Jeff Layton (jlayton@redhat.com)
-1
fs/cifs/cifs_unicode.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-or-later 2 2 /* 3 - * fs/cifs/cifs_unicode.c 4 3 * 5 4 * Copyright (c) International Business Machines Corp., 2000,2009 6 5 * Modified by Steve French (sfrench@us.ibm.com)
-1
fs/cifs/cifsacl.c
··· 1 1 // SPDX-License-Identifier: LGPL-2.1 2 2 /* 3 - * fs/cifs/cifsacl.c 4 3 * 5 4 * Copyright (C) International Business Machines Corp., 2007,2008 6 5 * Author(s): Steve French (sfrench@us.ibm.com)
-1
fs/cifs/cifsacl.h
··· 1 1 /* SPDX-License-Identifier: LGPL-2.1 */ 2 2 /* 3 - * fs/cifs/cifsacl.h 4 3 * 5 4 * Copyright (c) International Business Machines Corp., 2007 6 5 * Author(s): Steve French (sfrench@us.ibm.com)
-1
fs/cifs/cifsencrypt.c
··· 1 1 // SPDX-License-Identifier: LGPL-2.1 2 2 /* 3 - * fs/cifs/cifsencrypt.c 4 3 * 5 4 * Encryption and hashing operations relating to NTLM, NTLMv2. See MS-NLMP 6 5 * for more detailed information
-1
fs/cifs/cifsfs.c
··· 1 1 // SPDX-License-Identifier: LGPL-2.1 2 2 /* 3 - * fs/cifs/cifsfs.c 4 3 * 5 4 * Copyright (C) International Business Machines Corp., 2002,2008 6 5 * Author(s): Steve French (sfrench@us.ibm.com)
-1
fs/cifs/cifsfs.h
··· 1 1 /* SPDX-License-Identifier: LGPL-2.1 */ 2 2 /* 3 - * fs/cifs/cifsfs.h 4 3 * 5 4 * Copyright (c) International Business Machines Corp., 2002, 2007 6 5 * Author(s): Steve French (sfrench@us.ibm.com)
+1 -1
fs/cifs/cifsglob.h
··· 1 1 /* SPDX-License-Identifier: LGPL-2.1 */ 2 2 /* 3 - * fs/cifs/cifsglob.h 4 3 * 5 4 * Copyright (C) International Business Machines Corp., 2002,2008 6 5 * Author(s): Steve French (sfrench@us.ibm.com) ··· 1399 1400 #define CIFS_INO_INVALID_MAPPING (4) /* pagecache is invalid */ 1400 1401 #define CIFS_INO_LOCK (5) /* lock bit for synchronization */ 1401 1402 #define CIFS_INO_MODIFIED_ATTR (6) /* Indicate change in mtime/ctime */ 1403 + #define CIFS_INO_CLOSE_ON_LOCK (7) /* Not to defer the close when lock is set */ 1402 1404 unsigned long flags; 1403 1405 spinlock_t writers_lock; 1404 1406 unsigned int writers; /* Number of writers on this inode */
-1
fs/cifs/cifspdu.h
··· 1 1 /* SPDX-License-Identifier: LGPL-2.1 */ 2 2 /* 3 - * fs/cifs/cifspdu.h 4 3 * 5 4 * Copyright (c) International Business Machines Corp., 2002,2009 6 5 * Author(s): Steve French (sfrench@us.ibm.com)
+3 -1
fs/cifs/cifsproto.h
··· 1 1 /* SPDX-License-Identifier: LGPL-2.1 */ 2 2 /* 3 - * fs/cifs/cifsproto.h 4 3 * 5 4 * Copyright (c) International Business Machines Corp., 2002,2008 6 5 * Author(s): Steve French (sfrench@us.ibm.com) ··· 266 267 extern void cifs_close_deferred_file(struct cifsInodeInfo *cifs_inode); 267 268 268 269 extern void cifs_close_all_deferred_files(struct cifs_tcon *cifs_tcon); 270 + 271 + extern void cifs_close_deferred_file_under_dentry(struct cifs_tcon *cifs_tcon, 272 + const char *path); 269 273 270 274 extern struct TCP_Server_Info *cifs_get_tcp_session(struct smb3_fs_context *ctx); 271 275 extern void cifs_put_tcp_session(struct TCP_Server_Info *server,
-1
fs/cifs/cifssmb.c
··· 1 1 // SPDX-License-Identifier: LGPL-2.1 2 2 /* 3 - * fs/cifs/cifssmb.c 4 3 * 5 4 * Copyright (C) International Business Machines Corp., 2002,2010 6 5 * Author(s): Steve French (sfrench@us.ibm.com)
+13 -5
fs/cifs/connect.c
··· 1 1 // SPDX-License-Identifier: LGPL-2.1 2 2 /* 3 - * fs/cifs/connect.c 4 3 * 5 4 * Copyright (C) International Business Machines Corp., 2002,2011 6 5 * Author(s): Steve French (sfrench@us.ibm.com) ··· 1089 1090 module_put_and_exit(0); 1090 1091 } 1091 1092 1092 - /** 1093 + /* 1093 1094 * Returns true if srcaddr isn't specified and rhs isn't specified, or 1094 1095 * if srcaddr is specified and matches the IP address of the rhs argument 1095 1096 */ ··· 1549 1550 1550 1551 /** 1551 1552 * cifs_setup_ipc - helper to setup the IPC tcon for the session 1553 + * @ses: smb session to issue the request on 1554 + * @ctx: the superblock configuration context to use for building the 1555 + * new tree connection for the IPC (interprocess communication RPC) 1552 1556 * 1553 1557 * A new IPC connection is made and stored in the session 1554 1558 * tcon_ipc. The IPC tcon has the same lifetime as the session. ··· 1607 1605 1608 1606 /** 1609 1607 * cifs_free_ipc - helper to release the session IPC tcon 1608 + * @ses: smb session to unmount the IPC from 1610 1609 * 1611 1610 * Needs to be called everytime a session is destroyed. 1612 1611 * ··· 1858 1855 1859 1856 /** 1860 1857 * cifs_get_smb_ses - get a session matching @ctx data from @server 1858 + * @server: server to setup the session to 1859 + * @ctx: superblock configuration context to use to setup the session 1861 1860 * 1862 1861 * This function assumes it is being called from cifs_mount() where we 1863 1862 * already got a server reference (server refcount +1). See ··· 2070 2065 2071 2066 /** 2072 2067 * cifs_get_tcon - get a tcon matching @ctx data from @ses 2068 + * @ses: smb session to issue the request on 2069 + * @ctx: the superblock configuration context to use for building the 2073 2070 * 2074 2071 * - tcon refcount is the number of mount points using the tcon. 2075 2072 * - ses refcount is the number of tcon using the session. ··· 2389 2382 spin_lock(&cifs_tcp_ses_lock); 2390 2383 cifs_sb = CIFS_SB(sb); 2391 2384 tlink = cifs_get_tlink(cifs_sb_master_tlink(cifs_sb)); 2392 - if (IS_ERR(tlink)) { 2385 + if (tlink == NULL) { 2386 + /* can not match superblock if tlink were ever null */ 2393 2387 spin_unlock(&cifs_tcp_ses_lock); 2394 - return rc; 2388 + return 0; 2395 2389 } 2396 2390 tcon = tlink_tcon(tlink); 2397 2391 ses = tcon->ses; ··· 3038 3030 return full_path; 3039 3031 } 3040 3032 3041 - /** 3033 + /* 3042 3034 * expand_dfs_referral - Perform a dfs referral query and update the cifs_sb 3043 3035 * 3044 3036 * If a referral is found, cifs_sb->ctx->mount_options will be (re-)allocated
-1
fs/cifs/dir.c
··· 1 1 // SPDX-License-Identifier: LGPL-2.1 2 2 /* 3 - * fs/cifs/dir.c 4 3 * 5 4 * vfs operations that deal with dentries 6 5 *
-1
fs/cifs/dns_resolve.c
··· 1 1 // SPDX-License-Identifier: LGPL-2.1 2 2 /* 3 - * fs/cifs/dns_resolve.c 4 3 * 5 4 * Copyright (c) 2007 Igor Mammedov 6 5 * Author(s): Igor Mammedov (niallain@gmail.com)
+2 -2
fs/cifs/dns_resolve.h
··· 1 1 /* SPDX-License-Identifier: LGPL-2.1 */ 2 2 /* 3 - * fs/cifs/dns_resolve.h -- DNS Resolver upcall management for CIFS DFS 4 - * Handles host name to IP address resolution 3 + * DNS Resolver upcall management for CIFS DFS 4 + * Handles host name to IP address resolution 5 5 * 6 6 * Copyright (c) International Business Machines Corp., 2008 7 7 * Author(s): Steve French (sfrench@us.ibm.com)
-1
fs/cifs/export.c
··· 1 1 // SPDX-License-Identifier: LGPL-2.1 2 2 /* 3 - * fs/cifs/export.c 4 3 * 5 4 * Copyright (C) International Business Machines Corp., 2007 6 5 * Author(s): Steve French (sfrench@us.ibm.com)
+4 -3
fs/cifs/file.c
··· 1 1 // SPDX-License-Identifier: LGPL-2.1 2 2 /* 3 - * fs/cifs/file.c 4 3 * 5 4 * vfs operations that deal with files 6 5 * ··· 882 883 dclose = kmalloc(sizeof(struct cifs_deferred_close), GFP_KERNEL); 883 884 if ((cinode->oplock == CIFS_CACHE_RHW_FLG) && 884 885 cinode->lease_granted && 886 + !test_bit(CIFS_INO_CLOSE_ON_LOCK, &cinode->flags) && 885 887 dclose) { 886 - if (test_bit(CIFS_INO_MODIFIED_ATTR, &cinode->flags)) { 888 + if (test_and_clear_bit(CIFS_INO_MODIFIED_ATTR, &cinode->flags)) { 887 889 inode->i_ctime = inode->i_mtime = current_time(inode); 888 890 cifs_fscache_update_inode_cookie(inode); 889 891 } ··· 1865 1865 cifs_read_flock(flock, &type, &lock, &unlock, &wait_flag, 1866 1866 tcon->ses->server); 1867 1867 cifs_sb = CIFS_FILE_SB(file); 1868 + set_bit(CIFS_INO_CLOSE_ON_LOCK, &CIFS_I(d_inode(cfile->dentry))->flags); 1868 1869 1869 1870 if (cap_unix(tcon->ses) && 1870 1871 (CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability)) && ··· 3113 3112 struct cifs_tcon *tcon; 3114 3113 struct cifs_sb_info *cifs_sb; 3115 3114 struct dentry *dentry = ctx->cfile->dentry; 3116 - int rc; 3115 + ssize_t rc; 3117 3116 3118 3117 tcon = tlink_tcon(ctx->cfile->tlink); 3119 3118 cifs_sb = CIFS_SB(dentry->d_sb);
+1 -1
fs/cifs/fscache.c
··· 1 1 // SPDX-License-Identifier: LGPL-2.1 2 2 /* 3 - * fs/cifs/fscache.c - CIFS filesystem cache interface 3 + * CIFS filesystem cache interface 4 4 * 5 5 * Copyright (c) 2010 Novell, Inc. 6 6 * Author(s): Suresh Jayaraman <sjayaraman@suse.de>
+1 -1
fs/cifs/fscache.h
··· 1 1 /* SPDX-License-Identifier: LGPL-2.1 */ 2 2 /* 3 - * fs/cifs/fscache.h - CIFS filesystem cache interface definitions 3 + * CIFS filesystem cache interface definitions 4 4 * 5 5 * Copyright (c) 2010 Novell, Inc. 6 6 * Authors(s): Suresh Jayaraman (sjayaraman@suse.de>
+3 -4
fs/cifs/inode.c
··· 1 1 // SPDX-License-Identifier: LGPL-2.1 2 2 /* 3 - * fs/cifs/inode.c 4 3 * 5 4 * Copyright (C) International Business Machines Corp., 2002,2010 6 5 * Author(s): Steve French (sfrench@us.ibm.com) ··· 1624 1625 goto unlink_out; 1625 1626 } 1626 1627 1627 - cifs_close_deferred_file(CIFS_I(inode)); 1628 + cifs_close_deferred_file_under_dentry(tcon, full_path); 1628 1629 if (cap_unix(tcon->ses) && (CIFS_UNIX_POSIX_PATH_OPS_CAP & 1629 1630 le64_to_cpu(tcon->fsUnixInfo.Capability))) { 1630 1631 rc = CIFSPOSIXDelFile(xid, tcon, full_path, ··· 2113 2114 goto cifs_rename_exit; 2114 2115 } 2115 2116 2116 - cifs_close_deferred_file(CIFS_I(d_inode(source_dentry))); 2117 + cifs_close_deferred_file_under_dentry(tcon, from_name); 2117 2118 if (d_inode(target_dentry) != NULL) 2118 - cifs_close_deferred_file(CIFS_I(d_inode(target_dentry))); 2119 + cifs_close_deferred_file_under_dentry(tcon, to_name); 2119 2120 2120 2121 rc = cifs_do_rename(xid, source_dentry, from_name, target_dentry, 2121 2122 to_name);
+1 -2
fs/cifs/ioctl.c
··· 1 1 // SPDX-License-Identifier: LGPL-2.1 2 2 /* 3 - * fs/cifs/ioctl.c 4 3 * 5 4 * vfs operations that deal with io control 6 5 * ··· 358 359 if (pSMBFile == NULL) 359 360 break; 360 361 tcon = tlink_tcon(pSMBFile->tlink); 361 - caps = le64_to_cpu(tcon->fsUnixInfo.Capability); 362 + /* caps = le64_to_cpu(tcon->fsUnixInfo.Capability); */ 362 363 363 364 if (get_user(ExtAttrBits, (int __user *)arg)) { 364 365 rc = -EFAULT;
-1
fs/cifs/link.c
··· 1 1 // SPDX-License-Identifier: LGPL-2.1 2 2 /* 3 - * fs/cifs/link.c 4 3 * 5 4 * Copyright (C) International Business Machines Corp., 2002,2008 6 5 * Author(s): Steve French (sfrench@us.ibm.com)
+53 -6
fs/cifs/misc.c
··· 1 1 // SPDX-License-Identifier: LGPL-2.1 2 2 /* 3 - * fs/cifs/misc.c 4 3 * 5 4 * Copyright (C) International Business Machines Corp., 2002,2008 6 5 * Author(s): Steve French (sfrench@us.ibm.com) ··· 264 265 265 266 /* Uid is not converted */ 266 267 buffer->Uid = treeCon->ses->Suid; 267 - buffer->Mid = get_next_mid(treeCon->ses->server); 268 + if (treeCon->ses->server) 269 + buffer->Mid = get_next_mid(treeCon->ses->server); 268 270 } 269 271 if (treeCon->Flags & SMB_SHARE_IS_IN_DFS) 270 272 buffer->Flags2 |= SMBFLG2_DFS; ··· 591 591 592 592 /** 593 593 * cifs_queue_oplock_break - queue the oplock break handler for cfile 594 + * @cfile: The file to break the oplock on 594 595 * 595 596 * This function is called from the demultiplex thread when it 596 597 * receives an oplock break for @cfile. ··· 737 736 if (cancel_delayed_work(&cfile->deferred)) { 738 737 tmp_list = kmalloc(sizeof(struct file_list), GFP_ATOMIC); 739 738 if (tmp_list == NULL) 740 - continue; 739 + break; 741 740 tmp_list->cfile = cfile; 742 741 list_add_tail(&tmp_list->list, &file_head); 743 742 } ··· 768 767 if (cancel_delayed_work(&cfile->deferred)) { 769 768 tmp_list = kmalloc(sizeof(struct file_list), GFP_ATOMIC); 770 769 if (tmp_list == NULL) 771 - continue; 770 + break; 772 771 tmp_list->cfile = cfile; 773 772 list_add_tail(&tmp_list->list, &file_head); 774 773 } ··· 781 780 list_del(&tmp_list->list); 782 781 kfree(tmp_list); 783 782 } 783 + } 784 + void 785 + cifs_close_deferred_file_under_dentry(struct cifs_tcon *tcon, const char *path) 786 + { 787 + struct cifsFileInfo *cfile; 788 + struct list_head *tmp; 789 + struct file_list *tmp_list, *tmp_next_list; 790 + struct list_head file_head; 791 + void *page; 792 + const char *full_path; 793 + 794 + INIT_LIST_HEAD(&file_head); 795 + page = alloc_dentry_path(); 796 + spin_lock(&tcon->open_file_lock); 797 + list_for_each(tmp, &tcon->openFileList) { 798 + cfile = list_entry(tmp, struct cifsFileInfo, tlist); 799 + full_path = build_path_from_dentry(cfile->dentry, page); 800 + if (strstr(full_path, path)) { 801 + if (delayed_work_pending(&cfile->deferred)) { 802 + if (cancel_delayed_work(&cfile->deferred)) { 803 + tmp_list = kmalloc(sizeof(struct file_list), GFP_ATOMIC); 804 + if (tmp_list == NULL) 805 + break; 806 + tmp_list->cfile = cfile; 807 + list_add_tail(&tmp_list->list, &file_head); 808 + } 809 + } 810 + } 811 + } 812 + spin_unlock(&tcon->open_file_lock); 813 + 814 + list_for_each_entry_safe(tmp_list, tmp_next_list, &file_head, list) { 815 + _cifsFileInfo_put(tmp_list->cfile, true, false); 816 + list_del(&tmp_list->list); 817 + kfree(tmp_list); 818 + } 819 + free_dentry_path(page); 784 820 } 785 821 786 822 /* parses DFS refferal V3 structure ··· 1067 1029 1068 1030 /** 1069 1031 * cifs_alloc_hash - allocate hash and hash context together 1032 + * @name: The name of the crypto hash algo 1033 + * @shash: Where to put the pointer to the hash algo 1034 + * @sdesc: Where to put the pointer to the hash descriptor 1070 1035 * 1071 1036 * The caller has to make sure @sdesc is initialized to either NULL or 1072 1037 * a valid context. Both can be freed via cifs_free_hash(). ··· 1108 1067 1109 1068 /** 1110 1069 * cifs_free_hash - free hash and hash context together 1070 + * @shash: Where to find the pointer to the hash algo 1071 + * @sdesc: Where to find the pointer to the hash descriptor 1111 1072 * 1112 1073 * Freeing a NULL hash or context is safe. 1113 1074 */ ··· 1125 1082 1126 1083 /** 1127 1084 * rqst_page_get_length - obtain the length and offset for a page in smb_rqst 1128 - * Input: rqst - a smb_rqst, page - a page index for rqst 1129 - * Output: *len - the length for this page, *offset - the offset for this page 1085 + * @rqst: The request descriptor 1086 + * @page: The index of the page to query 1087 + * @len: Where to store the length for this page: 1088 + * @offset: Where to store the offset for this page 1130 1089 */ 1131 1090 void rqst_page_get_length(struct smb_rqst *rqst, unsigned int page, 1132 1091 unsigned int *len, unsigned int *offset) ··· 1161 1116 1162 1117 /** 1163 1118 * copy_path_name - copy src path to dst, possibly truncating 1119 + * @dst: The destination buffer 1120 + * @src: The source name 1164 1121 * 1165 1122 * returns number of bytes written (including trailing nul) 1166 1123 */
-1
fs/cifs/netmisc.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-or-later 2 2 /* 3 - * fs/cifs/netmisc.c 4 3 * 5 4 * Copyright (c) International Business Machines Corp., 2002,2008 6 5 * Author(s): Steve French (sfrench@us.ibm.com)
-1
fs/cifs/ntlmssp.h
··· 1 1 /* SPDX-License-Identifier: LGPL-2.1 */ 2 2 /* 3 - * fs/cifs/ntlmssp.h 4 3 * 5 4 * Copyright (c) International Business Machines Corp., 2002,2007 6 5 * Author(s): Steve French (sfrench@us.ibm.com)
-1
fs/cifs/readdir.c
··· 1 1 // SPDX-License-Identifier: LGPL-2.1 2 2 /* 3 - * fs/cifs/readdir.c 4 3 * 5 4 * Directory search handling 6 5 *
-1
fs/cifs/rfc1002pdu.h
··· 1 1 /* SPDX-License-Identifier: LGPL-2.1 */ 2 2 /* 3 - * fs/cifs/rfc1002pdu.h 4 3 * 5 4 * Protocol Data Unit definitions for RFC 1001/1002 support 6 5 *
-1
fs/cifs/sess.c
··· 1 1 // SPDX-License-Identifier: LGPL-2.1 2 2 /* 3 - * fs/cifs/sess.c 4 3 * 5 4 * SMB/CIFS session setup handling routines 6 5 *
-1
fs/cifs/smb2file.c
··· 1 1 // SPDX-License-Identifier: LGPL-2.1 2 2 /* 3 - * fs/cifs/smb2file.c 4 3 * 5 4 * Copyright (C) International Business Machines Corp., 2002, 2011 6 5 * Author(s): Steve French (sfrench@us.ibm.com),
-1
fs/cifs/smb2glob.h
··· 1 1 /* SPDX-License-Identifier: LGPL-2.1 */ 2 2 /* 3 - * fs/cifs/smb2glob.h 4 3 * 5 4 * Definitions for various global variables and structures 6 5 *
-1
fs/cifs/smb2inode.c
··· 1 1 // SPDX-License-Identifier: LGPL-2.1 2 2 /* 3 - * fs/cifs/smb2inode.c 4 3 * 5 4 * Copyright (C) International Business Machines Corp., 2002, 2011 6 5 * Etersoft, 2012
-1
fs/cifs/smb2misc.c
··· 1 1 // SPDX-License-Identifier: LGPL-2.1 2 2 /* 3 - * fs/cifs/smb2misc.c 4 3 * 5 4 * Copyright (C) International Business Machines Corp., 2002,2011 6 5 * Etersoft, 2012
+2 -3
fs/cifs/smb2pdu.c
··· 1 1 // SPDX-License-Identifier: LGPL-2.1 2 2 /* 3 - * fs/cifs/smb2pdu.c 4 3 * 5 4 * Copyright (C) International Business Machines Corp., 2009, 2013 6 5 * Etersoft, 2012 ··· 2397 2398 buf->sd.OffsetDacl = cpu_to_le32(ptr - (__u8 *)&buf->sd); 2398 2399 /* Ship the ACL for now. we will copy it into buf later. */ 2399 2400 aclptr = ptr; 2400 - ptr += sizeof(struct cifs_acl); 2401 + ptr += sizeof(struct smb3_acl); 2401 2402 2402 2403 /* create one ACE to hold the mode embedded in reserved special SID */ 2403 2404 acelen = setup_special_mode_ACE((struct cifs_ace *)ptr, (__u64)mode); ··· 2422 2423 acl.AclRevision = ACL_REVISION; /* See 2.4.4.1 of MS-DTYP */ 2423 2424 acl.AclSize = cpu_to_le16(acl_size); 2424 2425 acl.AceCount = cpu_to_le16(ace_count); 2425 - memcpy(aclptr, &acl, sizeof(struct cifs_acl)); 2426 + memcpy(aclptr, &acl, sizeof(struct smb3_acl)); 2426 2427 2427 2428 buf->ccontext.DataLength = cpu_to_le32(ptr - (__u8 *)&buf->sd); 2428 2429 *len = roundup(ptr - (__u8 *)buf, 8);
-1
fs/cifs/smb2pdu.h
··· 1 1 /* SPDX-License-Identifier: LGPL-2.1 */ 2 2 /* 3 - * fs/cifs/smb2pdu.h 4 3 * 5 4 * Copyright (c) International Business Machines Corp., 2009, 2013 6 5 * Etersoft, 2012
-1
fs/cifs/smb2proto.h
··· 1 1 /* SPDX-License-Identifier: LGPL-2.1 */ 2 2 /* 3 - * fs/cifs/smb2proto.h 4 3 * 5 4 * Copyright (c) International Business Machines Corp., 2002, 2011 6 5 * Etersoft, 2012
-1
fs/cifs/smb2status.h
··· 1 1 /* SPDX-License-Identifier: LGPL-2.1 */ 2 2 /* 3 - * fs/cifs/smb2status.h 4 3 * 5 4 * SMB2 Status code (network error) definitions 6 5 * Definitions are from MS-ERREF
-1
fs/cifs/smb2transport.c
··· 1 1 // SPDX-License-Identifier: LGPL-2.1 2 2 /* 3 - * fs/cifs/smb2transport.c 4 3 * 5 4 * Copyright (C) International Business Machines Corp., 2002, 2011 6 5 * Etersoft, 2012
-1
fs/cifs/smberr.h
··· 1 1 /* SPDX-License-Identifier: LGPL-2.1 */ 2 2 /* 3 - * fs/cifs/smberr.h 4 3 * 5 4 * Copyright (c) International Business Machines Corp., 2002,2004 6 5 * Author(s): Steve French (sfrench@us.ibm.com)
-1
fs/cifs/transport.c
··· 1 1 // SPDX-License-Identifier: LGPL-2.1 2 2 /* 3 - * fs/cifs/transport.c 4 3 * 5 4 * Copyright (C) International Business Machines Corp., 2002,2008 6 5 * Author(s): Steve French (sfrench@us.ibm.com)
-1
fs/cifs/winucase.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-or-later 2 2 /* 3 - * fs/cifs/winucase.c 4 3 * 5 4 * Copyright (c) Jeffrey Layton <jlayton@redhat.com>, 2013 6 5 *
-1
fs/cifs/xattr.c
··· 1 1 // SPDX-License-Identifier: LGPL-2.1 2 2 /* 3 - * fs/cifs/xattr.c 4 3 * 5 4 * Copyright (c) International Business Machines Corp., 2003, 2007 6 5 * Author(s): Steve French (sfrench@us.ibm.com)
+1 -1
fs/erofs/inode.c
··· 176 176 } 177 177 178 178 if (vi->datalayout == EROFS_INODE_CHUNK_BASED) { 179 - if (!(vi->chunkformat & EROFS_CHUNK_FORMAT_ALL)) { 179 + if (vi->chunkformat & ~EROFS_CHUNK_FORMAT_ALL) { 180 180 erofs_err(inode->i_sb, 181 181 "unsupported chunk format %x of nid %llu", 182 182 vi->chunkformat, vi->nid);
+2 -1
fs/erofs/zmap.c
··· 369 369 if (compacted_4b_initial == 32 / 4) 370 370 compacted_4b_initial = 0; 371 371 372 - if (vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) 372 + if ((vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) && 373 + compacted_4b_initial < totalidx) 373 374 compacted_2b = rounddown(totalidx - compacted_4b_initial, 16); 374 375 else 375 376 compacted_2b = 0;
+6 -8
fs/ext2/balloc.c
··· 48 48 struct ext2_sb_info *sbi = EXT2_SB(sb); 49 49 50 50 if (block_group >= sbi->s_groups_count) { 51 - ext2_error (sb, "ext2_get_group_desc", 52 - "block_group >= groups_count - " 53 - "block_group = %d, groups_count = %lu", 54 - block_group, sbi->s_groups_count); 51 + WARN(1, "block_group >= groups_count - " 52 + "block_group = %d, groups_count = %lu", 53 + block_group, sbi->s_groups_count); 55 54 56 55 return NULL; 57 56 } ··· 58 59 group_desc = block_group >> EXT2_DESC_PER_BLOCK_BITS(sb); 59 60 offset = block_group & (EXT2_DESC_PER_BLOCK(sb) - 1); 60 61 if (!sbi->s_group_desc[group_desc]) { 61 - ext2_error (sb, "ext2_get_group_desc", 62 - "Group descriptor not loaded - " 63 - "block_group = %d, group_desc = %lu, desc = %lu", 64 - block_group, group_desc, offset); 62 + WARN(1, "Group descriptor not loaded - " 63 + "block_group = %d, group_desc = %lu, desc = %lu", 64 + block_group, group_desc, offset); 65 65 return NULL; 66 66 } 67 67
+4 -2
fs/inode.c
··· 190 190 mapping_set_gfp_mask(mapping, GFP_HIGHUSER_MOVABLE); 191 191 mapping->private_data = NULL; 192 192 mapping->writeback_index = 0; 193 - __init_rwsem(&mapping->invalidate_lock, "mapping.invalidate_lock", 194 - &sb->s_type->invalidate_lock_key); 193 + init_rwsem(&mapping->invalidate_lock); 194 + lockdep_set_class_and_name(&mapping->invalidate_lock, 195 + &sb->s_type->invalidate_lock_key, 196 + "mapping.invalidate_lock"); 195 197 inode->i_private = NULL; 196 198 inode->i_mapping = mapping; 197 199 INIT_HLIST_HEAD(&inode->i_dentry); /* buggered by rcu freeing */
+2 -1
fs/io-wq.c
··· 584 584 585 585 if (!get_signal(&ksig)) 586 586 continue; 587 - if (fatal_signal_pending(current)) 587 + if (fatal_signal_pending(current) || 588 + signal_group_exit(current->signal)) 588 589 break; 589 590 continue; 590 591 }
+70 -15
fs/io_uring.c
··· 502 502 struct io_close { 503 503 struct file *file; 504 504 int fd; 505 + u32 file_slot; 505 506 }; 506 507 507 508 struct io_timeout_data { ··· 1099 1098 1100 1099 static int io_install_fixed_file(struct io_kiocb *req, struct file *file, 1101 1100 unsigned int issue_flags, u32 slot_index); 1101 + static int io_close_fixed(struct io_kiocb *req, unsigned int issue_flags); 1102 + 1102 1103 static enum hrtimer_restart io_link_timeout_fn(struct hrtimer *timer); 1103 1104 1104 1105 static struct kmem_cache *req_cachep; ··· 3608 3605 iov_iter_save_state(iter, state); 3609 3606 } 3610 3607 req->result = iov_iter_count(iter); 3611 - ret2 = 0; 3612 3608 3613 3609 /* Ensure we clear previously set non-block flag */ 3614 3610 if (!force_nonblock) ··· 3672 3670 } else { 3673 3671 copy_iov: 3674 3672 iov_iter_restore(iter, state); 3675 - if (ret2 > 0) 3676 - iov_iter_advance(iter, ret2); 3677 3673 ret = io_setup_async_rw(req, iovec, inline_vecs, iter, false); 3678 3674 return ret ?: -EAGAIN; 3679 3675 } ··· 4387 4387 int i, bid = pbuf->bid; 4388 4388 4389 4389 for (i = 0; i < pbuf->nbufs; i++) { 4390 - buf = kmalloc(sizeof(*buf), GFP_KERNEL); 4390 + buf = kmalloc(sizeof(*buf), GFP_KERNEL_ACCOUNT); 4391 4391 if (!buf) 4392 4392 break; 4393 4393 ··· 4594 4594 if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL)) 4595 4595 return -EINVAL; 4596 4596 if (sqe->ioprio || sqe->off || sqe->addr || sqe->len || 4597 - sqe->rw_flags || sqe->buf_index || sqe->splice_fd_in) 4597 + sqe->rw_flags || sqe->buf_index) 4598 4598 return -EINVAL; 4599 4599 if (req->flags & REQ_F_FIXED_FILE) 4600 4600 return -EBADF; 4601 4601 4602 4602 req->close.fd = READ_ONCE(sqe->fd); 4603 + req->close.file_slot = READ_ONCE(sqe->file_index); 4604 + if (req->close.file_slot && req->close.fd) 4605 + return -EINVAL; 4606 + 4603 4607 return 0; 4604 4608 } 4605 4609 ··· 4614 4610 struct fdtable *fdt; 4615 4611 struct file *file = NULL; 4616 4612 int ret = -EBADF; 4613 + 4614 + if (req->close.file_slot) { 4615 + ret = io_close_fixed(req, issue_flags); 4616 + goto err; 4617 + } 4617 4618 4618 4619 spin_lock(&files->file_lock); 4619 4620 fdt = files_fdtable(files); ··· 5347 5338 if (req->poll.events & EPOLLONESHOT) 5348 5339 flags = 0; 5349 5340 if (!io_cqring_fill_event(ctx, req->user_data, error, flags)) { 5350 - req->poll.done = true; 5341 + req->poll.events |= EPOLLONESHOT; 5351 5342 flags = 0; 5352 5343 } 5353 5344 if (flags & IORING_CQE_F_MORE) ··· 5376 5367 } else { 5377 5368 bool done; 5378 5369 5370 + if (req->poll.done) { 5371 + spin_unlock(&ctx->completion_lock); 5372 + return; 5373 + } 5379 5374 done = __io_poll_complete(req, req->result); 5380 5375 if (done) { 5381 5376 io_poll_remove_double(req); 5382 5377 hash_del(&req->hash_node); 5378 + req->poll.done = true; 5383 5379 } else { 5384 5380 req->result = 0; 5385 5381 add_wait_queue(req->poll.head, &req->poll.wait); ··· 5522 5508 5523 5509 hash_del(&req->hash_node); 5524 5510 io_poll_remove_double(req); 5511 + apoll->poll.done = true; 5525 5512 spin_unlock(&ctx->completion_lock); 5526 5513 5527 5514 if (!READ_ONCE(apoll->poll.canceled)) ··· 5843 5828 struct io_ring_ctx *ctx = req->ctx; 5844 5829 struct io_poll_table ipt; 5845 5830 __poll_t mask; 5831 + bool done; 5846 5832 5847 5833 ipt.pt._qproc = io_poll_queue_proc; 5848 5834 ··· 5852 5836 5853 5837 if (mask) { /* no async, we'd stolen it */ 5854 5838 ipt.error = 0; 5855 - io_poll_complete(req, mask); 5839 + done = io_poll_complete(req, mask); 5856 5840 } 5857 5841 spin_unlock(&ctx->completion_lock); 5858 5842 5859 5843 if (mask) { 5860 5844 io_cqring_ev_posted(ctx); 5861 - if (poll->events & EPOLLONESHOT) 5845 + if (done) 5862 5846 io_put_req(req); 5863 5847 } 5864 5848 return ipt.error; ··· 6349 6333 struct io_uring_rsrc_update2 up; 6350 6334 int ret; 6351 6335 6352 - if (issue_flags & IO_URING_F_NONBLOCK) 6353 - return -EAGAIN; 6354 - 6355 6336 up.offset = req->rsrc_update.offset; 6356 6337 up.data = req->rsrc_update.arg; 6357 6338 up.nr = 0; 6358 6339 up.tags = 0; 6359 6340 up.resv = 0; 6360 6341 6361 - mutex_lock(&ctx->uring_lock); 6342 + io_ring_submit_lock(ctx, !(issue_flags & IO_URING_F_NONBLOCK)); 6362 6343 ret = __io_register_rsrc_update(ctx, IORING_RSRC_FILE, 6363 6344 &up, req->rsrc_update.nr_args); 6364 - mutex_unlock(&ctx->uring_lock); 6345 + io_ring_submit_unlock(ctx, !(issue_flags & IO_URING_F_NONBLOCK)); 6365 6346 6366 6347 if (ret < 0) 6367 6348 req_set_fail(req); ··· 8413 8400 return ret; 8414 8401 } 8415 8402 8403 + static int io_close_fixed(struct io_kiocb *req, unsigned int issue_flags) 8404 + { 8405 + unsigned int offset = req->close.file_slot - 1; 8406 + struct io_ring_ctx *ctx = req->ctx; 8407 + struct io_fixed_file *file_slot; 8408 + struct file *file; 8409 + int ret, i; 8410 + 8411 + io_ring_submit_lock(ctx, !(issue_flags & IO_URING_F_NONBLOCK)); 8412 + ret = -ENXIO; 8413 + if (unlikely(!ctx->file_data)) 8414 + goto out; 8415 + ret = -EINVAL; 8416 + if (offset >= ctx->nr_user_files) 8417 + goto out; 8418 + ret = io_rsrc_node_switch_start(ctx); 8419 + if (ret) 8420 + goto out; 8421 + 8422 + i = array_index_nospec(offset, ctx->nr_user_files); 8423 + file_slot = io_fixed_file_slot(&ctx->file_table, i); 8424 + ret = -EBADF; 8425 + if (!file_slot->file_ptr) 8426 + goto out; 8427 + 8428 + file = (struct file *)(file_slot->file_ptr & FFS_MASK); 8429 + ret = io_queue_rsrc_removal(ctx->file_data, offset, ctx->rsrc_node, file); 8430 + if (ret) 8431 + goto out; 8432 + 8433 + file_slot->file_ptr = 0; 8434 + io_rsrc_node_switch(ctx, ctx->file_data); 8435 + ret = 0; 8436 + out: 8437 + io_ring_submit_unlock(ctx, !(issue_flags & IO_URING_F_NONBLOCK)); 8438 + return ret; 8439 + } 8440 + 8416 8441 static int __io_sqe_files_update(struct io_ring_ctx *ctx, 8417 8442 struct io_uring_rsrc_update2 *up, 8418 8443 unsigned nr_args) ··· 9217 9166 struct io_buffer *buf; 9218 9167 unsigned long index; 9219 9168 9220 - xa_for_each(&ctx->io_buffers, index, buf) 9169 + xa_for_each(&ctx->io_buffers, index, buf) { 9221 9170 __io_remove_buffers(ctx, buf, index, -1U); 9171 + cond_resched(); 9172 + } 9222 9173 } 9223 9174 9224 9175 static void io_req_cache_free(struct list_head *list) ··· 9718 9665 struct io_tctx_node *node; 9719 9666 unsigned long index; 9720 9667 9721 - xa_for_each(&tctx->xa, index, node) 9668 + xa_for_each(&tctx->xa, index, node) { 9722 9669 io_uring_del_tctx_node(index); 9670 + cond_resched(); 9671 + } 9723 9672 if (wq) { 9724 9673 /* 9725 9674 * Must be after io_uring_del_task_file() (removes nodes under
+10 -14
fs/ksmbd/misc.c
··· 158 158 * Return : windows path string or error 159 159 */ 160 160 161 - char *convert_to_nt_pathname(char *filename, char *sharepath) 161 + char *convert_to_nt_pathname(char *filename) 162 162 { 163 163 char *ab_pathname; 164 - int len, name_len; 165 164 166 - name_len = strlen(filename); 167 - ab_pathname = kmalloc(name_len, GFP_KERNEL); 168 - if (!ab_pathname) 169 - return NULL; 165 + if (strlen(filename) == 0) { 166 + ab_pathname = kmalloc(2, GFP_KERNEL); 167 + ab_pathname[0] = '\\'; 168 + ab_pathname[1] = '\0'; 169 + } else { 170 + ab_pathname = kstrdup(filename, GFP_KERNEL); 171 + if (!ab_pathname) 172 + return NULL; 170 173 171 - ab_pathname[0] = '\\'; 172 - ab_pathname[1] = '\0'; 173 - 174 - len = strlen(sharepath); 175 - if (!strncmp(filename, sharepath, len) && name_len != len) { 176 - strscpy(ab_pathname, &filename[len], name_len); 177 174 ksmbd_conv_path_to_windows(ab_pathname); 178 175 } 179 - 180 176 return ab_pathname; 181 177 } 182 178 ··· 236 240 * 237 241 * Return: converted name on success, otherwise NULL 238 242 */ 239 - char *convert_to_unix_name(struct ksmbd_share_config *share, char *name) 243 + char *convert_to_unix_name(struct ksmbd_share_config *share, const char *name) 240 244 { 241 245 int no_slash = 0, name_len, path_len; 242 246 char *new_name;
+2 -2
fs/ksmbd/misc.h
··· 14 14 int match_pattern(const char *str, size_t len, const char *pattern); 15 15 int ksmbd_validate_filename(char *filename); 16 16 int parse_stream_name(char *filename, char **stream_name, int *s_type); 17 - char *convert_to_nt_pathname(char *filename, char *sharepath); 17 + char *convert_to_nt_pathname(char *filename); 18 18 int get_nlink(struct kstat *st); 19 19 void ksmbd_conv_path_to_unix(char *path); 20 20 void ksmbd_strip_last_slash(char *path); 21 21 void ksmbd_conv_path_to_windows(char *path); 22 22 char *ksmbd_extract_sharename(char *treename); 23 - char *convert_to_unix_name(struct ksmbd_share_config *share, char *name); 23 + char *convert_to_unix_name(struct ksmbd_share_config *share, const char *name); 24 24 25 25 #define KSMBD_DIR_INFO_ALIGNMENT 8 26 26 struct ksmbd_dir_info;
+3
fs/ksmbd/server.c
··· 584 584 ret = ksmbd_workqueue_init(); 585 585 if (ret) 586 586 goto err_crypto_destroy; 587 + 588 + pr_warn_once("The ksmbd server is experimental, use at your own risk.\n"); 589 + 587 590 return 0; 588 591 589 592 err_crypto_destroy:
+40 -75
fs/ksmbd/smb2pdu.c
··· 433 433 work->compound_pfid = KSMBD_NO_FID; 434 434 } 435 435 memset((char *)rsp_hdr + 4, 0, sizeof(struct smb2_hdr) + 2); 436 - rsp_hdr->ProtocolId = rcv_hdr->ProtocolId; 436 + rsp_hdr->ProtocolId = SMB2_PROTO_NUMBER; 437 437 rsp_hdr->StructureSize = SMB2_HEADER_STRUCTURE_SIZE; 438 438 rsp_hdr->Command = rcv_hdr->Command; 439 439 ··· 634 634 smb2_get_name(struct ksmbd_share_config *share, const char *src, 635 635 const int maxlen, struct nls_table *local_nls) 636 636 { 637 - char *name, *unixname; 637 + char *name; 638 638 639 639 name = smb_strndup_from_utf16(src, maxlen, 1, local_nls); 640 640 if (IS_ERR(name)) { ··· 642 642 return name; 643 643 } 644 644 645 - /* change it to absolute unix name */ 646 645 ksmbd_conv_path_to_unix(name); 647 646 ksmbd_strip_last_slash(name); 648 - 649 - unixname = convert_to_unix_name(share, name); 650 - kfree(name); 651 - if (!unixname) { 652 - pr_err("can not convert absolute name\n"); 653 - return ERR_PTR(-ENOMEM); 654 - } 655 - 656 - ksmbd_debug(SMB, "absolute name = %s\n", unixname); 657 - return unixname; 647 + return name; 658 648 } 659 649 660 650 int setup_async_work(struct ksmbd_work *work, void (*fn)(void **), void **arg) ··· 2338 2348 return rc; 2339 2349 } 2340 2350 2341 - rc = ksmbd_vfs_kern_path(name, 0, path, 0); 2351 + rc = ksmbd_vfs_kern_path(work, name, 0, path, 0); 2342 2352 if (rc) { 2343 2353 pr_err("cannot get linux path (%s), err = %d\n", 2344 2354 name, rc); ··· 2413 2423 struct oplock_info *opinfo; 2414 2424 __le32 *next_ptr = NULL; 2415 2425 int req_op_level = 0, open_flags = 0, may_flags = 0, file_info = 0; 2416 - int rc = 0, len = 0; 2426 + int rc = 0; 2417 2427 int contxt_cnt = 0, query_disk_id = 0; 2418 2428 int maximal_access_ctxt = 0, posix_ctxt = 0; 2419 2429 int s_type = 0; ··· 2485 2495 goto err_out1; 2486 2496 } 2487 2497 } else { 2488 - len = strlen(share->path); 2489 - ksmbd_debug(SMB, "share path len %d\n", len); 2490 - name = kmalloc(len + 1, GFP_KERNEL); 2498 + name = kstrdup("", GFP_KERNEL); 2491 2499 if (!name) { 2492 - rsp->hdr.Status = STATUS_NO_MEMORY; 2493 2500 rc = -ENOMEM; 2494 2501 goto err_out1; 2495 2502 } 2496 - 2497 - memcpy(name, share->path, len); 2498 - *(name + len) = '\0'; 2499 2503 } 2500 2504 2501 2505 req_op_level = req->RequestedOplockLevel; ··· 2612 2628 goto err_out1; 2613 2629 } 2614 2630 2615 - if (req->CreateOptions & FILE_DELETE_ON_CLOSE_LE) { 2616 - /* 2617 - * On delete request, instead of following up, need to 2618 - * look the current entity 2619 - */ 2620 - rc = ksmbd_vfs_kern_path(name, 0, &path, 1); 2621 - if (!rc) { 2631 + rc = ksmbd_vfs_kern_path(work, name, LOOKUP_NO_SYMLINKS, &path, 1); 2632 + if (!rc) { 2633 + if (req->CreateOptions & FILE_DELETE_ON_CLOSE_LE) { 2622 2634 /* 2623 2635 * If file exists with under flags, return access 2624 2636 * denied error. ··· 2633 2653 path_put(&path); 2634 2654 goto err_out; 2635 2655 } 2636 - } 2637 - } else { 2638 - if (test_share_config_flag(work->tcon->share_conf, 2639 - KSMBD_SHARE_FLAG_FOLLOW_SYMLINKS)) { 2640 - /* 2641 - * Use LOOKUP_FOLLOW to follow the path of 2642 - * symlink in path buildup 2643 - */ 2644 - rc = ksmbd_vfs_kern_path(name, LOOKUP_FOLLOW, &path, 1); 2645 - if (rc) { /* Case for broken link ?*/ 2646 - rc = ksmbd_vfs_kern_path(name, 0, &path, 1); 2647 - } 2648 - } else { 2649 - rc = ksmbd_vfs_kern_path(name, 0, &path, 1); 2650 - if (!rc && d_is_symlink(path.dentry)) { 2651 - rc = -EACCES; 2652 - path_put(&path); 2653 - goto err_out; 2654 - } 2656 + } else if (d_is_symlink(path.dentry)) { 2657 + rc = -EACCES; 2658 + path_put(&path); 2659 + goto err_out; 2655 2660 } 2656 2661 } 2657 2662 2658 2663 if (rc) { 2659 - if (rc == -EACCES) { 2660 - ksmbd_debug(SMB, 2661 - "User does not have right permission\n"); 2664 + if (rc != -ENOENT) 2662 2665 goto err_out; 2663 - } 2664 2666 ksmbd_debug(SMB, "can not get linux path for %s, rc = %d\n", 2665 2667 name, rc); 2666 2668 rc = 0; ··· 3138 3176 rsp->hdr.Status = STATUS_INVALID_PARAMETER; 3139 3177 else if (rc == -EOPNOTSUPP) 3140 3178 rsp->hdr.Status = STATUS_NOT_SUPPORTED; 3141 - else if (rc == -EACCES || rc == -ESTALE) 3179 + else if (rc == -EACCES || rc == -ESTALE || rc == -EXDEV) 3142 3180 rsp->hdr.Status = STATUS_ACCESS_DENIED; 3143 3181 else if (rc == -ENOENT) 3144 3182 rsp->hdr.Status = STATUS_OBJECT_NAME_INVALID; ··· 4003 4041 path = &fp->filp->f_path; 4004 4042 /* single EA entry is requested with given user.* name */ 4005 4043 if (req->InputBufferLength) { 4044 + if (le32_to_cpu(req->InputBufferLength) < 4045 + sizeof(struct smb2_ea_info_req)) 4046 + return -EINVAL; 4047 + 4006 4048 ea_req = (struct smb2_ea_info_req *)req->Buffer; 4007 4049 } else { 4008 4050 /* need to send all EAs, if no specific EA is requested*/ ··· 4254 4288 return -EACCES; 4255 4289 } 4256 4290 4257 - filename = convert_to_nt_pathname(fp->filename, 4258 - work->tcon->share_conf->path); 4291 + filename = convert_to_nt_pathname(fp->filename); 4259 4292 if (!filename) 4260 4293 return -ENOMEM; 4261 4294 ··· 4385 4420 file_info->NextEntryOffset = cpu_to_le32(next); 4386 4421 } 4387 4422 4388 - if (nbytes) { 4423 + if (!S_ISDIR(stat.mode)) { 4389 4424 file_info = (struct smb2_file_stream_info *) 4390 4425 &rsp->Buffer[nbytes]; 4391 4426 streamlen = smbConvertToUTF16((__le16 *)file_info->StreamName, 4392 4427 "::$DATA", 7, conn->local_nls, 0); 4393 4428 streamlen *= 2; 4394 4429 file_info->StreamNameLength = cpu_to_le32(streamlen); 4395 - file_info->StreamSize = S_ISDIR(stat.mode) ? 0 : 4396 - cpu_to_le64(stat.size); 4397 - file_info->StreamAllocationSize = S_ISDIR(stat.mode) ? 0 : 4398 - cpu_to_le64(stat.size); 4430 + file_info->StreamSize = 0; 4431 + file_info->StreamAllocationSize = 0; 4399 4432 nbytes += sizeof(struct smb2_file_stream_info) + streamlen; 4400 4433 } 4401 4434 ··· 4708 4745 struct path path; 4709 4746 int rc = 0, len; 4710 4747 int fs_infoclass_size = 0; 4711 - int lookup_flags = 0; 4712 4748 4713 - if (test_share_config_flag(share, KSMBD_SHARE_FLAG_FOLLOW_SYMLINKS)) 4714 - lookup_flags = LOOKUP_FOLLOW; 4715 - 4716 - rc = ksmbd_vfs_kern_path(share->path, lookup_flags, &path, 0); 4749 + rc = kern_path(share->path, LOOKUP_NO_SYMLINKS, &path); 4717 4750 if (rc) { 4718 4751 pr_err("cannot create vfs path\n"); 4719 4752 return -EIO; ··· 5258 5299 goto out; 5259 5300 5260 5301 len = strlen(new_name); 5261 - if (new_name[len - 1] != '/') { 5302 + if (len > 0 && new_name[len - 1] != '/') { 5262 5303 pr_err("not allow base filename in rename\n"); 5263 5304 rc = -ESHARE; 5264 5305 goto out; ··· 5286 5327 } 5287 5328 5288 5329 ksmbd_debug(SMB, "new name %s\n", new_name); 5289 - rc = ksmbd_vfs_kern_path(new_name, 0, &path, 1); 5290 - if (rc) 5330 + rc = ksmbd_vfs_kern_path(work, new_name, LOOKUP_NO_SYMLINKS, &path, 1); 5331 + if (rc) { 5332 + if (rc != -ENOENT) 5333 + goto out; 5291 5334 file_present = false; 5292 - else 5335 + } else { 5293 5336 path_put(&path); 5337 + } 5294 5338 5295 5339 if (ksmbd_share_veto_filename(share, new_name)) { 5296 5340 rc = -ENOENT; ··· 5363 5401 } 5364 5402 5365 5403 ksmbd_debug(SMB, "target name is %s\n", target_name); 5366 - rc = ksmbd_vfs_kern_path(link_name, 0, &path, 0); 5367 - if (rc) 5404 + rc = ksmbd_vfs_kern_path(work, link_name, LOOKUP_NO_SYMLINKS, &path, 0); 5405 + if (rc) { 5406 + if (rc != -ENOENT) 5407 + goto out; 5368 5408 file_present = false; 5369 - else 5409 + } else { 5370 5410 path_put(&path); 5411 + } 5371 5412 5372 5413 if (file_info->ReplaceIfExists) { 5373 5414 if (file_present) { ··· 5530 5565 * inode size is retained by backup inode size. 5531 5566 */ 5532 5567 size = i_size_read(inode); 5533 - rc = ksmbd_vfs_truncate(work, NULL, fp, alloc_blks * 512); 5568 + rc = ksmbd_vfs_truncate(work, fp, alloc_blks * 512); 5534 5569 if (rc) { 5535 5570 pr_err("truncate failed! filename : %s, err %d\n", 5536 5571 fp->filename, rc); ··· 5567 5602 if (inode->i_sb->s_magic != MSDOS_SUPER_MAGIC) { 5568 5603 ksmbd_debug(SMB, "filename : %s truncated to newsize %lld\n", 5569 5604 fp->filename, newsize); 5570 - rc = ksmbd_vfs_truncate(work, NULL, fp, newsize); 5605 + rc = ksmbd_vfs_truncate(work, fp, newsize); 5571 5606 if (rc) { 5572 5607 ksmbd_debug(SMB, "truncate failed! filename : %s err %d\n", 5573 5608 fp->filename, rc); ··· 5844 5879 return 0; 5845 5880 5846 5881 err_out: 5847 - if (rc == -EACCES || rc == -EPERM) 5882 + if (rc == -EACCES || rc == -EPERM || rc == -EXDEV) 5848 5883 rsp->hdr.Status = STATUS_ACCESS_DENIED; 5849 5884 else if (rc == -EINVAL) 5850 5885 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
+9 -4
fs/ksmbd/smb_common.c
··· 129 129 * 130 130 * check for valid smb signature and packet direction(request/response) 131 131 * 132 - * Return: 0 on success, otherwise 1 132 + * Return: 0 on success, otherwise -EINVAL 133 133 */ 134 134 int ksmbd_verify_smb_message(struct ksmbd_work *work) 135 135 { 136 - struct smb2_hdr *smb2_hdr = work->request_buf; 136 + struct smb2_hdr *smb2_hdr = work->request_buf + work->next_smb2_rcv_hdr_off; 137 + struct smb_hdr *hdr; 137 138 138 139 if (smb2_hdr->ProtocolId == SMB2_PROTO_NUMBER) 139 140 return ksmbd_smb2_check_message(work); 140 141 141 - return 0; 142 + hdr = work->request_buf; 143 + if (*(__le32 *)hdr->Protocol == SMB1_PROTO_NUMBER && 144 + hdr->Command == SMB_COM_NEGOTIATE) 145 + return 0; 146 + 147 + return -EINVAL; 142 148 } 143 149 144 150 /** ··· 271 265 return BAD_PROT_ID; 272 266 } 273 267 274 - #define SMB_COM_NEGOTIATE 0x72 275 268 int ksmbd_init_smb_server(struct ksmbd_work *work) 276 269 { 277 270 struct ksmbd_conn *conn = work->conn;
+1
fs/ksmbd/smb_common.h
··· 210 210 FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES) 211 211 212 212 #define SMB1_PROTO_NUMBER cpu_to_le32(0x424d53ff) 213 + #define SMB_COM_NEGOTIATE 0x72 213 214 214 215 #define SMB1_CLIENT_GUID_SIZE (16) 215 216 struct smb_hdr {
-1
fs/ksmbd/transport_rdma.c
··· 20 20 #define SUBMOD_NAME "smb_direct" 21 21 22 22 #include <linux/kthread.h> 23 - #include <linux/rwlock.h> 24 23 #include <linux/list.h> 25 24 #include <linux/mempool.h> 26 25 #include <linux/highmem.h>
+88 -94
fs/ksmbd/vfs.c
··· 19 19 #include <linux/sched/xacct.h> 20 20 #include <linux/crc32c.h> 21 21 22 + #include "../internal.h" /* for vfs_path_lookup */ 23 + 22 24 #include "glob.h" 23 25 #include "oplock.h" 24 26 #include "connection.h" ··· 46 44 p++; 47 45 } else { 48 46 p = NULL; 49 - pr_err("Invalid path %s\n", path); 50 47 } 51 48 return p; 52 49 } ··· 156 155 /** 157 156 * ksmbd_vfs_create() - vfs helper for smb create file 158 157 * @work: work 159 - * @name: file name 158 + * @name: file name that is relative to share 160 159 * @mode: file create mode 161 160 * 162 161 * Return: 0 on success, otherwise error ··· 167 166 struct dentry *dentry; 168 167 int err; 169 168 170 - dentry = kern_path_create(AT_FDCWD, name, &path, 0); 169 + dentry = ksmbd_vfs_kern_path_create(work, name, 170 + LOOKUP_NO_SYMLINKS, &path); 171 171 if (IS_ERR(dentry)) { 172 172 err = PTR_ERR(dentry); 173 173 if (err != -ENOENT) ··· 193 191 /** 194 192 * ksmbd_vfs_mkdir() - vfs helper for smb create directory 195 193 * @work: work 196 - * @name: directory name 194 + * @name: directory name that is relative to share 197 195 * @mode: directory create mode 198 196 * 199 197 * Return: 0 on success, otherwise error ··· 205 203 struct dentry *dentry; 206 204 int err; 207 205 208 - dentry = kern_path_create(AT_FDCWD, name, &path, LOOKUP_DIRECTORY); 206 + dentry = ksmbd_vfs_kern_path_create(work, name, 207 + LOOKUP_NO_SYMLINKS | LOOKUP_DIRECTORY, 208 + &path); 209 209 if (IS_ERR(dentry)) { 210 210 err = PTR_ERR(dentry); 211 211 if (err != -EEXIST) ··· 582 578 583 579 /** 584 580 * ksmbd_vfs_remove_file() - vfs helper for smb rmdir or unlink 585 - * @name: absolute directory or file name 581 + * @name: directory or file name that is relative to share 586 582 * 587 583 * Return: 0 on success, otherwise error 588 584 */ ··· 592 588 struct path path; 593 589 struct dentry *parent; 594 590 int err; 595 - int flags = 0; 596 591 597 592 if (ksmbd_override_fsids(work)) 598 593 return -ENOMEM; 599 594 600 - if (test_share_config_flag(work->tcon->share_conf, 601 - KSMBD_SHARE_FLAG_FOLLOW_SYMLINKS)) 602 - flags = LOOKUP_FOLLOW; 603 - 604 - err = kern_path(name, flags, &path); 595 + err = ksmbd_vfs_kern_path(work, name, LOOKUP_NO_SYMLINKS, &path, false); 605 596 if (err) { 606 597 ksmbd_debug(VFS, "can't get %s, err %d\n", name, err); 607 598 ksmbd_revert_fsids(work); ··· 641 642 /** 642 643 * ksmbd_vfs_link() - vfs helper for creating smb hardlink 643 644 * @oldname: source file name 644 - * @newname: hardlink name 645 + * @newname: hardlink name that is relative to share 645 646 * 646 647 * Return: 0 on success, otherwise error 647 648 */ ··· 651 652 struct path oldpath, newpath; 652 653 struct dentry *dentry; 653 654 int err; 654 - int flags = 0; 655 655 656 656 if (ksmbd_override_fsids(work)) 657 657 return -ENOMEM; 658 658 659 - if (test_share_config_flag(work->tcon->share_conf, 660 - KSMBD_SHARE_FLAG_FOLLOW_SYMLINKS)) 661 - flags = LOOKUP_FOLLOW; 662 - 663 - err = kern_path(oldname, flags, &oldpath); 659 + err = kern_path(oldname, LOOKUP_NO_SYMLINKS, &oldpath); 664 660 if (err) { 665 661 pr_err("cannot get linux path for %s, err = %d\n", 666 662 oldname, err); 667 663 goto out1; 668 664 } 669 665 670 - dentry = kern_path_create(AT_FDCWD, newname, &newpath, 671 - flags | LOOKUP_REVAL); 666 + dentry = ksmbd_vfs_kern_path_create(work, newname, 667 + LOOKUP_NO_SYMLINKS | LOOKUP_REVAL, 668 + &newpath); 672 669 if (IS_ERR(dentry)) { 673 670 err = PTR_ERR(dentry); 674 671 pr_err("path create err for %s, err %d\n", newname, err); ··· 783 788 struct dentry *src_dent, *trap_dent, *src_child; 784 789 char *dst_name; 785 790 int err; 786 - int flags; 787 791 788 792 dst_name = extract_last_component(newname); 789 - if (!dst_name) 790 - return -EINVAL; 793 + if (!dst_name) { 794 + dst_name = newname; 795 + newname = ""; 796 + } 791 797 792 798 src_dent_parent = dget_parent(fp->filp->f_path.dentry); 793 799 src_dent = fp->filp->f_path.dentry; 794 800 795 - flags = LOOKUP_DIRECTORY; 796 - if (test_share_config_flag(work->tcon->share_conf, 797 - KSMBD_SHARE_FLAG_FOLLOW_SYMLINKS)) 798 - flags |= LOOKUP_FOLLOW; 799 - 800 - err = kern_path(newname, flags, &dst_path); 801 + err = ksmbd_vfs_kern_path(work, newname, 802 + LOOKUP_NO_SYMLINKS | LOOKUP_DIRECTORY, 803 + &dst_path, false); 801 804 if (err) { 802 805 ksmbd_debug(VFS, "Cannot get path for %s [%d]\n", newname, err); 803 806 goto out; ··· 841 848 /** 842 849 * ksmbd_vfs_truncate() - vfs helper for smb file truncate 843 850 * @work: work 844 - * @name: old filename 845 851 * @fid: file id of old file 846 852 * @size: truncate to given size 847 853 * 848 854 * Return: 0 on success, otherwise error 849 855 */ 850 - int ksmbd_vfs_truncate(struct ksmbd_work *work, const char *name, 856 + int ksmbd_vfs_truncate(struct ksmbd_work *work, 851 857 struct ksmbd_file *fp, loff_t size) 852 858 { 853 - struct path path; 854 859 int err = 0; 860 + struct file *filp; 855 861 856 - if (name) { 857 - err = kern_path(name, 0, &path); 862 + filp = fp->filp; 863 + 864 + /* Do we need to break any of a levelII oplock? */ 865 + smb_break_all_levII_oplock(work, fp, 1); 866 + 867 + if (!work->tcon->posix_extensions) { 868 + struct inode *inode = file_inode(filp); 869 + 870 + if (size < inode->i_size) { 871 + err = check_lock_range(filp, size, 872 + inode->i_size - 1, WRITE); 873 + } else { 874 + err = check_lock_range(filp, inode->i_size, 875 + size - 1, WRITE); 876 + } 877 + 858 878 if (err) { 859 - pr_err("cannot get linux path for %s, err %d\n", 860 - name, err); 861 - return err; 879 + pr_err("failed due to lock\n"); 880 + return -EAGAIN; 862 881 } 863 - err = vfs_truncate(&path, size); 864 - if (err) 865 - pr_err("truncate failed for %s err %d\n", 866 - name, err); 867 - path_put(&path); 868 - } else { 869 - struct file *filp; 870 - 871 - filp = fp->filp; 872 - 873 - /* Do we need to break any of a levelII oplock? */ 874 - smb_break_all_levII_oplock(work, fp, 1); 875 - 876 - if (!work->tcon->posix_extensions) { 877 - struct inode *inode = file_inode(filp); 878 - 879 - if (size < inode->i_size) { 880 - err = check_lock_range(filp, size, 881 - inode->i_size - 1, WRITE); 882 - } else { 883 - err = check_lock_range(filp, inode->i_size, 884 - size - 1, WRITE); 885 - } 886 - 887 - if (err) { 888 - pr_err("failed due to lock\n"); 889 - return -EAGAIN; 890 - } 891 - } 892 - 893 - err = vfs_truncate(&filp->f_path, size); 894 - if (err) 895 - pr_err("truncate failed for filename : %s err %d\n", 896 - fp->filename, err); 897 882 } 898 883 884 + err = vfs_truncate(&filp->f_path, size); 885 + if (err) 886 + pr_err("truncate failed for filename : %s err %d\n", 887 + fp->filename, err); 899 888 return err; 900 889 } 901 890 ··· 1195 1220 1196 1221 /** 1197 1222 * ksmbd_vfs_kern_path() - lookup a file and get path info 1198 - * @name: name of file for lookup 1223 + * @name: file path that is relative to share 1199 1224 * @flags: lookup flags 1200 1225 * @path: if lookup succeed, return path info 1201 1226 * @caseless: caseless filename lookup 1202 1227 * 1203 1228 * Return: 0 on success, otherwise error 1204 1229 */ 1205 - int ksmbd_vfs_kern_path(char *name, unsigned int flags, struct path *path, 1206 - bool caseless) 1230 + int ksmbd_vfs_kern_path(struct ksmbd_work *work, char *name, 1231 + unsigned int flags, struct path *path, bool caseless) 1207 1232 { 1233 + struct ksmbd_share_config *share_conf = work->tcon->share_conf; 1208 1234 int err; 1209 1235 1210 - if (name[0] != '/') 1211 - return -EINVAL; 1212 - 1213 - err = kern_path(name, flags, path); 1236 + flags |= LOOKUP_BENEATH; 1237 + err = vfs_path_lookup(share_conf->vfs_path.dentry, 1238 + share_conf->vfs_path.mnt, 1239 + name, 1240 + flags, 1241 + path); 1214 1242 if (!err) 1215 1243 return 0; 1216 1244 ··· 1227 1249 return -ENOMEM; 1228 1250 1229 1251 path_len = strlen(filepath); 1230 - remain_len = path_len - 1; 1252 + remain_len = path_len; 1231 1253 1232 - err = kern_path("/", flags, &parent); 1233 - if (err) 1234 - goto out; 1254 + parent = share_conf->vfs_path; 1255 + path_get(&parent); 1235 1256 1236 1257 while (d_can_lookup(parent.dentry)) { 1237 1258 char *filename = filepath + path_len - remain_len; ··· 1243 1266 1244 1267 err = ksmbd_vfs_lookup_in_dir(&parent, filename, 1245 1268 filename_len); 1246 - if (err) { 1247 - path_put(&parent); 1248 - goto out; 1249 - } 1250 - 1251 1269 path_put(&parent); 1252 - next[0] = '\0'; 1253 - 1254 - err = kern_path(filepath, flags, &parent); 1255 1270 if (err) 1256 1271 goto out; 1257 1272 1258 - if (is_last) { 1259 - path->mnt = parent.mnt; 1260 - path->dentry = parent.dentry; 1273 + next[0] = '\0'; 1274 + 1275 + err = vfs_path_lookup(share_conf->vfs_path.dentry, 1276 + share_conf->vfs_path.mnt, 1277 + filepath, 1278 + flags, 1279 + &parent); 1280 + if (err) 1281 + goto out; 1282 + else if (is_last) { 1283 + *path = parent; 1261 1284 goto out; 1262 1285 } 1263 1286 ··· 1271 1294 kfree(filepath); 1272 1295 } 1273 1296 return err; 1297 + } 1298 + 1299 + struct dentry *ksmbd_vfs_kern_path_create(struct ksmbd_work *work, 1300 + const char *name, 1301 + unsigned int flags, 1302 + struct path *path) 1303 + { 1304 + char *abs_name; 1305 + struct dentry *dent; 1306 + 1307 + abs_name = convert_to_unix_name(work->tcon->share_conf, name); 1308 + if (!abs_name) 1309 + return ERR_PTR(-ENOMEM); 1310 + 1311 + dent = kern_path_create(AT_FDCWD, abs_name, path, flags); 1312 + kfree(abs_name); 1313 + return dent; 1274 1314 } 1275 1315 1276 1316 int ksmbd_vfs_remove_acl_xattrs(struct user_namespace *user_ns,
+7 -2
fs/ksmbd/vfs.h
··· 126 126 int ksmbd_vfs_getattr(struct path *path, struct kstat *stat); 127 127 int ksmbd_vfs_fp_rename(struct ksmbd_work *work, struct ksmbd_file *fp, 128 128 char *newname); 129 - int ksmbd_vfs_truncate(struct ksmbd_work *work, const char *name, 129 + int ksmbd_vfs_truncate(struct ksmbd_work *work, 130 130 struct ksmbd_file *fp, loff_t size); 131 131 struct srv_copychunk; 132 132 int ksmbd_vfs_copy_file_ranges(struct ksmbd_work *work, ··· 152 152 size_t *xattr_stream_name_size, int s_type); 153 153 int ksmbd_vfs_remove_xattr(struct user_namespace *user_ns, 154 154 struct dentry *dentry, char *attr_name); 155 - int ksmbd_vfs_kern_path(char *name, unsigned int flags, struct path *path, 155 + int ksmbd_vfs_kern_path(struct ksmbd_work *work, 156 + char *name, unsigned int flags, struct path *path, 156 157 bool caseless); 158 + struct dentry *ksmbd_vfs_kern_path_create(struct ksmbd_work *work, 159 + const char *name, 160 + unsigned int flags, 161 + struct path *path); 157 162 int ksmbd_vfs_empty_dir(struct ksmbd_file *fp); 158 163 void ksmbd_vfs_set_fadvise(struct file *filp, __le32 option); 159 164 int ksmbd_vfs_zero_data(struct ksmbd_work *work, struct ksmbd_file *fp,
+2 -11
fs/lockd/svcxdr.h
··· 134 134 static inline bool 135 135 svcxdr_encode_owner(struct xdr_stream *xdr, const struct xdr_netobj *obj) 136 136 { 137 - unsigned int quadlen = XDR_QUADLEN(obj->len); 138 - __be32 *p; 139 - 140 - if (xdr_stream_encode_u32(xdr, obj->len) < 0) 137 + if (obj->len > XDR_MAX_NETOBJ) 141 138 return false; 142 - p = xdr_reserve_space(xdr, obj->len); 143 - if (!p) 144 - return false; 145 - p[quadlen - 1] = 0; /* XDR pad */ 146 - memcpy(p, obj->data, obj->len); 147 - 148 - return true; 139 + return xdr_stream_encode_opaque(xdr, obj->data, obj->len) > 0; 149 140 } 150 141 151 142 #endif /* _LOCKD_SVCXDR_H_ */
+13 -3
fs/nfsd/nfs4state.c
··· 3570 3570 } 3571 3571 3572 3572 static __be32 nfsd4_match_existing_connection(struct svc_rqst *rqst, 3573 - struct nfsd4_session *session, u32 req) 3573 + struct nfsd4_session *session, u32 req, struct nfsd4_conn **conn) 3574 3574 { 3575 3575 struct nfs4_client *clp = session->se_client; 3576 3576 struct svc_xprt *xpt = rqst->rq_xprt; ··· 3593 3593 else 3594 3594 status = nfserr_inval; 3595 3595 spin_unlock(&clp->cl_lock); 3596 + if (status == nfs_ok && conn) 3597 + *conn = c; 3596 3598 return status; 3597 3599 } 3598 3600 ··· 3619 3617 status = nfserr_wrong_cred; 3620 3618 if (!nfsd4_mach_creds_match(session->se_client, rqstp)) 3621 3619 goto out; 3622 - status = nfsd4_match_existing_connection(rqstp, session, bcts->dir); 3623 - if (status == nfs_ok || status == nfserr_inval) 3620 + status = nfsd4_match_existing_connection(rqstp, session, 3621 + bcts->dir, &conn); 3622 + if (status == nfs_ok) { 3623 + if (bcts->dir == NFS4_CDFC4_FORE_OR_BOTH || 3624 + bcts->dir == NFS4_CDFC4_BACK) 3625 + conn->cn_flags |= NFS4_CDFC4_BACK; 3626 + nfsd4_probe_callback(session->se_client); 3627 + goto out; 3628 + } 3629 + if (status == nfserr_inval) 3624 3630 goto out; 3625 3631 status = nfsd4_map_bcts_dir(&bcts->dir); 3626 3632 if (status)
+2 -1
fs/ocfs2/dlmglue.c
··· 3951 3951 oi = OCFS2_I(inode); 3952 3952 oi->ip_dir_lock_gen++; 3953 3953 mlog(0, "generation: %u\n", oi->ip_dir_lock_gen); 3954 - goto out; 3954 + goto out_forget; 3955 3955 } 3956 3956 3957 3957 if (!S_ISREG(inode->i_mode)) ··· 3982 3982 filemap_fdatawait(mapping); 3983 3983 } 3984 3984 3985 + out_forget: 3985 3986 forget_all_cached_acls(inode); 3986 3987 3987 3988 out:
+27 -9
fs/qnx4/dir.c
··· 20 20 * depending on the status field in the last byte. The 21 21 * first byte is where the name start either way, and a 22 22 * zero means it's empty. 23 + * 24 + * Also, due to a bug in gcc, we don't want to use the 25 + * real (differently sized) name arrays in the inode and 26 + * link entries, but always the 'de_name[]' one in the 27 + * fake struct entry. 28 + * 29 + * See 30 + * 31 + * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578#c6 32 + * 33 + * for details, but basically gcc will take the size of the 34 + * 'name' array from one of the used union entries randomly. 35 + * 36 + * This use of 'de_name[]' (48 bytes) avoids the false positive 37 + * warnings that would happen if gcc decides to use 'inode.di_name' 38 + * (16 bytes) even when the pointer and size were to come from 39 + * 'link.dl_name' (48 bytes). 40 + * 41 + * In all cases the actual name pointer itself is the same, it's 42 + * only the gcc internal 'what is the size of this field' logic 43 + * that can get confused. 23 44 */ 24 45 union qnx4_directory_entry { 25 46 struct { 26 - char de_name; 27 - char de_pad[62]; 28 - char de_status; 47 + const char de_name[48]; 48 + u8 de_pad[15]; 49 + u8 de_status; 29 50 }; 30 51 struct qnx4_inode_entry inode; 31 52 struct qnx4_link_info link; ··· 74 53 ix = (ctx->pos >> QNX4_DIR_ENTRY_SIZE_BITS) % QNX4_INODES_PER_BLOCK; 75 54 for (; ix < QNX4_INODES_PER_BLOCK; ix++, ctx->pos += QNX4_DIR_ENTRY_SIZE) { 76 55 union qnx4_directory_entry *de; 77 - const char *name; 78 56 79 57 offset = ix * QNX4_DIR_ENTRY_SIZE; 80 58 de = (union qnx4_directory_entry *) (bh->b_data + offset); 81 59 82 - if (!de->de_name) 60 + if (!de->de_name[0]) 83 61 continue; 84 62 if (!(de->de_status & (QNX4_FILE_USED|QNX4_FILE_LINK))) 85 63 continue; 86 64 if (!(de->de_status & QNX4_FILE_LINK)) { 87 65 size = sizeof(de->inode.di_fname); 88 - name = de->inode.di_fname; 89 66 ino = blknum * QNX4_INODES_PER_BLOCK + ix - 1; 90 67 } else { 91 68 size = sizeof(de->link.dl_fname); 92 - name = de->link.dl_fname; 93 69 ino = ( le32_to_cpu(de->link.dl_inode_blk) - 1 ) * 94 70 QNX4_INODES_PER_BLOCK + 95 71 de->link.dl_inode_ndx; 96 72 } 97 - size = strnlen(name, size); 73 + size = strnlen(de->de_name, size); 98 74 QNX4DEBUG((KERN_INFO "qnx4_readdir:%.*s\n", size, name)); 99 - if (!dir_emit(ctx, name, size, ino, DT_UNKNOWN)) { 75 + if (!dir_emit(ctx, de->de_name, size, ino, DT_UNKNOWN)) { 100 76 brelse(bh); 101 77 return 0; 102 78 }
+1 -1
fs/smbfs_common/smbfsctl.h
··· 1 1 /* SPDX-License-Identifier: LGPL-2.1+ */ 2 2 /* 3 - * fs/cifs/smbfsctl.h: SMB, CIFS, SMB2 FSCTL definitions 3 + * SMB, CIFS, SMB2 FSCTL definitions 4 4 * 5 5 * Copyright (c) International Business Machines Corp., 2002,2013 6 6 * Author(s): Steve French (sfrench@us.ibm.com)
-8
include/acpi/acpi_io.h
··· 14 14 } 15 15 #endif 16 16 17 - #ifndef acpi_os_memmap 18 - static inline void __iomem *acpi_os_memmap(acpi_physical_address phys, 19 - acpi_size size) 20 - { 21 - return ioremap_cache(phys, size); 22 - } 23 - #endif 24 - 25 17 extern bool acpi_permanent_mmap; 26 18 27 19 void __iomem __ref
+2 -2
include/linux/buffer_head.h
··· 194 194 struct buffer_head *__bread_gfp(struct block_device *, 195 195 sector_t block, unsigned size, gfp_t gfp); 196 196 void invalidate_bh_lrus(void); 197 - void invalidate_bh_lrus_cpu(int cpu); 197 + void invalidate_bh_lrus_cpu(void); 198 198 bool has_bh_in_lru(int cpu, void *dummy); 199 199 struct buffer_head *alloc_buffer_head(gfp_t gfp_flags); 200 200 void free_buffer_head(struct buffer_head * bh); ··· 408 408 static inline void invalidate_inode_buffers(struct inode *inode) {} 409 409 static inline int remove_inode_buffers(struct inode *inode) { return 1; } 410 410 static inline int sync_mapping_buffers(struct address_space *mapping) { return 0; } 411 - static inline void invalidate_bh_lrus_cpu(int cpu) {} 411 + static inline void invalidate_bh_lrus_cpu(void) {} 412 412 static inline bool has_bh_in_lru(int cpu, void *dummy) { return false; } 413 413 #define buffer_heads_over_limit 0 414 414
+1 -1
include/linux/dsa/ocelot.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 2 - * Copyright 2019-2021 NXP Semiconductors 2 + * Copyright 2019-2021 NXP 3 3 */ 4 4 5 5 #ifndef _NET_DSA_TAG_OCELOT_H
+1 -1
include/linux/irqdomain.h
··· 251 251 } 252 252 253 253 void irq_domain_free_fwnode(struct fwnode_handle *fwnode); 254 - struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size, 254 + struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, unsigned int size, 255 255 irq_hw_number_t hwirq_max, int direct_max, 256 256 const struct irq_domain_ops *ops, 257 257 void *host_data);
+3
include/linux/mdio.h
··· 80 80 81 81 /* Clears up any memory if needed */ 82 82 void (*remove)(struct mdio_device *mdiodev); 83 + 84 + /* Quiesces the device on system shutdown, turns off interrupts etc */ 85 + void (*shutdown)(struct mdio_device *mdiodev); 83 86 }; 84 87 85 88 static inline struct mdio_driver *
+5 -1
include/linux/migrate.h
··· 19 19 */ 20 20 #define MIGRATEPAGE_SUCCESS 0 21 21 22 + /* 23 + * Keep sync with: 24 + * - macro MIGRATE_REASON in include/trace/events/migrate.h 25 + * - migrate_reason_names[MR_TYPES] in mm/debug.c 26 + */ 22 27 enum migrate_reason { 23 28 MR_COMPACTION, 24 29 MR_MEMORY_FAILURE, ··· 37 32 MR_TYPES 38 33 }; 39 34 40 - /* In mm/debug.c; also keep sync with include/trace/events/migrate.h */ 41 35 extern const char *migrate_reason_names[MR_TYPES]; 42 36 43 37 #ifdef CONFIG_MIGRATION
+14
include/linux/nvmem-consumer.h
··· 150 150 return -EOPNOTSUPP; 151 151 } 152 152 153 + static inline int nvmem_cell_read_variable_le_u32(struct device *dev, 154 + const char *cell_id, 155 + u32 *val) 156 + { 157 + return -EOPNOTSUPP; 158 + } 159 + 160 + static inline int nvmem_cell_read_variable_le_u64(struct device *dev, 161 + const char *cell_id, 162 + u64 *val) 163 + { 164 + return -EOPNOTSUPP; 165 + } 166 + 153 167 static inline struct nvmem_device *nvmem_device_get(struct device *dev, 154 168 const char *name) 155 169 {
+1 -1
include/linux/packing.h
··· 1 1 /* SPDX-License-Identifier: BSD-3-Clause 2 - * Copyright (c) 2016-2018, NXP Semiconductors 2 + * Copyright 2016-2018 NXP 3 3 * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> 4 4 */ 5 5 #ifndef _LINUX_PACKING_H
+2
include/linux/pkeys.h
··· 4 4 5 5 #include <linux/mm.h> 6 6 7 + #define ARCH_DEFAULT_PKEY 0 8 + 7 9 #ifdef CONFIG_ARCH_HAS_PKEYS 8 10 #include <asm/pkeys.h> 9 11 #else /* ! CONFIG_ARCH_HAS_PKEYS */
+2
include/linux/tracehook.h
··· 197 197 198 198 mem_cgroup_handle_over_high(); 199 199 blkcg_maybe_throttle_current(); 200 + 201 + rseq_handle_notify_resume(NULL, regs); 200 202 } 201 203 202 204 /*
+2
include/linux/usb/hcd.h
··· 124 124 #define HCD_FLAG_RH_RUNNING 5 /* root hub is running? */ 125 125 #define HCD_FLAG_DEAD 6 /* controller has died? */ 126 126 #define HCD_FLAG_INTF_AUTHORIZED 7 /* authorize interfaces? */ 127 + #define HCD_FLAG_DEFER_RH_REGISTER 8 /* Defer roothub registration */ 127 128 128 129 /* The flags can be tested using these macros; they are likely to 129 130 * be slightly faster than test_bit(). ··· 135 134 #define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING)) 136 135 #define HCD_RH_RUNNING(hcd) ((hcd)->flags & (1U << HCD_FLAG_RH_RUNNING)) 137 136 #define HCD_DEAD(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEAD)) 137 + #define HCD_DEFER_RH_REGISTER(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEFER_RH_REGISTER)) 138 138 139 139 /* 140 140 * Specifies if interfaces are authorized by default
+9
include/net/dsa.h
··· 585 585 int (*change_tag_protocol)(struct dsa_switch *ds, int port, 586 586 enum dsa_tag_protocol proto); 587 587 588 + /* Optional switch-wide initialization and destruction methods */ 588 589 int (*setup)(struct dsa_switch *ds); 589 590 void (*teardown)(struct dsa_switch *ds); 591 + 592 + /* Per-port initialization and destruction methods. Mandatory if the 593 + * driver registers devlink port regions, optional otherwise. 594 + */ 595 + int (*port_setup)(struct dsa_switch *ds, int port); 596 + void (*port_teardown)(struct dsa_switch *ds, int port); 597 + 590 598 u32 (*get_phy_flags)(struct dsa_switch *ds, int port); 591 599 592 600 /* ··· 1054 1046 1055 1047 void dsa_unregister_switch(struct dsa_switch *ds); 1056 1048 int dsa_register_switch(struct dsa_switch *ds); 1049 + void dsa_switch_shutdown(struct dsa_switch *ds); 1057 1050 struct dsa_switch *dsa_switch_find(int tree_index, int sw_index); 1058 1051 #ifdef CONFIG_PM_SLEEP 1059 1052 int dsa_switch_suspend(struct dsa_switch *ds);
+1
include/net/sock.h
··· 1640 1640 release_sock(sk); 1641 1641 __release(&sk->sk_lock.slock); 1642 1642 } else { 1643 + mutex_release(&sk->sk_lock.dep_map, _RET_IP_); 1643 1644 spin_unlock_bh(&sk->sk_lock.slock); 1644 1645 } 1645 1646 }
-1
include/scsi/scsi_device.h
··· 146 146 struct scsi_vpd __rcu *vpd_pg83; 147 147 struct scsi_vpd __rcu *vpd_pg80; 148 148 struct scsi_vpd __rcu *vpd_pg89; 149 - unsigned char current_tag; /* current tag */ 150 149 struct scsi_target *sdev_target; 151 150 152 151 blist_flags_t sdev_bflags; /* black/white flags as also found in
+6 -2
include/trace/events/afs.h
··· 306 306 307 307 enum afs_cb_break_reason { 308 308 afs_cb_break_no_break, 309 + afs_cb_break_no_promise, 309 310 afs_cb_break_for_callback, 310 311 afs_cb_break_for_deleted, 311 312 afs_cb_break_for_lapsed, 313 + afs_cb_break_for_s_reinit, 312 314 afs_cb_break_for_unlink, 313 - afs_cb_break_for_vsbreak, 315 + afs_cb_break_for_v_break, 314 316 afs_cb_break_for_volume_callback, 315 317 afs_cb_break_for_zap, 316 318 }; ··· 604 602 605 603 #define afs_cb_break_reasons \ 606 604 EM(afs_cb_break_no_break, "no-break") \ 605 + EM(afs_cb_break_no_promise, "no-promise") \ 607 606 EM(afs_cb_break_for_callback, "break-cb") \ 608 607 EM(afs_cb_break_for_deleted, "break-del") \ 609 608 EM(afs_cb_break_for_lapsed, "break-lapsed") \ 609 + EM(afs_cb_break_for_s_reinit, "s-reinit") \ 610 610 EM(afs_cb_break_for_unlink, "break-unlink") \ 611 - EM(afs_cb_break_for_vsbreak, "break-vs") \ 611 + EM(afs_cb_break_for_v_break, "break-v") \ 612 612 EM(afs_cb_break_for_volume_callback, "break-v-cb") \ 613 613 E_(afs_cb_break_for_zap, "break-zap") 614 614
+3 -3
include/trace/events/erofs.h
··· 35 35 TP_STRUCT__entry( 36 36 __field(dev_t, dev ) 37 37 __field(erofs_nid_t, nid ) 38 - __field(const char *, name ) 38 + __string(name, dentry->d_name.name ) 39 39 __field(unsigned int, flags ) 40 40 ), 41 41 42 42 TP_fast_assign( 43 43 __entry->dev = dir->i_sb->s_dev; 44 44 __entry->nid = EROFS_I(dir)->nid; 45 - __entry->name = dentry->d_name.name; 45 + __assign_str(name, dentry->d_name.name); 46 46 __entry->flags = flags; 47 47 ), 48 48 49 49 TP_printk("dev = (%d,%d), pnid = %llu, name:%s, flags:%x", 50 50 show_dev_nid(__entry), 51 - __entry->name, 51 + __get_str(name), 52 52 __entry->flags) 53 53 ); 54 54
+7
include/uapi/linux/android/binder.h
··· 225 225 226 226 struct binder_frozen_status_info { 227 227 __u32 pid; 228 + 229 + /* process received sync transactions since last frozen 230 + * bit 0: received sync transaction after being frozen 231 + * bit 1: new pending sync transaction during freezing 232 + */ 228 233 __u32 sync_recv; 234 + 235 + /* process received async transactions since last frozen */ 229 236 __u32 async_recv; 230 237 }; 231 238
-1
include/uapi/linux/cifs/cifs_mount.h
··· 1 1 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ 2 2 /* 3 - * include/uapi/linux/cifs/cifs_mount.h 4 3 * 5 4 * Author(s): Scott Lovenberg (scott.lovenberg@gmail.com) 6 5 *
-12
include/xen/xen-ops.h
··· 46 46 int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order, 47 47 unsigned int address_bits, 48 48 dma_addr_t *dma_handle); 49 - 50 49 void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order); 51 - #else 52 - static inline int xen_create_contiguous_region(phys_addr_t pstart, 53 - unsigned int order, 54 - unsigned int address_bits, 55 - dma_addr_t *dma_handle) 56 - { 57 - return 0; 58 - } 59 - 60 - static inline void xen_destroy_contiguous_region(phys_addr_t pstart, 61 - unsigned int order) { } 62 50 #endif 63 51 64 52 #if defined(CONFIG_XEN_PV)
+16 -14
init/do_mounts.c
··· 338 338 __setup("rootfstype=", fs_names_setup); 339 339 __setup("rootdelay=", root_delay_setup); 340 340 341 - static int __init split_fs_names(char *page, char *names) 341 + /* This can return zero length strings. Caller should check */ 342 + static int __init split_fs_names(char *page, size_t size, char *names) 342 343 { 343 - int count = 0; 344 + int count = 1; 344 345 char *p = page; 345 346 346 - strcpy(p, root_fs_names); 347 + strlcpy(p, root_fs_names, size); 347 348 while (*p++) { 348 - if (p[-1] == ',') 349 + if (p[-1] == ',') { 349 350 p[-1] = '\0'; 351 + count++; 352 + } 350 353 } 351 - *p = '\0'; 352 - 353 - for (p = page; *p; p += strlen(p)+1) 354 - count++; 355 354 356 355 return count; 357 356 } ··· 403 404 scnprintf(b, BDEVNAME_SIZE, "unknown-block(%u,%u)", 404 405 MAJOR(ROOT_DEV), MINOR(ROOT_DEV)); 405 406 if (root_fs_names) 406 - num_fs = split_fs_names(fs_names, root_fs_names); 407 + num_fs = split_fs_names(fs_names, PAGE_SIZE, root_fs_names); 407 408 else 408 409 num_fs = list_bdev_fs_names(fs_names, PAGE_SIZE); 409 410 retry: 410 411 for (i = 0, p = fs_names; i < num_fs; i++, p += strlen(p)+1) { 411 - int err = do_mount_root(name, p, flags, root_mount_data); 412 + int err; 413 + 414 + if (!*p) 415 + continue; 416 + err = do_mount_root(name, p, flags, root_mount_data); 412 417 switch (err) { 413 418 case 0: 414 419 goto out; ··· 546 543 fs_names = (void *)__get_free_page(GFP_KERNEL); 547 544 if (!fs_names) 548 545 return -EINVAL; 549 - num_fs = split_fs_names(fs_names, root_fs_names); 546 + num_fs = split_fs_names(fs_names, PAGE_SIZE, root_fs_names); 550 547 551 548 for (i = 0, fstype = fs_names; i < num_fs; 552 549 i++, fstype += strlen(fstype) + 1) { 550 + if (!*fstype) 551 + continue; 553 552 if (!fs_is_nodev(fstype)) 554 553 continue; 555 554 err = do_mount_root(root_device_name, fstype, root_mountflags, 556 555 root_mount_data); 557 556 if (!err) 558 557 break; 559 - if (err != -EACCES && err != -EINVAL) 560 - panic("VFS: Unable to mount root \"%s\" (%s), err=%d\n", 561 - root_device_name, fstype, err); 562 558 } 563 559 564 560 free_page((unsigned long)fs_names);
+3 -3
init/main.c
··· 1242 1242 { 1243 1243 ktime_t *calltime = (ktime_t *)data; 1244 1244 1245 - printk(KERN_DEBUG "calling %pS @ %i irqs_disabled() %d\n", fn, task_pid_nr(current), irqs_disabled()); 1245 + printk(KERN_DEBUG "calling %pS @ %i\n", fn, task_pid_nr(current)); 1246 1246 *calltime = ktime_get(); 1247 1247 } 1248 1248 ··· 1256 1256 rettime = ktime_get(); 1257 1257 delta = ktime_sub(rettime, *calltime); 1258 1258 duration = (unsigned long long) ktime_to_ns(delta) >> 10; 1259 - printk(KERN_DEBUG "initcall %pS returned %d after %lld usecs, irqs_disabled() %d\n", 1260 - fn, ret, duration, irqs_disabled()); 1259 + printk(KERN_DEBUG "initcall %pS returned %d after %lld usecs\n", 1260 + fn, ret, duration); 1261 1261 } 1262 1262 1263 1263 static ktime_t initcall_calltime;
+1 -3
kernel/entry/common.c
··· 171 171 if (ti_work & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL)) 172 172 handle_signal_work(regs, ti_work); 173 173 174 - if (ti_work & _TIF_NOTIFY_RESUME) { 174 + if (ti_work & _TIF_NOTIFY_RESUME) 175 175 tracehook_notify_resume(regs); 176 - rseq_handle_notify_resume(NULL, regs); 177 - } 178 176 179 177 /* Architecture specific TIF work */ 180 178 arch_exit_to_user_mode_work(regs, ti_work);
+1 -1
kernel/irq/irqdomain.c
··· 136 136 * Allocates and initializes an irq_domain structure. 137 137 * Returns pointer to IRQ domain, or NULL on failure. 138 138 */ 139 - struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size, 139 + struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, unsigned int size, 140 140 irq_hw_number_t hwirq_max, int direct_max, 141 141 const struct irq_domain_ops *ops, 142 142 void *host_data)
+11 -3
kernel/rseq.c
··· 282 282 283 283 if (unlikely(t->flags & PF_EXITING)) 284 284 return; 285 - ret = rseq_ip_fixup(regs); 286 - if (unlikely(ret < 0)) 287 - goto error; 285 + 286 + /* 287 + * regs is NULL if and only if the caller is in a syscall path. Skip 288 + * fixup and leave rseq_cs as is so that rseq_sycall() will detect and 289 + * kill a misbehaving userspace on debug kernels. 290 + */ 291 + if (regs) { 292 + ret = rseq_ip_fixup(regs); 293 + if (unlikely(ret < 0)) 294 + goto error; 295 + } 288 296 if (unlikely(rseq_update_cpu_id(t))) 289 297 goto error; 290 298 return;
+2 -1
kernel/time/posix-cpu-timers.c
··· 1404 1404 } 1405 1405 } 1406 1406 1407 - *newval += now; 1407 + if (*newval) 1408 + *newval += now; 1408 1409 } 1409 1410 1410 1411 /*
+8
kernel/trace/blktrace.c
··· 1605 1605 if (bt == NULL) 1606 1606 return -EINVAL; 1607 1607 1608 + if (bt->trace_state == Blktrace_running) { 1609 + bt->trace_state = Blktrace_stopped; 1610 + spin_lock_irq(&running_trace_lock); 1611 + list_del_init(&bt->running_list); 1612 + spin_unlock_irq(&running_trace_lock); 1613 + relay_flush(bt->rchan); 1614 + } 1615 + 1608 1616 put_probe_ref(); 1609 1617 synchronize_rcu(); 1610 1618 blk_trace_free(bt);
+1 -1
lib/Kconfig.debug
··· 346 346 int "Warn for stack frames larger than" 347 347 range 0 8192 348 348 default 2048 if GCC_PLUGIN_LATENT_ENTROPY 349 - default 1536 if (!64BIT && PARISC) 349 + default 1536 if (!64BIT && (PARISC || XTENSA)) 350 350 default 1024 if (!64BIT && !PARISC) 351 351 default 2048 if 64BIT 352 352 help
+2
lib/Kconfig.kasan
··· 66 66 config KASAN_GENERIC 67 67 bool "Generic mode" 68 68 depends on HAVE_ARCH_KASAN && CC_HAS_KASAN_GENERIC 69 + depends on CC_HAS_WORKING_NOSANITIZE_ADDRESS 69 70 select SLUB_DEBUG if SLUB 70 71 select CONSTRUCTORS 71 72 help ··· 87 86 config KASAN_SW_TAGS 88 87 bool "Software tag-based mode" 89 88 depends on HAVE_ARCH_KASAN_SW_TAGS && CC_HAS_KASAN_SW_TAGS 89 + depends on CC_HAS_WORKING_NOSANITIZE_ADDRESS 90 90 select SLUB_DEBUG if SLUB 91 91 select CONSTRUCTORS 92 92 help
+1 -1
lib/packing.c
··· 1 1 // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 2 - /* Copyright (c) 2016-2018, NXP Semiconductors 2 + /* Copyright 2016-2018 NXP 3 3 * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> 4 4 */ 5 5 #include <linux/packing.h>
+6 -7
lib/zlib_inflate/inffast.c
··· 253 253 254 254 sfrom = (unsigned short *)(from); 255 255 loops = len >> 1; 256 - do 257 - #ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS 258 - *sout++ = *sfrom++; 259 - #else 260 - *sout++ = get_unaligned16(sfrom++); 261 - #endif 262 - while (--loops); 256 + do { 257 + if (IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)) 258 + *sout++ = *sfrom++; 259 + else 260 + *sout++ = get_unaligned16(sfrom++); 261 + } while (--loops); 263 262 out = (unsigned char *)sout; 264 263 from = (unsigned char *)sfrom; 265 264 } else { /* dist == 1 or dist == 2 */
+8 -8
mm/damon/dbgfs-test.h
··· 20 20 ssize_t nr_integers = 0, i; 21 21 22 22 question = "123"; 23 - answers = str_to_target_ids(question, strnlen(question, 128), 23 + answers = str_to_target_ids(question, strlen(question), 24 24 &nr_integers); 25 25 KUNIT_EXPECT_EQ(test, (ssize_t)1, nr_integers); 26 26 KUNIT_EXPECT_EQ(test, 123ul, answers[0]); 27 27 kfree(answers); 28 28 29 29 question = "123abc"; 30 - answers = str_to_target_ids(question, strnlen(question, 128), 30 + answers = str_to_target_ids(question, strlen(question), 31 31 &nr_integers); 32 32 KUNIT_EXPECT_EQ(test, (ssize_t)1, nr_integers); 33 33 KUNIT_EXPECT_EQ(test, 123ul, answers[0]); 34 34 kfree(answers); 35 35 36 36 question = "a123"; 37 - answers = str_to_target_ids(question, strnlen(question, 128), 37 + answers = str_to_target_ids(question, strlen(question), 38 38 &nr_integers); 39 39 KUNIT_EXPECT_EQ(test, (ssize_t)0, nr_integers); 40 40 kfree(answers); 41 41 42 42 question = "12 35"; 43 - answers = str_to_target_ids(question, strnlen(question, 128), 43 + answers = str_to_target_ids(question, strlen(question), 44 44 &nr_integers); 45 45 KUNIT_EXPECT_EQ(test, (ssize_t)2, nr_integers); 46 46 for (i = 0; i < nr_integers; i++) ··· 48 48 kfree(answers); 49 49 50 50 question = "12 35 46"; 51 - answers = str_to_target_ids(question, strnlen(question, 128), 51 + answers = str_to_target_ids(question, strlen(question), 52 52 &nr_integers); 53 53 KUNIT_EXPECT_EQ(test, (ssize_t)3, nr_integers); 54 54 for (i = 0; i < nr_integers; i++) ··· 56 56 kfree(answers); 57 57 58 58 question = "12 35 abc 46"; 59 - answers = str_to_target_ids(question, strnlen(question, 128), 59 + answers = str_to_target_ids(question, strlen(question), 60 60 &nr_integers); 61 61 KUNIT_EXPECT_EQ(test, (ssize_t)2, nr_integers); 62 62 for (i = 0; i < 2; i++) ··· 64 64 kfree(answers); 65 65 66 66 question = ""; 67 - answers = str_to_target_ids(question, strnlen(question, 128), 67 + answers = str_to_target_ids(question, strlen(question), 68 68 &nr_integers); 69 69 KUNIT_EXPECT_EQ(test, (ssize_t)0, nr_integers); 70 70 kfree(answers); 71 71 72 72 question = "\n"; 73 - answers = str_to_target_ids(question, strnlen(question, 128), 73 + answers = str_to_target_ids(question, strlen(question), 74 74 &nr_integers); 75 75 KUNIT_EXPECT_EQ(test, (ssize_t)0, nr_integers); 76 76 kfree(answers);
+3 -1
mm/debug.c
··· 24 24 "syscall_or_cpuset", 25 25 "mempolicy_mbind", 26 26 "numa_misplaced", 27 - "cma", 27 + "contig_range", 28 + "longterm_pin", 29 + "demotion", 28 30 }; 29 31 30 32 const struct trace_print_flags pageflag_names[] = {
-10
mm/memcontrol.c
··· 106 106 /* memcg and lruvec stats flushing */ 107 107 static void flush_memcg_stats_dwork(struct work_struct *w); 108 108 static DECLARE_DEFERRABLE_WORK(stats_flush_dwork, flush_memcg_stats_dwork); 109 - static void flush_memcg_stats_work(struct work_struct *w); 110 - static DECLARE_WORK(stats_flush_work, flush_memcg_stats_work); 111 - static DEFINE_PER_CPU(unsigned int, stats_flush_threshold); 112 109 static DEFINE_SPINLOCK(stats_flush_lock); 113 110 114 111 #define THRESHOLDS_EVENTS_TARGET 128 ··· 679 682 680 683 /* Update lruvec */ 681 684 __this_cpu_add(pn->lruvec_stats_percpu->state[idx], val); 682 - if (!(__this_cpu_inc_return(stats_flush_threshold) % MEMCG_CHARGE_BATCH)) 683 - queue_work(system_unbound_wq, &stats_flush_work); 684 685 } 685 686 686 687 /** ··· 5354 5359 { 5355 5360 mem_cgroup_flush_stats(); 5356 5361 queue_delayed_work(system_unbound_wq, &stats_flush_dwork, 2UL*HZ); 5357 - } 5358 - 5359 - static void flush_memcg_stats_work(struct work_struct *w) 5360 - { 5361 - mem_cgroup_flush_stats(); 5362 5362 } 5363 5363 5364 5364 static void mem_cgroup_css_rstat_flush(struct cgroup_subsys_state *css, int cpu)
+6 -6
mm/memory-failure.c
··· 306 306 struct vm_area_struct *vma) 307 307 { 308 308 unsigned long address = vma_address(page, vma); 309 + unsigned long ret = 0; 309 310 pgd_t *pgd; 310 311 p4d_t *p4d; 311 312 pud_t *pud; ··· 330 329 if (pmd_devmap(*pmd)) 331 330 return PMD_SHIFT; 332 331 pte = pte_offset_map(pmd, address); 333 - if (!pte_present(*pte)) 334 - return 0; 335 - if (pte_devmap(*pte)) 336 - return PAGE_SHIFT; 337 - return 0; 332 + if (pte_present(*pte) && pte_devmap(*pte)) 333 + ret = PAGE_SHIFT; 334 + pte_unmap(pte); 335 + return ret; 338 336 } 339 337 340 338 /* ··· 1126 1126 */ 1127 1127 static inline bool HWPoisonHandlable(struct page *page) 1128 1128 { 1129 - return PageLRU(page) || __PageMovable(page); 1129 + return PageLRU(page) || __PageMovable(page) || is_free_buddy_page(page); 1130 1130 } 1131 1131 1132 1132 static int __get_hwpoison_page(struct page *page)
+1
mm/memory.c
··· 3403 3403 unmap_mapping_range_tree(&mapping->i_mmap, &details); 3404 3404 i_mmap_unlock_write(mapping); 3405 3405 } 3406 + EXPORT_SYMBOL_GPL(unmap_mapping_pages); 3406 3407 3407 3408 /** 3408 3409 * unmap_mapping_range - unmap the portion of all mmaps in the specified
+2 -2
mm/shmem.c
··· 490 490 case SHMEM_HUGE_ALWAYS: 491 491 return true; 492 492 case SHMEM_HUGE_WITHIN_SIZE: 493 - index = round_up(index, HPAGE_PMD_NR); 493 + index = round_up(index + 1, HPAGE_PMD_NR); 494 494 i_size = round_up(i_size_read(inode), PAGE_SIZE); 495 - if (i_size >= HPAGE_PMD_SIZE && (i_size >> PAGE_SHIFT) >= index) 495 + if (i_size >> PAGE_SHIFT >= index) 496 496 return true; 497 497 fallthrough; 498 498 case SHMEM_HUGE_ADVISE:
+16 -3
mm/swap.c
··· 620 620 pagevec_lru_move_fn(pvec, lru_lazyfree_fn); 621 621 622 622 activate_page_drain(cpu); 623 - invalidate_bh_lrus_cpu(cpu); 624 623 } 625 624 626 625 /** ··· 702 703 local_unlock(&lru_pvecs.lock); 703 704 } 704 705 706 + /* 707 + * It's called from per-cpu workqueue context in SMP case so 708 + * lru_add_drain_cpu and invalidate_bh_lrus_cpu should run on 709 + * the same cpu. It shouldn't be a problem in !SMP case since 710 + * the core is only one and the locks will disable preemption. 711 + */ 712 + static void lru_add_and_bh_lrus_drain(void) 713 + { 714 + local_lock(&lru_pvecs.lock); 715 + lru_add_drain_cpu(smp_processor_id()); 716 + local_unlock(&lru_pvecs.lock); 717 + invalidate_bh_lrus_cpu(); 718 + } 719 + 705 720 void lru_add_drain_cpu_zone(struct zone *zone) 706 721 { 707 722 local_lock(&lru_pvecs.lock); ··· 730 717 731 718 static void lru_add_drain_per_cpu(struct work_struct *dummy) 732 719 { 733 - lru_add_drain(); 720 + lru_add_and_bh_lrus_drain(); 734 721 } 735 722 736 723 /* ··· 871 858 */ 872 859 __lru_add_drain_all(true); 873 860 #else 874 - lru_add_drain(); 861 + lru_add_and_bh_lrus_drain(); 875 862 #endif 876 863 } 877 864
+2 -2
mm/util.c
··· 787 787 size_t *lenp, loff_t *ppos) 788 788 { 789 789 struct ctl_table t; 790 - int new_policy; 790 + int new_policy = -1; 791 791 int ret; 792 792 793 793 /* ··· 805 805 t = *table; 806 806 t.data = &new_policy; 807 807 ret = proc_dointvec_minmax(&t, write, buffer, lenp, ppos); 808 - if (ret) 808 + if (ret || new_policy == -1) 809 809 return ret; 810 810 811 811 mm_compute_batch(new_policy);
+1
mm/workingset.c
··· 352 352 353 353 inc_lruvec_state(lruvec, WORKINGSET_REFAULT_BASE + file); 354 354 355 + mem_cgroup_flush_stats(); 355 356 /* 356 357 * Compare the distance to the existing workingset size. We 357 358 * don't activate pages that couldn't stay resident even if
+10 -6
net/core/dev.c
··· 6923 6923 */ 6924 6924 void napi_enable(struct napi_struct *n) 6925 6925 { 6926 - BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state)); 6927 - smp_mb__before_atomic(); 6928 - clear_bit(NAPI_STATE_SCHED, &n->state); 6929 - clear_bit(NAPI_STATE_NPSVC, &n->state); 6930 - if (n->dev->threaded && n->thread) 6931 - set_bit(NAPI_STATE_THREADED, &n->state); 6926 + unsigned long val, new; 6927 + 6928 + do { 6929 + val = READ_ONCE(n->state); 6930 + BUG_ON(!test_bit(NAPI_STATE_SCHED, &val)); 6931 + 6932 + new = val & ~(NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC); 6933 + if (n->dev->threaded && n->thread) 6934 + new |= NAPIF_STATE_THREADED; 6935 + } while (cmpxchg(&n->state, val, new) != val); 6932 6936 } 6933 6937 EXPORT_SYMBOL(napi_enable); 6934 6938
+23 -14
net/core/sock.c
··· 3179 3179 3180 3180 void lock_sock_nested(struct sock *sk, int subclass) 3181 3181 { 3182 + /* The sk_lock has mutex_lock() semantics here. */ 3183 + mutex_acquire(&sk->sk_lock.dep_map, subclass, 0, _RET_IP_); 3184 + 3182 3185 might_sleep(); 3183 3186 spin_lock_bh(&sk->sk_lock.slock); 3184 3187 if (sk->sk_lock.owned) 3185 3188 __lock_sock(sk); 3186 3189 sk->sk_lock.owned = 1; 3187 - spin_unlock(&sk->sk_lock.slock); 3188 - /* 3189 - * The sk_lock has mutex_lock() semantics here: 3190 - */ 3191 - mutex_acquire(&sk->sk_lock.dep_map, subclass, 0, _RET_IP_); 3192 - local_bh_enable(); 3190 + spin_unlock_bh(&sk->sk_lock.slock); 3193 3191 } 3194 3192 EXPORT_SYMBOL(lock_sock_nested); 3195 3193 ··· 3225 3227 */ 3226 3228 bool lock_sock_fast(struct sock *sk) __acquires(&sk->sk_lock.slock) 3227 3229 { 3230 + /* The sk_lock has mutex_lock() semantics here. */ 3231 + mutex_acquire(&sk->sk_lock.dep_map, 0, 0, _RET_IP_); 3232 + 3228 3233 might_sleep(); 3229 3234 spin_lock_bh(&sk->sk_lock.slock); 3230 3235 3231 - if (!sk->sk_lock.owned) 3236 + if (!sk->sk_lock.owned) { 3232 3237 /* 3233 - * Note : We must disable BH 3238 + * Fast path return with bottom halves disabled and 3239 + * sock::sk_lock.slock held. 3240 + * 3241 + * The 'mutex' is not contended and holding 3242 + * sock::sk_lock.slock prevents all other lockers to 3243 + * proceed so the corresponding unlock_sock_fast() can 3244 + * avoid the slow path of release_sock() completely and 3245 + * just release slock. 3246 + * 3247 + * From a semantical POV this is equivalent to 'acquiring' 3248 + * the 'mutex', hence the corresponding lockdep 3249 + * mutex_release() has to happen in the fast path of 3250 + * unlock_sock_fast(). 3234 3251 */ 3235 3252 return false; 3253 + } 3236 3254 3237 3255 __lock_sock(sk); 3238 3256 sk->sk_lock.owned = 1; 3239 - spin_unlock(&sk->sk_lock.slock); 3240 - /* 3241 - * The sk_lock has mutex_lock() semantics here: 3242 - */ 3243 - mutex_acquire(&sk->sk_lock.dep_map, 0, 0, _RET_IP_); 3244 3257 __acquire(&sk->sk_lock.slock); 3245 - local_bh_enable(); 3258 + spin_unlock_bh(&sk->sk_lock.slock); 3246 3259 return true; 3247 3260 } 3248 3261 EXPORT_SYMBOL(lock_sock_fast);
+106 -8
net/dsa/dsa2.c
··· 429 429 { 430 430 struct devlink_port *dlp = &dp->devlink_port; 431 431 bool dsa_port_link_registered = false; 432 + struct dsa_switch *ds = dp->ds; 432 433 bool dsa_port_enabled = false; 433 434 int err = 0; 434 435 ··· 438 437 439 438 INIT_LIST_HEAD(&dp->fdbs); 440 439 INIT_LIST_HEAD(&dp->mdbs); 440 + 441 + if (ds->ops->port_setup) { 442 + err = ds->ops->port_setup(ds, dp->index); 443 + if (err) 444 + return err; 445 + } 441 446 442 447 switch (dp->type) { 443 448 case DSA_PORT_TYPE_UNUSED: ··· 487 480 dsa_port_disable(dp); 488 481 if (err && dsa_port_link_registered) 489 482 dsa_port_link_unregister_of(dp); 490 - if (err) 483 + if (err) { 484 + if (ds->ops->port_teardown) 485 + ds->ops->port_teardown(ds, dp->index); 491 486 return err; 487 + } 492 488 493 489 dp->setup = true; 494 490 ··· 543 533 static void dsa_port_teardown(struct dsa_port *dp) 544 534 { 545 535 struct devlink_port *dlp = &dp->devlink_port; 536 + struct dsa_switch *ds = dp->ds; 546 537 struct dsa_mac_addr *a, *tmp; 547 538 548 539 if (!dp->setup) 549 540 return; 541 + 542 + if (ds->ops->port_teardown) 543 + ds->ops->port_teardown(ds, dp->index); 550 544 551 545 devlink_port_type_clear(dlp); 552 546 ··· 593 579 if (dp->devlink_port_setup) 594 580 devlink_port_unregister(dlp); 595 581 dp->devlink_port_setup = false; 582 + } 583 + 584 + /* Destroy the current devlink port, and create a new one which has the UNUSED 585 + * flavour. At this point, any call to ds->ops->port_setup has been already 586 + * balanced out by a call to ds->ops->port_teardown, so we know that any 587 + * devlink port regions the driver had are now unregistered. We then call its 588 + * ds->ops->port_setup again, in order for the driver to re-create them on the 589 + * new devlink port. 590 + */ 591 + static int dsa_port_reinit_as_unused(struct dsa_port *dp) 592 + { 593 + struct dsa_switch *ds = dp->ds; 594 + int err; 595 + 596 + dsa_port_devlink_teardown(dp); 597 + dp->type = DSA_PORT_TYPE_UNUSED; 598 + err = dsa_port_devlink_setup(dp); 599 + if (err) 600 + return err; 601 + 602 + if (ds->ops->port_setup) { 603 + /* On error, leave the devlink port registered, 604 + * dsa_switch_teardown will clean it up later. 605 + */ 606 + err = ds->ops->port_setup(ds, dp->index); 607 + if (err) 608 + return err; 609 + } 610 + 611 + return 0; 596 612 } 597 613 598 614 static int dsa_devlink_info_get(struct devlink *dl, ··· 880 836 devlink_params_publish(ds->devlink); 881 837 882 838 if (!ds->slave_mii_bus && ds->ops->phy_read) { 883 - ds->slave_mii_bus = devm_mdiobus_alloc(ds->dev); 839 + ds->slave_mii_bus = mdiobus_alloc(); 884 840 if (!ds->slave_mii_bus) { 885 841 err = -ENOMEM; 886 842 goto teardown; ··· 890 846 891 847 err = mdiobus_register(ds->slave_mii_bus); 892 848 if (err < 0) 893 - goto teardown; 849 + goto free_slave_mii_bus; 894 850 } 895 851 896 852 ds->setup = true; 897 853 898 854 return 0; 899 855 856 + free_slave_mii_bus: 857 + if (ds->slave_mii_bus && ds->ops->phy_read) 858 + mdiobus_free(ds->slave_mii_bus); 900 859 teardown: 901 860 if (ds->ops->teardown) 902 861 ds->ops->teardown(ds); ··· 924 877 if (!ds->setup) 925 878 return; 926 879 927 - if (ds->slave_mii_bus && ds->ops->phy_read) 880 + if (ds->slave_mii_bus && ds->ops->phy_read) { 928 881 mdiobus_unregister(ds->slave_mii_bus); 882 + mdiobus_free(ds->slave_mii_bus); 883 + ds->slave_mii_bus = NULL; 884 + } 929 885 930 886 dsa_switch_unregister_notifier(ds); 931 887 ··· 988 938 list_for_each_entry(dp, &dst->ports, list) { 989 939 err = dsa_port_setup(dp); 990 940 if (err) { 991 - dsa_port_devlink_teardown(dp); 992 - dp->type = DSA_PORT_TYPE_UNUSED; 993 - err = dsa_port_devlink_setup(dp); 941 + err = dsa_port_reinit_as_unused(dp); 994 942 if (err) 995 943 goto teardown; 996 - continue; 997 944 } 998 945 } 999 946 ··· 1095 1048 teardown_master: 1096 1049 dsa_tree_teardown_master(dst); 1097 1050 teardown_switches: 1051 + dsa_tree_teardown_ports(dst); 1098 1052 dsa_tree_teardown_switches(dst); 1099 1053 teardown_cpu_ports: 1100 1054 dsa_tree_teardown_cpu_ports(dst); ··· 1610 1562 mutex_unlock(&dsa2_mutex); 1611 1563 } 1612 1564 EXPORT_SYMBOL_GPL(dsa_unregister_switch); 1565 + 1566 + /* If the DSA master chooses to unregister its net_device on .shutdown, DSA is 1567 + * blocking that operation from completion, due to the dev_hold taken inside 1568 + * netdev_upper_dev_link. Unlink the DSA slave interfaces from being uppers of 1569 + * the DSA master, so that the system can reboot successfully. 1570 + */ 1571 + void dsa_switch_shutdown(struct dsa_switch *ds) 1572 + { 1573 + struct net_device *master, *slave_dev; 1574 + LIST_HEAD(unregister_list); 1575 + struct dsa_port *dp; 1576 + 1577 + mutex_lock(&dsa2_mutex); 1578 + rtnl_lock(); 1579 + 1580 + list_for_each_entry(dp, &ds->dst->ports, list) { 1581 + if (dp->ds != ds) 1582 + continue; 1583 + 1584 + if (!dsa_port_is_user(dp)) 1585 + continue; 1586 + 1587 + master = dp->cpu_dp->master; 1588 + slave_dev = dp->slave; 1589 + 1590 + netdev_upper_dev_unlink(master, slave_dev); 1591 + /* Just unlinking ourselves as uppers of the master is not 1592 + * sufficient. When the master net device unregisters, that will 1593 + * also call dev_close, which we will catch as NETDEV_GOING_DOWN 1594 + * and trigger a dev_close on our own devices (dsa_slave_close). 1595 + * In turn, that will call dev_mc_unsync on the master's net 1596 + * device. If the master is also a DSA switch port, this will 1597 + * trigger dsa_slave_set_rx_mode which will call dev_mc_sync on 1598 + * its own master. Lockdep will complain about the fact that 1599 + * all cascaded masters have the same dsa_master_addr_list_lock_key, 1600 + * which it normally would not do if the cascaded masters would 1601 + * be in a proper upper/lower relationship, which we've just 1602 + * destroyed. 1603 + * To suppress the lockdep warnings, let's actually unregister 1604 + * the DSA slave interfaces too, to avoid the nonsensical 1605 + * multicast address list synchronization on shutdown. 1606 + */ 1607 + unregister_netdevice_queue(slave_dev, &unregister_list); 1608 + } 1609 + unregister_netdevice_many(&unregister_list); 1610 + 1611 + rtnl_unlock(); 1612 + mutex_unlock(&dsa2_mutex); 1613 + } 1614 + EXPORT_SYMBOL_GPL(dsa_switch_shutdown);
+1 -1
net/dsa/tag_ocelot.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 - /* Copyright 2019 NXP Semiconductors 2 + /* Copyright 2019 NXP 3 3 */ 4 4 #include <linux/dsa/ocelot.h> 5 5 #include <soc/mscc/ocelot.h>
+1 -1
net/dsa/tag_ocelot_8021q.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 - /* Copyright 2020-2021 NXP Semiconductors 2 + /* Copyright 2020-2021 NXP 3 3 * 4 4 * An implementation of the software-defined tag_8021q.c tagger format, which 5 5 * also preserves full functionality under a vlan_filtering bridge. It does
+16 -5
net/ipv4/nexthop.c
··· 1982 1982 rcu_assign_pointer(old->nh_grp, newg); 1983 1983 1984 1984 if (newg->resilient) { 1985 + /* Make sure concurrent readers are not using 'oldg' anymore. */ 1986 + synchronize_net(); 1985 1987 rcu_assign_pointer(oldg->res_table, tmp_table); 1986 1988 rcu_assign_pointer(oldg->spare->res_table, tmp_table); 1987 1989 } ··· 3567 3565 }; 3568 3566 3569 3567 static int nexthops_dump(struct net *net, struct notifier_block *nb, 3568 + enum nexthop_event_type event_type, 3570 3569 struct netlink_ext_ack *extack) 3571 3570 { 3572 3571 struct rb_root *root = &net->nexthop.rb_root; ··· 3578 3575 struct nexthop *nh; 3579 3576 3580 3577 nh = rb_entry(node, struct nexthop, rb_node); 3581 - err = call_nexthop_notifier(nb, net, NEXTHOP_EVENT_REPLACE, nh, 3582 - extack); 3578 + err = call_nexthop_notifier(nb, net, event_type, nh, extack); 3583 3579 if (err) 3584 3580 break; 3585 3581 } ··· 3592 3590 int err; 3593 3591 3594 3592 rtnl_lock(); 3595 - err = nexthops_dump(net, nb, extack); 3593 + err = nexthops_dump(net, nb, NEXTHOP_EVENT_REPLACE, extack); 3596 3594 if (err) 3597 3595 goto unlock; 3598 3596 err = blocking_notifier_chain_register(&net->nexthop.notifier_chain, ··· 3605 3603 3606 3604 int unregister_nexthop_notifier(struct net *net, struct notifier_block *nb) 3607 3605 { 3608 - return blocking_notifier_chain_unregister(&net->nexthop.notifier_chain, 3609 - nb); 3606 + int err; 3607 + 3608 + rtnl_lock(); 3609 + err = blocking_notifier_chain_unregister(&net->nexthop.notifier_chain, 3610 + nb); 3611 + if (err) 3612 + goto unlock; 3613 + nexthops_dump(net, nb, NEXTHOP_EVENT_DEL, NULL); 3614 + unlock: 3615 + rtnl_unlock(); 3616 + return err; 3610 3617 } 3611 3618 EXPORT_SYMBOL(unregister_nexthop_notifier); 3612 3619
+2 -2
net/mptcp/protocol.c
··· 1316 1316 goto alloc_skb; 1317 1317 } 1318 1318 1319 - must_collapse = (info->size_goal - skb->len > 0) && 1319 + must_collapse = (info->size_goal > skb->len) && 1320 1320 (skb_shinfo(skb)->nr_frags < sysctl_max_skb_frags); 1321 1321 if (must_collapse) { 1322 1322 size_bias = skb->len; ··· 1325 1325 } 1326 1326 1327 1327 alloc_skb: 1328 - if (!must_collapse && !ssk->sk_tx_skb_cache && 1328 + if (!must_collapse && 1329 1329 !mptcp_alloc_tx_skb(sk, ssk, info->data_lock_held)) 1330 1330 return 0; 1331 1331
+2 -1
net/smc/smc_clc.c
··· 230 230 goto out_rel; 231 231 } 232 232 /* get address to which the internal TCP socket is bound */ 233 - kernel_getsockname(clcsock, (struct sockaddr *)&addrs); 233 + if (kernel_getsockname(clcsock, (struct sockaddr *)&addrs) < 0) 234 + goto out_rel; 234 235 /* analyze IP specific data of net_device belonging to TCP socket */ 235 236 addr6 = (struct sockaddr_in6 *)&addrs; 236 237 rcu_read_lock();
+2
net/smc/smc_core.c
··· 1474 1474 abort_work); 1475 1475 struct smc_sock *smc = container_of(conn, struct smc_sock, conn); 1476 1476 1477 + lock_sock(&smc->sk); 1477 1478 smc_conn_kill(conn, true); 1479 + release_sock(&smc->sk); 1478 1480 sock_put(&smc->sk); /* sock_hold done by schedulers of abort_work */ 1479 1481 } 1480 1482
+2 -1
scripts/Makefile.kasan
··· 33 33 CFLAGS_KASAN := $(CFLAGS_KASAN_SHADOW) \ 34 34 $(call cc-param,asan-globals=1) \ 35 35 $(call cc-param,asan-instrumentation-with-call-threshold=$(call_threshold)) \ 36 - $(call cc-param,asan-stack=$(stack_enable)) \ 37 36 $(call cc-param,asan-instrument-allocas=1) 38 37 endif 38 + 39 + CFLAGS_KASAN += $(call cc-param,asan-stack=$(stack_enable)) 39 40 40 41 endif # CONFIG_KASAN_GENERIC 41 42
+4
scripts/sorttable.c
··· 54 54 #define EM_ARCV2 195 55 55 #endif 56 56 57 + #ifndef EM_RISCV 58 + #define EM_RISCV 243 59 + #endif 60 + 57 61 static uint32_t (*r)(const uint32_t *); 58 62 static uint16_t (*r2)(const uint16_t *); 59 63 static uint64_t (*r8)(const uint64_t *);
+2 -2
security/selinux/hooks.c
··· 2157 2157 static int selinux_ptrace_traceme(struct task_struct *parent) 2158 2158 { 2159 2159 return avc_has_perm(&selinux_state, 2160 - task_sid_subj(parent), task_sid_obj(current), 2160 + task_sid_obj(parent), task_sid_obj(current), 2161 2161 SECCLASS_PROCESS, PROCESS__PTRACE, NULL); 2162 2162 } 2163 2163 ··· 6222 6222 struct ipc_security_struct *isec; 6223 6223 struct msg_security_struct *msec; 6224 6224 struct common_audit_data ad; 6225 - u32 sid = task_sid_subj(target); 6225 + u32 sid = task_sid_obj(target); 6226 6226 int rc; 6227 6227 6228 6228 isec = selinux_ipc(msq);
+2 -2
security/smack/smack_lsm.c
··· 2016 2016 const char *caller) 2017 2017 { 2018 2018 struct smk_audit_info ad; 2019 - struct smack_known *skp = smk_of_task_struct_subj(p); 2019 + struct smack_known *skp = smk_of_task_struct_obj(p); 2020 2020 int rc; 2021 2021 2022 2022 smk_ad_init(&ad, caller, LSM_AUDIT_DATA_TASK); ··· 3480 3480 */ 3481 3481 static int smack_getprocattr(struct task_struct *p, char *name, char **value) 3482 3482 { 3483 - struct smack_known *skp = smk_of_task_struct_subj(p); 3483 + struct smack_known *skp = smk_of_task_struct_obj(p); 3484 3484 char *cp; 3485 3485 int slen; 3486 3486
tools/arch/x86/include/asm/unistd_32.h tools/arch/x86/include/uapi/asm/unistd_32.h
-3
tools/arch/x86/include/asm/unistd_64.h tools/arch/x86/include/uapi/asm/unistd_64.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef __NR_userfaultfd 3 - #define __NR_userfaultfd 282 4 - #endif 5 2 #ifndef __NR_perf_event_open 6 3 # define __NR_perf_event_open 298 7 4 #endif
+2 -2
tools/arch/x86/lib/insn.c
··· 37 37 ((insn)->next_byte + sizeof(t) + n <= (insn)->end_kaddr) 38 38 39 39 #define __get_next(t, insn) \ 40 - ({ t r = *(t*)insn->next_byte; insn->next_byte += sizeof(t); leXX_to_cpu(t, r); }) 40 + ({ t r; memcpy(&r, insn->next_byte, sizeof(t)); insn->next_byte += sizeof(t); leXX_to_cpu(t, r); }) 41 41 42 42 #define __peek_nbyte_next(t, insn, n) \ 43 - ({ t r = *(t*)((insn)->next_byte + n); leXX_to_cpu(t, r); }) 43 + ({ t r; memcpy(&r, (insn)->next_byte + n, sizeof(t)); leXX_to_cpu(t, r); }) 44 44 45 45 #define get_next(t, insn) \ 46 46 ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
+5 -2
tools/testing/selftests/arm64/signal/test_signals_utils.c
··· 266 266 td->feats_supported |= FEAT_SSBS; 267 267 if (getauxval(AT_HWCAP) & HWCAP_SVE) 268 268 td->feats_supported |= FEAT_SVE; 269 - if (feats_ok(td)) 269 + if (feats_ok(td)) { 270 270 fprintf(stderr, 271 271 "Required Features: [%s] supported\n", 272 272 feats_to_string(td->feats_required & 273 273 td->feats_supported)); 274 - else 274 + } else { 275 275 fprintf(stderr, 276 276 "Required Features: [%s] NOT supported\n", 277 277 feats_to_string(td->feats_required & 278 278 ~td->feats_supported)); 279 + td->result = KSFT_SKIP; 280 + return 0; 281 + } 279 282 } 280 283 281 284 /* Perform test specific additional initialization */
+1 -1
tools/testing/selftests/drivers/net/ocelot/tc_flower_chains.sh
··· 1 1 #!/bin/bash 2 2 # SPDX-License-Identifier: GPL-2.0 3 - # Copyright 2020 NXP Semiconductors 3 + # Copyright 2020 NXP 4 4 5 5 WAIT_TIME=1 6 6 NUM_NETIFS=4
+1
tools/testing/selftests/kvm/.gitignore
··· 48 48 /kvm_page_table_test 49 49 /memslot_modification_stress_test 50 50 /memslot_perf_test 51 + /rseq_test 51 52 /set_memory_region_test 52 53 /steal_time 53 54 /kvm_binary_stats_test
+3
tools/testing/selftests/kvm/Makefile
··· 80 80 TEST_GEN_PROGS_x86_64 += kvm_page_table_test 81 81 TEST_GEN_PROGS_x86_64 += memslot_modification_stress_test 82 82 TEST_GEN_PROGS_x86_64 += memslot_perf_test 83 + TEST_GEN_PROGS_x86_64 += rseq_test 83 84 TEST_GEN_PROGS_x86_64 += set_memory_region_test 84 85 TEST_GEN_PROGS_x86_64 += steal_time 85 86 TEST_GEN_PROGS_x86_64 += kvm_binary_stats_test ··· 94 93 TEST_GEN_PROGS_aarch64 += dirty_log_perf_test 95 94 TEST_GEN_PROGS_aarch64 += kvm_create_max_vcpus 96 95 TEST_GEN_PROGS_aarch64 += kvm_page_table_test 96 + TEST_GEN_PROGS_aarch64 += rseq_test 97 97 TEST_GEN_PROGS_aarch64 += set_memory_region_test 98 98 TEST_GEN_PROGS_aarch64 += steal_time 99 99 TEST_GEN_PROGS_aarch64 += kvm_binary_stats_test ··· 106 104 TEST_GEN_PROGS_s390x += dirty_log_test 107 105 TEST_GEN_PROGS_s390x += kvm_create_max_vcpus 108 106 TEST_GEN_PROGS_s390x += kvm_page_table_test 107 + TEST_GEN_PROGS_s390x += rseq_test 109 108 TEST_GEN_PROGS_s390x += set_memory_region_test 110 109 TEST_GEN_PROGS_s390x += kvm_binary_stats_test 111 110
+3
tools/testing/selftests/kvm/include/test_util.h
··· 95 95 uint32_t flag; 96 96 }; 97 97 98 + #define MIN_RUN_DELAY_NS 200000UL 99 + 98 100 bool thp_configured(void); 99 101 size_t get_trans_hugepagesz(void); 100 102 size_t get_def_hugetlb_pagesz(void); ··· 104 102 size_t get_backing_src_pagesz(uint32_t i); 105 103 void backing_src_help(void); 106 104 enum vm_mem_backing_src_type parse_backing_src_type(const char *type_name); 105 + long get_run_delay(void); 107 106 108 107 /* 109 108 * Whether or not the given source type is shared memory (as opposed to
+21 -1
tools/testing/selftests/kvm/lib/test_util.c
··· 11 11 #include <stdlib.h> 12 12 #include <time.h> 13 13 #include <sys/stat.h> 14 + #include <sys/syscall.h> 14 15 #include <linux/mman.h> 15 16 #include "linux/kernel.h" 16 17 ··· 130 129 { 131 130 size_t size; 132 131 FILE *f; 132 + int ret; 133 133 134 134 TEST_ASSERT(thp_configured(), "THP is not configured in host kernel"); 135 135 136 136 f = fopen("/sys/kernel/mm/transparent_hugepage/hpage_pmd_size", "r"); 137 137 TEST_ASSERT(f != NULL, "Error in opening transparent_hugepage/hpage_pmd_size"); 138 138 139 - fscanf(f, "%ld", &size); 139 + ret = fscanf(f, "%ld", &size); 140 + ret = fscanf(f, "%ld", &size); 141 + TEST_ASSERT(ret < 1, "Error reading transparent_hugepage/hpage_pmd_size"); 140 142 fclose(f); 141 143 142 144 return size; ··· 303 299 backing_src_help(); 304 300 TEST_FAIL("Unknown backing src type: %s", type_name); 305 301 return -1; 302 + } 303 + 304 + long get_run_delay(void) 305 + { 306 + char path[64]; 307 + long val[2]; 308 + FILE *fp; 309 + 310 + sprintf(path, "/proc/%ld/schedstat", syscall(SYS_gettid)); 311 + fp = fopen(path, "r"); 312 + /* Return MIN_RUN_DELAY_NS upon failure just to be safe */ 313 + if (fscanf(fp, "%ld %ld ", &val[0], &val[1]) < 2) 314 + val[1] = MIN_RUN_DELAY_NS; 315 + fclose(fp); 316 + 317 + return val[1]; 306 318 }
+236
tools/testing/selftests/kvm/rseq_test.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + #define _GNU_SOURCE /* for program_invocation_short_name */ 3 + #include <errno.h> 4 + #include <fcntl.h> 5 + #include <pthread.h> 6 + #include <sched.h> 7 + #include <stdio.h> 8 + #include <stdlib.h> 9 + #include <string.h> 10 + #include <signal.h> 11 + #include <syscall.h> 12 + #include <sys/ioctl.h> 13 + #include <asm/barrier.h> 14 + #include <linux/atomic.h> 15 + #include <linux/rseq.h> 16 + #include <linux/unistd.h> 17 + 18 + #include "kvm_util.h" 19 + #include "processor.h" 20 + #include "test_util.h" 21 + 22 + #define VCPU_ID 0 23 + 24 + static __thread volatile struct rseq __rseq = { 25 + .cpu_id = RSEQ_CPU_ID_UNINITIALIZED, 26 + }; 27 + 28 + /* 29 + * Use an arbitrary, bogus signature for configuring rseq, this test does not 30 + * actually enter an rseq critical section. 31 + */ 32 + #define RSEQ_SIG 0xdeadbeef 33 + 34 + /* 35 + * Any bug related to task migration is likely to be timing-dependent; perform 36 + * a large number of migrations to reduce the odds of a false negative. 37 + */ 38 + #define NR_TASK_MIGRATIONS 100000 39 + 40 + static pthread_t migration_thread; 41 + static cpu_set_t possible_mask; 42 + static bool done; 43 + 44 + static atomic_t seq_cnt; 45 + 46 + static void guest_code(void) 47 + { 48 + for (;;) 49 + GUEST_SYNC(0); 50 + } 51 + 52 + static void sys_rseq(int flags) 53 + { 54 + int r; 55 + 56 + r = syscall(__NR_rseq, &__rseq, sizeof(__rseq), flags, RSEQ_SIG); 57 + TEST_ASSERT(!r, "rseq failed, errno = %d (%s)", errno, strerror(errno)); 58 + } 59 + 60 + static void *migration_worker(void *ign) 61 + { 62 + cpu_set_t allowed_mask; 63 + int r, i, nr_cpus, cpu; 64 + 65 + CPU_ZERO(&allowed_mask); 66 + 67 + nr_cpus = CPU_COUNT(&possible_mask); 68 + 69 + for (i = 0; i < NR_TASK_MIGRATIONS; i++) { 70 + cpu = i % nr_cpus; 71 + if (!CPU_ISSET(cpu, &possible_mask)) 72 + continue; 73 + 74 + CPU_SET(cpu, &allowed_mask); 75 + 76 + /* 77 + * Bump the sequence count twice to allow the reader to detect 78 + * that a migration may have occurred in between rseq and sched 79 + * CPU ID reads. An odd sequence count indicates a migration 80 + * is in-progress, while a completely different count indicates 81 + * a migration occurred since the count was last read. 82 + */ 83 + atomic_inc(&seq_cnt); 84 + 85 + /* 86 + * Ensure the odd count is visible while sched_getcpu() isn't 87 + * stable, i.e. while changing affinity is in-progress. 88 + */ 89 + smp_wmb(); 90 + r = sched_setaffinity(0, sizeof(allowed_mask), &allowed_mask); 91 + TEST_ASSERT(!r, "sched_setaffinity failed, errno = %d (%s)", 92 + errno, strerror(errno)); 93 + smp_wmb(); 94 + atomic_inc(&seq_cnt); 95 + 96 + CPU_CLR(cpu, &allowed_mask); 97 + 98 + /* 99 + * Wait 1-10us before proceeding to the next iteration and more 100 + * specifically, before bumping seq_cnt again. A delay is 101 + * needed on three fronts: 102 + * 103 + * 1. To allow sched_setaffinity() to prompt migration before 104 + * ioctl(KVM_RUN) enters the guest so that TIF_NOTIFY_RESUME 105 + * (or TIF_NEED_RESCHED, which indirectly leads to handling 106 + * NOTIFY_RESUME) is handled in KVM context. 107 + * 108 + * If NOTIFY_RESUME/NEED_RESCHED is set after KVM enters 109 + * the guest, the guest will trigger a IO/MMIO exit all the 110 + * way to userspace and the TIF flags will be handled by 111 + * the generic "exit to userspace" logic, not by KVM. The 112 + * exit to userspace is necessary to give the test a chance 113 + * to check the rseq CPU ID (see #2). 114 + * 115 + * Alternatively, guest_code() could include an instruction 116 + * to trigger an exit that is handled by KVM, but any such 117 + * exit requires architecture specific code. 118 + * 119 + * 2. To let ioctl(KVM_RUN) make its way back to the test 120 + * before the next round of migration. The test's check on 121 + * the rseq CPU ID must wait for migration to complete in 122 + * order to avoid false positive, thus any kernel rseq bug 123 + * will be missed if the next migration starts before the 124 + * check completes. 125 + * 126 + * 3. To ensure the read-side makes efficient forward progress, 127 + * e.g. if sched_getcpu() involves a syscall. Stalling the 128 + * read-side means the test will spend more time waiting for 129 + * sched_getcpu() to stabilize and less time trying to hit 130 + * the timing-dependent bug. 131 + * 132 + * Because any bug in this area is likely to be timing-dependent, 133 + * run with a range of delays at 1us intervals from 1us to 10us 134 + * as a best effort to avoid tuning the test to the point where 135 + * it can hit _only_ the original bug and not detect future 136 + * regressions. 137 + * 138 + * The original bug can reproduce with a delay up to ~500us on 139 + * x86-64, but starts to require more iterations to reproduce 140 + * as the delay creeps above ~10us, and the average runtime of 141 + * each iteration obviously increases as well. Cap the delay 142 + * at 10us to keep test runtime reasonable while minimizing 143 + * potential coverage loss. 144 + * 145 + * The lower bound for reproducing the bug is likely below 1us, 146 + * e.g. failures occur on x86-64 with nanosleep(0), but at that 147 + * point the overhead of the syscall likely dominates the delay. 148 + * Use usleep() for simplicity and to avoid unnecessary kernel 149 + * dependencies. 150 + */ 151 + usleep((i % 10) + 1); 152 + } 153 + done = true; 154 + return NULL; 155 + } 156 + 157 + int main(int argc, char *argv[]) 158 + { 159 + int r, i, snapshot; 160 + struct kvm_vm *vm; 161 + u32 cpu, rseq_cpu; 162 + 163 + /* Tell stdout not to buffer its content */ 164 + setbuf(stdout, NULL); 165 + 166 + r = sched_getaffinity(0, sizeof(possible_mask), &possible_mask); 167 + TEST_ASSERT(!r, "sched_getaffinity failed, errno = %d (%s)", errno, 168 + strerror(errno)); 169 + 170 + if (CPU_COUNT(&possible_mask) < 2) { 171 + print_skip("Only one CPU, task migration not possible\n"); 172 + exit(KSFT_SKIP); 173 + } 174 + 175 + sys_rseq(0); 176 + 177 + /* 178 + * Create and run a dummy VM that immediately exits to userspace via 179 + * GUEST_SYNC, while concurrently migrating the process by setting its 180 + * CPU affinity. 181 + */ 182 + vm = vm_create_default(VCPU_ID, 0, guest_code); 183 + 184 + pthread_create(&migration_thread, NULL, migration_worker, 0); 185 + 186 + for (i = 0; !done; i++) { 187 + vcpu_run(vm, VCPU_ID); 188 + TEST_ASSERT(get_ucall(vm, VCPU_ID, NULL) == UCALL_SYNC, 189 + "Guest failed?"); 190 + 191 + /* 192 + * Verify rseq's CPU matches sched's CPU. Ensure migration 193 + * doesn't occur between sched_getcpu() and reading the rseq 194 + * cpu_id by rereading both if the sequence count changes, or 195 + * if the count is odd (migration in-progress). 196 + */ 197 + do { 198 + /* 199 + * Drop bit 0 to force a mismatch if the count is odd, 200 + * i.e. if a migration is in-progress. 201 + */ 202 + snapshot = atomic_read(&seq_cnt) & ~1; 203 + 204 + /* 205 + * Ensure reading sched_getcpu() and rseq.cpu_id 206 + * complete in a single "no migration" window, i.e. are 207 + * not reordered across the seq_cnt reads. 208 + */ 209 + smp_rmb(); 210 + cpu = sched_getcpu(); 211 + rseq_cpu = READ_ONCE(__rseq.cpu_id); 212 + smp_rmb(); 213 + } while (snapshot != atomic_read(&seq_cnt)); 214 + 215 + TEST_ASSERT(rseq_cpu == cpu, 216 + "rseq CPU = %d, sched CPU = %d\n", rseq_cpu, cpu); 217 + } 218 + 219 + /* 220 + * Sanity check that the test was able to enter the guest a reasonable 221 + * number of times, e.g. didn't get stalled too often/long waiting for 222 + * sched_getcpu() to stabilize. A 2:1 migration:KVM_RUN ratio is a 223 + * fairly conservative ratio on x86-64, which can do _more_ KVM_RUNs 224 + * than migrations given the 1us+ delay in the migration task. 225 + */ 226 + TEST_ASSERT(i > (NR_TASK_MIGRATIONS / 2), 227 + "Only performed %d KVM_RUNs, task stalled too much?\n", i); 228 + 229 + pthread_join(migration_thread, NULL); 230 + 231 + kvm_vm_free(vm); 232 + 233 + sys_rseq(RSEQ_FLAG_UNREGISTER); 234 + 235 + return 0; 236 + }
-16
tools/testing/selftests/kvm/steal_time.c
··· 10 10 #include <sched.h> 11 11 #include <pthread.h> 12 12 #include <linux/kernel.h> 13 - #include <sys/syscall.h> 14 13 #include <asm/kvm.h> 15 14 #include <asm/kvm_para.h> 16 15 ··· 19 20 20 21 #define NR_VCPUS 4 21 22 #define ST_GPA_BASE (1 << 30) 22 - #define MIN_RUN_DELAY_NS 200000UL 23 23 24 24 static void *st_gva[NR_VCPUS]; 25 25 static uint64_t guest_stolen_time[NR_VCPUS]; ··· 214 216 } 215 217 216 218 #endif 217 - 218 - static long get_run_delay(void) 219 - { 220 - char path[64]; 221 - long val[2]; 222 - FILE *fp; 223 - 224 - sprintf(path, "/proc/%ld/schedstat", syscall(SYS_gettid)); 225 - fp = fopen(path, "r"); 226 - fscanf(fp, "%ld %ld ", &val[0], &val[1]); 227 - fclose(fp); 228 - 229 - return val[1]; 230 - } 231 219 232 220 static void *do_steal_time(void *arg) 233 221 {
+2 -1
tools/testing/selftests/kvm/x86_64/mmio_warning_test.c
··· 82 82 FILE *f; 83 83 84 84 f = popen("dmesg | grep \"WARNING:\" | wc -l", "r"); 85 - fscanf(f, "%d", &warnings); 85 + if (fscanf(f, "%d", &warnings) < 1) 86 + warnings = 0; 86 87 fclose(f); 87 88 88 89 return warnings;
-15
tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c
··· 14 14 #include <stdint.h> 15 15 #include <time.h> 16 16 #include <sched.h> 17 - #include <sys/syscall.h> 18 17 19 18 #define VCPU_ID 5 20 19 ··· 95 96 GUEST_ASSERT(rs->time[RUNSTATE_runnable] >= MIN_STEAL_TIME); 96 97 97 98 GUEST_DONE(); 98 - } 99 - 100 - static long get_run_delay(void) 101 - { 102 - char path[64]; 103 - long val[2]; 104 - FILE *fp; 105 - 106 - sprintf(path, "/proc/%ld/schedstat", syscall(SYS_gettid)); 107 - fp = fopen(path, "r"); 108 - fscanf(fp, "%ld %ld ", &val[0], &val[1]); 109 - fclose(fp); 110 - 111 - return val[1]; 112 99 } 113 100 114 101 static int cmp_timespec(struct timespec *a, struct timespec *b)
+1
tools/testing/selftests/lib.mk
··· 48 48 # When local build is done, headers are installed in the default 49 49 # INSTALL_HDR_PATH usr/include. 50 50 .PHONY: khdr 51 + .NOTPARALLEL: 51 52 khdr: 52 53 ifndef KSFT_KHDR_INSTALL_DONE 53 54 ifeq (1,$(DEFAULT_INSTALL_HDR_PATH))
+1 -4
tools/testing/selftests/net/af_unix/Makefile
··· 1 - ##TEST_GEN_FILES := test_unix_oob 2 - TEST_PROGS := test_unix_oob 1 + TEST_GEN_PROGS := test_unix_oob 3 2 include ../../lib.mk 4 - 5 - all: $(TEST_PROGS)
+3 -2
tools/testing/selftests/net/af_unix/test_unix_oob.c
··· 271 271 read_oob(pfd, &oob); 272 272 273 273 if (!signal_recvd || len != 127 || oob != '%' || atmark != 1) { 274 - fprintf(stderr, "Test 3 failed, sigurg %d len %d OOB %c ", 275 - "atmark %d\n", signal_recvd, len, oob, atmark); 274 + fprintf(stderr, 275 + "Test 3 failed, sigurg %d len %d OOB %c atmark %d\n", 276 + signal_recvd, len, oob, atmark); 276 277 die(1); 277 278 } 278 279
+8 -6
tools/usb/testusb.c
··· 265 265 } 266 266 267 267 entry->ifnum = ifnum; 268 - 269 - /* FIXME update USBDEVFS_CONNECTINFO so it tells about high speed etc */ 270 - 271 - fprintf(stderr, "%s speed\t%s\t%u\n", 272 - speed(entry->speed), entry->name, entry->ifnum); 273 - 274 268 entry->next = testdevs; 275 269 testdevs = entry; 276 270 return 0; ··· 292 298 perror ("can't open dev file r/w"); 293 299 return 0; 294 300 } 301 + 302 + status = ioctl(fd, USBDEVFS_GET_SPEED, NULL); 303 + if (status < 0) 304 + fprintf(stderr, "USBDEVFS_GET_SPEED failed %d\n", status); 305 + else 306 + dev->speed = status; 307 + fprintf(stderr, "%s speed\t%s\t%u\n", 308 + speed(dev->speed), dev->name, dev->ifnum); 295 309 296 310 restart: 297 311 for (i = 0; i < TEST_CASES; i++) {
+1 -1
tools/vm/page-types.c
··· 1331 1331 if (opt_list && opt_list_mapcnt) 1332 1332 kpagecount_fd = checked_open(PROC_KPAGECOUNT, O_RDONLY); 1333 1333 1334 - if (opt_mark_idle && opt_file) 1334 + if (opt_mark_idle) 1335 1335 page_idle_fd = checked_open(SYS_KERNEL_MM_PAGE_IDLE, O_RDWR); 1336 1336 1337 1337 if (opt_list && opt_pid)