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

Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

net/mptcp/protocol.c
977d293e23b4 ("mptcp: ensure tx skbs always have the MPTCP ext")
efe686ffce01 ("mptcp: ensure tx skbs always have the MPTCP ext")

same patch merged in both trees, keep net-next.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+3501 -1321
+1 -1
Documentation/devicetree/bindings/arm/tegra.yaml
··· 54 54 - const: toradex,apalis_t30 55 55 - const: nvidia,tegra30 56 56 - items: 57 - - const: toradex,apalis_t30-eval-v1.1 57 + - const: toradex,apalis_t30-v1.1-eval 58 58 - const: toradex,apalis_t30-eval 59 59 - const: toradex,apalis_t30-v1.1 60 60 - const: toradex,apalis_t30
+1 -1
Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
··· 9 9 10 10 All DISP device tree nodes must be siblings to the central MMSYS_CONFIG node. 11 11 For a description of the MMSYS_CONFIG binding, see 12 - Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.txt. 12 + Documentation/devicetree/bindings/arm/mediatek/mediatek,mmsys.yaml. 13 13 14 14 DISP function blocks 15 15 ====================
+89
Documentation/devicetree/bindings/ufs/samsung,exynos-ufs.yaml
··· 1 + # SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/ufs/samsung,exynos-ufs.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Samsung SoC series UFS host controller Device Tree Bindings 8 + 9 + maintainers: 10 + - Alim Akhtar <alim.akhtar@samsung.com> 11 + 12 + description: | 13 + Each Samsung UFS host controller instance should have its own node. 14 + This binding define Samsung specific binding other then what is used 15 + in the common ufshcd bindings 16 + [1] Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt 17 + 18 + properties: 19 + 20 + compatible: 21 + enum: 22 + - samsung,exynos7-ufs 23 + 24 + reg: 25 + items: 26 + - description: HCI register 27 + - description: vendor specific register 28 + - description: unipro register 29 + - description: UFS protector register 30 + 31 + reg-names: 32 + items: 33 + - const: hci 34 + - const: vs_hci 35 + - const: unipro 36 + - const: ufsp 37 + 38 + clocks: 39 + items: 40 + - description: ufs link core clock 41 + - description: unipro main clock 42 + 43 + clock-names: 44 + items: 45 + - const: core_clk 46 + - const: sclk_unipro_main 47 + 48 + interrupts: 49 + maxItems: 1 50 + 51 + phys: 52 + maxItems: 1 53 + 54 + phy-names: 55 + const: ufs-phy 56 + 57 + required: 58 + - compatible 59 + - reg 60 + - interrupts 61 + - phys 62 + - phy-names 63 + - clocks 64 + - clock-names 65 + 66 + additionalProperties: false 67 + 68 + examples: 69 + - | 70 + #include <dt-bindings/interrupt-controller/arm-gic.h> 71 + #include <dt-bindings/clock/exynos7-clk.h> 72 + 73 + ufs: ufs@15570000 { 74 + compatible = "samsung,exynos7-ufs"; 75 + reg = <0x15570000 0x100>, 76 + <0x15570100 0x100>, 77 + <0x15571000 0x200>, 78 + <0x15572000 0x300>; 79 + reg-names = "hci", "vs_hci", "unipro", "ufsp"; 80 + interrupts = <GIC_SPI 200 IRQ_TYPE_LEVEL_HIGH>; 81 + clocks = <&clock_fsys1 ACLK_UFS20_LINK>, 82 + <&clock_fsys1 SCLK_UFSUNIPRO20_USER>; 83 + clock-names = "core_clk", "sclk_unipro_main"; 84 + pinctrl-names = "default"; 85 + pinctrl-0 = <&ufs_rst_n &ufs_refclk_out>; 86 + phys = <&ufs_phy>; 87 + phy-names = "ufs-phy"; 88 + }; 89 + ...
+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
+1 -1
Documentation/networking/dsa/sja1105.rst
··· 296 296 Device Tree bindings and board design 297 297 ===================================== 298 298 299 - This section references ``Documentation/devicetree/bindings/net/dsa/sja1105.txt`` 299 + This section references ``Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml`` 300 300 and aims to showcase some potential switch caveats. 301 301 302 302 RMII PHY role and out-of-band signaling
+11 -11
MAINTAINERS
··· 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) ··· 14341 14342 F: drivers/pci/controller/pci-ixp4xx.c 14342 14343 14343 14344 PCI DRIVER FOR INTEL VOLUME MANAGEMENT DEVICE (VMD) 14344 - M: Jonathan Derrick <jonathan.derrick@intel.com> 14345 + M: Nirmal Patel <nirmal.patel@linux.intel.com> 14346 + R: Jonathan Derrick <jonathan.derrick@linux.dev> 14345 14347 L: linux-pci@vger.kernel.org 14346 14348 S: Supported 14347 14349 F: drivers/pci/controller/vmd.c ··· 16955 16955 16956 16956 SHARED MEMORY COMMUNICATIONS (SMC) SOCKETS 16957 16957 M: Karsten Graul <kgraul@linux.ibm.com> 16958 - M: Guvenc Gulce <guvenc@linux.ibm.com> 16959 16958 L: linux-s390@vger.kernel.org 16960 16959 S: Supported 16961 16960 W: http://www.ibm.com/developerworks/linux/linux390/ ··· 17967 17968 F: arch/x86/boot/video* 17968 17969 17969 17970 SWIOTLB SUBSYSTEM 17970 - M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> 17971 + M: Christoph Hellwig <hch@infradead.org> 17971 17972 L: iommu@lists.linux-foundation.org 17972 17973 S: Supported 17973 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb.git 17974 + W: http://git.infradead.org/users/hch/dma-mapping.git 17975 + T: git git://git.infradead.org/users/hch/dma-mapping.git 17974 17976 F: arch/*/kernel/pci-swiotlb.c 17975 17977 F: include/linux/swiotlb.h 17976 17978 F: kernel/dma/swiotlb.c ··· 20474 20474 F: tools/lib/bpf/xsk* 20475 20475 20476 20476 XEN BLOCK SUBSYSTEM 20477 - M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> 20478 20477 M: Roger Pau Monné <roger.pau@citrix.com> 20479 20478 L: xen-devel@lists.xenproject.org (moderated for non-subscribers) 20480 20479 S: Supported ··· 20521 20522 F: drivers/net/xen-netback/* 20522 20523 20523 20524 XEN PCI SUBSYSTEM 20524 - M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> 20525 + M: Juergen Gross <jgross@suse.com> 20525 20526 L: xen-devel@lists.xenproject.org (moderated for non-subscribers) 20526 20527 S: Supported 20527 20528 F: arch/x86/pci/*xen* ··· 20544 20545 F: sound/xen/* 20545 20546 20546 20547 XEN SWIOTLB SUBSYSTEM 20547 - M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> 20548 + M: Juergen Gross <jgross@suse.com> 20549 + M: Stefano Stabellini <sstabellini@kernel.org> 20548 20550 L: xen-devel@lists.xenproject.org (moderated for non-subscribers) 20549 20551 L: iommu@lists.linux-foundation.org 20550 20552 S: Supported
+1 -1
Makefile
··· 2 2 VERSION = 5 3 3 PATCHLEVEL = 15 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc1 5 + EXTRAVERSION = -rc2 6 6 NAME = Opossums on Parade 7 7 8 8 # *DOCUMENTATION*
+1 -2
arch/alpha/Kconfig
··· 20 20 select NEED_SG_DMA_LENGTH 21 21 select VIRT_TO_BUS 22 22 select GENERIC_IRQ_PROBE 23 - select GENERIC_PCI_IOMAP if PCI 23 + select GENERIC_PCI_IOMAP 24 24 select AUTO_IRQ_AFFINITY if SMP 25 25 select GENERIC_IRQ_SHOW 26 26 select ARCH_WANT_IPC_PARSE_VERSION ··· 199 199 200 200 config ALPHA_JENSEN 201 201 bool "Jensen" 202 - depends on BROKEN 203 202 select HAVE_EISA 204 203 help 205 204 DEC PC 150 AXP (aka Jensen): This is a very old Digital system - one
+1
arch/alpha/include/asm/asm-prototypes.h
··· 16 16 extern void __remlu(void); 17 17 extern void __divqu(void); 18 18 extern void __remqu(void); 19 + extern unsigned long __udiv_qrnnd(unsigned long *, unsigned long, unsigned long , unsigned long);
+4 -4
arch/alpha/include/asm/jensen.h
··· 111 111 * convinced that I need one of the newer machines. 112 112 */ 113 113 114 - static inline unsigned int jensen_local_inb(unsigned long addr) 114 + __EXTERN_INLINE unsigned int jensen_local_inb(unsigned long addr) 115 115 { 116 116 return 0xff & *(vuip)((addr << 9) + EISA_VL82C106); 117 117 } 118 118 119 - static inline void jensen_local_outb(u8 b, unsigned long addr) 119 + __EXTERN_INLINE void jensen_local_outb(u8 b, unsigned long addr) 120 120 { 121 121 *(vuip)((addr << 9) + EISA_VL82C106) = b; 122 122 mb(); 123 123 } 124 124 125 - static inline unsigned int jensen_bus_inb(unsigned long addr) 125 + __EXTERN_INLINE unsigned int jensen_bus_inb(unsigned long addr) 126 126 { 127 127 long result; 128 128 ··· 131 131 return __kernel_extbl(result, addr & 3); 132 132 } 133 133 134 - static inline void jensen_bus_outb(u8 b, unsigned long addr) 134 + __EXTERN_INLINE void jensen_bus_outb(u8 b, unsigned long addr) 135 135 { 136 136 jensen_set_hae(0); 137 137 *(vuip)((addr << 7) + EISA_IO + 0x00) = b * 0x01010101;
+5 -5
arch/alpha/kernel/sys_jensen.c
··· 7 7 * 8 8 * Code supporting the Jensen. 9 9 */ 10 + #define __EXTERN_INLINE 11 + #include <asm/io.h> 12 + #include <asm/jensen.h> 13 + #undef __EXTERN_INLINE 14 + 10 15 #include <linux/interrupt.h> 11 16 #include <linux/kernel.h> 12 17 #include <linux/types.h> ··· 21 16 #include <linux/init.h> 22 17 23 18 #include <asm/ptrace.h> 24 - 25 - #define __EXTERN_INLINE inline 26 - #include <asm/io.h> 27 - #include <asm/jensen.h> 28 - #undef __EXTERN_INLINE 29 19 30 20 #include <asm/dma.h> 31 21 #include <asm/irq.h>
+1
arch/alpha/lib/Makefile
··· 14 14 ev67-$(CONFIG_ALPHA_EV67) := ev67- 15 15 16 16 lib-y = __divqu.o __remqu.o __divlu.o __remlu.o \ 17 + udiv-qrnnd.o \ 17 18 udelay.o \ 18 19 $(ev6-y)memset.o \ 19 20 $(ev6-y)memcpy.o \
+1 -1
arch/alpha/math-emu/Makefile
··· 7 7 8 8 obj-$(CONFIG_MATHEMU) += math-emu.o 9 9 10 - math-emu-objs := math.o qrnnd.o 10 + math-emu-objs := math.o
-2
arch/alpha/math-emu/math.c
··· 403 403 egress: 404 404 return si_code; 405 405 } 406 - 407 - EXPORT_SYMBOL(__udiv_qrnnd);
+2
arch/alpha/math-emu/qrnnd.S arch/alpha/lib/udiv-qrnnd.S
··· 25 25 # along with GCC; see the file COPYING. If not, write to the 26 26 # Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 27 27 # MA 02111-1307, USA. 28 + #include <asm/export.h> 28 29 29 30 .set noreorder 30 31 .set noat ··· 162 161 ret $31,($26),1 163 162 164 163 .end __udiv_qrnnd 164 + EXPORT_SYMBOL(__udiv_qrnnd)
+1 -1
arch/arm64/kernel/fpsimd.c
··· 513 513 void sve_alloc(struct task_struct *task) 514 514 { 515 515 if (task->thread.sve_state) { 516 - memset(task->thread.sve_state, 0, sve_state_size(current)); 516 + memset(task->thread.sve_state, 0, sve_state_size(task)); 517 517 return; 518 518 } 519 519
+1 -2
arch/arm64/kernel/process.c
··· 18 18 #include <linux/mman.h> 19 19 #include <linux/mm.h> 20 20 #include <linux/nospec.h> 21 - #include <linux/sched.h> 22 21 #include <linux/stddef.h> 23 22 #include <linux/sysctl.h> 24 23 #include <linux/unistd.h> ··· 57 58 58 59 #if defined(CONFIG_STACKPROTECTOR) && !defined(CONFIG_STACKPROTECTOR_PER_TASK) 59 60 #include <linux/stackprotector.h> 60 - unsigned long __stack_chk_guard __read_mostly; 61 + unsigned long __stack_chk_guard __ro_after_init; 61 62 EXPORT_SYMBOL(__stack_chk_guard); 62 63 #endif 63 64
+3 -1
arch/parisc/lib/iomap.c
··· 513 513 } 514 514 } 515 515 516 + #ifdef CONFIG_PCI 516 517 void pci_iounmap(struct pci_dev *dev, void __iomem * addr) 517 518 { 518 519 if (!INDIRECT_ADDR(addr)) { 519 520 iounmap(addr); 520 521 } 521 522 } 523 + EXPORT_SYMBOL(pci_iounmap); 524 + #endif 522 525 523 526 EXPORT_SYMBOL(ioread8); 524 527 EXPORT_SYMBOL(ioread16); ··· 547 544 EXPORT_SYMBOL(iowrite32_rep); 548 545 EXPORT_SYMBOL(ioport_map); 549 546 EXPORT_SYMBOL(ioport_unmap); 550 - EXPORT_SYMBOL(pci_iounmap);
+43
arch/powerpc/kernel/interrupt.c
··· 18 18 #include <asm/switch_to.h> 19 19 #include <asm/syscall.h> 20 20 #include <asm/time.h> 21 + #include <asm/tm.h> 21 22 #include <asm/unistd.h> 22 23 23 24 #if defined(CONFIG_PPC_ADV_DEBUG_REGS) && defined(CONFIG_PPC32) ··· 136 135 * returns to user with IRQS_ENABLED, this store could be avoided! 137 136 */ 138 137 irq_soft_mask_regs_set_state(regs, IRQS_ENABLED); 138 + 139 + /* 140 + * If system call is called with TM active, set _TIF_RESTOREALL to 141 + * prevent RFSCV being used to return to userspace, because POWER9 142 + * TM implementation has problems with this instruction returning to 143 + * transactional state. Final register values are not relevant because 144 + * the transaction will be aborted upon return anyway. Or in the case 145 + * of unsupported_scv SIGILL fault, the return state does not much 146 + * matter because it's an edge case. 147 + */ 148 + if (IS_ENABLED(CONFIG_PPC_TRANSACTIONAL_MEM) && 149 + unlikely(MSR_TM_TRANSACTIONAL(regs->msr))) 150 + current_thread_info()->flags |= _TIF_RESTOREALL; 151 + 152 + /* 153 + * If the system call was made with a transaction active, doom it and 154 + * return without performing the system call. Unless it was an 155 + * unsupported scv vector, in which case it's treated like an illegal 156 + * instruction. 157 + */ 158 + #ifdef CONFIG_PPC_TRANSACTIONAL_MEM 159 + if (unlikely(MSR_TM_TRANSACTIONAL(regs->msr)) && 160 + !trap_is_unsupported_scv(regs)) { 161 + /* Enable TM in the kernel, and disable EE (for scv) */ 162 + hard_irq_disable(); 163 + mtmsr(mfmsr() | MSR_TM); 164 + 165 + /* tabort, this dooms the transaction, nothing else */ 166 + asm volatile(".long 0x7c00071d | ((%0) << 16)" 167 + :: "r"(TM_CAUSE_SYSCALL|TM_CAUSE_PERSISTENT)); 168 + 169 + /* 170 + * Userspace will never see the return value. Execution will 171 + * resume after the tbegin. of the aborted transaction with the 172 + * checkpointed register state. A context switch could occur 173 + * or signal delivered to the process before resuming the 174 + * doomed transaction context, but that should all be handled 175 + * as expected. 176 + */ 177 + return -ENOSYS; 178 + } 179 + #endif // CONFIG_PPC_TRANSACTIONAL_MEM 139 180 140 181 local_irq_enable(); 141 182
-41
arch/powerpc/kernel/interrupt_64.S
··· 12 12 #include <asm/mmu.h> 13 13 #include <asm/ppc_asm.h> 14 14 #include <asm/ptrace.h> 15 - #include <asm/tm.h> 16 15 17 16 .section ".toc","aw" 18 17 SYS_CALL_TABLE: ··· 54 55 .globl system_call_vectored_\name 55 56 system_call_vectored_\name: 56 57 _ASM_NOKPROBE_SYMBOL(system_call_vectored_\name) 57 - #ifdef CONFIG_PPC_TRANSACTIONAL_MEM 58 - BEGIN_FTR_SECTION 59 - extrdi. r10, r12, 1, (63-MSR_TS_T_LG) /* transaction active? */ 60 - bne tabort_syscall 61 - END_FTR_SECTION_IFSET(CPU_FTR_TM) 62 - #endif 63 58 SCV_INTERRUPT_TO_KERNEL 64 59 mr r10,r1 65 60 ld r1,PACAKSAVE(r13) ··· 240 247 .globl system_call_common 241 248 system_call_common: 242 249 _ASM_NOKPROBE_SYMBOL(system_call_common) 243 - #ifdef CONFIG_PPC_TRANSACTIONAL_MEM 244 - BEGIN_FTR_SECTION 245 - extrdi. r10, r12, 1, (63-MSR_TS_T_LG) /* transaction active? */ 246 - bne tabort_syscall 247 - END_FTR_SECTION_IFSET(CPU_FTR_TM) 248 - #endif 249 250 mr r10,r1 250 251 ld r1,PACAKSAVE(r13) 251 252 std r10,0(r1) ··· 410 423 411 424 SOFT_MASK_TABLE(.Lsyscall_rst_start, 1b) 412 425 RESTART_TABLE(.Lsyscall_rst_start, .Lsyscall_rst_end, syscall_restart) 413 - #endif 414 - 415 - #ifdef CONFIG_PPC_TRANSACTIONAL_MEM 416 - tabort_syscall: 417 - _ASM_NOKPROBE_SYMBOL(tabort_syscall) 418 - /* Firstly we need to enable TM in the kernel */ 419 - mfmsr r10 420 - li r9, 1 421 - rldimi r10, r9, MSR_TM_LG, 63-MSR_TM_LG 422 - mtmsrd r10, 0 423 - 424 - /* tabort, this dooms the transaction, nothing else */ 425 - li r9, (TM_CAUSE_SYSCALL|TM_CAUSE_PERSISTENT) 426 - TABORT(R9) 427 - 428 - /* 429 - * Return directly to userspace. We have corrupted user register state, 430 - * but userspace will never see that register state. Execution will 431 - * resume after the tbegin of the aborted transaction with the 432 - * checkpointed register state. 433 - */ 434 - li r9, MSR_RI 435 - andc r10, r10, r9 436 - mtmsrd r10, 1 437 - mtspr SPRN_SRR0, r11 438 - mtspr SPRN_SRR1, r12 439 - RFI_TO_USER 440 - b . /* prevent speculative execution */ 441 426 #endif 442 427 443 428 /*
+15 -2
arch/powerpc/kernel/mce.c
··· 249 249 { 250 250 int index; 251 251 struct machine_check_event evt; 252 + unsigned long msr; 252 253 253 254 if (!get_mce_event(&evt, MCE_EVENT_RELEASE)) 254 255 return; ··· 263 262 memcpy(&local_paca->mce_info->mce_event_queue[index], 264 263 &evt, sizeof(evt)); 265 264 266 - /* Queue irq work to process this event later. */ 267 - irq_work_queue(&mce_event_process_work); 265 + /* 266 + * Queue irq work to process this event later. Before 267 + * queuing the work enable translation for non radix LPAR, 268 + * as irq_work_queue may try to access memory outside RMO 269 + * region. 270 + */ 271 + if (!radix_enabled() && firmware_has_feature(FW_FEATURE_LPAR)) { 272 + msr = mfmsr(); 273 + mtmsr(msr | MSR_IR | MSR_DR); 274 + irq_work_queue(&mce_event_process_work); 275 + mtmsr(msr); 276 + } else { 277 + irq_work_queue(&mce_event_process_work); 278 + } 268 279 } 269 280 270 281 void mce_common_process_ue(struct pt_regs *regs,
+34 -2
arch/powerpc/kvm/book3s_hv_rmhandlers.S
··· 2536 2536 /* The following code handles the fake_suspend = 1 case */ 2537 2537 mflr r0 2538 2538 std r0, PPC_LR_STKOFF(r1) 2539 - stdu r1, -PPC_MIN_STKFRM(r1) 2539 + stdu r1, -TM_FRAME_SIZE(r1) 2540 2540 2541 2541 /* Turn on TM. */ 2542 2542 mfmsr r8 ··· 2551 2551 END_FTR_SECTION_IFSET(CPU_FTR_P9_TM_XER_SO_BUG) 2552 2552 nop 2553 2553 2554 + /* 2555 + * It's possible that treclaim. may modify registers, if we have lost 2556 + * track of fake-suspend state in the guest due to it using rfscv. 2557 + * Save and restore registers in case this occurs. 2558 + */ 2559 + mfspr r3, SPRN_DSCR 2560 + mfspr r4, SPRN_XER 2561 + mfspr r5, SPRN_AMR 2562 + /* SPRN_TAR would need to be saved here if the kernel ever used it */ 2563 + mfcr r12 2564 + SAVE_NVGPRS(r1) 2565 + SAVE_GPR(2, r1) 2566 + SAVE_GPR(3, r1) 2567 + SAVE_GPR(4, r1) 2568 + SAVE_GPR(5, r1) 2569 + stw r12, 8(r1) 2570 + std r1, HSTATE_HOST_R1(r13) 2571 + 2554 2572 /* We have to treclaim here because that's the only way to do S->N */ 2555 2573 li r3, TM_CAUSE_KVM_RESCHED 2556 2574 TRECLAIM(R3) 2575 + 2576 + GET_PACA(r13) 2577 + ld r1, HSTATE_HOST_R1(r13) 2578 + REST_GPR(2, r1) 2579 + REST_GPR(3, r1) 2580 + REST_GPR(4, r1) 2581 + REST_GPR(5, r1) 2582 + lwz r12, 8(r1) 2583 + REST_NVGPRS(r1) 2584 + mtspr SPRN_DSCR, r3 2585 + mtspr SPRN_XER, r4 2586 + mtspr SPRN_AMR, r5 2587 + mtcr r12 2588 + HMT_MEDIUM 2557 2589 2558 2590 /* 2559 2591 * We were in fake suspend, so we are not going to save the ··· 2614 2582 std r5, VCPU_TFHAR(r9) 2615 2583 std r6, VCPU_TFIAR(r9) 2616 2584 2617 - addi r1, r1, PPC_MIN_STKFRM 2585 + addi r1, r1, TM_FRAME_SIZE 2618 2586 ld r0, PPC_LR_STKOFF(r1) 2619 2587 mtlr r0 2620 2588 blr
+2 -2
arch/powerpc/sysdev/xics/xics-common.c
··· 348 348 if (xics_ics->check(xics_ics, hwirq)) 349 349 return -EINVAL; 350 350 351 - /* No chip data for the XICS domain */ 351 + /* Let the ICS be the chip data for the XICS domain. For ICS native */ 352 352 irq_domain_set_info(domain, virq, hwirq, xics_ics->chip, 353 - NULL, handle_fasteoi_irq, NULL, NULL); 353 + xics_ics, handle_fasteoi_irq, NULL, NULL); 354 354 355 355 return 0; 356 356 }
-10
arch/s390/Kconfig
··· 685 685 The minimum size for the stack guard should be 256 for 31 bit and 686 686 512 for 64 bit. 687 687 688 - config WARN_DYNAMIC_STACK 689 - def_bool n 690 - prompt "Emit compiler warnings for function with dynamic stack usage" 691 - help 692 - This option enables the compiler option -mwarn-dynamicstack. If the 693 - compiler supports this options generates warnings for functions 694 - that dynamically allocate stack space using alloca. 695 - 696 - Say N if you are unsure. 697 - 698 688 endmenu 699 689 700 690 menu "I/O subsystem"
-7
arch/s390/Makefile
··· 85 85 endif 86 86 endif 87 87 88 - ifdef CONFIG_WARN_DYNAMIC_STACK 89 - ifneq ($(call cc-option,-mwarn-dynamicstack),) 90 - KBUILD_CFLAGS += -mwarn-dynamicstack 91 - KBUILD_CFLAGS_DECOMPRESSOR += -mwarn-dynamicstack 92 - endif 93 - endif 94 - 95 88 ifdef CONFIG_EXPOLINE 96 89 ifneq ($(call cc-option,$(CC_FLAGS_MARCH) -mindirect-branch=thunk),) 97 90 CC_FLAGS_EXPOLINE := -mindirect-branch=thunk
+5 -3
arch/s390/configs/debug_defconfig
··· 10 10 CONFIG_BPF_JIT_ALWAYS_ON=y 11 11 CONFIG_BPF_LSM=y 12 12 CONFIG_PREEMPT=y 13 + CONFIG_SCHED_CORE=y 13 14 CONFIG_BSD_PROCESS_ACCT=y 14 15 CONFIG_BSD_PROCESS_ACCT_V3=y 15 16 CONFIG_TASKSTATS=y ··· 504 503 # CONFIG_NET_VENDOR_HUAWEI is not set 505 504 # CONFIG_NET_VENDOR_INTEL is not set 506 505 # CONFIG_NET_VENDOR_MICROSOFT is not set 506 + # CONFIG_NET_VENDOR_LITEX is not set 507 507 # CONFIG_NET_VENDOR_MARVELL is not set 508 508 CONFIG_MLX4_EN=m 509 509 CONFIG_MLX5_CORE=m ··· 663 661 CONFIG_NFSD_V4=y 664 662 CONFIG_NFSD_V4_SECURITY_LABEL=y 665 663 CONFIG_CIFS=m 666 - CONFIG_CIFS_WEAK_PW_HASH=y 667 664 CONFIG_CIFS_UPCALL=y 668 665 CONFIG_CIFS_XATTR=y 669 666 CONFIG_CIFS_POSIX=y ··· 721 720 CONFIG_CRYPTO_VMAC=m 722 721 CONFIG_CRYPTO_CRC32=m 723 722 CONFIG_CRYPTO_BLAKE2S=m 723 + CONFIG_CRYPTO_MD4=m 724 + CONFIG_CRYPTO_MD5=y 724 725 CONFIG_CRYPTO_MICHAEL_MIC=m 725 726 CONFIG_CRYPTO_RMD160=m 726 727 CONFIG_CRYPTO_SHA3=m ··· 777 774 CONFIG_DMA_CMA=y 778 775 CONFIG_CMA_SIZE_MBYTES=0 779 776 CONFIG_DMA_API_DEBUG=y 780 - CONFIG_STRING_SELFTEST=y 781 777 CONFIG_PRINTK_TIME=y 782 778 CONFIG_DYNAMIC_DEBUG=y 783 779 CONFIG_DEBUG_INFO=y ··· 855 853 CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y 856 854 CONFIG_LKDTM=m 857 855 CONFIG_TEST_MIN_HEAP=y 858 - CONFIG_TEST_SORT=y 859 856 CONFIG_KPROBES_SANITY_TEST=y 860 857 CONFIG_RBTREE_TEST=y 861 858 CONFIG_INTERVAL_TREE_TEST=m 862 859 CONFIG_PERCPU_TEST=m 863 860 CONFIG_ATOMIC64_SELFTEST=y 861 + CONFIG_STRING_SELFTEST=y 864 862 CONFIG_TEST_BITOPS=m 865 863 CONFIG_TEST_BPF=m 866 864 CONFIG_TEST_LIVEPATCH=m
+4 -1
arch/s390/configs/defconfig
··· 8 8 CONFIG_BPF_JIT=y 9 9 CONFIG_BPF_JIT_ALWAYS_ON=y 10 10 CONFIG_BPF_LSM=y 11 + CONFIG_SCHED_CORE=y 11 12 CONFIG_BSD_PROCESS_ACCT=y 12 13 CONFIG_BSD_PROCESS_ACCT_V3=y 13 14 CONFIG_TASKSTATS=y ··· 495 494 # CONFIG_NET_VENDOR_HUAWEI is not set 496 495 # CONFIG_NET_VENDOR_INTEL is not set 497 496 # CONFIG_NET_VENDOR_MICROSOFT is not set 497 + # CONFIG_NET_VENDOR_LITEX is not set 498 498 # CONFIG_NET_VENDOR_MARVELL is not set 499 499 CONFIG_MLX4_EN=m 500 500 CONFIG_MLX5_CORE=m ··· 650 648 CONFIG_NFSD_V4=y 651 649 CONFIG_NFSD_V4_SECURITY_LABEL=y 652 650 CONFIG_CIFS=m 653 - CONFIG_CIFS_WEAK_PW_HASH=y 654 651 CONFIG_CIFS_UPCALL=y 655 652 CONFIG_CIFS_XATTR=y 656 653 CONFIG_CIFS_POSIX=y ··· 709 708 CONFIG_CRYPTO_VMAC=m 710 709 CONFIG_CRYPTO_CRC32=m 711 710 CONFIG_CRYPTO_BLAKE2S=m 711 + CONFIG_CRYPTO_MD4=m 712 + CONFIG_CRYPTO_MD5=y 712 713 CONFIG_CRYPTO_MICHAEL_MIC=m 713 714 CONFIG_CRYPTO_RMD160=m 714 715 CONFIG_CRYPTO_SHA3=m
+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 */
+2 -2
arch/s390/pci/pci_mmio.c
··· 159 159 160 160 mmap_read_lock(current->mm); 161 161 ret = -EINVAL; 162 - vma = find_vma(current->mm, mmio_addr); 162 + vma = vma_lookup(current->mm, mmio_addr); 163 163 if (!vma) 164 164 goto out_unlock_mmap; 165 165 if (!(vma->vm_flags & (VM_IO | VM_PFNMAP))) ··· 298 298 299 299 mmap_read_lock(current->mm); 300 300 ret = -EINVAL; 301 - vma = find_vma(current->mm, mmio_addr); 301 + vma = vma_lookup(current->mm, mmio_addr); 302 302 if (!vma) 303 303 goto out_unlock_mmap; 304 304 if (!(vma->vm_flags & (VM_IO | VM_PFNMAP)))
+8 -8
arch/sh/boot/Makefile
··· 80 80 $(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE 81 81 $(call if_changed,lzo) 82 82 83 - $(obj)/uImage.bz2: $(obj)/vmlinux.bin.bz2 83 + $(obj)/uImage.bz2: $(obj)/vmlinux.bin.bz2 FORCE 84 84 $(call if_changed,uimage,bzip2) 85 85 86 - $(obj)/uImage.gz: $(obj)/vmlinux.bin.gz 86 + $(obj)/uImage.gz: $(obj)/vmlinux.bin.gz FORCE 87 87 $(call if_changed,uimage,gzip) 88 88 89 - $(obj)/uImage.lzma: $(obj)/vmlinux.bin.lzma 89 + $(obj)/uImage.lzma: $(obj)/vmlinux.bin.lzma FORCE 90 90 $(call if_changed,uimage,lzma) 91 91 92 - $(obj)/uImage.xz: $(obj)/vmlinux.bin.xz 92 + $(obj)/uImage.xz: $(obj)/vmlinux.bin.xz FORCE 93 93 $(call if_changed,uimage,xz) 94 94 95 - $(obj)/uImage.lzo: $(obj)/vmlinux.bin.lzo 95 + $(obj)/uImage.lzo: $(obj)/vmlinux.bin.lzo FORCE 96 96 $(call if_changed,uimage,lzo) 97 97 98 - $(obj)/uImage.bin: $(obj)/vmlinux.bin 98 + $(obj)/uImage.bin: $(obj)/vmlinux.bin FORCE 99 99 $(call if_changed,uimage,none) 100 100 101 101 OBJCOPYFLAGS_vmlinux.srec := -I binary -O srec 102 - $(obj)/vmlinux.srec: $(obj)/compressed/vmlinux 102 + $(obj)/vmlinux.srec: $(obj)/compressed/vmlinux FORCE 103 103 $(call if_changed,objcopy) 104 104 105 105 OBJCOPYFLAGS_uImage.srec := -I binary -O srec 106 - $(obj)/uImage.srec: $(obj)/uImage 106 + $(obj)/uImage.srec: $(obj)/uImage FORCE 107 107 $(call if_changed,objcopy) 108 108 109 109 $(obj)/uImage: $(obj)/uImage.$(suffix-y)
+3 -1
arch/sparc/kernel/ioport.c
··· 356 356 void arch_dma_free(struct device *dev, size_t size, void *cpu_addr, 357 357 dma_addr_t dma_addr, unsigned long attrs) 358 358 { 359 - if (!sparc_dma_free_resource(cpu_addr, PAGE_ALIGN(size))) 359 + size = PAGE_ALIGN(size); 360 + 361 + if (!sparc_dma_free_resource(cpu_addr, size)) 360 362 return; 361 363 362 364 dma_make_coherent(dma_addr, size);
+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
+5
arch/x86/Kconfig
··· 339 339 config ARCH_HIBERNATION_POSSIBLE 340 340 def_bool y 341 341 342 + config ARCH_NR_GPIO 343 + int 344 + default 1024 if X86_64 345 + default 512 346 + 342 347 config ARCH_SUSPEND_POSSIBLE 343 348 def_bool y 344 349
+9 -3
arch/x86/Makefile_32.cpu
··· 4 4 5 5 tune = $(call cc-option,-mtune=$(1),$(2)) 6 6 7 + ifdef CONFIG_CC_IS_CLANG 8 + align := -falign-functions=0 $(call cc-option,-falign-jumps=0) $(call cc-option,-falign-loops=0) 9 + else 10 + align := -falign-functions=0 -falign-jumps=0 -falign-loops=0 11 + endif 12 + 7 13 cflags-$(CONFIG_M486SX) += -march=i486 8 14 cflags-$(CONFIG_M486) += -march=i486 9 15 cflags-$(CONFIG_M586) += -march=i586 ··· 25 19 # They make zero difference whatsosever to performance at this time. 26 20 cflags-$(CONFIG_MK7) += -march=athlon 27 21 cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8,-march=athlon) 28 - cflags-$(CONFIG_MCRUSOE) += -march=i686 -falign-functions=0 -falign-jumps=0 -falign-loops=0 29 - cflags-$(CONFIG_MEFFICEON) += -march=i686 $(call tune,pentium3) -falign-functions=0 -falign-jumps=0 -falign-loops=0 22 + cflags-$(CONFIG_MCRUSOE) += -march=i686 $(align) 23 + cflags-$(CONFIG_MEFFICEON) += -march=i686 $(call tune,pentium3) $(align) 30 24 cflags-$(CONFIG_MWINCHIPC6) += $(call cc-option,-march=winchip-c6,-march=i586) 31 25 cflags-$(CONFIG_MWINCHIP3D) += $(call cc-option,-march=winchip2,-march=i586) 32 - cflags-$(CONFIG_MCYRIXIII) += $(call cc-option,-march=c3,-march=i486) -falign-functions=0 -falign-jumps=0 -falign-loops=0 26 + cflags-$(CONFIG_MCYRIXIII) += $(call cc-option,-march=c3,-march=i486) $(align) 33 27 cflags-$(CONFIG_MVIAC3_2) += $(call cc-option,-march=c3-2,-march=i686) 34 28 cflags-$(CONFIG_MVIAC7) += -march=i686 35 29 cflags-$(CONFIG_MCORE2) += -march=i686 $(call tune,core2)
+32 -11
arch/x86/kernel/cpu/mce/core.c
··· 1253 1253 1254 1254 static void kill_me_now(struct callback_head *ch) 1255 1255 { 1256 + struct task_struct *p = container_of(ch, struct task_struct, mce_kill_me); 1257 + 1258 + p->mce_count = 0; 1256 1259 force_sig(SIGBUS); 1257 1260 } 1258 1261 ··· 1265 1262 int flags = MF_ACTION_REQUIRED; 1266 1263 int ret; 1267 1264 1265 + p->mce_count = 0; 1268 1266 pr_err("Uncorrected hardware memory error in user-access at %llx", p->mce_addr); 1269 1267 1270 1268 if (!p->mce_ripv) ··· 1294 1290 } 1295 1291 } 1296 1292 1297 - static void queue_task_work(struct mce *m, int kill_current_task) 1293 + static void queue_task_work(struct mce *m, char *msg, int kill_current_task) 1298 1294 { 1299 - current->mce_addr = m->addr; 1300 - current->mce_kflags = m->kflags; 1301 - current->mce_ripv = !!(m->mcgstatus & MCG_STATUS_RIPV); 1302 - current->mce_whole_page = whole_page(m); 1295 + int count = ++current->mce_count; 1303 1296 1304 - if (kill_current_task) 1305 - current->mce_kill_me.func = kill_me_now; 1306 - else 1307 - current->mce_kill_me.func = kill_me_maybe; 1297 + /* First call, save all the details */ 1298 + if (count == 1) { 1299 + current->mce_addr = m->addr; 1300 + current->mce_kflags = m->kflags; 1301 + current->mce_ripv = !!(m->mcgstatus & MCG_STATUS_RIPV); 1302 + current->mce_whole_page = whole_page(m); 1303 + 1304 + if (kill_current_task) 1305 + current->mce_kill_me.func = kill_me_now; 1306 + else 1307 + current->mce_kill_me.func = kill_me_maybe; 1308 + } 1309 + 1310 + /* Ten is likely overkill. Don't expect more than two faults before task_work() */ 1311 + if (count > 10) 1312 + mce_panic("Too many consecutive machine checks while accessing user data", m, msg); 1313 + 1314 + /* Second or later call, make sure page address matches the one from first call */ 1315 + if (count > 1 && (current->mce_addr >> PAGE_SHIFT) != (m->addr >> PAGE_SHIFT)) 1316 + mce_panic("Consecutive machine checks to different user pages", m, msg); 1317 + 1318 + /* Do not call task_work_add() more than once */ 1319 + if (count > 1) 1320 + return; 1308 1321 1309 1322 task_work_add(current, &current->mce_kill_me, TWA_RESUME); 1310 1323 } ··· 1459 1438 /* If this triggers there is no way to recover. Die hard. */ 1460 1439 BUG_ON(!on_thread_stack() || !user_mode(regs)); 1461 1440 1462 - queue_task_work(&m, kill_current_task); 1441 + queue_task_work(&m, msg, kill_current_task); 1463 1442 1464 1443 } else { 1465 1444 /* ··· 1477 1456 } 1478 1457 1479 1458 if (m.kflags & MCE_IN_KERNEL_COPYIN) 1480 - queue_task_work(&m, kill_current_task); 1459 + queue_task_work(&m, msg, kill_current_task); 1481 1460 } 1482 1461 out: 1483 1462 mce_wrmsrl(MSR_IA32_MCG_STATUS, 0);
+3 -3
arch/x86/mm/init_64.c
··· 1432 1432 return 0; 1433 1433 1434 1434 p4d = p4d_offset(pgd, addr); 1435 - if (p4d_none(*p4d)) 1435 + if (!p4d_present(*p4d)) 1436 1436 return 0; 1437 1437 1438 1438 pud = pud_offset(p4d, addr); 1439 - if (pud_none(*pud)) 1439 + if (!pud_present(*pud)) 1440 1440 return 0; 1441 1441 1442 1442 if (pud_large(*pud)) 1443 1443 return pfn_valid(pud_pfn(*pud)); 1444 1444 1445 1445 pmd = pmd_offset(pud, addr); 1446 - if (pmd_none(*pmd)) 1446 + if (!pmd_present(*pmd)) 1447 1447 return 0; 1448 1448 1449 1449 if (pmd_large(*pmd))
+6 -1
arch/x86/mm/pat/memtype.c
··· 583 583 int err = 0; 584 584 585 585 start = sanitize_phys(start); 586 - end = sanitize_phys(end); 586 + 587 + /* 588 + * The end address passed into this function is exclusive, but 589 + * sanitize_phys() expects an inclusive address. 590 + */ 591 + end = sanitize_phys(end - 1) + 1; 587 592 if (start >= end) { 588 593 WARN(1, "%s failed: [mem %#010Lx-%#010Lx], req %s\n", __func__, 589 594 start, end - 1, cattr_name(req_type));
+7
arch/x86/xen/enlighten_pv.c
··· 1214 1214 x86_platform.legacy.rtc = 1; 1215 1215 } 1216 1216 1217 + static void __init xen_domu_set_legacy_features(void) 1218 + { 1219 + x86_platform.legacy.rtc = 0; 1220 + } 1221 + 1217 1222 /* First C function to be called on Xen boot */ 1218 1223 asmlinkage __visible void __init xen_start_kernel(void) 1219 1224 { ··· 1364 1359 add_preferred_console("xenboot", 0, NULL); 1365 1360 if (pci_xen) 1366 1361 x86_init.pci.arch_init = pci_xen_init; 1362 + x86_platform.set_legacy_features = 1363 + xen_domu_set_legacy_features; 1367 1364 } else { 1368 1365 const struct dom0_vga_console_info *info = 1369 1366 (void *)((char *)xen_start_info +
+5 -2
arch/x86/xen/mmu_pv.c
··· 1518 1518 if (pinned) { 1519 1519 struct page *page = pfn_to_page(pfn); 1520 1520 1521 - if (static_branch_likely(&xen_struct_pages_ready)) 1521 + pinned = false; 1522 + if (static_branch_likely(&xen_struct_pages_ready)) { 1523 + pinned = PagePinned(page); 1522 1524 SetPagePinned(page); 1525 + } 1523 1526 1524 1527 xen_mc_batch(); 1525 1528 1526 1529 __set_pfn_prot(pfn, PAGE_KERNEL_RO); 1527 1530 1528 - if (level == PT_PTE && USE_SPLIT_PTE_PTLOCKS) 1531 + if (level == PT_PTE && USE_SPLIT_PTE_PTLOCKS && !pinned) 1529 1532 __pin_pagetable_pfn(MMUEXT_PIN_L1_TABLE, pfn); 1530 1533 1531 1534 xen_mc_issue(PARAVIRT_LAZY_MMU);
+14 -4
block/blk-cgroup.c
··· 1182 1182 if (preloaded) 1183 1183 radix_tree_preload_end(); 1184 1184 1185 - ret = blk_iolatency_init(q); 1186 - if (ret) 1187 - goto err_destroy_all; 1188 - 1189 1185 ret = blk_ioprio_init(q); 1190 1186 if (ret) 1191 1187 goto err_destroy_all; ··· 1189 1193 ret = blk_throtl_init(q); 1190 1194 if (ret) 1191 1195 goto err_destroy_all; 1196 + 1197 + ret = blk_iolatency_init(q); 1198 + if (ret) { 1199 + blk_throtl_exit(q); 1200 + goto err_destroy_all; 1201 + } 1192 1202 1193 1203 return 0; 1194 1204 ··· 1366 1364 /* alloc failed, nothing's initialized yet, free everything */ 1367 1365 spin_lock_irq(&q->queue_lock); 1368 1366 list_for_each_entry(blkg, &q->blkg_list, q_node) { 1367 + struct blkcg *blkcg = blkg->blkcg; 1368 + 1369 + spin_lock(&blkcg->lock); 1369 1370 if (blkg->pd[pol->plid]) { 1370 1371 pol->pd_free_fn(blkg->pd[pol->plid]); 1371 1372 blkg->pd[pol->plid] = NULL; 1372 1373 } 1374 + spin_unlock(&blkcg->lock); 1373 1375 } 1374 1376 spin_unlock_irq(&q->queue_lock); 1375 1377 ret = -ENOMEM; ··· 1405 1399 __clear_bit(pol->plid, q->blkcg_pols); 1406 1400 1407 1401 list_for_each_entry(blkg, &q->blkg_list, q_node) { 1402 + struct blkcg *blkcg = blkg->blkcg; 1403 + 1404 + spin_lock(&blkcg->lock); 1408 1405 if (blkg->pd[pol->plid]) { 1409 1406 if (pol->pd_offline_fn) 1410 1407 pol->pd_offline_fn(blkg->pd[pol->plid]); 1411 1408 pol->pd_free_fn(blkg->pd[pol->plid]); 1412 1409 blkg->pd[pol->plid] = NULL; 1413 1410 } 1411 + spin_unlock(&blkcg->lock); 1414 1412 } 1415 1413 1416 1414 spin_unlock_irq(&q->queue_lock);
+8 -1
block/blk-integrity.c
··· 426 426 */ 427 427 void blk_integrity_unregister(struct gendisk *disk) 428 428 { 429 + struct blk_integrity *bi = &disk->queue->integrity; 430 + 431 + if (!bi->profile) 432 + return; 433 + 434 + /* ensure all bios are off the integrity workqueue */ 435 + blk_flush_integrity(); 429 436 blk_queue_flag_clear(QUEUE_FLAG_STABLE_WRITES, disk->queue); 430 - memset(&disk->queue->integrity, 0, sizeof(struct blk_integrity)); 437 + memset(bi, 0, sizeof(*bi)); 431 438 } 432 439 EXPORT_SYMBOL(blk_integrity_unregister); 433 440
+1 -1
block/blk-mq-tag.c
··· 208 208 209 209 spin_lock_irqsave(&tags->lock, flags); 210 210 rq = tags->rqs[bitnr]; 211 - if (!rq || !refcount_inc_not_zero(&rq->ref)) 211 + if (!rq || rq->tag != bitnr || !refcount_inc_not_zero(&rq->ref)) 212 212 rq = NULL; 213 213 spin_unlock_irqrestore(&tags->lock, flags); 214 214 return rq;
+10
drivers/base/power/trace.c
··· 13 13 #include <linux/export.h> 14 14 #include <linux/rtc.h> 15 15 #include <linux/suspend.h> 16 + #include <linux/init.h> 16 17 17 18 #include <linux/mc146818rtc.h> 18 19 ··· 166 165 const char *file = *(const char **)(tracedata + 2); 167 166 unsigned int user_hash_value, file_hash_value; 168 167 168 + if (!x86_platform.legacy.rtc) 169 + return; 170 + 169 171 user_hash_value = user % USERHASH; 170 172 file_hash_value = hash_string(lineno, file, FILEHASH); 171 173 set_magic_time(user_hash_value, file_hash_value, dev_hash_value); ··· 271 267 272 268 static int __init early_resume_init(void) 273 269 { 270 + if (!x86_platform.legacy.rtc) 271 + return 0; 272 + 274 273 hash_value_early_read = read_magic_time(); 275 274 register_pm_notifier(&pm_trace_nb); 276 275 return 0; ··· 283 276 { 284 277 unsigned int val = hash_value_early_read; 285 278 unsigned int user, file, dev; 279 + 280 + if (!x86_platform.legacy.rtc) 281 + return 0; 286 282 287 283 user = val % USERHASH; 288 284 val = val / USERHASH;
+1 -1
drivers/cpufreq/cpufreq_governor_attr_set.c
··· 74 74 if (count) 75 75 return count; 76 76 77 - kobject_put(&attr_set->kobj); 78 77 mutex_destroy(&attr_set->update_lock); 78 + kobject_put(&attr_set->kobj); 79 79 return 0; 80 80 } 81 81 EXPORT_SYMBOL_GPL(gov_attr_set_put);
+14 -8
drivers/cpufreq/intel_pstate.c
··· 3205 3205 if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) 3206 3206 return -ENODEV; 3207 3207 3208 - if (no_load) 3209 - return -ENODEV; 3210 - 3211 3208 id = x86_match_cpu(hwp_support_ids); 3212 3209 if (id) { 3210 + bool hwp_forced = intel_pstate_hwp_is_enabled(); 3211 + 3212 + if (hwp_forced) 3213 + pr_info("HWP enabled by BIOS\n"); 3214 + else if (no_load) 3215 + return -ENODEV; 3216 + 3213 3217 copy_cpu_funcs(&core_funcs); 3214 3218 /* 3215 3219 * Avoid enabling HWP for processors without EPP support, ··· 3223 3219 * If HWP is enabled already, though, there is no choice but to 3224 3220 * deal with it. 3225 3221 */ 3226 - if ((!no_hwp && boot_cpu_has(X86_FEATURE_HWP_EPP)) || 3227 - intel_pstate_hwp_is_enabled()) { 3222 + if ((!no_hwp && boot_cpu_has(X86_FEATURE_HWP_EPP)) || hwp_forced) { 3228 3223 hwp_active++; 3229 3224 hwp_mode_bdw = id->driver_data; 3230 3225 intel_pstate.attr = hwp_cpufreq_attrs; ··· 3238 3235 3239 3236 goto hwp_cpu_matched; 3240 3237 } 3238 + pr_info("HWP not enabled\n"); 3241 3239 } else { 3240 + if (no_load) 3241 + return -ENODEV; 3242 + 3242 3243 id = x86_match_cpu(intel_pstate_cpu_ids); 3243 3244 if (!id) { 3244 3245 pr_info("CPU model not supported\n"); ··· 3321 3314 else if (!strcmp(str, "passive")) 3322 3315 default_driver = &intel_cpufreq; 3323 3316 3324 - if (!strcmp(str, "no_hwp")) { 3325 - pr_info("HWP disabled\n"); 3317 + if (!strcmp(str, "no_hwp")) 3326 3318 no_hwp = 1; 3327 - } 3319 + 3328 3320 if (!strcmp(str, "force")) 3329 3321 force_load = 1; 3330 3322 if (!strcmp(str, "hwp_only"))
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu.h
··· 758 758 MAX_HWIP 759 759 }; 760 760 761 - #define HWIP_MAX_INSTANCE 8 761 + #define HWIP_MAX_INSTANCE 10 762 762 763 763 struct amd_powerplay { 764 764 void *pp_handle;
+10
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
··· 192 192 kgd2kfd_suspend(adev->kfd.dev, run_pm); 193 193 } 194 194 195 + int amdgpu_amdkfd_resume_iommu(struct amdgpu_device *adev) 196 + { 197 + int r = 0; 198 + 199 + if (adev->kfd.dev) 200 + r = kgd2kfd_resume_iommu(adev->kfd.dev); 201 + 202 + return r; 203 + } 204 + 195 205 int amdgpu_amdkfd_resume(struct amdgpu_device *adev, bool run_pm) 196 206 { 197 207 int r = 0;
+7
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
··· 137 137 void amdgpu_amdkfd_fini(void); 138 138 139 139 void amdgpu_amdkfd_suspend(struct amdgpu_device *adev, bool run_pm); 140 + int amdgpu_amdkfd_resume_iommu(struct amdgpu_device *adev); 140 141 int amdgpu_amdkfd_resume(struct amdgpu_device *adev, bool run_pm); 141 142 void amdgpu_amdkfd_interrupt(struct amdgpu_device *adev, 142 143 const void *ih_ring_entry); ··· 328 327 const struct kgd2kfd_shared_resources *gpu_resources); 329 328 void kgd2kfd_device_exit(struct kfd_dev *kfd); 330 329 void kgd2kfd_suspend(struct kfd_dev *kfd, bool run_pm); 330 + int kgd2kfd_resume_iommu(struct kfd_dev *kfd); 331 331 int kgd2kfd_resume(struct kfd_dev *kfd, bool run_pm); 332 332 int kgd2kfd_pre_reset(struct kfd_dev *kfd); 333 333 int kgd2kfd_post_reset(struct kfd_dev *kfd); ··· 365 363 366 364 static inline void kgd2kfd_suspend(struct kfd_dev *kfd, bool run_pm) 367 365 { 366 + } 367 + 368 + static int __maybe_unused kgd2kfd_resume_iommu(struct kfd_dev *kfd) 369 + { 370 + return 0; 368 371 } 369 372 370 373 static inline int kgd2kfd_resume(struct kfd_dev *kfd, bool run_pm)
+4 -6
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
··· 1544 1544 struct dentry *ent; 1545 1545 int r, i; 1546 1546 1547 - 1548 - 1549 1547 ent = debugfs_create_file("amdgpu_preempt_ib", 0600, root, adev, 1550 1548 &fops_ib_preempt); 1551 - if (!ent) { 1549 + if (IS_ERR(ent)) { 1552 1550 DRM_ERROR("unable to create amdgpu_preempt_ib debugsfs file\n"); 1553 - return -EIO; 1551 + return PTR_ERR(ent); 1554 1552 } 1555 1553 1556 1554 ent = debugfs_create_file("amdgpu_force_sclk", 0200, root, adev, 1557 1555 &fops_sclk_set); 1558 - if (!ent) { 1556 + if (IS_ERR(ent)) { 1559 1557 DRM_ERROR("unable to create amdgpu_set_sclk debugsfs file\n"); 1560 - return -EIO; 1558 + return PTR_ERR(ent); 1561 1559 } 1562 1560 1563 1561 /* Register debugfs entries for amdgpu_ttm */
+12
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 2394 2394 if (r) 2395 2395 goto init_failed; 2396 2396 2397 + r = amdgpu_amdkfd_resume_iommu(adev); 2398 + if (r) 2399 + goto init_failed; 2400 + 2397 2401 r = amdgpu_device_ip_hw_init_phase1(adev); 2398 2402 if (r) 2399 2403 goto init_failed; ··· 3151 3147 static int amdgpu_device_ip_resume(struct amdgpu_device *adev) 3152 3148 { 3153 3149 int r; 3150 + 3151 + r = amdgpu_amdkfd_resume_iommu(adev); 3152 + if (r) 3153 + return r; 3154 3154 3155 3155 r = amdgpu_device_ip_resume_phase1(adev); 3156 3156 if (r) ··· 4609 4601 dev_warn(tmp_adev->dev, "asic atom init failed!"); 4610 4602 } else { 4611 4603 dev_info(tmp_adev->dev, "GPU reset succeeded, trying to resume\n"); 4604 + r = amdgpu_amdkfd_resume_iommu(tmp_adev); 4605 + if (r) 4606 + goto out; 4607 + 4612 4608 r = amdgpu_device_ip_resume_phase1(tmp_adev); 4613 4609 if (r) 4614 4610 goto out;
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
··· 598 598 break; 599 599 default: 600 600 adev->gmc.tmz_enabled = false; 601 - dev_warn(adev->dev, 601 + dev_info(adev->dev, 602 602 "Trusted Memory Zone (TMZ) feature not supported\n"); 603 603 break; 604 604 }
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
··· 757 757 return res; 758 758 } 759 759 760 - inline uint32_t amdgpu_ras_eeprom_max_record_count(void) 760 + uint32_t amdgpu_ras_eeprom_max_record_count(void) 761 761 { 762 762 return RAS_MAX_RECORD_COUNT; 763 763 }
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.h
··· 120 120 int amdgpu_ras_eeprom_append(struct amdgpu_ras_eeprom_control *control, 121 121 struct eeprom_table_record *records, const u32 num); 122 122 123 - inline uint32_t amdgpu_ras_eeprom_max_record_count(void); 123 + uint32_t amdgpu_ras_eeprom_max_record_count(void); 124 124 125 125 void amdgpu_ras_debugfs_set_ret_size(struct amdgpu_ras_eeprom_control *control); 126 126
+2 -2
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
··· 428 428 ent = debugfs_create_file(name, 429 429 S_IFREG | S_IRUGO, root, 430 430 ring, &amdgpu_debugfs_ring_fops); 431 - if (!ent) 432 - return -ENOMEM; 431 + if (IS_ERR(ent)) 432 + return PTR_ERR(ent); 433 433 434 434 i_size_write(ent->d_inode, ring->ring_size + 12); 435 435 ring->ent = ent;
+9 -9
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
··· 515 515 goto out; 516 516 } 517 517 518 + if (bo->type == ttm_bo_type_device && 519 + new_mem->mem_type == TTM_PL_VRAM && 520 + old_mem->mem_type != TTM_PL_VRAM) { 521 + /* amdgpu_bo_fault_reserve_notify will re-set this if the CPU 522 + * accesses the BO after it's moved. 523 + */ 524 + abo->flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED; 525 + } 526 + 518 527 if (adev->mman.buffer_funcs_enabled) { 519 528 if (((old_mem->mem_type == TTM_PL_SYSTEM && 520 529 new_mem->mem_type == TTM_PL_VRAM) || ··· 552 543 r = ttm_bo_move_memcpy(bo, ctx, new_mem); 553 544 if (r) 554 545 return r; 555 - } 556 - 557 - if (bo->type == ttm_bo_type_device && 558 - new_mem->mem_type == TTM_PL_VRAM && 559 - old_mem->mem_type != TTM_PL_VRAM) { 560 - /* amdgpu_bo_fault_reserve_notify will re-set this if the CPU 561 - * accesses the BO after it's moved. 562 - */ 563 - abo->flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED; 564 546 } 565 547 566 548 out:
+36 -20
drivers/gpu/drm/amd/amdkfd/kfd_device.c
··· 468 468 .needs_iommu_device = false, 469 469 .supports_cwsr = true, 470 470 .needs_pci_atomics = true, 471 + .no_atomic_fw_version = 145, 471 472 .num_sdma_engines = 2, 472 473 .num_xgmi_sdma_engines = 0, 473 474 .num_sdma_queues_per_engine = 8, ··· 488 487 .needs_iommu_device = false, 489 488 .supports_cwsr = true, 490 489 .needs_pci_atomics = true, 490 + .no_atomic_fw_version = 145, 491 491 .num_sdma_engines = 2, 492 492 .num_xgmi_sdma_engines = 0, 493 493 .num_sdma_queues_per_engine = 8, ··· 508 506 .needs_iommu_device = false, 509 507 .supports_cwsr = true, 510 508 .needs_pci_atomics = true, 509 + .no_atomic_fw_version = 145, 511 510 .num_sdma_engines = 2, 512 511 .num_xgmi_sdma_engines = 0, 513 512 .num_sdma_queues_per_engine = 8, ··· 528 525 .needs_iommu_device = false, 529 526 .supports_cwsr = true, 530 527 .needs_pci_atomics = true, 528 + .no_atomic_fw_version = 92, 531 529 .num_sdma_engines = 4, 532 530 .num_xgmi_sdma_engines = 0, 533 531 .num_sdma_queues_per_engine = 8, ··· 548 544 .needs_iommu_device = false, 549 545 .supports_cwsr = true, 550 546 .needs_pci_atomics = true, 547 + .no_atomic_fw_version = 92, 551 548 .num_sdma_engines = 2, 552 549 .num_xgmi_sdma_engines = 0, 553 550 .num_sdma_queues_per_engine = 8, ··· 567 562 .mqd_size_aligned = MQD_SIZE_ALIGNED, 568 563 .needs_iommu_device = false, 569 564 .supports_cwsr = true, 570 - .needs_pci_atomics = false, 565 + .needs_pci_atomics = true, 566 + .no_atomic_fw_version = 92, 571 567 .num_sdma_engines = 1, 572 568 .num_xgmi_sdma_engines = 0, 573 569 .num_sdma_queues_per_engine = 2, ··· 588 582 .needs_iommu_device = false, 589 583 .supports_cwsr = true, 590 584 .needs_pci_atomics = true, 585 + .no_atomic_fw_version = 92, 591 586 .num_sdma_engines = 2, 592 587 .num_xgmi_sdma_engines = 0, 593 588 .num_sdma_queues_per_engine = 8, ··· 608 601 .needs_iommu_device = false, 609 602 .supports_cwsr = true, 610 603 .needs_pci_atomics = true, 604 + .no_atomic_fw_version = 92, 611 605 .num_sdma_engines = 1, 612 606 .num_xgmi_sdma_engines = 0, 613 607 .num_sdma_queues_per_engine = 8, ··· 627 619 .mqd_size_aligned = MQD_SIZE_ALIGNED, 628 620 .needs_iommu_device = false, 629 621 .supports_cwsr = true, 630 - .needs_pci_atomics = false, 622 + .needs_pci_atomics = true, 623 + .no_atomic_fw_version = 92, 631 624 .num_sdma_engines = 1, 632 625 .num_xgmi_sdma_engines = 0, 633 626 .num_sdma_queues_per_engine = 2, ··· 716 707 kfd = kzalloc(sizeof(*kfd), GFP_KERNEL); 717 708 if (!kfd) 718 709 return NULL; 719 - 720 - /* Allow BIF to recode atomics to PCIe 3.0 AtomicOps. 721 - * 32 and 64-bit requests are possible and must be 722 - * supported. 723 - */ 724 - kfd->pci_atomic_requested = amdgpu_amdkfd_have_atomics_support(kgd); 725 - if (device_info->needs_pci_atomics && 726 - !kfd->pci_atomic_requested) { 727 - dev_info(kfd_device, 728 - "skipped device %x:%x, PCI rejects atomics\n", 729 - pdev->vendor, pdev->device); 730 - kfree(kfd); 731 - return NULL; 732 - } 733 710 734 711 kfd->kgd = kgd; 735 712 kfd->device_info = device_info; ··· 815 820 kfd->vm_info.last_vmid_kfd = fls(gpu_resources->compute_vmid_bitmap)-1; 816 821 kfd->vm_info.vmid_num_kfd = kfd->vm_info.last_vmid_kfd 817 822 - kfd->vm_info.first_vmid_kfd + 1; 823 + 824 + /* Allow BIF to recode atomics to PCIe 3.0 AtomicOps. 825 + * 32 and 64-bit requests are possible and must be 826 + * supported. 827 + */ 828 + kfd->pci_atomic_requested = amdgpu_amdkfd_have_atomics_support(kfd->kgd); 829 + if (!kfd->pci_atomic_requested && 830 + kfd->device_info->needs_pci_atomics && 831 + (!kfd->device_info->no_atomic_fw_version || 832 + kfd->mec_fw_version < kfd->device_info->no_atomic_fw_version)) { 833 + dev_info(kfd_device, 834 + "skipped device %x:%x, PCI rejects atomics %d<%d\n", 835 + kfd->pdev->vendor, kfd->pdev->device, 836 + kfd->mec_fw_version, 837 + kfd->device_info->no_atomic_fw_version); 838 + return false; 839 + } 818 840 819 841 /* Verify module parameters regarding mapped process number*/ 820 842 if ((hws_max_conc_proc < 0) ··· 1069 1057 return ret; 1070 1058 } 1071 1059 1072 - static int kfd_resume(struct kfd_dev *kfd) 1060 + int kgd2kfd_resume_iommu(struct kfd_dev *kfd) 1073 1061 { 1074 1062 int err = 0; 1075 1063 1076 1064 err = kfd_iommu_resume(kfd); 1077 - if (err) { 1065 + if (err) 1078 1066 dev_err(kfd_device, 1079 1067 "Failed to resume IOMMU for device %x:%x\n", 1080 1068 kfd->pdev->vendor, kfd->pdev->device); 1081 - return err; 1082 - } 1069 + return err; 1070 + } 1071 + 1072 + static int kfd_resume(struct kfd_dev *kfd) 1073 + { 1074 + int err = 0; 1083 1075 1084 1076 err = kfd->dqm->ops.start(kfd->dqm); 1085 1077 if (err) {
+1
drivers/gpu/drm/amd/amdkfd/kfd_priv.h
··· 207 207 bool supports_cwsr; 208 208 bool needs_iommu_device; 209 209 bool needs_pci_atomics; 210 + uint32_t no_atomic_fw_version; 210 211 unsigned int num_sdma_engines; 211 212 unsigned int num_xgmi_sdma_engines; 212 213 unsigned int num_sdma_queues_per_engine;
+86 -23
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 998 998 uint32_t agp_base, agp_bot, agp_top; 999 999 PHYSICAL_ADDRESS_LOC page_table_start, page_table_end, page_table_base; 1000 1000 1001 + memset(pa_config, 0, sizeof(*pa_config)); 1002 + 1001 1003 logical_addr_low = min(adev->gmc.fb_start, adev->gmc.agp_start) >> 18; 1002 1004 pt_base = amdgpu_gmc_pd_addr(adev->gart.bo); 1003 1005 ··· 6026 6024 return 0; 6027 6025 6028 6026 #if defined(CONFIG_DRM_AMD_DC_DCN) 6029 - work = kzalloc(sizeof(*work), GFP_ATOMIC); 6030 - if (!work) 6031 - return -ENOMEM; 6027 + if (dm->vblank_control_workqueue) { 6028 + work = kzalloc(sizeof(*work), GFP_ATOMIC); 6029 + if (!work) 6030 + return -ENOMEM; 6032 6031 6033 - INIT_WORK(&work->work, vblank_control_worker); 6034 - work->dm = dm; 6035 - work->acrtc = acrtc; 6036 - work->enable = enable; 6032 + INIT_WORK(&work->work, vblank_control_worker); 6033 + work->dm = dm; 6034 + work->acrtc = acrtc; 6035 + work->enable = enable; 6037 6036 6038 - if (acrtc_state->stream) { 6039 - dc_stream_retain(acrtc_state->stream); 6040 - work->stream = acrtc_state->stream; 6037 + if (acrtc_state->stream) { 6038 + dc_stream_retain(acrtc_state->stream); 6039 + work->stream = acrtc_state->stream; 6040 + } 6041 + 6042 + queue_work(dm->vblank_control_workqueue, &work->work); 6041 6043 } 6042 - 6043 - queue_work(dm->vblank_control_workqueue, &work->work); 6044 6044 #endif 6045 6045 6046 6046 return 0; ··· 6796 6792 6797 6793 #if defined(CONFIG_DRM_AMD_DC_DCN) 6798 6794 static int dm_update_mst_vcpi_slots_for_dsc(struct drm_atomic_state *state, 6799 - struct dc_state *dc_state) 6795 + struct dc_state *dc_state, 6796 + struct dsc_mst_fairness_vars *vars) 6800 6797 { 6801 6798 struct dc_stream_state *stream = NULL; 6802 6799 struct drm_connector *connector; 6803 6800 struct drm_connector_state *new_con_state; 6804 6801 struct amdgpu_dm_connector *aconnector; 6805 6802 struct dm_connector_state *dm_conn_state; 6806 - int i, j, clock, bpp; 6803 + int i, j, clock; 6807 6804 int vcpi, pbn_div, pbn = 0; 6808 6805 6809 6806 for_each_new_connector_in_state(state, connector, new_con_state, i) { ··· 6843 6838 } 6844 6839 6845 6840 pbn_div = dm_mst_get_pbn_divider(stream->link); 6846 - bpp = stream->timing.dsc_cfg.bits_per_pixel; 6847 6841 clock = stream->timing.pix_clk_100hz / 10; 6848 - pbn = drm_dp_calc_pbn_mode(clock, bpp, true); 6842 + /* pbn is calculated by compute_mst_dsc_configs_for_state*/ 6843 + for (j = 0; j < dc_state->stream_count; j++) { 6844 + if (vars[j].aconnector == aconnector) { 6845 + pbn = vars[j].pbn; 6846 + break; 6847 + } 6848 + } 6849 + 6849 6850 vcpi = drm_dp_mst_atomic_enable_dsc(state, 6850 6851 aconnector->port, 6851 6852 pbn, pbn_div, ··· 7530 7519 } 7531 7520 } 7532 7521 7522 + static void amdgpu_set_panel_orientation(struct drm_connector *connector) 7523 + { 7524 + struct drm_encoder *encoder; 7525 + struct amdgpu_encoder *amdgpu_encoder; 7526 + const struct drm_display_mode *native_mode; 7527 + 7528 + if (connector->connector_type != DRM_MODE_CONNECTOR_eDP && 7529 + connector->connector_type != DRM_MODE_CONNECTOR_LVDS) 7530 + return; 7531 + 7532 + encoder = amdgpu_dm_connector_to_encoder(connector); 7533 + if (!encoder) 7534 + return; 7535 + 7536 + amdgpu_encoder = to_amdgpu_encoder(encoder); 7537 + 7538 + native_mode = &amdgpu_encoder->native_mode; 7539 + if (native_mode->hdisplay == 0 || native_mode->vdisplay == 0) 7540 + return; 7541 + 7542 + drm_connector_set_panel_orientation_with_quirk(connector, 7543 + DRM_MODE_PANEL_ORIENTATION_UNKNOWN, 7544 + native_mode->hdisplay, 7545 + native_mode->vdisplay); 7546 + } 7547 + 7533 7548 static void amdgpu_dm_connector_ddc_get_modes(struct drm_connector *connector, 7534 7549 struct edid *edid) 7535 7550 { ··· 7584 7547 * restored here. 7585 7548 */ 7586 7549 amdgpu_dm_update_freesync_caps(connector, edid); 7550 + 7551 + amdgpu_set_panel_orientation(connector); 7587 7552 } else { 7588 7553 amdgpu_dm_connector->num_modes = 0; 7589 7554 } ··· 8097 8058 state->content_protection == DRM_MODE_CONTENT_PROTECTION_ENABLED) 8098 8059 state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED; 8099 8060 8100 - /* Check if something is connected/enabled, otherwise we start hdcp but nothing is connected/enabled 8101 - * hot-plug, headless s3, dpms 8061 + /* Stream removed and re-enabled 8062 + * 8063 + * Can sometimes overlap with the HPD case, 8064 + * thus set update_hdcp to false to avoid 8065 + * setting HDCP multiple times. 8066 + * 8067 + * Handles: DESIRED -> DESIRED (Special case) 8068 + */ 8069 + if (!(old_state->crtc && old_state->crtc->enabled) && 8070 + state->crtc && state->crtc->enabled && 8071 + connector->state->content_protection == DRM_MODE_CONTENT_PROTECTION_DESIRED) { 8072 + dm_con_state->update_hdcp = false; 8073 + return true; 8074 + } 8075 + 8076 + /* Hot-plug, headless s3, dpms 8077 + * 8078 + * Only start HDCP if the display is connected/enabled. 8079 + * update_hdcp flag will be set to false until the next 8080 + * HPD comes in. 8102 8081 * 8103 8082 * Handles: DESIRED -> DESIRED (Special case) 8104 8083 */ ··· 8705 8648 * If PSR or idle optimizations are enabled then flush out 8706 8649 * any pending work before hardware programming. 8707 8650 */ 8708 - flush_workqueue(dm->vblank_control_workqueue); 8651 + if (dm->vblank_control_workqueue) 8652 + flush_workqueue(dm->vblank_control_workqueue); 8709 8653 #endif 8710 8654 8711 8655 bundle->stream_update.stream = acrtc_state->stream; ··· 9041 8983 /* if there mode set or reset, disable eDP PSR */ 9042 8984 if (mode_set_reset_required) { 9043 8985 #if defined(CONFIG_DRM_AMD_DC_DCN) 9044 - flush_workqueue(dm->vblank_control_workqueue); 8986 + if (dm->vblank_control_workqueue) 8987 + flush_workqueue(dm->vblank_control_workqueue); 9045 8988 #endif 9046 8989 amdgpu_dm_psr_disable_all(dm); 9047 8990 } ··· 10302 10243 int ret, i; 10303 10244 bool lock_and_validation_needed = false; 10304 10245 struct dm_crtc_state *dm_old_crtc_state; 10246 + #if defined(CONFIG_DRM_AMD_DC_DCN) 10247 + struct dsc_mst_fairness_vars vars[MAX_PIPES]; 10248 + #endif 10305 10249 10306 10250 trace_amdgpu_dm_atomic_check_begin(state); 10307 10251 ··· 10535 10473 goto fail; 10536 10474 10537 10475 #if defined(CONFIG_DRM_AMD_DC_DCN) 10538 - if (!compute_mst_dsc_configs_for_state(state, dm_state->context)) 10476 + if (!compute_mst_dsc_configs_for_state(state, dm_state->context, vars)) 10539 10477 goto fail; 10540 10478 10541 - ret = dm_update_mst_vcpi_slots_for_dsc(state, dm_state->context); 10479 + ret = dm_update_mst_vcpi_slots_for_dsc(state, dm_state->context, vars); 10542 10480 if (ret) 10543 10481 goto fail; 10544 10482 #endif ··· 10554 10492 goto fail; 10555 10493 status = dc_validate_global_state(dc, dm_state->context, false); 10556 10494 if (status != DC_OK) { 10557 - DC_LOG_WARNING("DC global validation failure: %s (%d)", 10495 + drm_dbg_atomic(dev, 10496 + "DC global validation failure: %s (%d)", 10558 10497 dc_status_to_str(status), status); 10559 10498 ret = -EINVAL; 10560 10499 goto fail;
+8 -10
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
··· 518 518 uint32_t num_slices_h; 519 519 uint32_t num_slices_v; 520 520 uint32_t bpp_overwrite; 521 - }; 522 - 523 - struct dsc_mst_fairness_vars { 524 - int pbn; 525 - bool dsc_enabled; 526 - int bpp_x16; 521 + struct amdgpu_dm_connector *aconnector; 527 522 }; 528 523 529 524 static int kbps_to_peak_pbn(int kbps) ··· 745 750 746 751 static bool compute_mst_dsc_configs_for_link(struct drm_atomic_state *state, 747 752 struct dc_state *dc_state, 748 - struct dc_link *dc_link) 753 + struct dc_link *dc_link, 754 + struct dsc_mst_fairness_vars *vars) 749 755 { 750 756 int i; 751 757 struct dc_stream_state *stream; 752 758 struct dsc_mst_fairness_params params[MAX_PIPES]; 753 - struct dsc_mst_fairness_vars vars[MAX_PIPES]; 754 759 struct amdgpu_dm_connector *aconnector; 755 760 int count = 0; 756 761 bool debugfs_overwrite = false; ··· 771 776 params[count].timing = &stream->timing; 772 777 params[count].sink = stream->sink; 773 778 aconnector = (struct amdgpu_dm_connector *)stream->dm_stream_context; 779 + params[count].aconnector = aconnector; 774 780 params[count].port = aconnector->port; 775 781 params[count].clock_force_enable = aconnector->dsc_settings.dsc_force_enable; 776 782 if (params[count].clock_force_enable == DSC_CLK_FORCE_ENABLE) ··· 794 798 } 795 799 /* Try no compression */ 796 800 for (i = 0; i < count; i++) { 801 + vars[i].aconnector = params[i].aconnector; 797 802 vars[i].pbn = kbps_to_peak_pbn(params[i].bw_range.stream_kbps); 798 803 vars[i].dsc_enabled = false; 799 804 vars[i].bpp_x16 = 0; ··· 848 851 } 849 852 850 853 bool compute_mst_dsc_configs_for_state(struct drm_atomic_state *state, 851 - struct dc_state *dc_state) 854 + struct dc_state *dc_state, 855 + struct dsc_mst_fairness_vars *vars) 852 856 { 853 857 int i, j; 854 858 struct dc_stream_state *stream; ··· 880 882 return false; 881 883 882 884 mutex_lock(&aconnector->mst_mgr.lock); 883 - if (!compute_mst_dsc_configs_for_link(state, dc_state, stream->link)) { 885 + if (!compute_mst_dsc_configs_for_link(state, dc_state, stream->link, vars)) { 884 886 mutex_unlock(&aconnector->mst_mgr.lock); 885 887 return false; 886 888 }
+10 -1
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h
··· 39 39 dm_dp_create_fake_mst_encoders(struct amdgpu_device *adev); 40 40 41 41 #if defined(CONFIG_DRM_AMD_DC_DCN) 42 + 43 + struct dsc_mst_fairness_vars { 44 + int pbn; 45 + bool dsc_enabled; 46 + int bpp_x16; 47 + struct amdgpu_dm_connector *aconnector; 48 + }; 49 + 42 50 bool compute_mst_dsc_configs_for_state(struct drm_atomic_state *state, 43 - struct dc_state *dc_state); 51 + struct dc_state *dc_state, 52 + struct dsc_mst_fairness_vars *vars); 44 53 #endif 45 54 46 55 #endif
+1 -1
drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c
··· 62 62 depth = *pcpu; 63 63 put_cpu_ptr(&fpu_recursion_depth); 64 64 65 - ASSERT(depth > 1); 65 + ASSERT(depth >= 1); 66 66 } 67 67 68 68 /**
+12 -4
drivers/gpu/drm/amd/display/dc/core/dc_link.c
··· 2586 2586 2587 2587 int dc_link_get_backlight_level(const struct dc_link *link) 2588 2588 { 2589 - 2590 2589 struct abm *abm = get_abm_from_stream_res(link); 2590 + struct panel_cntl *panel_cntl = link->panel_cntl; 2591 + struct dc *dc = link->ctx->dc; 2592 + struct dmcu *dmcu = dc->res_pool->dmcu; 2593 + bool fw_set_brightness = true; 2591 2594 2592 - if (abm == NULL || abm->funcs->get_current_backlight == NULL) 2595 + if (dmcu) 2596 + fw_set_brightness = dmcu->funcs->is_dmcu_initialized(dmcu); 2597 + 2598 + if (!fw_set_brightness && panel_cntl->funcs->get_current_backlight) 2599 + return panel_cntl->funcs->get_current_backlight(panel_cntl); 2600 + else if (abm != NULL && abm->funcs->get_current_backlight != NULL) 2601 + return (int) abm->funcs->get_current_backlight(abm); 2602 + else 2593 2603 return DC_ERROR_UNEXPECTED; 2594 - 2595 - return (int) abm->funcs->get_current_backlight(abm); 2596 2604 } 2597 2605 2598 2606 int dc_link_get_target_backlight_pwm(const struct dc_link *link)
-10
drivers/gpu/drm/amd/display/dc/dce/dce_panel_cntl.c
··· 49 49 static unsigned int dce_get_16_bit_backlight_from_pwm(struct panel_cntl *panel_cntl) 50 50 { 51 51 uint64_t current_backlight; 52 - uint32_t round_result; 53 52 uint32_t bl_period, bl_int_count; 54 53 uint32_t bl_pwm, fractional_duty_cycle_en; 55 54 uint32_t bl_period_mask, bl_pwm_mask; ··· 82 83 83 84 current_backlight = div_u64(current_backlight, bl_period); 84 85 current_backlight = (current_backlight + 1) >> 1; 85 - 86 - current_backlight = (uint64_t)(current_backlight) * bl_period; 87 - 88 - round_result = (uint32_t)(current_backlight & 0xFFFFFFFF); 89 - 90 - round_result = (round_result >> (bl_int_count-1)) & 1; 91 - 92 - current_backlight >>= bl_int_count; 93 - current_backlight += round_result; 94 86 95 87 return (uint32_t)(current_backlight); 96 88 }
+35 -51
drivers/gpu/drm/amd/pm/inc/smu11_driver_if_cyan_skillfish.h
··· 33 33 #define TABLE_PMSTATUSLOG 3 // Called by Tools for Agm logging 34 34 #define TABLE_DPMCLOCKS 4 // Called by Driver; defined here, but not used, for backward compatible 35 35 #define TABLE_MOMENTARY_PM 5 // Called by Tools; defined here, but not used, for backward compatible 36 - #define TABLE_COUNT 6 36 + #define TABLE_SMU_METRICS 6 // Called by Driver 37 + #define TABLE_COUNT 7 37 38 38 - #define NUM_DSPCLK_LEVELS 8 39 - #define NUM_SOCCLK_DPM_LEVELS 8 40 - #define NUM_DCEFCLK_DPM_LEVELS 4 41 - #define NUM_FCLK_DPM_LEVELS 4 42 - #define NUM_MEMCLK_DPM_LEVELS 4 39 + typedef struct SmuMetricsTable_t { 40 + //CPU status 41 + uint16_t CoreFrequency[6]; //[MHz] 42 + uint32_t CorePower[6]; //[mW] 43 + uint16_t CoreTemperature[6]; //[centi-Celsius] 44 + uint16_t L3Frequency[2]; //[MHz] 45 + uint16_t L3Temperature[2]; //[centi-Celsius] 46 + uint16_t C0Residency[6]; //Percentage 43 47 44 - #define NUMBER_OF_PSTATES 8 45 - #define NUMBER_OF_CORES 8 48 + // GFX status 49 + uint16_t GfxclkFrequency; //[MHz] 50 + uint16_t GfxTemperature; //[centi-Celsius] 46 51 47 - typedef enum { 48 - S3_TYPE_ENTRY, 49 - S5_TYPE_ENTRY, 50 - } Sleep_Type_e; 52 + // SOC IP info 53 + uint16_t SocclkFrequency; //[MHz] 54 + uint16_t VclkFrequency; //[MHz] 55 + uint16_t DclkFrequency; //[MHz] 56 + uint16_t MemclkFrequency; //[MHz] 51 57 52 - typedef enum { 53 - GFX_OFF = 0, 54 - GFX_ON = 1, 55 - } GFX_Mode_e; 58 + // power, VF info for CPU/GFX telemetry rails, and then socket power total 59 + uint32_t Voltage[2]; //[mV] indices: VDDCR_VDD, VDDCR_GFX 60 + uint32_t Current[2]; //[mA] indices: VDDCR_VDD, VDDCR_GFX 61 + uint32_t Power[2]; //[mW] indices: VDDCR_VDD, VDDCR_GFX 62 + uint32_t CurrentSocketPower; //[mW] 56 63 57 - typedef enum { 58 - CPU_P0 = 0, 59 - CPU_P1, 60 - CPU_P2, 61 - CPU_P3, 62 - CPU_P4, 63 - CPU_P5, 64 - CPU_P6, 65 - CPU_P7 66 - } CPU_PState_e; 64 + uint16_t SocTemperature; //[centi-Celsius] 65 + uint16_t EdgeTemperature; 66 + uint16_t ThrottlerStatus; 67 + uint16_t Spare; 67 68 68 - typedef enum { 69 - CPU_CORE0 = 0, 70 - CPU_CORE1, 71 - CPU_CORE2, 72 - CPU_CORE3, 73 - CPU_CORE4, 74 - CPU_CORE5, 75 - CPU_CORE6, 76 - CPU_CORE7 77 - } CORE_ID_e; 69 + } SmuMetricsTable_t; 78 70 79 - typedef enum { 80 - DF_DPM0 = 0, 81 - DF_DPM1, 82 - DF_DPM2, 83 - DF_DPM3, 84 - DF_PState_Count 85 - } DF_PState_e; 86 - 87 - typedef enum { 88 - GFX_DPM0 = 0, 89 - GFX_DPM1, 90 - GFX_DPM2, 91 - GFX_DPM3, 92 - GFX_PState_Count 93 - } GFX_PState_e; 71 + typedef struct SmuMetrics_t { 72 + SmuMetricsTable_t Current; 73 + SmuMetricsTable_t Average; 74 + uint32_t SampleStartTime; 75 + uint32_t SampleStopTime; 76 + uint32_t Accnt; 77 + } SmuMetrics_t; 94 78 95 79 #endif
+4 -1
drivers/gpu/drm/amd/pm/inc/smu_types.h
··· 226 226 __SMU_DUMMY_MAP(SetUclkDpmMode), \ 227 227 __SMU_DUMMY_MAP(LightSBR), \ 228 228 __SMU_DUMMY_MAP(GfxDriverResetRecovery), \ 229 - __SMU_DUMMY_MAP(BoardPowerCalibration), 229 + __SMU_DUMMY_MAP(BoardPowerCalibration), \ 230 + __SMU_DUMMY_MAP(RequestGfxclk), \ 231 + __SMU_DUMMY_MAP(ForceGfxVid), \ 232 + __SMU_DUMMY_MAP(UnforceGfxVid), 230 233 231 234 #undef __SMU_DUMMY_MAP 232 235 #define __SMU_DUMMY_MAP(type) SMU_MSG_##type
+8 -1
drivers/gpu/drm/amd/pm/inc/smu_v11_8_ppsmc.h
··· 65 65 #define PPSMC_MSG_SetDriverTableVMID 0x34 66 66 #define PPSMC_MSG_SetSoftMinCclk 0x35 67 67 #define PPSMC_MSG_SetSoftMaxCclk 0x36 68 - #define PPSMC_Message_Count 0x37 68 + #define PPSMC_MSG_GetGfxFrequency 0x37 69 + #define PPSMC_MSG_GetGfxVid 0x38 70 + #define PPSMC_MSG_ForceGfxFreq 0x39 71 + #define PPSMC_MSG_UnForceGfxFreq 0x3A 72 + #define PPSMC_MSG_ForceGfxVid 0x3B 73 + #define PPSMC_MSG_UnforceGfxVid 0x3C 74 + #define PPSMC_MSG_GetEnabledSmuFeatures 0x3D 75 + #define PPSMC_Message_Count 0x3E 69 76 70 77 #endif
+1 -1
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
··· 1404 1404 */ 1405 1405 if (smu->uploading_custom_pp_table && 1406 1406 (adev->asic_type >= CHIP_NAVI10) && 1407 - (adev->asic_type <= CHIP_DIMGREY_CAVEFISH)) 1407 + (adev->asic_type <= CHIP_BEIGE_GOBY)) 1408 1408 return smu_disable_all_features_with_exception(smu, 1409 1409 true, 1410 1410 SMU_FEATURE_COUNT);
+6 -2
drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
··· 771 771 struct smu_11_0_dpm_context *dpm_context = NULL; 772 772 uint32_t gen_speed, lane_width; 773 773 774 - if (amdgpu_ras_intr_triggered()) 775 - return sysfs_emit(buf, "unavailable\n"); 774 + smu_cmn_get_sysfs_buf(&buf, &size); 775 + 776 + if (amdgpu_ras_intr_triggered()) { 777 + size += sysfs_emit_at(buf, size, "unavailable\n"); 778 + return size; 779 + } 776 780 777 781 dpm_context = smu_dpm->dpm_context; 778 782
+481
drivers/gpu/drm/amd/pm/swsmu/smu11/cyan_skillfish_ppt.c
··· 44 44 #undef pr_info 45 45 #undef pr_debug 46 46 47 + /* unit: MHz */ 48 + #define CYAN_SKILLFISH_SCLK_MIN 1000 49 + #define CYAN_SKILLFISH_SCLK_MAX 2000 50 + #define CYAN_SKILLFISH_SCLK_DEFAULT 1800 51 + 52 + /* unit: mV */ 53 + #define CYAN_SKILLFISH_VDDC_MIN 700 54 + #define CYAN_SKILLFISH_VDDC_MAX 1129 55 + #define CYAN_SKILLFISH_VDDC_MAGIC 5118 // 0x13fe 56 + 57 + static struct gfx_user_settings { 58 + uint32_t sclk; 59 + uint32_t vddc; 60 + } cyan_skillfish_user_settings; 61 + 62 + #define FEATURE_MASK(feature) (1ULL << feature) 63 + #define SMC_DPM_FEATURE ( \ 64 + FEATURE_MASK(FEATURE_FCLK_DPM_BIT) | \ 65 + FEATURE_MASK(FEATURE_SOC_DPM_BIT) | \ 66 + FEATURE_MASK(FEATURE_GFX_DPM_BIT)) 67 + 47 68 static struct cmn2asic_msg_mapping cyan_skillfish_message_map[SMU_MSG_MAX_COUNT] = { 48 69 MSG_MAP(TestMessage, PPSMC_MSG_TestMessage, 0), 49 70 MSG_MAP(GetSmuVersion, PPSMC_MSG_GetSmuVersion, 0), ··· 73 52 MSG_MAP(SetDriverDramAddrLow, PPSMC_MSG_SetDriverTableDramAddrLow, 0), 74 53 MSG_MAP(TransferTableSmu2Dram, PPSMC_MSG_TransferTableSmu2Dram, 0), 75 54 MSG_MAP(TransferTableDram2Smu, PPSMC_MSG_TransferTableDram2Smu, 0), 55 + MSG_MAP(GetEnabledSmuFeatures, PPSMC_MSG_GetEnabledSmuFeatures, 0), 56 + MSG_MAP(RequestGfxclk, PPSMC_MSG_RequestGfxclk, 0), 57 + MSG_MAP(ForceGfxVid, PPSMC_MSG_ForceGfxVid, 0), 58 + MSG_MAP(UnforceGfxVid, PPSMC_MSG_UnforceGfxVid, 0), 76 59 }; 60 + 61 + static struct cmn2asic_mapping cyan_skillfish_table_map[SMU_TABLE_COUNT] = { 62 + TAB_MAP_VALID(SMU_METRICS), 63 + }; 64 + 65 + static int cyan_skillfish_tables_init(struct smu_context *smu) 66 + { 67 + struct smu_table_context *smu_table = &smu->smu_table; 68 + struct smu_table *tables = smu_table->tables; 69 + 70 + SMU_TABLE_INIT(tables, SMU_TABLE_SMU_METRICS, 71 + sizeof(SmuMetrics_t), 72 + PAGE_SIZE, 73 + AMDGPU_GEM_DOMAIN_VRAM); 74 + 75 + smu_table->metrics_table = kzalloc(sizeof(SmuMetrics_t), GFP_KERNEL); 76 + if (!smu_table->metrics_table) 77 + goto err0_out; 78 + 79 + smu_table->gpu_metrics_table_size = sizeof(struct gpu_metrics_v2_2); 80 + smu_table->gpu_metrics_table = kzalloc(smu_table->gpu_metrics_table_size, GFP_KERNEL); 81 + if (!smu_table->gpu_metrics_table) 82 + goto err1_out; 83 + 84 + smu_table->metrics_time = 0; 85 + 86 + return 0; 87 + 88 + err1_out: 89 + smu_table->gpu_metrics_table_size = 0; 90 + kfree(smu_table->metrics_table); 91 + err0_out: 92 + return -ENOMEM; 93 + } 94 + 95 + static int cyan_skillfish_init_smc_tables(struct smu_context *smu) 96 + { 97 + int ret = 0; 98 + 99 + ret = cyan_skillfish_tables_init(smu); 100 + if (ret) 101 + return ret; 102 + 103 + return smu_v11_0_init_smc_tables(smu); 104 + } 105 + 106 + static int cyan_skillfish_finit_smc_tables(struct smu_context *smu) 107 + { 108 + struct smu_table_context *smu_table = &smu->smu_table; 109 + 110 + kfree(smu_table->metrics_table); 111 + smu_table->metrics_table = NULL; 112 + 113 + kfree(smu_table->gpu_metrics_table); 114 + smu_table->gpu_metrics_table = NULL; 115 + smu_table->gpu_metrics_table_size = 0; 116 + 117 + smu_table->metrics_time = 0; 118 + 119 + return 0; 120 + } 121 + 122 + static int 123 + cyan_skillfish_get_smu_metrics_data(struct smu_context *smu, 124 + MetricsMember_t member, 125 + uint32_t *value) 126 + { 127 + struct smu_table_context *smu_table = &smu->smu_table; 128 + SmuMetrics_t *metrics = (SmuMetrics_t *)smu_table->metrics_table; 129 + int ret = 0; 130 + 131 + mutex_lock(&smu->metrics_lock); 132 + 133 + ret = smu_cmn_get_metrics_table_locked(smu, NULL, false); 134 + if (ret) { 135 + mutex_unlock(&smu->metrics_lock); 136 + return ret; 137 + } 138 + 139 + switch (member) { 140 + case METRICS_CURR_GFXCLK: 141 + *value = metrics->Current.GfxclkFrequency; 142 + break; 143 + case METRICS_CURR_SOCCLK: 144 + *value = metrics->Current.SocclkFrequency; 145 + break; 146 + case METRICS_CURR_VCLK: 147 + *value = metrics->Current.VclkFrequency; 148 + break; 149 + case METRICS_CURR_DCLK: 150 + *value = metrics->Current.DclkFrequency; 151 + break; 152 + case METRICS_CURR_UCLK: 153 + *value = metrics->Current.MemclkFrequency; 154 + break; 155 + case METRICS_AVERAGE_SOCKETPOWER: 156 + *value = (metrics->Current.CurrentSocketPower << 8) / 157 + 1000; 158 + break; 159 + case METRICS_TEMPERATURE_EDGE: 160 + *value = metrics->Current.GfxTemperature / 100 * 161 + SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; 162 + break; 163 + case METRICS_TEMPERATURE_HOTSPOT: 164 + *value = metrics->Current.SocTemperature / 100 * 165 + SMU_TEMPERATURE_UNITS_PER_CENTIGRADES; 166 + break; 167 + case METRICS_VOLTAGE_VDDSOC: 168 + *value = metrics->Current.Voltage[0]; 169 + break; 170 + case METRICS_VOLTAGE_VDDGFX: 171 + *value = metrics->Current.Voltage[1]; 172 + break; 173 + case METRICS_THROTTLER_STATUS: 174 + *value = metrics->Current.ThrottlerStatus; 175 + break; 176 + default: 177 + *value = UINT_MAX; 178 + break; 179 + } 180 + 181 + mutex_unlock(&smu->metrics_lock); 182 + 183 + return ret; 184 + } 185 + 186 + static int cyan_skillfish_read_sensor(struct smu_context *smu, 187 + enum amd_pp_sensors sensor, 188 + void *data, 189 + uint32_t *size) 190 + { 191 + int ret = 0; 192 + 193 + if (!data || !size) 194 + return -EINVAL; 195 + 196 + mutex_lock(&smu->sensor_lock); 197 + 198 + switch (sensor) { 199 + case AMDGPU_PP_SENSOR_GFX_SCLK: 200 + ret = cyan_skillfish_get_smu_metrics_data(smu, 201 + METRICS_CURR_GFXCLK, 202 + (uint32_t *)data); 203 + *(uint32_t *)data *= 100; 204 + *size = 4; 205 + break; 206 + case AMDGPU_PP_SENSOR_GFX_MCLK: 207 + ret = cyan_skillfish_get_smu_metrics_data(smu, 208 + METRICS_CURR_UCLK, 209 + (uint32_t *)data); 210 + *(uint32_t *)data *= 100; 211 + *size = 4; 212 + break; 213 + case AMDGPU_PP_SENSOR_GPU_POWER: 214 + ret = cyan_skillfish_get_smu_metrics_data(smu, 215 + METRICS_AVERAGE_SOCKETPOWER, 216 + (uint32_t *)data); 217 + *size = 4; 218 + break; 219 + case AMDGPU_PP_SENSOR_HOTSPOT_TEMP: 220 + ret = cyan_skillfish_get_smu_metrics_data(smu, 221 + METRICS_TEMPERATURE_HOTSPOT, 222 + (uint32_t *)data); 223 + *size = 4; 224 + break; 225 + case AMDGPU_PP_SENSOR_EDGE_TEMP: 226 + ret = cyan_skillfish_get_smu_metrics_data(smu, 227 + METRICS_TEMPERATURE_EDGE, 228 + (uint32_t *)data); 229 + *size = 4; 230 + break; 231 + case AMDGPU_PP_SENSOR_VDDNB: 232 + ret = cyan_skillfish_get_smu_metrics_data(smu, 233 + METRICS_VOLTAGE_VDDSOC, 234 + (uint32_t *)data); 235 + *size = 4; 236 + break; 237 + case AMDGPU_PP_SENSOR_VDDGFX: 238 + ret = cyan_skillfish_get_smu_metrics_data(smu, 239 + METRICS_VOLTAGE_VDDGFX, 240 + (uint32_t *)data); 241 + *size = 4; 242 + break; 243 + default: 244 + ret = -EOPNOTSUPP; 245 + break; 246 + } 247 + 248 + mutex_unlock(&smu->sensor_lock); 249 + 250 + return ret; 251 + } 252 + 253 + static int cyan_skillfish_get_current_clk_freq(struct smu_context *smu, 254 + enum smu_clk_type clk_type, 255 + uint32_t *value) 256 + { 257 + MetricsMember_t member_type; 258 + 259 + switch (clk_type) { 260 + case SMU_GFXCLK: 261 + case SMU_SCLK: 262 + member_type = METRICS_CURR_GFXCLK; 263 + break; 264 + case SMU_FCLK: 265 + case SMU_MCLK: 266 + member_type = METRICS_CURR_UCLK; 267 + break; 268 + case SMU_SOCCLK: 269 + member_type = METRICS_CURR_SOCCLK; 270 + break; 271 + case SMU_VCLK: 272 + member_type = METRICS_CURR_VCLK; 273 + break; 274 + case SMU_DCLK: 275 + member_type = METRICS_CURR_DCLK; 276 + break; 277 + default: 278 + return -EINVAL; 279 + } 280 + 281 + return cyan_skillfish_get_smu_metrics_data(smu, member_type, value); 282 + } 283 + 284 + static int cyan_skillfish_print_clk_levels(struct smu_context *smu, 285 + enum smu_clk_type clk_type, 286 + char *buf) 287 + { 288 + int ret = 0, size = 0; 289 + uint32_t cur_value = 0; 290 + 291 + smu_cmn_get_sysfs_buf(&buf, &size); 292 + 293 + switch (clk_type) { 294 + case SMU_OD_SCLK: 295 + ret = cyan_skillfish_get_smu_metrics_data(smu, METRICS_CURR_GFXCLK, &cur_value); 296 + if (ret) 297 + return ret; 298 + size += sysfs_emit_at(buf, size,"%s:\n", "OD_SCLK"); 299 + size += sysfs_emit_at(buf, size, "0: %uMhz *\n", cur_value); 300 + break; 301 + case SMU_OD_VDDC_CURVE: 302 + ret = cyan_skillfish_get_smu_metrics_data(smu, METRICS_VOLTAGE_VDDGFX, &cur_value); 303 + if (ret) 304 + return ret; 305 + size += sysfs_emit_at(buf, size,"%s:\n", "OD_VDDC"); 306 + size += sysfs_emit_at(buf, size, "0: %umV *\n", cur_value); 307 + break; 308 + case SMU_OD_RANGE: 309 + size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE"); 310 + size += sysfs_emit_at(buf, size, "SCLK: %7uMhz %10uMhz\n", 311 + CYAN_SKILLFISH_SCLK_MIN, CYAN_SKILLFISH_SCLK_MAX); 312 + size += sysfs_emit_at(buf, size, "VDDC: %7umV %10umV\n", 313 + CYAN_SKILLFISH_VDDC_MIN, CYAN_SKILLFISH_VDDC_MAX); 314 + break; 315 + case SMU_GFXCLK: 316 + case SMU_SCLK: 317 + case SMU_FCLK: 318 + case SMU_MCLK: 319 + case SMU_SOCCLK: 320 + case SMU_VCLK: 321 + case SMU_DCLK: 322 + ret = cyan_skillfish_get_current_clk_freq(smu, clk_type, &cur_value); 323 + if (ret) 324 + return ret; 325 + size += sysfs_emit_at(buf, size, "0: %uMhz *\n", cur_value); 326 + break; 327 + default: 328 + dev_warn(smu->adev->dev, "Unsupported clock type\n"); 329 + return ret; 330 + } 331 + 332 + return size; 333 + } 334 + 335 + static bool cyan_skillfish_is_dpm_running(struct smu_context *smu) 336 + { 337 + struct amdgpu_device *adev = smu->adev; 338 + int ret = 0; 339 + uint32_t feature_mask[2]; 340 + uint64_t feature_enabled; 341 + 342 + /* we need to re-init after suspend so return false */ 343 + if (adev->in_suspend) 344 + return false; 345 + 346 + ret = smu_cmn_get_enabled_32_bits_mask(smu, feature_mask, 2); 347 + 348 + if (ret) 349 + return false; 350 + 351 + feature_enabled = (uint64_t)feature_mask[0] | 352 + ((uint64_t)feature_mask[1] << 32); 353 + 354 + return !!(feature_enabled & SMC_DPM_FEATURE); 355 + } 356 + 357 + static ssize_t cyan_skillfish_get_gpu_metrics(struct smu_context *smu, 358 + void **table) 359 + { 360 + struct smu_table_context *smu_table = &smu->smu_table; 361 + struct gpu_metrics_v2_2 *gpu_metrics = 362 + (struct gpu_metrics_v2_2 *)smu_table->gpu_metrics_table; 363 + SmuMetrics_t metrics; 364 + int i, ret = 0; 365 + 366 + ret = smu_cmn_get_metrics_table(smu, &metrics, true); 367 + if (ret) 368 + return ret; 369 + 370 + smu_cmn_init_soft_gpu_metrics(gpu_metrics, 2, 2); 371 + 372 + gpu_metrics->temperature_gfx = metrics.Current.GfxTemperature; 373 + gpu_metrics->temperature_soc = metrics.Current.SocTemperature; 374 + 375 + gpu_metrics->average_socket_power = metrics.Current.CurrentSocketPower; 376 + gpu_metrics->average_soc_power = metrics.Current.Power[0]; 377 + gpu_metrics->average_gfx_power = metrics.Current.Power[1]; 378 + 379 + gpu_metrics->average_gfxclk_frequency = metrics.Average.GfxclkFrequency; 380 + gpu_metrics->average_socclk_frequency = metrics.Average.SocclkFrequency; 381 + gpu_metrics->average_uclk_frequency = metrics.Average.MemclkFrequency; 382 + gpu_metrics->average_fclk_frequency = metrics.Average.MemclkFrequency; 383 + gpu_metrics->average_vclk_frequency = metrics.Average.VclkFrequency; 384 + gpu_metrics->average_dclk_frequency = metrics.Average.DclkFrequency; 385 + 386 + gpu_metrics->current_gfxclk = metrics.Current.GfxclkFrequency; 387 + gpu_metrics->current_socclk = metrics.Current.SocclkFrequency; 388 + gpu_metrics->current_uclk = metrics.Current.MemclkFrequency; 389 + gpu_metrics->current_fclk = metrics.Current.MemclkFrequency; 390 + gpu_metrics->current_vclk = metrics.Current.VclkFrequency; 391 + gpu_metrics->current_dclk = metrics.Current.DclkFrequency; 392 + 393 + for (i = 0; i < 6; i++) { 394 + gpu_metrics->temperature_core[i] = metrics.Current.CoreTemperature[i]; 395 + gpu_metrics->average_core_power[i] = metrics.Average.CorePower[i]; 396 + gpu_metrics->current_coreclk[i] = metrics.Current.CoreFrequency[i]; 397 + } 398 + 399 + for (i = 0; i < 2; i++) { 400 + gpu_metrics->temperature_l3[i] = metrics.Current.L3Temperature[i]; 401 + gpu_metrics->current_l3clk[i] = metrics.Current.L3Frequency[i]; 402 + } 403 + 404 + gpu_metrics->throttle_status = metrics.Current.ThrottlerStatus; 405 + gpu_metrics->system_clock_counter = ktime_get_boottime_ns(); 406 + 407 + *table = (void *)gpu_metrics; 408 + 409 + return sizeof(struct gpu_metrics_v2_2); 410 + } 411 + 412 + static int cyan_skillfish_od_edit_dpm_table(struct smu_context *smu, 413 + enum PP_OD_DPM_TABLE_COMMAND type, 414 + long input[], uint32_t size) 415 + { 416 + int ret = 0; 417 + uint32_t vid; 418 + 419 + switch (type) { 420 + case PP_OD_EDIT_VDDC_CURVE: 421 + if (size != 3 || input[0] != 0) { 422 + dev_err(smu->adev->dev, "Invalid parameter!\n"); 423 + return -EINVAL; 424 + } 425 + 426 + if (input[1] <= CYAN_SKILLFISH_SCLK_MIN || 427 + input[1] > CYAN_SKILLFISH_SCLK_MAX) { 428 + dev_err(smu->adev->dev, "Invalid sclk! Valid sclk range: %uMHz - %uMhz\n", 429 + CYAN_SKILLFISH_SCLK_MIN, CYAN_SKILLFISH_SCLK_MAX); 430 + return -EINVAL; 431 + } 432 + 433 + if (input[2] <= CYAN_SKILLFISH_VDDC_MIN || 434 + input[2] > CYAN_SKILLFISH_VDDC_MAX) { 435 + dev_err(smu->adev->dev, "Invalid vddc! Valid vddc range: %umV - %umV\n", 436 + CYAN_SKILLFISH_VDDC_MIN, CYAN_SKILLFISH_VDDC_MAX); 437 + return -EINVAL; 438 + } 439 + 440 + cyan_skillfish_user_settings.sclk = input[1]; 441 + cyan_skillfish_user_settings.vddc = input[2]; 442 + 443 + break; 444 + case PP_OD_RESTORE_DEFAULT_TABLE: 445 + if (size != 0) { 446 + dev_err(smu->adev->dev, "Invalid parameter!\n"); 447 + return -EINVAL; 448 + } 449 + 450 + cyan_skillfish_user_settings.sclk = CYAN_SKILLFISH_SCLK_DEFAULT; 451 + cyan_skillfish_user_settings.vddc = CYAN_SKILLFISH_VDDC_MAGIC; 452 + 453 + break; 454 + case PP_OD_COMMIT_DPM_TABLE: 455 + if (size != 0) { 456 + dev_err(smu->adev->dev, "Invalid parameter!\n"); 457 + return -EINVAL; 458 + } 459 + 460 + if (cyan_skillfish_user_settings.sclk < CYAN_SKILLFISH_SCLK_MIN || 461 + cyan_skillfish_user_settings.sclk > CYAN_SKILLFISH_SCLK_MAX) { 462 + dev_err(smu->adev->dev, "Invalid sclk! Valid sclk range: %uMHz - %uMhz\n", 463 + CYAN_SKILLFISH_SCLK_MIN, CYAN_SKILLFISH_SCLK_MAX); 464 + return -EINVAL; 465 + } 466 + 467 + if ((cyan_skillfish_user_settings.vddc != CYAN_SKILLFISH_VDDC_MAGIC) && 468 + (cyan_skillfish_user_settings.vddc < CYAN_SKILLFISH_VDDC_MIN || 469 + cyan_skillfish_user_settings.vddc > CYAN_SKILLFISH_VDDC_MAX)) { 470 + dev_err(smu->adev->dev, "Invalid vddc! Valid vddc range: %umV - %umV\n", 471 + CYAN_SKILLFISH_VDDC_MIN, CYAN_SKILLFISH_VDDC_MAX); 472 + return -EINVAL; 473 + } 474 + 475 + ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_RequestGfxclk, 476 + cyan_skillfish_user_settings.sclk, NULL); 477 + if (ret) { 478 + dev_err(smu->adev->dev, "Set sclk failed!\n"); 479 + return ret; 480 + } 481 + 482 + if (cyan_skillfish_user_settings.vddc == CYAN_SKILLFISH_VDDC_MAGIC) { 483 + ret = smu_cmn_send_smc_msg(smu, SMU_MSG_UnforceGfxVid, NULL); 484 + if (ret) { 485 + dev_err(smu->adev->dev, "Unforce vddc failed!\n"); 486 + return ret; 487 + } 488 + } else { 489 + /* 490 + * PMFW accepts SVI2 VID code, convert voltage to VID: 491 + * vid = (uint32_t)((1.55 - voltage) * 160.0 + 0.00001) 492 + */ 493 + vid = (1550 - cyan_skillfish_user_settings.vddc) * 160 / 1000; 494 + ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_ForceGfxVid, vid, NULL); 495 + if (ret) { 496 + dev_err(smu->adev->dev, "Force vddc failed!\n"); 497 + return ret; 498 + } 499 + } 500 + 501 + break; 502 + default: 503 + return -EOPNOTSUPP; 504 + } 505 + 506 + return ret; 507 + } 77 508 78 509 static const struct pptable_funcs cyan_skillfish_ppt_funcs = { 79 510 ··· 533 60 .check_fw_version = smu_v11_0_check_fw_version, 534 61 .init_power = smu_v11_0_init_power, 535 62 .fini_power = smu_v11_0_fini_power, 63 + .init_smc_tables = cyan_skillfish_init_smc_tables, 64 + .fini_smc_tables = cyan_skillfish_finit_smc_tables, 65 + .read_sensor = cyan_skillfish_read_sensor, 66 + .print_clk_levels = cyan_skillfish_print_clk_levels, 67 + .is_dpm_running = cyan_skillfish_is_dpm_running, 68 + .get_gpu_metrics = cyan_skillfish_get_gpu_metrics, 69 + .od_edit_dpm_table = cyan_skillfish_od_edit_dpm_table, 536 70 .register_irq_handler = smu_v11_0_register_irq_handler, 537 71 .notify_memory_pool_location = smu_v11_0_notify_memory_pool_location, 538 72 .send_smc_msg_with_param = smu_cmn_send_smc_msg_with_param, ··· 552 72 { 553 73 smu->ppt_funcs = &cyan_skillfish_ppt_funcs; 554 74 smu->message_map = cyan_skillfish_message_map; 75 + smu->table_map = cyan_skillfish_table_map; 555 76 smu->is_apu = true; 556 77 }
+25 -3
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c
··· 1279 1279 struct smu_11_0_overdrive_table *od_settings = smu->od_settings; 1280 1280 uint32_t min_value, max_value; 1281 1281 1282 + smu_cmn_get_sysfs_buf(&buf, &size); 1283 + 1282 1284 switch (clk_type) { 1283 1285 case SMU_GFXCLK: 1284 1286 case SMU_SCLK: ··· 1394 1392 case SMU_OD_RANGE: 1395 1393 if (!smu->od_enabled || !od_table || !od_settings) 1396 1394 break; 1397 - size = sysfs_emit(buf, "%s:\n", "OD_RANGE"); 1395 + size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE"); 1398 1396 1399 1397 if (navi10_od_feature_is_supported(od_settings, SMU_11_0_ODCAP_GFXCLK_LIMITS)) { 1400 1398 navi10_od_setting_get_range(od_settings, SMU_11_0_ODSETTING_GFXCLKFMIN, ··· 2274 2272 { 2275 2273 struct amdgpu_device *adev = smu->adev; 2276 2274 2277 - if (adev->in_runpm) 2275 + /* 2276 + * This aims the case below: 2277 + * amdgpu driver loaded -> runpm suspend kicked -> sound driver loaded 2278 + * 2279 + * For NAVI10 and later ASICs, we rely on PMFW to handle the runpm. To 2280 + * make that possible, PMFW needs to acknowledge the dstate transition 2281 + * process for both gfx(function 0) and audio(function 1) function of 2282 + * the ASIC. 2283 + * 2284 + * The PCI device's initial runpm status is RUNPM_SUSPENDED. So as the 2285 + * device representing the audio function of the ASIC. And that means 2286 + * even if the sound driver(snd_hda_intel) was not loaded yet, it's still 2287 + * possible runpm suspend kicked on the ASIC. However without the dstate 2288 + * transition notification from audio function, pmfw cannot handle the 2289 + * BACO in/exit correctly. And that will cause driver hang on runpm 2290 + * resuming. 2291 + * 2292 + * To address this, we revert to legacy message way(driver masters the 2293 + * timing for BACO in/exit) on sound driver missing. 2294 + */ 2295 + if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev)) 2278 2296 return smu_v11_0_baco_set_armd3_sequence(smu, BACO_SEQ_BACO); 2279 2297 else 2280 2298 return smu_v11_0_baco_enter(smu); ··· 2304 2282 { 2305 2283 struct amdgpu_device *adev = smu->adev; 2306 2284 2307 - if (adev->in_runpm) { 2285 + if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev)) { 2308 2286 /* Wait for PMFW handling for the Dstate change */ 2309 2287 msleep(10); 2310 2288 return smu_v11_0_baco_set_armd3_sequence(smu, BACO_SEQ_ULPS);
+5 -3
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
··· 1058 1058 uint32_t min_value, max_value; 1059 1059 uint32_t smu_version; 1060 1060 1061 + smu_cmn_get_sysfs_buf(&buf, &size); 1062 + 1061 1063 switch (clk_type) { 1062 1064 case SMU_GFXCLK: 1063 1065 case SMU_SCLK: ··· 1182 1180 if (!smu->od_enabled || !od_table || !od_settings) 1183 1181 break; 1184 1182 1185 - size = sysfs_emit(buf, "%s:\n", "OD_RANGE"); 1183 + size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE"); 1186 1184 1187 1185 if (sienna_cichlid_is_od_feature_supported(od_settings, SMU_11_0_7_ODCAP_GFXCLK_LIMITS)) { 1188 1186 sienna_cichlid_get_od_setting_range(od_settings, SMU_11_0_7_ODSETTING_GFXCLKFMIN, ··· 2189 2187 { 2190 2188 struct amdgpu_device *adev = smu->adev; 2191 2189 2192 - if (adev->in_runpm) 2190 + if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev)) 2193 2191 return smu_v11_0_baco_set_armd3_sequence(smu, BACO_SEQ_BACO); 2194 2192 else 2195 2193 return smu_v11_0_baco_enter(smu); ··· 2199 2197 { 2200 2198 struct amdgpu_device *adev = smu->adev; 2201 2199 2202 - if (adev->in_runpm) { 2200 + if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev)) { 2203 2201 /* Wait for PMFW handling for the Dstate change */ 2204 2202 msleep(10); 2205 2203 return smu_v11_0_baco_set_armd3_sequence(smu, BACO_SEQ_ULPS);
+10 -6
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
··· 589 589 if (ret) 590 590 return ret; 591 591 592 + smu_cmn_get_sysfs_buf(&buf, &size); 593 + 592 594 switch (clk_type) { 593 595 case SMU_OD_SCLK: 594 596 if (smu_dpm_ctx->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL) { 595 - size = sysfs_emit(buf, "%s:\n", "OD_SCLK"); 597 + size += sysfs_emit_at(buf, size, "%s:\n", "OD_SCLK"); 596 598 size += sysfs_emit_at(buf, size, "0: %10uMhz\n", 597 599 (smu->gfx_actual_hard_min_freq > 0) ? smu->gfx_actual_hard_min_freq : smu->gfx_default_hard_min_freq); 598 600 size += sysfs_emit_at(buf, size, "1: %10uMhz\n", ··· 603 601 break; 604 602 case SMU_OD_CCLK: 605 603 if (smu_dpm_ctx->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL) { 606 - size = sysfs_emit(buf, "CCLK_RANGE in Core%d:\n", smu->cpu_core_id_select); 604 + size += sysfs_emit_at(buf, size, "CCLK_RANGE in Core%d:\n", smu->cpu_core_id_select); 607 605 size += sysfs_emit_at(buf, size, "0: %10uMhz\n", 608 606 (smu->cpu_actual_soft_min_freq > 0) ? smu->cpu_actual_soft_min_freq : smu->cpu_default_soft_min_freq); 609 607 size += sysfs_emit_at(buf, size, "1: %10uMhz\n", ··· 612 610 break; 613 611 case SMU_OD_RANGE: 614 612 if (smu_dpm_ctx->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL) { 615 - size = sysfs_emit(buf, "%s:\n", "OD_RANGE"); 613 + size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE"); 616 614 size += sysfs_emit_at(buf, size, "SCLK: %7uMhz %10uMhz\n", 617 615 smu->gfx_default_hard_min_freq, smu->gfx_default_soft_max_freq); 618 616 size += sysfs_emit_at(buf, size, "CCLK: %7uMhz %10uMhz\n", ··· 690 688 if (ret) 691 689 return ret; 692 690 691 + smu_cmn_get_sysfs_buf(&buf, &size); 692 + 693 693 switch (clk_type) { 694 694 case SMU_OD_SCLK: 695 695 if (smu_dpm_ctx->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL) { 696 - size = sysfs_emit(buf, "%s:\n", "OD_SCLK"); 696 + size += sysfs_emit_at(buf, size, "%s:\n", "OD_SCLK"); 697 697 size += sysfs_emit_at(buf, size, "0: %10uMhz\n", 698 698 (smu->gfx_actual_hard_min_freq > 0) ? smu->gfx_actual_hard_min_freq : smu->gfx_default_hard_min_freq); 699 699 size += sysfs_emit_at(buf, size, "1: %10uMhz\n", ··· 704 700 break; 705 701 case SMU_OD_CCLK: 706 702 if (smu_dpm_ctx->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL) { 707 - size = sysfs_emit(buf, "CCLK_RANGE in Core%d:\n", smu->cpu_core_id_select); 703 + size += sysfs_emit_at(buf, size, "CCLK_RANGE in Core%d:\n", smu->cpu_core_id_select); 708 704 size += sysfs_emit_at(buf, size, "0: %10uMhz\n", 709 705 (smu->cpu_actual_soft_min_freq > 0) ? smu->cpu_actual_soft_min_freq : smu->cpu_default_soft_min_freq); 710 706 size += sysfs_emit_at(buf, size, "1: %10uMhz\n", ··· 713 709 break; 714 710 case SMU_OD_RANGE: 715 711 if (smu_dpm_ctx->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL) { 716 - size = sysfs_emit(buf, "%s:\n", "OD_RANGE"); 712 + size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE"); 717 713 size += sysfs_emit_at(buf, size, "SCLK: %7uMhz %10uMhz\n", 718 714 smu->gfx_default_hard_min_freq, smu->gfx_default_soft_max_freq); 719 715 size += sysfs_emit_at(buf, size, "CCLK: %7uMhz %10uMhz\n",
+2
drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
··· 497 497 if (ret) 498 498 return ret; 499 499 500 + smu_cmn_get_sysfs_buf(&buf, &size); 501 + 500 502 switch (clk_type) { 501 503 case SMU_OD_RANGE: 502 504 if (smu_dpm_ctx->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL) {
+8 -4
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
··· 733 733 uint32_t freq_values[3] = {0}; 734 734 uint32_t min_clk, max_clk; 735 735 736 - if (amdgpu_ras_intr_triggered()) 737 - return sysfs_emit(buf, "unavailable\n"); 736 + smu_cmn_get_sysfs_buf(&buf, &size); 737 + 738 + if (amdgpu_ras_intr_triggered()) { 739 + size += sysfs_emit_at(buf, size, "unavailable\n"); 740 + return size; 741 + } 738 742 739 743 dpm_context = smu_dpm->dpm_context; 740 744 741 745 switch (type) { 742 746 743 747 case SMU_OD_SCLK: 744 - size = sysfs_emit(buf, "%s:\n", "GFXCLK"); 748 + size += sysfs_emit_at(buf, size, "%s:\n", "GFXCLK"); 745 749 fallthrough; 746 750 case SMU_SCLK: 747 751 ret = aldebaran_get_current_clk_freq_by_table(smu, SMU_GFXCLK, &now); ··· 799 795 break; 800 796 801 797 case SMU_OD_MCLK: 802 - size = sysfs_emit(buf, "%s:\n", "MCLK"); 798 + size += sysfs_emit_at(buf, size, "%s:\n", "MCLK"); 803 799 fallthrough; 804 800 case SMU_MCLK: 805 801 ret = aldebaran_get_current_clk_freq_by_table(smu, SMU_UCLK, &now);
+4 -2
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c
··· 1052 1052 int i, size = 0, ret = 0; 1053 1053 uint32_t cur_value = 0, value = 0, count = 0; 1054 1054 1055 + smu_cmn_get_sysfs_buf(&buf, &size); 1056 + 1055 1057 switch (clk_type) { 1056 1058 case SMU_OD_SCLK: 1057 - size = sysfs_emit(buf, "%s:\n", "OD_SCLK"); 1059 + size += sysfs_emit_at(buf, size, "%s:\n", "OD_SCLK"); 1058 1060 size += sysfs_emit_at(buf, size, "0: %10uMhz\n", 1059 1061 (smu->gfx_actual_hard_min_freq > 0) ? smu->gfx_actual_hard_min_freq : smu->gfx_default_hard_min_freq); 1060 1062 size += sysfs_emit_at(buf, size, "1: %10uMhz\n", 1061 1063 (smu->gfx_actual_soft_max_freq > 0) ? smu->gfx_actual_soft_max_freq : smu->gfx_default_soft_max_freq); 1062 1064 break; 1063 1065 case SMU_OD_RANGE: 1064 - size = sysfs_emit(buf, "%s:\n", "OD_RANGE"); 1066 + size += sysfs_emit_at(buf, size, "%s:\n", "OD_RANGE"); 1065 1067 size += sysfs_emit_at(buf, size, "SCLK: %7uMhz %10uMhz\n", 1066 1068 smu->gfx_default_hard_min_freq, smu->gfx_default_soft_max_freq); 1067 1069 break;
+21
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
··· 1053 1053 1054 1054 return ret; 1055 1055 } 1056 + 1057 + bool smu_cmn_is_audio_func_enabled(struct amdgpu_device *adev) 1058 + { 1059 + struct pci_dev *p = NULL; 1060 + bool snd_driver_loaded; 1061 + 1062 + /* 1063 + * If the ASIC comes with no audio function, we always assume 1064 + * it is "enabled". 1065 + */ 1066 + p = pci_get_domain_bus_and_slot(pci_domain_nr(adev->pdev->bus), 1067 + adev->pdev->bus->number, 1); 1068 + if (!p) 1069 + return true; 1070 + 1071 + snd_driver_loaded = pci_is_enabled(p) ? true : false; 1072 + 1073 + pci_dev_put(p); 1074 + 1075 + return snd_driver_loaded; 1076 + }
+15
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h
··· 110 110 int smu_cmn_set_mp1_state(struct smu_context *smu, 111 111 enum pp_mp1_state mp1_state); 112 112 113 + /* 114 + * Helper function to make sysfs_emit_at() happy. Align buf to 115 + * the current page boundary and record the offset. 116 + */ 117 + static inline void smu_cmn_get_sysfs_buf(char **buf, int *offset) 118 + { 119 + if (!*buf || !offset) 120 + return; 121 + 122 + *offset = offset_in_page(*buf); 123 + *buf -= *offset; 124 + } 125 + 126 + bool smu_cmn_is_audio_func_enabled(struct amdgpu_device *adev); 127 + 113 128 #endif 114 129 #endif
+1 -2
drivers/gpu/drm/etnaviv/etnaviv_buffer.c
··· 397 397 if (switch_mmu_context) { 398 398 struct etnaviv_iommu_context *old_context = gpu->mmu_context; 399 399 400 - etnaviv_iommu_context_get(mmu_context); 401 - gpu->mmu_context = mmu_context; 400 + gpu->mmu_context = etnaviv_iommu_context_get(mmu_context); 402 401 etnaviv_iommu_context_put(old_context); 403 402 } 404 403
+1 -2
drivers/gpu/drm/etnaviv/etnaviv_gem.c
··· 294 294 list_del(&mapping->obj_node); 295 295 } 296 296 297 - etnaviv_iommu_context_get(mmu_context); 298 - mapping->context = mmu_context; 297 + mapping->context = etnaviv_iommu_context_get(mmu_context); 299 298 mapping->use = 1; 300 299 301 300 ret = etnaviv_iommu_map_gem(mmu_context, etnaviv_obj,
+1 -2
drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
··· 532 532 goto err_submit_objects; 533 533 534 534 submit->ctx = file->driver_priv; 535 - etnaviv_iommu_context_get(submit->ctx->mmu); 536 - submit->mmu_context = submit->ctx->mmu; 535 + submit->mmu_context = etnaviv_iommu_context_get(submit->ctx->mmu); 537 536 submit->exec_state = args->exec_state; 538 537 submit->flags = args->flags; 539 538
+25 -18
drivers/gpu/drm/etnaviv/etnaviv_gpu.c
··· 569 569 /* We rely on the GPU running, so program the clock */ 570 570 etnaviv_gpu_update_clock(gpu); 571 571 572 + gpu->fe_running = false; 573 + gpu->exec_state = -1; 574 + if (gpu->mmu_context) 575 + etnaviv_iommu_context_put(gpu->mmu_context); 576 + gpu->mmu_context = NULL; 577 + 572 578 return 0; 573 579 } 574 580 ··· 643 637 VIVS_MMUv2_SEC_COMMAND_CONTROL_ENABLE | 644 638 VIVS_MMUv2_SEC_COMMAND_CONTROL_PREFETCH(prefetch)); 645 639 } 640 + 641 + gpu->fe_running = true; 646 642 } 647 643 648 - static void etnaviv_gpu_start_fe_idleloop(struct etnaviv_gpu *gpu) 644 + static void etnaviv_gpu_start_fe_idleloop(struct etnaviv_gpu *gpu, 645 + struct etnaviv_iommu_context *context) 649 646 { 650 - u32 address = etnaviv_cmdbuf_get_va(&gpu->buffer, 651 - &gpu->mmu_context->cmdbuf_mapping); 652 647 u16 prefetch; 648 + u32 address; 653 649 654 650 /* setup the MMU */ 655 - etnaviv_iommu_restore(gpu, gpu->mmu_context); 651 + etnaviv_iommu_restore(gpu, context); 656 652 657 653 /* Start command processor */ 658 654 prefetch = etnaviv_buffer_init(gpu); 655 + address = etnaviv_cmdbuf_get_va(&gpu->buffer, 656 + &gpu->mmu_context->cmdbuf_mapping); 659 657 660 658 etnaviv_gpu_start_fe(gpu, address, prefetch); 661 659 } ··· 842 832 /* Now program the hardware */ 843 833 mutex_lock(&gpu->lock); 844 834 etnaviv_gpu_hw_init(gpu); 845 - gpu->exec_state = -1; 846 835 mutex_unlock(&gpu->lock); 847 836 848 837 pm_runtime_mark_last_busy(gpu->dev); ··· 1066 1057 spin_unlock(&gpu->event_spinlock); 1067 1058 1068 1059 etnaviv_gpu_hw_init(gpu); 1069 - gpu->exec_state = -1; 1070 - gpu->mmu_context = NULL; 1071 1060 1072 1061 mutex_unlock(&gpu->lock); 1073 1062 pm_runtime_mark_last_busy(gpu->dev); ··· 1377 1370 goto out_unlock; 1378 1371 } 1379 1372 1380 - if (!gpu->mmu_context) { 1381 - etnaviv_iommu_context_get(submit->mmu_context); 1382 - gpu->mmu_context = submit->mmu_context; 1383 - etnaviv_gpu_start_fe_idleloop(gpu); 1384 - } else { 1385 - etnaviv_iommu_context_get(gpu->mmu_context); 1386 - submit->prev_mmu_context = gpu->mmu_context; 1387 - } 1373 + if (!gpu->fe_running) 1374 + etnaviv_gpu_start_fe_idleloop(gpu, submit->mmu_context); 1375 + 1376 + if (submit->prev_mmu_context) 1377 + etnaviv_iommu_context_put(submit->prev_mmu_context); 1378 + submit->prev_mmu_context = etnaviv_iommu_context_get(gpu->mmu_context); 1388 1379 1389 1380 if (submit->nr_pmrs) { 1390 1381 gpu->event[event[1]].sync_point = &sync_point_perfmon_sample_pre; ··· 1584 1579 1585 1580 static int etnaviv_gpu_hw_suspend(struct etnaviv_gpu *gpu) 1586 1581 { 1587 - if (gpu->initialized && gpu->mmu_context) { 1582 + if (gpu->initialized && gpu->fe_running) { 1588 1583 /* Replace the last WAIT with END */ 1589 1584 mutex_lock(&gpu->lock); 1590 1585 etnaviv_buffer_end(gpu); ··· 1597 1592 */ 1598 1593 etnaviv_gpu_wait_idle(gpu, 100); 1599 1594 1600 - etnaviv_iommu_context_put(gpu->mmu_context); 1601 - gpu->mmu_context = NULL; 1595 + gpu->fe_running = false; 1602 1596 } 1603 1597 1604 1598 gpu->exec_state = -1; ··· 1744 1740 #else 1745 1741 etnaviv_gpu_hw_suspend(gpu); 1746 1742 #endif 1743 + 1744 + if (gpu->mmu_context) 1745 + etnaviv_iommu_context_put(gpu->mmu_context); 1747 1746 1748 1747 if (gpu->initialized) { 1749 1748 etnaviv_cmdbuf_free(&gpu->buffer);
+1
drivers/gpu/drm/etnaviv/etnaviv_gpu.h
··· 101 101 struct workqueue_struct *wq; 102 102 struct drm_gpu_scheduler sched; 103 103 bool initialized; 104 + bool fe_running; 104 105 105 106 /* 'ring'-buffer: */ 106 107 struct etnaviv_cmdbuf buffer;
+4
drivers/gpu/drm/etnaviv/etnaviv_iommu.c
··· 92 92 struct etnaviv_iommuv1_context *v1_context = to_v1_context(context); 93 93 u32 pgtable; 94 94 95 + if (gpu->mmu_context) 96 + etnaviv_iommu_context_put(gpu->mmu_context); 97 + gpu->mmu_context = etnaviv_iommu_context_get(context); 98 + 95 99 /* set base addresses */ 96 100 gpu_write(gpu, VIVS_MC_MEMORY_BASE_ADDR_RA, context->global->memory_base); 97 101 gpu_write(gpu, VIVS_MC_MEMORY_BASE_ADDR_FE, context->global->memory_base);
+8
drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c
··· 172 172 if (gpu_read(gpu, VIVS_MMUv2_CONTROL) & VIVS_MMUv2_CONTROL_ENABLE) 173 173 return; 174 174 175 + if (gpu->mmu_context) 176 + etnaviv_iommu_context_put(gpu->mmu_context); 177 + gpu->mmu_context = etnaviv_iommu_context_get(context); 178 + 175 179 prefetch = etnaviv_buffer_config_mmuv2(gpu, 176 180 (u32)v2_context->mtlb_dma, 177 181 (u32)context->global->bad_page_dma); ··· 195 191 /* If the MMU is already enabled the state is still there. */ 196 192 if (gpu_read(gpu, VIVS_MMUv2_SEC_CONTROL) & VIVS_MMUv2_SEC_CONTROL_ENABLE) 197 193 return; 194 + 195 + if (gpu->mmu_context) 196 + etnaviv_iommu_context_put(gpu->mmu_context); 197 + gpu->mmu_context = etnaviv_iommu_context_get(context); 198 198 199 199 gpu_write(gpu, VIVS_MMUv2_PTA_ADDRESS_LOW, 200 200 lower_32_bits(context->global->v2.pta_dma));
+1
drivers/gpu/drm/etnaviv/etnaviv_mmu.c
··· 199 199 */ 200 200 list_for_each_entry_safe(m, n, &list, scan_node) { 201 201 etnaviv_iommu_remove_mapping(context, m); 202 + etnaviv_iommu_context_put(m->context); 202 203 m->context = NULL; 203 204 list_del_init(&m->mmu_node); 204 205 list_del_init(&m->scan_node);
+3 -1
drivers/gpu/drm/etnaviv/etnaviv_mmu.h
··· 105 105 struct etnaviv_iommu_context * 106 106 etnaviv_iommu_context_init(struct etnaviv_iommu_global *global, 107 107 struct etnaviv_cmdbuf_suballoc *suballoc); 108 - static inline void etnaviv_iommu_context_get(struct etnaviv_iommu_context *ctx) 108 + static inline struct etnaviv_iommu_context * 109 + etnaviv_iommu_context_get(struct etnaviv_iommu_context *ctx) 109 110 { 110 111 kref_get(&ctx->refcount); 112 + return ctx; 111 113 } 112 114 void etnaviv_iommu_context_put(struct etnaviv_iommu_context *ctx); 113 115 void etnaviv_iommu_restore(struct etnaviv_gpu *gpu,
-1
drivers/gpu/drm/i915/Makefile
··· 19 19 subdir-ccflags-y += $(call cc-disable-warning, unused-but-set-variable) 20 20 # clang warnings 21 21 subdir-ccflags-y += $(call cc-disable-warning, sign-compare) 22 - subdir-ccflags-y += $(call cc-disable-warning, sometimes-uninitialized) 23 22 subdir-ccflags-y += $(call cc-disable-warning, initializer-overrides) 24 23 subdir-ccflags-y += $(call cc-disable-warning, frame-address) 25 24 subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror
+4 -1
drivers/gpu/drm/i915/display/intel_dp.c
··· 2445 2445 */ 2446 2446 if (drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV, 2447 2447 intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd)) == 2448 - sizeof(intel_dp->edp_dpcd)) 2448 + sizeof(intel_dp->edp_dpcd)) { 2449 2449 drm_dbg_kms(&dev_priv->drm, "eDP DPCD: %*ph\n", 2450 2450 (int)sizeof(intel_dp->edp_dpcd), 2451 2451 intel_dp->edp_dpcd); 2452 + 2453 + intel_dp->use_max_params = intel_dp->edp_dpcd[0] < DP_EDP_14; 2454 + } 2452 2455 2453 2456 /* 2454 2457 * This has to be called after intel_dp->edp_dpcd is filled, PSR checks
+3 -3
drivers/gpu/drm/i915/gem/i915_gem_context.c
··· 986 986 trace_i915_context_free(ctx); 987 987 GEM_BUG_ON(!i915_gem_context_is_closed(ctx)); 988 988 989 + if (ctx->syncobj) 990 + drm_syncobj_put(ctx->syncobj); 991 + 989 992 mutex_destroy(&ctx->engines_mutex); 990 993 mutex_destroy(&ctx->lut_mutex); 991 994 ··· 1207 1204 vm = i915_gem_context_vm(ctx); 1208 1205 if (vm) 1209 1206 i915_vm_close(vm); 1210 - 1211 - if (ctx->syncobj) 1212 - drm_syncobj_put(ctx->syncobj); 1213 1207 1214 1208 ctx->file_priv = ERR_PTR(-EBADF); 1215 1209
+4 -3
drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c
··· 59 59 err = PTR_ERR(import); 60 60 goto out_dmabuf; 61 61 } 62 + import_obj = to_intel_bo(import); 62 63 63 64 if (import != &obj->base) { 64 65 pr_err("i915_gem_prime_import created a new object!\n"); 65 66 err = -EINVAL; 66 67 goto out_import; 67 68 } 68 - import_obj = to_intel_bo(import); 69 69 70 70 i915_gem_object_lock(import_obj, NULL); 71 71 err = __i915_gem_object_get_pages(import_obj); ··· 128 128 pr_err("i915_gem_prime_import failed with the wrong err=%ld\n", 129 129 PTR_ERR(import)); 130 130 err = PTR_ERR(import); 131 + } else { 132 + err = 0; 131 133 } 132 134 133 135 dma_buf_put(dmabuf); ··· 178 176 err = PTR_ERR(import); 179 177 goto out_dmabuf; 180 178 } 179 + import_obj = to_intel_bo(import); 181 180 182 181 if (import == &obj->base) { 183 182 pr_err("i915_gem_prime_import reused gem object!\n"); 184 183 err = -EINVAL; 185 184 goto out_import; 186 185 } 187 - 188 - import_obj = to_intel_bo(import); 189 186 190 187 i915_gem_object_lock(import_obj, NULL); 191 188 err = __i915_gem_object_get_pages(import_obj);
+20 -6
drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
··· 581 581 return I915_MMAP_TYPE_GTT; 582 582 } 583 583 584 + static struct drm_i915_gem_object * 585 + create_sys_or_internal(struct drm_i915_private *i915, 586 + unsigned long size) 587 + { 588 + if (HAS_LMEM(i915)) { 589 + struct intel_memory_region *sys_region = 590 + i915->mm.regions[INTEL_REGION_SMEM]; 591 + 592 + return __i915_gem_object_create_user(i915, size, &sys_region, 1); 593 + } 594 + 595 + return i915_gem_object_create_internal(i915, size); 596 + } 597 + 584 598 static bool assert_mmap_offset(struct drm_i915_private *i915, 585 599 unsigned long size, 586 600 int expected) ··· 603 589 u64 offset; 604 590 int ret; 605 591 606 - obj = i915_gem_object_create_internal(i915, size); 592 + obj = create_sys_or_internal(i915, size); 607 593 if (IS_ERR(obj)) 608 594 return expected && expected == PTR_ERR(obj); 609 595 ··· 647 633 struct drm_mm_node *hole, *next; 648 634 int loop, err = 0; 649 635 u64 offset; 636 + int enospc = HAS_LMEM(i915) ? -ENXIO : -ENOSPC; 650 637 651 638 /* Disable background reaper */ 652 639 disable_retire_worker(i915); ··· 698 683 } 699 684 700 685 /* Too large */ 701 - if (!assert_mmap_offset(i915, 2 * PAGE_SIZE, -ENOSPC)) { 686 + if (!assert_mmap_offset(i915, 2 * PAGE_SIZE, enospc)) { 702 687 pr_err("Unexpectedly succeeded in inserting too large object into single page hole\n"); 703 688 err = -EINVAL; 704 689 goto out; 705 690 } 706 691 707 692 /* Fill the hole, further allocation attempts should then fail */ 708 - obj = i915_gem_object_create_internal(i915, PAGE_SIZE); 693 + obj = create_sys_or_internal(i915, PAGE_SIZE); 709 694 if (IS_ERR(obj)) { 710 695 err = PTR_ERR(obj); 711 696 pr_err("Unable to create object for reclaimed hole\n"); ··· 718 703 goto err_obj; 719 704 } 720 705 721 - if (!assert_mmap_offset(i915, PAGE_SIZE, -ENOSPC)) { 706 + if (!assert_mmap_offset(i915, PAGE_SIZE, enospc)) { 722 707 pr_err("Unexpectedly succeeded in inserting object into no holes!\n"); 723 708 err = -EINVAL; 724 709 goto err_obj; ··· 854 839 855 840 static bool can_mmap(struct drm_i915_gem_object *obj, enum i915_mmap_type type) 856 841 { 857 - struct drm_i915_private *i915 = to_i915(obj->base.dev); 858 842 bool no_map; 859 843 860 - if (HAS_LMEM(i915)) 844 + if (obj->ops->mmap_offset) 861 845 return type == I915_MMAP_TYPE_FIXED; 862 846 else if (type == I915_MMAP_TYPE_FIXED) 863 847 return false;
+7 -1
drivers/gpu/drm/i915/gt/intel_rps.c
··· 1973 1973 u32 intel_rps_read_punit_req(struct intel_rps *rps) 1974 1974 { 1975 1975 struct intel_uncore *uncore = rps_to_uncore(rps); 1976 + struct intel_runtime_pm *rpm = rps_to_uncore(rps)->rpm; 1977 + intel_wakeref_t wakeref; 1978 + u32 freq = 0; 1976 1979 1977 - return intel_uncore_read(uncore, GEN6_RPNSWREQ); 1980 + with_intel_runtime_pm_if_in_use(rpm, wakeref) 1981 + freq = intel_uncore_read(uncore, GEN6_RPNSWREQ); 1982 + 1983 + return freq; 1978 1984 } 1979 1985 1980 1986 static u32 intel_rps_get_req(u32 pureq)
+3 -8
drivers/gpu/drm/i915/gt/uc/intel_uc.c
··· 172 172 __uc_free_load_err_log(uc); 173 173 } 174 174 175 - static inline bool guc_communication_enabled(struct intel_guc *guc) 176 - { 177 - return intel_guc_ct_enabled(&guc->ct); 178 - } 179 - 180 175 /* 181 176 * Events triggered while CT buffers are disabled are logged in the SCRATCH_15 182 177 * register using the same bits used in the CT message payload. Since our ··· 205 210 static void guc_handle_mmio_msg(struct intel_guc *guc) 206 211 { 207 212 /* we need communication to be enabled to reply to GuC */ 208 - GEM_BUG_ON(!guc_communication_enabled(guc)); 213 + GEM_BUG_ON(!intel_guc_ct_enabled(&guc->ct)); 209 214 210 215 spin_lock_irq(&guc->irq_lock); 211 216 if (guc->mmio_msg) { ··· 221 226 struct drm_i915_private *i915 = gt->i915; 222 227 int ret; 223 228 224 - GEM_BUG_ON(guc_communication_enabled(guc)); 229 + GEM_BUG_ON(intel_guc_ct_enabled(&guc->ct)); 225 230 226 231 ret = i915_inject_probe_error(i915, -ENXIO); 227 232 if (ret) ··· 657 662 return 0; 658 663 659 664 /* Make sure we enable communication if and only if it's disabled */ 660 - GEM_BUG_ON(enable_communication == guc_communication_enabled(guc)); 665 + GEM_BUG_ON(enable_communication == intel_guc_ct_enabled(&guc->ct)); 661 666 662 667 if (enable_communication) 663 668 guc_enable_communication(guc);
+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 -1
drivers/gpu/drm/radeon/radeon_kms.c
··· 119 119 #endif 120 120 121 121 if (pci_find_capability(pdev, PCI_CAP_ID_AGP)) 122 - rdev->agp = radeon_agp_head_init(rdev->ddev); 122 + rdev->agp = radeon_agp_head_init(dev); 123 123 if (rdev->agp) { 124 124 rdev->agp->agp_mtrr = arch_phys_wc_add( 125 125 rdev->agp->agp_info.aper_base,
+23 -61
drivers/gpu/drm/vc4/vc4_hdmi.c
··· 167 167 struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector); 168 168 bool connected = false; 169 169 170 - WARN_ON(pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev)); 171 - 172 170 if (vc4_hdmi->hpd_gpio && 173 171 gpiod_get_value_cansleep(vc4_hdmi->hpd_gpio)) { 174 172 connected = true; ··· 187 189 } 188 190 } 189 191 190 - pm_runtime_put(&vc4_hdmi->pdev->dev); 191 192 return connector_status_connected; 192 193 } 193 194 194 195 cec_phys_addr_invalidate(vc4_hdmi->cec_adap); 195 - pm_runtime_put(&vc4_hdmi->pdev->dev); 196 196 return connector_status_disconnected; 197 197 } 198 198 ··· 432 436 struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder); 433 437 struct drm_connector *connector = &vc4_hdmi->connector; 434 438 struct drm_connector_state *cstate = connector->state; 435 - struct drm_crtc *crtc = cstate->crtc; 439 + struct drm_crtc *crtc = encoder->crtc; 436 440 const struct drm_display_mode *mode = &crtc->state->adjusted_mode; 437 441 union hdmi_infoframe frame; 438 442 int ret; ··· 537 541 538 542 static void vc4_hdmi_enable_scrambling(struct drm_encoder *encoder) 539 543 { 544 + struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; 540 545 struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); 541 - struct drm_connector *connector = &vc4_hdmi->connector; 542 - struct drm_connector_state *cstate = connector->state; 543 - struct drm_crtc *crtc = cstate->crtc; 544 - struct drm_display_mode *mode = &crtc->state->adjusted_mode; 545 546 546 547 if (!vc4_hdmi_supports_scrambling(encoder, mode)) 547 548 return; ··· 559 566 static void vc4_hdmi_disable_scrambling(struct drm_encoder *encoder) 560 567 { 561 568 struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); 562 - struct drm_connector *connector = &vc4_hdmi->connector; 563 - struct drm_connector_state *cstate = connector->state; 569 + struct drm_crtc *crtc = encoder->crtc; 564 570 565 571 /* 566 - * At boot, connector->state will be NULL. Since we don't know the 572 + * At boot, encoder->crtc will be NULL. Since we don't know the 567 573 * state of the scrambler and in order to avoid any 568 574 * inconsistency, let's disable it all the time. 569 575 */ 570 - if (cstate && !vc4_hdmi_supports_scrambling(encoder, &cstate->crtc->mode)) 576 + if (crtc && !vc4_hdmi_supports_scrambling(encoder, &crtc->mode)) 571 577 return; 572 578 573 - if (cstate && !vc4_hdmi_mode_needs_scrambling(&cstate->crtc->mode)) 579 + if (crtc && !vc4_hdmi_mode_needs_scrambling(&crtc->mode)) 574 580 return; 575 581 576 582 if (delayed_work_pending(&vc4_hdmi->scrambling_work)) ··· 627 635 vc4_hdmi->variant->phy_disable(vc4_hdmi); 628 636 629 637 clk_disable_unprepare(vc4_hdmi->pixel_bvb_clock); 638 + clk_disable_unprepare(vc4_hdmi->hsm_clock); 630 639 clk_disable_unprepare(vc4_hdmi->pixel_clock); 631 640 632 641 ret = pm_runtime_put(&vc4_hdmi->pdev->dev); ··· 891 898 vc4_hdmi_encoder_get_connector_state(encoder, state); 892 899 struct vc4_hdmi_connector_state *vc4_conn_state = 893 900 conn_state_to_vc4_hdmi_conn_state(conn_state); 894 - struct drm_crtc_state *crtc_state = 895 - drm_atomic_get_new_crtc_state(state, conn_state->crtc); 896 - struct drm_display_mode *mode = &crtc_state->adjusted_mode; 901 + struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; 897 902 struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); 898 903 unsigned long bvb_rate, pixel_rate, hsm_rate; 899 904 int ret; ··· 938 947 return; 939 948 } 940 949 950 + ret = clk_prepare_enable(vc4_hdmi->hsm_clock); 951 + if (ret) { 952 + DRM_ERROR("Failed to turn on HSM clock: %d\n", ret); 953 + clk_disable_unprepare(vc4_hdmi->pixel_clock); 954 + return; 955 + } 956 + 941 957 vc4_hdmi_cec_update_clk_div(vc4_hdmi); 942 958 943 959 if (pixel_rate > 297000000) ··· 957 959 ret = clk_set_min_rate(vc4_hdmi->pixel_bvb_clock, bvb_rate); 958 960 if (ret) { 959 961 DRM_ERROR("Failed to set pixel bvb clock rate: %d\n", ret); 962 + clk_disable_unprepare(vc4_hdmi->hsm_clock); 960 963 clk_disable_unprepare(vc4_hdmi->pixel_clock); 961 964 return; 962 965 } ··· 965 966 ret = clk_prepare_enable(vc4_hdmi->pixel_bvb_clock); 966 967 if (ret) { 967 968 DRM_ERROR("Failed to turn on pixel bvb clock: %d\n", ret); 969 + clk_disable_unprepare(vc4_hdmi->hsm_clock); 968 970 clk_disable_unprepare(vc4_hdmi->pixel_clock); 969 971 return; 970 972 } ··· 985 985 static void vc4_hdmi_encoder_pre_crtc_enable(struct drm_encoder *encoder, 986 986 struct drm_atomic_state *state) 987 987 { 988 - struct drm_connector_state *conn_state = 989 - vc4_hdmi_encoder_get_connector_state(encoder, state); 990 - struct drm_crtc_state *crtc_state = 991 - drm_atomic_get_new_crtc_state(state, conn_state->crtc); 992 - struct drm_display_mode *mode = &crtc_state->adjusted_mode; 988 + struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; 993 989 struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder); 994 990 struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); 995 991 ··· 1008 1012 static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder, 1009 1013 struct drm_atomic_state *state) 1010 1014 { 1011 - struct drm_connector_state *conn_state = 1012 - vc4_hdmi_encoder_get_connector_state(encoder, state); 1013 - struct drm_crtc_state *crtc_state = 1014 - drm_atomic_get_new_crtc_state(state, conn_state->crtc); 1015 - struct drm_display_mode *mode = &crtc_state->adjusted_mode; 1015 + struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; 1016 1016 struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); 1017 1017 struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder); 1018 1018 bool hsync_pos = mode->flags & DRM_MODE_FLAG_PHSYNC; ··· 1196 1204 1197 1205 static void vc4_hdmi_set_n_cts(struct vc4_hdmi *vc4_hdmi, unsigned int samplerate) 1198 1206 { 1199 - struct drm_connector *connector = &vc4_hdmi->connector; 1200 - struct drm_crtc *crtc = connector->state->crtc; 1207 + struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base; 1208 + struct drm_crtc *crtc = encoder->crtc; 1201 1209 const struct drm_display_mode *mode = &crtc->state->adjusted_mode; 1202 1210 u32 n, cts; 1203 1211 u64 tmp; ··· 1230 1238 static int vc4_hdmi_audio_startup(struct device *dev, void *data) 1231 1239 { 1232 1240 struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); 1233 - struct drm_connector *connector = &vc4_hdmi->connector; 1241 + struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base; 1234 1242 1235 1243 /* 1236 1244 * If the HDMI encoder hasn't probed, or the encoder is 1237 1245 * currently in DVI mode, treat the codec dai as missing. 1238 1246 */ 1239 - if (!connector->state || !(HDMI_READ(HDMI_RAM_PACKET_CONFIG) & 1247 + if (!encoder->crtc || !(HDMI_READ(HDMI_RAM_PACKET_CONFIG) & 1240 1248 VC4_HDMI_RAM_PACKET_ENABLE)) 1241 1249 return -ENODEV; 1242 1250 ··· 2106 2114 return 0; 2107 2115 } 2108 2116 2109 - #ifdef CONFIG_PM 2110 - static int vc4_hdmi_runtime_suspend(struct device *dev) 2111 - { 2112 - struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); 2113 - 2114 - clk_disable_unprepare(vc4_hdmi->hsm_clock); 2115 - 2116 - return 0; 2117 - } 2118 - 2119 - static int vc4_hdmi_runtime_resume(struct device *dev) 2120 - { 2121 - struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); 2122 - int ret; 2123 - 2124 - ret = clk_prepare_enable(vc4_hdmi->hsm_clock); 2125 - if (ret) 2126 - return ret; 2127 - 2128 - return 0; 2129 - } 2130 - #endif 2131 - 2132 2117 static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) 2133 2118 { 2134 2119 const struct vc4_hdmi_variant *variant = of_device_get_match_data(dev); ··· 2360 2391 {} 2361 2392 }; 2362 2393 2363 - static const struct dev_pm_ops vc4_hdmi_pm_ops = { 2364 - SET_RUNTIME_PM_OPS(vc4_hdmi_runtime_suspend, 2365 - vc4_hdmi_runtime_resume, 2366 - NULL) 2367 - }; 2368 - 2369 2394 struct platform_driver vc4_hdmi_driver = { 2370 2395 .probe = vc4_hdmi_dev_probe, 2371 2396 .remove = vc4_hdmi_dev_remove, 2372 2397 .driver = { 2373 2398 .name = "vc4_hdmi", 2374 2399 .of_match_table = vc4_hdmi_dt_match, 2375 - .pm = &vc4_hdmi_pm_ops, 2376 2400 }, 2377 2401 };
+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
··· 227 227 dsa_unregister_switch(dev->ds); 228 228 } 229 229 230 + static inline void b53_switch_shutdown(struct b53_device *dev) 231 + { 232 + dsa_switch_shutdown(dev->ds); 233 + } 234 + 230 235 #define b53_build_op(type_op_size, val_type) \ 231 236 static inline int b53_##type_op_size(struct b53_device *dev, u8 page, \ 232 237 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) ··· 1514 1514 { 1515 1515 struct bcm_sf2_priv *priv = platform_get_drvdata(pdev); 1516 1516 1517 + if (!priv) 1518 + return 0; 1519 + 1517 1520 priv->wol_ports_mask = 0; 1518 1521 /* Disable interrupts */ 1519 1522 bcm_sf2_intr_disable(priv); ··· 1528 1525 if (priv->type == BCM7278_DEVICE_ID) 1529 1526 reset_control_assert(priv->rcdev); 1530 1527 1528 + platform_set_drvdata(pdev, NULL); 1529 + 1531 1530 return 0; 1532 1531 } 1533 1532 1534 1533 static void bcm_sf2_sw_shutdown(struct platform_device *pdev) 1535 1534 { 1536 1535 struct bcm_sf2_priv *priv = platform_get_drvdata(pdev); 1536 + 1537 + if (!priv) 1538 + return; 1537 1539 1538 1540 /* For a kernel about to be kexec'd we want to keep the GPHY on for a 1539 1541 * successful MDIO bus scan to occur. If we did turn off the GPHY ··· 1548 1540 */ 1549 1541 if (priv->hw_params.num_gphy == 1) 1550 1542 bcm_sf2_gphy_enable_set(priv->dev->ds, true); 1543 + 1544 + dsa_switch_shutdown(priv->dev->ds); 1545 + 1546 + platform_set_drvdata(pdev, NULL); 1551 1547 } 1552 1548 1553 1549 #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
··· 3340 3340 static int sja1105_remove(struct spi_device *spi) 3341 3341 { 3342 3342 struct sja1105_private *priv = spi_get_drvdata(spi); 3343 - struct dsa_switch *ds = priv->ds; 3344 3343 3345 - dsa_unregister_switch(ds); 3344 + if (!priv) 3345 + return 0; 3346 + 3347 + dsa_unregister_switch(priv->ds); 3348 + 3349 + spi_set_drvdata(spi, NULL); 3346 3350 3347 3351 return 0; 3352 + } 3353 + 3354 + static void sja1105_shutdown(struct spi_device *spi) 3355 + { 3356 + struct sja1105_private *priv = spi_get_drvdata(spi); 3357 + 3358 + if (!priv) 3359 + return; 3360 + 3361 + dsa_switch_shutdown(priv->ds); 3362 + 3363 + spi_set_drvdata(spi, NULL); 3348 3364 } 3349 3365 3350 3366 static const struct of_device_id sja1105_dt_ids[] = { ··· 3386 3370 }, 3387 3371 .probe = sja1105_probe, 3388 3372 .remove = sja1105_remove, 3373 + .shutdown = sja1105_shutdown, 3389 3374 }; 3390 3375 3391 3376 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
··· 3667 3667 if (ret) { 3668 3668 dev_err(&hdev->pdev->dev, 3669 3669 "set vf(%u) rst failed %d!\n", 3670 - vport->vport_id, ret); 3670 + vport->vport_id - HCLGE_VF_VPORT_START_NUM, 3671 + ret); 3671 3672 return ret; 3672 3673 } 3673 3674 ··· 3683 3682 if (ret) 3684 3683 dev_warn(&hdev->pdev->dev, 3685 3684 "inform reset to vf(%u) failed %d!\n", 3686 - vport->vport_id, ret); 3685 + vport->vport_id - HCLGE_VF_VPORT_START_NUM, 3686 + ret); 3687 3687 } 3688 3688 3689 3689 return 0; ··· 4749 4747 return 0; 4750 4748 } 4751 4749 4750 + static int hclge_parse_rss_hfunc(struct hclge_vport *vport, const u8 hfunc, 4751 + u8 *hash_algo) 4752 + { 4753 + switch (hfunc) { 4754 + case ETH_RSS_HASH_TOP: 4755 + *hash_algo = HCLGE_RSS_HASH_ALGO_TOEPLITZ; 4756 + return 0; 4757 + case ETH_RSS_HASH_XOR: 4758 + *hash_algo = HCLGE_RSS_HASH_ALGO_SIMPLE; 4759 + return 0; 4760 + case ETH_RSS_HASH_NO_CHANGE: 4761 + *hash_algo = vport->rss_algo; 4762 + return 0; 4763 + default: 4764 + return -EINVAL; 4765 + } 4766 + } 4767 + 4752 4768 static int hclge_set_rss(struct hnae3_handle *handle, const u32 *indir, 4753 4769 const u8 *key, const u8 hfunc) 4754 4770 { ··· 4776 4756 u8 hash_algo; 4777 4757 int ret, i; 4778 4758 4759 + ret = hclge_parse_rss_hfunc(vport, hfunc, &hash_algo); 4760 + if (ret) { 4761 + dev_err(&hdev->pdev->dev, "invalid hfunc type %u\n", hfunc); 4762 + return ret; 4763 + } 4764 + 4779 4765 /* Set the RSS Hash Key if specififed by the user */ 4780 4766 if (key) { 4781 - switch (hfunc) { 4782 - case ETH_RSS_HASH_TOP: 4783 - hash_algo = HCLGE_RSS_HASH_ALGO_TOEPLITZ; 4784 - break; 4785 - case ETH_RSS_HASH_XOR: 4786 - hash_algo = HCLGE_RSS_HASH_ALGO_SIMPLE; 4787 - break; 4788 - case ETH_RSS_HASH_NO_CHANGE: 4789 - hash_algo = vport->rss_algo; 4790 - break; 4791 - default: 4792 - return -EINVAL; 4793 - } 4794 - 4795 4767 ret = hclge_set_rss_algo_key(hdev, hash_algo, key); 4796 4768 if (ret) 4797 4769 return ret; 4798 4770 4799 4771 /* Update the shadow RSS key with user specified qids */ 4800 4772 memcpy(vport->rss_hash_key, key, HCLGE_RSS_KEY_SIZE); 4801 - vport->rss_algo = hash_algo; 4773 + } else { 4774 + ret = hclge_set_rss_algo_key(hdev, hash_algo, 4775 + vport->rss_hash_key); 4776 + if (ret) 4777 + return ret; 4802 4778 } 4779 + vport->rss_algo = hash_algo; 4803 4780 4804 4781 /* Update the shadow RSS table with user specified qids */ 4805 4782 for (i = 0; i < ae_dev->dev_specs.rss_ind_tbl_size; i++) ··· 6650 6633 u8 vf = ethtool_get_flow_spec_ring_vf(ring_cookie); 6651 6634 u16 tqps; 6652 6635 6636 + /* To keep consistent with user's configuration, minus 1 when 6637 + * printing 'vf', because vf id from ethtool is added 1 for vf. 6638 + */ 6653 6639 if (vf > hdev->num_req_vfs) { 6654 6640 dev_err(&hdev->pdev->dev, 6655 - "Error: vf id (%u) > max vf num (%u)\n", 6656 - vf, hdev->num_req_vfs); 6641 + "Error: vf id (%u) should be less than %u\n", 6642 + vf - 1, hdev->num_req_vfs); 6657 6643 return -EINVAL; 6658 6644 } 6659 6645 ··· 9845 9825 if (is_kill && !vlan_id) 9846 9826 return 0; 9847 9827 9828 + if (vlan_id >= VLAN_N_VID) 9829 + return -EINVAL; 9830 + 9848 9831 ret = hclge_set_vf_vlan_common(hdev, vport_id, is_kill, vlan_id); 9849 9832 if (ret) { 9850 9833 dev_err(&hdev->pdev->dev, ··· 10754 10731 return 0; 10755 10732 } 10756 10733 10757 - static int hclge_get_reset_status(struct hclge_dev *hdev, u16 queue_id) 10734 + static int hclge_get_reset_status(struct hclge_dev *hdev, u16 queue_id, 10735 + u8 *reset_status) 10758 10736 { 10759 10737 struct hclge_reset_tqp_queue_cmd *req; 10760 10738 struct hclge_desc desc; ··· 10773 10749 return ret; 10774 10750 } 10775 10751 10776 - return hnae3_get_bit(req->ready_to_reset, HCLGE_TQP_RESET_B); 10752 + *reset_status = hnae3_get_bit(req->ready_to_reset, HCLGE_TQP_RESET_B); 10753 + 10754 + return 0; 10777 10755 } 10778 10756 10779 10757 u16 hclge_covert_handle_qid_global(struct hnae3_handle *handle, u16 queue_id) ··· 10794 10768 struct hclge_vport *vport = hclge_get_vport(handle); 10795 10769 struct hclge_dev *hdev = vport->back; 10796 10770 u16 reset_try_times = 0; 10797 - int reset_status; 10771 + u8 reset_status; 10798 10772 u16 queue_gid; 10799 10773 int ret; 10800 10774 u16 i; ··· 10810 10784 } 10811 10785 10812 10786 while (reset_try_times++ < HCLGE_TQP_RESET_TRY_TIMES) { 10813 - reset_status = hclge_get_reset_status(hdev, queue_gid); 10787 + ret = hclge_get_reset_status(hdev, queue_gid, 10788 + &reset_status); 10789 + if (ret) 10790 + return ret; 10791 + 10814 10792 if (reset_status) 10815 10793 break; 10816 10794 ··· 11507 11477 struct hclge_vport *vport = &hdev->vport[i]; 11508 11478 int ret; 11509 11479 11510 - /* Send cmd to clear VF's FUNC_RST_ING */ 11480 + /* Send cmd to clear vport's FUNC_RST_ING */ 11511 11481 ret = hclge_set_vf_rst(hdev, vport->vport_id, false); 11512 11482 if (ret) 11513 11483 dev_warn(&hdev->pdev->dev, 11514 - "clear vf(%u) rst failed %d!\n", 11484 + "clear vport(%u) rst failed %d!\n", 11515 11485 vport->vport_id, ret); 11516 11486 } 11517 11487 }
+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");
+3 -3
drivers/net/hamradio/dmascc.c
··· 973 973 flags = claim_dma_lock(); 974 974 set_dma_mode(priv->param.dma, DMA_MODE_WRITE); 975 975 set_dma_addr(priv->param.dma, 976 - (int) priv->tx_buf[priv->tx_tail] + n); 976 + virt_to_bus(priv->tx_buf[priv->tx_tail]) + n); 977 977 set_dma_count(priv->param.dma, 978 978 priv->tx_len[priv->tx_tail] - n); 979 979 release_dma_lock(flags); ··· 1020 1020 flags = claim_dma_lock(); 1021 1021 set_dma_mode(priv->param.dma, DMA_MODE_READ); 1022 1022 set_dma_addr(priv->param.dma, 1023 - (int) priv->rx_buf[priv->rx_head]); 1023 + virt_to_bus(priv->rx_buf[priv->rx_head])); 1024 1024 set_dma_count(priv->param.dma, BUF_SIZE); 1025 1025 release_dma_lock(flags); 1026 1026 enable_dma(priv->param.dma); ··· 1233 1233 if (priv->param.dma >= 0) { 1234 1234 flags = claim_dma_lock(); 1235 1235 set_dma_addr(priv->param.dma, 1236 - (int) priv->rx_buf[priv->rx_head]); 1236 + virt_to_bus(priv->rx_buf[priv->rx_head])); 1237 1237 set_dma_count(priv->param.dma, BUF_SIZE); 1238 1238 release_dma_lock(flags); 1239 1239 } else {
+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
··· 425 425 426 426 skb_reserve(skb, p - buf); 427 427 skb_put(skb, len); 428 + 429 + page = (struct page *)page->private; 430 + if (page) 431 + give_pages(rq, page); 428 432 goto ok; 429 433 } 430 434
+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);
+7 -10
drivers/nvme/host/core.c
··· 3524 3524 lockdep_assert_held(&subsys->lock); 3525 3525 3526 3526 list_for_each_entry(h, &subsys->nsheads, entry) { 3527 - if (h->ns_id == nsid && nvme_tryget_ns_head(h)) 3527 + if (h->ns_id != nsid) 3528 + continue; 3529 + if (!list_empty(&h->list) && nvme_tryget_ns_head(h)) 3528 3530 return h; 3529 3531 } 3530 3532 ··· 3845 3843 3846 3844 mutex_lock(&ns->ctrl->subsys->lock); 3847 3845 list_del_rcu(&ns->siblings); 3846 + if (list_empty(&ns->head->list)) { 3847 + list_del_init(&ns->head->entry); 3848 + last_path = true; 3849 + } 3848 3850 mutex_unlock(&ns->ctrl->subsys->lock); 3849 3851 3850 3852 /* guarantee not available in head->list */ ··· 3862 3856 nvme_cdev_del(&ns->cdev, &ns->cdev_device); 3863 3857 del_gendisk(ns->disk); 3864 3858 blk_cleanup_queue(ns->queue); 3865 - if (blk_get_integrity(ns->disk)) 3866 - blk_integrity_unregister(ns->disk); 3867 3859 3868 3860 down_write(&ns->ctrl->namespaces_rwsem); 3869 3861 list_del_init(&ns->list); 3870 3862 up_write(&ns->ctrl->namespaces_rwsem); 3871 3863 3872 - /* Synchronize with nvme_init_ns_head() */ 3873 - mutex_lock(&ns->head->subsys->lock); 3874 - if (list_empty(&ns->head->list)) { 3875 - list_del_init(&ns->head->entry); 3876 - last_path = true; 3877 - } 3878 - mutex_unlock(&ns->head->subsys->lock); 3879 3864 if (last_path) 3880 3865 nvme_mpath_shutdown_disk(ns->head); 3881 3866 nvme_put_ns(ns);
+5 -2
drivers/nvme/host/multipath.c
··· 600 600 601 601 down_read(&ctrl->namespaces_rwsem); 602 602 list_for_each_entry(ns, &ctrl->namespaces, list) { 603 - unsigned nsid = le32_to_cpu(desc->nsids[n]); 604 - 603 + unsigned nsid; 604 + again: 605 + nsid = le32_to_cpu(desc->nsids[n]); 605 606 if (ns->head->ns_id < nsid) 606 607 continue; 607 608 if (ns->head->ns_id == nsid) 608 609 nvme_update_ns_ana_state(desc, ns); 609 610 if (++n == nr_nsids) 610 611 break; 612 + if (ns->head->ns_id > nsid) 613 + goto again; 611 614 } 612 615 up_read(&ctrl->namespaces_rwsem); 613 616 return 0;
+3 -13
drivers/nvme/host/rdma.c
··· 656 656 if (!test_and_clear_bit(NVME_RDMA_Q_ALLOCATED, &queue->flags)) 657 657 return; 658 658 659 - nvme_rdma_destroy_queue_ib(queue); 660 659 rdma_destroy_id(queue->cm_id); 660 + nvme_rdma_destroy_queue_ib(queue); 661 661 mutex_destroy(&queue->queue_lock); 662 662 } 663 663 ··· 1815 1815 for (i = 0; i < queue->queue_size; i++) { 1816 1816 ret = nvme_rdma_post_recv(queue, &queue->rsp_ring[i]); 1817 1817 if (ret) 1818 - goto out_destroy_queue_ib; 1818 + return ret; 1819 1819 } 1820 1820 1821 1821 return 0; 1822 - 1823 - out_destroy_queue_ib: 1824 - nvme_rdma_destroy_queue_ib(queue); 1825 - return ret; 1826 1822 } 1827 1823 1828 1824 static int nvme_rdma_conn_rejected(struct nvme_rdma_queue *queue, ··· 1912 1916 if (ret) { 1913 1917 dev_err(ctrl->ctrl.device, 1914 1918 "rdma_connect_locked failed (%d).\n", ret); 1915 - goto out_destroy_queue_ib; 1919 + return ret; 1916 1920 } 1917 1921 1918 1922 return 0; 1919 - 1920 - out_destroy_queue_ib: 1921 - nvme_rdma_destroy_queue_ib(queue); 1922 - return ret; 1923 1923 } 1924 1924 1925 1925 static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id, ··· 1946 1954 case RDMA_CM_EVENT_ROUTE_ERROR: 1947 1955 case RDMA_CM_EVENT_CONNECT_ERROR: 1948 1956 case RDMA_CM_EVENT_UNREACHABLE: 1949 - nvme_rdma_destroy_queue_ib(queue); 1950 - fallthrough; 1951 1957 case RDMA_CM_EVENT_ADDR_ERROR: 1952 1958 dev_dbg(queue->ctrl->ctrl.device, 1953 1959 "CM error event %d\n", ev->event);
+10 -10
drivers/nvme/host/tcp.c
··· 274 274 } while (ret > 0); 275 275 } 276 276 277 + static inline bool nvme_tcp_queue_more(struct nvme_tcp_queue *queue) 278 + { 279 + return !list_empty(&queue->send_list) || 280 + !llist_empty(&queue->req_list) || queue->more_requests; 281 + } 282 + 277 283 static inline void nvme_tcp_queue_request(struct nvme_tcp_request *req, 278 284 bool sync, bool last) 279 285 { ··· 300 294 nvme_tcp_send_all(queue); 301 295 queue->more_requests = false; 302 296 mutex_unlock(&queue->send_mutex); 303 - } else if (last) { 304 - queue_work_on(queue->io_cpu, nvme_tcp_wq, &queue->io_work); 305 297 } 298 + 299 + if (last && nvme_tcp_queue_more(queue)) 300 + queue_work_on(queue->io_cpu, nvme_tcp_wq, &queue->io_work); 306 301 } 307 302 308 303 static void nvme_tcp_process_req_list(struct nvme_tcp_queue *queue) ··· 913 906 read_unlock_bh(&sk->sk_callback_lock); 914 907 } 915 908 916 - static inline bool nvme_tcp_queue_more(struct nvme_tcp_queue *queue) 917 - { 918 - return !list_empty(&queue->send_list) || 919 - !llist_empty(&queue->req_list) || queue->more_requests; 920 - } 921 - 922 909 static inline void nvme_tcp_done_send_req(struct nvme_tcp_queue *queue) 923 910 { 924 911 queue->request = NULL; ··· 1146 1145 pending = true; 1147 1146 else if (unlikely(result < 0)) 1148 1147 break; 1149 - } else 1150 - pending = !llist_empty(&queue->req_list); 1148 + } 1151 1149 1152 1150 result = nvme_tcp_try_recv(queue); 1153 1151 if (result > 0)
+1 -1
drivers/nvme/target/configfs.c
··· 1067 1067 { 1068 1068 struct nvmet_subsys *subsys = to_subsys(item); 1069 1069 1070 - return snprintf(page, PAGE_SIZE, "%*s\n", 1070 + return snprintf(page, PAGE_SIZE, "%.*s\n", 1071 1071 NVMET_SN_MAX_SIZE, subsys->serial); 1072 1072 } 1073 1073
+5 -1
drivers/of/device.c
··· 85 85 break; 86 86 } 87 87 88 - if (i != count && of_reserved_mem_device_init_by_idx(dev, of_node, i)) 88 + /* 89 + * Attempt to initialize a restricted-dma-pool region if one was found. 90 + * Note that count can hold a negative error code. 91 + */ 92 + if (i < count && of_reserved_mem_device_init_by_idx(dev, of_node, i)) 89 93 dev_warn(dev, "failed to initialise \"restricted-dma-pool\" memory node\n"); 90 94 } 91 95
-2
drivers/of/property.c
··· 1291 1291 DEFINE_SIMPLE_PROP(resets, "resets", "#reset-cells") 1292 1292 DEFINE_SIMPLE_PROP(leds, "leds", NULL) 1293 1293 DEFINE_SIMPLE_PROP(backlight, "backlight", NULL) 1294 - DEFINE_SIMPLE_PROP(phy_handle, "phy-handle", NULL) 1295 1294 DEFINE_SUFFIX_PROP(regulators, "-supply", NULL) 1296 1295 DEFINE_SUFFIX_PROP(gpio, "-gpio", "#gpio-cells") 1297 1296 ··· 1379 1380 { .parse_prop = parse_resets, }, 1380 1381 { .parse_prop = parse_leds, }, 1381 1382 { .parse_prop = parse_backlight, }, 1382 - { .parse_prop = parse_phy_handle, }, 1383 1383 { .parse_prop = parse_gpio_compat, }, 1384 1384 { .parse_prop = parse_interrupts, }, 1385 1385 { .parse_prop = parse_regulators, },
+1 -1
drivers/pci/pci-acpi.c
··· 937 937 938 938 void pci_set_acpi_fwnode(struct pci_dev *dev) 939 939 { 940 - if (!ACPI_COMPANION(&dev->dev) && !pci_dev_is_added(dev)) 940 + if (!dev_fwnode(&dev->dev) && !pci_dev_is_added(dev)) 941 941 ACPI_COMPANION_SET(&dev->dev, 942 942 acpi_pci_find_companion(&dev->dev)); 943 943 }
+7 -2
drivers/pci/quirks.c
··· 5435 5435 PCI_CLASS_MULTIMEDIA_HD_AUDIO, 8, quirk_gpu_hda); 5436 5436 5437 5437 /* 5438 - * Create device link for NVIDIA GPU with integrated USB xHCI Host 5438 + * Create device link for GPUs with integrated USB xHCI Host 5439 5439 * controller to VGA. 5440 5440 */ 5441 5441 static void quirk_gpu_usb(struct pci_dev *usb) ··· 5444 5444 } 5445 5445 DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, 5446 5446 PCI_CLASS_SERIAL_USB, 8, quirk_gpu_usb); 5447 + DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_ATI, PCI_ANY_ID, 5448 + PCI_CLASS_SERIAL_USB, 8, quirk_gpu_usb); 5447 5449 5448 5450 /* 5449 - * Create device link for NVIDIA GPU with integrated Type-C UCSI controller 5451 + * Create device link for GPUs with integrated Type-C UCSI controller 5450 5452 * to VGA. Currently there is no class code defined for UCSI device over PCI 5451 5453 * so using UNKNOWN class for now and it will be updated when UCSI 5452 5454 * over PCI gets a class code. ··· 5459 5457 pci_create_device_link(ucsi, 3, 0, PCI_BASE_CLASS_DISPLAY, 16); 5460 5458 } 5461 5459 DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, 5460 + PCI_CLASS_SERIAL_UNKNOWN, 8, 5461 + quirk_gpu_usb_typec_ucsi); 5462 + DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_ATI, PCI_ANY_ID, 5462 5463 PCI_CLASS_SERIAL_UNKNOWN, 8, 5463 5464 quirk_gpu_usb_typec_ucsi); 5464 5465
+26 -10
drivers/pci/vpd.c
··· 99 99 return off ?: PCI_VPD_SZ_INVALID; 100 100 } 101 101 102 + static bool pci_vpd_available(struct pci_dev *dev) 103 + { 104 + struct pci_vpd *vpd = &dev->vpd; 105 + 106 + if (!vpd->cap) 107 + return false; 108 + 109 + if (vpd->len == 0) { 110 + vpd->len = pci_vpd_size(dev); 111 + if (vpd->len == PCI_VPD_SZ_INVALID) { 112 + vpd->cap = 0; 113 + return false; 114 + } 115 + } 116 + 117 + return true; 118 + } 119 + 102 120 /* 103 121 * Wait for last operation to complete. 104 122 * This code has to spin since there is no other notification from the PCI ··· 163 145 loff_t end = pos + count; 164 146 u8 *buf = arg; 165 147 166 - if (!vpd->cap) 148 + if (!pci_vpd_available(dev)) 167 149 return -ENODEV; 168 150 169 151 if (pos < 0) ··· 224 206 loff_t end = pos + count; 225 207 int ret = 0; 226 208 227 - if (!vpd->cap) 209 + if (!pci_vpd_available(dev)) 228 210 return -ENODEV; 229 211 230 212 if (pos < 0 || (pos & 3) || (count & 3)) ··· 260 242 261 243 void pci_vpd_init(struct pci_dev *dev) 262 244 { 245 + if (dev->vpd.len == PCI_VPD_SZ_INVALID) 246 + return; 247 + 263 248 dev->vpd.cap = pci_find_capability(dev, PCI_CAP_ID_VPD); 264 249 mutex_init(&dev->vpd.lock); 265 - 266 - if (!dev->vpd.len) 267 - dev->vpd.len = pci_vpd_size(dev); 268 - 269 - if (dev->vpd.len == PCI_VPD_SZ_INVALID) 270 - dev->vpd.cap = 0; 271 250 } 272 251 273 252 static ssize_t vpd_read(struct file *filp, struct kobject *kobj, ··· 309 294 310 295 void *pci_vpd_alloc(struct pci_dev *dev, unsigned int *size) 311 296 { 312 - unsigned int len = dev->vpd.len; 297 + unsigned int len; 313 298 void *buf; 314 299 int cnt; 315 300 316 - if (!dev->vpd.cap) 301 + if (!pci_vpd_available(dev)) 317 302 return ERR_PTR(-ENODEV); 318 303 304 + len = dev->vpd.len; 319 305 buf = kmalloc(len, GFP_KERNEL); 320 306 if (!buf) 321 307 return ERR_PTR(-ENOMEM);
+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
+2 -1
drivers/s390/char/sclp_early.c
··· 45 45 sclp.has_gisaf = !!(sccb->fac118 & 0x08); 46 46 sclp.has_hvs = !!(sccb->fac119 & 0x80); 47 47 sclp.has_kss = !!(sccb->fac98 & 0x01); 48 - sclp.has_sipl = !!(sccb->cbl & 0x4000); 49 48 if (sccb->fac85 & 0x02) 50 49 S390_lowcore.machine_flags |= MACHINE_FLAG_ESOP; 51 50 if (sccb->fac91 & 0x40) 52 51 S390_lowcore.machine_flags |= MACHINE_FLAG_TLB_GUEST; 53 52 if (sccb->cpuoff > 134) 54 53 sclp.has_diag318 = !!(sccb->byte_134 & 0x80); 54 + if (sccb->cpuoff > 137) 55 + sclp.has_sipl = !!(sccb->cbl & 0x4000); 55 56 sclp.rnmax = sccb->rnmax ? sccb->rnmax : sccb->rnmax2; 56 57 sclp.rzm = sccb->rnsize ? sccb->rnsize : sccb->rnsize2; 57 58 sclp.rzm <<= 20;
+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:
+2 -1
drivers/s390/crypto/ap_bus.c
··· 213 213 * ap_init_qci_info(): Allocate and query qci config info. 214 214 * Does also update the static variables ap_max_domain_id 215 215 * and ap_max_adapter_id if this info is available. 216 - 217 216 */ 218 217 static void __init ap_init_qci_info(void) 219 218 { ··· 438 439 /** 439 440 * ap_interrupt_handler() - Schedule ap_tasklet on interrupt 440 441 * @airq: pointer to adapter interrupt descriptor 442 + * @floating: ignored 441 443 */ 442 444 static void ap_interrupt_handler(struct airq_struct *airq, bool floating) 443 445 { ··· 1786 1786 /** 1787 1787 * ap_scan_bus(): Scan the AP bus for new devices 1788 1788 * Runs periodically, workqueue timer (ap_config_time) 1789 + * @unused: Unused pointer. 1789 1790 */ 1790 1791 static void ap_scan_bus(struct work_struct *unused) 1791 1792 {
+2 -2
drivers/s390/crypto/ap_queue.c
··· 20 20 21 21 /** 22 22 * ap_queue_enable_irq(): Enable interrupt support on this AP queue. 23 - * @qid: The AP queue number 23 + * @aq: The AP queue 24 24 * @ind: the notification indicator byte 25 25 * 26 26 * Enables interruption on AP queue via ap_aqic(). Based on the return ··· 311 311 312 312 /** 313 313 * ap_sm_reset(): Reset an AP queue. 314 - * @qid: The AP queue number 314 + * @aq: The AP queue 315 315 * 316 316 * Submit the Reset command to an AP queue. 317 317 */
-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
+6
drivers/spi/spi-rockchip.c
··· 600 600 int ret; 601 601 bool use_dma; 602 602 603 + /* Zero length transfers won't trigger an interrupt on completion */ 604 + if (!xfer->len) { 605 + spi_finalize_current_transfer(ctlr); 606 + return 1; 607 + } 608 + 603 609 WARN_ON(readl_relaxed(rs->regs + ROCKCHIP_SPI_SSIENR) && 604 610 (readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_BUSY)); 605 611
+2 -3
drivers/spi/spi-tegra20-slink.c
··· 204 204 struct dma_async_tx_descriptor *tx_dma_desc; 205 205 }; 206 206 207 - static int tegra_slink_runtime_suspend(struct device *dev); 208 - static int tegra_slink_runtime_resume(struct device *dev); 209 - 210 207 static inline u32 tegra_slink_readl(struct tegra_slink_data *tspi, 211 208 unsigned long reg) 212 209 { ··· 1182 1185 } 1183 1186 #endif 1184 1187 1188 + #ifdef CONFIG_PM 1185 1189 static int tegra_slink_runtime_suspend(struct device *dev) 1186 1190 { 1187 1191 struct spi_master *master = dev_get_drvdata(dev); ··· 1208 1210 } 1209 1211 return 0; 1210 1212 } 1213 + #endif /* CONFIG_PM */ 1211 1214 1212 1215 static const struct dev_pm_ops slink_pm_ops = { 1213 1216 SET_RUNTIME_PM_OPS(tegra_slink_runtime_suspend,
-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)
+3 -1
drivers/video/fbdev/Kconfig
··· 582 582 583 583 config FB_TGA 584 584 tristate "TGA/SFB+ framebuffer support" 585 - depends on FB && (ALPHA || TC) 585 + depends on FB 586 + depends on PCI || TC 587 + depends on ALPHA || TC 586 588 select FB_CFB_FILLRECT 587 589 select FB_CFB_COPYAREA 588 590 select FB_CFB_IMAGEBLIT
+1 -1
drivers/xen/Kconfig
··· 214 214 implements them. 215 215 216 216 config XEN_PVCALLS_BACKEND 217 - bool "XEN PV Calls backend driver" 217 + tristate "XEN PV Calls backend driver" 218 218 depends on INET && XEN && XEN_BACKEND 219 219 help 220 220 Experimental backend for the Xen PV Calls protocol
+45 -17
drivers/xen/balloon.c
··· 43 43 #include <linux/sched.h> 44 44 #include <linux/cred.h> 45 45 #include <linux/errno.h> 46 + #include <linux/freezer.h> 47 + #include <linux/kthread.h> 46 48 #include <linux/mm.h> 47 49 #include <linux/memblock.h> 48 50 #include <linux/pagemap.h> ··· 117 115 #define EXTENT_ORDER (fls(XEN_PFN_PER_PAGE) - 1) 118 116 119 117 /* 120 - * balloon_process() state: 118 + * balloon_thread() state: 121 119 * 122 120 * BP_DONE: done or nothing to do, 123 121 * BP_WAIT: wait to be rescheduled, ··· 132 130 BP_ECANCELED 133 131 }; 134 132 133 + /* Main waiting point for xen-balloon thread. */ 134 + static DECLARE_WAIT_QUEUE_HEAD(balloon_thread_wq); 135 135 136 136 static DEFINE_MUTEX(balloon_mutex); 137 137 ··· 147 143 /* List of ballooned pages, threaded through the mem_map array. */ 148 144 static LIST_HEAD(ballooned_pages); 149 145 static DECLARE_WAIT_QUEUE_HEAD(balloon_wq); 150 - 151 - /* Main work function, always executed in process context. */ 152 - static void balloon_process(struct work_struct *work); 153 - static DECLARE_DELAYED_WORK(balloon_worker, balloon_process); 154 146 155 147 /* When ballooning out (allocating memory to return to Xen) we don't really 156 148 want the kernel to try too hard since that can trigger the oom killer. */ ··· 366 366 static int xen_memory_notifier(struct notifier_block *nb, unsigned long val, void *v) 367 367 { 368 368 if (val == MEM_ONLINE) 369 - schedule_delayed_work(&balloon_worker, 0); 369 + wake_up(&balloon_thread_wq); 370 370 371 371 return NOTIFY_OK; 372 372 } ··· 491 491 } 492 492 493 493 /* 494 - * As this is a work item it is guaranteed to run as a single instance only. 494 + * Stop waiting if either state is not BP_EAGAIN and ballooning action is 495 + * needed, or if the credit has changed while state is BP_EAGAIN. 496 + */ 497 + static bool balloon_thread_cond(enum bp_state state, long credit) 498 + { 499 + if (state != BP_EAGAIN) 500 + credit = 0; 501 + 502 + return current_credit() != credit || kthread_should_stop(); 503 + } 504 + 505 + /* 506 + * As this is a kthread it is guaranteed to run as a single instance only. 495 507 * We may of course race updates of the target counts (which are protected 496 508 * by the balloon lock), or with changes to the Xen hard limit, but we will 497 509 * recover from these in time. 498 510 */ 499 - static void balloon_process(struct work_struct *work) 511 + static int balloon_thread(void *unused) 500 512 { 501 513 enum bp_state state = BP_DONE; 502 514 long credit; 515 + unsigned long timeout; 503 516 517 + set_freezable(); 518 + for (;;) { 519 + if (state == BP_EAGAIN) 520 + timeout = balloon_stats.schedule_delay * HZ; 521 + else 522 + timeout = 3600 * HZ; 523 + credit = current_credit(); 504 524 505 - do { 525 + wait_event_interruptible_timeout(balloon_thread_wq, 526 + balloon_thread_cond(state, credit), timeout); 527 + 528 + if (kthread_should_stop()) 529 + return 0; 530 + 506 531 mutex_lock(&balloon_mutex); 507 532 508 533 credit = current_credit(); ··· 554 529 mutex_unlock(&balloon_mutex); 555 530 556 531 cond_resched(); 557 - 558 - } while (credit && state == BP_DONE); 559 - 560 - /* Schedule more work if there is some still to be done. */ 561 - if (state == BP_EAGAIN) 562 - schedule_delayed_work(&balloon_worker, balloon_stats.schedule_delay * HZ); 532 + } 563 533 } 564 534 565 535 /* Resets the Xen limit, sets new target, and kicks off processing. */ ··· 562 542 { 563 543 /* No need for lock. Not read-modify-write updates. */ 564 544 balloon_stats.target_pages = target; 565 - schedule_delayed_work(&balloon_worker, 0); 545 + wake_up(&balloon_thread_wq); 566 546 } 567 547 EXPORT_SYMBOL_GPL(balloon_set_new_target); 568 548 ··· 667 647 668 648 /* The balloon may be too large now. Shrink it if needed. */ 669 649 if (current_credit()) 670 - schedule_delayed_work(&balloon_worker, 0); 650 + wake_up(&balloon_thread_wq); 671 651 672 652 mutex_unlock(&balloon_mutex); 673 653 } ··· 699 679 700 680 static int __init balloon_init(void) 701 681 { 682 + struct task_struct *task; 683 + 702 684 if (!xen_domain()) 703 685 return -ENODEV; 704 686 ··· 743 721 xen_extra_mem[i].n_pfns); 744 722 } 745 723 #endif 724 + 725 + task = kthread_run(balloon_thread, NULL, "xen-balloon"); 726 + if (IS_ERR(task)) { 727 + pr_err("xen-balloon thread could not be started, ballooning will not work!\n"); 728 + return PTR_ERR(task); 729 + } 746 730 747 731 /* Init the xen-balloon driver. */ 748 732 xen_balloon_init();
+17 -20
drivers/xen/swiotlb-xen.c
··· 106 106 107 107 static int xen_swiotlb_fixup(void *buf, unsigned long nslabs) 108 108 { 109 - int i, rc; 110 - int dma_bits; 109 + int rc; 110 + unsigned int order = get_order(IO_TLB_SEGSIZE << IO_TLB_SHIFT); 111 + unsigned int i, dma_bits = order + PAGE_SHIFT; 111 112 dma_addr_t dma_handle; 112 113 phys_addr_t p = virt_to_phys(buf); 113 114 114 - dma_bits = get_order(IO_TLB_SEGSIZE << IO_TLB_SHIFT) + PAGE_SHIFT; 115 + BUILD_BUG_ON(IO_TLB_SEGSIZE & (IO_TLB_SEGSIZE - 1)); 116 + BUG_ON(nslabs % IO_TLB_SEGSIZE); 115 117 116 118 i = 0; 117 119 do { 118 - int slabs = min(nslabs - i, (unsigned long)IO_TLB_SEGSIZE); 119 - 120 120 do { 121 121 rc = xen_create_contiguous_region( 122 - p + (i << IO_TLB_SHIFT), 123 - get_order(slabs << IO_TLB_SHIFT), 122 + p + (i << IO_TLB_SHIFT), order, 124 123 dma_bits, &dma_handle); 125 124 } while (rc && dma_bits++ < MAX_DMA_BITS); 126 125 if (rc) 127 126 return rc; 128 127 129 - i += slabs; 128 + i += IO_TLB_SEGSIZE; 130 129 } while (i < nslabs); 131 130 return 0; 132 131 } ··· 152 153 return ""; 153 154 } 154 155 155 - #define DEFAULT_NSLABS ALIGN(SZ_64M >> IO_TLB_SHIFT, IO_TLB_SEGSIZE) 156 - 157 - int __ref xen_swiotlb_init(void) 156 + int xen_swiotlb_init(void) 158 157 { 159 158 enum xen_swiotlb_err m_ret = XEN_SWIOTLB_UNKNOWN; 160 159 unsigned long bytes = swiotlb_size_or_default(); ··· 182 185 order--; 183 186 } 184 187 if (!start) 185 - goto error; 188 + goto exit; 186 189 if (order != get_order(bytes)) { 187 190 pr_warn("Warning: only able to allocate %ld MB for software IO TLB\n", 188 191 (PAGE_SIZE << order) >> 20); ··· 205 208 swiotlb_set_max_segment(PAGE_SIZE); 206 209 return 0; 207 210 error: 208 - if (repeat--) { 211 + if (nslabs > 1024 && repeat--) { 209 212 /* Min is 2MB */ 210 - nslabs = max(1024UL, (nslabs >> 1)); 211 - pr_info("Lowering to %luMB\n", 212 - (nslabs << IO_TLB_SHIFT) >> 20); 213 + nslabs = max(1024UL, ALIGN(nslabs >> 1, IO_TLB_SEGSIZE)); 214 + bytes = nslabs << IO_TLB_SHIFT; 215 + pr_info("Lowering to %luMB\n", bytes >> 20); 213 216 goto retry; 214 217 } 218 + exit: 215 219 pr_err("%s (rc:%d)\n", xen_swiotlb_error(m_ret), rc); 216 - free_pages((unsigned long)start, order); 217 220 return rc; 218 221 } 219 222 ··· 241 244 rc = xen_swiotlb_fixup(start, nslabs); 242 245 if (rc) { 243 246 memblock_free(__pa(start), PAGE_ALIGN(bytes)); 244 - if (repeat--) { 247 + if (nslabs > 1024 && repeat--) { 245 248 /* Min is 2MB */ 246 - nslabs = max(1024UL, (nslabs >> 1)); 249 + nslabs = max(1024UL, ALIGN(nslabs >> 1, IO_TLB_SEGSIZE)); 247 250 bytes = nslabs << IO_TLB_SHIFT; 248 251 pr_info("Lowering to %luMB\n", bytes >> 20); 249 252 goto retry; ··· 251 254 panic("%s (rc:%d)", xen_swiotlb_error(XEN_SWIOTLB_EFIXUP), rc); 252 255 } 253 256 254 - if (swiotlb_init_with_tbl(start, nslabs, false)) 257 + if (swiotlb_init_with_tbl(start, nslabs, true)) 255 258 panic("Cannot allocate SWIOTLB buffer"); 256 259 swiotlb_set_max_segment(PAGE_SIZE); 257 260 }
+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
+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)
+10 -3
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. ··· 3037 3030 return full_path; 3038 3031 } 3039 3032 3040 - /** 3033 + /* 3041 3034 * expand_dfs_referral - Perform a dfs referral query and update the cifs_sb 3042 3035 * 3043 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)
+2 -1
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 888 if (test_bit(CIFS_INO_MODIFIED_ATTR, &cinode->flags)) { 887 889 inode->i_ctime = inode->i_mtime = current_time(inode); ··· 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)) &&
+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)
+39 -3
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) ··· 735 736 if (cancel_delayed_work(&cfile->deferred)) { 736 737 tmp_list = kmalloc(sizeof(struct file_list), GFP_ATOMIC); 737 738 if (tmp_list == NULL) 738 - continue; 739 + break; 739 740 tmp_list->cfile = cfile; 740 741 list_add_tail(&tmp_list->list, &file_head); 741 742 } ··· 766 767 if (cancel_delayed_work(&cfile->deferred)) { 767 768 tmp_list = kmalloc(sizeof(struct file_list), GFP_ATOMIC); 768 769 if (tmp_list == NULL) 769 - continue; 770 + break; 770 771 tmp_list->cfile = cfile; 771 772 list_add_tail(&tmp_list->list, &file_head); 772 773 } ··· 779 780 list_del(&tmp_list->list); 780 781 kfree(tmp_list); 781 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); 782 820 } 783 821 784 822 /* parses DFS refferal V3 structure
-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
-1
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
-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)
+13 -14
fs/io-wq.c
··· 14 14 #include <linux/rculist_nulls.h> 15 15 #include <linux/cpu.h> 16 16 #include <linux/tracehook.h> 17 + #include <uapi/linux/io_uring.h> 17 18 18 19 #include "io-wq.h" 19 20 ··· 177 176 static void io_worker_exit(struct io_worker *worker) 178 177 { 179 178 struct io_wqe *wqe = worker->wqe; 180 - struct io_wqe_acct *acct = io_wqe_get_acct(worker); 181 179 182 180 if (refcount_dec_and_test(&worker->ref)) 183 181 complete(&worker->ref_done); ··· 186 186 if (worker->flags & IO_WORKER_F_FREE) 187 187 hlist_nulls_del_rcu(&worker->nulls_node); 188 188 list_del_rcu(&worker->all_list); 189 - acct->nr_workers--; 190 189 preempt_disable(); 191 190 io_wqe_dec_running(worker); 192 191 worker->flags = 0; ··· 245 246 */ 246 247 static bool io_wqe_create_worker(struct io_wqe *wqe, struct io_wqe_acct *acct) 247 248 { 248 - bool do_create = false; 249 - 250 249 /* 251 250 * Most likely an attempt to queue unbounded work on an io_wq that 252 251 * wasn't setup with any unbounded workers. ··· 253 256 pr_warn_once("io-wq is not configured for unbound workers"); 254 257 255 258 raw_spin_lock(&wqe->lock); 256 - if (acct->nr_workers < acct->max_workers) { 257 - acct->nr_workers++; 258 - do_create = true; 259 + if (acct->nr_workers == acct->max_workers) { 260 + raw_spin_unlock(&wqe->lock); 261 + return true; 259 262 } 263 + acct->nr_workers++; 260 264 raw_spin_unlock(&wqe->lock); 261 - if (do_create) { 262 - atomic_inc(&acct->nr_running); 263 - atomic_inc(&wqe->wq->worker_refs); 264 - return create_io_worker(wqe->wq, wqe, acct->index); 265 - } 266 - 267 - return true; 265 + atomic_inc(&acct->nr_running); 266 + atomic_inc(&wqe->wq->worker_refs); 267 + return create_io_worker(wqe->wq, wqe, acct->index); 268 268 } 269 269 270 270 static void io_wqe_inc_running(struct io_worker *worker) ··· 568 574 } 569 575 /* timed out, exit unless we're the last worker */ 570 576 if (last_timeout && acct->nr_workers > 1) { 577 + acct->nr_workers--; 571 578 raw_spin_unlock(&wqe->lock); 572 579 __set_current_state(TASK_RUNNING); 573 580 break; ··· 1281 1286 int io_wq_max_workers(struct io_wq *wq, int *new_count) 1282 1287 { 1283 1288 int i, node, prev = 0; 1289 + 1290 + BUILD_BUG_ON((int) IO_WQ_ACCT_BOUND != (int) IO_WQ_BOUND); 1291 + BUILD_BUG_ON((int) IO_WQ_ACCT_UNBOUND != (int) IO_WQ_UNBOUND); 1292 + BUILD_BUG_ON((int) IO_WQ_ACCT_NR != 2); 1284 1293 1285 1294 for (i = 0; i < 2; i++) { 1286 1295 if (new_count[i] > task_rlimit(current, RLIMIT_NPROC))
+144 -77
fs/io_uring.c
··· 712 712 struct iovec fast_iov[UIO_FASTIOV]; 713 713 const struct iovec *free_iovec; 714 714 struct iov_iter iter; 715 + struct iov_iter_state iter_state; 715 716 size_t bytes_done; 716 717 struct wait_page_queue wpq; 717 718 }; ··· 736 735 REQ_F_BUFFER_SELECTED_BIT, 737 736 REQ_F_COMPLETE_INLINE_BIT, 738 737 REQ_F_REISSUE_BIT, 739 - REQ_F_DONT_REISSUE_BIT, 740 738 REQ_F_CREDS_BIT, 741 739 REQ_F_REFCOUNT_BIT, 742 740 REQ_F_ARM_LTIMEOUT_BIT, ··· 782 782 REQ_F_COMPLETE_INLINE = BIT(REQ_F_COMPLETE_INLINE_BIT), 783 783 /* caller should reissue async */ 784 784 REQ_F_REISSUE = BIT(REQ_F_REISSUE_BIT), 785 - /* don't attempt request reissue, see io_rw_reissue() */ 786 - REQ_F_DONT_REISSUE = BIT(REQ_F_DONT_REISSUE_BIT), 787 785 /* supports async reads */ 788 786 REQ_F_NOWAIT_READ = BIT(REQ_F_NOWAIT_READ_BIT), 789 787 /* supports async writes */ ··· 2442 2444 req = list_first_entry(done, struct io_kiocb, inflight_entry); 2443 2445 list_del(&req->inflight_entry); 2444 2446 2445 - if (READ_ONCE(req->result) == -EAGAIN && 2446 - !(req->flags & REQ_F_DONT_REISSUE)) { 2447 - req->iopoll_completed = 0; 2448 - io_req_task_queue_reissue(req); 2449 - continue; 2450 - } 2451 - 2452 2447 __io_cqring_fill_event(ctx, req->user_data, req->result, 2453 2448 io_put_rw_kbuf(req)); 2454 2449 (*nr_events)++; ··· 2604 2613 2605 2614 if (!rw) 2606 2615 return !io_req_prep_async(req); 2607 - /* may have left rw->iter inconsistent on -EIOCBQUEUED */ 2608 - iov_iter_revert(&rw->iter, req->result - iov_iter_count(&rw->iter)); 2616 + iov_iter_restore(&rw->iter, &rw->iter_state); 2609 2617 return true; 2610 2618 } 2611 2619 ··· 2704 2714 if (kiocb->ki_flags & IOCB_WRITE) 2705 2715 kiocb_end_write(req); 2706 2716 if (unlikely(res != req->result)) { 2707 - if (!(res == -EAGAIN && io_rw_should_reissue(req) && 2708 - io_resubmit_prep(req))) { 2709 - req_set_fail(req); 2710 - req->flags |= REQ_F_DONT_REISSUE; 2717 + if (res == -EAGAIN && io_rw_should_reissue(req)) { 2718 + req->flags |= REQ_F_REISSUE; 2719 + return; 2711 2720 } 2712 2721 } 2713 2722 ··· 2832 2843 return __io_file_supports_nowait(req->file, rw); 2833 2844 } 2834 2845 2835 - static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe) 2846 + static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe, 2847 + int rw) 2836 2848 { 2837 2849 struct io_ring_ctx *ctx = req->ctx; 2838 2850 struct kiocb *kiocb = &req->rw.kiocb; ··· 2855 2865 if (unlikely(ret)) 2856 2866 return ret; 2857 2867 2858 - /* don't allow async punt for O_NONBLOCK or RWF_NOWAIT */ 2859 - if ((kiocb->ki_flags & IOCB_NOWAIT) || (file->f_flags & O_NONBLOCK)) 2868 + /* 2869 + * If the file is marked O_NONBLOCK, still allow retry for it if it 2870 + * supports async. Otherwise it's impossible to use O_NONBLOCK files 2871 + * reliably. If not, or it IOCB_NOWAIT is set, don't retry. 2872 + */ 2873 + if ((kiocb->ki_flags & IOCB_NOWAIT) || 2874 + ((file->f_flags & O_NONBLOCK) && !io_file_supports_nowait(req, rw))) 2860 2875 req->flags |= REQ_F_NOWAIT; 2861 2876 2862 2877 ioprio = READ_ONCE(sqe->ioprio); ··· 2926 2931 { 2927 2932 struct io_kiocb *req = container_of(kiocb, struct io_kiocb, rw.kiocb); 2928 2933 struct io_async_rw *io = req->async_data; 2929 - bool check_reissue = kiocb->ki_complete == io_complete_rw; 2930 2934 2931 2935 /* add previously done IO, if any */ 2932 2936 if (io && io->bytes_done > 0) { ··· 2937 2943 2938 2944 if (req->flags & REQ_F_CUR_POS) 2939 2945 req->file->f_pos = kiocb->ki_pos; 2940 - if (ret >= 0 && check_reissue) 2946 + if (ret >= 0 && (kiocb->ki_complete == io_complete_rw)) 2941 2947 __io_complete_rw(req, ret, 0, issue_flags); 2942 2948 else 2943 2949 io_rw_done(kiocb, ret); 2944 2950 2945 - if (check_reissue && (req->flags & REQ_F_REISSUE)) { 2951 + if (req->flags & REQ_F_REISSUE) { 2946 2952 req->flags &= ~REQ_F_REISSUE; 2947 2953 if (io_resubmit_prep(req)) { 2948 2954 io_req_task_queue_reissue(req); 2949 2955 } else { 2956 + unsigned int cflags = io_put_rw_kbuf(req); 2957 + struct io_ring_ctx *ctx = req->ctx; 2958 + 2950 2959 req_set_fail(req); 2951 - __io_req_complete(req, issue_flags, ret, 2952 - io_put_rw_kbuf(req)); 2960 + if (issue_flags & IO_URING_F_NONBLOCK) { 2961 + mutex_lock(&ctx->uring_lock); 2962 + __io_req_complete(req, issue_flags, ret, cflags); 2963 + mutex_unlock(&ctx->uring_lock); 2964 + } else { 2965 + __io_req_complete(req, issue_flags, ret, cflags); 2966 + } 2953 2967 } 2954 2968 } 2955 2969 } ··· 3265 3263 ret = nr; 3266 3264 break; 3267 3265 } 3266 + if (!iov_iter_is_bvec(iter)) { 3267 + iov_iter_advance(iter, nr); 3268 + } else { 3269 + req->rw.len -= nr; 3270 + req->rw.addr += nr; 3271 + } 3268 3272 ret += nr; 3269 3273 if (nr != iovec.iov_len) 3270 3274 break; 3271 - req->rw.len -= nr; 3272 - req->rw.addr += nr; 3273 - iov_iter_advance(iter, nr); 3274 3275 } 3275 3276 3276 3277 return ret; ··· 3320 3315 if (!force && !io_op_defs[req->opcode].needs_async_setup) 3321 3316 return 0; 3322 3317 if (!req->async_data) { 3318 + struct io_async_rw *iorw; 3319 + 3323 3320 if (io_alloc_async_data(req)) { 3324 3321 kfree(iovec); 3325 3322 return -ENOMEM; 3326 3323 } 3327 3324 3328 3325 io_req_map_rw(req, iovec, fast_iov, iter); 3326 + iorw = req->async_data; 3327 + /* we've copied and mapped the iter, ensure state is saved */ 3328 + iov_iter_save_state(&iorw->iter, &iorw->iter_state); 3329 3329 } 3330 3330 return 0; 3331 3331 } ··· 3349 3339 iorw->free_iovec = iov; 3350 3340 if (iov) 3351 3341 req->flags |= REQ_F_NEED_CLEANUP; 3342 + iov_iter_save_state(&iorw->iter, &iorw->iter_state); 3352 3343 return 0; 3353 3344 } 3354 3345 ··· 3357 3346 { 3358 3347 if (unlikely(!(req->file->f_mode & FMODE_READ))) 3359 3348 return -EBADF; 3360 - return io_prep_rw(req, sqe); 3349 + return io_prep_rw(req, sqe, READ); 3361 3350 } 3362 3351 3363 3352 /* ··· 3453 3442 struct kiocb *kiocb = &req->rw.kiocb; 3454 3443 struct iov_iter __iter, *iter = &__iter; 3455 3444 struct io_async_rw *rw = req->async_data; 3456 - ssize_t io_size, ret, ret2; 3457 3445 bool force_nonblock = issue_flags & IO_URING_F_NONBLOCK; 3446 + struct iov_iter_state __state, *state; 3447 + ssize_t ret, ret2; 3458 3448 3459 3449 if (rw) { 3460 3450 iter = &rw->iter; 3451 + state = &rw->iter_state; 3452 + /* 3453 + * We come here from an earlier attempt, restore our state to 3454 + * match in case it doesn't. It's cheap enough that we don't 3455 + * need to make this conditional. 3456 + */ 3457 + iov_iter_restore(iter, state); 3461 3458 iovec = NULL; 3462 3459 } else { 3463 3460 ret = io_import_iovec(READ, req, &iovec, iter, !force_nonblock); 3464 3461 if (ret < 0) 3465 3462 return ret; 3463 + state = &__state; 3464 + iov_iter_save_state(iter, state); 3466 3465 } 3467 - io_size = iov_iter_count(iter); 3468 - req->result = io_size; 3466 + req->result = iov_iter_count(iter); 3469 3467 3470 3468 /* Ensure we clear previously set non-block flag */ 3471 3469 if (!force_nonblock) ··· 3488 3468 return ret ?: -EAGAIN; 3489 3469 } 3490 3470 3491 - ret = rw_verify_area(READ, req->file, io_kiocb_ppos(kiocb), io_size); 3471 + ret = rw_verify_area(READ, req->file, io_kiocb_ppos(kiocb), req->result); 3492 3472 if (unlikely(ret)) { 3493 3473 kfree(iovec); 3494 3474 return ret; ··· 3504 3484 /* no retry on NONBLOCK nor RWF_NOWAIT */ 3505 3485 if (req->flags & REQ_F_NOWAIT) 3506 3486 goto done; 3507 - /* some cases will consume bytes even on error returns */ 3508 - iov_iter_reexpand(iter, iter->count + iter->truncated); 3509 - iov_iter_revert(iter, io_size - iov_iter_count(iter)); 3510 3487 ret = 0; 3511 3488 } else if (ret == -EIOCBQUEUED) { 3512 3489 goto out_free; 3513 - } else if (ret <= 0 || ret == io_size || !force_nonblock || 3490 + } else if (ret <= 0 || ret == req->result || !force_nonblock || 3514 3491 (req->flags & REQ_F_NOWAIT) || !need_read_all(req)) { 3515 3492 /* read all, failed, already did sync or don't want to retry */ 3516 3493 goto done; 3517 3494 } 3495 + 3496 + /* 3497 + * Don't depend on the iter state matching what was consumed, or being 3498 + * untouched in case of error. Restore it and we'll advance it 3499 + * manually if we need to. 3500 + */ 3501 + iov_iter_restore(iter, state); 3518 3502 3519 3503 ret2 = io_setup_async_rw(req, iovec, inline_vecs, iter, true); 3520 3504 if (ret2) ··· 3526 3502 3527 3503 iovec = NULL; 3528 3504 rw = req->async_data; 3529 - /* now use our persistent iterator, if we aren't already */ 3530 - iter = &rw->iter; 3505 + /* 3506 + * Now use our persistent iterator and state, if we aren't already. 3507 + * We've restored and mapped the iter to match. 3508 + */ 3509 + if (iter != &rw->iter) { 3510 + iter = &rw->iter; 3511 + state = &rw->iter_state; 3512 + } 3531 3513 3532 3514 do { 3533 - io_size -= ret; 3515 + /* 3516 + * We end up here because of a partial read, either from 3517 + * above or inside this loop. Advance the iter by the bytes 3518 + * that were consumed. 3519 + */ 3520 + iov_iter_advance(iter, ret); 3521 + if (!iov_iter_count(iter)) 3522 + break; 3534 3523 rw->bytes_done += ret; 3524 + iov_iter_save_state(iter, state); 3525 + 3535 3526 /* if we can retry, do so with the callbacks armed */ 3536 3527 if (!io_rw_should_retry(req)) { 3537 3528 kiocb->ki_flags &= ~IOCB_WAITQ; ··· 3564 3525 return 0; 3565 3526 /* we got some bytes, but not all. retry. */ 3566 3527 kiocb->ki_flags &= ~IOCB_WAITQ; 3567 - } while (ret > 0 && ret < io_size); 3528 + iov_iter_restore(iter, state); 3529 + } while (ret > 0); 3568 3530 done: 3569 3531 kiocb_done(kiocb, ret, issue_flags); 3570 3532 out_free: ··· 3579 3539 { 3580 3540 if (unlikely(!(req->file->f_mode & FMODE_WRITE))) 3581 3541 return -EBADF; 3582 - return io_prep_rw(req, sqe); 3542 + return io_prep_rw(req, sqe, WRITE); 3583 3543 } 3584 3544 3585 3545 static int io_write(struct io_kiocb *req, unsigned int issue_flags) ··· 3588 3548 struct kiocb *kiocb = &req->rw.kiocb; 3589 3549 struct iov_iter __iter, *iter = &__iter; 3590 3550 struct io_async_rw *rw = req->async_data; 3591 - ssize_t ret, ret2, io_size; 3592 3551 bool force_nonblock = issue_flags & IO_URING_F_NONBLOCK; 3552 + struct iov_iter_state __state, *state; 3553 + ssize_t ret, ret2; 3593 3554 3594 3555 if (rw) { 3595 3556 iter = &rw->iter; 3557 + state = &rw->iter_state; 3558 + iov_iter_restore(iter, state); 3596 3559 iovec = NULL; 3597 3560 } else { 3598 3561 ret = io_import_iovec(WRITE, req, &iovec, iter, !force_nonblock); 3599 3562 if (ret < 0) 3600 3563 return ret; 3564 + state = &__state; 3565 + iov_iter_save_state(iter, state); 3601 3566 } 3602 - io_size = iov_iter_count(iter); 3603 - req->result = io_size; 3567 + req->result = iov_iter_count(iter); 3568 + ret2 = 0; 3604 3569 3605 3570 /* Ensure we clear previously set non-block flag */ 3606 3571 if (!force_nonblock) ··· 3622 3577 (req->flags & REQ_F_ISREG)) 3623 3578 goto copy_iov; 3624 3579 3625 - ret = rw_verify_area(WRITE, req->file, io_kiocb_ppos(kiocb), io_size); 3580 + ret = rw_verify_area(WRITE, req->file, io_kiocb_ppos(kiocb), req->result); 3626 3581 if (unlikely(ret)) 3627 3582 goto out_free; 3628 3583 ··· 3669 3624 kiocb_done(kiocb, ret2, issue_flags); 3670 3625 } else { 3671 3626 copy_iov: 3672 - /* some cases will consume bytes even on error returns */ 3673 - iov_iter_reexpand(iter, iter->count + iter->truncated); 3674 - iov_iter_revert(iter, io_size - iov_iter_count(iter)); 3627 + iov_iter_restore(iter, state); 3628 + if (ret2 > 0) 3629 + iov_iter_advance(iter, ret2); 3675 3630 ret = io_setup_async_rw(req, iovec, inline_vecs, iter, false); 3676 3631 return ret ?: -EAGAIN; 3677 3632 } ··· 7560 7515 break; 7561 7516 } while (1); 7562 7517 7518 + if (uts) { 7519 + struct timespec64 ts; 7520 + 7521 + if (get_timespec64(&ts, uts)) 7522 + return -EFAULT; 7523 + timeout = timespec64_to_jiffies(&ts); 7524 + } 7525 + 7563 7526 if (sig) { 7564 7527 #ifdef CONFIG_COMPAT 7565 7528 if (in_compat_syscall()) ··· 7579 7526 7580 7527 if (ret) 7581 7528 return ret; 7582 - } 7583 - 7584 - if (uts) { 7585 - struct timespec64 ts; 7586 - 7587 - if (get_timespec64(&ts, uts)) 7588 - return -EFAULT; 7589 - timeout = timespec64_to_jiffies(&ts); 7590 7529 } 7591 7530 7592 7531 init_waitqueue_func_entry(&iowq.wq, io_wake_function); ··· 8329 8284 #endif 8330 8285 } 8331 8286 8287 + static int io_queue_rsrc_removal(struct io_rsrc_data *data, unsigned idx, 8288 + struct io_rsrc_node *node, void *rsrc) 8289 + { 8290 + struct io_rsrc_put *prsrc; 8291 + 8292 + prsrc = kzalloc(sizeof(*prsrc), GFP_KERNEL); 8293 + if (!prsrc) 8294 + return -ENOMEM; 8295 + 8296 + prsrc->tag = *io_get_tag_slot(data, idx); 8297 + prsrc->rsrc = rsrc; 8298 + list_add(&prsrc->list, &node->rsrc_list); 8299 + return 0; 8300 + } 8301 + 8332 8302 static int io_install_fixed_file(struct io_kiocb *req, struct file *file, 8333 8303 unsigned int issue_flags, u32 slot_index) 8334 8304 { 8335 8305 struct io_ring_ctx *ctx = req->ctx; 8336 8306 bool force_nonblock = issue_flags & IO_URING_F_NONBLOCK; 8307 + bool needs_switch = false; 8337 8308 struct io_fixed_file *file_slot; 8338 8309 int ret = -EBADF; 8339 8310 ··· 8365 8304 8366 8305 slot_index = array_index_nospec(slot_index, ctx->nr_user_files); 8367 8306 file_slot = io_fixed_file_slot(&ctx->file_table, slot_index); 8368 - ret = -EBADF; 8369 - if (file_slot->file_ptr) 8370 - goto err; 8307 + 8308 + if (file_slot->file_ptr) { 8309 + struct file *old_file; 8310 + 8311 + ret = io_rsrc_node_switch_start(ctx); 8312 + if (ret) 8313 + goto err; 8314 + 8315 + old_file = (struct file *)(file_slot->file_ptr & FFS_MASK); 8316 + ret = io_queue_rsrc_removal(ctx->file_data, slot_index, 8317 + ctx->rsrc_node, old_file); 8318 + if (ret) 8319 + goto err; 8320 + file_slot->file_ptr = 0; 8321 + needs_switch = true; 8322 + } 8371 8323 8372 8324 *io_get_tag_slot(ctx->file_data, slot_index) = 0; 8373 8325 io_fixed_file_set(file_slot, file); ··· 8392 8318 8393 8319 ret = 0; 8394 8320 err: 8321 + if (needs_switch) 8322 + io_rsrc_node_switch(ctx, ctx->file_data); 8395 8323 io_ring_submit_unlock(ctx, !force_nonblock); 8396 8324 if (ret) 8397 8325 fput(file); 8398 8326 return ret; 8399 - } 8400 - 8401 - static int io_queue_rsrc_removal(struct io_rsrc_data *data, unsigned idx, 8402 - struct io_rsrc_node *node, void *rsrc) 8403 - { 8404 - struct io_rsrc_put *prsrc; 8405 - 8406 - prsrc = kzalloc(sizeof(*prsrc), GFP_KERNEL); 8407 - if (!prsrc) 8408 - return -ENOMEM; 8409 - 8410 - prsrc->tag = *io_get_tag_slot(data, idx); 8411 - prsrc->rsrc = rsrc; 8412 - list_add(&prsrc->list, &node->rsrc_list); 8413 - return 0; 8414 8327 } 8415 8328 8416 8329 static int __io_sqe_files_update(struct io_ring_ctx *ctx, ··· 10621 10560 * ordering. Fine to drop uring_lock here, we hold 10622 10561 * a ref to the ctx. 10623 10562 */ 10563 + refcount_inc(&sqd->refs); 10624 10564 mutex_unlock(&ctx->uring_lock); 10625 10565 mutex_lock(&sqd->lock); 10626 10566 mutex_lock(&ctx->uring_lock); 10627 - tctx = sqd->thread->io_uring; 10567 + if (sqd->thread) 10568 + tctx = sqd->thread->io_uring; 10628 10569 } 10629 10570 } else { 10630 10571 tctx = current->io_uring; ··· 10640 10577 if (ret) 10641 10578 goto err; 10642 10579 10643 - if (sqd) 10580 + if (sqd) { 10644 10581 mutex_unlock(&sqd->lock); 10582 + io_put_sq_data(sqd); 10583 + } 10645 10584 10646 10585 if (copy_to_user(arg, new_count, sizeof(new_count))) 10647 10586 return -EFAULT; 10648 10587 10649 10588 return 0; 10650 10589 err: 10651 - if (sqd) 10590 + if (sqd) { 10652 10591 mutex_unlock(&sqd->lock); 10592 + io_put_sq_data(sqd); 10593 + } 10653 10594 return ret; 10654 10595 } 10655 10596
+67 -9
fs/ksmbd/misc.c
··· 191 191 return nlink; 192 192 } 193 193 194 - void ksmbd_conv_path_to_unix(char *path) 194 + char *ksmbd_conv_path_to_unix(char *path) 195 195 { 196 + size_t path_len, remain_path_len, out_path_len; 197 + char *out_path, *out_next; 198 + int i, pre_dotdot_cnt = 0, slash_cnt = 0; 199 + bool is_last; 200 + 196 201 strreplace(path, '\\', '/'); 197 - } 202 + path_len = strlen(path); 203 + remain_path_len = path_len; 204 + if (path_len == 0) 205 + return ERR_PTR(-EINVAL); 198 206 199 - void ksmbd_strip_last_slash(char *path) 200 - { 201 - int len = strlen(path); 207 + out_path = kzalloc(path_len + 2, GFP_KERNEL); 208 + if (!out_path) 209 + return ERR_PTR(-ENOMEM); 210 + out_path_len = 0; 211 + out_next = out_path; 202 212 203 - while (len && path[len - 1] == '/') { 204 - path[len - 1] = '\0'; 205 - len--; 206 - } 213 + do { 214 + char *name = path + path_len - remain_path_len; 215 + char *next = strchrnul(name, '/'); 216 + size_t name_len = next - name; 217 + 218 + is_last = !next[0]; 219 + if (name_len == 2 && name[0] == '.' && name[1] == '.') { 220 + pre_dotdot_cnt++; 221 + /* handle the case that path ends with "/.." */ 222 + if (is_last) 223 + goto follow_dotdot; 224 + } else { 225 + if (pre_dotdot_cnt) { 226 + follow_dotdot: 227 + slash_cnt = 0; 228 + for (i = out_path_len - 1; i >= 0; i--) { 229 + if (out_path[i] == '/' && 230 + ++slash_cnt == pre_dotdot_cnt + 1) 231 + break; 232 + } 233 + 234 + if (i < 0 && 235 + slash_cnt != pre_dotdot_cnt) { 236 + kfree(out_path); 237 + return ERR_PTR(-EINVAL); 238 + } 239 + 240 + out_next = &out_path[i+1]; 241 + *out_next = '\0'; 242 + out_path_len = i + 1; 243 + 244 + } 245 + 246 + if (name_len != 0 && 247 + !(name_len == 1 && name[0] == '.') && 248 + !(name_len == 2 && name[0] == '.' && name[1] == '.')) { 249 + next[0] = '\0'; 250 + sprintf(out_next, "%s/", name); 251 + out_next += name_len + 1; 252 + out_path_len += name_len + 1; 253 + next[0] = '/'; 254 + } 255 + pre_dotdot_cnt = 0; 256 + } 257 + 258 + remain_path_len -= name_len + 1; 259 + } while (!is_last); 260 + 261 + if (out_path_len > 0) 262 + out_path[out_path_len-1] = '\0'; 263 + path[path_len] = '\0'; 264 + return out_path; 207 265 } 208 266 209 267 void ksmbd_conv_path_to_windows(char *path)
+1 -2
fs/ksmbd/misc.h
··· 16 16 int parse_stream_name(char *filename, char **stream_name, int *s_type); 17 17 char *convert_to_nt_pathname(char *filename, char *sharepath); 18 18 int get_nlink(struct kstat *st); 19 - void ksmbd_conv_path_to_unix(char *path); 20 - void ksmbd_strip_last_slash(char *path); 19 + char *ksmbd_conv_path_to_unix(char *path); 21 20 void ksmbd_conv_path_to_windows(char *path); 22 21 char *ksmbd_extract_sharename(char *treename); 23 22 char *convert_to_unix_name(struct ksmbd_share_config *share, char *name);
+13 -5
fs/ksmbd/smb2pdu.c
··· 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, *norm_name, *unixname; 638 638 639 639 name = smb_strndup_from_utf16(src, maxlen, 1, local_nls); 640 640 if (IS_ERR(name)) { ··· 643 643 } 644 644 645 645 /* change it to absolute unix name */ 646 - ksmbd_conv_path_to_unix(name); 647 - ksmbd_strip_last_slash(name); 648 - 649 - unixname = convert_to_unix_name(share, name); 646 + norm_name = ksmbd_conv_path_to_unix(name); 647 + if (IS_ERR(norm_name)) { 648 + kfree(name); 649 + return norm_name; 650 + } 650 651 kfree(name); 652 + 653 + unixname = convert_to_unix_name(share, norm_name); 654 + kfree(norm_name); 651 655 if (!unixname) { 652 656 pr_err("can not convert absolute name\n"); 653 657 return ERR_PTR(-ENOMEM); ··· 4045 4041 path = &fp->filp->f_path; 4046 4042 /* single EA entry is requested with given user.* name */ 4047 4043 if (req->InputBufferLength) { 4044 + if (le32_to_cpu(req->InputBufferLength) < 4045 + sizeof(struct smb2_ea_info_req)) 4046 + return -EINVAL; 4047 + 4048 4048 ea_req = (struct smb2_ea_info_req *)req->Buffer; 4049 4049 } else { 4050 4050 /* need to send all EAs, if no specific EA is requested*/
-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>
+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)
+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)
+3 -23
include/asm-generic/io.h
··· 1023 1023 port &= IO_SPACE_LIMIT; 1024 1024 return (port > MMIO_UPPER_LIMIT) ? NULL : PCI_IOBASE + port; 1025 1025 } 1026 - #define __pci_ioport_unmap __pci_ioport_unmap 1027 - static inline void __pci_ioport_unmap(void __iomem *p) 1028 - { 1029 - uintptr_t start = (uintptr_t) PCI_IOBASE; 1030 - uintptr_t addr = (uintptr_t) p; 1031 - 1032 - if (addr >= start && addr < start + IO_SPACE_LIMIT) 1033 - return; 1034 - iounmap(p); 1035 - } 1026 + #define ARCH_HAS_GENERIC_IOPORT_MAP 1036 1027 #endif 1037 1028 1038 1029 #ifndef ioport_unmap ··· 1039 1048 #endif /* CONFIG_HAS_IOPORT_MAP */ 1040 1049 1041 1050 #ifndef CONFIG_GENERIC_IOMAP 1042 - struct pci_dev; 1043 - extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); 1044 - 1045 - #ifndef __pci_ioport_unmap 1046 - static inline void __pci_ioport_unmap(void __iomem *p) {} 1047 - #endif 1048 - 1049 1051 #ifndef pci_iounmap 1050 - #define pci_iounmap pci_iounmap 1051 - static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p) 1052 - { 1053 - __pci_ioport_unmap(p); 1054 - } 1052 + #define ARCH_WANTS_GENERIC_PCI_IOUNMAP 1055 1053 #endif 1056 - #endif /* CONFIG_GENERIC_IOMAP */ 1054 + #endif 1057 1055 1058 1056 #ifndef xlate_dev_mem_ptr 1059 1057 #define xlate_dev_mem_ptr xlate_dev_mem_ptr
-10
include/asm-generic/iomap.h
··· 110 110 } 111 111 #endif 112 112 113 - #ifdef CONFIG_PCI 114 - /* Destroy a virtual mapping cookie for a PCI BAR (memory or IO) */ 115 - struct pci_dev; 116 - extern void pci_iounmap(struct pci_dev *dev, void __iomem *); 117 - #elif defined(CONFIG_GENERIC_IOMAP) 118 - struct pci_dev; 119 - static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) 120 - { } 121 - #endif 122 - 123 113 #include <asm-generic/pci_iomap.h> 124 114 125 115 #endif
+3
include/asm-generic/pci_iomap.h
··· 18 18 extern void __iomem *pci_iomap_wc_range(struct pci_dev *dev, int bar, 19 19 unsigned long offset, 20 20 unsigned long maxlen); 21 + extern void pci_iounmap(struct pci_dev *dev, void __iomem *); 21 22 /* Create a virtual mapping cookie for a port on a given PCI device. 22 23 * Do not call this directly, it exists to make it easier for architectures 23 24 * to override */ ··· 51 50 { 52 51 return NULL; 53 52 } 53 + static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) 54 + { } 54 55 #endif 55 56 56 57 #endif /* __ASM_GENERIC_PCI_IOMAP_H */
+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
+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 *
+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
+1
include/linux/sched.h
··· 1471 1471 mce_whole_page : 1, 1472 1472 __mce_reserved : 62; 1473 1473 struct callback_head mce_kill_me; 1474 + int mce_count; 1474 1475 #endif 1475 1476 1476 1477 #ifdef CONFIG_KRETPROBES
+16 -5
include/linux/uio.h
··· 27 27 ITER_DISCARD, 28 28 }; 29 29 30 + struct iov_iter_state { 31 + size_t iov_offset; 32 + size_t count; 33 + unsigned long nr_segs; 34 + }; 35 + 30 36 struct iov_iter { 31 37 u8 iter_type; 32 38 bool data_source; ··· 53 47 }; 54 48 loff_t xarray_start; 55 49 }; 56 - size_t truncated; 57 50 }; 58 51 59 52 static inline enum iter_type iov_iter_type(const struct iov_iter *i) 60 53 { 61 54 return i->iter_type; 55 + } 56 + 57 + static inline void iov_iter_save_state(struct iov_iter *iter, 58 + struct iov_iter_state *state) 59 + { 60 + state->iov_offset = iter->iov_offset; 61 + state->count = iter->count; 62 + state->nr_segs = iter->nr_segs; 62 63 } 63 64 64 65 static inline bool iter_is_iovec(const struct iov_iter *i) ··· 246 233 ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages, 247 234 size_t maxsize, size_t *start); 248 235 int iov_iter_npages(const struct iov_iter *i, int maxpages); 236 + void iov_iter_restore(struct iov_iter *i, struct iov_iter_state *state); 249 237 250 238 const void *dup_iter(struct iov_iter *new, struct iov_iter *old, gfp_t flags); 251 239 ··· 269 255 * conversion in assignement is by definition greater than all 270 256 * values of size_t, including old i->count. 271 257 */ 272 - if (i->count > count) { 273 - i->truncated += i->count - count; 258 + if (i->count > count) 274 259 i->count = count; 275 - } 276 260 } 277 261 278 262 /* ··· 279 267 */ 280 268 static inline void iov_iter_reexpand(struct iov_iter *i, size_t count) 281 269 { 282 - i->truncated -= count - i->count; 283 270 i->count = count; 284 271 } 285 272
+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
··· 1628 1628 release_sock(sk); 1629 1629 __release(&sk->sk_lock.slock); 1630 1630 } else { 1631 + mutex_release(&sk->sk_lock.dep_map, _RET_IP_); 1631 1632 spin_unlock_bh(&sk->sk_lock.slock); 1632 1633 } 1633 1634 }
+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
-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 *
+7 -1
include/uapi/linux/io_uring.h
··· 317 317 IORING_REGISTER_IOWQ_AFF = 17, 318 318 IORING_UNREGISTER_IOWQ_AFF = 18, 319 319 320 - /* set/get max number of workers */ 320 + /* set/get max number of io-wq workers */ 321 321 IORING_REGISTER_IOWQ_MAX_WORKERS = 19, 322 322 323 323 /* this goes last */ 324 324 IORING_REGISTER_LAST 325 + }; 326 + 327 + /* io-wq worker categories */ 328 + enum { 329 + IO_WQ_BOUND, 330 + IO_WQ_UNBOUND, 325 331 }; 326 332 327 333 /* deprecated, see struct io_uring_rsrc_update */
+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;
+2 -1
kernel/dma/debug.c
··· 567 567 pr_err("cacheline tracking ENOMEM, dma-debug disabled\n"); 568 568 global_disable = true; 569 569 } else if (rc == -EEXIST) { 570 - pr_err("cacheline tracking EEXIST, overlapping mappings aren't supported\n"); 570 + err_printk(entry->dev, entry, 571 + "cacheline tracking EEXIST, overlapping mappings aren't supported\n"); 571 572 } 572 573 } 573 574
+2 -1
kernel/dma/mapping.c
··· 206 206 /** 207 207 * dma_map_sg_attrs - Map the given buffer for DMA 208 208 * @dev: The device for which to perform the DMA operation 209 - * @sg: The sg_table object describing the buffer 209 + * @sg: The sg_table object describing the buffer 210 + * @nents: Number of entries to map 210 211 * @dir: DMA direction 211 212 * @attrs: Optional DMA attributes for the map operation 212 213 *
+1 -1
kernel/events/core.c
··· 10193 10193 return; 10194 10194 10195 10195 if (ifh->nr_file_filters) { 10196 - mm = get_task_mm(event->ctx->task); 10196 + mm = get_task_mm(task); 10197 10197 if (!mm) 10198 10198 goto restart; 10199 10199
+46 -21
kernel/locking/rwbase_rt.c
··· 41 41 * The risk of writer starvation is there, but the pathological use cases 42 42 * which trigger it are not necessarily the typical RT workloads. 43 43 * 44 + * Fast-path orderings: 45 + * The lock/unlock of readers can run in fast paths: lock and unlock are only 46 + * atomic ops, and there is no inner lock to provide ACQUIRE and RELEASE 47 + * semantics of rwbase_rt. Atomic ops should thus provide _acquire() 48 + * and _release() (or stronger). 49 + * 44 50 * Common code shared between RT rw_semaphore and rwlock 45 51 */ 46 52 ··· 59 53 * set. 60 54 */ 61 55 for (r = atomic_read(&rwb->readers); r < 0;) { 56 + /* Fully-ordered if cmpxchg() succeeds, provides ACQUIRE */ 62 57 if (likely(atomic_try_cmpxchg(&rwb->readers, &r, r + 1))) 63 58 return 1; 64 59 } ··· 169 162 /* 170 163 * rwb->readers can only hit 0 when a writer is waiting for the 171 164 * active readers to leave the critical section. 165 + * 166 + * dec_and_test() is fully ordered, provides RELEASE. 172 167 */ 173 168 if (unlikely(atomic_dec_and_test(&rwb->readers))) 174 169 __rwbase_read_unlock(rwb, state); ··· 181 172 { 182 173 struct rt_mutex_base *rtm = &rwb->rtmutex; 183 174 184 - atomic_add(READER_BIAS - bias, &rwb->readers); 175 + /* 176 + * _release() is needed in case that reader is in fast path, pairing 177 + * with atomic_try_cmpxchg() in rwbase_read_trylock(), provides RELEASE 178 + */ 179 + (void)atomic_add_return_release(READER_BIAS - bias, &rwb->readers); 185 180 raw_spin_unlock_irqrestore(&rtm->wait_lock, flags); 186 181 rwbase_rtmutex_unlock(rtm); 187 182 } ··· 209 196 __rwbase_write_unlock(rwb, WRITER_BIAS - 1, flags); 210 197 } 211 198 199 + static inline bool __rwbase_write_trylock(struct rwbase_rt *rwb) 200 + { 201 + /* Can do without CAS because we're serialized by wait_lock. */ 202 + lockdep_assert_held(&rwb->rtmutex.wait_lock); 203 + 204 + /* 205 + * _acquire is needed in case the reader is in the fast path, pairing 206 + * with rwbase_read_unlock(), provides ACQUIRE. 207 + */ 208 + if (!atomic_read_acquire(&rwb->readers)) { 209 + atomic_set(&rwb->readers, WRITER_BIAS); 210 + return 1; 211 + } 212 + 213 + return 0; 214 + } 215 + 212 216 static int __sched rwbase_write_lock(struct rwbase_rt *rwb, 213 217 unsigned int state) 214 218 { ··· 240 210 atomic_sub(READER_BIAS, &rwb->readers); 241 211 242 212 raw_spin_lock_irqsave(&rtm->wait_lock, flags); 243 - /* 244 - * set_current_state() for rw_semaphore 245 - * current_save_and_set_rtlock_wait_state() for rwlock 246 - */ 247 - rwbase_set_and_save_current_state(state); 213 + if (__rwbase_write_trylock(rwb)) 214 + goto out_unlock; 248 215 249 - /* Block until all readers have left the critical section. */ 250 - for (; atomic_read(&rwb->readers);) { 216 + rwbase_set_and_save_current_state(state); 217 + for (;;) { 251 218 /* Optimized out for rwlocks */ 252 219 if (rwbase_signal_pending_state(state, current)) { 253 - __set_current_state(TASK_RUNNING); 220 + rwbase_restore_current_state(); 254 221 __rwbase_write_unlock(rwb, 0, flags); 255 222 return -EINTR; 256 223 } 224 + 225 + if (__rwbase_write_trylock(rwb)) 226 + break; 227 + 257 228 raw_spin_unlock_irqrestore(&rtm->wait_lock, flags); 258 - 259 - /* 260 - * Schedule and wait for the readers to leave the critical 261 - * section. The last reader leaving it wakes the waiter. 262 - */ 263 - if (atomic_read(&rwb->readers) != 0) 264 - rwbase_schedule(); 265 - set_current_state(state); 229 + rwbase_schedule(); 266 230 raw_spin_lock_irqsave(&rtm->wait_lock, flags); 267 - } 268 231 269 - atomic_set(&rwb->readers, WRITER_BIAS); 232 + set_current_state(state); 233 + } 270 234 rwbase_restore_current_state(); 235 + 236 + out_unlock: 271 237 raw_spin_unlock_irqrestore(&rtm->wait_lock, flags); 272 238 return 0; 273 239 } ··· 279 253 atomic_sub(READER_BIAS, &rwb->readers); 280 254 281 255 raw_spin_lock_irqsave(&rtm->wait_lock, flags); 282 - if (!atomic_read(&rwb->readers)) { 283 - atomic_set(&rwb->readers, WRITER_BIAS); 256 + if (__rwbase_write_trylock(rwb)) { 284 257 raw_spin_unlock_irqrestore(&rtm->wait_lock, flags); 285 258 return 1; 286 259 }
+36
lib/iov_iter.c
··· 1972 1972 return 0; 1973 1973 } 1974 1974 EXPORT_SYMBOL(import_single_range); 1975 + 1976 + /** 1977 + * iov_iter_restore() - Restore a &struct iov_iter to the same state as when 1978 + * iov_iter_save_state() was called. 1979 + * 1980 + * @i: &struct iov_iter to restore 1981 + * @state: state to restore from 1982 + * 1983 + * Used after iov_iter_save_state() to bring restore @i, if operations may 1984 + * have advanced it. 1985 + * 1986 + * Note: only works on ITER_IOVEC, ITER_BVEC, and ITER_KVEC 1987 + */ 1988 + void iov_iter_restore(struct iov_iter *i, struct iov_iter_state *state) 1989 + { 1990 + if (WARN_ON_ONCE(!iov_iter_is_bvec(i) && !iter_is_iovec(i)) && 1991 + !iov_iter_is_kvec(i)) 1992 + return; 1993 + i->iov_offset = state->iov_offset; 1994 + i->count = state->count; 1995 + /* 1996 + * For the *vec iters, nr_segs + iov is constant - if we increment 1997 + * the vec, then we also decrement the nr_segs count. Hence we don't 1998 + * need to track both of these, just one is enough and we can deduct 1999 + * the other from that. ITER_KVEC and ITER_IOVEC are the same struct 2000 + * size, so we can just increment the iov pointer as they are unionzed. 2001 + * ITER_BVEC _may_ be the same size on some archs, but on others it is 2002 + * not. Be safe and handle it separately. 2003 + */ 2004 + BUILD_BUG_ON(sizeof(struct iovec) != sizeof(struct kvec)); 2005 + if (iov_iter_is_bvec(i)) 2006 + i->bvec -= state->nr_segs - i->nr_segs; 2007 + else 2008 + i->iov -= state->nr_segs - i->nr_segs; 2009 + i->nr_segs = state->nr_segs; 2010 + }
+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>
+43
lib/pci_iomap.c
··· 134 134 return pci_iomap_wc_range(dev, bar, 0, maxlen); 135 135 } 136 136 EXPORT_SYMBOL_GPL(pci_iomap_wc); 137 + 138 + /* 139 + * pci_iounmap() somewhat illogically comes from lib/iomap.c for the 140 + * CONFIG_GENERIC_IOMAP case, because that's the code that knows about 141 + * the different IOMAP ranges. 142 + * 143 + * But if the architecture does not use the generic iomap code, and if 144 + * it has _not_ defined it's own private pci_iounmap function, we define 145 + * it here. 146 + * 147 + * NOTE! This default implementation assumes that if the architecture 148 + * support ioport mapping (HAS_IOPORT_MAP), the ioport mapping will 149 + * be fixed to the range [ PCI_IOBASE, PCI_IOBASE+IO_SPACE_LIMIT [, 150 + * and does not need unmapping with 'ioport_unmap()'. 151 + * 152 + * If you have different rules for your architecture, you need to 153 + * implement your own pci_iounmap() that knows the rules for where 154 + * and how IO vs MEM get mapped. 155 + * 156 + * This code is odd, and the ARCH_HAS/ARCH_WANTS #define logic comes 157 + * from legacy <asm-generic/io.h> header file behavior. In particular, 158 + * it would seem to make sense to do the iounmap(p) for the non-IO-space 159 + * case here regardless, but that's not what the old header file code 160 + * did. Probably incorrectly, but this is meant to be bug-for-bug 161 + * compatible. 162 + */ 163 + #if defined(ARCH_WANTS_GENERIC_PCI_IOUNMAP) 164 + 165 + void pci_iounmap(struct pci_dev *dev, void __iomem *p) 166 + { 167 + #ifdef ARCH_HAS_GENERIC_IOPORT_MAP 168 + uintptr_t start = (uintptr_t) PCI_IOBASE; 169 + uintptr_t addr = (uintptr_t) p; 170 + 171 + if (addr >= start && addr < start + IO_SPACE_LIMIT) 172 + return; 173 + iounmap(p); 174 + #endif 175 + } 176 + EXPORT_SYMBOL(pci_iounmap); 177 + 178 + #endif /* ARCH_WANTS_GENERIC_PCI_IOUNMAP */ 179 + 137 180 #endif /* CONFIG_PCI */
-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)
+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
+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
··· 6925 6925 */ 6926 6926 void napi_enable(struct napi_struct *n) 6927 6927 { 6928 - BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state)); 6929 - smp_mb__before_atomic(); 6930 - clear_bit(NAPI_STATE_SCHED, &n->state); 6931 - clear_bit(NAPI_STATE_NPSVC, &n->state); 6932 - if (n->dev->threaded && n->thread) 6933 - set_bit(NAPI_STATE_THREADED, &n->state); 6928 + unsigned long val, new; 6929 + 6930 + do { 6931 + val = READ_ONCE(n->state); 6932 + BUG_ON(!test_bit(NAPI_STATE_SCHED, &val)); 6933 + 6934 + new = val & ~(NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC); 6935 + if (n->dev->threaded && n->thread) 6936 + new |= NAPIF_STATE_THREADED; 6937 + } while (cmpxchg(&n->state, val, new) != val); 6934 6938 } 6935 6939 EXPORT_SYMBOL(napi_enable); 6936 6940
+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, ··· 877 833 devlink_params_publish(ds->devlink); 878 834 879 835 if (!ds->slave_mii_bus && ds->ops->phy_read) { 880 - ds->slave_mii_bus = devm_mdiobus_alloc(ds->dev); 836 + ds->slave_mii_bus = mdiobus_alloc(); 881 837 if (!ds->slave_mii_bus) { 882 838 err = -ENOMEM; 883 839 goto teardown; ··· 887 843 888 844 err = mdiobus_register(ds->slave_mii_bus); 889 845 if (err < 0) 890 - goto teardown; 846 + goto free_slave_mii_bus; 891 847 } 892 848 893 849 ds->setup = true; 894 850 895 851 return 0; 896 852 853 + free_slave_mii_bus: 854 + if (ds->slave_mii_bus && ds->ops->phy_read) 855 + mdiobus_free(ds->slave_mii_bus); 897 856 teardown: 898 857 if (ds->ops->teardown) 899 858 ds->ops->teardown(ds); ··· 919 872 if (!ds->setup) 920 873 return; 921 874 922 - if (ds->slave_mii_bus && ds->ops->phy_read) 875 + if (ds->slave_mii_bus && ds->ops->phy_read) { 923 876 mdiobus_unregister(ds->slave_mii_bus); 877 + mdiobus_free(ds->slave_mii_bus); 878 + ds->slave_mii_bus = NULL; 879 + } 924 880 925 881 dsa_switch_unregister_notifier(ds); 926 882 ··· 983 933 list_for_each_entry(dp, &dst->ports, list) { 984 934 err = dsa_port_setup(dp); 985 935 if (err) { 986 - dsa_port_devlink_teardown(dp); 987 - dp->type = DSA_PORT_TYPE_UNUSED; 988 - err = dsa_port_devlink_setup(dp); 936 + err = dsa_port_reinit_as_unused(dp); 989 937 if (err) 990 938 goto teardown; 991 - continue; 992 939 } 993 940 } 994 941 ··· 1090 1043 teardown_master: 1091 1044 dsa_tree_teardown_master(dst); 1092 1045 teardown_switches: 1046 + dsa_tree_teardown_ports(dst); 1093 1047 dsa_tree_teardown_switches(dst); 1094 1048 teardown_cpu_ports: 1095 1049 dsa_tree_teardown_cpu_ports(dst); ··· 1605 1557 mutex_unlock(&dsa2_mutex); 1606 1558 } 1607 1559 EXPORT_SYMBOL_GPL(dsa_unregister_switch); 1560 + 1561 + /* If the DSA master chooses to unregister its net_device on .shutdown, DSA is 1562 + * blocking that operation from completion, due to the dev_hold taken inside 1563 + * netdev_upper_dev_link. Unlink the DSA slave interfaces from being uppers of 1564 + * the DSA master, so that the system can reboot successfully. 1565 + */ 1566 + void dsa_switch_shutdown(struct dsa_switch *ds) 1567 + { 1568 + struct net_device *master, *slave_dev; 1569 + LIST_HEAD(unregister_list); 1570 + struct dsa_port *dp; 1571 + 1572 + mutex_lock(&dsa2_mutex); 1573 + rtnl_lock(); 1574 + 1575 + list_for_each_entry(dp, &ds->dst->ports, list) { 1576 + if (dp->ds != ds) 1577 + continue; 1578 + 1579 + if (!dsa_port_is_user(dp)) 1580 + continue; 1581 + 1582 + master = dp->cpu_dp->master; 1583 + slave_dev = dp->slave; 1584 + 1585 + netdev_upper_dev_unlink(master, slave_dev); 1586 + /* Just unlinking ourselves as uppers of the master is not 1587 + * sufficient. When the master net device unregisters, that will 1588 + * also call dev_close, which we will catch as NETDEV_GOING_DOWN 1589 + * and trigger a dev_close on our own devices (dsa_slave_close). 1590 + * In turn, that will call dev_mc_unsync on the master's net 1591 + * device. If the master is also a DSA switch port, this will 1592 + * trigger dsa_slave_set_rx_mode which will call dev_mc_sync on 1593 + * its own master. Lockdep will complain about the fact that 1594 + * all cascaded masters have the same dsa_master_addr_list_lock_key, 1595 + * which it normally would not do if the cascaded masters would 1596 + * be in a proper upper/lower relationship, which we've just 1597 + * destroyed. 1598 + * To suppress the lockdep warnings, let's actually unregister 1599 + * the DSA slave interfaces too, to avoid the nonsensical 1600 + * multicast address list synchronization on shutdown. 1601 + */ 1602 + unregister_netdevice_queue(slave_dev, &unregister_list); 1603 + } 1604 + unregister_netdevice_many(&unregister_list); 1605 + 1606 + rtnl_unlock(); 1607 + mutex_unlock(&dsa2_mutex); 1608 + } 1609 + 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 -1
net/smc/smc_clc.c
··· 510 510 goto out_rel; 511 511 } 512 512 /* get address to which the internal TCP socket is bound */ 513 - kernel_getsockname(clcsock, (struct sockaddr *)&addrs); 513 + if (kernel_getsockname(clcsock, (struct sockaddr *)&addrs) < 0) 514 + goto out_rel; 514 515 /* analyze IP specific data of net_device belonging to TCP socket */ 515 516 addr6 = (struct sockaddr_in6 *)&addrs; 516 517 rcu_read_lock();
+2
net/smc/smc_core.c
··· 1468 1468 abort_work); 1469 1469 struct smc_sock *smc = container_of(conn, struct smc_sock, conn); 1470 1470 1471 + lock_sock(&smc->sk); 1471 1472 smc_conn_kill(conn, true); 1473 + release_sock(&smc->sk); 1472 1474 sock_put(&smc->sk); /* sock_hold done by schedulers of abort_work */ 1473 1475 } 1474 1476
+5
scripts/Makefile.clang
··· 29 29 else 30 30 CLANG_FLAGS += -fintegrated-as 31 31 endif 32 + # By default, clang only warns when it encounters an unknown warning flag or 33 + # certain optimization flags it knows it has not implemented. 34 + # Make it behave more like gcc by erroring when these flags are encountered 35 + # so they can be implemented or wrapped in cc-option. 32 36 CLANG_FLAGS += -Werror=unknown-warning-option 37 + CLANG_FLAGS += -Werror=ignored-optimization-argument 33 38 KBUILD_CFLAGS += $(CLANG_FLAGS) 34 39 KBUILD_AFLAGS += $(CLANG_FLAGS) 35 40 export CLANG_FLAGS
+1 -1
scripts/Makefile.modpost
··· 13 13 # Stage 2 is handled by this file and does the following 14 14 # 1) Find all modules listed in modules.order 15 15 # 2) modpost is then used to 16 - # 3) create one <module>.mod.c file pr. module 16 + # 3) create one <module>.mod.c file per module 17 17 # 4) create one Module.symvers file with CRC for all exported symbols 18 18 19 19 # Step 3 is used to place certain information in the module's ELF
+3 -8
scripts/checkkconfigsymbols.py
··· 34 34 REGEX_KCONFIG_DEF = re.compile(DEF) 35 35 REGEX_KCONFIG_EXPR = re.compile(EXPR) 36 36 REGEX_KCONFIG_STMT = re.compile(STMT) 37 - REGEX_KCONFIG_HELP = re.compile(r"^\s+help\s*$") 38 37 REGEX_FILTER_SYMBOLS = re.compile(r"[A-Za-z0-9]$") 39 38 REGEX_NUMERIC = re.compile(r"0[xX][0-9a-fA-F]+|[0-9]+") 40 39 REGEX_QUOTES = re.compile("(\"(.*?)\")") ··· 101 102 "continue.") 102 103 103 104 if args.commit: 105 + if args.commit.startswith('HEAD'): 106 + sys.exit("The --commit option can't use the HEAD ref") 107 + 104 108 args.find = False 105 109 106 110 if args.ignore: ··· 434 432 lines = [] 435 433 defined = [] 436 434 references = [] 437 - skip = False 438 435 439 436 if not os.path.exists(kfile): 440 437 return defined, references ··· 449 448 if REGEX_KCONFIG_DEF.match(line): 450 449 symbol_def = REGEX_KCONFIG_DEF.findall(line) 451 450 defined.append(symbol_def[0]) 452 - skip = False 453 - elif REGEX_KCONFIG_HELP.match(line): 454 - skip = True 455 - elif skip: 456 - # ignore content of help messages 457 - pass 458 451 elif REGEX_KCONFIG_STMT.match(line): 459 452 line = REGEX_QUOTES.sub("", line) 460 453 symbols = get_symbols_in_line(line)
+1
scripts/clang-tools/gen_compile_commands.py
··· 13 13 import os 14 14 import re 15 15 import subprocess 16 + import sys 16 17 17 18 _DEFAULT_OUTPUT = 'compile_commands.json' 18 19 _DEFAULT_LOG_LEVEL = 'WARNING'
+41 -23
tools/lib/perf/evsel.c
··· 43 43 free(evsel); 44 44 } 45 45 46 - #define FD(e, x, y) (*(int *) xyarray__entry(e->fd, x, y)) 46 + #define FD(e, x, y) ((int *) xyarray__entry(e->fd, x, y)) 47 47 #define MMAP(e, x, y) (e->mmap ? ((struct perf_mmap *) xyarray__entry(e->mmap, x, y)) : NULL) 48 48 49 49 int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads) ··· 54 54 int cpu, thread; 55 55 for (cpu = 0; cpu < ncpus; cpu++) { 56 56 for (thread = 0; thread < nthreads; thread++) { 57 - FD(evsel, cpu, thread) = -1; 57 + int *fd = FD(evsel, cpu, thread); 58 + 59 + if (fd) 60 + *fd = -1; 58 61 } 59 62 } 60 63 } ··· 83 80 static int get_group_fd(struct perf_evsel *evsel, int cpu, int thread, int *group_fd) 84 81 { 85 82 struct perf_evsel *leader = evsel->leader; 86 - int fd; 83 + int *fd; 87 84 88 85 if (evsel == leader) { 89 86 *group_fd = -1; ··· 98 95 return -ENOTCONN; 99 96 100 97 fd = FD(leader, cpu, thread); 101 - if (fd == -1) 98 + if (fd == NULL || *fd == -1) 102 99 return -EBADF; 103 100 104 - *group_fd = fd; 101 + *group_fd = *fd; 105 102 106 103 return 0; 107 104 } ··· 141 138 142 139 for (cpu = 0; cpu < cpus->nr; cpu++) { 143 140 for (thread = 0; thread < threads->nr; thread++) { 144 - int fd, group_fd; 141 + int fd, group_fd, *evsel_fd; 142 + 143 + evsel_fd = FD(evsel, cpu, thread); 144 + if (evsel_fd == NULL) 145 + return -EINVAL; 145 146 146 147 err = get_group_fd(evsel, cpu, thread, &group_fd); 147 148 if (err < 0) ··· 158 151 if (fd < 0) 159 152 return -errno; 160 153 161 - FD(evsel, cpu, thread) = fd; 154 + *evsel_fd = fd; 162 155 } 163 156 } 164 157 ··· 170 163 int thread; 171 164 172 165 for (thread = 0; thread < xyarray__max_y(evsel->fd); ++thread) { 173 - if (FD(evsel, cpu, thread) >= 0) 174 - close(FD(evsel, cpu, thread)); 175 - FD(evsel, cpu, thread) = -1; 166 + int *fd = FD(evsel, cpu, thread); 167 + 168 + if (fd && *fd >= 0) { 169 + close(*fd); 170 + *fd = -1; 171 + } 176 172 } 177 173 } 178 174 ··· 219 209 220 210 for (cpu = 0; cpu < xyarray__max_x(evsel->fd); cpu++) { 221 211 for (thread = 0; thread < xyarray__max_y(evsel->fd); thread++) { 222 - int fd = FD(evsel, cpu, thread); 223 - struct perf_mmap *map = MMAP(evsel, cpu, thread); 212 + int *fd = FD(evsel, cpu, thread); 224 213 225 - if (fd < 0) 214 + if (fd == NULL || *fd < 0) 226 215 continue; 227 216 228 - perf_mmap__munmap(map); 217 + perf_mmap__munmap(MMAP(evsel, cpu, thread)); 229 218 } 230 219 } 231 220 ··· 248 239 249 240 for (cpu = 0; cpu < xyarray__max_x(evsel->fd); cpu++) { 250 241 for (thread = 0; thread < xyarray__max_y(evsel->fd); thread++) { 251 - int fd = FD(evsel, cpu, thread); 252 - struct perf_mmap *map = MMAP(evsel, cpu, thread); 242 + int *fd = FD(evsel, cpu, thread); 243 + struct perf_mmap *map; 253 244 254 - if (fd < 0) 245 + if (fd == NULL || *fd < 0) 255 246 continue; 256 247 248 + map = MMAP(evsel, cpu, thread); 257 249 perf_mmap__init(map, NULL, false, NULL); 258 250 259 - ret = perf_mmap__mmap(map, &mp, fd, cpu); 251 + ret = perf_mmap__mmap(map, &mp, *fd, cpu); 260 252 if (ret) { 261 253 perf_evsel__munmap(evsel); 262 254 return ret; ··· 270 260 271 261 void *perf_evsel__mmap_base(struct perf_evsel *evsel, int cpu, int thread) 272 262 { 273 - if (FD(evsel, cpu, thread) < 0 || MMAP(evsel, cpu, thread) == NULL) 263 + int *fd = FD(evsel, cpu, thread); 264 + 265 + if (fd == NULL || *fd < 0 || MMAP(evsel, cpu, thread) == NULL) 274 266 return NULL; 275 267 276 268 return MMAP(evsel, cpu, thread)->base; ··· 307 295 struct perf_counts_values *count) 308 296 { 309 297 size_t size = perf_evsel__read_size(evsel); 298 + int *fd = FD(evsel, cpu, thread); 310 299 311 300 memset(count, 0, sizeof(*count)); 312 301 313 - if (FD(evsel, cpu, thread) < 0) 302 + if (fd == NULL || *fd < 0) 314 303 return -EINVAL; 315 304 316 305 if (MMAP(evsel, cpu, thread) && 317 306 !perf_mmap__read_self(MMAP(evsel, cpu, thread), count)) 318 307 return 0; 319 308 320 - if (readn(FD(evsel, cpu, thread), count->values, size) <= 0) 309 + if (readn(*fd, count->values, size) <= 0) 321 310 return -errno; 322 311 323 312 return 0; ··· 331 318 int thread; 332 319 333 320 for (thread = 0; thread < xyarray__max_y(evsel->fd); thread++) { 334 - int fd = FD(evsel, cpu, thread), 335 - err = ioctl(fd, ioc, arg); 321 + int err; 322 + int *fd = FD(evsel, cpu, thread); 323 + 324 + if (fd == NULL || *fd < 0) 325 + return -1; 326 + 327 + err = ioctl(*fd, ioc, arg); 336 328 337 329 if (err) 338 330 return err;
+13 -11
tools/perf/builtin-script.c
··· 368 368 return OUTPUT_TYPE_OTHER; 369 369 } 370 370 371 - static inline unsigned int attr_type(unsigned int type) 372 - { 373 - switch (type) { 374 - case OUTPUT_TYPE_SYNTH: 375 - return PERF_TYPE_SYNTH; 376 - default: 377 - return type; 378 - } 379 - } 380 - 381 371 static bool output_set_by_user(void) 382 372 { 383 373 int j; ··· 546 556 output[type].print_ip_opts |= EVSEL__PRINT_SRCLINE; 547 557 } 548 558 559 + static struct evsel *find_first_output_type(struct evlist *evlist, 560 + unsigned int type) 561 + { 562 + struct evsel *evsel; 563 + 564 + evlist__for_each_entry(evlist, evsel) { 565 + if (output_type(evsel->core.attr.type) == (int)type) 566 + return evsel; 567 + } 568 + return NULL; 569 + } 570 + 549 571 /* 550 572 * verify all user requested events exist and the samples 551 573 * have the expected data ··· 569 567 struct evsel *evsel; 570 568 571 569 for (j = 0; j < OUTPUT_TYPE_MAX; ++j) { 572 - evsel = perf_session__find_first_evtype(session, attr_type(j)); 570 + evsel = find_first_output_type(session->evlist, j); 573 571 574 572 /* 575 573 * even if fields is set to 0 (ie., show nothing) event must
+24 -9
tools/perf/ui/browser.c
··· 757 757 } 758 758 759 759 void ui_browser__mark_fused(struct ui_browser *browser, unsigned int column, 760 - unsigned int row, bool arrow_down) 760 + unsigned int row, int diff, bool arrow_down) 761 761 { 762 - unsigned int end_row; 762 + int end_row; 763 763 764 - if (row >= browser->top_idx) 765 - end_row = row - browser->top_idx; 766 - else 764 + if (diff <= 0) 767 765 return; 768 766 769 767 SLsmg_set_char_set(1); 770 768 771 769 if (arrow_down) { 770 + if (row + diff <= browser->top_idx) 771 + return; 772 + 773 + end_row = row + diff - browser->top_idx; 772 774 ui_browser__gotorc(browser, end_row, column - 1); 773 - SLsmg_write_char(SLSMG_ULCORN_CHAR); 774 - ui_browser__gotorc(browser, end_row, column); 775 - SLsmg_draw_hline(2); 776 - ui_browser__gotorc(browser, end_row + 1, column - 1); 777 775 SLsmg_write_char(SLSMG_LTEE_CHAR); 776 + 777 + while (--end_row >= 0 && end_row > (int)(row - browser->top_idx)) { 778 + ui_browser__gotorc(browser, end_row, column - 1); 779 + SLsmg_draw_vline(1); 780 + } 781 + 782 + end_row = (int)(row - browser->top_idx); 783 + if (end_row >= 0) { 784 + ui_browser__gotorc(browser, end_row, column - 1); 785 + SLsmg_write_char(SLSMG_ULCORN_CHAR); 786 + ui_browser__gotorc(browser, end_row, column); 787 + SLsmg_draw_hline(2); 788 + } 778 789 } else { 790 + if (row < browser->top_idx) 791 + return; 792 + 793 + end_row = row - browser->top_idx; 779 794 ui_browser__gotorc(browser, end_row, column - 1); 780 795 SLsmg_write_char(SLSMG_LTEE_CHAR); 781 796 ui_browser__gotorc(browser, end_row, column);
+1 -1
tools/perf/ui/browser.h
··· 51 51 void __ui_browser__line_arrow(struct ui_browser *browser, unsigned int column, 52 52 u64 start, u64 end); 53 53 void ui_browser__mark_fused(struct ui_browser *browser, unsigned int column, 54 - unsigned int row, bool arrow_down); 54 + unsigned int row, int diff, bool arrow_down); 55 55 void __ui_browser__show_title(struct ui_browser *browser, const char *title); 56 56 void ui_browser__show_title(struct ui_browser *browser, const char *title); 57 57 int ui_browser__show(struct ui_browser *browser, const char *title,
+17 -7
tools/perf/ui/browsers/annotate.c
··· 125 125 ab->selection = al; 126 126 } 127 127 128 - static bool is_fused(struct annotate_browser *ab, struct disasm_line *cursor) 128 + static int is_fused(struct annotate_browser *ab, struct disasm_line *cursor) 129 129 { 130 130 struct disasm_line *pos = list_prev_entry(cursor, al.node); 131 131 const char *name; 132 + int diff = 1; 133 + 134 + while (pos && pos->al.offset == -1) { 135 + pos = list_prev_entry(pos, al.node); 136 + if (!ab->opts->hide_src_code) 137 + diff++; 138 + } 132 139 133 140 if (!pos) 134 - return false; 141 + return 0; 135 142 136 143 if (ins__is_lock(&pos->ins)) 137 144 name = pos->ops.locked.ins.name; ··· 146 139 name = pos->ins.name; 147 140 148 141 if (!name || !cursor->ins.name) 149 - return false; 142 + return 0; 150 143 151 - return ins__is_fused(ab->arch, name, cursor->ins.name); 144 + if (ins__is_fused(ab->arch, name, cursor->ins.name)) 145 + return diff; 146 + return 0; 152 147 } 153 148 154 149 static void annotate_browser__draw_current_jump(struct ui_browser *browser) ··· 164 155 struct annotation *notes = symbol__annotation(sym); 165 156 u8 pcnt_width = annotation__pcnt_width(notes); 166 157 int width; 158 + int diff = 0; 167 159 168 160 /* PLT symbols contain external offsets */ 169 161 if (strstr(sym->name, "@plt")) ··· 215 205 pcnt_width + 2 + notes->widths.addr + width, 216 206 from, to); 217 207 218 - if (is_fused(ab, cursor)) { 208 + diff = is_fused(ab, cursor); 209 + if (diff > 0) { 219 210 ui_browser__mark_fused(browser, 220 211 pcnt_width + 3 + notes->widths.addr + width, 221 - from - 1, 222 - to > from); 212 + from - diff, diff, to > from); 223 213 } 224 214 } 225 215
+3
tools/perf/util/bpf-event.c
··· 24 24 struct btf * __weak btf__load_from_kernel_by_id(__u32 id) 25 25 { 26 26 struct btf *btf; 27 + #pragma GCC diagnostic push 28 + #pragma GCC diagnostic ignored "-Wdeprecated-declarations" 27 29 int err = btf__get_from_id(id, &btf); 30 + #pragma GCC diagnostic pop 28 31 29 32 return err ? ERR_PTR(err) : btf; 30 33 }
+1
tools/perf/util/machine.c
··· 2149 2149 2150 2150 al.filtered = 0; 2151 2151 al.sym = NULL; 2152 + al.srcline = NULL; 2152 2153 if (!cpumode) { 2153 2154 thread__find_cpumode_addr_location(thread, ip, &al); 2154 2155 } else {
+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 -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
+36 -1
tools/testing/selftests/powerpc/tm/tm-syscall-asm.S
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 - #include <ppc-asm.h> 2 + #include <basic_asm.h> 3 3 #include <asm/unistd.h> 4 4 5 5 .text ··· 25 25 blr 26 26 1: 27 27 li r3, -1 28 + blr 29 + 30 + 31 + .macro scv level 32 + .long (0x44000001 | (\level) << 5) 33 + .endm 34 + 35 + FUNC_START(getppid_scv_tm_active) 36 + PUSH_BASIC_STACK(0) 37 + tbegin. 38 + beq 1f 39 + li r0, __NR_getppid 40 + scv 0 41 + tend. 42 + POP_BASIC_STACK(0) 43 + blr 44 + 1: 45 + li r3, -1 46 + POP_BASIC_STACK(0) 47 + blr 48 + 49 + FUNC_START(getppid_scv_tm_suspended) 50 + PUSH_BASIC_STACK(0) 51 + tbegin. 52 + beq 1f 53 + li r0, __NR_getppid 54 + tsuspend. 55 + scv 0 56 + tresume. 57 + tend. 58 + POP_BASIC_STACK(0) 59 + blr 60 + 1: 61 + li r3, -1 62 + POP_BASIC_STACK(0) 28 63 blr
+29 -7
tools/testing/selftests/powerpc/tm/tm-syscall.c
··· 19 19 #include "utils.h" 20 20 #include "tm.h" 21 21 22 + #ifndef PPC_FEATURE2_SCV 23 + #define PPC_FEATURE2_SCV 0x00100000 /* scv syscall */ 24 + #endif 25 + 22 26 extern int getppid_tm_active(void); 23 27 extern int getppid_tm_suspended(void); 28 + extern int getppid_scv_tm_active(void); 29 + extern int getppid_scv_tm_suspended(void); 24 30 25 31 unsigned retries = 0; 26 32 27 33 #define TEST_DURATION 10 /* seconds */ 28 34 29 - pid_t getppid_tm(bool suspend) 35 + pid_t getppid_tm(bool scv, bool suspend) 30 36 { 31 37 int i; 32 38 pid_t pid; 33 39 34 40 for (i = 0; i < TM_RETRIES; i++) { 35 - if (suspend) 36 - pid = getppid_tm_suspended(); 37 - else 38 - pid = getppid_tm_active(); 41 + if (suspend) { 42 + if (scv) 43 + pid = getppid_scv_tm_suspended(); 44 + else 45 + pid = getppid_tm_suspended(); 46 + } else { 47 + if (scv) 48 + pid = getppid_scv_tm_active(); 49 + else 50 + pid = getppid_tm_active(); 51 + } 39 52 40 53 if (pid >= 0) 41 54 return pid; ··· 95 82 * Test a syscall within a suspended transaction and verify 96 83 * that it succeeds. 97 84 */ 98 - FAIL_IF(getppid_tm(true) == -1); /* Should succeed. */ 85 + FAIL_IF(getppid_tm(false, true) == -1); /* Should succeed. */ 99 86 100 87 /* 101 88 * Test a syscall within an active transaction and verify that 102 89 * it fails with the correct failure code. 103 90 */ 104 - FAIL_IF(getppid_tm(false) != -1); /* Should fail... */ 91 + FAIL_IF(getppid_tm(false, false) != -1); /* Should fail... */ 105 92 FAIL_IF(!failure_is_persistent()); /* ...persistently... */ 106 93 FAIL_IF(!failure_is_syscall()); /* ...with code syscall. */ 94 + 95 + /* Now do it all again with scv if it is available. */ 96 + if (have_hwcap2(PPC_FEATURE2_SCV)) { 97 + FAIL_IF(getppid_tm(true, true) == -1); /* Should succeed. */ 98 + FAIL_IF(getppid_tm(true, false) != -1); /* Should fail... */ 99 + FAIL_IF(!failure_is_persistent()); /* ...persistently... */ 100 + FAIL_IF(!failure_is_syscall()); /* ...with code syscall. */ 101 + } 102 + 107 103 gettimeofday(&now, 0); 108 104 } 109 105