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

Cross-merge networking fixes after downstream PR (net-6.14-rc6).

Conflicts:

tools/testing/selftests/drivers/net/ping.py
75cc19c8ff89 ("selftests: drv-net: add xdp cases for ping.py")
de94e8697405 ("selftests: drv-net: store addresses in dict indexed by ipver")
https://lore.kernel.org/netdev/20250311115758.17a1d414@canb.auug.org.au/

net/core/devmem.c
a70f891e0fa0 ("net: devmem: do not WARN conditionally after netdev_rx_queue_restart()")
1d22d3060b9b ("net: drop rtnl_lock for queue_mgmt operations")
https://lore.kernel.org/netdev/20250313114929.43744df1@canb.auug.org.au/

Adjacent changes:

tools/testing/selftests/net/Makefile
6f50175ccad4 ("selftests: Add IPv6 link-local address generation tests for GRE devices.")
2e5584e0f913 ("selftests/net: expand cmsg_ipv6.sh with ipv4")

drivers/net/ethernet/broadcom/bnxt/bnxt.c
661958552eda ("eth: bnxt: do not use BNXT_VNIC_NTUPLE unconditionally in queue restart logic")
fe96d717d38e ("bnxt_en: Extend queue stop/start for TX rings")

Signed-off-by: Paolo Abeni <pabeni@redhat.com>

+3545 -1364
+1
.mailmap
··· 691 691 Subhash Jadavani <subhashj@codeaurora.org> 692 692 Sudarshan Rajagopalan <quic_sudaraja@quicinc.com> <sudaraja@codeaurora.org> 693 693 Sudeep Holla <sudeep.holla@arm.com> Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com> 694 + Sumit Garg <sumit.garg@kernel.org> <sumit.garg@linaro.org> 694 695 Sumit Semwal <sumit.semwal@ti.com> 695 696 Surabhi Vishnoi <quic_svishnoi@quicinc.com> <svishnoi@codeaurora.org> 696 697 Sven Eckelmann <sven@narfation.org> <seckelmann@datto.com>
+1 -1
Documentation/admin-guide/README.rst
··· 176 176 values without prompting. 177 177 178 178 "make defconfig" Create a ./.config file by using the default 179 - symbol values from either arch/$ARCH/defconfig 179 + symbol values from either arch/$ARCH/configs/defconfig 180 180 or arch/$ARCH/configs/${PLATFORM}_defconfig, 181 181 depending on the architecture. 182 182
+11
Documentation/admin-guide/sysctl/kernel.rst
··· 212 212 This value defaults to 0. 213 213 214 214 215 + core_sort_vma 216 + ============= 217 + 218 + The default coredump writes VMAs in address order. By setting 219 + ``core_sort_vma`` to 1, VMAs will be written from smallest size 220 + to largest size. This is known to break at least elfutils, but 221 + can be handy when dealing with very large (and truncated) 222 + coredumps where the more useful debugging details are included 223 + in the smaller VMAs. 224 + 225 + 215 226 core_uses_pid 216 227 ============= 217 228
+1
Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml
··· 146 146 maxItems: 2 147 147 148 148 pwm-names: 149 + minItems: 1 149 150 items: 150 151 - const: convst1 151 152 - const: convst2
+3
Documentation/scheduler/sched-rt-group.rst
··· 102 102 * sched_rt_period_us takes values from 1 to INT_MAX. 103 103 * sched_rt_runtime_us takes values from -1 to sched_rt_period_us. 104 104 * A run time of -1 specifies runtime == period, ie. no limit. 105 + * sched_rt_runtime_us/sched_rt_period_us > 0.05 inorder to preserve 106 + bandwidth for fair dl_server. For accurate value check average of 107 + runtime/period in /sys/kernel/debug/sched/fair_server/cpuX/ 105 108 106 109 107 110 2.2 Default behaviour
+34 -18
MAINTAINERS
··· 124 124 F: include/net/iw_handler.h 125 125 F: include/net/wext.h 126 126 F: include/uapi/linux/nl80211.h 127 + N: include/uapi/linux/nl80211-.* 127 128 F: include/uapi/linux/wireless.h 128 129 F: net/wireless/ 129 130 ··· 515 514 ADM8211 WIRELESS DRIVER 516 515 L: linux-wireless@vger.kernel.org 517 516 S: Orphan 518 - F: drivers/net/wireless/admtek/adm8211.* 517 + F: drivers/net/wireless/admtek/ 519 518 520 519 ADP1050 HARDWARE MONITOR DRIVER 521 520 M: Radu Sabau <radu.sabau@analog.com> ··· 6208 6207 6209 6208 CW1200 WLAN driver 6210 6209 S: Orphan 6211 - F: drivers/net/wireless/st/cw1200/ 6210 + F: drivers/net/wireless/st/ 6212 6211 F: include/linux/platform_data/net-cw1200.h 6213 6212 6214 6213 CX18 VIDEO4LINUX DRIVER ··· 9444 9443 F: include/uapi/linux/fscrypt.h 9445 9444 9446 9445 FSI SUBSYSTEM 9447 - M: Jeremy Kerr <jk@ozlabs.org> 9448 - M: Joel Stanley <joel@jms.id.au> 9449 - R: Alistar Popple <alistair@popple.id.au> 9450 - R: Eddie James <eajames@linux.ibm.com> 9446 + M: Eddie James <eajames@linux.ibm.com> 9447 + R: Ninad Palsule <ninad@linux.ibm.com> 9451 9448 L: linux-fsi@lists.ozlabs.org 9452 9449 S: Supported 9453 9450 Q: http://patchwork.ozlabs.org/project/linux-fsi/list/ 9454 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/joel/fsi.git 9455 9451 F: drivers/fsi/ 9456 9452 F: include/linux/fsi*.h 9457 9453 F: include/trace/events/fsi*.h ··· 12874 12876 F: security/keys/trusted-keys/trusted_dcp.c 12875 12877 12876 12878 KEYS-TRUSTED-TEE 12877 - M: Sumit Garg <sumit.garg@linaro.org> 12879 + M: Sumit Garg <sumit.garg@kernel.org> 12878 12880 L: linux-integrity@vger.kernel.org 12879 12881 L: keyrings@vger.kernel.org 12880 12882 S: Supported ··· 13997 13999 L: libertas-dev@lists.infradead.org 13998 14000 S: Orphan 13999 14001 F: drivers/net/wireless/marvell/libertas/ 14002 + F: drivers/net/wireless/marvell/libertas_tf/ 14000 14003 14001 14004 MARVELL MACCHIATOBIN SUPPORT 14002 14005 M: Russell King <linux@armlinux.org.uk> ··· 15667 15668 M: Claudiu Beznea <claudiu.beznea@tuxon.dev> 15668 15669 L: linux-wireless@vger.kernel.org 15669 15670 S: Supported 15670 - F: drivers/net/wireless/microchip/wilc1000/ 15671 + F: drivers/net/wireless/microchip/ 15671 15672 15672 15673 MICROSEMI MIPS SOCS 15673 15674 M: Alexandre Belloni <alexandre.belloni@bootlin.com> ··· 16453 16454 T: git git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git 16454 16455 F: Documentation/devicetree/bindings/net/wireless/ 16455 16456 F: drivers/net/wireless/ 16457 + X: drivers/net/wireless/ath/ 16458 + X: drivers/net/wireless/broadcom/ 16459 + X: drivers/net/wireless/intel/ 16460 + X: drivers/net/wireless/intersil/ 16461 + X: drivers/net/wireless/marvell/ 16462 + X: drivers/net/wireless/mediatek/mt76/ 16463 + X: drivers/net/wireless/mediatek/mt7601u/ 16464 + X: drivers/net/wireless/microchip/ 16465 + X: drivers/net/wireless/purelifi/ 16466 + X: drivers/net/wireless/quantenna/ 16467 + X: drivers/net/wireless/ralink/ 16468 + X: drivers/net/wireless/realtek/ 16469 + X: drivers/net/wireless/rsi/ 16470 + X: drivers/net/wireless/silabs/ 16471 + X: drivers/net/wireless/st/ 16472 + X: drivers/net/wireless/ti/ 16473 + X: drivers/net/wireless/zydas/ 16456 16474 16457 16475 NETWORKING [DSA] 16458 16476 M: Andrew Lunn <andrew@lunn.ch> ··· 17693 17677 F: drivers/tee/optee/ 17694 17678 17695 17679 OP-TEE RANDOM NUMBER GENERATOR (RNG) DRIVER 17696 - M: Sumit Garg <sumit.garg@linaro.org> 17680 + M: Sumit Garg <sumit.garg@kernel.org> 17697 17681 L: op-tee@lists.trustedfirmware.org 17698 17682 S: Maintained 17699 17683 F: drivers/char/hw_random/optee-rng.c ··· 17854 17838 L: linux-wireless@vger.kernel.org 17855 17839 S: Maintained 17856 17840 W: https://wireless.wiki.kernel.org/en/users/Drivers/p54 17857 - F: drivers/net/wireless/intersil/p54/ 17841 + F: drivers/net/wireless/intersil/ 17858 17842 17859 17843 PACKET SOCKETS 17860 17844 M: Willem de Bruijn <willemdebruijn.kernel@gmail.com> ··· 19131 19115 M: Srinivasan Raju <srini.raju@purelifi.com> 19132 19116 L: linux-wireless@vger.kernel.org 19133 19117 S: Supported 19134 - F: drivers/net/wireless/purelifi/plfxlc/ 19118 + F: drivers/net/wireless/purelifi/ 19135 19119 19136 19120 PVRUSB2 VIDEO4LINUX DRIVER 19137 19121 M: Mike Isely <isely@pobox.com> ··· 19682 19666 R: Sergey Matyukevich <geomatsi@gmail.com> 19683 19667 L: linux-wireless@vger.kernel.org 19684 19668 S: Maintained 19685 - F: drivers/net/wireless/quantenna 19669 + F: drivers/net/wireless/quantenna/ 19686 19670 19687 19671 RADEON and AMDGPU DRM DRIVERS 19688 19672 M: Alex Deucher <alexander.deucher@amd.com> ··· 19762 19746 M: Stanislaw Gruszka <stf_xl@wp.pl> 19763 19747 L: linux-wireless@vger.kernel.org 19764 19748 S: Maintained 19765 - F: drivers/net/wireless/ralink/rt2x00/ 19749 + F: drivers/net/wireless/ralink/ 19766 19750 19767 19751 RAMDISK RAM BLOCK DEVICE DRIVER 19768 19752 M: Jens Axboe <axboe@kernel.dk> ··· 21110 21094 21111 21095 SAMSUNG SPI DRIVERS 21112 21096 M: Andi Shyti <andi.shyti@kernel.org> 21097 + R: Tudor Ambarus <tudor.ambarus@linaro.org> 21113 21098 L: linux-spi@vger.kernel.org 21114 21099 L: linux-samsung-soc@vger.kernel.org 21115 21100 S: Maintained ··· 21521 21504 21522 21505 SFC NETWORK DRIVER 21523 21506 M: Edward Cree <ecree.xilinx@gmail.com> 21524 - M: Martin Habets <habetsm.xilinx@gmail.com> 21525 21507 L: netdev@vger.kernel.org 21526 21508 L: linux-net-drivers@amd.com 21527 21509 S: Maintained ··· 21729 21713 M: Jérôme Pouiller <jerome.pouiller@silabs.com> 21730 21714 S: Supported 21731 21715 F: Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml 21732 - F: drivers/net/wireless/silabs/wfx/ 21716 + F: drivers/net/wireless/silabs/ 21733 21717 21734 21718 SILICON MOTION SM712 FRAME BUFFER DRIVER 21735 21719 M: Sudip Mukherjee <sudipm.mukherjee@gmail.com> ··· 23306 23290 23307 23291 TEE SUBSYSTEM 23308 23292 M: Jens Wiklander <jens.wiklander@linaro.org> 23309 - R: Sumit Garg <sumit.garg@linaro.org> 23293 + R: Sumit Garg <sumit.garg@kernel.org> 23310 23294 L: op-tee@lists.trustedfirmware.org 23311 23295 S: Maintained 23312 23296 F: Documentation/ABI/testing/sysfs-class-tee ··· 26229 26213 ZD1211RW WIRELESS DRIVER 26230 26214 L: linux-wireless@vger.kernel.org 26231 26215 S: Orphan 26232 - F: drivers/net/wireless/zydas/zd1211rw/ 26216 + F: drivers/net/wireless/zydas/ 26233 26217 26234 26218 ZD1301 MEDIA DRIVER 26235 26219 L: linux-media@vger.kernel.org
+6 -1
Makefile
··· 2 2 VERSION = 6 3 3 PATCHLEVEL = 14 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc5 5 + EXTRAVERSION = -rc6 6 6 NAME = Baby Opossum Posse 7 7 8 8 # *DOCUMENTATION* ··· 1122 1122 # Align the bit size of userspace programs with the kernel 1123 1123 KBUILD_USERCFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS)) 1124 1124 KBUILD_USERLDFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS)) 1125 + 1126 + # userspace programs are linked via the compiler, use the correct linker 1127 + ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_LD_IS_LLD),yy) 1128 + KBUILD_USERLDFLAGS += --ld-path=$(LD) 1129 + endif 1125 1130 1126 1131 # make the checker run with the right architecture 1127 1132 CHECKFLAGS += --arch=$(ARCH)
+25 -12
arch/arm/mm/fault-armv.c
··· 62 62 } 63 63 64 64 static int adjust_pte(struct vm_area_struct *vma, unsigned long address, 65 - unsigned long pfn, struct vm_fault *vmf) 65 + unsigned long pfn, bool need_lock) 66 66 { 67 67 spinlock_t *ptl; 68 68 pgd_t *pgd; ··· 99 99 if (!pte) 100 100 return 0; 101 101 102 - /* 103 - * If we are using split PTE locks, then we need to take the page 104 - * lock here. Otherwise we are using shared mm->page_table_lock 105 - * which is already locked, thus cannot take it. 106 - */ 107 - if (ptl != vmf->ptl) { 102 + if (need_lock) { 103 + /* 104 + * Use nested version here to indicate that we are already 105 + * holding one similar spinlock. 106 + */ 108 107 spin_lock_nested(ptl, SINGLE_DEPTH_NESTING); 109 108 if (unlikely(!pmd_same(pmdval, pmdp_get_lockless(pmd)))) { 110 109 pte_unmap_unlock(pte, ptl); ··· 113 114 114 115 ret = do_adjust_pte(vma, address, pfn, pte); 115 116 116 - if (ptl != vmf->ptl) 117 + if (need_lock) 117 118 spin_unlock(ptl); 118 119 pte_unmap(pte); 119 120 ··· 122 123 123 124 static void 124 125 make_coherent(struct address_space *mapping, struct vm_area_struct *vma, 125 - unsigned long addr, pte_t *ptep, unsigned long pfn, 126 - struct vm_fault *vmf) 126 + unsigned long addr, pte_t *ptep, unsigned long pfn) 127 127 { 128 + const unsigned long pmd_start_addr = ALIGN_DOWN(addr, PMD_SIZE); 129 + const unsigned long pmd_end_addr = pmd_start_addr + PMD_SIZE; 128 130 struct mm_struct *mm = vma->vm_mm; 129 131 struct vm_area_struct *mpnt; 130 132 unsigned long offset; ··· 142 142 flush_dcache_mmap_lock(mapping); 143 143 vma_interval_tree_foreach(mpnt, &mapping->i_mmap, pgoff, pgoff) { 144 144 /* 145 + * If we are using split PTE locks, then we need to take the pte 146 + * lock. Otherwise we are using shared mm->page_table_lock which 147 + * is already locked, thus cannot take it. 148 + */ 149 + bool need_lock = IS_ENABLED(CONFIG_SPLIT_PTE_PTLOCKS); 150 + unsigned long mpnt_addr; 151 + 152 + /* 145 153 * If this VMA is not in our MM, we can ignore it. 146 154 * Note that we intentionally mask out the VMA 147 155 * that we are fixing up. ··· 159 151 if (!(mpnt->vm_flags & VM_MAYSHARE)) 160 152 continue; 161 153 offset = (pgoff - mpnt->vm_pgoff) << PAGE_SHIFT; 162 - aliases += adjust_pte(mpnt, mpnt->vm_start + offset, pfn, vmf); 154 + mpnt_addr = mpnt->vm_start + offset; 155 + 156 + /* Avoid deadlocks by not grabbing the same PTE lock again. */ 157 + if (mpnt_addr >= pmd_start_addr && mpnt_addr < pmd_end_addr) 158 + need_lock = false; 159 + aliases += adjust_pte(mpnt, mpnt_addr, pfn, need_lock); 163 160 } 164 161 flush_dcache_mmap_unlock(mapping); 165 162 if (aliases) ··· 207 194 __flush_dcache_folio(mapping, folio); 208 195 if (mapping) { 209 196 if (cache_is_vivt()) 210 - make_coherent(mapping, vma, addr, ptep, pfn, vmf); 197 + make_coherent(mapping, vma, addr, ptep, pfn); 211 198 else if (vma->vm_flags & VM_EXEC) 212 199 __flush_icache_all(); 213 200 }
+26 -5
arch/arm64/include/asm/el2_setup.h
··· 16 16 #include <asm/sysreg.h> 17 17 #include <linux/irqchip/arm-gic-v3.h> 18 18 19 + .macro init_el2_hcr val 20 + mov_q x0, \val 21 + 22 + /* 23 + * Compliant CPUs advertise their VHE-onlyness with 24 + * ID_AA64MMFR4_EL1.E2H0 < 0. On such CPUs HCR_EL2.E2H is RES1, but it 25 + * can reset into an UNKNOWN state and might not read as 1 until it has 26 + * been initialized explicitly. 27 + * 28 + * Fruity CPUs seem to have HCR_EL2.E2H set to RAO/WI, but 29 + * don't advertise it (they predate this relaxation). 30 + * 31 + * Initalize HCR_EL2.E2H so that later code can rely upon HCR_EL2.E2H 32 + * indicating whether the CPU is running in E2H mode. 33 + */ 34 + mrs_s x1, SYS_ID_AA64MMFR4_EL1 35 + sbfx x1, x1, #ID_AA64MMFR4_EL1_E2H0_SHIFT, #ID_AA64MMFR4_EL1_E2H0_WIDTH 36 + cmp x1, #0 37 + b.ge .LnVHE_\@ 38 + 39 + orr x0, x0, #HCR_E2H 40 + .LnVHE_\@: 41 + msr hcr_el2, x0 42 + isb 43 + .endm 44 + 19 45 .macro __init_el2_sctlr 20 46 mov_q x0, INIT_SCTLR_EL2_MMU_OFF 21 47 msr sctlr_el2, x0 ··· 268 242 msr_s SYS_GCSCR_EL1, xzr 269 243 msr_s SYS_GCSCRE0_EL1, xzr 270 244 .Lskip_gcs_\@: 271 - .endm 272 - 273 - .macro __init_el2_nvhe_prepare_eret 274 - mov x0, #INIT_PSTATE_EL1 275 - msr spsr_el2, x0 276 245 .endm 277 246 278 247 .macro __init_el2_mpam
+3 -19
arch/arm64/kernel/head.S
··· 298 298 msr sctlr_el2, x0 299 299 isb 300 300 0: 301 - mov_q x0, HCR_HOST_NVHE_FLAGS 302 301 303 - /* 304 - * Compliant CPUs advertise their VHE-onlyness with 305 - * ID_AA64MMFR4_EL1.E2H0 < 0. HCR_EL2.E2H can be 306 - * RES1 in that case. Publish the E2H bit early so that 307 - * it can be picked up by the init_el2_state macro. 308 - * 309 - * Fruity CPUs seem to have HCR_EL2.E2H set to RAO/WI, but 310 - * don't advertise it (they predate this relaxation). 311 - */ 312 - mrs_s x1, SYS_ID_AA64MMFR4_EL1 313 - tbz x1, #(ID_AA64MMFR4_EL1_E2H0_SHIFT + ID_AA64MMFR4_EL1_E2H0_WIDTH - 1), 1f 314 - 315 - orr x0, x0, #HCR_E2H 316 - 1: 317 - msr hcr_el2, x0 318 - isb 319 - 302 + init_el2_hcr HCR_HOST_NVHE_FLAGS 320 303 init_el2_state 321 304 322 305 /* Hypervisor stub */ ··· 322 339 msr sctlr_el1, x1 323 340 mov x2, xzr 324 341 3: 325 - __init_el2_nvhe_prepare_eret 342 + mov x0, #INIT_PSTATE_EL1 343 + msr spsr_el2, x0 326 344 327 345 mov w0, #BOOT_CPU_MODE_EL2 328 346 orr x0, x0, x2
+7 -3
arch/arm64/kvm/hyp/nvhe/hyp-init.S
··· 73 73 eret 74 74 SYM_CODE_END(__kvm_hyp_init) 75 75 76 + /* 77 + * Initialize EL2 CPU state to sane values. 78 + * 79 + * HCR_EL2.E2H must have been initialized already. 80 + */ 76 81 SYM_CODE_START_LOCAL(__kvm_init_el2_state) 77 - /* Initialize EL2 CPU state to sane values. */ 78 82 init_el2_state // Clobbers x0..x2 79 83 finalise_el2_state 80 84 ret ··· 210 206 211 207 2: msr SPsel, #1 // We want to use SP_EL{1,2} 212 208 213 - bl __kvm_init_el2_state 209 + init_el2_hcr 0 214 210 215 - __init_el2_nvhe_prepare_eret 211 + bl __kvm_init_el2_state 216 212 217 213 /* Enable MMU, set vectors and stack. */ 218 214 mov x0, x28
+3
arch/arm64/kvm/hyp/nvhe/psci-relay.c
··· 218 218 if (is_cpu_on) 219 219 release_boot_args(boot_args); 220 220 221 + write_sysreg_el1(INIT_SCTLR_EL1_MMU_OFF, SYS_SCTLR); 222 + write_sysreg(INIT_PSTATE_EL1, SPSR_EL2); 223 + 221 224 __host_enter(host_ctxt); 222 225 } 223 226
-12
arch/loongarch/kernel/acpi.c
··· 249 249 return acpi_map_pxm_to_node(pxm); 250 250 } 251 251 252 - /* 253 - * Callback for SLIT parsing. pxm_to_node() returns NUMA_NO_NODE for 254 - * I/O localities since SRAT does not list them. I/O localities are 255 - * not supported at this point. 256 - */ 257 - unsigned int numa_distance_cnt; 258 - 259 - static inline unsigned int get_numa_distances_cnt(struct acpi_table_slit *slit) 260 - { 261 - return slit->locality_count; 262 - } 263 - 264 252 void __init numa_set_distance(int from, int to, int distance) 265 253 { 266 254 if ((u8)distance != distance || (from == to && distance != LOCAL_DISTANCE)) {
+2 -2
arch/loongarch/kernel/machine_kexec.c
··· 126 126 /* All secondary cpus go to kexec_smp_wait */ 127 127 if (smp_processor_id() > 0) { 128 128 relocated_kexec_smp_wait(NULL); 129 - unreachable(); 129 + BUG(); 130 130 } 131 131 #endif 132 132 133 133 do_kexec = (void *)reboot_code_buffer; 134 134 do_kexec(efi_boot, cmdline_ptr, systable_ptr, start_addr, first_ind_entry); 135 135 136 - unreachable(); 136 + BUG(); 137 137 } 138 138 139 139
+3
arch/loongarch/kernel/setup.c
··· 387 387 */ 388 388 static void __init arch_mem_init(char **cmdline_p) 389 389 { 390 + /* Recalculate max_low_pfn for "mem=xxx" */ 391 + max_pfn = max_low_pfn = PHYS_PFN(memblock_end_of_DRAM()); 392 + 390 393 if (usermem) 391 394 pr_info("User-defined physical RAM map overwrite\n"); 392 395
+46 -1
arch/loongarch/kernel/smp.c
··· 19 19 #include <linux/smp.h> 20 20 #include <linux/threads.h> 21 21 #include <linux/export.h> 22 + #include <linux/suspend.h> 22 23 #include <linux/syscore_ops.h> 23 24 #include <linux/time.h> 24 25 #include <linux/tracepoint.h> ··· 424 423 mb(); 425 424 } 426 425 427 - void __noreturn arch_cpu_idle_dead(void) 426 + static void __noreturn idle_play_dead(void) 428 427 { 429 428 register uint64_t addr; 430 429 register void (*init_fn)(void); ··· 447 446 init_fn(); 448 447 BUG(); 449 448 } 449 + 450 + #ifdef CONFIG_HIBERNATION 451 + static void __noreturn poll_play_dead(void) 452 + { 453 + register uint64_t addr; 454 + register void (*init_fn)(void); 455 + 456 + idle_task_exit(); 457 + __this_cpu_write(cpu_state, CPU_DEAD); 458 + 459 + __smp_mb(); 460 + do { 461 + __asm__ __volatile__("nop\n\t"); 462 + addr = iocsr_read64(LOONGARCH_IOCSR_MBUF0); 463 + } while (addr == 0); 464 + 465 + init_fn = (void *)TO_CACHE(addr); 466 + iocsr_write32(0xffffffff, LOONGARCH_IOCSR_IPI_CLEAR); 467 + 468 + init_fn(); 469 + BUG(); 470 + } 471 + #endif 472 + 473 + static void (*play_dead)(void) = idle_play_dead; 474 + 475 + void __noreturn arch_cpu_idle_dead(void) 476 + { 477 + play_dead(); 478 + BUG(); /* play_dead() doesn't return */ 479 + } 480 + 481 + #ifdef CONFIG_HIBERNATION 482 + int hibernate_resume_nonboot_cpu_disable(void) 483 + { 484 + int ret; 485 + 486 + play_dead = poll_play_dead; 487 + ret = suspend_disable_secondary_cpus(); 488 + play_dead = idle_play_dead; 489 + 490 + return ret; 491 + } 492 + #endif 450 493 451 494 #endif 452 495
+6
arch/loongarch/kvm/exit.c
··· 669 669 struct kvm_run *run = vcpu->run; 670 670 unsigned long badv = vcpu->arch.badv; 671 671 672 + /* Inject ADE exception if exceed max GPA size */ 673 + if (unlikely(badv >= vcpu->kvm->arch.gpa_size)) { 674 + kvm_queue_exception(vcpu, EXCCODE_ADE, EXSUBCODE_ADEM); 675 + return RESUME_GUEST; 676 + } 677 + 672 678 ret = kvm_handle_mm_fault(vcpu, badv, write); 673 679 if (ret) { 674 680 /* Treat as MMIO */
+7
arch/loongarch/kvm/main.c
··· 317 317 kvm_debug("GCFG:%lx GSTAT:%lx GINTC:%lx GTLBC:%lx", 318 318 read_csr_gcfg(), read_csr_gstat(), read_csr_gintc(), read_csr_gtlbc()); 319 319 320 + /* 321 + * HW Guest CSR registers are lost after CPU suspend and resume. 322 + * Clear last_vcpu so that Guest CSR registers forced to reload 323 + * from vCPU SW state. 324 + */ 325 + this_cpu_ptr(vmcs)->last_vcpu = NULL; 326 + 320 327 return 0; 321 328 } 322 329
+1 -1
arch/loongarch/kvm/vcpu.c
··· 311 311 { 312 312 int ret = RESUME_GUEST; 313 313 unsigned long estat = vcpu->arch.host_estat; 314 - u32 intr = estat & 0x1fff; /* Ignore NMI */ 314 + u32 intr = estat & CSR_ESTAT_IS; 315 315 u32 ecode = (estat & CSR_ESTAT_EXC) >> CSR_ESTAT_EXC_SHIFT; 316 316 317 317 vcpu->mode = OUTSIDE_GUEST_MODE;
+5 -1
arch/loongarch/kvm/vm.c
··· 48 48 if (kvm_pvtime_supported()) 49 49 kvm->arch.pv_features |= BIT(KVM_FEATURE_STEAL_TIME); 50 50 51 - kvm->arch.gpa_size = BIT(cpu_vabits - 1); 51 + /* 52 + * cpu_vabits means user address space only (a half of total). 53 + * GPA size of VM is the same with the size of user address space. 54 + */ 55 + kvm->arch.gpa_size = BIT(cpu_vabits); 52 56 kvm->arch.root_level = CONFIG_PGTABLE_LEVELS - 1; 53 57 kvm->arch.invalid_ptes[0] = 0; 54 58 kvm->arch.invalid_ptes[1] = (unsigned long)invalid_pte_table;
+5 -1
arch/loongarch/mm/mmap.c
··· 3 3 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited 4 4 */ 5 5 #include <linux/export.h> 6 + #include <linux/hugetlb.h> 6 7 #include <linux/io.h> 7 8 #include <linux/kfence.h> 8 9 #include <linux/memblock.h> ··· 64 63 } 65 64 66 65 info.length = len; 67 - info.align_mask = do_color_align ? (PAGE_MASK & SHM_ALIGN_MASK) : 0; 68 66 info.align_offset = pgoff << PAGE_SHIFT; 67 + if (filp && is_file_hugepages(filp)) 68 + info.align_mask = huge_page_mask_align(filp); 69 + else 70 + info.align_mask = do_color_align ? (PAGE_MASK & SHM_ALIGN_MASK) : 0; 69 71 70 72 if (dir == DOWN) { 71 73 info.flags = VM_UNMAPPED_AREA_TOPDOWN;
+4 -2
arch/m68k/include/asm/sun3_pgalloc.h
··· 44 44 pgd_t *new_pgd; 45 45 46 46 new_pgd = __pgd_alloc(mm, 0); 47 - memcpy(new_pgd, swapper_pg_dir, PAGE_SIZE); 48 - memset(new_pgd, 0, (PAGE_OFFSET >> PGDIR_SHIFT)); 47 + if (likely(new_pgd != NULL)) { 48 + memcpy(new_pgd, swapper_pg_dir, PAGE_SIZE); 49 + memset(new_pgd, 0, (PAGE_OFFSET >> PGDIR_SHIFT)); 50 + } 49 51 return new_pgd; 50 52 } 51 53
+1
arch/riscv/Kconfig.socs
··· 26 26 27 27 config ARCH_SPACEMIT 28 28 bool "SpacemiT SoCs" 29 + select PINCTRL 29 30 help 30 31 This enables support for SpacemiT SoC platform hardware. 31 32
+2 -1
arch/s390/kernel/ftrace.c
··· 266 266 struct ftrace_ops *op, struct ftrace_regs *fregs) 267 267 { 268 268 unsigned long *parent = &arch_ftrace_regs(fregs)->regs.gprs[14]; 269 + unsigned long sp = arch_ftrace_regs(fregs)->regs.gprs[15]; 269 270 270 271 if (unlikely(ftrace_graph_is_dead())) 271 272 return; 272 273 if (unlikely(atomic_read(&current->tracing_graph_pause))) 273 274 return; 274 - if (!function_graph_enter_regs(*parent, ip, 0, parent, fregs)) 275 + if (!function_graph_enter_regs(*parent, ip, 0, (unsigned long *)sp, fregs)) 275 276 *parent = (unsigned long)&return_to_handler; 276 277 } 277 278
+3 -3
arch/s390/kernel/traps.c
··· 285 285 return; 286 286 asm volatile( 287 287 " mc 0,0\n" 288 - "0: xgr %0,%0\n" 288 + "0: lhi %[val],0\n" 289 289 "1:\n" 290 - EX_TABLE(0b,1b) 291 - : "+d" (val)); 290 + EX_TABLE(0b, 1b) 291 + : [val] "+d" (val)); 292 292 if (!val) 293 293 panic("Monitor call doesn't work!\n"); 294 294 }
+2
arch/x86/boot/compressed/pgtable_64.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include "misc.h" 3 3 #include <asm/bootparam.h> 4 + #include <asm/bootparam_utils.h> 4 5 #include <asm/e820/types.h> 5 6 #include <asm/processor.h> 6 7 #include "pgtable.h" ··· 108 107 bool l5_required = false; 109 108 110 109 /* Initialize boot_params. Required for cmdline_find_option_bool(). */ 110 + sanitize_boot_params(bp); 111 111 boot_params_ptr = bp; 112 112 113 113 /*
+8 -15
arch/x86/coco/sev/core.c
··· 2853 2853 if (!mdesc->response) 2854 2854 goto e_free_request; 2855 2855 2856 - mdesc->certs_data = alloc_shared_pages(SEV_FW_BLOB_MAX_SIZE); 2857 - if (!mdesc->certs_data) 2858 - goto e_free_response; 2859 - 2860 - /* initial the input address for guest request */ 2861 - mdesc->input.req_gpa = __pa(mdesc->request); 2862 - mdesc->input.resp_gpa = __pa(mdesc->response); 2863 - mdesc->input.data_gpa = __pa(mdesc->certs_data); 2864 - 2865 2856 return mdesc; 2866 2857 2867 - e_free_response: 2868 - free_shared_pages(mdesc->response, sizeof(struct snp_guest_msg)); 2869 2858 e_free_request: 2870 2859 free_shared_pages(mdesc->request, sizeof(struct snp_guest_msg)); 2871 2860 e_unmap: ··· 2874 2885 kfree(mdesc->ctx); 2875 2886 free_shared_pages(mdesc->response, sizeof(struct snp_guest_msg)); 2876 2887 free_shared_pages(mdesc->request, sizeof(struct snp_guest_msg)); 2877 - free_shared_pages(mdesc->certs_data, SEV_FW_BLOB_MAX_SIZE); 2878 2888 iounmap((__force void __iomem *)mdesc->secrets); 2879 2889 2880 2890 memset(mdesc, 0, sizeof(*mdesc)); ··· 3042 3054 * sequence number must be incremented or the VMPCK must be deleted to 3043 3055 * prevent reuse of the IV. 3044 3056 */ 3045 - rc = snp_issue_guest_request(req, &mdesc->input, rio); 3057 + rc = snp_issue_guest_request(req, &req->input, rio); 3046 3058 switch (rc) { 3047 3059 case -ENOSPC: 3048 3060 /* ··· 3052 3064 * order to increment the sequence number and thus avoid 3053 3065 * IV reuse. 3054 3066 */ 3055 - override_npages = mdesc->input.data_npages; 3067 + override_npages = req->input.data_npages; 3056 3068 req->exit_code = SVM_VMGEXIT_GUEST_REQUEST; 3057 3069 3058 3070 /* ··· 3108 3120 } 3109 3121 3110 3122 if (override_npages) 3111 - mdesc->input.data_npages = override_npages; 3123 + req->input.data_npages = override_npages; 3112 3124 3113 3125 return rc; 3114 3126 } ··· 3145 3157 * request page. 3146 3158 */ 3147 3159 memcpy(mdesc->request, &mdesc->secret_request, sizeof(mdesc->secret_request)); 3160 + 3161 + /* Initialize the input address for guest request */ 3162 + req->input.req_gpa = __pa(mdesc->request); 3163 + req->input.resp_gpa = __pa(mdesc->response); 3164 + req->input.data_gpa = req->certs_data ? __pa(req->certs_data) : 0; 3148 3165 3149 3166 rc = __handle_guest_request(mdesc, req, rio); 3150 3167 if (rc) {
+1
arch/x86/hyperv/hv_vtl.c
··· 30 30 x86_platform.realmode_init = x86_init_noop; 31 31 x86_init.irqs.pre_vector_init = x86_init_noop; 32 32 x86_init.timers.timer_init = x86_init_noop; 33 + x86_init.resources.probe_roms = x86_init_noop; 33 34 34 35 /* Avoid searching for BIOS MP tables */ 35 36 x86_init.mpparse.find_mptable = x86_init_noop;
+1 -2
arch/x86/hyperv/ivm.c
··· 464 464 enum hv_mem_host_visibility visibility) 465 465 { 466 466 struct hv_gpa_range_for_visibility *input; 467 - u16 pages_processed; 468 467 u64 hv_status; 469 468 unsigned long flags; 470 469 ··· 492 493 memcpy((void *)input->gpa_page_list, pfn, count * sizeof(*pfn)); 493 494 hv_status = hv_do_rep_hypercall( 494 495 HVCALL_MODIFY_SPARSE_GPA_PAGE_HOST_VISIBILITY, count, 495 - 0, input, &pages_processed); 496 + 0, input, NULL); 496 497 local_irq_restore(flags); 497 498 498 499 if (hv_result_success(hv_status))
+1
arch/x86/include/asm/kvm_host.h
··· 780 780 u32 pkru; 781 781 u32 hflags; 782 782 u64 efer; 783 + u64 host_debugctl; 783 784 u64 apic_base; 784 785 struct kvm_lapic *apic; /* kernel irqchip context */ 785 786 bool load_eoi_exitmap_pending;
+19 -13
arch/x86/include/asm/nospec-branch.h
··· 198 198 .endm 199 199 200 200 /* 201 - * Equivalent to -mindirect-branch-cs-prefix; emit the 5 byte jmp/call 202 - * to the retpoline thunk with a CS prefix when the register requires 203 - * a RAX prefix byte to encode. Also see apply_retpolines(). 201 + * Emits a conditional CS prefix that is compatible with 202 + * -mindirect-branch-cs-prefix. 204 203 */ 205 204 .macro __CS_PREFIX reg:req 206 205 .irp rs,r8,r9,r10,r11,r12,r13,r14,r15 ··· 420 421 #ifdef CONFIG_X86_64 421 422 422 423 /* 424 + * Emits a conditional CS prefix that is compatible with 425 + * -mindirect-branch-cs-prefix. 426 + */ 427 + #define __CS_PREFIX(reg) \ 428 + ".irp rs,r8,r9,r10,r11,r12,r13,r14,r15\n" \ 429 + ".ifc \\rs," reg "\n" \ 430 + ".byte 0x2e\n" \ 431 + ".endif\n" \ 432 + ".endr\n" 433 + 434 + /* 423 435 * Inline asm uses the %V modifier which is only in newer GCC 424 436 * which is ensured when CONFIG_MITIGATION_RETPOLINE is defined. 425 437 */ 426 - # define CALL_NOSPEC \ 427 - ALTERNATIVE_2( \ 428 - ANNOTATE_RETPOLINE_SAFE \ 429 - "call *%[thunk_target]\n", \ 430 - "call __x86_indirect_thunk_%V[thunk_target]\n", \ 431 - X86_FEATURE_RETPOLINE, \ 432 - "lfence;\n" \ 433 - ANNOTATE_RETPOLINE_SAFE \ 434 - "call *%[thunk_target]\n", \ 435 - X86_FEATURE_RETPOLINE_LFENCE) 438 + #ifdef CONFIG_MITIGATION_RETPOLINE 439 + #define CALL_NOSPEC __CS_PREFIX("%V[thunk_target]") \ 440 + "call __x86_indirect_thunk_%V[thunk_target]\n" 441 + #else 442 + #define CALL_NOSPEC "call *%[thunk_target]\n" 443 + #endif 436 444 437 445 # define THUNK_TARGET(addr) [thunk_target] "r" (addr) 438 446
+4 -4
arch/x86/include/asm/pgtable-2level_types.h
··· 23 23 #define ARCH_PAGE_TABLE_SYNC_MASK PGTBL_PMD_MODIFIED 24 24 25 25 /* 26 - * traditional i386 two-level paging structure: 26 + * Traditional i386 two-level paging structure: 27 27 */ 28 28 29 29 #define PGDIR_SHIFT 22 30 30 #define PTRS_PER_PGD 1024 31 31 32 - 33 32 /* 34 - * the i386 is two-level, so we don't really have any 35 - * PMD directory physically. 33 + * The i386 is two-level, so we don't really have any 34 + * PMD directory physically: 36 35 */ 36 + #define PTRS_PER_PMD 1 37 37 38 38 #define PTRS_PER_PTE 1024 39 39
+3 -3
arch/x86/include/asm/sev.h
··· 203 203 unsigned int vmpck_id; 204 204 u8 msg_version; 205 205 u8 msg_type; 206 + 207 + struct snp_req_data input; 208 + void *certs_data; 206 209 }; 207 210 208 211 /* ··· 266 263 struct snp_guest_msg secret_request, secret_response; 267 264 268 265 struct snp_secrets_page *secrets; 269 - struct snp_req_data input; 270 - 271 - void *certs_data; 272 266 273 267 struct aesgcm_ctx *ctx; 274 268
+3 -6
arch/x86/kernel/amd_nb.c
··· 143 143 144 144 struct resource *amd_get_mmconfig_range(struct resource *res) 145 145 { 146 - u32 address; 147 146 u64 base, msr; 148 147 unsigned int segn_busn_bits; 149 148 ··· 150 151 boot_cpu_data.x86_vendor != X86_VENDOR_HYGON) 151 152 return NULL; 152 153 153 - /* assume all cpus from fam10h have mmconfig */ 154 - if (boot_cpu_data.x86 < 0x10) 154 + /* Assume CPUs from Fam10h have mmconfig, although not all VMs do */ 155 + if (boot_cpu_data.x86 < 0x10 || 156 + rdmsrl_safe(MSR_FAM10H_MMIO_CONF_BASE, &msr)) 155 157 return NULL; 156 - 157 - address = MSR_FAM10H_MMIO_CONF_BASE; 158 - rdmsrl(address, msr); 159 158 160 159 /* mmconfig is not enabled */ 161 160 if (!(msr & FAM10H_MMIO_CONF_ENABLE))
+1 -1
arch/x86/kernel/cpu/cacheinfo.c
··· 808 808 cpuid(2, &regs[0], &regs[1], &regs[2], &regs[3]); 809 809 810 810 /* If bit 31 is set, this is an unknown format */ 811 - for (j = 0 ; j < 3 ; j++) 811 + for (j = 0 ; j < 4 ; j++) 812 812 if (regs[j] & (1 << 31)) 813 813 regs[j] = 0; 814 814
+35 -17
arch/x86/kernel/cpu/intel.c
··· 635 635 } 636 636 #endif 637 637 638 - #define TLB_INST_4K 0x01 639 - #define TLB_INST_4M 0x02 640 - #define TLB_INST_2M_4M 0x03 638 + #define TLB_INST_4K 0x01 639 + #define TLB_INST_4M 0x02 640 + #define TLB_INST_2M_4M 0x03 641 641 642 - #define TLB_INST_ALL 0x05 643 - #define TLB_INST_1G 0x06 642 + #define TLB_INST_ALL 0x05 643 + #define TLB_INST_1G 0x06 644 644 645 - #define TLB_DATA_4K 0x11 646 - #define TLB_DATA_4M 0x12 647 - #define TLB_DATA_2M_4M 0x13 648 - #define TLB_DATA_4K_4M 0x14 645 + #define TLB_DATA_4K 0x11 646 + #define TLB_DATA_4M 0x12 647 + #define TLB_DATA_2M_4M 0x13 648 + #define TLB_DATA_4K_4M 0x14 649 649 650 - #define TLB_DATA_1G 0x16 650 + #define TLB_DATA_1G 0x16 651 + #define TLB_DATA_1G_2M_4M 0x17 651 652 652 - #define TLB_DATA0_4K 0x21 653 - #define TLB_DATA0_4M 0x22 654 - #define TLB_DATA0_2M_4M 0x23 653 + #define TLB_DATA0_4K 0x21 654 + #define TLB_DATA0_4M 0x22 655 + #define TLB_DATA0_2M_4M 0x23 655 656 656 - #define STLB_4K 0x41 657 - #define STLB_4K_2M 0x42 657 + #define STLB_4K 0x41 658 + #define STLB_4K_2M 0x42 659 + 660 + /* 661 + * All of leaf 0x2's one-byte TLB descriptors implies the same number of 662 + * entries for their respective TLB types. The 0x63 descriptor is an 663 + * exception: it implies 4 dTLB entries for 1GB pages 32 dTLB entries 664 + * for 2MB or 4MB pages. Encode descriptor 0x63 dTLB entry count for 665 + * 2MB/4MB pages here, as its count for dTLB 1GB pages is already at the 666 + * intel_tlb_table[] mapping. 667 + */ 668 + #define TLB_0x63_2M_4M_ENTRIES 32 658 669 659 670 static const struct _tlb_table intel_tlb_table[] = { 660 671 { 0x01, TLB_INST_4K, 32, " TLB_INST 4 KByte pages, 4-way set associative" }, ··· 687 676 { 0x5c, TLB_DATA_4K_4M, 128, " TLB_DATA 4 KByte and 4 MByte pages" }, 688 677 { 0x5d, TLB_DATA_4K_4M, 256, " TLB_DATA 4 KByte and 4 MByte pages" }, 689 678 { 0x61, TLB_INST_4K, 48, " TLB_INST 4 KByte pages, full associative" }, 690 - { 0x63, TLB_DATA_1G, 4, " TLB_DATA 1 GByte pages, 4-way set associative" }, 679 + { 0x63, TLB_DATA_1G_2M_4M, 4, " TLB_DATA 1 GByte pages, 4-way set associative" 680 + " (plus 32 entries TLB_DATA 2 MByte or 4 MByte pages, not encoded here)" }, 691 681 { 0x6b, TLB_DATA_4K, 256, " TLB_DATA 4 KByte pages, 8-way associative" }, 692 682 { 0x6c, TLB_DATA_2M_4M, 128, " TLB_DATA 2 MByte or 4 MByte pages, 8-way associative" }, 693 683 { 0x6d, TLB_DATA_1G, 16, " TLB_DATA 1 GByte pages, fully associative" }, ··· 788 776 if (tlb_lld_4m[ENTRIES] < intel_tlb_table[k].entries) 789 777 tlb_lld_4m[ENTRIES] = intel_tlb_table[k].entries; 790 778 break; 779 + case TLB_DATA_1G_2M_4M: 780 + if (tlb_lld_2m[ENTRIES] < TLB_0x63_2M_4M_ENTRIES) 781 + tlb_lld_2m[ENTRIES] = TLB_0x63_2M_4M_ENTRIES; 782 + if (tlb_lld_4m[ENTRIES] < TLB_0x63_2M_4M_ENTRIES) 783 + tlb_lld_4m[ENTRIES] = TLB_0x63_2M_4M_ENTRIES; 784 + fallthrough; 791 785 case TLB_DATA_1G: 792 786 if (tlb_lld_1g[ENTRIES] < intel_tlb_table[k].entries) 793 787 tlb_lld_1g[ENTRIES] = intel_tlb_table[k].entries; ··· 817 799 cpuid(2, &regs[0], &regs[1], &regs[2], &regs[3]); 818 800 819 801 /* If bit 31 is set, this is an unknown format */ 820 - for (j = 0 ; j < 3 ; j++) 802 + for (j = 0 ; j < 4 ; j++) 821 803 if (regs[j] & (1 << 31)) 822 804 regs[j] = 0; 823 805
+7 -1
arch/x86/kernel/cpu/microcode/amd.c
··· 175 175 { 176 176 switch (cur_rev >> 8) { 177 177 case 0x80012: return cur_rev <= 0x800126f; break; 178 + case 0x80082: return cur_rev <= 0x800820f; break; 178 179 case 0x83010: return cur_rev <= 0x830107c; break; 179 180 case 0x86001: return cur_rev <= 0x860010e; break; 180 181 case 0x86081: return cur_rev <= 0x8608108; break; 181 182 case 0x87010: return cur_rev <= 0x8701034; break; 182 183 case 0x8a000: return cur_rev <= 0x8a0000a; break; 184 + case 0xa0010: return cur_rev <= 0xa00107a; break; 183 185 case 0xa0011: return cur_rev <= 0xa0011da; break; 184 186 case 0xa0012: return cur_rev <= 0xa001243; break; 187 + case 0xa0082: return cur_rev <= 0xa00820e; break; 185 188 case 0xa1011: return cur_rev <= 0xa101153; break; 186 189 case 0xa1012: return cur_rev <= 0xa10124e; break; 187 190 case 0xa1081: return cur_rev <= 0xa108109; break; 188 191 case 0xa2010: return cur_rev <= 0xa20102f; break; 189 192 case 0xa2012: return cur_rev <= 0xa201212; break; 193 + case 0xa4041: return cur_rev <= 0xa404109; break; 194 + case 0xa5000: return cur_rev <= 0xa500013; break; 190 195 case 0xa6012: return cur_rev <= 0xa60120a; break; 191 196 case 0xa7041: return cur_rev <= 0xa704109; break; 192 197 case 0xa7052: return cur_rev <= 0xa705208; break; 193 198 case 0xa7080: return cur_rev <= 0xa708009; break; 194 199 case 0xa70c0: return cur_rev <= 0xa70C009; break; 200 + case 0xaa001: return cur_rev <= 0xaa00116; break; 195 201 case 0xaa002: return cur_rev <= 0xaa00218; break; 196 202 default: break; 197 203 } ··· 1074 1068 if (ret != UCODE_OK) 1075 1069 return ret; 1076 1070 1077 - for_each_node(nid) { 1071 + for_each_node_with_cpus(nid) { 1078 1072 cpu = cpumask_first(cpumask_of_node(nid)); 1079 1073 c = &cpu_data(cpu); 1080 1074
+7 -3
arch/x86/kernel/cpu/sgx/driver.c
··· 150 150 u64 xfrm_mask; 151 151 int ret; 152 152 153 - if (!cpu_feature_enabled(X86_FEATURE_SGX_LC)) 153 + if (!cpu_feature_enabled(X86_FEATURE_SGX_LC)) { 154 + pr_info("SGX disabled: SGX launch control CPU feature is not available, /dev/sgx_enclave disabled.\n"); 154 155 return -ENODEV; 156 + } 155 157 156 158 cpuid_count(SGX_CPUID, 0, &eax, &ebx, &ecx, &edx); 157 159 158 160 if (!(eax & 1)) { 159 - pr_err("SGX disabled: SGX1 instruction support not available.\n"); 161 + pr_info("SGX disabled: SGX1 instruction support not available, /dev/sgx_enclave disabled.\n"); 160 162 return -ENODEV; 161 163 } 162 164 ··· 175 173 } 176 174 177 175 ret = misc_register(&sgx_dev_enclave); 178 - if (ret) 176 + if (ret) { 177 + pr_info("SGX disabled: Unable to register the /dev/sgx_enclave driver (%d).\n", ret); 179 178 return ret; 179 + } 180 180 181 181 return 0; 182 182 }
+7
arch/x86/kernel/cpu/sgx/ioctl.c
··· 64 64 struct file *backing; 65 65 long ret; 66 66 67 + /* 68 + * ECREATE would detect this too, but checking here also ensures 69 + * that the 'encl_size' calculations below can never overflow. 70 + */ 71 + if (!is_power_of_2(secs->size)) 72 + return -EINVAL; 73 + 67 74 va_page = sgx_encl_grow(encl, true); 68 75 if (IS_ERR(va_page)) 69 76 return PTR_ERR(va_page);
+1 -1
arch/x86/kvm/cpuid.c
··· 1763 1763 1764 1764 entry->ecx = entry->edx = 0; 1765 1765 if (!enable_pmu || !kvm_cpu_cap_has(X86_FEATURE_PERFMON_V2)) { 1766 - entry->eax = entry->ebx; 1766 + entry->eax = entry->ebx = 0; 1767 1767 break; 1768 1768 } 1769 1769
+17 -7
arch/x86/kvm/svm/sev.c
··· 4590 4590 4591 4591 void sev_es_prepare_switch_to_guest(struct vcpu_svm *svm, struct sev_es_save_area *hostsa) 4592 4592 { 4593 + struct kvm *kvm = svm->vcpu.kvm; 4594 + 4593 4595 /* 4594 4596 * All host state for SEV-ES guests is categorized into three swap types 4595 4597 * based on how it is handled by hardware during a world switch: ··· 4615 4613 4616 4614 /* 4617 4615 * If DebugSwap is enabled, debug registers are loaded but NOT saved by 4618 - * the CPU (Type-B). If DebugSwap is disabled/unsupported, the CPU both 4619 - * saves and loads debug registers (Type-A). 4616 + * the CPU (Type-B). If DebugSwap is disabled/unsupported, the CPU does 4617 + * not save or load debug registers. Sadly, KVM can't prevent SNP 4618 + * guests from lying about DebugSwap on secondary vCPUs, i.e. the 4619 + * SEV_FEATURES provided at "AP Create" isn't guaranteed to match what 4620 + * the guest has actually enabled (or not!) in the VMSA. 4621 + * 4622 + * If DebugSwap is *possible*, save the masks so that they're restored 4623 + * if the guest enables DebugSwap. But for the DRs themselves, do NOT 4624 + * rely on the CPU to restore the host values; KVM will restore them as 4625 + * needed in common code, via hw_breakpoint_restore(). Note, KVM does 4626 + * NOT support virtualizing Breakpoint Extensions, i.e. the mask MSRs 4627 + * don't need to be restored per se, KVM just needs to ensure they are 4628 + * loaded with the correct values *if* the CPU writes the MSRs. 4620 4629 */ 4621 - if (sev_vcpu_has_debug_swap(svm)) { 4622 - hostsa->dr0 = native_get_debugreg(0); 4623 - hostsa->dr1 = native_get_debugreg(1); 4624 - hostsa->dr2 = native_get_debugreg(2); 4625 - hostsa->dr3 = native_get_debugreg(3); 4630 + if (sev_vcpu_has_debug_swap(svm) || 4631 + (sev_snp_guest(kvm) && cpu_feature_enabled(X86_FEATURE_DEBUG_SWAP))) { 4626 4632 hostsa->dr0_addr_mask = amd_get_dr_addr_mask(0); 4627 4633 hostsa->dr1_addr_mask = amd_get_dr_addr_mask(1); 4628 4634 hostsa->dr2_addr_mask = amd_get_dr_addr_mask(2);
+49
arch/x86/kvm/svm/svm.c
··· 3165 3165 kvm_pr_unimpl_wrmsr(vcpu, ecx, data); 3166 3166 break; 3167 3167 } 3168 + 3169 + /* 3170 + * AMD changed the architectural behavior of bits 5:2. On CPUs 3171 + * without BusLockTrap, bits 5:2 control "external pins", but 3172 + * on CPUs that support BusLockDetect, bit 2 enables BusLockTrap 3173 + * and bits 5:3 are reserved-to-zero. Sadly, old KVM allowed 3174 + * the guest to set bits 5:2 despite not actually virtualizing 3175 + * Performance-Monitoring/Breakpoint external pins. Drop bits 3176 + * 5:2 for backwards compatibility. 3177 + */ 3178 + data &= ~GENMASK(5, 2); 3179 + 3180 + /* 3181 + * Suppress BTF as KVM doesn't virtualize BTF, but there's no 3182 + * way to communicate lack of support to the guest. 3183 + */ 3184 + if (data & DEBUGCTLMSR_BTF) { 3185 + kvm_pr_unimpl_wrmsr(vcpu, MSR_IA32_DEBUGCTLMSR, data); 3186 + data &= ~DEBUGCTLMSR_BTF; 3187 + } 3188 + 3168 3189 if (data & DEBUGCTL_RESERVED_BITS) 3169 3190 return 1; 3170 3191 ··· 4210 4189 4211 4190 guest_state_enter_irqoff(); 4212 4191 4192 + /* 4193 + * Set RFLAGS.IF prior to VMRUN, as the host's RFLAGS.IF at the time of 4194 + * VMRUN controls whether or not physical IRQs are masked (KVM always 4195 + * runs with V_INTR_MASKING_MASK). Toggle RFLAGS.IF here to avoid the 4196 + * temptation to do STI+VMRUN+CLI, as AMD CPUs bleed the STI shadow 4197 + * into guest state if delivery of an event during VMRUN triggers a 4198 + * #VMEXIT, and the guest_state transitions already tell lockdep that 4199 + * IRQs are being enabled/disabled. Note! GIF=0 for the entirety of 4200 + * this path, so IRQs aren't actually unmasked while running host code. 4201 + */ 4202 + raw_local_irq_enable(); 4203 + 4213 4204 amd_clear_divider(); 4214 4205 4215 4206 if (sev_es_guest(vcpu->kvm)) ··· 4229 4196 sev_es_host_save_area(sd)); 4230 4197 else 4231 4198 __svm_vcpu_run(svm, spec_ctrl_intercepted); 4199 + 4200 + raw_local_irq_disable(); 4232 4201 4233 4202 guest_state_exit_irqoff(); 4234 4203 } ··· 4288 4253 clgi(); 4289 4254 kvm_load_guest_xsave_state(vcpu); 4290 4255 4256 + /* 4257 + * Hardware only context switches DEBUGCTL if LBR virtualization is 4258 + * enabled. Manually load DEBUGCTL if necessary (and restore it after 4259 + * VM-Exit), as running with the host's DEBUGCTL can negatively affect 4260 + * guest state and can even be fatal, e.g. due to Bus Lock Detect. 4261 + */ 4262 + if (!(svm->vmcb->control.virt_ext & LBR_CTL_ENABLE_MASK) && 4263 + vcpu->arch.host_debugctl != svm->vmcb->save.dbgctl) 4264 + update_debugctlmsr(svm->vmcb->save.dbgctl); 4265 + 4291 4266 kvm_wait_lapic_expire(vcpu); 4292 4267 4293 4268 /* ··· 4324 4279 4325 4280 if (unlikely(svm->vmcb->control.exit_code == SVM_EXIT_NMI)) 4326 4281 kvm_before_interrupt(vcpu, KVM_HANDLING_NMI); 4282 + 4283 + if (!(svm->vmcb->control.virt_ext & LBR_CTL_ENABLE_MASK) && 4284 + vcpu->arch.host_debugctl != svm->vmcb->save.dbgctl) 4285 + update_debugctlmsr(vcpu->arch.host_debugctl); 4327 4286 4328 4287 kvm_load_host_xsave_state(vcpu); 4329 4288 stgi();
+1 -1
arch/x86/kvm/svm/svm.h
··· 584 584 /* svm.c */ 585 585 #define MSR_INVALID 0xffffffffU 586 586 587 - #define DEBUGCTL_RESERVED_BITS (~(0x3fULL)) 587 + #define DEBUGCTL_RESERVED_BITS (~DEBUGCTLMSR_LBR) 588 588 589 589 extern bool dump_invalid_vmcb; 590 590
+1 -9
arch/x86/kvm/svm/vmenter.S
··· 170 170 mov VCPU_RDI(%_ASM_DI), %_ASM_DI 171 171 172 172 /* Enter guest mode */ 173 - sti 174 - 175 173 3: vmrun %_ASM_AX 176 174 4: 177 - cli 178 - 179 175 /* Pop @svm to RAX while it's the only available register. */ 180 176 pop %_ASM_AX 181 177 ··· 336 340 mov KVM_VMCB_pa(%rax), %rax 337 341 338 342 /* Enter guest mode */ 339 - sti 340 - 341 343 1: vmrun %rax 342 - 343 - 2: cli 344 - 344 + 2: 345 345 /* IMPORTANT: Stuff the RSB immediately after VM-Exit, before RET! */ 346 346 FILL_RETURN_BUFFER %rax, RSB_CLEAR_LOOPS, X86_FEATURE_RSB_VMEXIT 347 347
+2 -6
arch/x86/kvm/vmx/vmx.c
··· 1514 1514 */ 1515 1515 void vmx_vcpu_load(struct kvm_vcpu *vcpu, int cpu) 1516 1516 { 1517 - struct vcpu_vmx *vmx = to_vmx(vcpu); 1518 - 1519 1517 if (vcpu->scheduled_out && !kvm_pause_in_guest(vcpu->kvm)) 1520 1518 shrink_ple_window(vcpu); 1521 1519 1522 1520 vmx_vcpu_load_vmcs(vcpu, cpu, NULL); 1523 1521 1524 1522 vmx_vcpu_pi_load(vcpu, cpu); 1525 - 1526 - vmx->host_debugctlmsr = get_debugctlmsr(); 1527 1523 } 1528 1524 1529 1525 void vmx_vcpu_put(struct kvm_vcpu *vcpu) ··· 7454 7458 } 7455 7459 7456 7460 /* MSR_IA32_DEBUGCTLMSR is zeroed on vmexit. Restore it if needed */ 7457 - if (vmx->host_debugctlmsr) 7458 - update_debugctlmsr(vmx->host_debugctlmsr); 7461 + if (vcpu->arch.host_debugctl) 7462 + update_debugctlmsr(vcpu->arch.host_debugctl); 7459 7463 7460 7464 #ifndef CONFIG_X86_64 7461 7465 /*
-2
arch/x86/kvm/vmx/vmx.h
··· 340 340 /* apic deadline value in host tsc */ 341 341 u64 hv_deadline_tsc; 342 342 343 - unsigned long host_debugctlmsr; 344 - 345 343 /* 346 344 * Only bits masked by msr_ia32_feature_control_valid_bits can be set in 347 345 * msr_ia32_feature_control. FEAT_CTL_LOCKED is always included
+2
arch/x86/kvm/x86.c
··· 10968 10968 set_debugreg(0, 7); 10969 10969 } 10970 10970 10971 + vcpu->arch.host_debugctl = get_debugctlmsr(); 10972 + 10971 10973 guest_timing_enter_irqoff(); 10972 10974 10973 10975 for (;;) {
+1 -1
block/partitions/efi.c
··· 682 682 out[size] = 0; 683 683 684 684 while (i < size) { 685 - u8 c = le16_to_cpu(in[i]) & 0xff; 685 + u8 c = le16_to_cpu(in[i]) & 0x7f; 686 686 687 687 if (c && !isprint(c)) 688 688 c = '!';
+73 -21
drivers/acpi/platform_profile.c
··· 21 21 struct device dev; 22 22 int minor; 23 23 unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)]; 24 + unsigned long hidden_choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)]; 24 25 const struct platform_profile_ops *ops; 26 + }; 27 + 28 + struct aggregate_choices_data { 29 + unsigned long aggregate[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)]; 30 + int count; 25 31 }; 26 32 27 33 static const char * const profile_names[] = { ··· 79 73 80 74 lockdep_assert_held(&profile_lock); 81 75 handler = to_pprof_handler(dev); 82 - if (!test_bit(*bit, handler->choices)) 76 + if (!test_bit(*bit, handler->choices) && !test_bit(*bit, handler->hidden_choices)) 83 77 return -EOPNOTSUPP; 84 78 85 79 return handler->ops->profile_set(dev, *bit); ··· 245 239 /** 246 240 * _aggregate_choices - Aggregate the available profile choices 247 241 * @dev: The device 248 - * @data: The available profile choices 242 + * @arg: struct aggregate_choices_data 249 243 * 250 244 * Return: 0 on success, -errno on failure 251 245 */ 252 - static int _aggregate_choices(struct device *dev, void *data) 246 + static int _aggregate_choices(struct device *dev, void *arg) 253 247 { 248 + unsigned long tmp[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)]; 249 + struct aggregate_choices_data *data = arg; 254 250 struct platform_profile_handler *handler; 255 - unsigned long *aggregate = data; 256 251 257 252 lockdep_assert_held(&profile_lock); 258 253 handler = to_pprof_handler(dev); 259 - if (test_bit(PLATFORM_PROFILE_LAST, aggregate)) 260 - bitmap_copy(aggregate, handler->choices, PLATFORM_PROFILE_LAST); 254 + bitmap_or(tmp, handler->choices, handler->hidden_choices, PLATFORM_PROFILE_LAST); 255 + if (test_bit(PLATFORM_PROFILE_LAST, data->aggregate)) 256 + bitmap_copy(data->aggregate, tmp, PLATFORM_PROFILE_LAST); 261 257 else 262 - bitmap_and(aggregate, handler->choices, aggregate, PLATFORM_PROFILE_LAST); 258 + bitmap_and(data->aggregate, tmp, data->aggregate, PLATFORM_PROFILE_LAST); 259 + data->count++; 260 + 261 + return 0; 262 + } 263 + 264 + /** 265 + * _remove_hidden_choices - Remove hidden choices from aggregate data 266 + * @dev: The device 267 + * @arg: struct aggregate_choices_data 268 + * 269 + * Return: 0 on success, -errno on failure 270 + */ 271 + static int _remove_hidden_choices(struct device *dev, void *arg) 272 + { 273 + struct aggregate_choices_data *data = arg; 274 + struct platform_profile_handler *handler; 275 + 276 + lockdep_assert_held(&profile_lock); 277 + handler = to_pprof_handler(dev); 278 + bitmap_andnot(data->aggregate, handler->choices, 279 + handler->hidden_choices, PLATFORM_PROFILE_LAST); 263 280 264 281 return 0; 265 282 } ··· 299 270 struct device_attribute *attr, 300 271 char *buf) 301 272 { 302 - unsigned long aggregate[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)]; 273 + struct aggregate_choices_data data = { 274 + .aggregate = { [0 ... BITS_TO_LONGS(PLATFORM_PROFILE_LAST) - 1] = ~0UL }, 275 + .count = 0, 276 + }; 303 277 int err; 304 278 305 - set_bit(PLATFORM_PROFILE_LAST, aggregate); 279 + set_bit(PLATFORM_PROFILE_LAST, data.aggregate); 306 280 scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) { 307 281 err = class_for_each_device(&platform_profile_class, NULL, 308 - aggregate, _aggregate_choices); 282 + &data, _aggregate_choices); 309 283 if (err) 310 284 return err; 285 + if (data.count == 1) { 286 + err = class_for_each_device(&platform_profile_class, NULL, 287 + &data, _remove_hidden_choices); 288 + if (err) 289 + return err; 290 + } 311 291 } 312 292 313 293 /* no profile handler registered any more */ 314 - if (bitmap_empty(aggregate, PLATFORM_PROFILE_LAST)) 294 + if (bitmap_empty(data.aggregate, PLATFORM_PROFILE_LAST)) 315 295 return -EINVAL; 316 296 317 - return _commmon_choices_show(aggregate, buf); 297 + return _commmon_choices_show(data.aggregate, buf); 318 298 } 319 299 320 300 /** ··· 411 373 struct device_attribute *attr, 412 374 const char *buf, size_t count) 413 375 { 414 - unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)]; 376 + struct aggregate_choices_data data = { 377 + .aggregate = { [0 ... BITS_TO_LONGS(PLATFORM_PROFILE_LAST) - 1] = ~0UL }, 378 + .count = 0, 379 + }; 415 380 int ret; 416 381 int i; 417 382 ··· 422 381 i = sysfs_match_string(profile_names, buf); 423 382 if (i < 0 || i == PLATFORM_PROFILE_CUSTOM) 424 383 return -EINVAL; 425 - set_bit(PLATFORM_PROFILE_LAST, choices); 384 + set_bit(PLATFORM_PROFILE_LAST, data.aggregate); 426 385 scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) { 427 386 ret = class_for_each_device(&platform_profile_class, NULL, 428 - choices, _aggregate_choices); 387 + &data, _aggregate_choices); 429 388 if (ret) 430 389 return ret; 431 - if (!test_bit(i, choices)) 390 + if (!test_bit(i, data.aggregate)) 432 391 return -EOPNOTSUPP; 433 392 434 393 ret = class_for_each_device(&platform_profile_class, NULL, &i, ··· 494 453 */ 495 454 int platform_profile_cycle(void) 496 455 { 456 + struct aggregate_choices_data data = { 457 + .aggregate = { [0 ... BITS_TO_LONGS(PLATFORM_PROFILE_LAST) - 1] = ~0UL }, 458 + .count = 0, 459 + }; 497 460 enum platform_profile_option next = PLATFORM_PROFILE_LAST; 498 461 enum platform_profile_option profile = PLATFORM_PROFILE_LAST; 499 - unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)]; 500 462 int err; 501 463 502 - set_bit(PLATFORM_PROFILE_LAST, choices); 464 + set_bit(PLATFORM_PROFILE_LAST, data.aggregate); 503 465 scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) { 504 466 err = class_for_each_device(&platform_profile_class, NULL, 505 467 &profile, _aggregate_profiles); ··· 514 470 return -EINVAL; 515 471 516 472 err = class_for_each_device(&platform_profile_class, NULL, 517 - choices, _aggregate_choices); 473 + &data, _aggregate_choices); 518 474 if (err) 519 475 return err; 520 476 521 477 /* never iterate into a custom if all drivers supported it */ 522 - clear_bit(PLATFORM_PROFILE_CUSTOM, choices); 478 + clear_bit(PLATFORM_PROFILE_CUSTOM, data.aggregate); 523 479 524 - next = find_next_bit_wrap(choices, 480 + next = find_next_bit_wrap(data.aggregate, 525 481 PLATFORM_PROFILE_LAST, 526 482 profile + 1); 527 483 ··· 574 530 if (bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST)) { 575 531 dev_err(dev, "Failed to register platform_profile class device with empty choices\n"); 576 532 return ERR_PTR(-EINVAL); 533 + } 534 + 535 + if (ops->hidden_choices) { 536 + err = ops->hidden_choices(drvdata, pprof->hidden_choices); 537 + if (err) { 538 + dev_err(dev, "platform_profile hidden_choices failed\n"); 539 + return ERR_PTR(err); 540 + } 577 541 } 578 542 579 543 guard(mutex)(&profile_lock);
+1
drivers/android/binderfs.c
··· 274 274 mutex_unlock(&binderfs_minors_mutex); 275 275 276 276 if (refcount_dec_and_test(&device->ref)) { 277 + hlist_del_init(&device->hlist); 277 278 kfree(device->context.name); 278 279 kfree(device); 279 280 }
+1
drivers/base/core.c
··· 2079 2079 out: 2080 2080 sup_handle->flags &= ~FWNODE_FLAG_VISITED; 2081 2081 put_device(sup_dev); 2082 + put_device(con_dev); 2082 2083 put_device(par_dev); 2083 2084 return ret; 2084 2085 }
+5 -2
drivers/block/ublk_drv.c
··· 2715 2715 if (ph.len > sizeof(struct ublk_params)) 2716 2716 ph.len = sizeof(struct ublk_params); 2717 2717 2718 - /* parameters can only be changed when device isn't live */ 2719 2718 mutex_lock(&ub->mutex); 2720 - if (ub->dev_info.state == UBLK_S_DEV_LIVE) { 2719 + if (test_bit(UB_STATE_USED, &ub->state)) { 2720 + /* 2721 + * Parameters can only be changed when device hasn't 2722 + * been started yet 2723 + */ 2721 2724 ret = -EACCES; 2722 2725 } else if (copy_from_user(&ub->params, argp, ph.len)) { 2723 2726 ret = -EFAULT;
+12
drivers/bluetooth/Kconfig
··· 56 56 Say Y here to enable USB poll_sync for Bluetooth USB devices by 57 57 default. 58 58 59 + config BT_HCIBTUSB_AUTO_ISOC_ALT 60 + bool "Automatically adjust alternate setting for Isoc endpoints" 61 + depends on BT_HCIBTUSB 62 + default y if CHROME_PLATFORMS 63 + help 64 + Say Y here to automatically adjusting the alternate setting for 65 + HCI_USER_CHANNEL whenever a SCO link is established. 66 + 67 + When enabled, btusb intercepts the HCI_EV_SYNC_CONN_COMPLETE packets 68 + and configures isoc endpoint alternate setting automatically when 69 + HCI_USER_CHANNEL is in use. 70 + 59 71 config BT_HCIBTUSB_BCM 60 72 bool "Broadcom protocol support" 61 73 depends on BT_HCIBTUSB
+41
drivers/bluetooth/btusb.c
··· 34 34 static bool enable_autosuspend = IS_ENABLED(CONFIG_BT_HCIBTUSB_AUTOSUSPEND); 35 35 static bool enable_poll_sync = IS_ENABLED(CONFIG_BT_HCIBTUSB_POLL_SYNC); 36 36 static bool reset = true; 37 + static bool auto_isoc_alt = IS_ENABLED(CONFIG_BT_HCIBTUSB_AUTO_ISOC_ALT); 37 38 38 39 static struct usb_driver btusb_driver; 39 40 ··· 1086 1085 spin_unlock_irqrestore(&data->rxlock, flags); 1087 1086 } 1088 1087 1088 + static void btusb_sco_connected(struct btusb_data *data, struct sk_buff *skb) 1089 + { 1090 + struct hci_event_hdr *hdr = (void *) skb->data; 1091 + struct hci_ev_sync_conn_complete *ev = 1092 + (void *) skb->data + sizeof(*hdr); 1093 + struct hci_dev *hdev = data->hdev; 1094 + unsigned int notify_air_mode; 1095 + 1096 + if (hci_skb_pkt_type(skb) != HCI_EVENT_PKT) 1097 + return; 1098 + 1099 + if (skb->len < sizeof(*hdr) || hdr->evt != HCI_EV_SYNC_CONN_COMPLETE) 1100 + return; 1101 + 1102 + if (skb->len != sizeof(*hdr) + sizeof(*ev) || ev->status) 1103 + return; 1104 + 1105 + switch (ev->air_mode) { 1106 + case BT_CODEC_CVSD: 1107 + notify_air_mode = HCI_NOTIFY_ENABLE_SCO_CVSD; 1108 + break; 1109 + 1110 + case BT_CODEC_TRANSPARENT: 1111 + notify_air_mode = HCI_NOTIFY_ENABLE_SCO_TRANSP; 1112 + break; 1113 + 1114 + default: 1115 + return; 1116 + } 1117 + 1118 + bt_dev_info(hdev, "enabling SCO with air mode %u", ev->air_mode); 1119 + data->sco_num = 1; 1120 + data->air_mode = notify_air_mode; 1121 + schedule_work(&data->work); 1122 + } 1123 + 1089 1124 static int btusb_recv_event(struct btusb_data *data, struct sk_buff *skb) 1090 1125 { 1091 1126 if (data->intr_interval) { 1092 1127 /* Trigger dequeue immediately if an event is received */ 1093 1128 schedule_delayed_work(&data->rx_work, 0); 1094 1129 } 1130 + 1131 + /* Configure altsetting for HCI_USER_CHANNEL on SCO connected */ 1132 + if (auto_isoc_alt && hci_dev_test_flag(data->hdev, HCI_USER_CHANNEL)) 1133 + btusb_sco_connected(data, skb); 1095 1134 1096 1135 return data->recv_event(data->hdev, skb); 1097 1136 }
+3 -2
drivers/bus/mhi/host/pci_generic.c
··· 1095 1095 err_unprepare: 1096 1096 mhi_unprepare_after_power_down(mhi_cntrl); 1097 1097 err_try_reset: 1098 - if (pci_reset_function(pdev)) 1099 - dev_err(&pdev->dev, "Recovery failed\n"); 1098 + err = pci_try_reset_function(pdev); 1099 + if (err) 1100 + dev_err(&pdev->dev, "Recovery failed: %d\n", err); 1100 1101 } 1101 1102 1102 1103 static void health_check(struct timer_list *t)
+21 -1
drivers/bus/simple-pm-bus.c
··· 109 109 return 0; 110 110 } 111 111 112 + static int simple_pm_bus_suspend(struct device *dev) 113 + { 114 + struct simple_pm_bus *bus = dev_get_drvdata(dev); 115 + 116 + if (!bus) 117 + return 0; 118 + 119 + return pm_runtime_force_suspend(dev); 120 + } 121 + 122 + static int simple_pm_bus_resume(struct device *dev) 123 + { 124 + struct simple_pm_bus *bus = dev_get_drvdata(dev); 125 + 126 + if (!bus) 127 + return 0; 128 + 129 + return pm_runtime_force_resume(dev); 130 + } 131 + 112 132 static const struct dev_pm_ops simple_pm_bus_pm_ops = { 113 133 RUNTIME_PM_OPS(simple_pm_bus_runtime_suspend, simple_pm_bus_runtime_resume, NULL) 114 - NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) 134 + NOIRQ_SYSTEM_SLEEP_PM_OPS(simple_pm_bus_suspend, simple_pm_bus_resume) 115 135 }; 116 136 117 137 #define ONLY_BUS ((void *) 1) /* Match if the device is only a bus. */
+5 -1
drivers/cdx/cdx.c
··· 473 473 struct device_attribute *attr, char *buf) 474 474 { 475 475 struct cdx_device *cdx_dev = to_cdx_device(dev); 476 + ssize_t len; 476 477 477 - return sysfs_emit(buf, "%s\n", cdx_dev->driver_override); 478 + device_lock(dev); 479 + len = sysfs_emit(buf, "%s\n", cdx_dev->driver_override); 480 + device_unlock(dev); 481 + return len; 478 482 } 479 483 static DEVICE_ATTR_RW(driver_override); 480 484
+1 -1
drivers/char/misc.c
··· 264 264 device_create_with_groups(&misc_class, misc->parent, dev, 265 265 misc, misc->groups, "%s", misc->name); 266 266 if (IS_ERR(misc->this_device)) { 267 + misc_minor_free(misc->minor); 267 268 if (is_dynamic) { 268 - misc_minor_free(misc->minor); 269 269 misc->minor = MISC_DYNAMIC_MINOR; 270 270 } 271 271 err = PTR_ERR(misc->this_device);
+2 -2
drivers/char/virtio_console.c
··· 923 923 924 924 pipe_lock(pipe); 925 925 ret = 0; 926 - if (pipe_empty(pipe->head, pipe->tail)) 926 + if (pipe_is_empty(pipe)) 927 927 goto error_out; 928 928 929 929 ret = wait_port_writable(port, filp->f_flags & O_NONBLOCK); 930 930 if (ret < 0) 931 931 goto error_out; 932 932 933 - occupancy = pipe_occupancy(pipe->head, pipe->tail); 933 + occupancy = pipe_buf_usage(pipe); 934 934 buf = alloc_buf(port->portdev->vdev, 0, occupancy); 935 935 936 936 if (!buf) {
+17 -3
drivers/gpio/gpio-aggregator.c
··· 119 119 struct platform_device *pdev; 120 120 int res, id; 121 121 122 + if (!try_module_get(THIS_MODULE)) 123 + return -ENOENT; 124 + 122 125 /* kernfs guarantees string termination, so count + 1 is safe */ 123 126 aggr = kzalloc(sizeof(*aggr) + count + 1, GFP_KERNEL); 124 - if (!aggr) 125 - return -ENOMEM; 127 + if (!aggr) { 128 + res = -ENOMEM; 129 + goto put_module; 130 + } 126 131 127 132 memcpy(aggr->args, buf, count + 1); 128 133 ··· 166 161 } 167 162 168 163 aggr->pdev = pdev; 164 + module_put(THIS_MODULE); 169 165 return count; 170 166 171 167 remove_table: ··· 181 175 kfree(aggr->lookups); 182 176 free_ga: 183 177 kfree(aggr); 178 + put_module: 179 + module_put(THIS_MODULE); 184 180 return res; 185 181 } 186 182 ··· 211 203 if (error) 212 204 return error; 213 205 206 + if (!try_module_get(THIS_MODULE)) 207 + return -ENOENT; 208 + 214 209 mutex_lock(&gpio_aggregator_lock); 215 210 aggr = idr_remove(&gpio_aggregator_idr, id); 216 211 mutex_unlock(&gpio_aggregator_lock); 217 - if (!aggr) 212 + if (!aggr) { 213 + module_put(THIS_MODULE); 218 214 return -ENOENT; 215 + } 219 216 220 217 gpio_aggregator_free(aggr); 218 + module_put(THIS_MODULE); 221 219 return count; 222 220 } 223 221 static DRIVER_ATTR_WO(delete_device);
+18 -13
drivers/gpio/gpio-rcar.c
··· 40 40 41 41 struct gpio_rcar_priv { 42 42 void __iomem *base; 43 - spinlock_t lock; 43 + raw_spinlock_t lock; 44 44 struct device *dev; 45 45 struct gpio_chip gpio_chip; 46 46 unsigned int irq_parent; ··· 123 123 * "Setting Level-Sensitive Interrupt Input Mode" 124 124 */ 125 125 126 - spin_lock_irqsave(&p->lock, flags); 126 + raw_spin_lock_irqsave(&p->lock, flags); 127 127 128 128 /* Configure positive or negative logic in POSNEG */ 129 129 gpio_rcar_modify_bit(p, POSNEG, hwirq, !active_high_rising_edge); ··· 142 142 if (!level_trigger) 143 143 gpio_rcar_write(p, INTCLR, BIT(hwirq)); 144 144 145 - spin_unlock_irqrestore(&p->lock, flags); 145 + raw_spin_unlock_irqrestore(&p->lock, flags); 146 146 } 147 147 148 148 static int gpio_rcar_irq_set_type(struct irq_data *d, unsigned int type) ··· 246 246 * "Setting General Input Mode" 247 247 */ 248 248 249 - spin_lock_irqsave(&p->lock, flags); 249 + raw_spin_lock_irqsave(&p->lock, flags); 250 250 251 251 /* Configure positive logic in POSNEG */ 252 252 gpio_rcar_modify_bit(p, POSNEG, gpio, false); ··· 261 261 if (p->info.has_outdtsel && output) 262 262 gpio_rcar_modify_bit(p, OUTDTSEL, gpio, false); 263 263 264 - spin_unlock_irqrestore(&p->lock, flags); 264 + raw_spin_unlock_irqrestore(&p->lock, flags); 265 265 } 266 266 267 267 static int gpio_rcar_request(struct gpio_chip *chip, unsigned offset) ··· 347 347 return 0; 348 348 } 349 349 350 - spin_lock_irqsave(&p->lock, flags); 350 + raw_spin_lock_irqsave(&p->lock, flags); 351 351 outputs = gpio_rcar_read(p, INOUTSEL); 352 352 m = outputs & bankmask; 353 353 if (m) ··· 356 356 m = ~outputs & bankmask; 357 357 if (m) 358 358 val |= gpio_rcar_read(p, INDT) & m; 359 - spin_unlock_irqrestore(&p->lock, flags); 359 + raw_spin_unlock_irqrestore(&p->lock, flags); 360 360 361 361 bits[0] = val; 362 362 return 0; ··· 367 367 struct gpio_rcar_priv *p = gpiochip_get_data(chip); 368 368 unsigned long flags; 369 369 370 - spin_lock_irqsave(&p->lock, flags); 370 + raw_spin_lock_irqsave(&p->lock, flags); 371 371 gpio_rcar_modify_bit(p, OUTDT, offset, value); 372 - spin_unlock_irqrestore(&p->lock, flags); 372 + raw_spin_unlock_irqrestore(&p->lock, flags); 373 373 } 374 374 375 375 static void gpio_rcar_set_multiple(struct gpio_chip *chip, unsigned long *mask, ··· 386 386 if (!bankmask) 387 387 return; 388 388 389 - spin_lock_irqsave(&p->lock, flags); 389 + raw_spin_lock_irqsave(&p->lock, flags); 390 390 val = gpio_rcar_read(p, OUTDT); 391 391 val &= ~bankmask; 392 392 val |= (bankmask & bits[0]); 393 393 gpio_rcar_write(p, OUTDT, val); 394 - spin_unlock_irqrestore(&p->lock, flags); 394 + raw_spin_unlock_irqrestore(&p->lock, flags); 395 395 } 396 396 397 397 static int gpio_rcar_direction_output(struct gpio_chip *chip, unsigned offset, ··· 468 468 p->info = *info; 469 469 470 470 ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 0, &args); 471 - *npins = ret == 0 ? args.args[2] : RCAR_MAX_GPIO_PER_BANK; 471 + if (ret) { 472 + *npins = RCAR_MAX_GPIO_PER_BANK; 473 + } else { 474 + *npins = args.args[2]; 475 + of_node_put(args.np); 476 + } 472 477 473 478 if (*npins == 0 || *npins > RCAR_MAX_GPIO_PER_BANK) { 474 479 dev_warn(p->dev, "Invalid number of gpio lines %u, using %u\n", ··· 510 505 return -ENOMEM; 511 506 512 507 p->dev = dev; 513 - spin_lock_init(&p->lock); 508 + raw_spin_lock_init(&p->lock); 514 509 515 510 /* Get device configuration from DT node */ 516 511 ret = gpio_rcar_parse_dt(p, &npins);
+2 -2
drivers/gpu/drm/amd/amdkfd/kfd_queue.c
··· 266 266 /* EOP buffer is not required for all ASICs */ 267 267 if (properties->eop_ring_buffer_address) { 268 268 if (properties->eop_ring_buffer_size != topo_dev->node_props.eop_buffer_size) { 269 - pr_debug("queue eop bo size 0x%lx not equal to node eop buf size 0x%x\n", 270 - properties->eop_buf_bo->tbo.base.size, 269 + pr_debug("queue eop bo size 0x%x not equal to node eop buf size 0x%x\n", 270 + properties->eop_ring_buffer_size, 271 271 topo_dev->node_props.eop_buffer_size); 272 272 err = -EINVAL; 273 273 goto out_err_unreserve;
+2 -1
drivers/gpu/drm/amd/display/dc/core/dc_resource.c
··· 1455 1455 DC_LOGGER_INIT(pipe_ctx->stream->ctx->logger); 1456 1456 1457 1457 /* Invalid input */ 1458 - if (!plane_state->dst_rect.width || 1458 + if (!plane_state || 1459 + !plane_state->dst_rect.width || 1459 1460 !plane_state->dst_rect.height || 1460 1461 !plane_state->src_rect.width || 1461 1462 !plane_state->src_rect.height) {
+1 -11
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c
··· 1895 1895 NULL); 1896 1896 } 1897 1897 1898 - static int smu_v14_0_process_pending_interrupt(struct smu_context *smu) 1899 - { 1900 - int ret = 0; 1901 - 1902 - if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_ACDC_BIT)) 1903 - ret = smu_v14_0_allow_ih_interrupt(smu); 1904 - 1905 - return ret; 1906 - } 1907 - 1908 1898 int smu_v14_0_enable_thermal_alert(struct smu_context *smu) 1909 1899 { 1910 1900 int ret = 0; ··· 1906 1916 if (ret) 1907 1917 return ret; 1908 1918 1909 - return smu_v14_0_process_pending_interrupt(smu); 1919 + return smu_v14_0_allow_ih_interrupt(smu); 1910 1920 } 1911 1921 1912 1922 int smu_v14_0_disable_thermal_alert(struct smu_context *smu)
+2
drivers/gpu/drm/hyperv/hyperv_drm_drv.c
··· 154 154 return 0; 155 155 156 156 err_free_mmio: 157 + iounmap(hv->vram); 157 158 vmbus_free_mmio(hv->mem->start, hv->fb_size); 158 159 err_vmbus_close: 159 160 vmbus_close(hdev->channel); ··· 173 172 vmbus_close(hdev->channel); 174 173 hv_set_drvdata(hdev, NULL); 175 174 175 + iounmap(hv->vram); 176 176 vmbus_free_mmio(hv->mem->start, hv->fb_size); 177 177 } 178 178
+2 -1
drivers/gpu/drm/i915/display/intel_dp_mst.c
··· 1867 1867 /* create encoders */ 1868 1868 mst_stream_encoders_create(dig_port); 1869 1869 ret = drm_dp_mst_topology_mgr_init(&intel_dp->mst_mgr, display->drm, 1870 - &intel_dp->aux, 16, 3, conn_base_id); 1870 + &intel_dp->aux, 16, 1871 + INTEL_NUM_PIPES(display), conn_base_id); 1871 1872 if (ret) { 1872 1873 intel_dp->mst_mgr.cbs = NULL; 1873 1874 return ret;
+4 -2
drivers/gpu/drm/imagination/pvr_fw_meta.c
··· 527 527 static void 528 528 pvr_meta_vm_unmap(struct pvr_device *pvr_dev, struct pvr_fw_object *fw_obj) 529 529 { 530 - pvr_vm_unmap(pvr_dev->kernel_vm_ctx, fw_obj->fw_mm_node.start, 531 - fw_obj->fw_mm_node.size); 530 + struct pvr_gem_object *pvr_obj = fw_obj->gem; 531 + 532 + pvr_vm_unmap_obj(pvr_dev->kernel_vm_ctx, pvr_obj, 533 + fw_obj->fw_mm_node.start, fw_obj->fw_mm_node.size); 532 534 } 533 535 534 536 static bool
+2 -2
drivers/gpu/drm/imagination/pvr_fw_trace.c
··· 333 333 if (sf_id == ROGUE_FW_SF_LAST) 334 334 return -EINVAL; 335 335 336 - timestamp = read_fw_trace(trace_seq_data, 1) | 337 - ((u64)read_fw_trace(trace_seq_data, 2) << 32); 336 + timestamp = ((u64)read_fw_trace(trace_seq_data, 1) << 32) | 337 + read_fw_trace(trace_seq_data, 2); 338 338 timestamp = (timestamp & ~ROGUE_FWT_TIMESTAMP_TIME_CLRMSK) >> 339 339 ROGUE_FWT_TIMESTAMP_TIME_SHIFT; 340 340
+14 -4
drivers/gpu/drm/imagination/pvr_queue.c
··· 109 109 return PVR_DRIVER_NAME; 110 110 } 111 111 112 + static void pvr_queue_fence_release_work(struct work_struct *w) 113 + { 114 + struct pvr_queue_fence *fence = container_of(w, struct pvr_queue_fence, release_work); 115 + 116 + pvr_context_put(fence->queue->ctx); 117 + dma_fence_free(&fence->base); 118 + } 119 + 112 120 static void pvr_queue_fence_release(struct dma_fence *f) 113 121 { 114 122 struct pvr_queue_fence *fence = container_of(f, struct pvr_queue_fence, base); 123 + struct pvr_device *pvr_dev = fence->queue->ctx->pvr_dev; 115 124 116 - pvr_context_put(fence->queue->ctx); 117 - dma_fence_free(f); 125 + queue_work(pvr_dev->sched_wq, &fence->release_work); 118 126 } 119 127 120 128 static const char * ··· 276 268 277 269 pvr_context_get(queue->ctx); 278 270 fence->queue = queue; 271 + INIT_WORK(&fence->release_work, pvr_queue_fence_release_work); 279 272 dma_fence_init(&fence->base, fence_ops, 280 273 &fence_ctx->lock, fence_ctx->id, 281 274 atomic_inc_return(&fence_ctx->seqno)); ··· 313 304 static void 314 305 pvr_queue_job_fence_init(struct dma_fence *fence, struct pvr_queue *queue) 315 306 { 316 - pvr_queue_fence_init(fence, queue, &pvr_queue_job_fence_ops, 317 - &queue->job_fence_ctx); 307 + if (!fence->ops) 308 + pvr_queue_fence_init(fence, queue, &pvr_queue_job_fence_ops, 309 + &queue->job_fence_ctx); 318 310 } 319 311 320 312 /**
+4
drivers/gpu/drm/imagination/pvr_queue.h
··· 5 5 #define PVR_QUEUE_H 6 6 7 7 #include <drm/gpu_scheduler.h> 8 + #include <linux/workqueue.h> 8 9 9 10 #include "pvr_cccb.h" 10 11 #include "pvr_device.h" ··· 64 63 65 64 /** @queue: Queue that created this fence. */ 66 65 struct pvr_queue *queue; 66 + 67 + /** @release_work: Fence release work structure. */ 68 + struct work_struct release_work; 67 69 }; 68 70 69 71 /**
+108 -26
drivers/gpu/drm/imagination/pvr_vm.c
··· 293 293 294 294 static int 295 295 pvr_vm_bind_op_unmap_init(struct pvr_vm_bind_op *bind_op, 296 - struct pvr_vm_context *vm_ctx, u64 device_addr, 297 - u64 size) 296 + struct pvr_vm_context *vm_ctx, 297 + struct pvr_gem_object *pvr_obj, 298 + u64 device_addr, u64 size) 298 299 { 299 300 int err; 300 301 ··· 319 318 goto err_bind_op_fini; 320 319 } 321 320 321 + bind_op->pvr_obj = pvr_obj; 322 322 bind_op->vm_ctx = vm_ctx; 323 323 bind_op->device_addr = device_addr; 324 324 bind_op->size = size; ··· 600 598 } 601 599 602 600 /** 603 - * pvr_vm_unmap_all() - Unmap all mappings associated with a VM context. 604 - * @vm_ctx: Target VM context. 605 - * 606 - * This function ensures that no mappings are left dangling by unmapping them 607 - * all in order of ascending device-virtual address. 608 - */ 609 - void 610 - pvr_vm_unmap_all(struct pvr_vm_context *vm_ctx) 611 - { 612 - WARN_ON(pvr_vm_unmap(vm_ctx, vm_ctx->gpuvm_mgr.mm_start, 613 - vm_ctx->gpuvm_mgr.mm_range)); 614 - } 615 - 616 - /** 617 601 * pvr_vm_context_release() - Teardown a VM context. 618 602 * @ref_count: Pointer to reference counter of the VM context. 619 603 * ··· 691 703 struct pvr_vm_bind_op *bind_op = vm_exec->extra.priv; 692 704 struct pvr_gem_object *pvr_obj = bind_op->pvr_obj; 693 705 694 - /* Unmap operations don't have an object to lock. */ 695 - if (!pvr_obj) 696 - return 0; 697 - 698 - /* Acquire lock on the GEM being mapped. */ 706 + /* Acquire lock on the GEM object being mapped/unmapped. */ 699 707 return drm_exec_lock_obj(&vm_exec->exec, gem_from_pvr_gem(pvr_obj)); 700 708 } 701 709 ··· 756 772 } 757 773 758 774 /** 759 - * pvr_vm_unmap() - Unmap an already mapped section of device-virtual memory. 775 + * pvr_vm_unmap_obj_locked() - Unmap an already mapped section of device-virtual 776 + * memory. 760 777 * @vm_ctx: Target VM context. 778 + * @pvr_obj: Target PowerVR memory object. 761 779 * @device_addr: Virtual device address at the start of the target mapping. 762 780 * @size: Size of the target mapping. 763 781 * ··· 770 784 * * Any error encountered while performing internal operations required to 771 785 * destroy the mapping (returned from pvr_vm_gpuva_unmap or 772 786 * pvr_vm_gpuva_remap). 787 + * 788 + * The vm_ctx->lock must be held when calling this function. 773 789 */ 774 - int 775 - pvr_vm_unmap(struct pvr_vm_context *vm_ctx, u64 device_addr, u64 size) 790 + static int 791 + pvr_vm_unmap_obj_locked(struct pvr_vm_context *vm_ctx, 792 + struct pvr_gem_object *pvr_obj, 793 + u64 device_addr, u64 size) 776 794 { 777 795 struct pvr_vm_bind_op bind_op = {0}; 778 796 struct drm_gpuvm_exec vm_exec = { ··· 789 799 }, 790 800 }; 791 801 792 - int err = pvr_vm_bind_op_unmap_init(&bind_op, vm_ctx, device_addr, 793 - size); 802 + int err = pvr_vm_bind_op_unmap_init(&bind_op, vm_ctx, pvr_obj, 803 + device_addr, size); 794 804 if (err) 795 805 return err; 806 + 807 + pvr_gem_object_get(pvr_obj); 796 808 797 809 err = drm_gpuvm_exec_lock(&vm_exec); 798 810 if (err) ··· 808 816 pvr_vm_bind_op_fini(&bind_op); 809 817 810 818 return err; 819 + } 820 + 821 + /** 822 + * pvr_vm_unmap_obj() - Unmap an already mapped section of device-virtual 823 + * memory. 824 + * @vm_ctx: Target VM context. 825 + * @pvr_obj: Target PowerVR memory object. 826 + * @device_addr: Virtual device address at the start of the target mapping. 827 + * @size: Size of the target mapping. 828 + * 829 + * Return: 830 + * * 0 on success, 831 + * * Any error encountered by pvr_vm_unmap_obj_locked. 832 + */ 833 + int 834 + pvr_vm_unmap_obj(struct pvr_vm_context *vm_ctx, struct pvr_gem_object *pvr_obj, 835 + u64 device_addr, u64 size) 836 + { 837 + int err; 838 + 839 + mutex_lock(&vm_ctx->lock); 840 + err = pvr_vm_unmap_obj_locked(vm_ctx, pvr_obj, device_addr, size); 841 + mutex_unlock(&vm_ctx->lock); 842 + 843 + return err; 844 + } 845 + 846 + /** 847 + * pvr_vm_unmap() - Unmap an already mapped section of device-virtual memory. 848 + * @vm_ctx: Target VM context. 849 + * @device_addr: Virtual device address at the start of the target mapping. 850 + * @size: Size of the target mapping. 851 + * 852 + * Return: 853 + * * 0 on success, 854 + * * Any error encountered by drm_gpuva_find, 855 + * * Any error encountered by pvr_vm_unmap_obj_locked. 856 + */ 857 + int 858 + pvr_vm_unmap(struct pvr_vm_context *vm_ctx, u64 device_addr, u64 size) 859 + { 860 + struct pvr_gem_object *pvr_obj; 861 + struct drm_gpuva *va; 862 + int err; 863 + 864 + mutex_lock(&vm_ctx->lock); 865 + 866 + va = drm_gpuva_find(&vm_ctx->gpuvm_mgr, device_addr, size); 867 + if (va) { 868 + pvr_obj = gem_to_pvr_gem(va->gem.obj); 869 + err = pvr_vm_unmap_obj_locked(vm_ctx, pvr_obj, 870 + va->va.addr, va->va.range); 871 + } else { 872 + err = -ENOENT; 873 + } 874 + 875 + mutex_unlock(&vm_ctx->lock); 876 + 877 + return err; 878 + } 879 + 880 + /** 881 + * pvr_vm_unmap_all() - Unmap all mappings associated with a VM context. 882 + * @vm_ctx: Target VM context. 883 + * 884 + * This function ensures that no mappings are left dangling by unmapping them 885 + * all in order of ascending device-virtual address. 886 + */ 887 + void 888 + pvr_vm_unmap_all(struct pvr_vm_context *vm_ctx) 889 + { 890 + mutex_lock(&vm_ctx->lock); 891 + 892 + for (;;) { 893 + struct pvr_gem_object *pvr_obj; 894 + struct drm_gpuva *va; 895 + 896 + va = drm_gpuva_find_first(&vm_ctx->gpuvm_mgr, 897 + vm_ctx->gpuvm_mgr.mm_start, 898 + vm_ctx->gpuvm_mgr.mm_range); 899 + if (!va) 900 + break; 901 + 902 + pvr_obj = gem_to_pvr_gem(va->gem.obj); 903 + 904 + WARN_ON(pvr_vm_unmap_obj_locked(vm_ctx, pvr_obj, 905 + va->va.addr, va->va.range)); 906 + } 907 + 908 + mutex_unlock(&vm_ctx->lock); 811 909 } 812 910 813 911 /* Static data areas are determined by firmware. */
+3
drivers/gpu/drm/imagination/pvr_vm.h
··· 38 38 int pvr_vm_map(struct pvr_vm_context *vm_ctx, 39 39 struct pvr_gem_object *pvr_obj, u64 pvr_obj_offset, 40 40 u64 device_addr, u64 size); 41 + int pvr_vm_unmap_obj(struct pvr_vm_context *vm_ctx, 42 + struct pvr_gem_object *pvr_obj, 43 + u64 device_addr, u64 size); 41 44 int pvr_vm_unmap(struct pvr_vm_context *vm_ctx, u64 device_addr, u64 size); 42 45 void pvr_vm_unmap_all(struct pvr_vm_context *vm_ctx); 43 46
+1
drivers/gpu/drm/nouveau/Kconfig
··· 4 4 depends on DRM && PCI && MMU 5 5 select IOMMU_API 6 6 select FW_LOADER 7 + select FW_CACHE if PM_SLEEP 7 8 select DRM_CLIENT_SELECTION 8 9 select DRM_DISPLAY_DP_HELPER 9 10 select DRM_DISPLAY_HDMI_HELPER
+2 -1
drivers/gpu/drm/radeon/r300.c
··· 359 359 return -1; 360 360 } 361 361 362 - static void r300_gpu_init(struct radeon_device *rdev) 362 + /* rs400_gpu_init also calls this! */ 363 + void r300_gpu_init(struct radeon_device *rdev) 363 364 { 364 365 uint32_t gb_tile_config, tmp; 365 366
+1
drivers/gpu/drm/radeon/radeon_asic.h
··· 165 165 */ 166 166 extern int r300_init(struct radeon_device *rdev); 167 167 extern void r300_fini(struct radeon_device *rdev); 168 + extern void r300_gpu_init(struct radeon_device *rdev); 168 169 extern int r300_suspend(struct radeon_device *rdev); 169 170 extern int r300_resume(struct radeon_device *rdev); 170 171 extern int r300_asic_reset(struct radeon_device *rdev, bool hard);
+16 -2
drivers/gpu/drm/radeon/rs400.c
··· 256 256 257 257 static void rs400_gpu_init(struct radeon_device *rdev) 258 258 { 259 - /* FIXME: is this correct ? */ 260 - r420_pipes_init(rdev); 259 + /* Earlier code was calling r420_pipes_init and then 260 + * rs400_mc_wait_for_idle(rdev). The problem is that 261 + * at least on my Mobility Radeon Xpress 200M RC410 card 262 + * that ends up in this code path ends up num_gb_pipes == 3 263 + * while the card seems to have only one pipe. With the 264 + * r420 pipe initialization method. 265 + * 266 + * Problems shown up as HyperZ glitches, see: 267 + * https://bugs.freedesktop.org/show_bug.cgi?id=110897 268 + * 269 + * Delegating initialization to r300 code seems to work 270 + * and results in proper pipe numbers. The rs400 cards 271 + * are said to be not r400, but r300 kind of cards. 272 + */ 273 + r300_gpu_init(rdev); 274 + 261 275 if (rs400_mc_wait_for_idle(rdev)) { 262 276 pr_warn("rs400: Failed to wait MC idle while programming pipes. Bad things might happen. %08x\n", 263 277 RREG32(RADEON_MC_STATUS));
+2 -2
drivers/gpu/drm/scheduler/gpu_scheduler_trace.h
··· 21 21 * 22 22 */ 23 23 24 - #if !defined(_GPU_SCHED_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) 24 + #if !defined(_GPU_SCHED_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ) 25 25 #define _GPU_SCHED_TRACE_H_ 26 26 27 27 #include <linux/stringify.h> ··· 106 106 __entry->seqno) 107 107 ); 108 108 109 - #endif 109 + #endif /* _GPU_SCHED_TRACE_H_ */ 110 110 111 111 /* This part must be outside protection */ 112 112 #undef TRACE_INCLUDE_PATH
+3 -2
drivers/gpu/drm/tiny/bochs.c
··· 335 335 bochs->xres, bochs->yres, bochs->bpp, 336 336 bochs->yres_virtual); 337 337 338 - bochs_hw_blank(bochs, false); 339 - 340 338 bochs_dispi_write(bochs, VBE_DISPI_INDEX_ENABLE, 0); 341 339 bochs_dispi_write(bochs, VBE_DISPI_INDEX_BPP, bochs->bpp); 342 340 bochs_dispi_write(bochs, VBE_DISPI_INDEX_XRES, bochs->xres); ··· 504 506 static void bochs_crtc_helper_atomic_enable(struct drm_crtc *crtc, 505 507 struct drm_atomic_state *state) 506 508 { 509 + struct bochs_device *bochs = to_bochs_device(crtc->dev); 510 + 511 + bochs_hw_blank(bochs, false); 507 512 } 508 513 509 514 static void bochs_crtc_helper_atomic_disable(struct drm_crtc *crtc,
-10
drivers/gpu/drm/xe/display/xe_plane_initial.c
··· 194 194 to_intel_plane(crtc->base.primary); 195 195 struct intel_plane_state *plane_state = 196 196 to_intel_plane_state(plane->base.state); 197 - struct intel_crtc_state *crtc_state = 198 - to_intel_crtc_state(crtc->base.state); 199 197 struct drm_framebuffer *fb; 200 198 struct i915_vma *vma; 201 199 ··· 239 241 atomic_or(plane->frontbuffer_bit, &to_intel_frontbuffer(fb)->bits); 240 242 241 243 plane_config->vma = vma; 242 - 243 - /* 244 - * Flip to the newly created mapping ASAP, so we can re-use the 245 - * first part of GGTT for WOPCM, prevent flickering, and prevent 246 - * the lookup of sysmem scratch pages. 247 - */ 248 - plane->check_plane(crtc_state, plane_state); 249 - plane->async_flip(NULL, plane, crtc_state, plane_state, true); 250 244 return; 251 245 252 246 nofb:
+2 -2
drivers/gpu/drm/xe/xe_gt.c
··· 380 380 if (err) 381 381 return err; 382 382 383 - xe_wa_process_gt(gt); 384 383 xe_wa_process_oob(gt); 385 - xe_tuning_process_gt(gt); 386 384 387 385 xe_force_wake_init_gt(gt, gt_to_fw(gt)); 388 386 spin_lock_init(&gt->global_invl_lock); ··· 472 474 } 473 475 474 476 xe_gt_mcr_set_implicit_defaults(gt); 477 + xe_wa_process_gt(gt); 478 + xe_tuning_process_gt(gt); 475 479 xe_reg_sr_apply_mmio(&gt->reg_sr, gt); 476 480 477 481 err = xe_gt_clock_init(gt);
+143 -51
drivers/gpu/drm/xe/xe_hmm.c
··· 19 19 return (end - start) >> PAGE_SHIFT; 20 20 } 21 21 22 - /* 22 + /** 23 23 * xe_mark_range_accessed() - mark a range is accessed, so core mm 24 24 * have such information for memory eviction or write back to 25 25 * hard disk 26 - * 27 26 * @range: the range to mark 28 27 * @write: if write to this range, we mark pages in this range 29 28 * as dirty ··· 42 43 } 43 44 } 44 45 45 - /* 46 + static int xe_alloc_sg(struct xe_device *xe, struct sg_table *st, 47 + struct hmm_range *range, struct rw_semaphore *notifier_sem) 48 + { 49 + unsigned long i, npages, hmm_pfn; 50 + unsigned long num_chunks = 0; 51 + int ret; 52 + 53 + /* HMM docs says this is needed. */ 54 + ret = down_read_interruptible(notifier_sem); 55 + if (ret) 56 + return ret; 57 + 58 + if (mmu_interval_read_retry(range->notifier, range->notifier_seq)) { 59 + up_read(notifier_sem); 60 + return -EAGAIN; 61 + } 62 + 63 + npages = xe_npages_in_range(range->start, range->end); 64 + for (i = 0; i < npages;) { 65 + unsigned long len; 66 + 67 + hmm_pfn = range->hmm_pfns[i]; 68 + xe_assert(xe, hmm_pfn & HMM_PFN_VALID); 69 + 70 + len = 1UL << hmm_pfn_to_map_order(hmm_pfn); 71 + 72 + /* If order > 0 the page may extend beyond range->start */ 73 + len -= (hmm_pfn & ~HMM_PFN_FLAGS) & (len - 1); 74 + i += len; 75 + num_chunks++; 76 + } 77 + up_read(notifier_sem); 78 + 79 + return sg_alloc_table(st, num_chunks, GFP_KERNEL); 80 + } 81 + 82 + /** 46 83 * xe_build_sg() - build a scatter gather table for all the physical pages/pfn 47 84 * in a hmm_range. dma-map pages if necessary. dma-address is save in sg table 48 85 * and will be used to program GPU page table later. 49 - * 50 86 * @xe: the xe device who will access the dma-address in sg table 51 87 * @range: the hmm range that we build the sg table from. range->hmm_pfns[] 52 88 * has the pfn numbers of pages that back up this hmm address range. 53 89 * @st: pointer to the sg table. 90 + * @notifier_sem: The xe notifier lock. 54 91 * @write: whether we write to this range. This decides dma map direction 55 92 * for system pages. If write we map it bi-diretional; otherwise 56 93 * DMA_TO_DEVICE ··· 113 78 * Returns 0 if successful; -ENOMEM if fails to allocate memory 114 79 */ 115 80 static int xe_build_sg(struct xe_device *xe, struct hmm_range *range, 116 - struct sg_table *st, bool write) 81 + struct sg_table *st, 82 + struct rw_semaphore *notifier_sem, 83 + bool write) 117 84 { 85 + unsigned long npages = xe_npages_in_range(range->start, range->end); 118 86 struct device *dev = xe->drm.dev; 119 - struct page **pages; 120 - u64 i, npages; 121 - int ret; 87 + struct scatterlist *sgl; 88 + struct page *page; 89 + unsigned long i, j; 122 90 123 - npages = xe_npages_in_range(range->start, range->end); 124 - pages = kvmalloc_array(npages, sizeof(*pages), GFP_KERNEL); 125 - if (!pages) 126 - return -ENOMEM; 91 + lockdep_assert_held(notifier_sem); 127 92 128 - for (i = 0; i < npages; i++) { 129 - pages[i] = hmm_pfn_to_page(range->hmm_pfns[i]); 130 - xe_assert(xe, !is_device_private_page(pages[i])); 93 + i = 0; 94 + for_each_sg(st->sgl, sgl, st->nents, j) { 95 + unsigned long hmm_pfn, size; 96 + 97 + hmm_pfn = range->hmm_pfns[i]; 98 + page = hmm_pfn_to_page(hmm_pfn); 99 + xe_assert(xe, !is_device_private_page(page)); 100 + 101 + size = 1UL << hmm_pfn_to_map_order(hmm_pfn); 102 + size -= page_to_pfn(page) & (size - 1); 103 + i += size; 104 + 105 + if (unlikely(j == st->nents - 1)) { 106 + if (i > npages) 107 + size -= (i - npages); 108 + sg_mark_end(sgl); 109 + } 110 + sg_set_page(sgl, page, size << PAGE_SHIFT, 0); 131 111 } 112 + xe_assert(xe, i == npages); 132 113 133 - ret = sg_alloc_table_from_pages_segment(st, pages, npages, 0, npages << PAGE_SHIFT, 134 - xe_sg_segment_size(dev), GFP_KERNEL); 135 - if (ret) 136 - goto free_pages; 137 - 138 - ret = dma_map_sgtable(dev, st, write ? DMA_BIDIRECTIONAL : DMA_TO_DEVICE, 139 - DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_NO_KERNEL_MAPPING); 140 - if (ret) { 141 - sg_free_table(st); 142 - st = NULL; 143 - } 144 - 145 - free_pages: 146 - kvfree(pages); 147 - return ret; 114 + return dma_map_sgtable(dev, st, write ? DMA_BIDIRECTIONAL : DMA_TO_DEVICE, 115 + DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_NO_KERNEL_MAPPING); 148 116 } 149 117 150 - /* 118 + static void xe_hmm_userptr_set_mapped(struct xe_userptr_vma *uvma) 119 + { 120 + struct xe_userptr *userptr = &uvma->userptr; 121 + struct xe_vm *vm = xe_vma_vm(&uvma->vma); 122 + 123 + lockdep_assert_held_write(&vm->lock); 124 + lockdep_assert_held(&vm->userptr.notifier_lock); 125 + 126 + mutex_lock(&userptr->unmap_mutex); 127 + xe_assert(vm->xe, !userptr->mapped); 128 + userptr->mapped = true; 129 + mutex_unlock(&userptr->unmap_mutex); 130 + } 131 + 132 + void xe_hmm_userptr_unmap(struct xe_userptr_vma *uvma) 133 + { 134 + struct xe_userptr *userptr = &uvma->userptr; 135 + struct xe_vma *vma = &uvma->vma; 136 + bool write = !xe_vma_read_only(vma); 137 + struct xe_vm *vm = xe_vma_vm(vma); 138 + struct xe_device *xe = vm->xe; 139 + 140 + if (!lockdep_is_held_type(&vm->userptr.notifier_lock, 0) && 141 + !lockdep_is_held_type(&vm->lock, 0) && 142 + !(vma->gpuva.flags & XE_VMA_DESTROYED)) { 143 + /* Don't unmap in exec critical section. */ 144 + xe_vm_assert_held(vm); 145 + /* Don't unmap while mapping the sg. */ 146 + lockdep_assert_held(&vm->lock); 147 + } 148 + 149 + mutex_lock(&userptr->unmap_mutex); 150 + if (userptr->sg && userptr->mapped) 151 + dma_unmap_sgtable(xe->drm.dev, userptr->sg, 152 + write ? DMA_BIDIRECTIONAL : DMA_TO_DEVICE, 0); 153 + userptr->mapped = false; 154 + mutex_unlock(&userptr->unmap_mutex); 155 + } 156 + 157 + /** 151 158 * xe_hmm_userptr_free_sg() - Free the scatter gather table of userptr 152 - * 153 159 * @uvma: the userptr vma which hold the scatter gather table 154 160 * 155 161 * With function xe_userptr_populate_range, we allocate storage of ··· 200 124 void xe_hmm_userptr_free_sg(struct xe_userptr_vma *uvma) 201 125 { 202 126 struct xe_userptr *userptr = &uvma->userptr; 203 - struct xe_vma *vma = &uvma->vma; 204 - bool write = !xe_vma_read_only(vma); 205 - struct xe_vm *vm = xe_vma_vm(vma); 206 - struct xe_device *xe = vm->xe; 207 - struct device *dev = xe->drm.dev; 208 127 209 - xe_assert(xe, userptr->sg); 210 - dma_unmap_sgtable(dev, userptr->sg, 211 - write ? DMA_BIDIRECTIONAL : DMA_TO_DEVICE, 0); 212 - 128 + xe_assert(xe_vma_vm(&uvma->vma)->xe, userptr->sg); 129 + xe_hmm_userptr_unmap(uvma); 213 130 sg_free_table(userptr->sg); 214 131 userptr->sg = NULL; 215 132 } ··· 235 166 { 236 167 unsigned long timeout = 237 168 jiffies + msecs_to_jiffies(HMM_RANGE_DEFAULT_TIMEOUT); 238 - unsigned long *pfns, flags = HMM_PFN_REQ_FAULT; 169 + unsigned long *pfns; 239 170 struct xe_userptr *userptr; 240 171 struct xe_vma *vma = &uvma->vma; 241 172 u64 userptr_start = xe_vma_userptr(vma); 242 173 u64 userptr_end = userptr_start + xe_vma_size(vma); 243 174 struct xe_vm *vm = xe_vma_vm(vma); 244 - struct hmm_range hmm_range; 175 + struct hmm_range hmm_range = { 176 + .pfn_flags_mask = 0, /* ignore pfns */ 177 + .default_flags = HMM_PFN_REQ_FAULT, 178 + .start = userptr_start, 179 + .end = userptr_end, 180 + .notifier = &uvma->userptr.notifier, 181 + .dev_private_owner = vm->xe, 182 + }; 245 183 bool write = !xe_vma_read_only(vma); 246 184 unsigned long notifier_seq; 247 185 u64 npages; ··· 275 199 return -ENOMEM; 276 200 277 201 if (write) 278 - flags |= HMM_PFN_REQ_WRITE; 202 + hmm_range.default_flags |= HMM_PFN_REQ_WRITE; 279 203 280 204 if (!mmget_not_zero(userptr->notifier.mm)) { 281 205 ret = -EFAULT; 282 206 goto free_pfns; 283 207 } 284 208 285 - hmm_range.default_flags = flags; 286 209 hmm_range.hmm_pfns = pfns; 287 - hmm_range.notifier = &userptr->notifier; 288 - hmm_range.start = userptr_start; 289 - hmm_range.end = userptr_end; 290 - hmm_range.dev_private_owner = vm->xe; 291 210 292 211 while (true) { 293 212 hmm_range.notifier_seq = mmu_interval_read_begin(&userptr->notifier); ··· 309 238 if (ret) 310 239 goto free_pfns; 311 240 312 - ret = xe_build_sg(vm->xe, &hmm_range, &userptr->sgt, write); 241 + ret = xe_alloc_sg(vm->xe, &userptr->sgt, &hmm_range, &vm->userptr.notifier_lock); 313 242 if (ret) 314 243 goto free_pfns; 315 244 245 + ret = down_read_interruptible(&vm->userptr.notifier_lock); 246 + if (ret) 247 + goto free_st; 248 + 249 + if (mmu_interval_read_retry(hmm_range.notifier, hmm_range.notifier_seq)) { 250 + ret = -EAGAIN; 251 + goto out_unlock; 252 + } 253 + 254 + ret = xe_build_sg(vm->xe, &hmm_range, &userptr->sgt, 255 + &vm->userptr.notifier_lock, write); 256 + if (ret) 257 + goto out_unlock; 258 + 316 259 xe_mark_range_accessed(&hmm_range, write); 317 260 userptr->sg = &userptr->sgt; 261 + xe_hmm_userptr_set_mapped(uvma); 318 262 userptr->notifier_seq = hmm_range.notifier_seq; 263 + up_read(&vm->userptr.notifier_lock); 264 + kvfree(pfns); 265 + return 0; 319 266 267 + out_unlock: 268 + up_read(&vm->userptr.notifier_lock); 269 + free_st: 270 + sg_free_table(&userptr->sgt); 320 271 free_pfns: 321 272 kvfree(pfns); 322 273 return ret; 323 274 } 324 -
+7
drivers/gpu/drm/xe/xe_hmm.h
··· 3 3 * Copyright © 2024 Intel Corporation 4 4 */ 5 5 6 + #ifndef _XE_HMM_H_ 7 + #define _XE_HMM_H_ 8 + 6 9 #include <linux/types.h> 7 10 8 11 struct xe_userptr_vma; 9 12 10 13 int xe_hmm_userptr_populate_range(struct xe_userptr_vma *uvma, bool is_mm_mmap_locked); 14 + 11 15 void xe_hmm_userptr_free_sg(struct xe_userptr_vma *uvma); 16 + 17 + void xe_hmm_userptr_unmap(struct xe_userptr_vma *uvma); 18 + #endif
+49 -47
drivers/gpu/drm/xe/xe_pt.c
··· 28 28 struct xe_pt pt; 29 29 /** @children: Array of page-table child nodes */ 30 30 struct xe_ptw *children[XE_PDES]; 31 + /** @staging: Array of page-table staging nodes */ 32 + struct xe_ptw *staging[XE_PDES]; 31 33 }; 32 34 33 35 #if IS_ENABLED(CONFIG_DRM_XE_DEBUG_VM) ··· 50 48 return container_of(pt, struct xe_pt_dir, pt); 51 49 } 52 50 53 - static struct xe_pt *xe_pt_entry(struct xe_pt_dir *pt_dir, unsigned int index) 51 + static struct xe_pt * 52 + xe_pt_entry_staging(struct xe_pt_dir *pt_dir, unsigned int index) 54 53 { 55 - return container_of(pt_dir->children[index], struct xe_pt, base); 54 + return container_of(pt_dir->staging[index], struct xe_pt, base); 56 55 } 57 56 58 57 static u64 __xe_pt_empty_pte(struct xe_tile *tile, struct xe_vm *vm, ··· 128 125 } 129 126 pt->bo = bo; 130 127 pt->base.children = level ? as_xe_pt_dir(pt)->children : NULL; 128 + pt->base.staging = level ? as_xe_pt_dir(pt)->staging : NULL; 131 129 132 130 if (vm->xef) 133 131 xe_drm_client_add_bo(vm->xef->client, pt->bo); ··· 210 206 struct xe_pt_dir *pt_dir = as_xe_pt_dir(pt); 211 207 212 208 for (i = 0; i < XE_PDES; i++) { 213 - if (xe_pt_entry(pt_dir, i)) 214 - xe_pt_destroy(xe_pt_entry(pt_dir, i), flags, 209 + if (xe_pt_entry_staging(pt_dir, i)) 210 + xe_pt_destroy(xe_pt_entry_staging(pt_dir, i), flags, 215 211 deferred); 216 212 } 217 213 } ··· 380 376 /* Continue building a non-connected subtree. */ 381 377 struct iosys_map *map = &parent->bo->vmap; 382 378 383 - if (unlikely(xe_child)) 379 + if (unlikely(xe_child)) { 384 380 parent->base.children[offset] = &xe_child->base; 381 + parent->base.staging[offset] = &xe_child->base; 382 + } 385 383 386 384 xe_pt_write(xe_walk->vm->xe, map, offset, pte); 387 385 parent->num_live++; ··· 620 614 .ops = &xe_pt_stage_bind_ops, 621 615 .shifts = xe_normal_pt_shifts, 622 616 .max_level = XE_PT_HIGHEST_LEVEL, 617 + .staging = true, 623 618 }, 624 619 .vm = xe_vma_vm(vma), 625 620 .tile = tile, ··· 880 873 } 881 874 } 882 875 883 - static void xe_pt_commit_locks_assert(struct xe_vma *vma) 876 + static void xe_pt_commit_prepare_locks_assert(struct xe_vma *vma) 884 877 { 885 878 struct xe_vm *vm = xe_vma_vm(vma); 886 879 ··· 890 883 dma_resv_assert_held(xe_vma_bo(vma)->ttm.base.resv); 891 884 892 885 xe_vm_assert_held(vm); 886 + } 887 + 888 + static void xe_pt_commit_locks_assert(struct xe_vma *vma) 889 + { 890 + struct xe_vm *vm = xe_vma_vm(vma); 891 + 892 + xe_pt_commit_prepare_locks_assert(vma); 893 + 894 + if (xe_vma_is_userptr(vma)) 895 + lockdep_assert_held_read(&vm->userptr.notifier_lock); 893 896 } 894 897 895 898 static void xe_pt_commit(struct xe_vma *vma, ··· 912 895 913 896 for (i = 0; i < num_entries; i++) { 914 897 struct xe_pt *pt = entries[i].pt; 898 + struct xe_pt_dir *pt_dir; 915 899 916 900 if (!pt->level) 917 901 continue; 918 902 903 + pt_dir = as_xe_pt_dir(pt); 919 904 for (j = 0; j < entries[i].qwords; j++) { 920 905 struct xe_pt *oldpte = entries[i].pt_entries[j].pt; 906 + int j_ = j + entries[i].ofs; 921 907 908 + pt_dir->children[j_] = pt_dir->staging[j_]; 922 909 xe_pt_destroy(oldpte, xe_vma_vm(vma)->flags, deferred); 923 910 } 924 911 } ··· 934 913 { 935 914 int i, j; 936 915 937 - xe_pt_commit_locks_assert(vma); 916 + xe_pt_commit_prepare_locks_assert(vma); 938 917 939 918 for (i = num_entries - 1; i >= 0; --i) { 940 919 struct xe_pt *pt = entries[i].pt; ··· 949 928 pt_dir = as_xe_pt_dir(pt); 950 929 for (j = 0; j < entries[i].qwords; j++) { 951 930 u32 j_ = j + entries[i].ofs; 952 - struct xe_pt *newpte = xe_pt_entry(pt_dir, j_); 931 + struct xe_pt *newpte = xe_pt_entry_staging(pt_dir, j_); 953 932 struct xe_pt *oldpte = entries[i].pt_entries[j].pt; 954 933 955 - pt_dir->children[j_] = oldpte ? &oldpte->base : 0; 934 + pt_dir->staging[j_] = oldpte ? &oldpte->base : 0; 956 935 xe_pt_destroy(newpte, xe_vma_vm(vma)->flags, NULL); 957 936 } 958 937 } ··· 964 943 { 965 944 u32 i, j; 966 945 967 - xe_pt_commit_locks_assert(vma); 946 + xe_pt_commit_prepare_locks_assert(vma); 968 947 969 948 for (i = 0; i < num_entries; i++) { 970 949 struct xe_pt *pt = entries[i].pt; ··· 982 961 struct xe_pt *newpte = entries[i].pt_entries[j].pt; 983 962 struct xe_pt *oldpte = NULL; 984 963 985 - if (xe_pt_entry(pt_dir, j_)) 986 - oldpte = xe_pt_entry(pt_dir, j_); 964 + if (xe_pt_entry_staging(pt_dir, j_)) 965 + oldpte = xe_pt_entry_staging(pt_dir, j_); 987 966 988 - pt_dir->children[j_] = &newpte->base; 967 + pt_dir->staging[j_] = &newpte->base; 989 968 entries[i].pt_entries[j].pt = oldpte; 990 969 } 991 970 } ··· 1234 1213 return 0; 1235 1214 1236 1215 uvma = to_userptr_vma(vma); 1216 + if (xe_pt_userptr_inject_eagain(uvma)) 1217 + xe_vma_userptr_force_invalidate(uvma); 1218 + 1237 1219 notifier_seq = uvma->userptr.notifier_seq; 1238 1220 1239 - if (uvma->userptr.initial_bind && !xe_vm_in_fault_mode(vm)) 1240 - return 0; 1241 - 1242 1221 if (!mmu_interval_read_retry(&uvma->userptr.notifier, 1243 - notifier_seq) && 1244 - !xe_pt_userptr_inject_eagain(uvma)) 1222 + notifier_seq)) 1245 1223 return 0; 1246 1224 1247 - if (xe_vm_in_fault_mode(vm)) { 1225 + if (xe_vm_in_fault_mode(vm)) 1248 1226 return -EAGAIN; 1249 - } else { 1250 - spin_lock(&vm->userptr.invalidated_lock); 1251 - list_move_tail(&uvma->userptr.invalidate_link, 1252 - &vm->userptr.invalidated); 1253 - spin_unlock(&vm->userptr.invalidated_lock); 1254 1227 1255 - if (xe_vm_in_preempt_fence_mode(vm)) { 1256 - struct dma_resv_iter cursor; 1257 - struct dma_fence *fence; 1258 - long err; 1259 - 1260 - dma_resv_iter_begin(&cursor, xe_vm_resv(vm), 1261 - DMA_RESV_USAGE_BOOKKEEP); 1262 - dma_resv_for_each_fence_unlocked(&cursor, fence) 1263 - dma_fence_enable_sw_signaling(fence); 1264 - dma_resv_iter_end(&cursor); 1265 - 1266 - err = dma_resv_wait_timeout(xe_vm_resv(vm), 1267 - DMA_RESV_USAGE_BOOKKEEP, 1268 - false, MAX_SCHEDULE_TIMEOUT); 1269 - XE_WARN_ON(err <= 0); 1270 - } 1271 - } 1272 - 1228 + /* 1229 + * Just continue the operation since exec or rebind worker 1230 + * will take care of rebinding. 1231 + */ 1273 1232 return 0; 1274 1233 } 1275 1234 ··· 1515 1514 .ops = &xe_pt_stage_unbind_ops, 1516 1515 .shifts = xe_normal_pt_shifts, 1517 1516 .max_level = XE_PT_HIGHEST_LEVEL, 1517 + .staging = true, 1518 1518 }, 1519 1519 .tile = tile, 1520 1520 .modified_start = xe_vma_start(vma), ··· 1557 1555 { 1558 1556 int i, j; 1559 1557 1560 - xe_pt_commit_locks_assert(vma); 1558 + xe_pt_commit_prepare_locks_assert(vma); 1561 1559 1562 1560 for (i = num_entries - 1; i >= 0; --i) { 1563 1561 struct xe_vm_pgtable_update *entry = &entries[i]; ··· 1570 1568 continue; 1571 1569 1572 1570 for (j = entry->ofs; j < entry->ofs + entry->qwords; j++) 1573 - pt_dir->children[j] = 1571 + pt_dir->staging[j] = 1574 1572 entries[i].pt_entries[j - entry->ofs].pt ? 1575 1573 &entries[i].pt_entries[j - entry->ofs].pt->base : NULL; 1576 1574 } ··· 1583 1581 { 1584 1582 int i, j; 1585 1583 1586 - xe_pt_commit_locks_assert(vma); 1584 + xe_pt_commit_prepare_locks_assert(vma); 1587 1585 1588 1586 for (i = 0; i < num_entries; ++i) { 1589 1587 struct xe_vm_pgtable_update *entry = &entries[i]; ··· 1597 1595 pt_dir = as_xe_pt_dir(pt); 1598 1596 for (j = entry->ofs; j < entry->ofs + entry->qwords; j++) { 1599 1597 entry->pt_entries[j - entry->ofs].pt = 1600 - xe_pt_entry(pt_dir, j); 1601 - pt_dir->children[j] = NULL; 1598 + xe_pt_entry_staging(pt_dir, j); 1599 + pt_dir->staging[j] = NULL; 1602 1600 } 1603 1601 } 1604 1602 }
+2 -1
drivers/gpu/drm/xe/xe_pt_walk.c
··· 74 74 u64 addr, u64 end, struct xe_pt_walk *walk) 75 75 { 76 76 pgoff_t offset = xe_pt_offset(addr, level, walk); 77 - struct xe_ptw **entries = parent->children ? parent->children : NULL; 77 + struct xe_ptw **entries = walk->staging ? (parent->staging ?: NULL) : 78 + (parent->children ?: NULL); 78 79 const struct xe_pt_walk_ops *ops = walk->ops; 79 80 enum page_walk_action action; 80 81 struct xe_ptw *child;
+4
drivers/gpu/drm/xe/xe_pt_walk.h
··· 11 11 /** 12 12 * struct xe_ptw - base class for driver pagetable subclassing. 13 13 * @children: Pointer to an array of children if any. 14 + * @staging: Pointer to an array of staging if any. 14 15 * 15 16 * Drivers could subclass this, and if it's a page-directory, typically 16 17 * embed an array of xe_ptw pointers. 17 18 */ 18 19 struct xe_ptw { 19 20 struct xe_ptw **children; 21 + struct xe_ptw **staging; 20 22 }; 21 23 22 24 /** ··· 43 41 * as shared pagetables. 44 42 */ 45 43 bool shared_pt_mode; 44 + /** @staging: Walk staging PT structure */ 45 + bool staging; 46 46 }; 47 47 48 48 /**
+70 -30
drivers/gpu/drm/xe/xe_vm.c
··· 579 579 trace_xe_vm_rebind_worker_exit(vm); 580 580 } 581 581 582 - static bool vma_userptr_invalidate(struct mmu_interval_notifier *mni, 583 - const struct mmu_notifier_range *range, 584 - unsigned long cur_seq) 582 + static void __vma_userptr_invalidate(struct xe_vm *vm, struct xe_userptr_vma *uvma) 585 583 { 586 - struct xe_userptr *userptr = container_of(mni, typeof(*userptr), notifier); 587 - struct xe_userptr_vma *uvma = container_of(userptr, typeof(*uvma), userptr); 584 + struct xe_userptr *userptr = &uvma->userptr; 588 585 struct xe_vma *vma = &uvma->vma; 589 - struct xe_vm *vm = xe_vma_vm(vma); 590 586 struct dma_resv_iter cursor; 591 587 struct dma_fence *fence; 592 588 long err; 593 - 594 - xe_assert(vm->xe, xe_vma_is_userptr(vma)); 595 - trace_xe_vma_userptr_invalidate(vma); 596 - 597 - if (!mmu_notifier_range_blockable(range)) 598 - return false; 599 - 600 - vm_dbg(&xe_vma_vm(vma)->xe->drm, 601 - "NOTIFIER: addr=0x%016llx, range=0x%016llx", 602 - xe_vma_start(vma), xe_vma_size(vma)); 603 - 604 - down_write(&vm->userptr.notifier_lock); 605 - mmu_interval_set_seq(mni, cur_seq); 606 - 607 - /* No need to stop gpu access if the userptr is not yet bound. */ 608 - if (!userptr->initial_bind) { 609 - up_write(&vm->userptr.notifier_lock); 610 - return true; 611 - } 612 589 613 590 /* 614 591 * Tell exec and rebind worker they need to repin and rebind this 615 592 * userptr. 616 593 */ 617 594 if (!xe_vm_in_fault_mode(vm) && 618 - !(vma->gpuva.flags & XE_VMA_DESTROYED) && vma->tile_present) { 595 + !(vma->gpuva.flags & XE_VMA_DESTROYED)) { 619 596 spin_lock(&vm->userptr.invalidated_lock); 620 597 list_move_tail(&userptr->invalidate_link, 621 598 &vm->userptr.invalidated); 622 599 spin_unlock(&vm->userptr.invalidated_lock); 623 600 } 624 - 625 - up_write(&vm->userptr.notifier_lock); 626 601 627 602 /* 628 603 * Preempt fences turn into schedule disables, pipeline these. ··· 616 641 false, MAX_SCHEDULE_TIMEOUT); 617 642 XE_WARN_ON(err <= 0); 618 643 619 - if (xe_vm_in_fault_mode(vm)) { 644 + if (xe_vm_in_fault_mode(vm) && userptr->initial_bind) { 620 645 err = xe_vm_invalidate_vma(vma); 621 646 XE_WARN_ON(err); 622 647 } 623 648 649 + xe_hmm_userptr_unmap(uvma); 650 + } 651 + 652 + static bool vma_userptr_invalidate(struct mmu_interval_notifier *mni, 653 + const struct mmu_notifier_range *range, 654 + unsigned long cur_seq) 655 + { 656 + struct xe_userptr_vma *uvma = container_of(mni, typeof(*uvma), userptr.notifier); 657 + struct xe_vma *vma = &uvma->vma; 658 + struct xe_vm *vm = xe_vma_vm(vma); 659 + 660 + xe_assert(vm->xe, xe_vma_is_userptr(vma)); 661 + trace_xe_vma_userptr_invalidate(vma); 662 + 663 + if (!mmu_notifier_range_blockable(range)) 664 + return false; 665 + 666 + vm_dbg(&xe_vma_vm(vma)->xe->drm, 667 + "NOTIFIER: addr=0x%016llx, range=0x%016llx", 668 + xe_vma_start(vma), xe_vma_size(vma)); 669 + 670 + down_write(&vm->userptr.notifier_lock); 671 + mmu_interval_set_seq(mni, cur_seq); 672 + 673 + __vma_userptr_invalidate(vm, uvma); 674 + up_write(&vm->userptr.notifier_lock); 624 675 trace_xe_vma_userptr_invalidate_complete(vma); 625 676 626 677 return true; ··· 655 654 static const struct mmu_interval_notifier_ops vma_userptr_notifier_ops = { 656 655 .invalidate = vma_userptr_invalidate, 657 656 }; 657 + 658 + #if IS_ENABLED(CONFIG_DRM_XE_USERPTR_INVAL_INJECT) 659 + /** 660 + * xe_vma_userptr_force_invalidate() - force invalidate a userptr 661 + * @uvma: The userptr vma to invalidate 662 + * 663 + * Perform a forced userptr invalidation for testing purposes. 664 + */ 665 + void xe_vma_userptr_force_invalidate(struct xe_userptr_vma *uvma) 666 + { 667 + struct xe_vm *vm = xe_vma_vm(&uvma->vma); 668 + 669 + /* Protect against concurrent userptr pinning */ 670 + lockdep_assert_held(&vm->lock); 671 + /* Protect against concurrent notifiers */ 672 + lockdep_assert_held(&vm->userptr.notifier_lock); 673 + /* 674 + * Protect against concurrent instances of this function and 675 + * the critical exec sections 676 + */ 677 + xe_vm_assert_held(vm); 678 + 679 + if (!mmu_interval_read_retry(&uvma->userptr.notifier, 680 + uvma->userptr.notifier_seq)) 681 + uvma->userptr.notifier_seq -= 2; 682 + __vma_userptr_invalidate(vm, uvma); 683 + } 684 + #endif 658 685 659 686 int xe_vm_userptr_pin(struct xe_vm *vm) 660 687 { ··· 1041 1012 INIT_LIST_HEAD(&userptr->invalidate_link); 1042 1013 INIT_LIST_HEAD(&userptr->repin_link); 1043 1014 vma->gpuva.gem.offset = bo_offset_or_userptr; 1015 + mutex_init(&userptr->unmap_mutex); 1044 1016 1045 1017 err = mmu_interval_notifier_insert(&userptr->notifier, 1046 1018 current->mm, ··· 1083 1053 * them anymore 1084 1054 */ 1085 1055 mmu_interval_notifier_remove(&userptr->notifier); 1056 + mutex_destroy(&userptr->unmap_mutex); 1086 1057 xe_vm_put(vm); 1087 1058 } else if (xe_vma_is_null(vma)) { 1088 1059 xe_vm_put(vm); ··· 2317 2286 break; 2318 2287 } 2319 2288 case DRM_GPUVA_OP_UNMAP: 2289 + xe_vma_ops_incr_pt_update_ops(vops, op->tile_mask); 2290 + break; 2320 2291 case DRM_GPUVA_OP_PREFETCH: 2321 - /* FIXME: Need to skip some prefetch ops */ 2292 + vma = gpuva_to_vma(op->base.prefetch.va); 2293 + 2294 + if (xe_vma_is_userptr(vma)) { 2295 + err = xe_vma_userptr_pin_pages(to_userptr_vma(vma)); 2296 + if (err) 2297 + return err; 2298 + } 2299 + 2322 2300 xe_vma_ops_incr_pt_update_ops(vops, op->tile_mask); 2323 2301 break; 2324 2302 default:
+9 -1
drivers/gpu/drm/xe/xe_vm.h
··· 274 274 const char *format, ...) 275 275 { /* noop */ } 276 276 #endif 277 - #endif 278 277 279 278 struct xe_vm_snapshot *xe_vm_snapshot_capture(struct xe_vm *vm); 280 279 void xe_vm_snapshot_capture_delayed(struct xe_vm_snapshot *snap); 281 280 void xe_vm_snapshot_print(struct xe_vm_snapshot *snap, struct drm_printer *p); 282 281 void xe_vm_snapshot_free(struct xe_vm_snapshot *snap); 282 + 283 + #if IS_ENABLED(CONFIG_DRM_XE_USERPTR_INVAL_INJECT) 284 + void xe_vma_userptr_force_invalidate(struct xe_userptr_vma *uvma); 285 + #else 286 + static inline void xe_vma_userptr_force_invalidate(struct xe_userptr_vma *uvma) 287 + { 288 + } 289 + #endif 290 + #endif
+6 -2
drivers/gpu/drm/xe/xe_vm_types.h
··· 59 59 struct sg_table *sg; 60 60 /** @notifier_seq: notifier sequence number */ 61 61 unsigned long notifier_seq; 62 + /** @unmap_mutex: Mutex protecting dma-unmapping */ 63 + struct mutex unmap_mutex; 62 64 /** 63 65 * @initial_bind: user pointer has been bound at least once. 64 66 * write: vm->userptr.notifier_lock in read mode and vm->resv held. 65 67 * read: vm->userptr.notifier_lock in write mode or vm->resv held. 66 68 */ 67 69 bool initial_bind; 70 + /** @mapped: Whether the @sgt sg-table is dma-mapped. Protected by @unmap_mutex. */ 71 + bool mapped; 68 72 #if IS_ENABLED(CONFIG_DRM_XE_USERPTR_INVAL_INJECT) 69 73 u32 divisor; 70 74 #endif ··· 231 227 * up for revalidation. Protected from access with the 232 228 * @invalidated_lock. Removing items from the list 233 229 * additionally requires @lock in write mode, and adding 234 - * items to the list requires the @userptr.notifer_lock in 235 - * write mode. 230 + * items to the list requires either the @userptr.notifer_lock in 231 + * write mode, OR @lock in write mode. 236 232 */ 237 233 struct list_head invalidated; 238 234 } userptr;
+13
drivers/hv/vmbus_drv.c
··· 2262 2262 struct resource *iter; 2263 2263 2264 2264 mutex_lock(&hyperv_mmio_lock); 2265 + 2266 + /* 2267 + * If all bytes of the MMIO range to be released are within the 2268 + * special case fb_mmio shadow region, skip releasing the shadow 2269 + * region since no corresponding __request_region() was done 2270 + * in vmbus_allocate_mmio(). 2271 + */ 2272 + if (fb_mmio && start >= fb_mmio->start && 2273 + (start + size - 1 <= fb_mmio->end)) 2274 + goto skip_shadow_release; 2275 + 2265 2276 for (iter = hyperv_mmio; iter; iter = iter->sibling) { 2266 2277 if ((iter->start >= start + size) || (iter->end <= start)) 2267 2278 continue; 2268 2279 2269 2280 __release_region(iter, start, size); 2270 2281 } 2282 + 2283 + skip_shadow_release: 2271 2284 release_mem_region(start, size); 2272 2285 mutex_unlock(&hyperv_mmio_lock); 2273 2286
+10
drivers/hwmon/ad7314.c
··· 22 22 */ 23 23 #define AD7314_TEMP_MASK 0x7FE0 24 24 #define AD7314_TEMP_SHIFT 5 25 + #define AD7314_LEADING_ZEROS_MASK BIT(15) 25 26 26 27 /* 27 28 * ADT7301 and ADT7302 temperature masks 28 29 */ 29 30 #define ADT7301_TEMP_MASK 0x3FFF 31 + #define ADT7301_LEADING_ZEROS_MASK (BIT(15) | BIT(14)) 30 32 31 33 enum ad7314_variant { 32 34 adt7301, ··· 67 65 return ret; 68 66 switch (spi_get_device_id(chip->spi_dev)->driver_data) { 69 67 case ad7314: 68 + if (ret & AD7314_LEADING_ZEROS_MASK) { 69 + /* Invalid read-out, leading zero part is missing */ 70 + return -EIO; 71 + } 70 72 data = (ret & AD7314_TEMP_MASK) >> AD7314_TEMP_SHIFT; 71 73 data = sign_extend32(data, 9); 72 74 73 75 return sprintf(buf, "%d\n", 250 * data); 74 76 case adt7301: 75 77 case adt7302: 78 + if (ret & ADT7301_LEADING_ZEROS_MASK) { 79 + /* Invalid read-out, leading zero part is missing */ 80 + return -EIO; 81 + } 76 82 /* 77 83 * Documented as a 13 bit twos complement register 78 84 * with a sign bit - which is a 14 bit 2's complement
+33 -33
drivers/hwmon/ntc_thermistor.c
··· 181 181 }; 182 182 183 183 static const struct ntc_compensation ncpXXxh103[] = { 184 - { .temp_c = -40, .ohm = 247565 }, 185 - { .temp_c = -35, .ohm = 181742 }, 186 - { .temp_c = -30, .ohm = 135128 }, 187 - { .temp_c = -25, .ohm = 101678 }, 188 - { .temp_c = -20, .ohm = 77373 }, 189 - { .temp_c = -15, .ohm = 59504 }, 190 - { .temp_c = -10, .ohm = 46222 }, 191 - { .temp_c = -5, .ohm = 36244 }, 192 - { .temp_c = 0, .ohm = 28674 }, 193 - { .temp_c = 5, .ohm = 22878 }, 194 - { .temp_c = 10, .ohm = 18399 }, 195 - { .temp_c = 15, .ohm = 14910 }, 196 - { .temp_c = 20, .ohm = 12169 }, 184 + { .temp_c = -40, .ohm = 195652 }, 185 + { .temp_c = -35, .ohm = 148171 }, 186 + { .temp_c = -30, .ohm = 113347 }, 187 + { .temp_c = -25, .ohm = 87559 }, 188 + { .temp_c = -20, .ohm = 68237 }, 189 + { .temp_c = -15, .ohm = 53650 }, 190 + { .temp_c = -10, .ohm = 42506 }, 191 + { .temp_c = -5, .ohm = 33892 }, 192 + { .temp_c = 0, .ohm = 27219 }, 193 + { .temp_c = 5, .ohm = 22021 }, 194 + { .temp_c = 10, .ohm = 17926 }, 195 + { .temp_c = 15, .ohm = 14674 }, 196 + { .temp_c = 20, .ohm = 12081 }, 197 197 { .temp_c = 25, .ohm = 10000 }, 198 - { .temp_c = 30, .ohm = 8271 }, 199 - { .temp_c = 35, .ohm = 6883 }, 200 - { .temp_c = 40, .ohm = 5762 }, 201 - { .temp_c = 45, .ohm = 4851 }, 202 - { .temp_c = 50, .ohm = 4105 }, 203 - { .temp_c = 55, .ohm = 3492 }, 204 - { .temp_c = 60, .ohm = 2985 }, 205 - { .temp_c = 65, .ohm = 2563 }, 206 - { .temp_c = 70, .ohm = 2211 }, 207 - { .temp_c = 75, .ohm = 1915 }, 208 - { .temp_c = 80, .ohm = 1666 }, 209 - { .temp_c = 85, .ohm = 1454 }, 210 - { .temp_c = 90, .ohm = 1275 }, 211 - { .temp_c = 95, .ohm = 1121 }, 212 - { .temp_c = 100, .ohm = 990 }, 213 - { .temp_c = 105, .ohm = 876 }, 214 - { .temp_c = 110, .ohm = 779 }, 215 - { .temp_c = 115, .ohm = 694 }, 216 - { .temp_c = 120, .ohm = 620 }, 217 - { .temp_c = 125, .ohm = 556 }, 198 + { .temp_c = 30, .ohm = 8315 }, 199 + { .temp_c = 35, .ohm = 6948 }, 200 + { .temp_c = 40, .ohm = 5834 }, 201 + { .temp_c = 45, .ohm = 4917 }, 202 + { .temp_c = 50, .ohm = 4161 }, 203 + { .temp_c = 55, .ohm = 3535 }, 204 + { .temp_c = 60, .ohm = 3014 }, 205 + { .temp_c = 65, .ohm = 2586 }, 206 + { .temp_c = 70, .ohm = 2228 }, 207 + { .temp_c = 75, .ohm = 1925 }, 208 + { .temp_c = 80, .ohm = 1669 }, 209 + { .temp_c = 85, .ohm = 1452 }, 210 + { .temp_c = 90, .ohm = 1268 }, 211 + { .temp_c = 95, .ohm = 1110 }, 212 + { .temp_c = 100, .ohm = 974 }, 213 + { .temp_c = 105, .ohm = 858 }, 214 + { .temp_c = 110, .ohm = 758 }, 215 + { .temp_c = 115, .ohm = 672 }, 216 + { .temp_c = 120, .ohm = 596 }, 217 + { .temp_c = 125, .ohm = 531 }, 218 218 }; 219 219 220 220 /*
+4 -6
drivers/hwmon/peci/dimmtemp.c
··· 127 127 return 0; 128 128 129 129 ret = priv->gen_info->read_thresholds(priv, dimm_order, chan_rank, &data); 130 - if (ret == -ENODATA) /* Use default or previous value */ 131 - return 0; 132 130 if (ret) 133 131 return ret; 134 132 ··· 507 509 508 510 ret = peci_ep_pci_local_read(priv->peci_dev, 0, 13, 0, 2, 0xd4, &reg_val); 509 511 if (ret || !(reg_val & BIT(31))) 510 - return -ENODATA; /* Use default or previous value */ 512 + return -ENODATA; 511 513 512 514 ret = peci_ep_pci_local_read(priv->peci_dev, 0, 13, 0, 2, 0xd0, &reg_val); 513 515 if (ret) 514 - return -ENODATA; /* Use default or previous value */ 516 + return -ENODATA; 515 517 516 518 /* 517 519 * Device 26, Offset 224e0: IMC 0 channel 0 -> rank 0 ··· 544 546 545 547 ret = peci_ep_pci_local_read(priv->peci_dev, 0, 30, 0, 2, 0xd4, &reg_val); 546 548 if (ret || !(reg_val & BIT(31))) 547 - return -ENODATA; /* Use default or previous value */ 549 + return -ENODATA; 548 550 549 551 ret = peci_ep_pci_local_read(priv->peci_dev, 0, 30, 0, 2, 0xd0, &reg_val); 550 552 if (ret) 551 - return -ENODATA; /* Use default or previous value */ 553 + return -ENODATA; 552 554 553 555 /* 554 556 * Device 26, Offset 219a8: IMC 0 channel 0 -> rank 0
+2
drivers/hwmon/pmbus/pmbus.c
··· 103 103 if (pmbus_check_byte_register(client, 0, PMBUS_PAGE)) { 104 104 int page; 105 105 106 + info->pages = PMBUS_PAGES; 107 + 106 108 for (page = 1; page < PMBUS_PAGES; page++) { 107 109 if (pmbus_set_page(client, page, 0xff) < 0) 108 110 break;
+1 -1
drivers/hwmon/xgene-hwmon.c
··· 706 706 goto out; 707 707 } 708 708 709 - if (!ctx->pcc_comm_addr) { 709 + if (IS_ERR_OR_NULL(ctx->pcc_comm_addr)) { 710 710 dev_err(&pdev->dev, 711 711 "Failed to ioremap PCC comm region\n"); 712 712 rc = -ENOMEM;
+11 -2
drivers/hwtracing/intel_th/msu.c
··· 105 105 106 106 /** 107 107 * struct msc - MSC device representation 108 - * @reg_base: register window base address 108 + * @reg_base: register window base address for the entire MSU 109 + * @msu_base: register window base address for this MSC 109 110 * @thdev: intel_th_device pointer 110 111 * @mbuf: MSU buffer, if assigned 111 - * @mbuf_priv MSU buffer's private data, if @mbuf 112 + * @mbuf_priv: MSU buffer's private data, if @mbuf 113 + * @work: a work to stop the trace when the buffer is full 112 114 * @win_list: list of windows in multiblock mode 113 115 * @single_sgt: single mode buffer 114 116 * @cur_win: current window 117 + * @switch_on_unlock: window to switch to when it becomes available 115 118 * @nr_pages: total number of pages allocated for this buffer 116 119 * @single_sz: amount of data in single mode 117 120 * @single_wrap: single mode wrap occurred 118 121 * @base: buffer's base pointer 119 122 * @base_addr: buffer's base address 123 + * @orig_addr: MSC0 buffer's base address 124 + * @orig_sz: MSC0 buffer's size 120 125 * @user_count: number of users of the buffer 121 126 * @mmap_count: number of mappings 122 127 * @buf_mutex: mutex to serialize access to buffer-related bits 128 + * @iter_list: list of open file descriptor iterators 129 + * @stop_on_full: stop the trace if the current window is full 123 130 * @enabled: MSC is enabled 124 131 * @wrap: wrapping is enabled 132 + * @do_irq: IRQ resource is available, handle interrupts 133 + * @multi_is_broken: multiblock mode enabled (not disabled by PCI drvdata) 125 134 * @mode: MSC operating mode 126 135 * @burst_len: write burst length 127 136 * @index: number of this MSC in the MSU
+15
drivers/hwtracing/intel_th/pci.c
··· 335 335 .driver_data = (kernel_ulong_t)&intel_th_2x, 336 336 }, 337 337 { 338 + /* Arrow Lake */ 339 + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x7724), 340 + .driver_data = (kernel_ulong_t)&intel_th_2x, 341 + }, 342 + { 343 + /* Panther Lake-H */ 344 + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe324), 345 + .driver_data = (kernel_ulong_t)&intel_th_2x, 346 + }, 347 + { 348 + /* Panther Lake-P/U */ 349 + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe424), 350 + .driver_data = (kernel_ulong_t)&intel_th_2x, 351 + }, 352 + { 338 353 /* Alder Lake CPU */ 339 354 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x466f), 340 355 .driver_data = (kernel_ulong_t)&intel_th_2x,
+1 -1
drivers/iio/adc/ad7192.c
··· 1084 1084 1085 1085 conf &= ~AD7192_CONF_CHAN_MASK; 1086 1086 for_each_set_bit(i, scan_mask, 8) 1087 - conf |= FIELD_PREP(AD7192_CONF_CHAN_MASK, i); 1087 + conf |= FIELD_PREP(AD7192_CONF_CHAN_MASK, BIT(i)); 1088 1088 1089 1089 ret = ad_sd_write_reg(&st->sd, AD7192_REG_CONF, 3, conf); 1090 1090 if (ret < 0)
+1 -1
drivers/iio/adc/ad7606.c
··· 1047 1047 1048 1048 cs = &st->chan_scales[ch]; 1049 1049 *vals = (int *)cs->scale_avail; 1050 - *length = cs->num_scales; 1050 + *length = cs->num_scales * 2; 1051 1051 *type = IIO_VAL_INT_PLUS_MICRO; 1052 1052 1053 1053 return IIO_AVAIL_LIST;
+40 -28
drivers/iio/adc/at91-sama5d2_adc.c
··· 329 329 #define AT91_HWFIFO_MAX_SIZE_STR "128" 330 330 #define AT91_HWFIFO_MAX_SIZE 128 331 331 332 - #define AT91_SAMA5D2_CHAN_SINGLE(index, num, addr) \ 332 + #define AT91_SAMA_CHAN_SINGLE(index, num, addr, rbits) \ 333 333 { \ 334 334 .type = IIO_VOLTAGE, \ 335 335 .channel = num, \ ··· 337 337 .scan_index = index, \ 338 338 .scan_type = { \ 339 339 .sign = 'u', \ 340 - .realbits = 14, \ 340 + .realbits = rbits, \ 341 341 .storagebits = 16, \ 342 342 }, \ 343 343 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ ··· 350 350 .indexed = 1, \ 351 351 } 352 352 353 - #define AT91_SAMA5D2_CHAN_DIFF(index, num, num2, addr) \ 353 + #define AT91_SAMA5D2_CHAN_SINGLE(index, num, addr) \ 354 + AT91_SAMA_CHAN_SINGLE(index, num, addr, 14) 355 + 356 + #define AT91_SAMA7G5_CHAN_SINGLE(index, num, addr) \ 357 + AT91_SAMA_CHAN_SINGLE(index, num, addr, 16) 358 + 359 + #define AT91_SAMA_CHAN_DIFF(index, num, num2, addr, rbits) \ 354 360 { \ 355 361 .type = IIO_VOLTAGE, \ 356 362 .differential = 1, \ ··· 366 360 .scan_index = index, \ 367 361 .scan_type = { \ 368 362 .sign = 's', \ 369 - .realbits = 14, \ 363 + .realbits = rbits, \ 370 364 .storagebits = 16, \ 371 365 }, \ 372 366 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ ··· 378 372 .datasheet_name = "CH"#num"-CH"#num2, \ 379 373 .indexed = 1, \ 380 374 } 375 + 376 + #define AT91_SAMA5D2_CHAN_DIFF(index, num, num2, addr) \ 377 + AT91_SAMA_CHAN_DIFF(index, num, num2, addr, 14) 378 + 379 + #define AT91_SAMA7G5_CHAN_DIFF(index, num, num2, addr) \ 380 + AT91_SAMA_CHAN_DIFF(index, num, num2, addr, 16) 381 381 382 382 #define AT91_SAMA5D2_CHAN_TOUCH(num, name, mod) \ 383 383 { \ ··· 678 666 }; 679 667 680 668 static const struct iio_chan_spec at91_sama7g5_adc_channels[] = { 681 - AT91_SAMA5D2_CHAN_SINGLE(0, 0, 0x60), 682 - AT91_SAMA5D2_CHAN_SINGLE(1, 1, 0x64), 683 - AT91_SAMA5D2_CHAN_SINGLE(2, 2, 0x68), 684 - AT91_SAMA5D2_CHAN_SINGLE(3, 3, 0x6c), 685 - AT91_SAMA5D2_CHAN_SINGLE(4, 4, 0x70), 686 - AT91_SAMA5D2_CHAN_SINGLE(5, 5, 0x74), 687 - AT91_SAMA5D2_CHAN_SINGLE(6, 6, 0x78), 688 - AT91_SAMA5D2_CHAN_SINGLE(7, 7, 0x7c), 689 - AT91_SAMA5D2_CHAN_SINGLE(8, 8, 0x80), 690 - AT91_SAMA5D2_CHAN_SINGLE(9, 9, 0x84), 691 - AT91_SAMA5D2_CHAN_SINGLE(10, 10, 0x88), 692 - AT91_SAMA5D2_CHAN_SINGLE(11, 11, 0x8c), 693 - AT91_SAMA5D2_CHAN_SINGLE(12, 12, 0x90), 694 - AT91_SAMA5D2_CHAN_SINGLE(13, 13, 0x94), 695 - AT91_SAMA5D2_CHAN_SINGLE(14, 14, 0x98), 696 - AT91_SAMA5D2_CHAN_SINGLE(15, 15, 0x9c), 697 - AT91_SAMA5D2_CHAN_DIFF(16, 0, 1, 0x60), 698 - AT91_SAMA5D2_CHAN_DIFF(17, 2, 3, 0x68), 699 - AT91_SAMA5D2_CHAN_DIFF(18, 4, 5, 0x70), 700 - AT91_SAMA5D2_CHAN_DIFF(19, 6, 7, 0x78), 701 - AT91_SAMA5D2_CHAN_DIFF(20, 8, 9, 0x80), 702 - AT91_SAMA5D2_CHAN_DIFF(21, 10, 11, 0x88), 703 - AT91_SAMA5D2_CHAN_DIFF(22, 12, 13, 0x90), 704 - AT91_SAMA5D2_CHAN_DIFF(23, 14, 15, 0x98), 669 + AT91_SAMA7G5_CHAN_SINGLE(0, 0, 0x60), 670 + AT91_SAMA7G5_CHAN_SINGLE(1, 1, 0x64), 671 + AT91_SAMA7G5_CHAN_SINGLE(2, 2, 0x68), 672 + AT91_SAMA7G5_CHAN_SINGLE(3, 3, 0x6c), 673 + AT91_SAMA7G5_CHAN_SINGLE(4, 4, 0x70), 674 + AT91_SAMA7G5_CHAN_SINGLE(5, 5, 0x74), 675 + AT91_SAMA7G5_CHAN_SINGLE(6, 6, 0x78), 676 + AT91_SAMA7G5_CHAN_SINGLE(7, 7, 0x7c), 677 + AT91_SAMA7G5_CHAN_SINGLE(8, 8, 0x80), 678 + AT91_SAMA7G5_CHAN_SINGLE(9, 9, 0x84), 679 + AT91_SAMA7G5_CHAN_SINGLE(10, 10, 0x88), 680 + AT91_SAMA7G5_CHAN_SINGLE(11, 11, 0x8c), 681 + AT91_SAMA7G5_CHAN_SINGLE(12, 12, 0x90), 682 + AT91_SAMA7G5_CHAN_SINGLE(13, 13, 0x94), 683 + AT91_SAMA7G5_CHAN_SINGLE(14, 14, 0x98), 684 + AT91_SAMA7G5_CHAN_SINGLE(15, 15, 0x9c), 685 + AT91_SAMA7G5_CHAN_DIFF(16, 0, 1, 0x60), 686 + AT91_SAMA7G5_CHAN_DIFF(17, 2, 3, 0x68), 687 + AT91_SAMA7G5_CHAN_DIFF(18, 4, 5, 0x70), 688 + AT91_SAMA7G5_CHAN_DIFF(19, 6, 7, 0x78), 689 + AT91_SAMA7G5_CHAN_DIFF(20, 8, 9, 0x80), 690 + AT91_SAMA7G5_CHAN_DIFF(21, 10, 11, 0x88), 691 + AT91_SAMA7G5_CHAN_DIFF(22, 12, 13, 0x90), 692 + AT91_SAMA7G5_CHAN_DIFF(23, 14, 15, 0x98), 705 693 IIO_CHAN_SOFT_TIMESTAMP(24), 706 694 AT91_SAMA5D2_CHAN_TEMP(AT91_SAMA7G5_ADC_TEMP_CHANNEL, "temp", 0xdc), 707 695 };
+1 -1
drivers/iio/adc/pac1921.c
··· 1198 1198 1199 1199 label = devm_kstrdup(dev, status->package.elements[0].string.pointer, 1200 1200 GFP_KERNEL); 1201 + ACPI_FREE(status); 1201 1202 if (!label) 1202 1203 return -ENOMEM; 1203 1204 1204 1205 indio_dev->label = label; 1205 - ACPI_FREE(status); 1206 1206 1207 1207 return 0; 1208 1208 }
+6
drivers/iio/dac/ad3552r.c
··· 410 410 return ret; 411 411 } 412 412 413 + /* Clear reset error flag, see ad3552r manual, rev B table 38. */ 414 + ret = ad3552r_write_reg(dac, AD3552R_REG_ADDR_ERR_STATUS, 415 + AD3552R_MASK_RESET_STATUS); 416 + if (ret) 417 + return ret; 418 + 413 419 return ad3552r_update_reg_field(dac, 414 420 AD3552R_REG_ADDR_INTERFACE_CONFIG_A, 415 421 AD3552R_MASK_ADDR_ASCENSION,
+4 -10
drivers/iio/filter/admv8818.c
··· 574 574 struct spi_device *spi = st->spi; 575 575 unsigned int chip_id; 576 576 577 - ret = regmap_update_bits(st->regmap, ADMV8818_REG_SPI_CONFIG_A, 578 - ADMV8818_SOFTRESET_N_MSK | 579 - ADMV8818_SOFTRESET_MSK, 580 - FIELD_PREP(ADMV8818_SOFTRESET_N_MSK, 1) | 581 - FIELD_PREP(ADMV8818_SOFTRESET_MSK, 1)); 577 + ret = regmap_write(st->regmap, ADMV8818_REG_SPI_CONFIG_A, 578 + ADMV8818_SOFTRESET_N_MSK | ADMV8818_SOFTRESET_MSK); 582 579 if (ret) { 583 580 dev_err(&spi->dev, "ADMV8818 Soft Reset failed.\n"); 584 581 return ret; 585 582 } 586 583 587 - ret = regmap_update_bits(st->regmap, ADMV8818_REG_SPI_CONFIG_A, 588 - ADMV8818_SDOACTIVE_N_MSK | 589 - ADMV8818_SDOACTIVE_MSK, 590 - FIELD_PREP(ADMV8818_SDOACTIVE_N_MSK, 1) | 591 - FIELD_PREP(ADMV8818_SDOACTIVE_MSK, 1)); 584 + ret = regmap_write(st->regmap, ADMV8818_REG_SPI_CONFIG_A, 585 + ADMV8818_SDOACTIVE_N_MSK | ADMV8818_SDOACTIVE_MSK); 592 586 if (ret) { 593 587 dev_err(&spi->dev, "ADMV8818 SDO Enable failed.\n"); 594 588 return ret;
+2 -2
drivers/iio/light/apds9306.c
··· 108 108 { 109 109 .part_id = 0xB1, 110 110 .max_scale_int = 16, 111 - .max_scale_nano = 3264320, 111 + .max_scale_nano = 326432000, 112 112 }, { 113 113 .part_id = 0xB3, 114 114 .max_scale_int = 14, 115 - .max_scale_nano = 9712000, 115 + .max_scale_nano = 97120000, 116 116 }, 117 117 }; 118 118
+4 -3
drivers/iio/light/hid-sensor-prox.c
··· 49 49 #define PROX_CHANNEL(_is_proximity, _channel) \ 50 50 {\ 51 51 .type = _is_proximity ? IIO_PROXIMITY : IIO_ATTENTION,\ 52 - .info_mask_separate = _is_proximity ? BIT(IIO_CHAN_INFO_RAW) :\ 53 - BIT(IIO_CHAN_INFO_PROCESSED),\ 54 - .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) |\ 52 + .info_mask_separate = \ 53 + (_is_proximity ? BIT(IIO_CHAN_INFO_RAW) :\ 54 + BIT(IIO_CHAN_INFO_PROCESSED)) |\ 55 + BIT(IIO_CHAN_INFO_OFFSET) |\ 55 56 BIT(IIO_CHAN_INFO_SCALE) |\ 56 57 BIT(IIO_CHAN_INFO_SAMP_FREQ) |\ 57 58 BIT(IIO_CHAN_INFO_HYSTERESIS),\
+2 -1
drivers/iio/proximity/hx9023s.c
··· 1036 1036 return -ENOMEM; 1037 1037 1038 1038 memcpy(bin->data, fw->data, fw->size); 1039 - release_firmware(fw); 1040 1039 1041 1040 bin->fw_size = fw->size; 1042 1041 bin->fw_ver = bin->data[FW_VER_OFFSET]; 1043 1042 bin->reg_count = get_unaligned_le16(bin->data + FW_REG_CNT_OFFSET); 1043 + 1044 + release_firmware(fw); 1044 1045 1045 1046 return hx9023s_bin_load(data, bin); 1046 1047 }
-15
drivers/misc/cardreader/rtsx_usb.c
··· 286 286 int rtsx_usb_get_card_status(struct rtsx_ucr *ucr, u16 *status) 287 287 { 288 288 int ret; 289 - u8 interrupt_val = 0; 290 289 u16 *buf; 291 290 292 291 if (!status) ··· 307 308 } else { 308 309 ret = rtsx_usb_get_status_with_bulk(ucr, status); 309 310 } 310 - 311 - rtsx_usb_read_register(ucr, CARD_INT_PEND, &interrupt_val); 312 - /* Cross check presence with interrupts */ 313 - if (*status & XD_CD) 314 - if (!(interrupt_val & XD_INT)) 315 - *status &= ~XD_CD; 316 - 317 - if (*status & SD_CD) 318 - if (!(interrupt_val & SD_INT)) 319 - *status &= ~SD_CD; 320 - 321 - if (*status & MS_CD) 322 - if (!(interrupt_val & MS_INT)) 323 - *status &= ~MS_CD; 324 311 325 312 /* usb_control_msg may return positive when success */ 326 313 if (ret < 0)
+1 -1
drivers/misc/eeprom/digsy_mtc_eeprom.c
··· 50 50 }; 51 51 52 52 static struct gpiod_lookup_table eeprom_spi_gpiod_table = { 53 - .dev_id = "spi_gpio", 53 + .dev_id = "spi_gpio.1", 54 54 .table = { 55 55 GPIO_LOOKUP("gpio@b00", GPIO_EEPROM_CLK, 56 56 "sck", GPIO_ACTIVE_HIGH),
+2
drivers/misc/mei/hw-me-regs.h
··· 117 117 118 118 #define MEI_DEV_ID_LNL_M 0xA870 /* Lunar Lake Point M */ 119 119 120 + #define MEI_DEV_ID_PTL_P 0xE470 /* Panther Lake P */ 121 + 120 122 /* 121 123 * MEI HW Section 122 124 */
+2
drivers/misc/mei/pci-me.c
··· 124 124 125 125 {MEI_PCI_DEVICE(MEI_DEV_ID_LNL_M, MEI_ME_PCH15_CFG)}, 126 126 127 + {MEI_PCI_DEVICE(MEI_DEV_ID_PTL_P, MEI_ME_PCH15_CFG)}, 128 + 127 129 /* required last entry */ 128 130 {0, } 129 131 };
+1 -1
drivers/misc/mei/vsc-tp.c
··· 502 502 if (ret) 503 503 return ret; 504 504 505 - tp->wakeuphost = devm_gpiod_get(dev, "wakeuphost", GPIOD_IN); 505 + tp->wakeuphost = devm_gpiod_get(dev, "wakeuphostint", GPIOD_IN); 506 506 if (IS_ERR(tp->wakeuphost)) 507 507 return PTR_ERR(tp->wakeuphost); 508 508
+4 -3
drivers/misc/ntsync.c
··· 873 873 { 874 874 int fds[NTSYNC_MAX_WAIT_COUNT + 1]; 875 875 const __u32 count = args->count; 876 + size_t size = array_size(count, sizeof(fds[0])); 876 877 struct ntsync_q *q; 877 878 __u32 total_count; 878 879 __u32 i, j; ··· 881 880 if (args->pad || (args->flags & ~NTSYNC_WAIT_REALTIME)) 882 881 return -EINVAL; 883 882 884 - if (args->count > NTSYNC_MAX_WAIT_COUNT) 883 + if (size >= sizeof(fds)) 885 884 return -EINVAL; 886 885 887 886 total_count = count; 888 887 if (args->alert) 889 888 total_count++; 890 889 891 - if (copy_from_user(fds, u64_to_user_ptr(args->objs), 892 - array_size(count, sizeof(*fds)))) 890 + if (copy_from_user(fds, u64_to_user_ptr(args->objs), size)) 893 891 return -EFAULT; 894 892 if (args->alert) 895 893 fds[count] = args->alert; ··· 1208 1208 .minor = MISC_DYNAMIC_MINOR, 1209 1209 .name = NTSYNC_NAME, 1210 1210 .fops = &ntsync_fops, 1211 + .mode = 0666, 1211 1212 }; 1212 1213 1213 1214 module_misc_device(ntsync_misc);
+47 -8
drivers/net/bonding/bond_options.c
··· 1242 1242 slave->dev->flags & IFF_MULTICAST; 1243 1243 } 1244 1244 1245 + /** 1246 + * slave_set_ns_maddrs - add/del all NS mac addresses for slave 1247 + * @bond: bond device 1248 + * @slave: slave device 1249 + * @add: add or remove all the NS mac addresses 1250 + * 1251 + * This function tries to add or delete all the NS mac addresses on the slave 1252 + * 1253 + * Note, the IPv6 NS target address is the unicast address in Neighbor 1254 + * Solicitation (NS) message. The dest address of NS message should be 1255 + * solicited-node multicast address of the target. The dest mac of NS message 1256 + * is converted from the solicited-node multicast address. 1257 + * 1258 + * This function is called when 1259 + * * arp_validate changes 1260 + * * enslaving, releasing new slaves 1261 + */ 1245 1262 static void slave_set_ns_maddrs(struct bonding *bond, struct slave *slave, bool add) 1246 1263 { 1247 1264 struct in6_addr *targets = bond->params.ns_targets; 1248 1265 char slot_maddr[MAX_ADDR_LEN]; 1266 + struct in6_addr mcaddr; 1249 1267 int i; 1250 1268 1251 1269 if (!slave_can_set_ns_maddr(bond, slave)) ··· 1273 1255 if (ipv6_addr_any(&targets[i])) 1274 1256 break; 1275 1257 1276 - if (!ndisc_mc_map(&targets[i], slot_maddr, slave->dev, 0)) { 1258 + addrconf_addr_solict_mult(&targets[i], &mcaddr); 1259 + if (!ndisc_mc_map(&mcaddr, slot_maddr, slave->dev, 0)) { 1277 1260 if (add) 1278 1261 dev_mc_add(slave->dev, slot_maddr); 1279 1262 else ··· 1297 1278 slave_set_ns_maddrs(bond, slave, false); 1298 1279 } 1299 1280 1281 + /** 1282 + * slave_set_ns_maddr - set new NS mac address for slave 1283 + * @bond: bond device 1284 + * @slave: slave device 1285 + * @target: the new IPv6 target 1286 + * @slot: the old IPv6 target in the slot 1287 + * 1288 + * This function tries to replace the old mac address to new one on the slave. 1289 + * 1290 + * Note, the target/slot IPv6 address is the unicast address in Neighbor 1291 + * Solicitation (NS) message. The dest address of NS message should be 1292 + * solicited-node multicast address of the target. The dest mac of NS message 1293 + * is converted from the solicited-node multicast address. 1294 + * 1295 + * This function is called when 1296 + * * An IPv6 NS target is added or removed. 1297 + */ 1300 1298 static void slave_set_ns_maddr(struct bonding *bond, struct slave *slave, 1301 1299 struct in6_addr *target, struct in6_addr *slot) 1302 1300 { 1303 - char target_maddr[MAX_ADDR_LEN], slot_maddr[MAX_ADDR_LEN]; 1301 + char mac_addr[MAX_ADDR_LEN]; 1302 + struct in6_addr mcast_addr; 1304 1303 1305 1304 if (!bond->params.arp_validate || !slave_can_set_ns_maddr(bond, slave)) 1306 1305 return; 1307 1306 1308 - /* remove the previous maddr from slave */ 1307 + /* remove the previous mac addr from slave */ 1308 + addrconf_addr_solict_mult(slot, &mcast_addr); 1309 1309 if (!ipv6_addr_any(slot) && 1310 - !ndisc_mc_map(slot, slot_maddr, slave->dev, 0)) 1311 - dev_mc_del(slave->dev, slot_maddr); 1310 + !ndisc_mc_map(&mcast_addr, mac_addr, slave->dev, 0)) 1311 + dev_mc_del(slave->dev, mac_addr); 1312 1312 1313 - /* add new maddr on slave if target is set */ 1313 + /* add new mac addr on slave if target is set */ 1314 + addrconf_addr_solict_mult(target, &mcast_addr); 1314 1315 if (!ipv6_addr_any(target) && 1315 - !ndisc_mc_map(target, target_maddr, slave->dev, 0)) 1316 - dev_mc_add(slave->dev, target_maddr); 1316 + !ndisc_mc_map(&mcast_addr, mac_addr, slave->dev, 0)) 1317 + dev_mc_add(slave->dev, mac_addr); 1317 1318 } 1318 1319 1319 1320 static void _bond_options_ns_ip6_target_set(struct bonding *bond, int slot,
+48 -11
drivers/net/dsa/mv88e6xxx/chip.c
··· 2208 2208 return err; 2209 2209 } 2210 2210 2211 - static int mv88e6xxx_port_db_load_purge(struct mv88e6xxx_chip *chip, int port, 2212 - const unsigned char *addr, u16 vid, 2213 - u8 state) 2211 + static int mv88e6xxx_port_db_get(struct mv88e6xxx_chip *chip, 2212 + const unsigned char *addr, u16 vid, 2213 + u16 *fid, struct mv88e6xxx_atu_entry *entry) 2214 2214 { 2215 - struct mv88e6xxx_atu_entry entry; 2216 2215 struct mv88e6xxx_vtu_entry vlan; 2217 - u16 fid; 2218 2216 int err; 2219 2217 2220 2218 /* Ports have two private address databases: one for when the port is ··· 2223 2225 * VLAN ID into the port's database used for VLAN-unaware bridging. 2224 2226 */ 2225 2227 if (vid == 0) { 2226 - fid = MV88E6XXX_FID_BRIDGED; 2228 + *fid = MV88E6XXX_FID_BRIDGED; 2227 2229 } else { 2228 2230 err = mv88e6xxx_vtu_get(chip, vid, &vlan); 2229 2231 if (err) ··· 2233 2235 if (!vlan.valid) 2234 2236 return -EOPNOTSUPP; 2235 2237 2236 - fid = vlan.fid; 2238 + *fid = vlan.fid; 2237 2239 } 2238 2240 2239 - entry.state = 0; 2240 - ether_addr_copy(entry.mac, addr); 2241 - eth_addr_dec(entry.mac); 2241 + entry->state = 0; 2242 + ether_addr_copy(entry->mac, addr); 2243 + eth_addr_dec(entry->mac); 2242 2244 2243 - err = mv88e6xxx_g1_atu_getnext(chip, fid, &entry); 2245 + return mv88e6xxx_g1_atu_getnext(chip, *fid, entry); 2246 + } 2247 + 2248 + static bool mv88e6xxx_port_db_find(struct mv88e6xxx_chip *chip, 2249 + const unsigned char *addr, u16 vid) 2250 + { 2251 + struct mv88e6xxx_atu_entry entry; 2252 + u16 fid; 2253 + int err; 2254 + 2255 + err = mv88e6xxx_port_db_get(chip, addr, vid, &fid, &entry); 2256 + if (err) 2257 + return false; 2258 + 2259 + return entry.state && ether_addr_equal(entry.mac, addr); 2260 + } 2261 + 2262 + static int mv88e6xxx_port_db_load_purge(struct mv88e6xxx_chip *chip, int port, 2263 + const unsigned char *addr, u16 vid, 2264 + u8 state) 2265 + { 2266 + struct mv88e6xxx_atu_entry entry; 2267 + u16 fid; 2268 + int err; 2269 + 2270 + err = mv88e6xxx_port_db_get(chip, addr, vid, &fid, &entry); 2244 2271 if (err) 2245 2272 return err; 2246 2273 ··· 2869 2846 mv88e6xxx_reg_lock(chip); 2870 2847 err = mv88e6xxx_port_db_load_purge(chip, port, addr, vid, 2871 2848 MV88E6XXX_G1_ATU_DATA_STATE_UC_STATIC); 2849 + if (err) 2850 + goto out; 2851 + 2852 + if (!mv88e6xxx_port_db_find(chip, addr, vid)) 2853 + err = -ENOSPC; 2854 + 2855 + out: 2872 2856 mv88e6xxx_reg_unlock(chip); 2873 2857 2874 2858 return err; ··· 6644 6614 mv88e6xxx_reg_lock(chip); 6645 6615 err = mv88e6xxx_port_db_load_purge(chip, port, mdb->addr, mdb->vid, 6646 6616 MV88E6XXX_G1_ATU_DATA_STATE_MC_STATIC); 6617 + if (err) 6618 + goto out; 6619 + 6620 + if (!mv88e6xxx_port_db_find(chip, mdb->addr, mdb->vid)) 6621 + err = -ENOSPC; 6622 + 6623 + out: 6647 6624 mv88e6xxx_reg_unlock(chip); 6648 6625 6649 6626 return err;
+22 -3
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 2042 2042 struct rx_cmp_ext *rxcmp1; 2043 2043 u32 tmp_raw_cons = *raw_cons; 2044 2044 u16 cons, prod, cp_cons = RING_CMP(tmp_raw_cons); 2045 + struct skb_shared_info *sinfo; 2045 2046 struct bnxt_sw_rx_bd *rx_buf; 2046 2047 unsigned int len; 2047 2048 u8 *data_ptr, agg_bufs, cmp_type; ··· 2169 2168 false); 2170 2169 if (!frag_len) 2171 2170 goto oom_next_rx; 2171 + 2172 2172 } 2173 2173 xdp_active = true; 2174 2174 } ··· 2178 2176 if (bnxt_rx_xdp(bp, rxr, cons, &xdp, data, &data_ptr, &len, event)) { 2179 2177 rc = 1; 2180 2178 goto next_rx; 2179 + } 2180 + if (xdp_buff_has_frags(&xdp)) { 2181 + sinfo = xdp_get_shared_info_from_buff(&xdp); 2182 + agg_bufs = sinfo->nr_frags; 2183 + } else { 2184 + agg_bufs = 0; 2181 2185 } 2182 2186 } 2183 2187 ··· 2222 2214 if (!skb) 2223 2215 goto oom_next_rx; 2224 2216 } else { 2225 - skb = bnxt_xdp_build_skb(bp, skb, agg_bufs, rxr->page_pool, &xdp, rxcmp1); 2217 + skb = bnxt_xdp_build_skb(bp, skb, agg_bufs, 2218 + rxr->page_pool, &xdp); 2226 2219 if (!skb) { 2227 2220 /* we should be able to free the old skb here */ 2228 2221 bnxt_xdp_buff_frags_free(rxr, &xdp); ··· 15610 15601 struct bnxt_cp_ring_info *cpr; 15611 15602 u64 *sw; 15612 15603 15604 + if (!bp->bnapi) 15605 + return; 15606 + 15613 15607 cpr = &bp->bnapi[i]->cp_ring; 15614 15608 sw = cpr->stats.sw_stats; 15615 15609 ··· 15635 15623 struct bnxt *bp = netdev_priv(dev); 15636 15624 struct bnxt_napi *bnapi; 15637 15625 u64 *sw; 15626 + 15627 + if (!bp->tx_ring) 15628 + return; 15638 15629 15639 15630 bnapi = bp->tx_ring[bp->tx_ring_map[i]].bnapi; 15640 15631 sw = bnapi->cp_ring.stats.sw_stats; ··· 15679 15664 struct bnxt *bp = netdev_priv(dev); 15680 15665 struct bnxt_ring_struct *ring; 15681 15666 int rc; 15667 + 15668 + if (!bp->rx_ring) 15669 + return -ENETDOWN; 15682 15670 15683 15671 rxr = &bp->rx_ring[idx]; 15684 15672 clone = qmem; ··· 15765 15747 struct bnxt_ring_struct *ring; 15766 15748 15767 15749 bnxt_free_one_rx_ring_skbs(bp, rxr); 15750 + bnxt_free_one_tpa_info(bp, rxr); 15768 15751 15769 15752 xdp_rxq_info_unreg(&rxr->xdp_rxq); 15770 15753 ··· 15897 15878 napi_enable(&bnapi->napi); 15898 15879 bnxt_db_nq_arm(bp, &cpr->cp_db, cpr->cp_raw_cons); 15899 15880 15900 - for (i = 0; i <= BNXT_VNIC_NTUPLE; i++) { 15881 + for (i = 0; i <= bp->nr_vnics; i++) { 15901 15882 vnic = &bp->vnic_info[i]; 15902 15883 15903 15884 rc = bnxt_hwrm_vnic_set_rss_p5(bp, vnic, true); ··· 15931 15912 struct bnxt_napi *bnapi; 15932 15913 int i; 15933 15914 15934 - for (i = 0; i <= BNXT_VNIC_NTUPLE; i++) { 15915 + for (i = 0; i <= bp->nr_vnics; i++) { 15935 15916 vnic = &bp->vnic_info[i]; 15936 15917 vnic->mru = 0; 15937 15918 bnxt_hwrm_vnic_update(bp, vnic,
+3 -10
drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c
··· 462 462 463 463 struct sk_buff * 464 464 bnxt_xdp_build_skb(struct bnxt *bp, struct sk_buff *skb, u8 num_frags, 465 - struct page_pool *pool, struct xdp_buff *xdp, 466 - struct rx_cmp_ext *rxcmp1) 465 + struct page_pool *pool, struct xdp_buff *xdp) 467 466 { 468 467 struct skb_shared_info *sinfo = xdp_get_shared_info_from_buff(xdp); 469 468 470 469 if (!skb) 471 470 return NULL; 472 - skb_checksum_none_assert(skb); 473 - if (RX_CMP_L4_CS_OK(rxcmp1)) { 474 - if (bp->dev->features & NETIF_F_RXCSUM) { 475 - skb->ip_summed = CHECKSUM_UNNECESSARY; 476 - skb->csum_level = RX_CMP_ENCAP(rxcmp1); 477 - } 478 - } 471 + 479 472 xdp_update_skb_shared_info(skb, num_frags, 480 473 sinfo->xdp_frags_size, 481 - BNXT_RX_PAGE_SIZE * sinfo->nr_frags, 474 + BNXT_RX_PAGE_SIZE * num_frags, 482 475 xdp_buff_is_frag_pfmemalloc(xdp)); 483 476 return skb; 484 477 }
+1 -2
drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.h
··· 33 33 struct xdp_buff *xdp); 34 34 struct sk_buff *bnxt_xdp_build_skb(struct bnxt *bp, struct sk_buff *skb, 35 35 u8 num_frags, struct page_pool *pool, 36 - struct xdp_buff *xdp, 37 - struct rx_cmp_ext *rxcmp1); 36 + struct xdp_buff *xdp); 38 37 #endif
+1 -1
drivers/net/ethernet/intel/ice/ice_arfs.c
··· 511 511 struct hlist_head *arfs_fltr_list; 512 512 unsigned int i; 513 513 514 - if (!vsi || vsi->type != ICE_VSI_PF) 514 + if (!vsi || vsi->type != ICE_VSI_PF || ice_is_arfs_active(vsi)) 515 515 return; 516 516 517 517 arfs_fltr_list = kcalloc(ICE_MAX_ARFS_LIST, sizeof(*arfs_fltr_list),
-6
drivers/net/ethernet/intel/ice/ice_eswitch.c
··· 49 49 if (vlan_ops->dis_rx_filtering(uplink_vsi)) 50 50 goto err_vlan_filtering; 51 51 52 - if (ice_vsi_update_security(uplink_vsi, ice_vsi_ctx_set_allow_override)) 53 - goto err_override_uplink; 54 - 55 52 if (ice_vsi_update_local_lb(uplink_vsi, true)) 56 53 goto err_override_local_lb; 57 54 ··· 60 63 err_up: 61 64 ice_vsi_update_local_lb(uplink_vsi, false); 62 65 err_override_local_lb: 63 - ice_vsi_update_security(uplink_vsi, ice_vsi_ctx_clear_allow_override); 64 - err_override_uplink: 65 66 vlan_ops->ena_rx_filtering(uplink_vsi); 66 67 err_vlan_filtering: 67 68 ice_cfg_dflt_vsi(uplink_vsi->port_info, uplink_vsi->idx, false, ··· 270 275 vlan_ops = ice_get_compat_vsi_vlan_ops(uplink_vsi); 271 276 272 277 ice_vsi_update_local_lb(uplink_vsi, false); 273 - ice_vsi_update_security(uplink_vsi, ice_vsi_ctx_clear_allow_override); 274 278 vlan_ops->ena_rx_filtering(uplink_vsi); 275 279 ice_cfg_dflt_vsi(uplink_vsi->port_info, uplink_vsi->idx, false, 276 280 ICE_FLTR_TX);
+27
drivers/net/ethernet/intel/ice/ice_lag.c
··· 1001 1001 } 1002 1002 1003 1003 /** 1004 + * ice_lag_config_eswitch - configure eswitch to work with LAG 1005 + * @lag: lag info struct 1006 + * @netdev: active network interface device struct 1007 + * 1008 + * Updates all port representors in eswitch to use @netdev for Tx. 1009 + * 1010 + * Configures the netdev to keep dst metadata (also used in representor Tx). 1011 + * This is required for an uplink without switchdev mode configured. 1012 + */ 1013 + static void ice_lag_config_eswitch(struct ice_lag *lag, 1014 + struct net_device *netdev) 1015 + { 1016 + struct ice_repr *repr; 1017 + unsigned long id; 1018 + 1019 + xa_for_each(&lag->pf->eswitch.reprs, id, repr) 1020 + repr->dst->u.port_info.lower_dev = netdev; 1021 + 1022 + netif_keep_dst(netdev); 1023 + } 1024 + 1025 + /** 1004 1026 * ice_lag_unlink - handle unlink event 1005 1027 * @lag: LAG info struct 1006 1028 */ ··· 1043 1021 ice_lag_move_vf_nodes(lag, act_port, pri_port); 1044 1022 lag->primary = false; 1045 1023 lag->active_port = ICE_LAG_INVALID_PORT; 1024 + 1025 + /* Config primary's eswitch back to normal operation. */ 1026 + ice_lag_config_eswitch(lag, lag->netdev); 1046 1027 } else { 1047 1028 struct ice_lag *primary_lag; 1048 1029 ··· 1444 1419 ice_lag_move_vf_nodes(lag, prim_port, 1445 1420 event_port); 1446 1421 lag->active_port = event_port; 1422 + ice_lag_config_eswitch(lag, event_netdev); 1447 1423 return; 1448 1424 } 1449 1425 ··· 1454 1428 /* new active port */ 1455 1429 ice_lag_move_vf_nodes(lag, lag->active_port, event_port); 1456 1430 lag->active_port = event_port; 1431 + ice_lag_config_eswitch(lag, event_netdev); 1457 1432 } else { 1458 1433 /* port not set as currently active (e.g. new active port 1459 1434 * has already claimed the nodes and filters
-18
drivers/net/ethernet/intel/ice/ice_lib.c
··· 3947 3947 } 3948 3948 3949 3949 /** 3950 - * ice_vsi_ctx_set_allow_override - allow destination override on VSI 3951 - * @ctx: pointer to VSI ctx structure 3952 - */ 3953 - void ice_vsi_ctx_set_allow_override(struct ice_vsi_ctx *ctx) 3954 - { 3955 - ctx->info.sec_flags |= ICE_AQ_VSI_SEC_FLAG_ALLOW_DEST_OVRD; 3956 - } 3957 - 3958 - /** 3959 - * ice_vsi_ctx_clear_allow_override - turn off destination override on VSI 3960 - * @ctx: pointer to VSI ctx structure 3961 - */ 3962 - void ice_vsi_ctx_clear_allow_override(struct ice_vsi_ctx *ctx) 3963 - { 3964 - ctx->info.sec_flags &= ~ICE_AQ_VSI_SEC_FLAG_ALLOW_DEST_OVRD; 3965 - } 3966 - 3967 - /** 3968 3950 * ice_vsi_update_local_lb - update sw block in VSI with local loopback bit 3969 3951 * @vsi: pointer to VSI structure 3970 3952 * @set: set or unset the bit
-4
drivers/net/ethernet/intel/ice/ice_lib.h
··· 105 105 void ice_vsi_ctx_set_antispoof(struct ice_vsi_ctx *ctx); 106 106 107 107 void ice_vsi_ctx_clear_antispoof(struct ice_vsi_ctx *ctx); 108 - 109 - void ice_vsi_ctx_set_allow_override(struct ice_vsi_ctx *ctx); 110 - 111 - void ice_vsi_ctx_clear_allow_override(struct ice_vsi_ctx *ctx); 112 108 int ice_vsi_update_local_lb(struct ice_vsi *vsi, bool set); 113 109 int ice_vsi_add_vlan_zero(struct ice_vsi *vsi); 114 110 int ice_vsi_del_vlan_zero(struct ice_vsi *vsi);
+2 -2
drivers/net/ethernet/intel/ice/ice_main.c
··· 5009 5009 return err; 5010 5010 5011 5011 ice_devlink_init_regions(pf); 5012 - ice_health_init(pf); 5013 5012 ice_devlink_register(pf); 5013 + ice_health_init(pf); 5014 5014 5015 5015 return 0; 5016 5016 } 5017 5017 5018 5018 static void ice_deinit_devlink(struct ice_pf *pf) 5019 5019 { 5020 - ice_devlink_unregister(pf); 5021 5020 ice_health_deinit(pf); 5021 + ice_devlink_unregister(pf); 5022 5022 ice_devlink_destroy_regions(pf); 5023 5023 ice_devlink_unregister_params(pf); 5024 5024 }
+3 -1
drivers/net/ethernet/intel/ice/ice_txrx.c
··· 2424 2424 ICE_TXD_CTX_QW1_CMD_S); 2425 2425 2426 2426 ice_tstamp(tx_ring, skb, first, &offload); 2427 - if (ice_is_switchdev_running(vsi->back) && vsi->type != ICE_VSI_SF) 2427 + if ((ice_is_switchdev_running(vsi->back) || 2428 + ice_lag_is_switchdev_running(vsi->back)) && 2429 + vsi->type != ICE_VSI_SF) 2428 2430 ice_eswitch_set_target_vsi(skb, &offload); 2429 2431 2430 2432 if (offload.cd_qw1 & ICE_TX_DESC_DTYPE_CTX) {
+3
drivers/net/ethernet/mellanox/mlx5/core/devlink.c
··· 46 46 u32 running_fw, stored_fw; 47 47 int err; 48 48 49 + if (!mlx5_core_is_pf(dev)) 50 + return 0; 51 + 49 52 err = devlink_info_version_fixed_put(req, "fw.psid", dev->board_id); 50 53 if (err) 51 54 return err;
+5 -7
drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c
··· 48 48 struct list_head *iter; 49 49 50 50 netdev_for_each_lower_dev(dev, lower, iter) { 51 - struct mlx5_core_dev *mdev; 52 - struct mlx5e_priv *priv; 53 - 54 51 if (!mlx5e_eswitch_rep(lower)) 55 52 continue; 56 53 57 - priv = netdev_priv(lower); 58 - mdev = priv->mdev; 59 - if (mlx5_lag_is_shared_fdb(mdev) && mlx5_esw_bridge_dev_same_esw(lower, esw)) 54 + if (mlx5_esw_bridge_dev_same_esw(lower, esw)) 60 55 return lower; 61 56 } 62 57 ··· 120 125 priv = netdev_priv(rep); 121 126 mdev = priv->mdev; 122 127 if (netif_is_lag_master(dev)) 123 - return mlx5_lag_is_shared_fdb(mdev) && mlx5_lag_is_master(mdev); 128 + return mlx5_lag_is_master(mdev); 124 129 return true; 125 130 } 126 131 ··· 448 453 449 454 rep = mlx5_esw_bridge_rep_vport_num_vhca_id_get(dev, esw, &vport_num, &esw_owner_vhca_id); 450 455 if (!rep) 456 + return NOTIFY_DONE; 457 + 458 + if (netif_is_lag_master(dev) && !mlx5_lag_is_shared_fdb(esw->dev)) 451 459 return NOTIFY_DONE; 452 460 453 461 switch (event) {
+2 -4
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 5108 5108 struct mlx5e_priv *priv = netdev_priv(dev); 5109 5109 struct mlx5_core_dev *mdev = priv->mdev; 5110 5110 u8 mode, setting; 5111 - int err; 5112 5111 5113 - err = mlx5_eswitch_get_vepa(mdev->priv.eswitch, &setting); 5114 - if (err) 5115 - return err; 5112 + if (mlx5_eswitch_get_vepa(mdev->priv.eswitch, &setting)) 5113 + return -EOPNOTSUPP; 5116 5114 mode = setting ? BRIDGE_MODE_VEPA : BRIDGE_MODE_VEB; 5117 5115 return ndo_dflt_bridge_getlink(skb, pid, seq, dev, 5118 5116 mode,
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/eq.c
··· 871 871 872 872 static int comp_irq_request_sf(struct mlx5_core_dev *dev, u16 vecidx) 873 873 { 874 + struct mlx5_irq_pool *pool = mlx5_irq_table_get_comp_irq_pool(dev); 874 875 struct mlx5_eq_table *table = dev->priv.eq_table; 875 - struct mlx5_irq_pool *pool = mlx5_irq_pool_get(dev); 876 876 struct irq_affinity_desc af_desc = {}; 877 877 struct mlx5_irq *irq; 878 878
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c
··· 175 175 176 176 void mlx5_irq_affinity_irq_release(struct mlx5_core_dev *dev, struct mlx5_irq *irq) 177 177 { 178 - struct mlx5_irq_pool *pool = mlx5_irq_pool_get(dev); 178 + struct mlx5_irq_pool *pool = mlx5_irq_get_pool(irq); 179 179 int cpu; 180 180 181 181 cpu = cpumask_first(mlx5_irq_get_affinity_mask(irq));
+2 -2
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
··· 951 951 mlx5_eswitch_reload_ib_reps(ldev->pf[i].dev->priv.eswitch); 952 952 } 953 953 954 - static bool mlx5_shared_fdb_supported(struct mlx5_lag *ldev) 954 + bool mlx5_lag_shared_fdb_supported(struct mlx5_lag *ldev) 955 955 { 956 956 int idx = mlx5_lag_get_dev_index_by_seq(ldev, MLX5_LAG_P1); 957 957 struct mlx5_core_dev *dev; ··· 1038 1038 } 1039 1039 1040 1040 if (do_bond && !__mlx5_lag_is_active(ldev)) { 1041 - bool shared_fdb = mlx5_shared_fdb_supported(ldev); 1041 + bool shared_fdb = mlx5_lag_shared_fdb_supported(ldev); 1042 1042 1043 1043 roce_lag = mlx5_lag_is_roce_lag(ldev); 1044 1044
+1
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.h
··· 92 92 return test_bit(MLX5_LAG_FLAG_NDEVS_READY, &ldev->state_flags); 93 93 } 94 94 95 + bool mlx5_lag_shared_fdb_supported(struct mlx5_lag *ldev); 95 96 bool mlx5_lag_check_prereq(struct mlx5_lag *ldev); 96 97 void mlx5_modify_lag(struct mlx5_lag *ldev, 97 98 struct lag_tracker *tracker);
+2 -1
drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c
··· 79 79 if (mlx5_eswitch_mode(dev0) != MLX5_ESWITCH_OFFLOADS || 80 80 !MLX5_CAP_PORT_SELECTION(dev0, port_select_flow_table) || 81 81 !MLX5_CAP_GEN(dev0, create_lag_when_not_master_up) || 82 - !mlx5_lag_check_prereq(ldev)) 82 + !mlx5_lag_check_prereq(ldev) || 83 + !mlx5_lag_shared_fdb_supported(ldev)) 83 84 return -EOPNOTSUPP; 84 85 85 86 err = mlx5_mpesw_metadata_set(ldev);
+5
drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c
··· 197 197 ns = mlx5_get_flow_namespace(chains->dev, chains->ns); 198 198 } 199 199 200 + if (!ns) { 201 + mlx5_core_warn(chains->dev, "Failed to get flow namespace\n"); 202 + return ERR_PTR(-EOPNOTSUPP); 203 + } 204 + 200 205 ft_attr.autogroup.num_reserved_entries = 2; 201 206 ft_attr.autogroup.max_num_groups = chains->group_num; 202 207 ft = mlx5_create_auto_grouped_flow_table(ns, &ft_attr);
+3 -1
drivers/net/ethernet/mellanox/mlx5/core/mlx5_irq.h
··· 10 10 11 11 struct mlx5_irq; 12 12 struct cpu_rmap; 13 + struct mlx5_irq_pool; 13 14 14 15 int mlx5_irq_table_init(struct mlx5_core_dev *dev); 15 16 void mlx5_irq_table_cleanup(struct mlx5_core_dev *dev); 16 17 int mlx5_irq_table_create(struct mlx5_core_dev *dev); 17 18 void mlx5_irq_table_destroy(struct mlx5_core_dev *dev); 18 19 void mlx5_irq_table_free_irqs(struct mlx5_core_dev *dev); 20 + struct mlx5_irq_pool * 21 + mlx5_irq_table_get_comp_irq_pool(struct mlx5_core_dev *dev); 19 22 int mlx5_irq_table_get_num_comp(struct mlx5_irq_table *table); 20 23 int mlx5_irq_table_get_sfs_vec(struct mlx5_irq_table *table); 21 24 struct mlx5_irq_table *mlx5_irq_table_get(struct mlx5_core_dev *dev); ··· 41 38 int mlx5_irq_get_index(struct mlx5_irq *irq); 42 39 int mlx5_irq_get_irq(const struct mlx5_irq *irq); 43 40 44 - struct mlx5_irq_pool; 45 41 #ifdef CONFIG_MLX5_SF 46 42 struct mlx5_irq *mlx5_irq_affinity_irq_request_auto(struct mlx5_core_dev *dev, 47 43 struct cpumask *used_cpus, u16 vecidx);
+10 -3
drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c
··· 378 378 return irq->map.index; 379 379 } 380 380 381 + struct mlx5_irq_pool *mlx5_irq_get_pool(struct mlx5_irq *irq) 382 + { 383 + return irq->pool; 384 + } 385 + 381 386 /* irq_pool API */ 382 387 383 388 /* requesting an irq from a given pool according to given index */ ··· 410 405 return irq_table->sf_ctrl_pool; 411 406 } 412 407 413 - static struct mlx5_irq_pool *sf_irq_pool_get(struct mlx5_irq_table *irq_table) 408 + static struct mlx5_irq_pool * 409 + sf_comp_irq_pool_get(struct mlx5_irq_table *irq_table) 414 410 { 415 411 return irq_table->sf_comp_pool; 416 412 } 417 413 418 - struct mlx5_irq_pool *mlx5_irq_pool_get(struct mlx5_core_dev *dev) 414 + struct mlx5_irq_pool * 415 + mlx5_irq_table_get_comp_irq_pool(struct mlx5_core_dev *dev) 419 416 { 420 417 struct mlx5_irq_table *irq_table = mlx5_irq_table_get(dev); 421 418 struct mlx5_irq_pool *pool = NULL; 422 419 423 420 if (mlx5_core_is_sf(dev)) 424 - pool = sf_irq_pool_get(irq_table); 421 + pool = sf_comp_irq_pool_get(irq_table); 425 422 426 423 /* In some configs, there won't be a pool of SFs IRQs. Hence, returning 427 424 * the PF IRQs pool in case the SF pool doesn't exist.
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/pci_irq.h
··· 28 28 struct mlx5_core_dev *dev; 29 29 }; 30 30 31 - struct mlx5_irq_pool *mlx5_irq_pool_get(struct mlx5_core_dev *dev); 32 31 static inline bool mlx5_irq_pool_is_sf_pool(struct mlx5_irq_pool *pool) 33 32 { 34 33 return !strncmp("mlx5_sf", pool->name, strlen("mlx5_sf")); ··· 39 40 int mlx5_irq_get_locked(struct mlx5_irq *irq); 40 41 int mlx5_irq_read_locked(struct mlx5_irq *irq); 41 42 int mlx5_irq_put(struct mlx5_irq *irq); 43 + struct mlx5_irq_pool *mlx5_irq_get_pool(struct mlx5_irq *irq); 42 44 43 45 #endif /* __PCI_IRQ_H__ */
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.h
··· 24 24 struct mlx5hws_matcher *matcher; 25 25 struct mlx5hws_match_template *mt; 26 26 struct mlx5hws_action_template *at[MLX5HWS_BWC_MATCHER_ATTACH_AT_NUM]; 27 + u32 priority; 27 28 u8 num_of_at; 28 - u16 priority; 29 29 u8 size_log; 30 30 atomic_t num_of_rules; 31 31 struct list_head *rules;
+4
drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_ste.h
··· 210 210 void (*set_encap_l3)(u8 *hw_ste_p, u8 *frst_s_action, 211 211 u8 *scnd_d_action, u32 reformat_id, 212 212 int size); 213 + void (*set_insert_hdr)(u8 *hw_ste_p, u8 *d_action, u32 reformat_id, 214 + u8 anchor, u8 offset, int size); 215 + void (*set_remove_hdr)(u8 *hw_ste_p, u8 *s_action, u8 anchor, 216 + u8 offset, int size); 213 217 /* Send */ 214 218 void (*prepare_for_postsend)(u8 *hw_ste_p, u32 ste_size); 215 219 };
+27 -25
drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_ste_v1.c
··· 266 266 dr_ste_v1_set_reparse(hw_ste_p); 267 267 } 268 268 269 - static void dr_ste_v1_set_insert_hdr(u8 *hw_ste_p, u8 *d_action, 270 - u32 reformat_id, 271 - u8 anchor, u8 offset, 272 - int size) 269 + void dr_ste_v1_set_insert_hdr(u8 *hw_ste_p, u8 *d_action, 270 + u32 reformat_id, 271 + u8 anchor, u8 offset, 272 + int size) 273 273 { 274 274 MLX5_SET(ste_double_action_insert_with_ptr_v1, d_action, 275 275 action_id, DR_STE_V1_ACTION_ID_INSERT_POINTER); ··· 286 286 dr_ste_v1_set_reparse(hw_ste_p); 287 287 } 288 288 289 - static void dr_ste_v1_set_remove_hdr(u8 *hw_ste_p, u8 *s_action, 290 - u8 anchor, u8 offset, 291 - int size) 289 + void dr_ste_v1_set_remove_hdr(u8 *hw_ste_p, u8 *s_action, 290 + u8 anchor, u8 offset, 291 + int size) 292 292 { 293 293 MLX5_SET(ste_single_action_remove_header_size_v1, s_action, 294 294 action_id, DR_STE_V1_ACTION_ID_REMOVE_BY_SIZE); ··· 584 584 action = MLX5_ADDR_OF(ste_mask_and_match_v1, last_ste, action); 585 585 action_sz = DR_STE_ACTION_TRIPLE_SZ; 586 586 } 587 - dr_ste_v1_set_insert_hdr(last_ste, action, 588 - attr->reformat.id, 589 - attr->reformat.param_0, 590 - attr->reformat.param_1, 591 - attr->reformat.size); 587 + ste_ctx->set_insert_hdr(last_ste, action, 588 + attr->reformat.id, 589 + attr->reformat.param_0, 590 + attr->reformat.param_1, 591 + attr->reformat.size); 592 592 action_sz -= DR_STE_ACTION_DOUBLE_SZ; 593 593 action += DR_STE_ACTION_DOUBLE_SZ; 594 594 } else if (action_type_set[DR_ACTION_TYP_REMOVE_HDR]) { ··· 597 597 action = MLX5_ADDR_OF(ste_mask_and_match_v1, last_ste, action); 598 598 action_sz = DR_STE_ACTION_TRIPLE_SZ; 599 599 } 600 - dr_ste_v1_set_remove_hdr(last_ste, action, 601 - attr->reformat.param_0, 602 - attr->reformat.param_1, 603 - attr->reformat.size); 600 + ste_ctx->set_remove_hdr(last_ste, action, 601 + attr->reformat.param_0, 602 + attr->reformat.param_1, 603 + attr->reformat.size); 604 604 action_sz -= DR_STE_ACTION_SINGLE_SZ; 605 605 action += DR_STE_ACTION_SINGLE_SZ; 606 606 } ··· 792 792 action = MLX5_ADDR_OF(ste_mask_and_match_v1, last_ste, action); 793 793 action_sz = DR_STE_ACTION_TRIPLE_SZ; 794 794 } 795 - dr_ste_v1_set_insert_hdr(last_ste, action, 796 - attr->reformat.id, 797 - attr->reformat.param_0, 798 - attr->reformat.param_1, 799 - attr->reformat.size); 795 + ste_ctx->set_insert_hdr(last_ste, action, 796 + attr->reformat.id, 797 + attr->reformat.param_0, 798 + attr->reformat.param_1, 799 + attr->reformat.size); 800 800 action_sz -= DR_STE_ACTION_DOUBLE_SZ; 801 801 action += DR_STE_ACTION_DOUBLE_SZ; 802 802 allow_modify_hdr = false; ··· 808 808 allow_modify_hdr = true; 809 809 allow_ctr = true; 810 810 } 811 - dr_ste_v1_set_remove_hdr(last_ste, action, 812 - attr->reformat.param_0, 813 - attr->reformat.param_1, 814 - attr->reformat.size); 811 + ste_ctx->set_remove_hdr(last_ste, action, 812 + attr->reformat.param_0, 813 + attr->reformat.param_1, 814 + attr->reformat.size); 815 815 action_sz -= DR_STE_ACTION_SINGLE_SZ; 816 816 action += DR_STE_ACTION_SINGLE_SZ; 817 817 } ··· 2200 2200 .set_pop_vlan = &dr_ste_v1_set_pop_vlan, 2201 2201 .set_rx_decap = &dr_ste_v1_set_rx_decap, 2202 2202 .set_encap_l3 = &dr_ste_v1_set_encap_l3, 2203 + .set_insert_hdr = &dr_ste_v1_set_insert_hdr, 2204 + .set_remove_hdr = &dr_ste_v1_set_remove_hdr, 2203 2205 /* Send */ 2204 2206 .prepare_for_postsend = &dr_ste_v1_prepare_for_postsend, 2205 2207 };
+4
drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_ste_v1.h
··· 156 156 void dr_ste_v1_set_encap_l3(u8 *hw_ste_p, u8 *frst_s_action, u8 *scnd_d_action, 157 157 u32 reformat_id, int size); 158 158 void dr_ste_v1_set_rx_decap(u8 *hw_ste_p, u8 *s_action); 159 + void dr_ste_v1_set_insert_hdr(u8 *hw_ste_p, u8 *d_action, u32 reformat_id, 160 + u8 anchor, u8 offset, int size); 161 + void dr_ste_v1_set_remove_hdr(u8 *hw_ste_p, u8 *s_action, u8 anchor, 162 + u8 offset, int size); 159 163 void dr_ste_v1_set_actions_tx(struct mlx5dr_ste_ctx *ste_ctx, struct mlx5dr_domain *dmn, 160 164 u8 *action_type_set, u32 actions_caps, u8 *last_ste, 161 165 struct mlx5dr_ste_actions_attr *attr, u32 *added_stes);
+2
drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_ste_v2.c
··· 69 69 .set_pop_vlan = &dr_ste_v1_set_pop_vlan, 70 70 .set_rx_decap = &dr_ste_v1_set_rx_decap, 71 71 .set_encap_l3 = &dr_ste_v1_set_encap_l3, 72 + .set_insert_hdr = &dr_ste_v1_set_insert_hdr, 73 + .set_remove_hdr = &dr_ste_v1_set_remove_hdr, 72 74 /* Send */ 73 75 .prepare_for_postsend = &dr_ste_v1_prepare_for_postsend, 74 76 };
+42
drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_ste_v3.c
··· 79 79 dr_ste_v1_set_reparse(hw_ste_p); 80 80 } 81 81 82 + static void dr_ste_v3_set_insert_hdr(u8 *hw_ste_p, u8 *d_action, 83 + u32 reformat_id, u8 anchor, 84 + u8 offset, int size) 85 + { 86 + MLX5_SET(ste_double_action_insert_with_ptr_v3, d_action, 87 + action_id, DR_STE_V1_ACTION_ID_INSERT_POINTER); 88 + MLX5_SET(ste_double_action_insert_with_ptr_v3, d_action, 89 + start_anchor, anchor); 90 + 91 + /* The hardware expects here size and offset in words (2 byte) */ 92 + MLX5_SET(ste_double_action_insert_with_ptr_v3, d_action, 93 + size, size / 2); 94 + MLX5_SET(ste_double_action_insert_with_ptr_v3, d_action, 95 + start_offset, offset / 2); 96 + 97 + MLX5_SET(ste_double_action_insert_with_ptr_v3, d_action, 98 + pointer, reformat_id); 99 + MLX5_SET(ste_double_action_insert_with_ptr_v3, d_action, 100 + attributes, DR_STE_V1_ACTION_INSERT_PTR_ATTR_NONE); 101 + 102 + dr_ste_v1_set_reparse(hw_ste_p); 103 + } 104 + 105 + static void dr_ste_v3_set_remove_hdr(u8 *hw_ste_p, u8 *s_action, 106 + u8 anchor, u8 offset, int size) 107 + { 108 + MLX5_SET(ste_single_action_remove_header_size_v3, s_action, 109 + action_id, DR_STE_V1_ACTION_ID_REMOVE_BY_SIZE); 110 + MLX5_SET(ste_single_action_remove_header_size_v3, s_action, 111 + start_anchor, anchor); 112 + 113 + /* The hardware expects here size and offset in words (2 byte) */ 114 + MLX5_SET(ste_single_action_remove_header_size_v3, s_action, 115 + remove_size, size / 2); 116 + MLX5_SET(ste_single_action_remove_header_size_v3, s_action, 117 + start_offset, offset / 2); 118 + 119 + dr_ste_v1_set_reparse(hw_ste_p); 120 + } 121 + 82 122 static int 83 123 dr_ste_v3_set_action_decap_l3_list(void *data, u32 data_sz, 84 124 u8 *hw_action, u32 hw_action_sz, ··· 251 211 .set_pop_vlan = &dr_ste_v3_set_pop_vlan, 252 212 .set_rx_decap = &dr_ste_v3_set_rx_decap, 253 213 .set_encap_l3 = &dr_ste_v3_set_encap_l3, 214 + .set_insert_hdr = &dr_ste_v3_set_insert_hdr, 215 + .set_remove_hdr = &dr_ste_v3_set_remove_hdr, 254 216 /* Send */ 255 217 .prepare_for_postsend = &dr_ste_v1_prepare_for_postsend, 256 218 };
+10 -1
drivers/net/ethernet/microsoft/mana/gdma_main.c
··· 1579 1579 * adapter-MTU file and apc->mana_pci_debugfs folder. 1580 1580 */ 1581 1581 debugfs_remove_recursive(gc->mana_pci_debugfs); 1582 + gc->mana_pci_debugfs = NULL; 1582 1583 pci_iounmap(pdev, bar0_va); 1583 1584 free_gc: 1584 1585 pci_set_drvdata(pdev, NULL); ··· 1601 1600 mana_gd_cleanup(pdev); 1602 1601 1603 1602 debugfs_remove_recursive(gc->mana_pci_debugfs); 1603 + 1604 + gc->mana_pci_debugfs = NULL; 1604 1605 1605 1606 pci_iounmap(pdev, gc->bar0_va); 1606 1607 ··· 1659 1656 1660 1657 debugfs_remove_recursive(gc->mana_pci_debugfs); 1661 1658 1659 + gc->mana_pci_debugfs = NULL; 1660 + 1662 1661 pci_disable_device(pdev); 1663 1662 } 1664 1663 ··· 1687 1682 mana_debugfs_root = debugfs_create_dir("mana", NULL); 1688 1683 1689 1684 err = pci_register_driver(&mana_driver); 1690 - if (err) 1685 + if (err) { 1691 1686 debugfs_remove(mana_debugfs_root); 1687 + mana_debugfs_root = NULL; 1688 + } 1692 1689 1693 1690 return err; 1694 1691 } ··· 1700 1693 pci_unregister_driver(&mana_driver); 1701 1694 1702 1695 debugfs_remove(mana_debugfs_root); 1696 + 1697 + mana_debugfs_root = NULL; 1703 1698 } 1704 1699 1705 1700 module_init(mana_driver_init);
+6 -4
drivers/net/ethernet/microsoft/mana/mana_en.c
··· 748 748 static void mana_cleanup_port_context(struct mana_port_context *apc) 749 749 { 750 750 /* 751 - * at this point all dir/files under the vport directory 752 - * are already cleaned up. 753 - * We are sure the apc->mana_port_debugfs remove will not 754 - * cause any freed memory access issues 751 + * make sure subsequent cleanup attempts don't end up removing already 752 + * cleaned dentry pointer 755 753 */ 756 754 debugfs_remove(apc->mana_port_debugfs); 755 + apc->mana_port_debugfs = NULL; 757 756 kfree(apc->rxqs); 758 757 apc->rxqs = NULL; 759 758 } ··· 1263 1264 return; 1264 1265 1265 1266 debugfs_remove_recursive(ac->mana_eqs_debugfs); 1267 + ac->mana_eqs_debugfs = NULL; 1266 1268 1267 1269 for (i = 0; i < gc->max_num_queues; i++) { 1268 1270 eq = ac->eqs[i].eq; ··· 1926 1926 1927 1927 for (i = 0; i < apc->num_queues; i++) { 1928 1928 debugfs_remove_recursive(apc->tx_qp[i].mana_tx_debugfs); 1929 + apc->tx_qp[i].mana_tx_debugfs = NULL; 1929 1930 1930 1931 napi = &apc->tx_qp[i].tx_cq.napi; 1931 1932 if (apc->tx_qp[i].txq.napi_initialized) { ··· 2114 2113 return; 2115 2114 2116 2115 debugfs_remove_recursive(rxq->mana_rx_debugfs); 2116 + rxq->mana_rx_debugfs = NULL; 2117 2117 2118 2118 napi = &rxq->rx_cq.napi; 2119 2119
+6 -2
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
··· 454 454 455 455 num_vlans = sriov->num_allowed_vlans; 456 456 sriov->allowed_vlans = kcalloc(num_vlans, sizeof(u16), GFP_KERNEL); 457 - if (!sriov->allowed_vlans) 457 + if (!sriov->allowed_vlans) { 458 + qlcnic_sriov_free_vlans(adapter); 458 459 return -ENOMEM; 460 + } 459 461 460 462 vlans = (u16 *)&cmd->rsp.arg[3]; 461 463 for (i = 0; i < num_vlans; i++) ··· 2169 2167 vf = &sriov->vf_info[i]; 2170 2168 vf->sriov_vlans = kcalloc(sriov->num_allowed_vlans, 2171 2169 sizeof(*vf->sriov_vlans), GFP_KERNEL); 2172 - if (!vf->sriov_vlans) 2170 + if (!vf->sriov_vlans) { 2171 + qlcnic_sriov_free_vlans(adapter); 2173 2172 return -ENOMEM; 2173 + } 2174 2174 } 2175 2175 2176 2176 return 0;
+10
drivers/net/ethernet/realtek/rtase/rtase_main.c
··· 1501 1501 static void rtase_sw_reset(struct net_device *dev) 1502 1502 { 1503 1503 struct rtase_private *tp = netdev_priv(dev); 1504 + struct rtase_ring *ring, *tmp; 1505 + struct rtase_int_vector *ivec; 1504 1506 int ret; 1507 + u32 i; 1505 1508 1506 1509 netif_stop_queue(dev); 1507 1510 netif_carrier_off(dev); ··· 1514 1511 rtase_wait_for_quiescence(dev); 1515 1512 rtase_tx_clear(tp); 1516 1513 rtase_rx_clear(tp); 1514 + 1515 + for (i = 0; i < tp->int_nums; i++) { 1516 + ivec = &tp->int_vector[i]; 1517 + list_for_each_entry_safe(ring, tmp, &ivec->ring_list, 1518 + ring_entry) 1519 + list_del(&ring->ring_entry); 1520 + } 1517 1521 1518 1522 ret = rtase_init_ring(dev); 1519 1523 if (ret) {
+5
drivers/net/mctp/mctp-i2c.c
··· 583 583 struct mctp_i2c_hdr *hdr; 584 584 struct mctp_hdr *mhdr; 585 585 u8 lldst, llsrc; 586 + int rc; 586 587 587 588 if (len > MCTP_I2C_MAXMTU) 588 589 return -EMSGSIZE; ··· 593 592 594 593 lldst = *((u8 *)daddr); 595 594 llsrc = *((u8 *)saddr); 595 + 596 + rc = skb_cow_head(skb, sizeof(struct mctp_i2c_hdr)); 597 + if (rc) 598 + return rc; 596 599 597 600 skb_push(skb, sizeof(struct mctp_i2c_hdr)); 598 601 skb_reset_mac_header(skb);
+5
drivers/net/mctp/mctp-i3c.c
··· 506 506 const void *saddr, unsigned int len) 507 507 { 508 508 struct mctp_i3c_internal_hdr *ihdr; 509 + int rc; 509 510 510 511 if (!daddr || !saddr) 511 512 return -EINVAL; 513 + 514 + rc = skb_cow_head(skb, sizeof(struct mctp_i3c_internal_hdr)); 515 + if (rc) 516 + return rc; 512 517 513 518 skb_push(skb, sizeof(struct mctp_i3c_internal_hdr)); 514 519 skb_reset_mac_header(skb);
+68
drivers/net/phy/nxp-c45-tja11xx.c
··· 25 25 /* Same id: TJA1120, TJA1121 */ 26 26 #define PHY_ID_TJA_1120 0x001BB031 27 27 28 + #define VEND1_DEVICE_ID3 0x0004 29 + #define TJA1120_DEV_ID3_SILICON_VERSION GENMASK(15, 12) 30 + #define TJA1120_DEV_ID3_SAMPLE_TYPE GENMASK(11, 8) 31 + #define DEVICE_ID3_SAMPLE_TYPE_R 0x9 32 + 28 33 #define VEND1_DEVICE_CONTROL 0x0040 29 34 #define DEVICE_CONTROL_RESET BIT(15) 30 35 #define DEVICE_CONTROL_CONFIG_GLOBAL_EN BIT(14) ··· 116 111 #define MII_BASIC_CONFIG_RGMII 0x7 117 112 #define MII_BASIC_CONFIG_RMII 0x5 118 113 #define MII_BASIC_CONFIG_MII 0x4 114 + 115 + #define VEND1_SGMII_BASIC_CONTROL 0xB000 116 + #define SGMII_LPM BIT(11) 119 117 120 118 #define VEND1_SYMBOL_ERROR_CNT_XTD 0x8351 121 119 #define EXTENDED_CNT_EN BIT(15) ··· 1604 1596 return 0; 1605 1597 } 1606 1598 1599 + /* Errata: ES_TJA1120 and ES_TJA1121 Rev. 1.0 — 28 November 2024 Section 3.1 & 3.2 */ 1600 + static void nxp_c45_tja1120_errata(struct phy_device *phydev) 1601 + { 1602 + bool macsec_ability, sgmii_ability; 1603 + int silicon_version, sample_type; 1604 + int phy_abilities; 1605 + int ret = 0; 1606 + 1607 + ret = phy_read_mmd(phydev, MDIO_MMD_VEND1, VEND1_DEVICE_ID3); 1608 + if (ret < 0) 1609 + return; 1610 + 1611 + sample_type = FIELD_GET(TJA1120_DEV_ID3_SAMPLE_TYPE, ret); 1612 + if (sample_type != DEVICE_ID3_SAMPLE_TYPE_R) 1613 + return; 1614 + 1615 + silicon_version = FIELD_GET(TJA1120_DEV_ID3_SILICON_VERSION, ret); 1616 + 1617 + phy_abilities = phy_read_mmd(phydev, MDIO_MMD_VEND1, 1618 + VEND1_PORT_ABILITIES); 1619 + macsec_ability = !!(phy_abilities & MACSEC_ABILITY); 1620 + sgmii_ability = !!(phy_abilities & SGMII_ABILITY); 1621 + if ((!macsec_ability && silicon_version == 2) || 1622 + (macsec_ability && silicon_version == 1)) { 1623 + /* TJA1120/TJA1121 PHY configuration errata workaround. 1624 + * Apply PHY writes sequence before link up. 1625 + */ 1626 + if (!macsec_ability) { 1627 + phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x01F8, 0x4b95); 1628 + phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x01F9, 0xf3cd); 1629 + } else { 1630 + phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x01F8, 0x89c7); 1631 + phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x01F9, 0x0893); 1632 + } 1633 + 1634 + phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x0476, 0x58a0); 1635 + 1636 + phy_write_mmd(phydev, MDIO_MMD_PMAPMD, 0x8921, 0xa3a); 1637 + phy_write_mmd(phydev, MDIO_MMD_PMAPMD, 0x89F1, 0x16c1); 1638 + 1639 + phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x01F8, 0x0); 1640 + phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x01F9, 0x0); 1641 + 1642 + if (sgmii_ability) { 1643 + /* TJA1120B/TJA1121B SGMII PCS restart errata workaround. 1644 + * Put SGMII PCS into power down mode and back up. 1645 + */ 1646 + phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, 1647 + VEND1_SGMII_BASIC_CONTROL, 1648 + SGMII_LPM); 1649 + phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, 1650 + VEND1_SGMII_BASIC_CONTROL, 1651 + SGMII_LPM); 1652 + } 1653 + } 1654 + } 1655 + 1607 1656 static int nxp_c45_config_init(struct phy_device *phydev) 1608 1657 { 1609 1658 int ret; ··· 1676 1611 */ 1677 1612 phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x01F8, 1); 1678 1613 phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x01F9, 2); 1614 + 1615 + if (phy_id_compare(phydev->phy_id, PHY_ID_TJA_1120, GENMASK(31, 4))) 1616 + nxp_c45_tja1120_errata(phydev); 1679 1617 1680 1618 phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, VEND1_PHY_CONFIG, 1681 1619 PHY_CONFIG_AUTO);
+2 -2
drivers/net/usb/lan78xx.c
··· 627 627 628 628 kfree(buf); 629 629 630 - return ret; 630 + return ret < 0 ? ret : 0; 631 631 } 632 632 633 633 static int lan78xx_write_reg(struct lan78xx_net *dev, u32 index, u32 data) ··· 658 658 659 659 kfree(buf); 660 660 661 - return ret; 661 + return ret < 0 ? ret : 0; 662 662 } 663 663 664 664 static int lan78xx_update_reg(struct lan78xx_net *dev, u32 reg, u32 mask,
+2
drivers/net/wireless/intel/iwlwifi/iwl-trans.c
··· 403 403 404 404 iwl_trans_pcie_op_mode_leave(trans); 405 405 406 + cancel_work_sync(&trans->restart.wk); 407 + 406 408 trans->op_mode = NULL; 407 409 408 410 trans->state = IWL_TRANS_NO_FW;
+3 -3
drivers/net/wireless/intel/iwlwifi/mvm/fw.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause 2 2 /* 3 - * Copyright (C) 2012-2014, 2018-2024 Intel Corporation 3 + * Copyright (C) 2012-2014, 2018-2025 Intel Corporation 4 4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH 5 5 * Copyright (C) 2016-2017 Intel Deutschland GmbH 6 6 */ ··· 422 422 /* if reached this point, Alive notification was received */ 423 423 iwl_mei_alive_notif(true); 424 424 425 + iwl_trans_fw_alive(mvm->trans, alive_data.scd_base_addr); 426 + 425 427 ret = iwl_pnvm_load(mvm->trans, &mvm->notif_wait, 426 428 &mvm->fw->ucode_capa); 427 429 if (ret) { ··· 431 429 iwl_fw_set_current_image(&mvm->fwrt, old_type); 432 430 return ret; 433 431 } 434 - 435 - iwl_trans_fw_alive(mvm->trans, alive_data.scd_base_addr); 436 432 437 433 /* 438 434 * Note: all the queues are enabled as part of the interface
+6 -5
drivers/net/wireless/intel/iwlwifi/pcie/tx.c
··· 1869 1869 unsigned int offset) 1870 1870 { 1871 1871 struct sg_table *sgt; 1872 - unsigned int n_segments; 1872 + unsigned int n_segments = skb_shinfo(skb)->nr_frags + 1; 1873 + int orig_nents; 1873 1874 1874 1875 if (WARN_ON_ONCE(skb_has_frag_list(skb))) 1875 1876 return NULL; 1876 1877 1877 - n_segments = DIV_ROUND_UP(skb->len - offset, skb_shinfo(skb)->gso_size); 1878 1878 *hdr = iwl_pcie_get_page_hdr(trans, 1879 1879 hdr_room + __alignof__(struct sg_table) + 1880 1880 sizeof(struct sg_table) + ··· 1889 1889 sg_init_table(sgt->sgl, n_segments); 1890 1890 1891 1891 /* Only map the data, not the header (it is copied to the TSO page) */ 1892 - sgt->orig_nents = skb_to_sgvec(skb, sgt->sgl, offset, 1893 - skb->len - offset); 1894 - if (WARN_ON_ONCE(sgt->orig_nents <= 0)) 1892 + orig_nents = skb_to_sgvec(skb, sgt->sgl, offset, skb->len - offset); 1893 + if (WARN_ON_ONCE(orig_nents <= 0)) 1895 1894 return NULL; 1895 + 1896 + sgt->orig_nents = orig_nents; 1896 1897 1897 1898 /* And map the entire SKB */ 1898 1899 if (dma_map_sgtable(trans->dev, sgt, DMA_TO_DEVICE, 0) < 0)
+8 -4
drivers/nvme/host/ioctl.c
··· 128 128 if (!nvme_ctrl_sgl_supported(ctrl)) 129 129 dev_warn_once(ctrl->device, "using unchecked data buffer\n"); 130 130 if (has_metadata) { 131 - if (!supports_metadata) 132 - return -EINVAL; 131 + if (!supports_metadata) { 132 + ret = -EINVAL; 133 + goto out; 134 + } 133 135 if (!nvme_ctrl_meta_sgl_supported(ctrl)) 134 136 dev_warn_once(ctrl->device, 135 137 "using unchecked metadata buffer\n"); ··· 141 139 struct iov_iter iter; 142 140 143 141 /* fixedbufs is only for non-vectored io */ 144 - if (WARN_ON_ONCE(flags & NVME_IOCTL_VEC)) 145 - return -EINVAL; 142 + if (WARN_ON_ONCE(flags & NVME_IOCTL_VEC)) { 143 + ret = -EINVAL; 144 + goto out; 145 + } 146 146 ret = io_uring_cmd_import_fixed(ubuffer, bufflen, 147 147 rq_data_dir(req), &iter, ioucmd); 148 148 if (ret < 0)
+13 -8
drivers/nvme/host/pci.c
··· 1983 1983 return; 1984 1984 1985 1985 /* 1986 + * Controllers may support a CMB size larger than their BAR, for 1987 + * example, due to being behind a bridge. Reduce the CMB to the 1988 + * reported size of the BAR 1989 + */ 1990 + size = min(size, bar_size - offset); 1991 + 1992 + if (!IS_ALIGNED(size, memremap_compat_align()) || 1993 + !IS_ALIGNED(pci_resource_start(pdev, bar), 1994 + memremap_compat_align())) 1995 + return; 1996 + 1997 + /* 1986 1998 * Tell the controller about the host side address mapping the CMB, 1987 1999 * and enable CMB decoding for the NVMe 1.4+ scheme: 1988 2000 */ ··· 2004 1992 dev->bar + NVME_REG_CMBMSC); 2005 1993 } 2006 1994 2007 - /* 2008 - * Controllers may support a CMB size larger than their BAR, 2009 - * for example, due to being behind a bridge. Reduce the CMB to 2010 - * the reported size of the BAR 2011 - */ 2012 - if (size > bar_size - offset) 2013 - size = bar_size - offset; 2014 - 2015 1995 if (pci_p2pdma_add_resource(pdev, bar, size, offset)) { 2016 1996 dev_warn(dev->ctrl.device, 2017 1997 "failed to register the CMB\n"); 1998 + hi_lo_writeq(0, dev->bar + NVME_REG_CMBMSC); 2018 1999 return; 2019 2000 } 2020 2001
+36 -9
drivers/nvme/host/tcp.c
··· 217 217 return queue - queue->ctrl->queues; 218 218 } 219 219 220 + static inline bool nvme_tcp_recv_pdu_supported(enum nvme_tcp_pdu_type type) 221 + { 222 + switch (type) { 223 + case nvme_tcp_c2h_term: 224 + case nvme_tcp_c2h_data: 225 + case nvme_tcp_r2t: 226 + case nvme_tcp_rsp: 227 + return true; 228 + default: 229 + return false; 230 + } 231 + } 232 + 220 233 /* 221 234 * Check if the queue is TLS encrypted 222 235 */ ··· 788 775 [NVME_TCP_FES_PDU_SEQ_ERR] = "PDU Sequence Error", 789 776 [NVME_TCP_FES_HDR_DIGEST_ERR] = "Header Digest Error", 790 777 [NVME_TCP_FES_DATA_OUT_OF_RANGE] = "Data Transfer Out Of Range", 791 - [NVME_TCP_FES_R2T_LIMIT_EXCEEDED] = "R2T Limit Exceeded", 778 + [NVME_TCP_FES_DATA_LIMIT_EXCEEDED] = "Data Transfer Limit Exceeded", 792 779 [NVME_TCP_FES_UNSUPPORTED_PARAM] = "Unsupported Parameter", 793 780 }; 794 781 ··· 831 818 return 0; 832 819 833 820 hdr = queue->pdu; 821 + if (unlikely(hdr->hlen != sizeof(struct nvme_tcp_rsp_pdu))) { 822 + if (!nvme_tcp_recv_pdu_supported(hdr->type)) 823 + goto unsupported_pdu; 824 + 825 + dev_err(queue->ctrl->ctrl.device, 826 + "pdu type %d has unexpected header length (%d)\n", 827 + hdr->type, hdr->hlen); 828 + return -EPROTO; 829 + } 830 + 834 831 if (unlikely(hdr->type == nvme_tcp_c2h_term)) { 835 832 /* 836 833 * C2HTermReq never includes Header or Data digests. ··· 873 850 nvme_tcp_init_recv_ctx(queue); 874 851 return nvme_tcp_handle_r2t(queue, (void *)queue->pdu); 875 852 default: 876 - dev_err(queue->ctrl->ctrl.device, 877 - "unsupported pdu type (%d)\n", hdr->type); 878 - return -EINVAL; 853 + goto unsupported_pdu; 879 854 } 855 + 856 + unsupported_pdu: 857 + dev_err(queue->ctrl->ctrl.device, 858 + "unsupported pdu type (%d)\n", hdr->type); 859 + return -EINVAL; 880 860 } 881 861 882 862 static inline void nvme_tcp_end_request(struct request *rq, u16 status) ··· 1521 1495 msg.msg_flags = MSG_WAITALL; 1522 1496 ret = kernel_recvmsg(queue->sock, &msg, &iov, 1, 1523 1497 iov.iov_len, msg.msg_flags); 1524 - if (ret < sizeof(*icresp)) { 1498 + if (ret >= 0 && ret < sizeof(*icresp)) 1499 + ret = -ECONNRESET; 1500 + if (ret < 0) { 1525 1501 pr_warn("queue %d: failed to receive icresp, error %d\n", 1526 1502 nvme_tcp_queue_id(queue), ret); 1527 - if (ret >= 0) 1528 - ret = -ECONNRESET; 1529 1503 goto free_icresp; 1530 1504 } 1531 1505 ret = -ENOTCONN; ··· 2725 2699 { 2726 2700 struct nvme_tcp_queue *queue = hctx->driver_data; 2727 2701 struct sock *sk = queue->sock->sk; 2702 + int ret; 2728 2703 2729 2704 if (!test_bit(NVME_TCP_Q_LIVE, &queue->flags)) 2730 2705 return 0; ··· 2733 2706 set_bit(NVME_TCP_Q_POLLING, &queue->flags); 2734 2707 if (sk_can_busy_loop(sk) && skb_queue_empty_lockless(&sk->sk_receive_queue)) 2735 2708 sk_busy_loop(sk, true); 2736 - nvme_tcp_try_recv(queue); 2709 + ret = nvme_tcp_try_recv(queue); 2737 2710 clear_bit(NVME_TCP_Q_POLLING, &queue->flags); 2738 - return queue->nr_cqe; 2711 + return ret < 0 ? ret : queue->nr_cqe; 2739 2712 } 2740 2713 2741 2714 static int nvme_tcp_get_address(struct nvme_ctrl *ctrl, char *buf, int size)
-1
drivers/nvme/target/nvmet.h
··· 647 647 struct nvmet_host *host); 648 648 void nvmet_add_async_event(struct nvmet_ctrl *ctrl, u8 event_type, 649 649 u8 event_info, u8 log_page); 650 - bool nvmet_subsys_nsid_exists(struct nvmet_subsys *subsys, u32 nsid); 651 650 652 651 #define NVMET_MIN_QUEUE_SIZE 16 653 652 #define NVMET_MAX_QUEUE_SIZE 1024
+11 -4
drivers/nvme/target/tcp.c
··· 571 571 struct nvmet_tcp_cmd *cmd = 572 572 container_of(req, struct nvmet_tcp_cmd, req); 573 573 struct nvmet_tcp_queue *queue = cmd->queue; 574 + enum nvmet_tcp_recv_state queue_state; 575 + struct nvmet_tcp_cmd *queue_cmd; 574 576 struct nvme_sgl_desc *sgl; 575 577 u32 len; 576 578 577 - if (unlikely(cmd == queue->cmd)) { 579 + /* Pairs with store_release in nvmet_prepare_receive_pdu() */ 580 + queue_state = smp_load_acquire(&queue->rcv_state); 581 + queue_cmd = READ_ONCE(queue->cmd); 582 + 583 + if (unlikely(cmd == queue_cmd)) { 578 584 sgl = &cmd->req.cmd->common.dptr.sgl; 579 585 len = le32_to_cpu(sgl->length); 580 586 ··· 589 583 * Avoid using helpers, this might happen before 590 584 * nvmet_req_init is completed. 591 585 */ 592 - if (queue->rcv_state == NVMET_TCP_RECV_PDU && 586 + if (queue_state == NVMET_TCP_RECV_PDU && 593 587 len && len <= cmd->req.port->inline_data_size && 594 588 nvme_is_write(cmd->req.cmd)) 595 589 return; ··· 853 847 { 854 848 queue->offset = 0; 855 849 queue->left = sizeof(struct nvme_tcp_hdr); 856 - queue->cmd = NULL; 857 - queue->rcv_state = NVMET_TCP_RECV_PDU; 850 + WRITE_ONCE(queue->cmd, NULL); 851 + /* Ensure rcv_state is visible only after queue->cmd is set */ 852 + smp_store_release(&queue->rcv_state, NVMET_TCP_RECV_PDU); 858 853 } 859 854 860 855 static void nvmet_tcp_free_crypto(struct nvmet_tcp_queue *queue)
+1 -1
drivers/pinctrl/bcm/pinctrl-bcm281xx.c
··· 974 974 .reg_bits = 32, 975 975 .reg_stride = 4, 976 976 .val_bits = 32, 977 - .max_register = BCM281XX_PIN_VC_CAM3_SDA, 977 + .max_register = BCM281XX_PIN_VC_CAM3_SDA * 4, 978 978 }; 979 979 980 980 static int bcm281xx_pinctrl_get_groups_count(struct pinctrl_dev *pctldev)
+3
drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
··· 2374 2374 pctrl->gpio_bank[id].gc.parent = dev; 2375 2375 pctrl->gpio_bank[id].gc.fwnode = child; 2376 2376 pctrl->gpio_bank[id].gc.label = devm_kasprintf(dev, GFP_KERNEL, "%pfw", child); 2377 + if (pctrl->gpio_bank[id].gc.label == NULL) 2378 + return -ENOMEM; 2379 + 2377 2380 pctrl->gpio_bank[id].gc.dbg_show = npcmgpio_dbg_show; 2378 2381 pctrl->gpio_bank[id].direction_input = pctrl->gpio_bank[id].gc.direction_input; 2379 2382 pctrl->gpio_bank[id].gc.direction_input = npcmgpio_direction_input;
+2 -1
drivers/pinctrl/spacemit/Kconfig
··· 4 4 # 5 5 6 6 config PINCTRL_SPACEMIT_K1 7 - tristate "SpacemiT K1 SoC Pinctrl driver" 7 + bool "SpacemiT K1 SoC Pinctrl driver" 8 8 depends on ARCH_SPACEMIT || COMPILE_TEST 9 9 depends on OF 10 + default y 10 11 select GENERIC_PINCTRL_GROUPS 11 12 select GENERIC_PINMUX_FUNCTIONS 12 13 select GENERIC_PINCONF
+1 -1
drivers/pinctrl/spacemit/pinctrl-k1.c
··· 1044 1044 .of_match_table = k1_pinctrl_ids, 1045 1045 }, 1046 1046 }; 1047 - module_platform_driver(k1_pinctrl_driver); 1047 + builtin_platform_driver(k1_pinctrl_driver); 1048 1048 1049 1049 MODULE_AUTHOR("Yixun Lan <dlan@gentoo.org>"); 1050 1050 MODULE_DESCRIPTION("Pinctrl driver for the SpacemiT K1 SoC");
+2
drivers/platform/x86/amd/pmf/core.c
··· 452 452 453 453 mutex_init(&dev->lock); 454 454 mutex_init(&dev->update_mutex); 455 + mutex_init(&dev->cb_mutex); 455 456 456 457 apmf_acpi_init(dev); 457 458 platform_set_drvdata(pdev, dev); ··· 478 477 amd_pmf_dbgfs_unregister(dev); 479 478 mutex_destroy(&dev->lock); 480 479 mutex_destroy(&dev->update_mutex); 480 + mutex_destroy(&dev->cb_mutex); 481 481 kfree(dev->buf); 482 482 } 483 483
+4 -1
drivers/platform/x86/amd/pmf/pmf.h
··· 106 106 #define PMF_TA_IF_VERSION_MAJOR 1 107 107 #define TA_PMF_ACTION_MAX 32 108 108 #define TA_PMF_UNDO_MAX 8 109 - #define TA_OUTPUT_RESERVED_MEM 906 109 + #define TA_OUTPUT_RESERVED_MEM 922 110 110 #define MAX_OPERATION_PARAMS 4 111 + 112 + #define TA_ERROR_CRYPTO_INVALID_PARAM 0x20002 113 + #define TA_ERROR_CRYPTO_BIN_TOO_LARGE 0x2000d 111 114 112 115 #define PMF_IF_V1 1 113 116 #define PMF_IF_V2 2
+11
drivers/platform/x86/amd/pmf/sps.c
··· 297 297 298 298 switch (pmf->current_profile) { 299 299 case PLATFORM_PROFILE_PERFORMANCE: 300 + case PLATFORM_PROFILE_BALANCED_PERFORMANCE: 300 301 mode = POWER_MODE_PERFORMANCE; 301 302 break; 302 303 case PLATFORM_PROFILE_BALANCED: 303 304 mode = POWER_MODE_BALANCED_POWER; 304 305 break; 305 306 case PLATFORM_PROFILE_LOW_POWER: 307 + case PLATFORM_PROFILE_QUIET: 306 308 mode = POWER_MODE_POWER_SAVER; 307 309 break; 308 310 default: ··· 389 387 return 0; 390 388 } 391 389 390 + static int amd_pmf_hidden_choices(void *drvdata, unsigned long *choices) 391 + { 392 + set_bit(PLATFORM_PROFILE_QUIET, choices); 393 + set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, choices); 394 + 395 + return 0; 396 + } 397 + 392 398 static int amd_pmf_profile_probe(void *drvdata, unsigned long *choices) 393 399 { 394 400 set_bit(PLATFORM_PROFILE_LOW_POWER, choices); ··· 408 398 409 399 static const struct platform_profile_ops amd_pmf_profile_ops = { 410 400 .probe = amd_pmf_profile_probe, 401 + .hidden_choices = amd_pmf_hidden_choices, 411 402 .profile_get = amd_pmf_profile_get, 412 403 .profile_set = amd_pmf_profile_set, 413 404 };
+37 -15
drivers/platform/x86/amd/pmf/tee-if.c
··· 27 27 MODULE_PARM_DESC(pb_side_load, "Sideload policy binaries debug policy failures"); 28 28 #endif 29 29 30 - static const uuid_t amd_pmf_ta_uuid = UUID_INIT(0x6fd93b77, 0x3fb8, 0x524d, 31 - 0xb1, 0x2d, 0xc5, 0x29, 0xb1, 0x3d, 0x85, 0x43); 30 + static const uuid_t amd_pmf_ta_uuid[] = { UUID_INIT(0xd9b39bf2, 0x66bd, 0x4154, 0xaf, 0xb8, 0x8a, 31 + 0xcc, 0x2b, 0x2b, 0x60, 0xd6), 32 + UUID_INIT(0x6fd93b77, 0x3fb8, 0x524d, 0xb1, 0x2d, 0xc5, 33 + 0x29, 0xb1, 0x3d, 0x85, 0x43), 34 + }; 32 35 33 36 static const char *amd_pmf_uevent_as_str(unsigned int state) 34 37 { ··· 324 321 */ 325 322 schedule_delayed_work(&dev->pb_work, msecs_to_jiffies(pb_actions_ms * 3)); 326 323 } else { 327 - dev_err(dev->dev, "ta invoke cmd init failed err: %x\n", res); 324 + dev_dbg(dev->dev, "ta invoke cmd init failed err: %x\n", res); 328 325 dev->smart_pc_enabled = false; 329 - return -EIO; 326 + return res; 330 327 } 331 328 332 329 return 0; ··· 393 390 return ver->impl_id == TEE_IMPL_ID_AMDTEE; 394 391 } 395 392 396 - static int amd_pmf_ta_open_session(struct tee_context *ctx, u32 *id) 393 + static int amd_pmf_ta_open_session(struct tee_context *ctx, u32 *id, const uuid_t *uuid) 397 394 { 398 395 struct tee_ioctl_open_session_arg sess_arg = {}; 399 396 int rc; 400 397 401 - export_uuid(sess_arg.uuid, &amd_pmf_ta_uuid); 398 + export_uuid(sess_arg.uuid, uuid); 402 399 sess_arg.clnt_login = TEE_IOCTL_LOGIN_PUBLIC; 403 400 sess_arg.num_params = 0; 404 401 ··· 437 434 return 0; 438 435 } 439 436 440 - static int amd_pmf_tee_init(struct amd_pmf_dev *dev) 437 + static int amd_pmf_tee_init(struct amd_pmf_dev *dev, const uuid_t *uuid) 441 438 { 442 439 u32 size; 443 440 int ret; ··· 448 445 return PTR_ERR(dev->tee_ctx); 449 446 } 450 447 451 - ret = amd_pmf_ta_open_session(dev->tee_ctx, &dev->session_id); 448 + ret = amd_pmf_ta_open_session(dev->tee_ctx, &dev->session_id, uuid); 452 449 if (ret) { 453 450 dev_err(dev->dev, "Failed to open TA session (%d)\n", ret); 454 451 ret = -EINVAL; ··· 492 489 493 490 int amd_pmf_init_smart_pc(struct amd_pmf_dev *dev) 494 491 { 495 - int ret; 492 + bool status; 493 + int ret, i; 496 494 497 495 ret = apmf_check_smart_pc(dev); 498 496 if (ret) { ··· 505 501 dev_info(dev->dev, "PMF Smart PC not advertised in BIOS!:%d\n", ret); 506 502 return -ENODEV; 507 503 } 508 - 509 - ret = amd_pmf_tee_init(dev); 510 - if (ret) 511 - return ret; 512 504 513 505 INIT_DELAYED_WORK(&dev->pb_work, amd_pmf_invoke_cmd); 514 506 ··· 534 534 goto error; 535 535 } 536 536 537 - ret = amd_pmf_start_policy_engine(dev); 538 - if (ret) 537 + for (i = 0; i < ARRAY_SIZE(amd_pmf_ta_uuid); i++) { 538 + ret = amd_pmf_tee_init(dev, &amd_pmf_ta_uuid[i]); 539 + if (ret) 540 + return ret; 541 + 542 + ret = amd_pmf_start_policy_engine(dev); 543 + switch (ret) { 544 + case TA_PMF_TYPE_SUCCESS: 545 + status = true; 546 + break; 547 + case TA_ERROR_CRYPTO_INVALID_PARAM: 548 + case TA_ERROR_CRYPTO_BIN_TOO_LARGE: 549 + amd_pmf_tee_deinit(dev); 550 + status = false; 551 + break; 552 + default: 553 + goto error; 554 + } 555 + 556 + if (status) 557 + break; 558 + } 559 + 560 + if (!status && !pb_side_load) 539 561 goto error; 540 562 541 563 if (pb_side_load)
+7
drivers/platform/x86/intel/hid.c
··· 139 139 DMI_MATCH(DMI_PRODUCT_NAME, "Surface Go 3"), 140 140 }, 141 141 }, 142 + { 143 + .ident = "Microsoft Surface Go 4", 144 + .matches = { 145 + DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), 146 + DMI_MATCH(DMI_PRODUCT_NAME, "Surface Go 4"), 147 + }, 148 + }, 142 149 { } 143 150 }; 144 151
+7
drivers/platform/x86/intel/vsec.c
··· 404 404 .caps = VSEC_CAP_TELEMETRY | VSEC_CAP_SDSI | VSEC_CAP_TPMI, 405 405 }; 406 406 407 + /* DMR OOBMSM info */ 408 + static const struct intel_vsec_platform_info dmr_oobmsm_info = { 409 + .caps = VSEC_CAP_TELEMETRY | VSEC_CAP_TPMI, 410 + }; 411 + 407 412 /* TGL info */ 408 413 static const struct intel_vsec_platform_info tgl_info = { 409 414 .caps = VSEC_CAP_TELEMETRY, ··· 425 420 #define PCI_DEVICE_ID_INTEL_VSEC_MTL_M 0x7d0d 426 421 #define PCI_DEVICE_ID_INTEL_VSEC_MTL_S 0xad0d 427 422 #define PCI_DEVICE_ID_INTEL_VSEC_OOBMSM 0x09a7 423 + #define PCI_DEVICE_ID_INTEL_VSEC_OOBMSM_DMR 0x09a1 428 424 #define PCI_DEVICE_ID_INTEL_VSEC_RPL 0xa77d 429 425 #define PCI_DEVICE_ID_INTEL_VSEC_TGL 0x9a0d 430 426 #define PCI_DEVICE_ID_INTEL_VSEC_LNL_M 0x647d ··· 436 430 { PCI_DEVICE_DATA(INTEL, VSEC_MTL_M, &mtl_info) }, 437 431 { PCI_DEVICE_DATA(INTEL, VSEC_MTL_S, &mtl_info) }, 438 432 { PCI_DEVICE_DATA(INTEL, VSEC_OOBMSM, &oobmsm_info) }, 433 + { PCI_DEVICE_DATA(INTEL, VSEC_OOBMSM_DMR, &dmr_oobmsm_info) }, 439 434 { PCI_DEVICE_DATA(INTEL, VSEC_RPL, &tgl_info) }, 440 435 { PCI_DEVICE_DATA(INTEL, VSEC_TGL, &tgl_info) }, 441 436 { PCI_DEVICE_DATA(INTEL, VSEC_LNL_M, &lnl_info) },
+1
drivers/platform/x86/thinkpad_acpi.c
··· 9972 9972 * Individual addressing is broken on models that expose the 9973 9973 * primary battery as BAT1. 9974 9974 */ 9975 + TPACPI_Q_LNV('G', '8', true), /* ThinkPad X131e */ 9975 9976 TPACPI_Q_LNV('8', 'F', true), /* Thinkpad X120e */ 9976 9977 TPACPI_Q_LNV('J', '7', true), /* B5400 */ 9977 9978 TPACPI_Q_LNV('J', 'I', true), /* Thinkpad 11e */
+2 -1
drivers/rapidio/devices/rio_mport_cdev.c
··· 1742 1742 err = rio_add_net(net); 1743 1743 if (err) { 1744 1744 rmcd_debug(RDEV, "failed to register net, err=%d", err); 1745 - kfree(net); 1745 + put_device(&net->dev); 1746 + mport->net = NULL; 1746 1747 goto cleanup; 1747 1748 } 1748 1749 }
+4 -1
drivers/rapidio/rio-scan.c
··· 871 871 dev_set_name(&net->dev, "rnet_%d", net->id); 872 872 net->dev.parent = &mport->dev; 873 873 net->dev.release = rio_scan_release_dev; 874 - rio_add_net(net); 874 + if (rio_add_net(net)) { 875 + put_device(&net->dev); 876 + net = NULL; 877 + } 875 878 } 876 879 877 880 return net;
+3 -2
drivers/slimbus/messaging.c
··· 148 148 } 149 149 150 150 ret = ctrl->xfer_msg(ctrl, txn); 151 - 152 - if (!ret && need_tid && !txn->msg->comp) { 151 + if (ret == -ETIMEDOUT) { 152 + slim_free_txn_tid(ctrl, txn); 153 + } else if (!ret && need_tid && !txn->msg->comp) { 153 154 unsigned long ms = txn->rl + HZ; 154 155 155 156 time_left = wait_for_completion_timeout(txn->comp,
+1 -4
drivers/spi/atmel-quadspi.c
··· 930 930 931 931 /* Release the chip-select. */ 932 932 ret = atmel_qspi_reg_sync(aq); 933 - if (ret) { 934 - pm_runtime_mark_last_busy(&aq->pdev->dev); 935 - pm_runtime_put_autosuspend(&aq->pdev->dev); 933 + if (ret) 936 934 return ret; 937 - } 938 935 atmel_qspi_write(QSPI_CR_LASTXFER, aq, QSPI_CR); 939 936 940 937 return atmel_qspi_wait_for_completion(aq, QSPI_SR_CSRA);
+18 -23
drivers/spi/spi-microchip-core.c
··· 70 70 #define INT_RX_CHANNEL_OVERFLOW BIT(2) 71 71 #define INT_TX_CHANNEL_UNDERRUN BIT(3) 72 72 73 - #define INT_ENABLE_MASK (CONTROL_RX_DATA_INT | CONTROL_TX_DATA_INT | \ 74 - CONTROL_RX_OVER_INT | CONTROL_TX_UNDER_INT) 73 + #define INT_ENABLE_MASK (CONTROL_RX_OVER_INT | CONTROL_TX_UNDER_INT) 75 74 76 75 #define REG_CONTROL (0x00) 77 76 #define REG_FRAME_SIZE (0x04) ··· 132 133 mchp_corespi_write(spi, REG_CONTROL, control); 133 134 } 134 135 135 - static inline void mchp_corespi_read_fifo(struct mchp_corespi *spi) 136 + static inline void mchp_corespi_read_fifo(struct mchp_corespi *spi, int fifo_max) 136 137 { 137 - while (spi->rx_len >= spi->n_bytes && !(mchp_corespi_read(spi, REG_STATUS) & STATUS_RXFIFO_EMPTY)) { 138 - u32 data = mchp_corespi_read(spi, REG_RX_DATA); 138 + for (int i = 0; i < fifo_max; i++) { 139 + u32 data; 140 + 141 + while (mchp_corespi_read(spi, REG_STATUS) & STATUS_RXFIFO_EMPTY) 142 + ; 143 + 144 + data = mchp_corespi_read(spi, REG_RX_DATA); 139 145 140 146 spi->rx_len -= spi->n_bytes; 141 147 ··· 215 211 mchp_corespi_write(spi, REG_FRAMESUP, len); 216 212 } 217 213 218 - static inline void mchp_corespi_write_fifo(struct mchp_corespi *spi) 214 + static inline void mchp_corespi_write_fifo(struct mchp_corespi *spi, int fifo_max) 219 215 { 220 - int fifo_max, i = 0; 216 + int i = 0; 221 217 222 - fifo_max = DIV_ROUND_UP(min(spi->tx_len, FIFO_DEPTH), spi->n_bytes); 223 218 mchp_corespi_set_xfer_size(spi, fifo_max); 224 219 225 220 while ((i < fifo_max) && !(mchp_corespi_read(spi, REG_STATUS) & STATUS_TXFIFO_FULL)) { ··· 416 413 if (intfield == 0) 417 414 return IRQ_NONE; 418 415 419 - if (intfield & INT_TXDONE) 420 - mchp_corespi_write(spi, REG_INT_CLEAR, INT_TXDONE); 421 - 422 - if (intfield & INT_RXRDY) { 423 - mchp_corespi_write(spi, REG_INT_CLEAR, INT_RXRDY); 424 - 425 - if (spi->rx_len) 426 - mchp_corespi_read_fifo(spi); 427 - } 428 - 429 - if (!spi->rx_len && !spi->tx_len) 430 - finalise = true; 431 - 432 416 if (intfield & INT_RX_CHANNEL_OVERFLOW) { 433 417 mchp_corespi_write(spi, REG_INT_CLEAR, INT_RX_CHANNEL_OVERFLOW); 434 418 finalise = true; ··· 502 512 503 513 mchp_corespi_write(spi, REG_SLAVE_SELECT, spi->pending_slave_select); 504 514 505 - while (spi->tx_len) 506 - mchp_corespi_write_fifo(spi); 515 + while (spi->tx_len) { 516 + int fifo_max = DIV_ROUND_UP(min(spi->tx_len, FIFO_DEPTH), spi->n_bytes); 507 517 518 + mchp_corespi_write_fifo(spi, fifo_max); 519 + mchp_corespi_read_fifo(spi, fifo_max); 520 + } 521 + 522 + spi_finalize_current_transfer(host); 508 523 return 1; 509 524 } 510 525
+7 -6
drivers/usb/atm/cxacru.c
··· 1131 1131 struct cxacru_data *instance; 1132 1132 struct usb_device *usb_dev = interface_to_usbdev(intf); 1133 1133 struct usb_host_endpoint *cmd_ep = usb_dev->ep_in[CXACRU_EP_CMD]; 1134 - struct usb_endpoint_descriptor *in, *out; 1134 + static const u8 ep_addrs[] = { 1135 + CXACRU_EP_CMD + USB_DIR_IN, 1136 + CXACRU_EP_CMD + USB_DIR_OUT, 1137 + 0}; 1135 1138 int ret; 1136 1139 1137 1140 /* instance init */ ··· 1182 1179 } 1183 1180 1184 1181 if (usb_endpoint_xfer_int(&cmd_ep->desc)) 1185 - ret = usb_find_common_endpoints(intf->cur_altsetting, 1186 - NULL, NULL, &in, &out); 1182 + ret = usb_check_int_endpoints(intf, ep_addrs); 1187 1183 else 1188 - ret = usb_find_common_endpoints(intf->cur_altsetting, 1189 - &in, &out, NULL, NULL); 1184 + ret = usb_check_bulk_endpoints(intf, ep_addrs); 1190 1185 1191 - if (ret) { 1186 + if (!ret) { 1192 1187 usb_err(usbatm_instance, "cxacru_bind: interface has incorrect endpoints\n"); 1193 1188 ret = -ENODEV; 1194 1189 goto fail;
+33
drivers/usb/core/hub.c
··· 6066 6066 } /* usb_hub_cleanup() */ 6067 6067 6068 6068 /** 6069 + * hub_hc_release_resources - clear resources used by host controller 6070 + * @udev: pointer to device being released 6071 + * 6072 + * Context: task context, might sleep 6073 + * 6074 + * Function releases the host controller resources in correct order before 6075 + * making any operation on resuming usb device. The host controller resources 6076 + * allocated for devices in tree should be released starting from the last 6077 + * usb device in tree toward the root hub. This function is used only during 6078 + * resuming device when usb device require reinitialization – that is, when 6079 + * flag udev->reset_resume is set. 6080 + * 6081 + * This call is synchronous, and may not be used in an interrupt context. 6082 + */ 6083 + static void hub_hc_release_resources(struct usb_device *udev) 6084 + { 6085 + struct usb_hub *hub = usb_hub_to_struct_hub(udev); 6086 + struct usb_hcd *hcd = bus_to_hcd(udev->bus); 6087 + int i; 6088 + 6089 + /* Release up resources for all children before this device */ 6090 + for (i = 0; i < udev->maxchild; i++) 6091 + if (hub->ports[i]->child) 6092 + hub_hc_release_resources(hub->ports[i]->child); 6093 + 6094 + if (hcd->driver->reset_device) 6095 + hcd->driver->reset_device(hcd, udev); 6096 + } 6097 + 6098 + /** 6069 6099 * usb_reset_and_verify_device - perform a USB port reset to reinitialize a device 6070 6100 * @udev: device to reset (not in SUSPENDED or NOTATTACHED state) 6071 6101 * ··· 6158 6128 6159 6129 bos = udev->bos; 6160 6130 udev->bos = NULL; 6131 + 6132 + if (udev->reset_resume) 6133 + hub_hc_release_resources(udev); 6161 6134 6162 6135 mutex_lock(hcd->address0_mutex); 6163 6136
+4
drivers/usb/core/quirks.c
··· 341 341 { USB_DEVICE(0x0638, 0x0a13), .driver_info = 342 342 USB_QUIRK_STRING_FETCH_255 }, 343 343 344 + /* Prolific Single-LUN Mass Storage Card Reader */ 345 + { USB_DEVICE(0x067b, 0x2731), .driver_info = USB_QUIRK_DELAY_INIT | 346 + USB_QUIRK_NO_LPM }, 347 + 344 348 /* Saitek Cyborg Gold Joystick */ 345 349 { USB_DEVICE(0x06a3, 0x0006), .driver_info = 346 350 USB_QUIRK_CONFIG_INTF_STRINGS },
+48 -37
drivers/usb/dwc3/core.c
··· 131 131 } 132 132 } 133 133 134 - void dwc3_set_prtcap(struct dwc3 *dwc, u32 mode) 134 + void dwc3_set_prtcap(struct dwc3 *dwc, u32 mode, bool ignore_susphy) 135 135 { 136 + unsigned int hw_mode; 136 137 u32 reg; 137 138 138 139 reg = dwc3_readl(dwc->regs, DWC3_GCTL); 140 + 141 + /* 142 + * For DRD controllers, GUSB3PIPECTL.SUSPENDENABLE and 143 + * GUSB2PHYCFG.SUSPHY should be cleared during mode switching, 144 + * and they can be set after core initialization. 145 + */ 146 + hw_mode = DWC3_GHWPARAMS0_MODE(dwc->hwparams.hwparams0); 147 + if (hw_mode == DWC3_GHWPARAMS0_MODE_DRD && !ignore_susphy) { 148 + if (DWC3_GCTL_PRTCAP(reg) != mode) 149 + dwc3_enable_susphy(dwc, false); 150 + } 151 + 139 152 reg &= ~(DWC3_GCTL_PRTCAPDIR(DWC3_GCTL_PRTCAP_OTG)); 140 153 reg |= DWC3_GCTL_PRTCAPDIR(mode); 141 154 dwc3_writel(dwc->regs, DWC3_GCTL, reg); ··· 229 216 230 217 spin_lock_irqsave(&dwc->lock, flags); 231 218 232 - dwc3_set_prtcap(dwc, desired_dr_role); 219 + dwc3_set_prtcap(dwc, desired_dr_role, false); 233 220 234 221 spin_unlock_irqrestore(&dwc->lock, flags); 235 222 ··· 671 658 */ 672 659 reg &= ~DWC3_GUSB3PIPECTL_UX_EXIT_PX; 673 660 674 - /* 675 - * Above DWC_usb3.0 1.94a, it is recommended to set 676 - * DWC3_GUSB3PIPECTL_SUSPHY to '0' during coreConsultant configuration. 677 - * So default value will be '0' when the core is reset. Application 678 - * needs to set it to '1' after the core initialization is completed. 679 - * 680 - * Similarly for DRD controllers, GUSB3PIPECTL.SUSPENDENABLE must be 681 - * cleared after power-on reset, and it can be set after core 682 - * initialization. 683 - */ 661 + /* Ensure the GUSB3PIPECTL.SUSPENDENABLE is cleared prior to phy init. */ 684 662 reg &= ~DWC3_GUSB3PIPECTL_SUSPHY; 685 663 686 664 if (dwc->u2ss_inp3_quirk) ··· 751 747 break; 752 748 } 753 749 754 - /* 755 - * Above DWC_usb3.0 1.94a, it is recommended to set 756 - * DWC3_GUSB2PHYCFG_SUSPHY to '0' during coreConsultant configuration. 757 - * So default value will be '0' when the core is reset. Application 758 - * needs to set it to '1' after the core initialization is completed. 759 - * 760 - * Similarly for DRD controllers, GUSB2PHYCFG.SUSPHY must be cleared 761 - * after power-on reset, and it can be set after core initialization. 762 - */ 750 + /* Ensure the GUSB2PHYCFG.SUSPHY is cleared prior to phy init. */ 763 751 reg &= ~DWC3_GUSB2PHYCFG_SUSPHY; 764 752 765 753 if (dwc->dis_enblslpm_quirk) ··· 825 829 if (ret < 0) 826 830 goto err_exit_usb3_phy; 827 831 } 832 + 833 + /* 834 + * Above DWC_usb3.0 1.94a, it is recommended to set 835 + * DWC3_GUSB3PIPECTL_SUSPHY and DWC3_GUSB2PHYCFG_SUSPHY to '0' during 836 + * coreConsultant configuration. So default value will be '0' when the 837 + * core is reset. Application needs to set it to '1' after the core 838 + * initialization is completed. 839 + * 840 + * Certain phy requires to be in P0 power state during initialization. 841 + * Make sure GUSB3PIPECTL.SUSPENDENABLE and GUSB2PHYCFG.SUSPHY are clear 842 + * prior to phy init to maintain in the P0 state. 843 + * 844 + * After phy initialization, some phy operations can only be executed 845 + * while in lower P states. Ensure GUSB3PIPECTL.SUSPENDENABLE and 846 + * GUSB2PHYCFG.SUSPHY are set soon after initialization to avoid 847 + * blocking phy ops. 848 + */ 849 + if (!DWC3_VER_IS_WITHIN(DWC3, ANY, 194A)) 850 + dwc3_enable_susphy(dwc, true); 828 851 829 852 return 0; 830 853 ··· 1603 1588 1604 1589 switch (dwc->dr_mode) { 1605 1590 case USB_DR_MODE_PERIPHERAL: 1606 - dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE); 1591 + dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE, false); 1607 1592 1608 1593 if (dwc->usb2_phy) 1609 1594 otg_set_vbus(dwc->usb2_phy->otg, false); ··· 1615 1600 return dev_err_probe(dev, ret, "failed to initialize gadget\n"); 1616 1601 break; 1617 1602 case USB_DR_MODE_HOST: 1618 - dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST); 1603 + dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST, false); 1619 1604 1620 1605 if (dwc->usb2_phy) 1621 1606 otg_set_vbus(dwc->usb2_phy->otg, true); ··· 1660 1645 } 1661 1646 1662 1647 /* de-assert DRVVBUS for HOST and OTG mode */ 1663 - dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE); 1648 + dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE, true); 1664 1649 } 1665 1650 1666 1651 static void dwc3_get_software_properties(struct dwc3 *dwc) ··· 1850 1835 dwc->tx_thr_num_pkt_prd = tx_thr_num_pkt_prd; 1851 1836 dwc->tx_max_burst_prd = tx_max_burst_prd; 1852 1837 1853 - dwc->imod_interval = 0; 1854 - 1855 1838 dwc->tx_fifo_resize_max_num = tx_fifo_resize_max_num; 1856 1839 } 1857 1840 ··· 1867 1854 unsigned int hwparam_gen = 1868 1855 DWC3_GHWPARAMS3_SSPHY_IFC(dwc->hwparams.hwparams3); 1869 1856 1870 - /* Check for proper value of imod_interval */ 1871 - if (dwc->imod_interval && !dwc3_has_imod(dwc)) { 1872 - dev_warn(dwc->dev, "Interrupt moderation not supported\n"); 1873 - dwc->imod_interval = 0; 1874 - } 1875 - 1876 1857 /* 1858 + * Enable IMOD for all supporting controllers. 1859 + * 1860 + * Particularly, DWC_usb3 v3.00a must enable this feature for 1861 + * the following reason: 1862 + * 1877 1863 * Workaround for STAR 9000961433 which affects only version 1878 1864 * 3.00a of the DWC_usb3 core. This prevents the controller 1879 1865 * interrupt from being masked while handling events. IMOD 1880 1866 * allows us to work around this issue. Enable it for the 1881 1867 * affected version. 1882 1868 */ 1883 - if (!dwc->imod_interval && 1884 - DWC3_VER_IS(DWC3, 300A)) 1869 + if (dwc3_has_imod((dwc))) 1885 1870 dwc->imod_interval = 1; 1886 1871 1887 1872 /* Check the maximum_speed parameter */ ··· 2468 2457 if (ret) 2469 2458 return ret; 2470 2459 2471 - dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE); 2460 + dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE, true); 2472 2461 dwc3_gadget_resume(dwc); 2473 2462 break; 2474 2463 case DWC3_GCTL_PRTCAP_HOST: ··· 2476 2465 ret = dwc3_core_init_for_resume(dwc); 2477 2466 if (ret) 2478 2467 return ret; 2479 - dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST); 2468 + dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST, true); 2480 2469 break; 2481 2470 } 2482 2471 /* Restore GUSB2PHYCFG bits that were modified in suspend */ ··· 2505 2494 if (ret) 2506 2495 return ret; 2507 2496 2508 - dwc3_set_prtcap(dwc, dwc->current_dr_role); 2497 + dwc3_set_prtcap(dwc, dwc->current_dr_role, true); 2509 2498 2510 2499 dwc3_otg_init(dwc); 2511 2500 if (dwc->current_otg_role == DWC3_OTG_ROLE_HOST) {
+1 -1
drivers/usb/dwc3/core.h
··· 1558 1558 #define DWC3_HAS_OTG BIT(3) 1559 1559 1560 1560 /* prototypes */ 1561 - void dwc3_set_prtcap(struct dwc3 *dwc, u32 mode); 1561 + void dwc3_set_prtcap(struct dwc3 *dwc, u32 mode, bool ignore_susphy); 1562 1562 void dwc3_set_mode(struct dwc3 *dwc, u32 mode); 1563 1563 u32 dwc3_core_fifo_space(struct dwc3_ep *dep, u8 type); 1564 1564
+2 -2
drivers/usb/dwc3/drd.c
··· 173 173 * block "Initialize GCTL for OTG operation". 174 174 */ 175 175 /* GCTL.PrtCapDir=2'b11 */ 176 - dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_OTG); 176 + dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_OTG, true); 177 177 /* GUSB2PHYCFG0.SusPHY=0 */ 178 178 reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); 179 179 reg &= ~DWC3_GUSB2PHYCFG_SUSPHY; ··· 556 556 557 557 dwc3_drd_update(dwc); 558 558 } else { 559 - dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_OTG); 559 + dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_OTG, true); 560 560 561 561 /* use OTG block to get ID event */ 562 562 irq = dwc3_otg_get_irq(dwc);
+7 -3
drivers/usb/dwc3/gadget.c
··· 4501 4501 dwc3_writel(dwc->regs, DWC3_GEVNTSIZ(0), 4502 4502 DWC3_GEVNTSIZ_SIZE(evt->length)); 4503 4503 4504 + evt->flags &= ~DWC3_EVENT_PENDING; 4505 + /* 4506 + * Add an explicit write memory barrier to make sure that the update of 4507 + * clearing DWC3_EVENT_PENDING is observed in dwc3_check_event_buf() 4508 + */ 4509 + wmb(); 4510 + 4504 4511 if (dwc->imod_interval) { 4505 4512 dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), DWC3_GEVNTCOUNT_EHB); 4506 4513 dwc3_writel(dwc->regs, DWC3_DEV_IMOD(0), dwc->imod_interval); 4507 4514 } 4508 - 4509 - /* Keep the clearing of DWC3_EVENT_PENDING at the end */ 4510 - evt->flags &= ~DWC3_EVENT_PENDING; 4511 4515 4512 4516 return ret; 4513 4517 }
+12 -5
drivers/usb/gadget/composite.c
··· 1050 1050 else 1051 1051 usb_gadget_set_remote_wakeup(gadget, 0); 1052 1052 done: 1053 - if (power <= USB_SELF_POWER_VBUS_MAX_DRAW) 1054 - usb_gadget_set_selfpowered(gadget); 1055 - else 1053 + if (power > USB_SELF_POWER_VBUS_MAX_DRAW || 1054 + (c && !(c->bmAttributes & USB_CONFIG_ATT_SELFPOWER))) 1056 1055 usb_gadget_clear_selfpowered(gadget); 1056 + else 1057 + usb_gadget_set_selfpowered(gadget); 1057 1058 1058 1059 usb_gadget_vbus_draw(gadget, power); 1059 1060 if (result >= 0 && cdev->delayed_status) ··· 2616 2615 2617 2616 cdev->suspended = 1; 2618 2617 2619 - usb_gadget_set_selfpowered(gadget); 2618 + if (cdev->config && 2619 + cdev->config->bmAttributes & USB_CONFIG_ATT_SELFPOWER) 2620 + usb_gadget_set_selfpowered(gadget); 2621 + 2620 2622 usb_gadget_vbus_draw(gadget, 2); 2621 2623 } 2622 2624 ··· 2653 2649 else 2654 2650 maxpower = min(maxpower, 900U); 2655 2651 2656 - if (maxpower > USB_SELF_POWER_VBUS_MAX_DRAW) 2652 + if (maxpower > USB_SELF_POWER_VBUS_MAX_DRAW || 2653 + !(cdev->config->bmAttributes & USB_CONFIG_ATT_SELFPOWER)) 2657 2654 usb_gadget_clear_selfpowered(gadget); 2655 + else 2656 + usb_gadget_set_selfpowered(gadget); 2658 2657 2659 2658 usb_gadget_vbus_draw(gadget, maxpower); 2660 2659 } else {
+2 -2
drivers/usb/gadget/function/u_ether.c
··· 1052 1052 * There is a transfer in progress. So we trigger a remote 1053 1053 * wakeup to inform the host. 1054 1054 */ 1055 - ether_wakeup_host(dev->port_usb); 1056 - return; 1055 + if (!ether_wakeup_host(dev->port_usb)) 1056 + return; 1057 1057 } 1058 1058 spin_lock_irqsave(&dev->lock, flags); 1059 1059 link->is_suspend = true;
+8
drivers/usb/host/xhci-hub.c
··· 12 12 #include <linux/slab.h> 13 13 #include <linux/unaligned.h> 14 14 #include <linux/bitfield.h> 15 + #include <linux/pci.h> 15 16 16 17 #include "xhci.h" 17 18 #include "xhci-trace.h" ··· 771 770 enum usb_link_tunnel_mode xhci_port_is_tunneled(struct xhci_hcd *xhci, 772 771 struct xhci_port *port) 773 772 { 773 + struct usb_hcd *hcd; 774 774 void __iomem *base; 775 775 u32 offset; 776 + 777 + /* Don't try and probe this capability for non-Intel hosts */ 778 + hcd = xhci_to_hcd(xhci); 779 + if (!dev_is_pci(hcd->self.controller) || 780 + to_pci_dev(hcd->self.controller)->vendor != PCI_VENDOR_ID_INTEL) 781 + return USB_LINK_UNKNOWN; 776 782 777 783 base = &xhci->cap_regs->hc_capbase; 778 784 offset = xhci_find_next_ext_cap(base, 0, XHCI_EXT_CAPS_INTEL_SPR_SHADOW);
+2 -1
drivers/usb/host/xhci-mem.c
··· 2437 2437 * and our use of dma addresses in the trb_address_map radix tree needs 2438 2438 * TRB_SEGMENT_SIZE alignment, so we pick the greater alignment need. 2439 2439 */ 2440 - if (xhci->quirks & XHCI_ZHAOXIN_TRB_FETCH) 2440 + if (xhci->quirks & XHCI_TRB_OVERFETCH) 2441 + /* Buggy HC prefetches beyond segment bounds - allocate dummy space at the end */ 2441 2442 xhci->segment_pool = dma_pool_create("xHCI ring segments", dev, 2442 2443 TRB_SEGMENT_SIZE * 2, TRB_SEGMENT_SIZE * 2, xhci->page_size * 2); 2443 2444 else
+7 -3
drivers/usb/host/xhci-pci.c
··· 38 38 #define PCI_DEVICE_ID_ETRON_EJ168 0x7023 39 39 #define PCI_DEVICE_ID_ETRON_EJ188 0x7052 40 40 41 + #define PCI_DEVICE_ID_VIA_VL805 0x3483 42 + 41 43 #define PCI_DEVICE_ID_INTEL_LYNXPOINT_XHCI 0x8c31 42 44 #define PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI 0x9c31 43 45 #define PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP_XHCI 0x9cb1 ··· 420 418 pdev->device == 0x3432) 421 419 xhci->quirks |= XHCI_BROKEN_STREAMS; 422 420 423 - if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483) 421 + if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == PCI_DEVICE_ID_VIA_VL805) { 424 422 xhci->quirks |= XHCI_LPM_SUPPORT; 423 + xhci->quirks |= XHCI_TRB_OVERFETCH; 424 + } 425 425 426 426 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && 427 427 pdev->device == PCI_DEVICE_ID_ASMEDIA_1042_XHCI) { ··· 471 467 472 468 if (pdev->device == 0x9202) { 473 469 xhci->quirks |= XHCI_RESET_ON_RESUME; 474 - xhci->quirks |= XHCI_ZHAOXIN_TRB_FETCH; 470 + xhci->quirks |= XHCI_TRB_OVERFETCH; 475 471 } 476 472 477 473 if (pdev->device == 0x9203) 478 - xhci->quirks |= XHCI_ZHAOXIN_TRB_FETCH; 474 + xhci->quirks |= XHCI_TRB_OVERFETCH; 479 475 } 480 476 481 477 if (pdev->vendor == PCI_VENDOR_ID_CDNS &&
+5 -1
drivers/usb/host/xhci.c
··· 780 780 struct xhci_segment *seg; 781 781 782 782 ring = xhci->cmd_ring; 783 - xhci_for_each_ring_seg(ring->first_seg, seg) 783 + xhci_for_each_ring_seg(ring->first_seg, seg) { 784 + /* erase all TRBs before the link */ 784 785 memset(seg->trbs, 0, sizeof(union xhci_trb) * (TRBS_PER_SEGMENT - 1)); 786 + /* clear link cycle bit */ 787 + seg->trbs[TRBS_PER_SEGMENT - 1].link.control &= cpu_to_le32(~TRB_CYCLE); 788 + } 785 789 786 790 xhci_initialize_ring_info(ring); 787 791 /*
+1 -1
drivers/usb/host/xhci.h
··· 1632 1632 #define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42) 1633 1633 #define XHCI_SUSPEND_RESUME_CLKS BIT_ULL(43) 1634 1634 #define XHCI_RESET_TO_DEFAULT BIT_ULL(44) 1635 - #define XHCI_ZHAOXIN_TRB_FETCH BIT_ULL(45) 1635 + #define XHCI_TRB_OVERFETCH BIT_ULL(45) 1636 1636 #define XHCI_ZHAOXIN_HOST BIT_ULL(46) 1637 1637 #define XHCI_WRITE_64_HI_LO BIT_ULL(47) 1638 1638 #define XHCI_CDNS_SCTX_QUIRK BIT_ULL(48)
+5 -1
drivers/usb/renesas_usbhs/common.c
··· 312 312 priv->clks[1] = of_clk_get(dev_of_node(dev), 1); 313 313 if (PTR_ERR(priv->clks[1]) == -ENOENT) 314 314 priv->clks[1] = NULL; 315 - else if (IS_ERR(priv->clks[1])) 315 + else if (IS_ERR(priv->clks[1])) { 316 + clk_put(priv->clks[0]); 316 317 return PTR_ERR(priv->clks[1]); 318 + } 317 319 318 320 return 0; 319 321 } ··· 780 778 struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev); 781 779 782 780 dev_dbg(&pdev->dev, "usb remove\n"); 781 + 782 + flush_delayed_work(&priv->notify_hotplug_work); 783 783 784 784 /* power off */ 785 785 if (!usbhs_get_dparam(priv, runtime_pwctrl))
+1 -1
drivers/usb/renesas_usbhs/mod_gadget.c
··· 1094 1094 goto usbhs_mod_gadget_probe_err_gpriv; 1095 1095 } 1096 1096 1097 - gpriv->transceiver = usb_get_phy(USB_PHY_TYPE_UNDEFINED); 1097 + gpriv->transceiver = devm_usb_get_phy(dev, USB_PHY_TYPE_UNDEFINED); 1098 1098 dev_info(dev, "%stransceiver found\n", 1099 1099 !IS_ERR(gpriv->transceiver) ? "" : "no "); 1100 1100
+11
drivers/usb/typec/tcpm/tcpci_rt1711h.c
··· 334 334 { 335 335 int ret; 336 336 struct rt1711h_chip *chip; 337 + const u16 alert_mask = TCPC_ALERT_TX_SUCCESS | TCPC_ALERT_TX_DISCARDED | 338 + TCPC_ALERT_TX_FAILED | TCPC_ALERT_RX_HARD_RST | 339 + TCPC_ALERT_RX_STATUS | TCPC_ALERT_POWER_STATUS | 340 + TCPC_ALERT_CC_STATUS | TCPC_ALERT_RX_BUF_OVF | 341 + TCPC_ALERT_FAULT; 337 342 338 343 chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); 339 344 if (!chip) ··· 387 382 dev_name(chip->dev), chip); 388 383 if (ret < 0) 389 384 return ret; 385 + 386 + /* Enable alert interrupts */ 387 + ret = rt1711h_write16(chip, TCPC_ALERT_MASK, alert_mask); 388 + if (ret < 0) 389 + return ret; 390 + 390 391 enable_irq_wake(client->irq); 391 392 392 393 return 0;
+13 -12
drivers/usb/typec/ucsi/ucsi.c
··· 25 25 * difficult to estimate the time it takes for the system to process the command 26 26 * before it is actually passed to the PPM. 27 27 */ 28 - #define UCSI_TIMEOUT_MS 5000 28 + #define UCSI_TIMEOUT_MS 10000 29 29 30 30 /* 31 31 * UCSI_SWAP_TIMEOUT_MS - Timeout for role swap requests ··· 1346 1346 1347 1347 mutex_lock(&ucsi->ppm_lock); 1348 1348 1349 - ret = ucsi->ops->read_cci(ucsi, &cci); 1349 + ret = ucsi->ops->poll_cci(ucsi, &cci); 1350 1350 if (ret < 0) 1351 1351 goto out; 1352 1352 ··· 1364 1364 1365 1365 tmo = jiffies + msecs_to_jiffies(UCSI_TIMEOUT_MS); 1366 1366 do { 1367 - ret = ucsi->ops->read_cci(ucsi, &cci); 1367 + ret = ucsi->ops->poll_cci(ucsi, &cci); 1368 1368 if (ret < 0) 1369 1369 goto out; 1370 1370 if (cci & UCSI_CCI_COMMAND_COMPLETE) ··· 1393 1393 /* Give the PPM time to process a reset before reading CCI */ 1394 1394 msleep(20); 1395 1395 1396 - ret = ucsi->ops->read_cci(ucsi, &cci); 1396 + ret = ucsi->ops->poll_cci(ucsi, &cci); 1397 1397 if (ret) 1398 1398 goto out; 1399 1399 ··· 1825 1825 1826 1826 err_unregister: 1827 1827 for (con = connector; con->port; con++) { 1828 + if (con->wq) 1829 + destroy_workqueue(con->wq); 1828 1830 ucsi_unregister_partner(con); 1829 1831 ucsi_unregister_altmodes(con, UCSI_RECIPIENT_CON); 1830 1832 ucsi_unregister_port_psy(con); 1831 - if (con->wq) 1832 - destroy_workqueue(con->wq); 1833 1833 1834 1834 usb_power_delivery_unregister_capabilities(con->port_sink_caps); 1835 1835 con->port_sink_caps = NULL; ··· 1929 1929 struct ucsi *ucsi; 1930 1930 1931 1931 if (!ops || 1932 - !ops->read_version || !ops->read_cci || !ops->read_message_in || 1933 - !ops->sync_control || !ops->async_control) 1932 + !ops->read_version || !ops->read_cci || !ops->poll_cci || 1933 + !ops->read_message_in || !ops->sync_control || !ops->async_control) 1934 1934 return ERR_PTR(-EINVAL); 1935 1935 1936 1936 ucsi = kzalloc(sizeof(*ucsi), GFP_KERNEL); ··· 2013 2013 2014 2014 for (i = 0; i < ucsi->cap.num_connectors; i++) { 2015 2015 cancel_work_sync(&ucsi->connector[i].work); 2016 - ucsi_unregister_partner(&ucsi->connector[i]); 2017 - ucsi_unregister_altmodes(&ucsi->connector[i], 2018 - UCSI_RECIPIENT_CON); 2019 - ucsi_unregister_port_psy(&ucsi->connector[i]); 2020 2016 2021 2017 if (ucsi->connector[i].wq) { 2022 2018 struct ucsi_work *uwork; ··· 2027 2031 mutex_unlock(&ucsi->connector[i].lock); 2028 2032 destroy_workqueue(ucsi->connector[i].wq); 2029 2033 } 2034 + 2035 + ucsi_unregister_partner(&ucsi->connector[i]); 2036 + ucsi_unregister_altmodes(&ucsi->connector[i], 2037 + UCSI_RECIPIENT_CON); 2038 + ucsi_unregister_port_psy(&ucsi->connector[i]); 2030 2039 2031 2040 usb_power_delivery_unregister_capabilities(ucsi->connector[i].port_sink_caps); 2032 2041 ucsi->connector[i].port_sink_caps = NULL;
+2
drivers/usb/typec/ucsi/ucsi.h
··· 62 62 * struct ucsi_operations - UCSI I/O operations 63 63 * @read_version: Read implemented UCSI version 64 64 * @read_cci: Read CCI register 65 + * @poll_cci: Read CCI register while polling with notifications disabled 65 66 * @read_message_in: Read message data from UCSI 66 67 * @sync_control: Blocking control operation 67 68 * @async_control: Non-blocking control operation ··· 77 76 struct ucsi_operations { 78 77 int (*read_version)(struct ucsi *ucsi, u16 *version); 79 78 int (*read_cci)(struct ucsi *ucsi, u32 *cci); 79 + int (*poll_cci)(struct ucsi *ucsi, u32 *cci); 80 80 int (*read_message_in)(struct ucsi *ucsi, void *val, size_t val_len); 81 81 int (*sync_control)(struct ucsi *ucsi, u64 command); 82 82 int (*async_control)(struct ucsi *ucsi, u64 command);
+14 -7
drivers/usb/typec/ucsi/ucsi_acpi.c
··· 59 59 static int ucsi_acpi_read_cci(struct ucsi *ucsi, u32 *cci) 60 60 { 61 61 struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi); 62 - int ret; 63 - 64 - if (UCSI_COMMAND(ua->cmd) == UCSI_PPM_RESET) { 65 - ret = ucsi_acpi_dsm(ua, UCSI_DSM_FUNC_READ); 66 - if (ret) 67 - return ret; 68 - } 69 62 70 63 memcpy(cci, ua->base + UCSI_CCI, sizeof(*cci)); 71 64 72 65 return 0; 66 + } 67 + 68 + static int ucsi_acpi_poll_cci(struct ucsi *ucsi, u32 *cci) 69 + { 70 + struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi); 71 + int ret; 72 + 73 + ret = ucsi_acpi_dsm(ua, UCSI_DSM_FUNC_READ); 74 + if (ret) 75 + return ret; 76 + 77 + return ucsi_acpi_read_cci(ucsi, cci); 73 78 } 74 79 75 80 static int ucsi_acpi_read_message_in(struct ucsi *ucsi, void *val, size_t val_len) ··· 99 94 static const struct ucsi_operations ucsi_acpi_ops = { 100 95 .read_version = ucsi_acpi_read_version, 101 96 .read_cci = ucsi_acpi_read_cci, 97 + .poll_cci = ucsi_acpi_poll_cci, 102 98 .read_message_in = ucsi_acpi_read_message_in, 103 99 .sync_control = ucsi_sync_control_common, 104 100 .async_control = ucsi_acpi_async_control ··· 148 142 static const struct ucsi_operations ucsi_gram_ops = { 149 143 .read_version = ucsi_acpi_read_version, 150 144 .read_cci = ucsi_acpi_read_cci, 145 + .poll_cci = ucsi_acpi_poll_cci, 151 146 .read_message_in = ucsi_gram_read_message_in, 152 147 .sync_control = ucsi_gram_sync_control, 153 148 .async_control = ucsi_acpi_async_control
+1
drivers/usb/typec/ucsi/ucsi_ccg.c
··· 664 664 static const struct ucsi_operations ucsi_ccg_ops = { 665 665 .read_version = ucsi_ccg_read_version, 666 666 .read_cci = ucsi_ccg_read_cci, 667 + .poll_cci = ucsi_ccg_read_cci, 667 668 .read_message_in = ucsi_ccg_read_message_in, 668 669 .sync_control = ucsi_ccg_sync_control, 669 670 .async_control = ucsi_ccg_async_control,
+1
drivers/usb/typec/ucsi/ucsi_glink.c
··· 206 206 static const struct ucsi_operations pmic_glink_ucsi_ops = { 207 207 .read_version = pmic_glink_ucsi_read_version, 208 208 .read_cci = pmic_glink_ucsi_read_cci, 209 + .poll_cci = pmic_glink_ucsi_read_cci, 209 210 .read_message_in = pmic_glink_ucsi_read_message_in, 210 211 .sync_control = ucsi_sync_control_common, 211 212 .async_control = pmic_glink_ucsi_async_control,
+1
drivers/usb/typec/ucsi/ucsi_stm32g0.c
··· 424 424 static const struct ucsi_operations ucsi_stm32g0_ops = { 425 425 .read_version = ucsi_stm32g0_read_version, 426 426 .read_cci = ucsi_stm32g0_read_cci, 427 + .poll_cci = ucsi_stm32g0_read_cci, 427 428 .read_message_in = ucsi_stm32g0_read_message_in, 428 429 .sync_control = ucsi_sync_control_common, 429 430 .async_control = ucsi_stm32g0_async_control,
+1
drivers/usb/typec/ucsi/ucsi_yoga_c630.c
··· 74 74 static const struct ucsi_operations yoga_c630_ucsi_ops = { 75 75 .read_version = yoga_c630_ucsi_read_version, 76 76 .read_cci = yoga_c630_ucsi_read_cci, 77 + .poll_cci = yoga_c630_ucsi_read_cci, 77 78 .read_message_in = yoga_c630_ucsi_read_message_in, 78 79 .sync_control = ucsi_sync_control_common, 79 80 .async_control = yoga_c630_ucsi_async_control,
+34 -18
drivers/video/fbdev/hyperv_fb.c
··· 282 282 static uint screen_fb_size; 283 283 static uint dio_fb_size; /* FB size for deferred IO */ 284 284 285 + static void hvfb_putmem(struct fb_info *info); 286 + 285 287 /* Send message to Hyper-V host */ 286 288 static inline int synthvid_send(struct hv_device *hdev, 287 289 struct synthvid_msg *msg) ··· 865 863 } 866 864 867 865 /* 866 + * fb_ops.fb_destroy is called by the last put_fb_info() call at the end 867 + * of unregister_framebuffer() or fb_release(). Do any cleanup related to 868 + * framebuffer here. 869 + */ 870 + static void hvfb_destroy(struct fb_info *info) 871 + { 872 + hvfb_putmem(info); 873 + framebuffer_release(info); 874 + } 875 + 876 + /* 868 877 * TODO: GEN1 codepaths allocate from system or DMA-able memory. Fix the 869 878 * driver to use the _SYSMEM_ or _DMAMEM_ helpers in these cases. 870 879 */ ··· 890 877 .fb_set_par = hvfb_set_par, 891 878 .fb_setcolreg = hvfb_setcolreg, 892 879 .fb_blank = hvfb_blank, 880 + .fb_destroy = hvfb_destroy, 893 881 }; 894 882 895 883 /* Get options from kernel paramenter "video=" */ ··· 966 952 } 967 953 968 954 /* Release contiguous physical memory */ 969 - static void hvfb_release_phymem(struct hv_device *hdev, 955 + static void hvfb_release_phymem(struct device *device, 970 956 phys_addr_t paddr, unsigned int size) 971 957 { 972 958 unsigned int order = get_order(size); ··· 974 960 if (order <= MAX_PAGE_ORDER) 975 961 __free_pages(pfn_to_page(paddr >> PAGE_SHIFT), order); 976 962 else 977 - dma_free_coherent(&hdev->device, 963 + dma_free_coherent(device, 978 964 round_up(size, PAGE_SIZE), 979 965 phys_to_virt(paddr), 980 966 paddr); ··· 1003 989 1004 990 base = pci_resource_start(pdev, 0); 1005 991 size = pci_resource_len(pdev, 0); 992 + aperture_remove_conflicting_devices(base, size, KBUILD_MODNAME); 1006 993 1007 994 /* 1008 995 * For Gen 1 VM, we can directly use the contiguous memory ··· 1025 1010 goto getmem_done; 1026 1011 } 1027 1012 pr_info("Unable to allocate enough contiguous physical memory on Gen 1 VM. Using MMIO instead.\n"); 1013 + } else { 1014 + aperture_remove_all_conflicting_devices(KBUILD_MODNAME); 1028 1015 } 1029 1016 1030 1017 /* 1031 - * Cannot use the contiguous physical memory. 1032 - * Allocate mmio space for framebuffer. 1018 + * Cannot use contiguous physical memory, so allocate MMIO space for 1019 + * the framebuffer. At this point in the function, conflicting devices 1020 + * that might have claimed the framebuffer MMIO space based on 1021 + * screen_info.lfb_base must have already been removed so that 1022 + * vmbus_allocate_mmio() does not allocate different MMIO space. If the 1023 + * kdump image were to be loaded using kexec_file_load(), the 1024 + * framebuffer location in the kdump image would be set from 1025 + * screen_info.lfb_base at the time that kdump is enabled. If the 1026 + * framebuffer has moved elsewhere, this could be the wrong location, 1027 + * causing kdump to hang when efifb (for example) loads. 1033 1028 */ 1034 1029 dio_fb_size = 1035 1030 screen_width * screen_height * screen_depth / 8; ··· 1076 1051 info->screen_size = dio_fb_size; 1077 1052 1078 1053 getmem_done: 1079 - if (base && size) 1080 - aperture_remove_conflicting_devices(base, size, KBUILD_MODNAME); 1081 - else 1082 - aperture_remove_all_conflicting_devices(KBUILD_MODNAME); 1083 - 1084 1054 if (!gen2vm) 1085 1055 pci_dev_put(pdev); 1086 1056 ··· 1094 1074 } 1095 1075 1096 1076 /* Release the framebuffer */ 1097 - static void hvfb_putmem(struct hv_device *hdev, struct fb_info *info) 1077 + static void hvfb_putmem(struct fb_info *info) 1098 1078 { 1099 1079 struct hvfb_par *par = info->par; 1100 1080 1101 1081 if (par->need_docopy) { 1102 1082 vfree(par->dio_vp); 1103 - iounmap(info->screen_base); 1083 + iounmap(par->mmio_vp); 1104 1084 vmbus_free_mmio(par->mem->start, screen_fb_size); 1105 1085 } else { 1106 - hvfb_release_phymem(hdev, info->fix.smem_start, 1086 + hvfb_release_phymem(info->device, info->fix.smem_start, 1107 1087 screen_fb_size); 1108 1088 } 1109 1089 ··· 1192 1172 if (ret) 1193 1173 goto error; 1194 1174 1195 - ret = register_framebuffer(info); 1175 + ret = devm_register_framebuffer(&hdev->device, info); 1196 1176 if (ret) { 1197 1177 pr_err("Unable to register framebuffer\n"); 1198 1178 goto error; ··· 1217 1197 1218 1198 error: 1219 1199 fb_deferred_io_cleanup(info); 1220 - hvfb_putmem(hdev, info); 1200 + hvfb_putmem(info); 1221 1201 error2: 1222 1202 vmbus_close(hdev->channel); 1223 1203 error1: ··· 1240 1220 1241 1221 fb_deferred_io_cleanup(info); 1242 1222 1243 - unregister_framebuffer(info); 1244 1223 cancel_delayed_work_sync(&par->dwork); 1245 1224 1246 1225 vmbus_close(hdev->channel); 1247 1226 hv_set_drvdata(hdev, NULL); 1248 - 1249 - hvfb_putmem(hdev, info); 1250 - framebuffer_release(info); 1251 1227 } 1252 1228 1253 1229 static int hvfb_suspend(struct hv_device *hdev)
+3 -3
drivers/virt/acrn/hsm.c
··· 49 49 switch (cmd & PMCMD_TYPE_MASK) { 50 50 case ACRN_PMCMD_GET_PX_CNT: 51 51 case ACRN_PMCMD_GET_CX_CNT: 52 - pm_info = kmalloc(sizeof(u64), GFP_KERNEL); 52 + pm_info = kzalloc(sizeof(u64), GFP_KERNEL); 53 53 if (!pm_info) 54 54 return -ENOMEM; 55 55 ··· 64 64 kfree(pm_info); 65 65 break; 66 66 case ACRN_PMCMD_GET_PX_DATA: 67 - px_data = kmalloc(sizeof(*px_data), GFP_KERNEL); 67 + px_data = kzalloc(sizeof(*px_data), GFP_KERNEL); 68 68 if (!px_data) 69 69 return -ENOMEM; 70 70 ··· 79 79 kfree(px_data); 80 80 break; 81 81 case ACRN_PMCMD_GET_CX_DATA: 82 - cx_data = kmalloc(sizeof(*cx_data), GFP_KERNEL); 82 + cx_data = kzalloc(sizeof(*cx_data), GFP_KERNEL); 83 83 if (!cx_data) 84 84 return -ENOMEM; 85 85
+43 -15
drivers/virt/coco/sev-guest/sev-guest.c
··· 38 38 struct miscdevice misc; 39 39 40 40 struct snp_msg_desc *msg_desc; 41 - 42 - union { 43 - struct snp_report_req report; 44 - struct snp_derived_key_req derived_key; 45 - struct snp_ext_report_req ext_report; 46 - } req; 47 41 }; 48 42 49 43 /* ··· 65 71 66 72 static int get_report(struct snp_guest_dev *snp_dev, struct snp_guest_request_ioctl *arg) 67 73 { 68 - struct snp_report_req *report_req = &snp_dev->req.report; 74 + struct snp_report_req *report_req __free(kfree) = NULL; 69 75 struct snp_msg_desc *mdesc = snp_dev->msg_desc; 70 76 struct snp_report_resp *report_resp; 71 77 struct snp_guest_req req = {}; ··· 73 79 74 80 if (!arg->req_data || !arg->resp_data) 75 81 return -EINVAL; 82 + 83 + report_req = kzalloc(sizeof(*report_req), GFP_KERNEL_ACCOUNT); 84 + if (!report_req) 85 + return -ENOMEM; 76 86 77 87 if (copy_from_user(report_req, (void __user *)arg->req_data, sizeof(*report_req))) 78 88 return -EFAULT; ··· 114 116 115 117 static int get_derived_key(struct snp_guest_dev *snp_dev, struct snp_guest_request_ioctl *arg) 116 118 { 117 - struct snp_derived_key_req *derived_key_req = &snp_dev->req.derived_key; 119 + struct snp_derived_key_req *derived_key_req __free(kfree) = NULL; 118 120 struct snp_derived_key_resp derived_key_resp = {0}; 119 121 struct snp_msg_desc *mdesc = snp_dev->msg_desc; 120 122 struct snp_guest_req req = {}; ··· 132 134 */ 133 135 resp_len = sizeof(derived_key_resp.data) + mdesc->ctx->authsize; 134 136 if (sizeof(buf) < resp_len) 137 + return -ENOMEM; 138 + 139 + derived_key_req = kzalloc(sizeof(*derived_key_req), GFP_KERNEL_ACCOUNT); 140 + if (!derived_key_req) 135 141 return -ENOMEM; 136 142 137 143 if (copy_from_user(derived_key_req, (void __user *)arg->req_data, ··· 170 168 struct snp_req_resp *io) 171 169 172 170 { 173 - struct snp_ext_report_req *report_req = &snp_dev->req.ext_report; 171 + struct snp_ext_report_req *report_req __free(kfree) = NULL; 174 172 struct snp_msg_desc *mdesc = snp_dev->msg_desc; 175 173 struct snp_report_resp *report_resp; 176 174 struct snp_guest_req req = {}; 177 175 int ret, npages = 0, resp_len; 178 176 sockptr_t certs_address; 177 + struct page *page; 179 178 180 179 if (sockptr_is_null(io->req_data) || sockptr_is_null(io->resp_data)) 181 180 return -EINVAL; 181 + 182 + report_req = kzalloc(sizeof(*report_req), GFP_KERNEL_ACCOUNT); 183 + if (!report_req) 184 + return -ENOMEM; 182 185 183 186 if (copy_from_sockptr(report_req, io->req_data, sizeof(*report_req))) 184 187 return -EFAULT; ··· 210 203 * the host. If host does not supply any certs in it, then copy 211 204 * zeros to indicate that certificate data was not provided. 212 205 */ 213 - memset(mdesc->certs_data, 0, report_req->certs_len); 214 206 npages = report_req->certs_len >> PAGE_SHIFT; 207 + page = alloc_pages(GFP_KERNEL_ACCOUNT | __GFP_ZERO, 208 + get_order(report_req->certs_len)); 209 + if (!page) 210 + return -ENOMEM; 211 + 212 + req.certs_data = page_address(page); 213 + ret = set_memory_decrypted((unsigned long)req.certs_data, npages); 214 + if (ret) { 215 + pr_err("failed to mark page shared, ret=%d\n", ret); 216 + __free_pages(page, get_order(report_req->certs_len)); 217 + return -EFAULT; 218 + } 219 + 215 220 cmd: 216 221 /* 217 222 * The intermediate response buffer is used while decrypting the ··· 232 213 */ 233 214 resp_len = sizeof(report_resp->data) + mdesc->ctx->authsize; 234 215 report_resp = kzalloc(resp_len, GFP_KERNEL_ACCOUNT); 235 - if (!report_resp) 236 - return -ENOMEM; 216 + if (!report_resp) { 217 + ret = -ENOMEM; 218 + goto e_free_data; 219 + } 237 220 238 - mdesc->input.data_npages = npages; 221 + req.input.data_npages = npages; 239 222 240 223 req.msg_version = arg->msg_version; 241 224 req.msg_type = SNP_MSG_REPORT_REQ; ··· 252 231 253 232 /* If certs length is invalid then copy the returned length */ 254 233 if (arg->vmm_error == SNP_GUEST_VMM_ERR_INVALID_LEN) { 255 - report_req->certs_len = mdesc->input.data_npages << PAGE_SHIFT; 234 + report_req->certs_len = req.input.data_npages << PAGE_SHIFT; 256 235 257 236 if (copy_to_sockptr(io->req_data, report_req, sizeof(*report_req))) 258 237 ret = -EFAULT; ··· 261 240 if (ret) 262 241 goto e_free; 263 242 264 - if (npages && copy_to_sockptr(certs_address, mdesc->certs_data, report_req->certs_len)) { 243 + if (npages && copy_to_sockptr(certs_address, req.certs_data, report_req->certs_len)) { 265 244 ret = -EFAULT; 266 245 goto e_free; 267 246 } ··· 271 250 272 251 e_free: 273 252 kfree(report_resp); 253 + e_free_data: 254 + if (npages) { 255 + if (set_memory_encrypted((unsigned long)req.certs_data, npages)) 256 + WARN_ONCE(ret, "failed to restore encryption mask (leak it)\n"); 257 + else 258 + __free_pages(page, get_order(report_req->certs_len)); 259 + } 274 260 return ret; 275 261 } 276 262
+2 -1
drivers/virt/vboxguest/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 config VBOXGUEST 3 3 tristate "Virtual Box Guest integration support" 4 - depends on (ARM64 || X86) && PCI && INPUT 4 + depends on (ARM64 || X86 || COMPILE_TEST) && PCI && INPUT 5 + depends on HAS_IOPORT 5 6 help 6 7 This is a driver for the Virtual Box Guest PCI device used in 7 8 Virtual Box virtual machines. Enabling this driver will add
+6 -5
fs/afs/cell.c
··· 64 64 return ERR_PTR(-ENAMETOOLONG); 65 65 66 66 if (!name) { 67 - cell = net->ws_cell; 67 + cell = rcu_dereference_protected(net->ws_cell, 68 + lockdep_is_held(&net->cells_lock)); 68 69 if (!cell) 69 70 return ERR_PTR(-EDESTADDRREQ); 70 71 goto found; ··· 389 388 /* install the new cell */ 390 389 down_write(&net->cells_lock); 391 390 afs_see_cell(new_root, afs_cell_trace_see_ws); 392 - old_root = net->ws_cell; 393 - net->ws_cell = new_root; 391 + old_root = rcu_replace_pointer(net->ws_cell, new_root, 392 + lockdep_is_held(&net->cells_lock)); 394 393 up_write(&net->cells_lock); 395 394 396 395 afs_unuse_cell(net, old_root, afs_cell_trace_unuse_ws); ··· 946 945 _enter(""); 947 946 948 947 down_write(&net->cells_lock); 949 - ws = net->ws_cell; 950 - net->ws_cell = NULL; 948 + ws = rcu_replace_pointer(net->ws_cell, NULL, 949 + lockdep_is_held(&net->cells_lock)); 951 950 up_write(&net->cells_lock); 952 951 afs_unuse_cell(net, ws, afs_cell_trace_unuse_ws); 953 952
+13 -2
fs/afs/dynroot.c
··· 314 314 const char *name; 315 315 bool dotted = vnode->fid.vnode == 3; 316 316 317 - if (!net->ws_cell) 317 + if (!dentry) { 318 + /* We're in RCU-pathwalk. */ 319 + cell = rcu_dereference(net->ws_cell); 320 + if (dotted) 321 + name = cell->name - 1; 322 + else 323 + name = cell->name; 324 + /* Shouldn't need to set a delayed call. */ 325 + return name; 326 + } 327 + 328 + if (!rcu_access_pointer(net->ws_cell)) 318 329 return ERR_PTR(-ENOENT); 319 330 320 331 down_read(&net->cells_lock); 321 332 322 - cell = net->ws_cell; 333 + cell = rcu_dereference_protected(net->ws_cell, lockdep_is_held(&net->cells_lock)); 323 334 if (dotted) 324 335 name = cell->name - 1; 325 336 else
+1 -1
fs/afs/internal.h
··· 287 287 288 288 /* Cell database */ 289 289 struct rb_root cells; 290 - struct afs_cell *ws_cell; 290 + struct afs_cell __rcu *ws_cell; 291 291 struct work_struct cells_manager; 292 292 struct timer_list cells_timer; 293 293 atomic_t cells_outstanding;
+2 -2
fs/afs/proc.c
··· 206 206 207 207 net = afs_seq2net_single(m); 208 208 down_read(&net->cells_lock); 209 - cell = net->ws_cell; 209 + cell = rcu_dereference_protected(net->ws_cell, lockdep_is_held(&net->cells_lock)); 210 210 if (cell) 211 211 seq_printf(m, "%s\n", cell->name); 212 212 up_read(&net->cells_lock); ··· 242 242 243 243 ret = -EEXIST; 244 244 inode_lock(file_inode(file)); 245 - if (!net->ws_cell) 245 + if (!rcu_access_pointer(net->ws_cell)) 246 246 ret = afs_cell_init(net, buf); 247 247 else 248 248 printk("busy\n");
+32 -27
fs/bcachefs/journal.c
··· 1021 1021 1022 1022 /* allocate journal on a device: */ 1023 1023 1024 - static int __bch2_set_nr_journal_buckets(struct bch_dev *ca, unsigned nr, 1025 - bool new_fs, struct closure *cl) 1024 + static int bch2_set_nr_journal_buckets_iter(struct bch_dev *ca, unsigned nr, 1025 + bool new_fs, struct closure *cl) 1026 1026 { 1027 1027 struct bch_fs *c = ca->fs; 1028 1028 struct journal_device *ja = &ca->journal; ··· 1150 1150 return ret; 1151 1151 } 1152 1152 1153 - /* 1154 - * Allocate more journal space at runtime - not currently making use if it, but 1155 - * the code works: 1156 - */ 1157 - int bch2_set_nr_journal_buckets(struct bch_fs *c, struct bch_dev *ca, 1158 - unsigned nr) 1153 + static int bch2_set_nr_journal_buckets_loop(struct bch_fs *c, struct bch_dev *ca, 1154 + unsigned nr, bool new_fs) 1159 1155 { 1160 1156 struct journal_device *ja = &ca->journal; 1161 - struct closure cl; 1162 1157 int ret = 0; 1163 1158 1159 + struct closure cl; 1164 1160 closure_init_stack(&cl); 1165 - 1166 - down_write(&c->state_lock); 1167 1161 1168 1162 /* don't handle reducing nr of buckets yet: */ 1169 1163 if (nr < ja->nr) 1170 - goto unlock; 1164 + return 0; 1171 1165 1172 - while (ja->nr < nr) { 1166 + while (!ret && ja->nr < nr) { 1173 1167 struct disk_reservation disk_res = { 0, 0, 0 }; 1174 1168 1175 1169 /* ··· 1176 1182 * filesystem-wide allocation will succeed, this is a device 1177 1183 * specific allocation - we can hang here: 1178 1184 */ 1185 + if (!new_fs) { 1186 + ret = bch2_disk_reservation_get(c, &disk_res, 1187 + bucket_to_sector(ca, nr - ja->nr), 1, 0); 1188 + if (ret) 1189 + break; 1190 + } 1179 1191 1180 - ret = bch2_disk_reservation_get(c, &disk_res, 1181 - bucket_to_sector(ca, nr - ja->nr), 1, 0); 1182 - if (ret) 1183 - break; 1192 + ret = bch2_set_nr_journal_buckets_iter(ca, nr, new_fs, &cl); 1184 1193 1185 - ret = __bch2_set_nr_journal_buckets(ca, nr, false, &cl); 1194 + if (ret == -BCH_ERR_bucket_alloc_blocked || 1195 + ret == -BCH_ERR_open_buckets_empty) 1196 + ret = 0; /* wait and retry */ 1186 1197 1187 1198 bch2_disk_reservation_put(c, &disk_res); 1188 - 1189 1199 closure_sync(&cl); 1190 - 1191 - if (ret && 1192 - ret != -BCH_ERR_bucket_alloc_blocked && 1193 - ret != -BCH_ERR_open_buckets_empty) 1194 - break; 1195 1200 } 1196 1201 1197 - bch_err_fn(c, ret); 1198 - unlock: 1202 + return ret; 1203 + } 1204 + 1205 + /* 1206 + * Allocate more journal space at runtime - not currently making use if it, but 1207 + * the code works: 1208 + */ 1209 + int bch2_set_nr_journal_buckets(struct bch_fs *c, struct bch_dev *ca, 1210 + unsigned nr) 1211 + { 1212 + down_write(&c->state_lock); 1213 + int ret = bch2_set_nr_journal_buckets_loop(c, ca, nr, false); 1199 1214 up_write(&c->state_lock); 1215 + 1216 + bch_err_fn(c, ret); 1200 1217 return ret; 1201 1218 } 1202 1219 ··· 1233 1228 min(1 << 13, 1234 1229 (1 << 24) / ca->mi.bucket_size)); 1235 1230 1236 - ret = __bch2_set_nr_journal_buckets(ca, nr, new_fs, NULL); 1231 + ret = bch2_set_nr_journal_buckets_loop(ca->fs, ca, nr, new_fs); 1237 1232 err: 1238 1233 bch_err_fn(ca, ret); 1239 1234 return ret;
+12 -13
fs/bcachefs/movinggc.c
··· 74 74 struct move_bucket *b, u64 time) 75 75 { 76 76 struct bch_fs *c = trans->c; 77 - struct btree_iter iter; 78 - struct bkey_s_c k; 79 - struct bch_alloc_v4 _a; 80 - const struct bch_alloc_v4 *a; 81 - int ret; 82 77 83 - if (bch2_bucket_is_open(trans->c, 84 - b->k.bucket.inode, 85 - b->k.bucket.offset)) 78 + if (bch2_bucket_is_open(c, b->k.bucket.inode, b->k.bucket.offset)) 86 79 return 0; 87 80 88 - k = bch2_bkey_get_iter(trans, &iter, BTREE_ID_alloc, 89 - b->k.bucket, BTREE_ITER_cached); 90 - ret = bkey_err(k); 81 + struct btree_iter iter; 82 + struct bkey_s_c k = bch2_bkey_get_iter(trans, &iter, BTREE_ID_alloc, 83 + b->k.bucket, BTREE_ITER_cached); 84 + int ret = bkey_err(k); 91 85 if (ret) 92 86 return ret; 93 87 ··· 89 95 if (!ca) 90 96 goto out; 91 97 92 - a = bch2_alloc_to_v4(k, &_a); 98 + if (ca->mi.state != BCH_MEMBER_STATE_rw || 99 + !bch2_dev_is_online(ca)) 100 + goto out_put; 101 + 102 + struct bch_alloc_v4 _a; 103 + const struct bch_alloc_v4 *a = bch2_alloc_to_v4(k, &_a); 93 104 b->k.gen = a->gen; 94 105 b->sectors = bch2_bucket_sectors_dirty(*a); 95 106 u64 lru_idx = alloc_lru_idx_fragmentation(*a, ca); 96 107 97 108 ret = lru_idx && lru_idx <= time; 98 - 109 + out_put: 99 110 bch2_dev_put(ca); 100 111 out: 101 112 bch2_trans_iter_exit(trans, &iter);
+16 -8
fs/bcachefs/super-io.c
··· 69 69 return v; 70 70 } 71 71 72 - void bch2_set_version_incompat(struct bch_fs *c, enum bcachefs_metadata_version version) 72 + bool bch2_set_version_incompat(struct bch_fs *c, enum bcachefs_metadata_version version) 73 73 { 74 - mutex_lock(&c->sb_lock); 75 - SET_BCH_SB_VERSION_INCOMPAT(c->disk_sb.sb, 76 - max(BCH_SB_VERSION_INCOMPAT(c->disk_sb.sb), version)); 77 - c->disk_sb.sb->features[0] |= cpu_to_le64(BCH_FEATURE_incompat_version_field); 78 - bch2_write_super(c); 79 - mutex_unlock(&c->sb_lock); 74 + bool ret = (c->sb.features & BIT_ULL(BCH_FEATURE_incompat_version_field)) && 75 + version <= c->sb.version_incompat_allowed; 76 + 77 + if (ret) { 78 + mutex_lock(&c->sb_lock); 79 + SET_BCH_SB_VERSION_INCOMPAT(c->disk_sb.sb, 80 + max(BCH_SB_VERSION_INCOMPAT(c->disk_sb.sb), version)); 81 + bch2_write_super(c); 82 + mutex_unlock(&c->sb_lock); 83 + } 84 + 85 + return ret; 80 86 } 81 87 82 88 const char * const bch2_sb_fields[] = { ··· 1225 1219 c->disk_sb.sb->version = cpu_to_le16(new_version); 1226 1220 c->disk_sb.sb->features[0] |= cpu_to_le64(BCH_SB_FEATURES_ALL); 1227 1221 1228 - if (incompat) 1222 + if (incompat) { 1229 1223 SET_BCH_SB_VERSION_INCOMPAT_ALLOWED(c->disk_sb.sb, 1230 1224 max(BCH_SB_VERSION_INCOMPAT_ALLOWED(c->disk_sb.sb), new_version)); 1225 + c->disk_sb.sb->features[0] |= cpu_to_le64(BCH_FEATURE_incompat_version_field); 1226 + } 1231 1227 } 1232 1228 1233 1229 static int bch2_sb_ext_validate(struct bch_sb *sb, struct bch_sb_field *f,
+4 -7
fs/bcachefs/super-io.h
··· 21 21 void bch2_version_to_text(struct printbuf *, enum bcachefs_metadata_version); 22 22 enum bcachefs_metadata_version bch2_latest_compatible_version(enum bcachefs_metadata_version); 23 23 24 - void bch2_set_version_incompat(struct bch_fs *, enum bcachefs_metadata_version); 24 + bool bch2_set_version_incompat(struct bch_fs *, enum bcachefs_metadata_version); 25 25 26 26 static inline bool bch2_request_incompat_feature(struct bch_fs *c, 27 27 enum bcachefs_metadata_version version) 28 28 { 29 - if (unlikely(version > c->sb.version_incompat)) { 30 - if (version > c->sb.version_incompat_allowed) 31 - return false; 32 - bch2_set_version_incompat(c, version); 33 - } 34 - return true; 29 + return likely(version <= c->sb.version_incompat) 30 + ? true 31 + : bch2_set_version_incompat(c, version); 35 32 } 36 33 37 34 static inline size_t bch2_sb_field_bytes(struct bch_sb_field *f)
+7 -2
fs/btrfs/inode.c
··· 1382 1382 continue; 1383 1383 } 1384 1384 if (done_offset) { 1385 - *done_offset = start - 1; 1386 - return 0; 1385 + /* 1386 + * Move @end to the end of the processed range, 1387 + * and exit the loop to unlock the processed extents. 1388 + */ 1389 + end = start - 1; 1390 + ret = 0; 1391 + break; 1387 1392 } 1388 1393 ret = -ENOSPC; 1389 1394 }
+2 -2
fs/btrfs/sysfs.c
··· 1330 1330 1331 1331 int btrfs_read_policy_to_enum(const char *str, s64 *value_ret) 1332 1332 { 1333 - char param[32] = { 0 }; 1333 + char param[32]; 1334 1334 char __maybe_unused *value_str; 1335 1335 1336 1336 if (!str || strlen(str) == 0) 1337 1337 return 0; 1338 1338 1339 - strncpy(param, str, sizeof(param) - 1); 1339 + strscpy(param, str); 1340 1340 1341 1341 #ifdef CONFIG_BTRFS_EXPERIMENTAL 1342 1342 /* Separate value from input in policy:value format. */
+1
fs/btrfs/volumes.c
··· 7155 7155 btrfs_err(fs_info, 7156 7156 "failed to add chunk map, start=%llu len=%llu: %d", 7157 7157 map->start, map->chunk_len, ret); 7158 + btrfs_free_chunk_map(map); 7158 7159 } 7159 7160 7160 7161 return ret;
+13 -2
fs/coredump.c
··· 63 63 64 64 static int core_uses_pid; 65 65 static unsigned int core_pipe_limit; 66 + static unsigned int core_sort_vma; 66 67 static char core_pattern[CORENAME_MAX_SIZE] = "core"; 67 68 static int core_name_size = CORENAME_MAX_SIZE; 68 69 unsigned int core_file_note_size_limit = CORE_FILE_NOTE_SIZE_DEFAULT; ··· 1027 1026 .extra1 = (unsigned int *)&core_file_note_size_min, 1028 1027 .extra2 = (unsigned int *)&core_file_note_size_max, 1029 1028 }, 1029 + { 1030 + .procname = "core_sort_vma", 1031 + .data = &core_sort_vma, 1032 + .maxlen = sizeof(int), 1033 + .mode = 0644, 1034 + .proc_handler = proc_douintvec_minmax, 1035 + .extra1 = SYSCTL_ZERO, 1036 + .extra2 = SYSCTL_ONE, 1037 + }, 1030 1038 }; 1031 1039 1032 1040 static int __init init_fs_coredump_sysctls(void) ··· 1266 1256 cprm->vma_data_size += m->dump_size; 1267 1257 } 1268 1258 1269 - sort(cprm->vma_meta, cprm->vma_count, sizeof(*cprm->vma_meta), 1270 - cmp_vma_size, NULL); 1259 + if (core_sort_vma) 1260 + sort(cprm->vma_meta, cprm->vma_count, sizeof(*cprm->vma_meta), 1261 + cmp_vma_size, NULL); 1271 1262 1272 1263 return true; 1273 1264 }
+1 -1
fs/fuse/dev.c
··· 1457 1457 if (ret < 0) 1458 1458 goto out; 1459 1459 1460 - if (pipe_occupancy(pipe->head, pipe->tail) + cs.nr_segs > pipe->max_usage) { 1460 + if (pipe_buf_usage(pipe) + cs.nr_segs > pipe->max_usage) { 1461 1461 ret = -EIO; 1462 1462 goto out; 1463 1463 }
+2 -1
fs/nfs/file.c
··· 29 29 #include <linux/pagemap.h> 30 30 #include <linux/gfp.h> 31 31 #include <linux/swap.h> 32 + #include <linux/compaction.h> 32 33 33 34 #include <linux/uaccess.h> 34 35 #include <linux/filelock.h> ··· 458 457 /* If the private flag is set, then the folio is not freeable */ 459 458 if (folio_test_private(folio)) { 460 459 if ((current_gfp_context(gfp) & GFP_KERNEL) != GFP_KERNEL || 461 - current_is_kswapd()) 460 + current_is_kswapd() || current_is_kcompactd()) 462 461 return false; 463 462 if (nfs_wb_folio(folio->mapping->host, folio) < 0) 464 463 return false;
+3 -3
fs/pipe.c
··· 394 394 wake_next_reader = true; 395 395 mutex_lock(&pipe->mutex); 396 396 } 397 - if (pipe_empty(pipe->head, pipe->tail)) 397 + if (pipe_is_empty(pipe)) 398 398 wake_next_reader = false; 399 399 mutex_unlock(&pipe->mutex); 400 400 ··· 577 577 kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); 578 578 wait_event_interruptible_exclusive(pipe->wr_wait, pipe_writable(pipe)); 579 579 mutex_lock(&pipe->mutex); 580 - was_empty = pipe_empty(pipe->head, pipe->tail); 580 + was_empty = pipe_is_empty(pipe); 581 581 wake_next_writer = true; 582 582 } 583 583 out: 584 - if (pipe_full(pipe->head, pipe->tail, pipe->max_usage)) 584 + if (pipe_is_full(pipe)) 585 585 wake_next_writer = false; 586 586 mutex_unlock(&pipe->mutex); 587 587
+10 -10
fs/splice.c
··· 331 331 int i; 332 332 333 333 /* Work out how much data we can actually add into the pipe */ 334 - used = pipe_occupancy(pipe->head, pipe->tail); 334 + used = pipe_buf_usage(pipe); 335 335 npages = max_t(ssize_t, pipe->max_usage - used, 0); 336 336 len = min_t(size_t, len, npages * PAGE_SIZE); 337 337 npages = DIV_ROUND_UP(len, PAGE_SIZE); ··· 527 527 return -ERESTARTSYS; 528 528 529 529 repeat: 530 - while (pipe_empty(pipe->head, pipe->tail)) { 530 + while (pipe_is_empty(pipe)) { 531 531 if (!pipe->writers) 532 532 return 0; 533 533 ··· 820 820 if (signal_pending(current)) 821 821 break; 822 822 823 - while (pipe_empty(pipe->head, pipe->tail)) { 823 + while (pipe_is_empty(pipe)) { 824 824 ret = 0; 825 825 if (!pipe->writers) 826 826 goto out; ··· 968 968 return 0; 969 969 970 970 /* Don't try to read more the pipe has space for. */ 971 - p_space = pipe->max_usage - pipe_occupancy(pipe->head, pipe->tail); 971 + p_space = pipe->max_usage - pipe_buf_usage(pipe); 972 972 len = min_t(size_t, len, p_space << PAGE_SHIFT); 973 973 974 974 if (unlikely(len > MAX_RW_COUNT)) ··· 1080 1080 more = sd->flags & SPLICE_F_MORE; 1081 1081 sd->flags |= SPLICE_F_MORE; 1082 1082 1083 - WARN_ON_ONCE(!pipe_empty(pipe->head, pipe->tail)); 1083 + WARN_ON_ONCE(!pipe_is_empty(pipe)); 1084 1084 1085 1085 while (len) { 1086 1086 size_t read_len; ··· 1268 1268 send_sig(SIGPIPE, current, 0); 1269 1269 return -EPIPE; 1270 1270 } 1271 - if (!pipe_full(pipe->head, pipe->tail, pipe->max_usage)) 1271 + if (!pipe_is_full(pipe)) 1272 1272 return 0; 1273 1273 if (flags & SPLICE_F_NONBLOCK) 1274 1274 return -EAGAIN; ··· 1652 1652 * Check the pipe occupancy without the inode lock first. This function 1653 1653 * is speculative anyways, so missing one is ok. 1654 1654 */ 1655 - if (!pipe_empty(pipe->head, pipe->tail)) 1655 + if (!pipe_is_empty(pipe)) 1656 1656 return 0; 1657 1657 1658 1658 ret = 0; 1659 1659 pipe_lock(pipe); 1660 1660 1661 - while (pipe_empty(pipe->head, pipe->tail)) { 1661 + while (pipe_is_empty(pipe)) { 1662 1662 if (signal_pending(current)) { 1663 1663 ret = -ERESTARTSYS; 1664 1664 break; ··· 1688 1688 * Check pipe occupancy without the inode lock first. This function 1689 1689 * is speculative anyways, so missing one is ok. 1690 1690 */ 1691 - if (!pipe_full(pipe->head, pipe->tail, pipe->max_usage)) 1691 + if (!pipe_is_full(pipe)) 1692 1692 return 0; 1693 1693 1694 1694 ret = 0; 1695 1695 pipe_lock(pipe); 1696 1696 1697 - while (pipe_full(pipe->head, pipe->tail, pipe->max_usage)) { 1697 + while (pipe_is_full(pipe)) { 1698 1698 if (!pipe->readers) { 1699 1699 send_sig(SIGPIPE, current, 0); 1700 1700 ret = -EPIPE;
+1 -2
fs/vboxsf/super.c
··· 21 21 22 22 #define VBOXSF_SUPER_MAGIC 0x786f4256 /* 'VBox' little endian */ 23 23 24 - static const unsigned char VBSF_MOUNT_SIGNATURE[4] = { '\000', '\377', '\376', 25 - '\375' }; 24 + static const unsigned char VBSF_MOUNT_SIGNATURE[4] __nonstring = "\000\377\376\375"; 26 25 27 26 static int follow_symlinks; 28 27 module_param(follow_symlinks, int, 0444);
+1 -1
include/linux/blk-mq.h
··· 28 28 typedef __u32 __bitwise req_flags_t; 29 29 30 30 /* Keep rqf_name[] in sync with the definitions below */ 31 - enum { 31 + enum rqf_flags { 32 32 /* drive already may have started this one */ 33 33 __RQF_STARTED, 34 34 /* request for flush sequence */
+5
include/linux/compaction.h
··· 80 80 return 2UL << order; 81 81 } 82 82 83 + static inline int current_is_kcompactd(void) 84 + { 85 + return current->flags & PF_KCOMPACTD; 86 + } 87 + 83 88 #ifdef CONFIG_COMPACTION 84 89 85 90 extern unsigned int extfrag_for_order(struct zone *zone, unsigned int order);
+5
include/linux/hugetlb.h
··· 682 682 683 683 int isolate_or_dissolve_huge_page(struct page *page, struct list_head *list); 684 684 int replace_free_hugepage_folios(unsigned long start_pfn, unsigned long end_pfn); 685 + void wait_for_freed_hugetlb_folios(void); 685 686 struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma, 686 687 unsigned long addr, bool cow_from_owner); 687 688 struct folio *alloc_hugetlb_folio_nodemask(struct hstate *h, int preferred_nid, ··· 1067 1066 unsigned long end_pfn) 1068 1067 { 1069 1068 return 0; 1069 + } 1070 + 1071 + static inline void wait_for_freed_hugetlb_folios(void) 1072 + { 1070 1073 } 1071 1074 1072 1075 static inline struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma,
+1 -1
include/linux/log2.h
··· 41 41 * *not* considered a power of two. 42 42 * Return: true if @n is a power of 2, otherwise false. 43 43 */ 44 - static inline __attribute__((const)) 44 + static __always_inline __attribute__((const)) 45 45 bool is_power_of_2(unsigned long n) 46 46 { 47 47 return (n != 0 && ((n & (n - 1)) == 0));
+27
include/linux/pipe_fs_i.h
··· 209 209 } 210 210 211 211 /** 212 + * pipe_is_full - Return true if the pipe is full 213 + * @pipe: the pipe 214 + */ 215 + static inline bool pipe_is_full(const struct pipe_inode_info *pipe) 216 + { 217 + return pipe_full(pipe->head, pipe->tail, pipe->max_usage); 218 + } 219 + 220 + /** 221 + * pipe_is_empty - Return true if the pipe is empty 222 + * @pipe: the pipe 223 + */ 224 + static inline bool pipe_is_empty(const struct pipe_inode_info *pipe) 225 + { 226 + return pipe_empty(pipe->head, pipe->tail); 227 + } 228 + 229 + /** 230 + * pipe_buf_usage - Return how many pipe buffers are in use 231 + * @pipe: the pipe 232 + */ 233 + static inline unsigned int pipe_buf_usage(const struct pipe_inode_info *pipe) 234 + { 235 + return pipe_occupancy(pipe->head, pipe->tail); 236 + } 237 + 238 + /** 212 239 * pipe_buf - Return the pipe buffer for the specified slot in the pipe ring 213 240 * @pipe: The pipe to access 214 241 * @slot: The slot of interest
+3
include/linux/platform_profile.h
··· 33 33 * @probe: Callback to setup choices available to the new class device. These 34 34 * choices will only be enforced when setting a new profile, not when 35 35 * getting the current one. 36 + * @hidden_choices: Callback to setup choices that are not visible to the user 37 + * but can be set by the driver. 36 38 * @profile_get: Callback that will be called when showing the current platform 37 39 * profile in sysfs. 38 40 * @profile_set: Callback that will be called when storing a new platform ··· 42 40 */ 43 41 struct platform_profile_ops { 44 42 int (*probe)(void *drvdata, unsigned long *choices); 43 + int (*hidden_choices)(void *drvdata, unsigned long *choices); 45 44 int (*profile_get)(struct device *dev, enum platform_profile_option *profile); 46 45 int (*profile_set)(struct device *dev, enum platform_profile_option profile); 47 46 };
+1 -1
include/linux/sched.h
··· 1701 1701 #define PF_USED_MATH 0x00002000 /* If unset the fpu must be initialized before use */ 1702 1702 #define PF_USER_WORKER 0x00004000 /* Kernel thread cloned from userspace thread */ 1703 1703 #define PF_NOFREEZE 0x00008000 /* This thread should not be frozen */ 1704 - #define PF__HOLE__00010000 0x00010000 1704 + #define PF_KCOMPACTD 0x00010000 /* I am kcompactd */ 1705 1705 #define PF_KSWAPD 0x00020000 /* I am kswapd */ 1706 1706 #define PF_MEMALLOC_NOFS 0x00040000 /* All allocations inherit GFP_NOFS. See memalloc_nfs_save() */ 1707 1707 #define PF_MEMALLOC_NOIO 0x00080000 /* All allocations inherit GFP_NOIO. See memalloc_noio_save() */
+38 -70
include/net/bluetooth/hci_core.h
··· 804 804 extern struct list_head hci_dev_list; 805 805 extern struct list_head hci_cb_list; 806 806 extern rwlock_t hci_dev_list_lock; 807 + extern struct mutex hci_cb_list_lock; 807 808 808 809 #define hci_dev_set_flag(hdev, nr) set_bit((nr), (hdev)->dev_flags) 809 810 #define hci_dev_clear_flag(hdev, nr) clear_bit((nr), (hdev)->dev_flags) ··· 2011 2010 2012 2011 char *name; 2013 2012 2014 - bool (*match) (struct hci_conn *conn); 2015 2013 void (*connect_cfm) (struct hci_conn *conn, __u8 status); 2016 2014 void (*disconn_cfm) (struct hci_conn *conn, __u8 status); 2017 2015 void (*security_cfm) (struct hci_conn *conn, __u8 status, 2018 - __u8 encrypt); 2016 + __u8 encrypt); 2019 2017 void (*key_change_cfm) (struct hci_conn *conn, __u8 status); 2020 2018 void (*role_switch_cfm) (struct hci_conn *conn, __u8 status, __u8 role); 2021 2019 }; 2022 2020 2023 - static inline void hci_cb_lookup(struct hci_conn *conn, struct list_head *list) 2024 - { 2025 - struct hci_cb *cb, *cpy; 2026 - 2027 - rcu_read_lock(); 2028 - list_for_each_entry_rcu(cb, &hci_cb_list, list) { 2029 - if (cb->match && cb->match(conn)) { 2030 - cpy = kmalloc(sizeof(*cpy), GFP_ATOMIC); 2031 - if (!cpy) 2032 - break; 2033 - 2034 - *cpy = *cb; 2035 - INIT_LIST_HEAD(&cpy->list); 2036 - list_add_rcu(&cpy->list, list); 2037 - } 2038 - } 2039 - rcu_read_unlock(); 2040 - } 2041 - 2042 2021 static inline void hci_connect_cfm(struct hci_conn *conn, __u8 status) 2043 2022 { 2044 - struct list_head list; 2045 - struct hci_cb *cb, *tmp; 2023 + struct hci_cb *cb; 2046 2024 2047 - INIT_LIST_HEAD(&list); 2048 - hci_cb_lookup(conn, &list); 2049 - 2050 - list_for_each_entry_safe(cb, tmp, &list, list) { 2025 + mutex_lock(&hci_cb_list_lock); 2026 + list_for_each_entry(cb, &hci_cb_list, list) { 2051 2027 if (cb->connect_cfm) 2052 2028 cb->connect_cfm(conn, status); 2053 - kfree(cb); 2054 2029 } 2030 + mutex_unlock(&hci_cb_list_lock); 2055 2031 2056 2032 if (conn->connect_cfm_cb) 2057 2033 conn->connect_cfm_cb(conn, status); ··· 2036 2058 2037 2059 static inline void hci_disconn_cfm(struct hci_conn *conn, __u8 reason) 2038 2060 { 2039 - struct list_head list; 2040 - struct hci_cb *cb, *tmp; 2061 + struct hci_cb *cb; 2041 2062 2042 - INIT_LIST_HEAD(&list); 2043 - hci_cb_lookup(conn, &list); 2044 - 2045 - list_for_each_entry_safe(cb, tmp, &list, list) { 2063 + mutex_lock(&hci_cb_list_lock); 2064 + list_for_each_entry(cb, &hci_cb_list, list) { 2046 2065 if (cb->disconn_cfm) 2047 2066 cb->disconn_cfm(conn, reason); 2048 - kfree(cb); 2049 2067 } 2068 + mutex_unlock(&hci_cb_list_lock); 2050 2069 2051 2070 if (conn->disconn_cfm_cb) 2052 2071 conn->disconn_cfm_cb(conn, reason); 2053 2072 } 2054 2073 2055 - static inline void hci_security_cfm(struct hci_conn *conn, __u8 status, 2056 - __u8 encrypt) 2057 - { 2058 - struct list_head list; 2059 - struct hci_cb *cb, *tmp; 2060 - 2061 - INIT_LIST_HEAD(&list); 2062 - hci_cb_lookup(conn, &list); 2063 - 2064 - list_for_each_entry_safe(cb, tmp, &list, list) { 2065 - if (cb->security_cfm) 2066 - cb->security_cfm(conn, status, encrypt); 2067 - kfree(cb); 2068 - } 2069 - 2070 - if (conn->security_cfm_cb) 2071 - conn->security_cfm_cb(conn, status); 2072 - } 2073 - 2074 2074 static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status) 2075 2075 { 2076 + struct hci_cb *cb; 2076 2077 __u8 encrypt; 2077 2078 2078 2079 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags)) ··· 2059 2102 2060 2103 encrypt = test_bit(HCI_CONN_ENCRYPT, &conn->flags) ? 0x01 : 0x00; 2061 2104 2062 - hci_security_cfm(conn, status, encrypt); 2105 + mutex_lock(&hci_cb_list_lock); 2106 + list_for_each_entry(cb, &hci_cb_list, list) { 2107 + if (cb->security_cfm) 2108 + cb->security_cfm(conn, status, encrypt); 2109 + } 2110 + mutex_unlock(&hci_cb_list_lock); 2111 + 2112 + if (conn->security_cfm_cb) 2113 + conn->security_cfm_cb(conn, status); 2063 2114 } 2064 2115 2065 2116 static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status) 2066 2117 { 2118 + struct hci_cb *cb; 2067 2119 __u8 encrypt; 2068 2120 2069 2121 if (conn->state == BT_CONFIG) { ··· 2099 2133 conn->sec_level = conn->pending_sec_level; 2100 2134 } 2101 2135 2102 - hci_security_cfm(conn, status, encrypt); 2136 + mutex_lock(&hci_cb_list_lock); 2137 + list_for_each_entry(cb, &hci_cb_list, list) { 2138 + if (cb->security_cfm) 2139 + cb->security_cfm(conn, status, encrypt); 2140 + } 2141 + mutex_unlock(&hci_cb_list_lock); 2142 + 2143 + if (conn->security_cfm_cb) 2144 + conn->security_cfm_cb(conn, status); 2103 2145 } 2104 2146 2105 2147 static inline void hci_key_change_cfm(struct hci_conn *conn, __u8 status) 2106 2148 { 2107 - struct list_head list; 2108 - struct hci_cb *cb, *tmp; 2149 + struct hci_cb *cb; 2109 2150 2110 - INIT_LIST_HEAD(&list); 2111 - hci_cb_lookup(conn, &list); 2112 - 2113 - list_for_each_entry_safe(cb, tmp, &list, list) { 2151 + mutex_lock(&hci_cb_list_lock); 2152 + list_for_each_entry(cb, &hci_cb_list, list) { 2114 2153 if (cb->key_change_cfm) 2115 2154 cb->key_change_cfm(conn, status); 2116 - kfree(cb); 2117 2155 } 2156 + mutex_unlock(&hci_cb_list_lock); 2118 2157 } 2119 2158 2120 2159 static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status, 2121 2160 __u8 role) 2122 2161 { 2123 - struct list_head list; 2124 - struct hci_cb *cb, *tmp; 2162 + struct hci_cb *cb; 2125 2163 2126 - INIT_LIST_HEAD(&list); 2127 - hci_cb_lookup(conn, &list); 2128 - 2129 - list_for_each_entry_safe(cb, tmp, &list, list) { 2164 + mutex_lock(&hci_cb_list_lock); 2165 + list_for_each_entry(cb, &hci_cb_list, list) { 2130 2166 if (cb->role_switch_cfm) 2131 2167 cb->role_switch_cfm(conn, status, role); 2132 - kfree(cb); 2133 2168 } 2169 + mutex_unlock(&hci_cb_list_lock); 2134 2170 } 2135 2171 2136 2172 static inline bool hci_bdaddr_is_rpa(bdaddr_t *bdaddr, u8 addr_type)
+3 -1
include/net/netfilter/nf_tables.h
··· 1891 1891 void __init nft_chain_route_init(void); 1892 1892 void nft_chain_route_fini(void); 1893 1893 1894 - void nf_tables_trans_destroy_flush_work(void); 1894 + void nf_tables_trans_destroy_flush_work(struct net *net); 1895 1895 1896 1896 int nf_msecs_to_jiffies64(const struct nlattr *nla, u64 *result); 1897 1897 __be64 nf_jiffies64_to_msecs(u64 input); ··· 1905 1905 struct nftables_pernet { 1906 1906 struct list_head tables; 1907 1907 struct list_head commit_list; 1908 + struct list_head destroy_list; 1908 1909 struct list_head commit_set_list; 1909 1910 struct list_head binding_list; 1910 1911 struct list_head module_list; ··· 1916 1915 unsigned int base_seq; 1917 1916 unsigned int gc_seq; 1918 1917 u8 validate_state; 1918 + struct work_struct destroy_work; 1919 1919 }; 1920 1920 1921 1921 extern unsigned int nf_tables_net_id;
+3 -4
io_uring/rw.c
··· 560 560 if (kiocb->ki_flags & IOCB_WRITE) 561 561 io_req_end_write(req); 562 562 if (unlikely(res != req->cqe.res)) { 563 - if (res == -EAGAIN && io_rw_should_reissue(req)) { 563 + if (res == -EAGAIN && io_rw_should_reissue(req)) 564 564 req->flags |= REQ_F_REISSUE | REQ_F_BL_NO_RECYCLE; 565 - return; 566 - } 567 - req->cqe.res = res; 565 + else 566 + req->cqe.res = res; 568 567 } 569 568 570 569 /* order with io_iopoll_complete() checking ->iopoll_completed */
+28 -4
kernel/events/core.c
··· 11830 11830 static struct lock_class_key cpuctx_mutex; 11831 11831 static struct lock_class_key cpuctx_lock; 11832 11832 11833 + static bool idr_cmpxchg(struct idr *idr, unsigned long id, void *old, void *new) 11834 + { 11835 + void *tmp, *val = idr_find(idr, id); 11836 + 11837 + if (val != old) 11838 + return false; 11839 + 11840 + tmp = idr_replace(idr, new, id); 11841 + if (IS_ERR(tmp)) 11842 + return false; 11843 + 11844 + WARN_ON_ONCE(tmp != val); 11845 + return true; 11846 + } 11847 + 11833 11848 int perf_pmu_register(struct pmu *pmu, const char *name, int type) 11834 11849 { 11835 11850 int cpu, ret, max = PERF_TYPE_MAX; ··· 11871 11856 if (type >= 0) 11872 11857 max = type; 11873 11858 11874 - ret = idr_alloc(&pmu_idr, pmu, max, 0, GFP_KERNEL); 11859 + ret = idr_alloc(&pmu_idr, NULL, max, 0, GFP_KERNEL); 11875 11860 if (ret < 0) 11876 11861 goto free_pdc; 11877 11862 ··· 11879 11864 11880 11865 type = ret; 11881 11866 pmu->type = type; 11867 + atomic_set(&pmu->exclusive_cnt, 0); 11882 11868 11883 11869 if (pmu_bus_running && !pmu->dev) { 11884 11870 ret = pmu_dev_alloc(pmu); ··· 11928 11912 if (!pmu->event_idx) 11929 11913 pmu->event_idx = perf_event_idx_default; 11930 11914 11915 + /* 11916 + * Now that the PMU is complete, make it visible to perf_try_init_event(). 11917 + */ 11918 + if (!idr_cmpxchg(&pmu_idr, pmu->type, NULL, pmu)) 11919 + goto free_context; 11931 11920 list_add_rcu(&pmu->entry, &pmus); 11932 - atomic_set(&pmu->exclusive_cnt, 0); 11921 + 11933 11922 ret = 0; 11934 11923 unlock: 11935 11924 mutex_unlock(&pmus_lock); 11936 11925 11937 11926 return ret; 11927 + 11928 + free_context: 11929 + free_percpu(pmu->cpu_pmu_context); 11938 11930 11939 11931 free_dev: 11940 11932 if (pmu->dev && pmu->dev != PMU_NULL_DEV) { ··· 11963 11939 { 11964 11940 mutex_lock(&pmus_lock); 11965 11941 list_del_rcu(&pmu->entry); 11942 + idr_remove(&pmu_idr, pmu->type); 11943 + mutex_unlock(&pmus_lock); 11966 11944 11967 11945 /* 11968 11946 * We dereference the pmu list under both SRCU and regular RCU, so ··· 11974 11948 synchronize_rcu(); 11975 11949 11976 11950 free_percpu(pmu->pmu_disable_count); 11977 - idr_remove(&pmu_idr, pmu->type); 11978 11951 if (pmu_bus_running && pmu->dev && pmu->dev != PMU_NULL_DEV) { 11979 11952 if (pmu->nr_addr_filters) 11980 11953 device_remove_file(pmu->dev, &dev_attr_nr_addr_filters); ··· 11981 11956 put_device(pmu->dev); 11982 11957 } 11983 11958 free_pmu_context(pmu); 11984 - mutex_unlock(&pmus_lock); 11985 11959 } 11986 11960 EXPORT_SYMBOL_GPL(perf_pmu_unregister); 11987 11961
+1 -1
kernel/sched/deadline.c
··· 3189 3189 * value smaller than the currently allocated bandwidth in 3190 3190 * any of the root_domains. 3191 3191 */ 3192 - for_each_possible_cpu(cpu) { 3192 + for_each_online_cpu(cpu) { 3193 3193 rcu_read_lock_sched(); 3194 3194 3195 3195 if (dl_bw_visited(cpu, gen))
+3
kernel/sched/ext.c
··· 6422 6422 __bpf_kfunc s32 scx_bpf_select_cpu_dfl(struct task_struct *p, s32 prev_cpu, 6423 6423 u64 wake_flags, bool *is_idle) 6424 6424 { 6425 + if (!ops_cpu_valid(prev_cpu, NULL)) 6426 + goto prev_cpu; 6427 + 6425 6428 if (!check_builtin_idle_enabled()) 6426 6429 goto prev_cpu; 6427 6430
+4 -2
kernel/sched/fair.c
··· 4045 4045 { 4046 4046 struct cfs_rq *prev_cfs_rq; 4047 4047 struct list_head *prev; 4048 + struct rq *rq = rq_of(cfs_rq); 4048 4049 4049 4050 if (cfs_rq->on_list) { 4050 4051 prev = cfs_rq->leaf_cfs_rq_list.prev; 4051 4052 } else { 4052 - struct rq *rq = rq_of(cfs_rq); 4053 - 4054 4053 prev = rq->tmp_alone_branch; 4055 4054 } 4055 + 4056 + if (prev == &rq->leaf_cfs_rq_list) 4057 + return false; 4056 4058 4057 4059 prev_cfs_rq = container_of(prev, struct cfs_rq, leaf_cfs_rq_list); 4058 4060
+1 -1
lib/Kconfig.debug
··· 2103 2103 reallocated, catching possible invalid pointers to the skb. 2104 2104 2105 2105 For more information, check 2106 - Documentation/dev-tools/fault-injection/fault-injection.rst 2106 + Documentation/fault-injection/fault-injection.rst 2107 2107 2108 2108 config FAULT_INJECTION_CONFIGFS 2109 2109 bool "Configfs interface for fault-injection capabilities"
+3
mm/compaction.c
··· 3181 3181 long default_timeout = msecs_to_jiffies(HPAGE_FRAG_CHECK_INTERVAL_MSEC); 3182 3182 long timeout = default_timeout; 3183 3183 3184 + current->flags |= PF_KCOMPACTD; 3184 3185 set_freezable(); 3185 3186 3186 3187 pgdat->kcompactd_max_order = 0; ··· 3237 3236 if (unlikely(pgdat->proactive_compact_trigger)) 3238 3237 pgdat->proactive_compact_trigger = false; 3239 3238 } 3239 + 3240 + current->flags &= ~PF_KCOMPACTD; 3240 3241 3241 3242 return 0; 3242 3243 }
+3 -4
mm/filemap.c
··· 2897 2897 size = min(size, folio_size(folio) - offset); 2898 2898 offset %= PAGE_SIZE; 2899 2899 2900 - while (spliced < size && 2901 - !pipe_full(pipe->head, pipe->tail, pipe->max_usage)) { 2900 + while (spliced < size && !pipe_is_full(pipe)) { 2902 2901 struct pipe_buffer *buf = pipe_head_buf(pipe); 2903 2902 size_t part = min_t(size_t, PAGE_SIZE - offset, size - spliced); 2904 2903 ··· 2954 2955 iocb.ki_pos = *ppos; 2955 2956 2956 2957 /* Work out how much data we can actually add into the pipe */ 2957 - used = pipe_occupancy(pipe->head, pipe->tail); 2958 + used = pipe_buf_usage(pipe); 2958 2959 npages = max_t(ssize_t, pipe->max_usage - used, 0); 2959 2960 len = min_t(size_t, len, npages * PAGE_SIZE); 2960 2961 ··· 3014 3015 total_spliced += n; 3015 3016 *ppos += n; 3016 3017 in->f_ra.prev_pos = *ppos; 3017 - if (pipe_full(pipe->head, pipe->tail, pipe->max_usage)) 3018 + if (pipe_is_full(pipe)) 3018 3019 goto out; 3019 3020 } 3020 3021
+8
mm/hugetlb.c
··· 2943 2943 return ret; 2944 2944 } 2945 2945 2946 + void wait_for_freed_hugetlb_folios(void) 2947 + { 2948 + if (llist_empty(&hpage_freelist)) 2949 + return; 2950 + 2951 + flush_work(&free_hpage_work); 2952 + } 2953 + 2946 2954 typedef enum { 2947 2955 /* 2948 2956 * For either 0/1: we checked the per-vma resv map, and one resv
+3 -2
mm/internal.h
··· 1115 1115 * mm/memory-failure.c 1116 1116 */ 1117 1117 #ifdef CONFIG_MEMORY_FAILURE 1118 - void unmap_poisoned_folio(struct folio *folio, enum ttu_flags ttu); 1118 + int unmap_poisoned_folio(struct folio *folio, unsigned long pfn, bool must_kill); 1119 1119 void shake_folio(struct folio *folio); 1120 1120 extern int hwpoison_filter(struct page *p); 1121 1121 ··· 1138 1138 struct vm_area_struct *vma); 1139 1139 1140 1140 #else 1141 - static inline void unmap_poisoned_folio(struct folio *folio, enum ttu_flags ttu) 1141 + static inline int unmap_poisoned_folio(struct folio *folio, unsigned long pfn, bool must_kill) 1142 1142 { 1143 + return -EBUSY; 1143 1144 } 1144 1145 #endif 1145 1146
+1
mm/kmsan/hooks.c
··· 357 357 size -= to_go; 358 358 } 359 359 } 360 + EXPORT_SYMBOL_GPL(kmsan_handle_dma); 360 361 361 362 void kmsan_handle_dma_sg(struct scatterlist *sg, int nents, 362 363 enum dma_data_direction dir)
+31 -32
mm/memory-failure.c
··· 1556 1556 return ret; 1557 1557 } 1558 1558 1559 - void unmap_poisoned_folio(struct folio *folio, enum ttu_flags ttu) 1559 + int unmap_poisoned_folio(struct folio *folio, unsigned long pfn, bool must_kill) 1560 1560 { 1561 - if (folio_test_hugetlb(folio) && !folio_test_anon(folio)) { 1562 - struct address_space *mapping; 1561 + enum ttu_flags ttu = TTU_IGNORE_MLOCK | TTU_SYNC | TTU_HWPOISON; 1562 + struct address_space *mapping; 1563 1563 1564 + if (folio_test_swapcache(folio)) { 1565 + pr_err("%#lx: keeping poisoned page in swap cache\n", pfn); 1566 + ttu &= ~TTU_HWPOISON; 1567 + } 1568 + 1569 + /* 1570 + * Propagate the dirty bit from PTEs to struct page first, because we 1571 + * need this to decide if we should kill or just drop the page. 1572 + * XXX: the dirty test could be racy: set_page_dirty() may not always 1573 + * be called inside page lock (it's recommended but not enforced). 1574 + */ 1575 + mapping = folio_mapping(folio); 1576 + if (!must_kill && !folio_test_dirty(folio) && mapping && 1577 + mapping_can_writeback(mapping)) { 1578 + if (folio_mkclean(folio)) { 1579 + folio_set_dirty(folio); 1580 + } else { 1581 + ttu &= ~TTU_HWPOISON; 1582 + pr_info("%#lx: corrupted page was clean: dropped without side effects\n", 1583 + pfn); 1584 + } 1585 + } 1586 + 1587 + if (folio_test_hugetlb(folio) && !folio_test_anon(folio)) { 1564 1588 /* 1565 1589 * For hugetlb folios in shared mappings, try_to_unmap 1566 1590 * could potentially call huge_pmd_unshare. Because of ··· 1596 1572 if (!mapping) { 1597 1573 pr_info("%#lx: could not lock mapping for mapped hugetlb folio\n", 1598 1574 folio_pfn(folio)); 1599 - return; 1575 + return -EBUSY; 1600 1576 } 1601 1577 1602 1578 try_to_unmap(folio, ttu|TTU_RMAP_LOCKED); ··· 1604 1580 } else { 1605 1581 try_to_unmap(folio, ttu); 1606 1582 } 1583 + 1584 + return folio_mapped(folio) ? -EBUSY : 0; 1607 1585 } 1608 1586 1609 1587 /* ··· 1615 1589 static bool hwpoison_user_mappings(struct folio *folio, struct page *p, 1616 1590 unsigned long pfn, int flags) 1617 1591 { 1618 - enum ttu_flags ttu = TTU_IGNORE_MLOCK | TTU_SYNC | TTU_HWPOISON; 1619 - struct address_space *mapping; 1620 1592 LIST_HEAD(tokill); 1621 1593 bool unmap_success; 1622 1594 int forcekill; ··· 1637 1613 if (!folio_mapped(folio)) 1638 1614 return true; 1639 1615 1640 - if (folio_test_swapcache(folio)) { 1641 - pr_err("%#lx: keeping poisoned page in swap cache\n", pfn); 1642 - ttu &= ~TTU_HWPOISON; 1643 - } 1644 - 1645 - /* 1646 - * Propagate the dirty bit from PTEs to struct page first, because we 1647 - * need this to decide if we should kill or just drop the page. 1648 - * XXX: the dirty test could be racy: set_page_dirty() may not always 1649 - * be called inside page lock (it's recommended but not enforced). 1650 - */ 1651 - mapping = folio_mapping(folio); 1652 - if (!(flags & MF_MUST_KILL) && !folio_test_dirty(folio) && mapping && 1653 - mapping_can_writeback(mapping)) { 1654 - if (folio_mkclean(folio)) { 1655 - folio_set_dirty(folio); 1656 - } else { 1657 - ttu &= ~TTU_HWPOISON; 1658 - pr_info("%#lx: corrupted page was clean: dropped without side effects\n", 1659 - pfn); 1660 - } 1661 - } 1662 - 1663 1616 /* 1664 1617 * First collect all the processes that have the page 1665 1618 * mapped in dirty form. This has to be done before try_to_unmap, ··· 1644 1643 */ 1645 1644 collect_procs(folio, p, &tokill, flags & MF_ACTION_REQUIRED); 1646 1645 1647 - unmap_poisoned_folio(folio, ttu); 1648 - 1649 - unmap_success = !folio_mapped(folio); 1646 + unmap_success = !unmap_poisoned_folio(folio, pfn, flags & MF_MUST_KILL); 1650 1647 if (!unmap_success) 1651 1648 pr_err("%#lx: failed to unmap page (folio mapcount=%d)\n", 1652 1649 pfn, folio_mapcount(folio));
+14 -7
mm/memory.c
··· 3051 3051 next = pgd_addr_end(addr, end); 3052 3052 if (pgd_none(*pgd) && !create) 3053 3053 continue; 3054 - if (WARN_ON_ONCE(pgd_leaf(*pgd))) 3055 - return -EINVAL; 3054 + if (WARN_ON_ONCE(pgd_leaf(*pgd))) { 3055 + err = -EINVAL; 3056 + break; 3057 + } 3056 3058 if (!pgd_none(*pgd) && WARN_ON_ONCE(pgd_bad(*pgd))) { 3057 3059 if (!create) 3058 3060 continue; ··· 5185 5183 bool is_cow = (vmf->flags & FAULT_FLAG_WRITE) && 5186 5184 !(vma->vm_flags & VM_SHARED); 5187 5185 int type, nr_pages; 5188 - unsigned long addr = vmf->address; 5186 + unsigned long addr; 5187 + bool needs_fallback = false; 5188 + 5189 + fallback: 5190 + addr = vmf->address; 5189 5191 5190 5192 /* Did we COW the page? */ 5191 5193 if (is_cow) ··· 5228 5222 * approach also applies to non-anonymous-shmem faults to avoid 5229 5223 * inflating the RSS of the process. 5230 5224 */ 5231 - if (!vma_is_anon_shmem(vma) || unlikely(userfaultfd_armed(vma))) { 5225 + if (!vma_is_anon_shmem(vma) || unlikely(userfaultfd_armed(vma)) || 5226 + unlikely(needs_fallback)) { 5232 5227 nr_pages = 1; 5233 5228 } else if (nr_pages > 1) { 5234 5229 pgoff_t idx = folio_page_idx(folio, page); ··· 5265 5258 ret = VM_FAULT_NOPAGE; 5266 5259 goto unlock; 5267 5260 } else if (nr_pages > 1 && !pte_range_none(vmf->pte, nr_pages)) { 5268 - update_mmu_tlb_range(vma, addr, vmf->pte, nr_pages); 5269 - ret = VM_FAULT_NOPAGE; 5270 - goto unlock; 5261 + needs_fallback = true; 5262 + pte_unmap_unlock(vmf->pte, vmf->ptl); 5263 + goto fallback; 5271 5264 } 5272 5265 5273 5266 folio_ref_add(folio, nr_pages - 1);
+13 -15
mm/memory_hotplug.c
··· 1822 1822 if (folio_test_large(folio)) 1823 1823 pfn = folio_pfn(folio) + folio_nr_pages(folio) - 1; 1824 1824 1825 - /* 1826 - * HWPoison pages have elevated reference counts so the migration would 1827 - * fail on them. It also doesn't make any sense to migrate them in the 1828 - * first place. Still try to unmap such a page in case it is still mapped 1829 - * (keep the unmap as the catch all safety net). 1830 - */ 1831 - if (folio_test_hwpoison(folio) || 1832 - (folio_test_large(folio) && folio_test_has_hwpoisoned(folio))) { 1833 - if (WARN_ON(folio_test_lru(folio))) 1834 - folio_isolate_lru(folio); 1835 - if (folio_mapped(folio)) 1836 - unmap_poisoned_folio(folio, TTU_IGNORE_MLOCK); 1837 - continue; 1838 - } 1839 - 1840 1825 if (!folio_try_get(folio)) 1841 1826 continue; 1842 1827 1843 1828 if (unlikely(page_folio(page) != folio)) 1844 1829 goto put_folio; 1830 + 1831 + if (folio_test_hwpoison(folio) || 1832 + (folio_test_large(folio) && folio_test_has_hwpoisoned(folio))) { 1833 + if (WARN_ON(folio_test_lru(folio))) 1834 + folio_isolate_lru(folio); 1835 + if (folio_mapped(folio)) { 1836 + folio_lock(folio); 1837 + unmap_poisoned_folio(folio, pfn, false); 1838 + folio_unlock(folio); 1839 + } 1840 + 1841 + goto put_folio; 1842 + } 1845 1843 1846 1844 if (!isolate_folio_to_list(folio, &source)) { 1847 1845 if (__ratelimit(&migrate_rs)) {
+2 -2
mm/page_alloc.c
··· 4243 4243 restart: 4244 4244 compaction_retries = 0; 4245 4245 no_progress_loops = 0; 4246 + compact_result = COMPACT_SKIPPED; 4246 4247 compact_priority = DEF_COMPACT_PRIORITY; 4247 4248 cpuset_mems_cookie = read_mems_allowed_begin(); 4248 4249 zonelist_iter_cookie = zonelist_iter_begin(); ··· 5850 5849 5851 5850 for (j = i + 1; j < MAX_NR_ZONES; j++) { 5852 5851 struct zone *upper_zone = &pgdat->node_zones[j]; 5853 - bool empty = !zone_managed_pages(upper_zone); 5854 5852 5855 5853 managed_pages += zone_managed_pages(upper_zone); 5856 5854 5857 - if (clear || empty) 5855 + if (clear) 5858 5856 zone->lowmem_reserve[j] = 0; 5859 5857 else 5860 5858 zone->lowmem_reserve[j] = managed_pages / ratio;
+10
mm/page_isolation.c
··· 608 608 int ret; 609 609 610 610 /* 611 + * Due to the deferred freeing of hugetlb folios, the hugepage folios may 612 + * not immediately release to the buddy system. This can cause PageBuddy() 613 + * to fail in __test_page_isolated_in_pageblock(). To ensure that the 614 + * hugetlb folios are properly released back to the buddy system, we 615 + * invoke the wait_for_freed_hugetlb_folios() function to wait for the 616 + * release to complete. 617 + */ 618 + wait_for_freed_hugetlb_folios(); 619 + 620 + /* 611 621 * Note: pageblock_nr_pages != MAX_PAGE_ORDER. Then, chunks of free 612 622 * pages are not aligned to pageblock_nr_pages. 613 623 * Then we just check migratetype first.
+31 -8
mm/shmem.c
··· 1548 1548 if (WARN_ON_ONCE(!wbc->for_reclaim)) 1549 1549 goto redirty; 1550 1550 1551 - if (WARN_ON_ONCE((info->flags & VM_LOCKED) || sbinfo->noswap)) 1551 + if ((info->flags & VM_LOCKED) || sbinfo->noswap) 1552 1552 goto redirty; 1553 1553 1554 1554 if (!total_swap_pages) ··· 2253 2253 struct folio *folio = NULL; 2254 2254 bool skip_swapcache = false; 2255 2255 swp_entry_t swap; 2256 - int error, nr_pages; 2256 + int error, nr_pages, order, split_order; 2257 2257 2258 2258 VM_BUG_ON(!*foliop || !xa_is_value(*foliop)); 2259 2259 swap = radix_to_swp_entry(*foliop); ··· 2272 2272 2273 2273 /* Look it up and read it in.. */ 2274 2274 folio = swap_cache_get_folio(swap, NULL, 0); 2275 + order = xa_get_order(&mapping->i_pages, index); 2275 2276 if (!folio) { 2276 - int order = xa_get_order(&mapping->i_pages, index); 2277 2277 bool fallback_order0 = false; 2278 - int split_order; 2279 2278 2280 2279 /* Or update major stats only when swapin succeeds?? */ 2281 2280 if (fault_type) { ··· 2338 2339 error = -ENOMEM; 2339 2340 goto failed; 2340 2341 } 2342 + } else if (order != folio_order(folio)) { 2343 + /* 2344 + * Swap readahead may swap in order 0 folios into swapcache 2345 + * asynchronously, while the shmem mapping can still stores 2346 + * large swap entries. In such cases, we should split the 2347 + * large swap entry to prevent possible data corruption. 2348 + */ 2349 + split_order = shmem_split_large_entry(inode, index, swap, gfp); 2350 + if (split_order < 0) { 2351 + error = split_order; 2352 + goto failed; 2353 + } 2354 + 2355 + /* 2356 + * If the large swap entry has already been split, it is 2357 + * necessary to recalculate the new swap entry based on 2358 + * the old order alignment. 2359 + */ 2360 + if (split_order > 0) { 2361 + pgoff_t offset = index - round_down(index, 1 << split_order); 2362 + 2363 + swap = swp_entry(swp_type(swap), swp_offset(swap) + offset); 2364 + } 2341 2365 } 2342 2366 2343 2367 alloced: ··· 2368 2346 folio_lock(folio); 2369 2347 if ((!skip_swapcache && !folio_test_swapcache(folio)) || 2370 2348 folio->swap.val != swap.val || 2371 - !shmem_confirm_swap(mapping, index, swap)) { 2349 + !shmem_confirm_swap(mapping, index, swap) || 2350 + xa_get_order(&mapping->i_pages, index) != folio_order(folio)) { 2372 2351 error = -EEXIST; 2373 2352 goto unlock; 2374 2353 } ··· 3510 3487 3511 3488 size = min_t(size_t, size, PAGE_SIZE - offset); 3512 3489 3513 - if (!pipe_full(pipe->head, pipe->tail, pipe->max_usage)) { 3490 + if (!pipe_is_full(pipe)) { 3514 3491 struct pipe_buffer *buf = pipe_head_buf(pipe); 3515 3492 3516 3493 *buf = (struct pipe_buffer) { ··· 3537 3514 int error = 0; 3538 3515 3539 3516 /* Work out how much data we can actually add into the pipe */ 3540 - used = pipe_occupancy(pipe->head, pipe->tail); 3517 + used = pipe_buf_usage(pipe); 3541 3518 npages = max_t(ssize_t, pipe->max_usage - used, 0); 3542 3519 len = min_t(size_t, len, npages * PAGE_SIZE); 3543 3520 ··· 3624 3601 total_spliced += n; 3625 3602 *ppos += n; 3626 3603 in->f_ra.prev_pos = *ppos; 3627 - if (pipe_full(pipe->head, pipe->tail, pipe->max_usage)) 3604 + if (pipe_is_full(pipe)) 3628 3605 break; 3629 3606 3630 3607 cond_resched();
+10 -4
mm/slab_common.c
··· 1304 1304 static int rcu_delay_page_cache_fill_msec = 5000; 1305 1305 module_param(rcu_delay_page_cache_fill_msec, int, 0444); 1306 1306 1307 + static struct workqueue_struct *rcu_reclaim_wq; 1308 + 1307 1309 /* Maximum number of jiffies to wait before draining a batch. */ 1308 1310 #define KFREE_DRAIN_JIFFIES (5 * HZ) 1309 1311 #define KFREE_N_BATCHES 2 ··· 1634 1632 if (delayed_work_pending(&krcp->monitor_work)) { 1635 1633 delay_left = krcp->monitor_work.timer.expires - jiffies; 1636 1634 if (delay < delay_left) 1637 - mod_delayed_work(system_unbound_wq, &krcp->monitor_work, delay); 1635 + mod_delayed_work(rcu_reclaim_wq, &krcp->monitor_work, delay); 1638 1636 return; 1639 1637 } 1640 - queue_delayed_work(system_unbound_wq, &krcp->monitor_work, delay); 1638 + queue_delayed_work(rcu_reclaim_wq, &krcp->monitor_work, delay); 1641 1639 } 1642 1640 1643 1641 static void ··· 1735 1733 // "free channels", the batch can handle. Break 1736 1734 // the loop since it is done with this CPU thus 1737 1735 // queuing an RCU work is _always_ success here. 1738 - queued = queue_rcu_work(system_unbound_wq, &krwp->rcu_work); 1736 + queued = queue_rcu_work(rcu_reclaim_wq, &krwp->rcu_work); 1739 1737 WARN_ON_ONCE(!queued); 1740 1738 break; 1741 1739 } ··· 1885 1883 if (rcu_scheduler_active == RCU_SCHEDULER_RUNNING && 1886 1884 !atomic_xchg(&krcp->work_in_progress, 1)) { 1887 1885 if (atomic_read(&krcp->backoff_page_cache_fill)) { 1888 - queue_delayed_work(system_unbound_wq, 1886 + queue_delayed_work(rcu_reclaim_wq, 1889 1887 &krcp->page_cache_work, 1890 1888 msecs_to_jiffies(rcu_delay_page_cache_fill_msec)); 1891 1889 } else { ··· 2121 2119 int cpu; 2122 2120 int i, j; 2123 2121 struct shrinker *kfree_rcu_shrinker; 2122 + 2123 + rcu_reclaim_wq = alloc_workqueue("kvfree_rcu_reclaim", 2124 + WQ_UNBOUND | WQ_MEM_RECLAIM, 0); 2125 + WARN_ON(!rcu_reclaim_wq); 2124 2126 2125 2127 /* Clamp it to [0:100] seconds interval. */ 2126 2128 if (rcu_delay_page_cache_fill_msec < 0 ||
+10 -2
mm/swapfile.c
··· 653 653 return; 654 654 655 655 if (!ci->count) { 656 - free_cluster(si, ci); 656 + if (ci->flags != CLUSTER_FLAG_FREE) 657 + free_cluster(si, ci); 657 658 } else if (ci->count != SWAPFILE_CLUSTER) { 658 659 if (ci->flags != CLUSTER_FLAG_FRAG) 659 660 move_cluster(si, ci, &si->frag_clusters[ci->order], ··· 858 857 } 859 858 offset++; 860 859 } 860 + 861 + /* in case no swap cache is reclaimed */ 862 + if (ci->flags == CLUSTER_FLAG_NONE) 863 + relocate_cluster(si, ci); 861 864 862 865 unlock_cluster(ci); 863 866 if (to_scan <= 0) ··· 2646 2641 for (offset = 0; offset < end; offset += SWAPFILE_CLUSTER) { 2647 2642 ci = lock_cluster(si, offset); 2648 2643 unlock_cluster(ci); 2649 - offset += SWAPFILE_CLUSTER; 2650 2644 } 2651 2645 } 2652 2646 ··· 3546 3542 int err, i; 3547 3543 3548 3544 si = swp_swap_info(entry); 3545 + if (WARN_ON_ONCE(!si)) { 3546 + pr_err("%s%08lx\n", Bad_file, entry.val); 3547 + return -EINVAL; 3548 + } 3549 3549 3550 3550 offset = swp_offset(entry); 3551 3551 VM_WARN_ON(nr > SWAPFILE_CLUSTER - offset % SWAPFILE_CLUSTER);
+90 -17
mm/userfaultfd.c
··· 18 18 #include <asm/tlbflush.h> 19 19 #include <asm/tlb.h> 20 20 #include "internal.h" 21 + #include "swap.h" 21 22 22 23 static __always_inline 23 24 bool validate_dst_vma(struct vm_area_struct *dst_vma, unsigned long dst_end) ··· 1077 1076 return err; 1078 1077 } 1079 1078 1080 - static int move_swap_pte(struct mm_struct *mm, 1079 + static int move_swap_pte(struct mm_struct *mm, struct vm_area_struct *dst_vma, 1081 1080 unsigned long dst_addr, unsigned long src_addr, 1082 1081 pte_t *dst_pte, pte_t *src_pte, 1083 1082 pte_t orig_dst_pte, pte_t orig_src_pte, 1084 1083 pmd_t *dst_pmd, pmd_t dst_pmdval, 1085 - spinlock_t *dst_ptl, spinlock_t *src_ptl) 1084 + spinlock_t *dst_ptl, spinlock_t *src_ptl, 1085 + struct folio *src_folio) 1086 1086 { 1087 - if (!pte_swp_exclusive(orig_src_pte)) 1088 - return -EBUSY; 1089 - 1090 1087 double_pt_lock(dst_ptl, src_ptl); 1091 1088 1092 1089 if (!is_pte_pages_stable(dst_pte, src_pte, orig_dst_pte, orig_src_pte, 1093 1090 dst_pmd, dst_pmdval)) { 1094 1091 double_pt_unlock(dst_ptl, src_ptl); 1095 1092 return -EAGAIN; 1093 + } 1094 + 1095 + /* 1096 + * The src_folio resides in the swapcache, requiring an update to its 1097 + * index and mapping to align with the dst_vma, where a swap-in may 1098 + * occur and hit the swapcache after moving the PTE. 1099 + */ 1100 + if (src_folio) { 1101 + folio_move_anon_rmap(src_folio, dst_vma); 1102 + src_folio->index = linear_page_index(dst_vma, dst_addr); 1096 1103 } 1097 1104 1098 1105 orig_src_pte = ptep_get_and_clear(mm, src_addr, src_pte); ··· 1150 1141 __u64 mode) 1151 1142 { 1152 1143 swp_entry_t entry; 1144 + struct swap_info_struct *si = NULL; 1153 1145 pte_t orig_src_pte, orig_dst_pte; 1154 1146 pte_t src_folio_pte; 1155 1147 spinlock_t *src_ptl, *dst_ptl; ··· 1250 1240 */ 1251 1241 if (!src_folio) { 1252 1242 struct folio *folio; 1243 + bool locked; 1253 1244 1254 1245 /* 1255 1246 * Pin the page while holding the lock to be sure the ··· 1270 1259 goto out; 1271 1260 } 1272 1261 1262 + locked = folio_trylock(folio); 1263 + /* 1264 + * We avoid waiting for folio lock with a raised 1265 + * refcount for large folios because extra refcounts 1266 + * will result in split_folio() failing later and 1267 + * retrying. If multiple tasks are trying to move a 1268 + * large folio we can end up livelocking. 1269 + */ 1270 + if (!locked && folio_test_large(folio)) { 1271 + spin_unlock(src_ptl); 1272 + err = -EAGAIN; 1273 + goto out; 1274 + } 1275 + 1273 1276 folio_get(folio); 1274 1277 src_folio = folio; 1275 1278 src_folio_pte = orig_src_pte; 1276 1279 spin_unlock(src_ptl); 1277 1280 1278 - if (!folio_trylock(src_folio)) { 1279 - pte_unmap(&orig_src_pte); 1280 - pte_unmap(&orig_dst_pte); 1281 + if (!locked) { 1282 + pte_unmap(src_pte); 1283 + pte_unmap(dst_pte); 1281 1284 src_pte = dst_pte = NULL; 1282 1285 /* now we can block and wait */ 1283 1286 folio_lock(src_folio); ··· 1307 1282 /* at this point we have src_folio locked */ 1308 1283 if (folio_test_large(src_folio)) { 1309 1284 /* split_folio() can block */ 1310 - pte_unmap(&orig_src_pte); 1311 - pte_unmap(&orig_dst_pte); 1285 + pte_unmap(src_pte); 1286 + pte_unmap(dst_pte); 1312 1287 src_pte = dst_pte = NULL; 1313 1288 err = split_folio(src_folio); 1314 1289 if (err) ··· 1333 1308 goto out; 1334 1309 } 1335 1310 if (!anon_vma_trylock_write(src_anon_vma)) { 1336 - pte_unmap(&orig_src_pte); 1337 - pte_unmap(&orig_dst_pte); 1311 + pte_unmap(src_pte); 1312 + pte_unmap(dst_pte); 1338 1313 src_pte = dst_pte = NULL; 1339 1314 /* now we can block and wait */ 1340 1315 anon_vma_lock_write(src_anon_vma); ··· 1347 1322 orig_dst_pte, orig_src_pte, dst_pmd, 1348 1323 dst_pmdval, dst_ptl, src_ptl, src_folio); 1349 1324 } else { 1325 + struct folio *folio = NULL; 1326 + 1350 1327 entry = pte_to_swp_entry(orig_src_pte); 1351 1328 if (non_swap_entry(entry)) { 1352 1329 if (is_migration_entry(entry)) { 1353 - pte_unmap(&orig_src_pte); 1354 - pte_unmap(&orig_dst_pte); 1330 + pte_unmap(src_pte); 1331 + pte_unmap(dst_pte); 1355 1332 src_pte = dst_pte = NULL; 1356 1333 migration_entry_wait(mm, src_pmd, src_addr); 1357 1334 err = -EAGAIN; ··· 1362 1335 goto out; 1363 1336 } 1364 1337 1365 - err = move_swap_pte(mm, dst_addr, src_addr, dst_pte, src_pte, 1366 - orig_dst_pte, orig_src_pte, dst_pmd, 1367 - dst_pmdval, dst_ptl, src_ptl); 1338 + if (!pte_swp_exclusive(orig_src_pte)) { 1339 + err = -EBUSY; 1340 + goto out; 1341 + } 1342 + 1343 + si = get_swap_device(entry); 1344 + if (unlikely(!si)) { 1345 + err = -EAGAIN; 1346 + goto out; 1347 + } 1348 + /* 1349 + * Verify the existence of the swapcache. If present, the folio's 1350 + * index and mapping must be updated even when the PTE is a swap 1351 + * entry. The anon_vma lock is not taken during this process since 1352 + * the folio has already been unmapped, and the swap entry is 1353 + * exclusive, preventing rmap walks. 1354 + * 1355 + * For large folios, return -EBUSY immediately, as split_folio() 1356 + * also returns -EBUSY when attempting to split unmapped large 1357 + * folios in the swapcache. This issue needs to be resolved 1358 + * separately to allow proper handling. 1359 + */ 1360 + if (!src_folio) 1361 + folio = filemap_get_folio(swap_address_space(entry), 1362 + swap_cache_index(entry)); 1363 + if (!IS_ERR_OR_NULL(folio)) { 1364 + if (folio_test_large(folio)) { 1365 + err = -EBUSY; 1366 + folio_put(folio); 1367 + goto out; 1368 + } 1369 + src_folio = folio; 1370 + src_folio_pte = orig_src_pte; 1371 + if (!folio_trylock(src_folio)) { 1372 + pte_unmap(src_pte); 1373 + pte_unmap(dst_pte); 1374 + src_pte = dst_pte = NULL; 1375 + put_swap_device(si); 1376 + si = NULL; 1377 + /* now we can block and wait */ 1378 + folio_lock(src_folio); 1379 + goto retry; 1380 + } 1381 + } 1382 + err = move_swap_pte(mm, dst_vma, dst_addr, src_addr, dst_pte, src_pte, 1383 + orig_dst_pte, orig_src_pte, dst_pmd, dst_pmdval, 1384 + dst_ptl, src_ptl, src_folio); 1368 1385 } 1369 1386 1370 1387 out: ··· 1425 1354 if (src_pte) 1426 1355 pte_unmap(src_pte); 1427 1356 mmu_notifier_invalidate_range_end(&range); 1357 + if (si) 1358 + put_swap_device(si); 1428 1359 1429 1360 return err; 1430 1361 }
+8 -4
mm/vma.c
··· 1509 1509 static struct vm_area_struct *vma_modify(struct vma_merge_struct *vmg) 1510 1510 { 1511 1511 struct vm_area_struct *vma = vmg->vma; 1512 + unsigned long start = vmg->start; 1513 + unsigned long end = vmg->end; 1512 1514 struct vm_area_struct *merged; 1513 1515 1514 1516 /* First, try to merge. */ 1515 1517 merged = vma_merge_existing_range(vmg); 1516 1518 if (merged) 1517 1519 return merged; 1520 + if (vmg_nomem(vmg)) 1521 + return ERR_PTR(-ENOMEM); 1518 1522 1519 1523 /* Split any preceding portion of the VMA. */ 1520 - if (vma->vm_start < vmg->start) { 1521 - int err = split_vma(vmg->vmi, vma, vmg->start, 1); 1524 + if (vma->vm_start < start) { 1525 + int err = split_vma(vmg->vmi, vma, start, 1); 1522 1526 1523 1527 if (err) 1524 1528 return ERR_PTR(err); 1525 1529 } 1526 1530 1527 1531 /* Split any trailing portion of the VMA. */ 1528 - if (vma->vm_end > vmg->end) { 1529 - int err = split_vma(vmg->vmi, vma, vmg->end, 0); 1532 + if (vma->vm_end > end) { 1533 + int err = split_vma(vmg->vmi, vma, end, 0); 1530 1534 1531 1535 if (err) 1532 1536 return ERR_PTR(err);
+2 -2
mm/vmalloc.c
··· 586 586 mask |= PGTBL_PGD_MODIFIED; 587 587 err = vmap_pages_p4d_range(pgd, addr, next, prot, pages, &nr, &mask); 588 588 if (err) 589 - return err; 589 + break; 590 590 } while (pgd++, addr = next, addr != end); 591 591 592 592 if (mask & ARCH_PAGE_TABLE_SYNC_MASK) 593 593 arch_sync_kernel_mappings(start, end); 594 594 595 - return 0; 595 + return err; 596 596 } 597 597 598 598 /*
+1 -1
mm/zswap.c
··· 43 43 * statistics 44 44 **********************************/ 45 45 /* The number of compressed pages currently stored in zswap */ 46 - atomic_long_t zswap_stored_pages = ATOMIC_INIT(0); 46 + atomic_long_t zswap_stored_pages = ATOMIC_LONG_INIT(0); 47 47 48 48 /* 49 49 * The statistics below are not protected from concurrent access for
+7 -3
net/bluetooth/hci_core.c
··· 57 57 58 58 /* HCI callback list */ 59 59 LIST_HEAD(hci_cb_list); 60 + DEFINE_MUTEX(hci_cb_list_lock); 60 61 61 62 /* HCI ID Numbering */ 62 63 static DEFINE_IDA(hci_index_ida); ··· 2973 2972 { 2974 2973 BT_DBG("%p name %s", cb, cb->name); 2975 2974 2976 - list_add_tail_rcu(&cb->list, &hci_cb_list); 2975 + mutex_lock(&hci_cb_list_lock); 2976 + list_add_tail(&cb->list, &hci_cb_list); 2977 + mutex_unlock(&hci_cb_list_lock); 2977 2978 2978 2979 return 0; 2979 2980 } ··· 2985 2982 { 2986 2983 BT_DBG("%p name %s", cb, cb->name); 2987 2984 2988 - list_del_rcu(&cb->list); 2989 - synchronize_rcu(); 2985 + mutex_lock(&hci_cb_list_lock); 2986 + list_del(&cb->list); 2987 + mutex_unlock(&hci_cb_list_lock); 2990 2988 2991 2989 return 0; 2992 2990 }
+22 -15
net/bluetooth/hci_event.c
··· 3391 3391 hci_update_scan(hdev); 3392 3392 } 3393 3393 3394 - params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type); 3395 - if (params) { 3396 - switch (params->auto_connect) { 3397 - case HCI_AUTO_CONN_LINK_LOSS: 3398 - if (ev->reason != HCI_ERROR_CONNECTION_TIMEOUT) 3394 + /* Re-enable passive scanning if disconnected device is marked 3395 + * as auto-connectable. 3396 + */ 3397 + if (conn->type == LE_LINK) { 3398 + params = hci_conn_params_lookup(hdev, &conn->dst, 3399 + conn->dst_type); 3400 + if (params) { 3401 + switch (params->auto_connect) { 3402 + case HCI_AUTO_CONN_LINK_LOSS: 3403 + if (ev->reason != HCI_ERROR_CONNECTION_TIMEOUT) 3404 + break; 3405 + fallthrough; 3406 + 3407 + case HCI_AUTO_CONN_DIRECT: 3408 + case HCI_AUTO_CONN_ALWAYS: 3409 + hci_pend_le_list_del_init(params); 3410 + hci_pend_le_list_add(params, 3411 + &hdev->pend_le_conns); 3412 + hci_update_passive_scan(hdev); 3399 3413 break; 3400 - fallthrough; 3401 3414 3402 - case HCI_AUTO_CONN_DIRECT: 3403 - case HCI_AUTO_CONN_ALWAYS: 3404 - hci_pend_le_list_del_init(params); 3405 - hci_pend_le_list_add(params, &hdev->pend_le_conns); 3406 - hci_update_passive_scan(hdev); 3407 - break; 3408 - 3409 - default: 3410 - break; 3415 + default: 3416 + break; 3417 + } 3411 3418 } 3412 3419 } 3413 3420
-6
net/bluetooth/iso.c
··· 2187 2187 return HCI_LM_ACCEPT; 2188 2188 } 2189 2189 2190 - static bool iso_match(struct hci_conn *hcon) 2191 - { 2192 - return hcon->type == ISO_LINK || hcon->type == LE_LINK; 2193 - } 2194 - 2195 2190 static void iso_connect_cfm(struct hci_conn *hcon, __u8 status) 2196 2191 { 2197 2192 if (hcon->type != ISO_LINK) { ··· 2368 2373 2369 2374 static struct hci_cb iso_cb = { 2370 2375 .name = "ISO", 2371 - .match = iso_match, 2372 2376 .connect_cfm = iso_connect_cfm, 2373 2377 .disconn_cfm = iso_disconn_cfm, 2374 2378 };
+6 -6
net/bluetooth/l2cap_core.c
··· 7182 7182 return NULL; 7183 7183 } 7184 7184 7185 - static bool l2cap_match(struct hci_conn *hcon) 7186 - { 7187 - return hcon->type == ACL_LINK || hcon->type == LE_LINK; 7188 - } 7189 - 7190 7185 static void l2cap_connect_cfm(struct hci_conn *hcon, u8 status) 7191 7186 { 7192 7187 struct hci_dev *hdev = hcon->hdev; 7193 7188 struct l2cap_conn *conn; 7194 7189 struct l2cap_chan *pchan; 7195 7190 u8 dst_type; 7191 + 7192 + if (hcon->type != ACL_LINK && hcon->type != LE_LINK) 7193 + return; 7196 7194 7197 7195 BT_DBG("hcon %p bdaddr %pMR status %d", hcon, &hcon->dst, status); 7198 7196 ··· 7256 7258 7257 7259 static void l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason) 7258 7260 { 7261 + if (hcon->type != ACL_LINK && hcon->type != LE_LINK) 7262 + return; 7263 + 7259 7264 BT_DBG("hcon %p reason %d", hcon, reason); 7260 7265 7261 7266 l2cap_conn_del(hcon, bt_to_errno(reason)); ··· 7566 7565 7567 7566 static struct hci_cb l2cap_cb = { 7568 7567 .name = "L2CAP", 7569 - .match = l2cap_match, 7570 7568 .connect_cfm = l2cap_connect_cfm, 7571 7569 .disconn_cfm = l2cap_disconn_cfm, 7572 7570 .security_cfm = l2cap_security_cfm,
-6
net/bluetooth/rfcomm/core.c
··· 2134 2134 return 0; 2135 2135 } 2136 2136 2137 - static bool rfcomm_match(struct hci_conn *hcon) 2138 - { 2139 - return hcon->type == ACL_LINK; 2140 - } 2141 - 2142 2137 static void rfcomm_security_cfm(struct hci_conn *conn, u8 status, u8 encrypt) 2143 2138 { 2144 2139 struct rfcomm_session *s; ··· 2180 2185 2181 2186 static struct hci_cb rfcomm_cb = { 2182 2187 .name = "RFCOMM", 2183 - .match = rfcomm_match, 2184 2188 .security_cfm = rfcomm_security_cfm 2185 2189 }; 2186 2190
+18 -7
net/bluetooth/sco.c
··· 107 107 kref_put(&conn->ref, sco_conn_free); 108 108 } 109 109 110 + static struct sco_conn *sco_conn_hold(struct sco_conn *conn) 111 + { 112 + BT_DBG("conn %p refcnt %u", conn, kref_read(&conn->ref)); 113 + 114 + kref_get(&conn->ref); 115 + return conn; 116 + } 117 + 110 118 static struct sco_conn *sco_conn_hold_unless_zero(struct sco_conn *conn) 111 119 { 112 120 if (!conn) ··· 1361 1353 bacpy(&sco_pi(sk)->src, &conn->hcon->src); 1362 1354 bacpy(&sco_pi(sk)->dst, &conn->hcon->dst); 1363 1355 1356 + sco_conn_hold(conn); 1364 1357 hci_conn_hold(conn->hcon); 1365 1358 __sco_chan_add(conn, sk, parent); 1366 1359 ··· 1407 1398 return lm; 1408 1399 } 1409 1400 1410 - static bool sco_match(struct hci_conn *hcon) 1411 - { 1412 - return hcon->type == SCO_LINK || hcon->type == ESCO_LINK; 1413 - } 1414 - 1415 1401 static void sco_connect_cfm(struct hci_conn *hcon, __u8 status) 1416 1402 { 1403 + if (hcon->type != SCO_LINK && hcon->type != ESCO_LINK) 1404 + return; 1405 + 1417 1406 BT_DBG("hcon %p bdaddr %pMR status %u", hcon, &hcon->dst, status); 1418 1407 1419 1408 if (!status) { 1420 1409 struct sco_conn *conn; 1421 1410 1422 1411 conn = sco_conn_add(hcon); 1423 - if (conn) 1412 + if (conn) { 1424 1413 sco_conn_ready(conn); 1414 + sco_conn_put(conn); 1415 + } 1425 1416 } else 1426 1417 sco_conn_del(hcon, bt_to_errno(status)); 1427 1418 } 1428 1419 1429 1420 static void sco_disconn_cfm(struct hci_conn *hcon, __u8 reason) 1430 1421 { 1422 + if (hcon->type != SCO_LINK && hcon->type != ESCO_LINK) 1423 + return; 1424 + 1431 1425 BT_DBG("hcon %p reason %d", hcon, reason); 1432 1426 1433 1427 sco_conn_del(hcon, bt_to_errno(reason)); ··· 1456 1444 1457 1445 static struct hci_cb sco_cb = { 1458 1446 .name = "SCO", 1459 - .match = sco_match, 1460 1447 .connect_cfm = sco_connect_cfm, 1461 1448 .disconn_cfm = sco_disconn_cfm, 1462 1449 };
+3
net/core/dev.c
··· 3854 3854 { 3855 3855 netdev_features_t features; 3856 3856 3857 + if (!skb_frags_readable(skb)) 3858 + goto out_kfree_skb; 3859 + 3857 3860 features = netif_skb_features(skb); 3858 3861 skb = validate_xmit_vlan(skb, features); 3859 3862 if (unlikely(!skb))
+4 -1
net/core/devmem.c
··· 117 117 struct netdev_rx_queue *rxq; 118 118 unsigned long xa_idx; 119 119 unsigned int rxq_idx; 120 + int err; 120 121 121 122 if (binding->list.next) 122 123 list_del(&binding->list); ··· 130 129 131 130 netdev_lock(binding->dev); 132 131 rxq_idx = get_netdev_rx_queue_index(rxq); 133 - WARN_ON(netdev_rx_queue_restart(binding->dev, rxq_idx)); 132 + 133 + err = netdev_rx_queue_restart(binding->dev, rxq_idx); 134 + WARN_ON(err && err != -ENETDOWN); 134 135 netdev_unlock(binding->dev); 135 136 } 136 137
+7 -2
net/core/netpoll.c
··· 320 320 static netdev_tx_t __netpoll_send_skb(struct netpoll *np, struct sk_buff *skb) 321 321 { 322 322 netdev_tx_t status = NETDEV_TX_BUSY; 323 + netdev_tx_t ret = NET_XMIT_DROP; 323 324 struct net_device *dev; 324 325 unsigned long tries; 325 326 /* It is up to the caller to keep npinfo alive. */ ··· 329 328 lockdep_assert_irqs_disabled(); 330 329 331 330 dev = np->dev; 331 + rcu_read_lock(); 332 332 npinfo = rcu_dereference_bh(dev->npinfo); 333 333 334 334 if (!npinfo || !netif_running(dev) || !netif_device_present(dev)) { 335 335 dev_kfree_skb_irq(skb); 336 - return NET_XMIT_DROP; 336 + goto out; 337 337 } 338 338 339 339 /* don't get messages out of order, and no recursion */ ··· 373 371 skb_queue_tail(&npinfo->txq, skb); 374 372 schedule_delayed_work(&npinfo->tx_work,0); 375 373 } 376 - return NETDEV_TX_OK; 374 + ret = NETDEV_TX_OK; 375 + out: 376 + rcu_read_unlock(); 377 + return ret; 377 378 } 378 379 379 380 netdev_tx_t netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
+2 -1
net/ethtool/tsinfo.c
··· 291 291 reply_data = ctx->reply_data; 292 292 memset(reply_data, 0, sizeof(*reply_data)); 293 293 reply_data->base.dev = dev; 294 - memset(&reply_data->ts_info, 0, sizeof(reply_data->ts_info)); 294 + reply_data->ts_info.cmd = ETHTOOL_GET_TS_INFO; 295 + reply_data->ts_info.phc_index = -1; 295 296 296 297 return ehdr; 297 298 }
+9 -6
net/ipv6/addrconf.c
··· 3209 3209 struct in6_addr addr; 3210 3210 struct net_device *dev; 3211 3211 struct net *net = dev_net(idev->dev); 3212 - int scope, plen, offset = 0; 3212 + int scope, plen; 3213 3213 u32 pflags = 0; 3214 3214 3215 3215 ASSERT_RTNL(); 3216 3216 3217 3217 memset(&addr, 0, sizeof(struct in6_addr)); 3218 - /* in case of IP6GRE the dev_addr is an IPv6 and therefore we use only the last 4 bytes */ 3219 - if (idev->dev->addr_len == sizeof(struct in6_addr)) 3220 - offset = sizeof(struct in6_addr) - 4; 3221 - memcpy(&addr.s6_addr32[3], idev->dev->dev_addr + offset, 4); 3218 + memcpy(&addr.s6_addr32[3], idev->dev->dev_addr, 4); 3222 3219 3223 3220 if (!(idev->dev->flags & IFF_POINTOPOINT) && idev->dev->type == ARPHRD_SIT) { 3224 3221 scope = IPV6_ADDR_COMPATv4; ··· 3526 3529 return; 3527 3530 } 3528 3531 3529 - if (dev->type == ARPHRD_ETHER) { 3532 + /* Generate the IPv6 link-local address using addrconf_addr_gen(), 3533 + * unless we have an IPv4 GRE device not bound to an IP address and 3534 + * which is in EUI64 mode (as __ipv6_isatap_ifid() would fail in this 3535 + * case). Such devices fall back to add_v4_addrs() instead. 3536 + */ 3537 + if (!(dev->type == ARPHRD_IPGRE && *(__be32 *)dev->dev_addr == 0 && 3538 + idev->cnf.addr_gen_mode == IN6_ADDR_GEN_MODE_EUI64)) { 3530 3539 addrconf_addr_gen(idev, true); 3531 3540 return; 3532 3541 }
+8 -1
net/mac80211/eht.c
··· 2 2 /* 3 3 * EHT handling 4 4 * 5 - * Copyright(c) 2021-2024 Intel Corporation 5 + * Copyright(c) 2021-2025 Intel Corporation 6 6 */ 7 7 8 8 #include "ieee80211_i.h" ··· 75 75 76 76 link_sta->cur_max_bandwidth = ieee80211_sta_cap_rx_bw(link_sta); 77 77 link_sta->pub->bandwidth = ieee80211_sta_cur_vht_bw(link_sta); 78 + 79 + /* 80 + * The MPDU length bits are reserved on all but 2.4 GHz and get set via 81 + * VHT (5 GHz) or HE (6 GHz) capabilities. 82 + */ 83 + if (sband->band != NL80211_BAND_2GHZ) 84 + return; 78 85 79 86 switch (u8_get_bits(eht_cap->eht_cap_elem.mac_cap_info[0], 80 87 IEEE80211_EHT_MAC_CAP0_MAX_MPDU_LEN_MASK)) {
+5 -5
net/mac80211/rx.c
··· 6 6 * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net> 7 7 * Copyright 2013-2014 Intel Mobile Communications GmbH 8 8 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH 9 - * Copyright (C) 2018-2024 Intel Corporation 9 + * Copyright (C) 2018-2025 Intel Corporation 10 10 */ 11 11 12 12 #include <linux/jiffies.h> ··· 3321 3321 return; 3322 3322 } 3323 3323 3324 - if (!ether_addr_equal(mgmt->sa, sdata->deflink.u.mgd.bssid) || 3325 - !ether_addr_equal(mgmt->bssid, sdata->deflink.u.mgd.bssid)) { 3324 + if (!ether_addr_equal(mgmt->sa, sdata->vif.cfg.ap_addr) || 3325 + !ether_addr_equal(mgmt->bssid, sdata->vif.cfg.ap_addr)) { 3326 3326 /* Not from the current AP or not associated yet. */ 3327 3327 return; 3328 3328 } ··· 3338 3338 3339 3339 skb_reserve(skb, local->hw.extra_tx_headroom); 3340 3340 resp = skb_put_zero(skb, 24); 3341 - memcpy(resp->da, mgmt->sa, ETH_ALEN); 3341 + memcpy(resp->da, sdata->vif.cfg.ap_addr, ETH_ALEN); 3342 3342 memcpy(resp->sa, sdata->vif.addr, ETH_ALEN); 3343 - memcpy(resp->bssid, sdata->deflink.u.mgd.bssid, ETH_ALEN); 3343 + memcpy(resp->bssid, sdata->vif.cfg.ap_addr, ETH_ALEN); 3344 3344 resp->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | 3345 3345 IEEE80211_STYPE_ACTION); 3346 3346 skb_put(skb, 1 + sizeof(resp->u.action.u.sa_query));
+17 -3
net/mac80211/sta_info.c
··· 4 4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 5 5 * Copyright 2013-2014 Intel Mobile Communications GmbH 6 6 * Copyright (C) 2015 - 2017 Intel Deutschland GmbH 7 - * Copyright (C) 2018-2023 Intel Corporation 7 + * Copyright (C) 2018-2024 Intel Corporation 8 8 */ 9 9 10 10 #include <linux/module.h> ··· 1335 1335 sta->sta.addr, new_state); 1336 1336 1337 1337 /* notify the driver before the actual changes so it can 1338 - * fail the transition 1338 + * fail the transition if the state is increasing. 1339 + * The driver is required not to fail when the transition 1340 + * is decreasing the state, so first, do all the preparation 1341 + * work and only then, notify the driver. 1339 1342 */ 1340 - if (test_sta_flag(sta, WLAN_STA_INSERTED)) { 1343 + if (new_state > sta->sta_state && 1344 + test_sta_flag(sta, WLAN_STA_INSERTED)) { 1341 1345 int err = drv_sta_state(sta->local, sta->sdata, sta, 1342 1346 sta->sta_state, new_state); 1343 1347 if (err) ··· 1415 1411 break; 1416 1412 default: 1417 1413 break; 1414 + } 1415 + 1416 + if (new_state < sta->sta_state && 1417 + test_sta_flag(sta, WLAN_STA_INSERTED)) { 1418 + int err = drv_sta_state(sta->local, sta->sdata, sta, 1419 + sta->sta_state, new_state); 1420 + 1421 + WARN_ONCE(err, 1422 + "Driver is not allowed to fail if the sta_state is transitioning down the list: %d\n", 1423 + err); 1418 1424 } 1419 1425 1420 1426 sta->sta_state = new_state;
+5 -3
net/mac80211/util.c
··· 6 6 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> 7 7 * Copyright 2013-2014 Intel Mobile Communications GmbH 8 8 * Copyright (C) 2015-2017 Intel Deutschland GmbH 9 - * Copyright (C) 2018-2024 Intel Corporation 9 + * Copyright (C) 2018-2025 Intel Corporation 10 10 * 11 11 * utilities for mac80211 12 12 */ ··· 2194 2194 ieee80211_reconfig_roc(local); 2195 2195 2196 2196 /* Requeue all works */ 2197 - list_for_each_entry(sdata, &local->interfaces, list) 2198 - wiphy_work_queue(local->hw.wiphy, &sdata->work); 2197 + list_for_each_entry(sdata, &local->interfaces, list) { 2198 + if (ieee80211_sdata_running(sdata)) 2199 + wiphy_work_queue(local->hw.wiphy, &sdata->work); 2200 + } 2199 2201 } 2200 2202 2201 2203 ieee80211_wake_queues_by_reason(hw, IEEE80211_MAX_QUEUE_MAP,
+8 -2
net/mctp/route.c
··· 332 332 & MCTP_HDR_SEQ_MASK; 333 333 334 334 if (!key->reasm_head) { 335 - key->reasm_head = skb; 336 - key->reasm_tailp = &(skb_shinfo(skb)->frag_list); 335 + /* Since we're manipulating the shared frag_list, ensure it isn't 336 + * shared with any other SKBs. 337 + */ 338 + key->reasm_head = skb_unshare(skb, GFP_ATOMIC); 339 + if (!key->reasm_head) 340 + return -ENOMEM; 341 + 342 + key->reasm_tailp = &(skb_shinfo(key->reasm_head)->frag_list); 337 343 key->last_seq = this_seq; 338 344 return 0; 339 345 }
+109
net/mctp/test/route-test.c
··· 921 921 __mctp_route_test_fini(test, dev, rt, sock); 922 922 } 923 923 924 + /* Input route to socket, using a fragmented message created from clones. 925 + */ 926 + static void mctp_test_route_input_cloned_frag(struct kunit *test) 927 + { 928 + /* 5 packet fragments, forming 2 complete messages */ 929 + const struct mctp_hdr hdrs[5] = { 930 + RX_FRAG(FL_S, 0), 931 + RX_FRAG(0, 1), 932 + RX_FRAG(FL_E, 2), 933 + RX_FRAG(FL_S, 0), 934 + RX_FRAG(FL_E, 1), 935 + }; 936 + struct mctp_test_route *rt; 937 + struct mctp_test_dev *dev; 938 + struct sk_buff *skb[5]; 939 + struct sk_buff *rx_skb; 940 + struct socket *sock; 941 + size_t data_len; 942 + u8 compare[100]; 943 + u8 flat[100]; 944 + size_t total; 945 + void *p; 946 + int rc; 947 + 948 + /* Arbitrary length */ 949 + data_len = 3; 950 + total = data_len + sizeof(struct mctp_hdr); 951 + 952 + __mctp_route_test_init(test, &dev, &rt, &sock, MCTP_NET_ANY); 953 + 954 + /* Create a single skb initially with concatenated packets */ 955 + skb[0] = mctp_test_create_skb(&hdrs[0], 5 * total); 956 + mctp_test_skb_set_dev(skb[0], dev); 957 + memset(skb[0]->data, 0 * 0x11, skb[0]->len); 958 + memcpy(skb[0]->data, &hdrs[0], sizeof(struct mctp_hdr)); 959 + 960 + /* Extract and populate packets */ 961 + for (int i = 1; i < 5; i++) { 962 + skb[i] = skb_clone(skb[i - 1], GFP_ATOMIC); 963 + KUNIT_ASSERT_TRUE(test, skb[i]); 964 + p = skb_pull(skb[i], total); 965 + KUNIT_ASSERT_TRUE(test, p); 966 + skb_reset_network_header(skb[i]); 967 + memcpy(skb[i]->data, &hdrs[i], sizeof(struct mctp_hdr)); 968 + memset(&skb[i]->data[sizeof(struct mctp_hdr)], i * 0x11, data_len); 969 + } 970 + for (int i = 0; i < 5; i++) 971 + skb_trim(skb[i], total); 972 + 973 + /* SOM packets have a type byte to match the socket */ 974 + skb[0]->data[4] = 0; 975 + skb[3]->data[4] = 0; 976 + 977 + skb_dump("pkt1 ", skb[0], false); 978 + skb_dump("pkt2 ", skb[1], false); 979 + skb_dump("pkt3 ", skb[2], false); 980 + skb_dump("pkt4 ", skb[3], false); 981 + skb_dump("pkt5 ", skb[4], false); 982 + 983 + for (int i = 0; i < 5; i++) { 984 + KUNIT_EXPECT_EQ(test, refcount_read(&skb[i]->users), 1); 985 + /* Take a reference so we can check refcounts at the end */ 986 + skb_get(skb[i]); 987 + } 988 + 989 + /* Feed the fragments into MCTP core */ 990 + for (int i = 0; i < 5; i++) { 991 + rc = mctp_route_input(&rt->rt, skb[i]); 992 + KUNIT_EXPECT_EQ(test, rc, 0); 993 + } 994 + 995 + /* Receive first reassembled message */ 996 + rx_skb = skb_recv_datagram(sock->sk, MSG_DONTWAIT, &rc); 997 + KUNIT_EXPECT_EQ(test, rc, 0); 998 + KUNIT_EXPECT_EQ(test, rx_skb->len, 3 * data_len); 999 + rc = skb_copy_bits(rx_skb, 0, flat, rx_skb->len); 1000 + for (int i = 0; i < rx_skb->len; i++) 1001 + compare[i] = (i / data_len) * 0x11; 1002 + /* Set type byte */ 1003 + compare[0] = 0; 1004 + 1005 + KUNIT_EXPECT_MEMEQ(test, flat, compare, rx_skb->len); 1006 + KUNIT_EXPECT_EQ(test, refcount_read(&rx_skb->users), 1); 1007 + kfree_skb(rx_skb); 1008 + 1009 + /* Receive second reassembled message */ 1010 + rx_skb = skb_recv_datagram(sock->sk, MSG_DONTWAIT, &rc); 1011 + KUNIT_EXPECT_EQ(test, rc, 0); 1012 + KUNIT_EXPECT_EQ(test, rx_skb->len, 2 * data_len); 1013 + rc = skb_copy_bits(rx_skb, 0, flat, rx_skb->len); 1014 + for (int i = 0; i < rx_skb->len; i++) 1015 + compare[i] = (i / data_len + 3) * 0x11; 1016 + /* Set type byte */ 1017 + compare[0] = 0; 1018 + 1019 + KUNIT_EXPECT_MEMEQ(test, flat, compare, rx_skb->len); 1020 + KUNIT_EXPECT_EQ(test, refcount_read(&rx_skb->users), 1); 1021 + kfree_skb(rx_skb); 1022 + 1023 + /* Check input skb refcounts */ 1024 + for (int i = 0; i < 5; i++) { 1025 + KUNIT_EXPECT_EQ(test, refcount_read(&skb[i]->users), 1); 1026 + kfree_skb(skb[i]); 1027 + } 1028 + 1029 + __mctp_route_test_fini(test, dev, rt, sock); 1030 + } 1031 + 924 1032 #if IS_ENABLED(CONFIG_MCTP_FLOWS) 925 1033 926 1034 static void mctp_test_flow_init(struct kunit *test, ··· 1252 1144 KUNIT_CASE(mctp_test_packet_flow), 1253 1145 KUNIT_CASE(mctp_test_fragment_flow), 1254 1146 KUNIT_CASE(mctp_test_route_output_key_create), 1147 + KUNIT_CASE(mctp_test_route_input_cloned_frag), 1255 1148 {} 1256 1149 }; 1257 1150
+4 -4
net/netfilter/ipvs/ip_vs_ctl.c
··· 3091 3091 case IP_VS_SO_GET_SERVICES: 3092 3092 { 3093 3093 struct ip_vs_get_services *get; 3094 - int size; 3094 + size_t size; 3095 3095 3096 3096 get = (struct ip_vs_get_services *)arg; 3097 3097 size = struct_size(get, entrytable, get->num_services); 3098 3098 if (*len != size) { 3099 - pr_err("length: %u != %u\n", *len, size); 3099 + pr_err("length: %u != %zu\n", *len, size); 3100 3100 ret = -EINVAL; 3101 3101 goto out; 3102 3102 } ··· 3132 3132 case IP_VS_SO_GET_DESTS: 3133 3133 { 3134 3134 struct ip_vs_get_dests *get; 3135 - int size; 3135 + size_t size; 3136 3136 3137 3137 get = (struct ip_vs_get_dests *)arg; 3138 3138 size = struct_size(get, entrytable, get->num_dests); 3139 3139 if (*len != size) { 3140 - pr_err("length: %u != %u\n", *len, size); 3140 + pr_err("length: %u != %zu\n", *len, size); 3141 3141 ret = -EINVAL; 3142 3142 goto out; 3143 3143 }
+4 -2
net/netfilter/nf_conncount.c
··· 132 132 struct nf_conn *found_ct; 133 133 unsigned int collect = 0; 134 134 135 - if (time_is_after_eq_jiffies((unsigned long)list->last_gc)) 135 + if ((u32)jiffies == list->last_gc) 136 136 goto add_new_node; 137 137 138 138 /* check the saved connections */ ··· 234 234 bool ret = false; 235 235 236 236 /* don't bother if we just did GC */ 237 - if (time_is_after_eq_jiffies((unsigned long)READ_ONCE(list->last_gc))) 237 + if ((u32)jiffies == READ_ONCE(list->last_gc)) 238 238 return false; 239 239 240 240 /* don't bother if other cpu is already doing GC */ ··· 377 377 378 378 conn->tuple = *tuple; 379 379 conn->zone = *zone; 380 + conn->cpu = raw_smp_processor_id(); 381 + conn->jiffies32 = (u32)jiffies; 380 382 memcpy(rbconn->key, key, sizeof(u32) * data->keylen); 381 383 382 384 nf_conncount_list_init(&rbconn->list);
+14 -10
net/netfilter/nf_tables_api.c
··· 34 34 static LIST_HEAD(nf_tables_expressions); 35 35 static LIST_HEAD(nf_tables_objects); 36 36 static LIST_HEAD(nf_tables_flowtables); 37 - static LIST_HEAD(nf_tables_destroy_list); 38 37 static LIST_HEAD(nf_tables_gc_list); 39 38 static DEFINE_SPINLOCK(nf_tables_destroy_list_lock); 40 39 static DEFINE_SPINLOCK(nf_tables_gc_list_lock); ··· 124 125 table->validate_state = new_validate_state; 125 126 } 126 127 static void nf_tables_trans_destroy_work(struct work_struct *w); 127 - static DECLARE_WORK(trans_destroy_work, nf_tables_trans_destroy_work); 128 128 129 129 static void nft_trans_gc_work(struct work_struct *work); 130 130 static DECLARE_WORK(trans_gc_work, nft_trans_gc_work); ··· 10004 10006 10005 10007 static void nf_tables_trans_destroy_work(struct work_struct *w) 10006 10008 { 10009 + struct nftables_pernet *nft_net = container_of(w, struct nftables_pernet, destroy_work); 10007 10010 struct nft_trans *trans, *next; 10008 10011 LIST_HEAD(head); 10009 10012 10010 10013 spin_lock(&nf_tables_destroy_list_lock); 10011 - list_splice_init(&nf_tables_destroy_list, &head); 10014 + list_splice_init(&nft_net->destroy_list, &head); 10012 10015 spin_unlock(&nf_tables_destroy_list_lock); 10013 10016 10014 10017 if (list_empty(&head)) ··· 10023 10024 } 10024 10025 } 10025 10026 10026 - void nf_tables_trans_destroy_flush_work(void) 10027 + void nf_tables_trans_destroy_flush_work(struct net *net) 10027 10028 { 10028 - flush_work(&trans_destroy_work); 10029 + struct nftables_pernet *nft_net = nft_pernet(net); 10030 + 10031 + flush_work(&nft_net->destroy_work); 10029 10032 } 10030 10033 EXPORT_SYMBOL_GPL(nf_tables_trans_destroy_flush_work); 10031 10034 ··· 10485 10484 10486 10485 trans->put_net = true; 10487 10486 spin_lock(&nf_tables_destroy_list_lock); 10488 - list_splice_tail_init(&nft_net->commit_list, &nf_tables_destroy_list); 10487 + list_splice_tail_init(&nft_net->commit_list, &nft_net->destroy_list); 10489 10488 spin_unlock(&nf_tables_destroy_list_lock); 10490 10489 10491 10490 nf_tables_module_autoload_cleanup(net); 10492 - schedule_work(&trans_destroy_work); 10491 + schedule_work(&nft_net->destroy_work); 10493 10492 10494 10493 mutex_unlock(&nft_net->commit_mutex); 10495 10494 } ··· 11854 11853 11855 11854 gc_seq = nft_gc_seq_begin(nft_net); 11856 11855 11857 - nf_tables_trans_destroy_flush_work(); 11856 + nf_tables_trans_destroy_flush_work(net); 11858 11857 again: 11859 11858 list_for_each_entry(table, &nft_net->tables, list) { 11860 11859 if (nft_table_has_owner(table) && ··· 11896 11895 11897 11896 INIT_LIST_HEAD(&nft_net->tables); 11898 11897 INIT_LIST_HEAD(&nft_net->commit_list); 11898 + INIT_LIST_HEAD(&nft_net->destroy_list); 11899 11899 INIT_LIST_HEAD(&nft_net->commit_set_list); 11900 11900 INIT_LIST_HEAD(&nft_net->binding_list); 11901 11901 INIT_LIST_HEAD(&nft_net->module_list); ··· 11905 11903 nft_net->base_seq = 1; 11906 11904 nft_net->gc_seq = 0; 11907 11905 nft_net->validate_state = NFT_VALIDATE_SKIP; 11906 + INIT_WORK(&nft_net->destroy_work, nf_tables_trans_destroy_work); 11908 11907 11909 11908 return 0; 11910 11909 } ··· 11934 11931 if (!list_empty(&nft_net->module_list)) 11935 11932 nf_tables_module_autoload_cleanup(net); 11936 11933 11934 + cancel_work_sync(&nft_net->destroy_work); 11937 11935 __nft_release_tables(net); 11938 11936 11939 11937 nft_gc_seq_end(nft_net, gc_seq); 11940 11938 11941 11939 mutex_unlock(&nft_net->commit_mutex); 11940 + 11942 11941 WARN_ON_ONCE(!list_empty(&nft_net->tables)); 11943 11942 WARN_ON_ONCE(!list_empty(&nft_net->module_list)); 11944 11943 WARN_ON_ONCE(!list_empty(&nft_net->notify_list)); 11944 + WARN_ON_ONCE(!list_empty(&nft_net->destroy_list)); 11945 11945 } 11946 11946 11947 11947 static void nf_tables_exit_batch(struct list_head *net_exit_list) ··· 12035 12029 unregister_netdevice_notifier(&nf_tables_flowtable_notifier); 12036 12030 nft_chain_filter_fini(); 12037 12031 nft_chain_route_fini(); 12038 - nf_tables_trans_destroy_flush_work(); 12039 12032 unregister_pernet_subsys(&nf_tables_net_ops); 12040 12033 cancel_work_sync(&trans_gc_work); 12041 - cancel_work_sync(&trans_destroy_work); 12042 12034 rcu_barrier(); 12043 12035 rhltable_destroy(&nft_objname_ht); 12044 12036 nf_tables_core_module_exit();
+4 -4
net/netfilter/nft_compat.c
··· 228 228 return 0; 229 229 } 230 230 231 - static void nft_compat_wait_for_destructors(void) 231 + static void nft_compat_wait_for_destructors(struct net *net) 232 232 { 233 233 /* xtables matches or targets can have side effects, e.g. 234 234 * creation/destruction of /proc files. ··· 236 236 * work queue. If we have pending invocations we thus 237 237 * need to wait for those to finish. 238 238 */ 239 - nf_tables_trans_destroy_flush_work(); 239 + nf_tables_trans_destroy_flush_work(net); 240 240 } 241 241 242 242 static int ··· 262 262 263 263 nft_target_set_tgchk_param(&par, ctx, target, info, &e, proto, inv); 264 264 265 - nft_compat_wait_for_destructors(); 265 + nft_compat_wait_for_destructors(ctx->net); 266 266 267 267 ret = xt_check_target(&par, size, proto, inv); 268 268 if (ret < 0) { ··· 515 515 516 516 nft_match_set_mtchk_param(&par, ctx, match, info, &e, proto, inv); 517 517 518 - nft_compat_wait_for_destructors(); 518 + nft_compat_wait_for_destructors(ctx->net); 519 519 520 520 return xt_check_match(&par, size, proto, inv); 521 521 }
+4 -2
net/netfilter/nft_ct.c
··· 230 230 enum ip_conntrack_info ctinfo; 231 231 u16 value = nft_reg_load16(&regs->data[priv->sreg]); 232 232 struct nf_conn *ct; 233 + int oldcnt; 233 234 234 235 ct = nf_ct_get(skb, &ctinfo); 235 236 if (ct) /* already tracked */ ··· 251 250 252 251 ct = this_cpu_read(nft_ct_pcpu_template); 253 252 254 - if (likely(refcount_read(&ct->ct_general.use) == 1)) { 255 - refcount_inc(&ct->ct_general.use); 253 + __refcount_inc(&ct->ct_general.use, &oldcnt); 254 + if (likely(oldcnt == 1)) { 256 255 nf_ct_zone_add(ct, &zone); 257 256 } else { 257 + refcount_dec(&ct->ct_general.use); 258 258 /* previous skb got queued to userspace, allocate temporary 259 259 * one until percpu template can be reused. 260 260 */
+4 -6
net/netfilter/nft_exthdr.c
··· 85 85 unsigned char optbuf[sizeof(struct ip_options) + 40]; 86 86 struct ip_options *opt = (struct ip_options *)optbuf; 87 87 struct iphdr *iph, _iph; 88 - unsigned int start; 89 88 bool found = false; 90 89 __be32 info; 91 90 int optlen; ··· 92 93 iph = skb_header_pointer(skb, 0, sizeof(_iph), &_iph); 93 94 if (!iph) 94 95 return -EBADMSG; 95 - start = sizeof(struct iphdr); 96 96 97 97 optlen = iph->ihl * 4 - (int)sizeof(struct iphdr); 98 98 if (optlen <= 0) ··· 101 103 /* Copy the options since __ip_options_compile() modifies 102 104 * the options. 103 105 */ 104 - if (skb_copy_bits(skb, start, opt->__data, optlen)) 106 + if (skb_copy_bits(skb, sizeof(struct iphdr), opt->__data, optlen)) 105 107 return -EBADMSG; 106 108 opt->optlen = optlen; 107 109 ··· 116 118 found = target == IPOPT_SSRR ? opt->is_strictroute : 117 119 !opt->is_strictroute; 118 120 if (found) 119 - *offset = opt->srr + start; 121 + *offset = opt->srr; 120 122 break; 121 123 case IPOPT_RR: 122 124 if (!opt->rr) 123 125 break; 124 - *offset = opt->rr + start; 126 + *offset = opt->rr; 125 127 found = true; 126 128 break; 127 129 case IPOPT_RA: 128 130 if (!opt->router_alert) 129 131 break; 130 - *offset = opt->router_alert + start; 132 + *offset = opt->router_alert; 131 133 found = true; 132 134 break; 133 135 default:
+18 -12
net/openvswitch/conntrack.c
··· 1368 1368 attr == OVS_KEY_ATTR_CT_MARK) 1369 1369 return true; 1370 1370 if (IS_ENABLED(CONFIG_NF_CONNTRACK_LABELS) && 1371 - attr == OVS_KEY_ATTR_CT_LABELS) 1372 - return true; 1371 + attr == OVS_KEY_ATTR_CT_LABELS) { 1372 + struct ovs_net *ovs_net = net_generic(net, ovs_net_id); 1373 + 1374 + return ovs_net->xt_label; 1375 + } 1373 1376 1374 1377 return false; 1375 1378 } ··· 1381 1378 const struct sw_flow_key *key, 1382 1379 struct sw_flow_actions **sfa, bool log) 1383 1380 { 1384 - unsigned int n_bits = sizeof(struct ovs_key_ct_labels) * BITS_PER_BYTE; 1385 1381 struct ovs_conntrack_info ct_info; 1386 1382 const char *helper = NULL; 1387 1383 u16 family; ··· 1407 1405 if (!ct_info.ct) { 1408 1406 OVS_NLERR(log, "Failed to allocate conntrack template"); 1409 1407 return -ENOMEM; 1410 - } 1411 - 1412 - if (nf_connlabels_get(net, n_bits - 1)) { 1413 - nf_ct_tmpl_free(ct_info.ct); 1414 - OVS_NLERR(log, "Failed to set connlabel length"); 1415 - return -EOPNOTSUPP; 1416 1408 } 1417 1409 1418 1410 if (ct_info.timeout[0]) { ··· 1577 1581 if (ct_info->ct) { 1578 1582 if (ct_info->timeout[0]) 1579 1583 nf_ct_destroy_timeout(ct_info->ct); 1580 - nf_connlabels_put(nf_ct_net(ct_info->ct)); 1581 1584 nf_ct_tmpl_free(ct_info->ct); 1582 1585 } 1583 1586 } ··· 2001 2006 2002 2007 int ovs_ct_init(struct net *net) 2003 2008 { 2004 - #if IS_ENABLED(CONFIG_NETFILTER_CONNCOUNT) 2009 + unsigned int n_bits = sizeof(struct ovs_key_ct_labels) * BITS_PER_BYTE; 2005 2010 struct ovs_net *ovs_net = net_generic(net, ovs_net_id); 2006 2011 2012 + if (nf_connlabels_get(net, n_bits - 1)) { 2013 + ovs_net->xt_label = false; 2014 + OVS_NLERR(true, "Failed to set connlabel length"); 2015 + } else { 2016 + ovs_net->xt_label = true; 2017 + } 2018 + 2019 + #if IS_ENABLED(CONFIG_NETFILTER_CONNCOUNT) 2007 2020 return ovs_ct_limit_init(net, ovs_net); 2008 2021 #else 2009 2022 return 0; ··· 2020 2017 2021 2018 void ovs_ct_exit(struct net *net) 2022 2019 { 2023 - #if IS_ENABLED(CONFIG_NETFILTER_CONNCOUNT) 2024 2020 struct ovs_net *ovs_net = net_generic(net, ovs_net_id); 2025 2021 2022 + #if IS_ENABLED(CONFIG_NETFILTER_CONNCOUNT) 2026 2023 ovs_ct_limit_exit(net, ovs_net); 2027 2024 #endif 2025 + 2026 + if (ovs_net->xt_label) 2027 + nf_connlabels_put(net); 2028 2028 }
+3
net/openvswitch/datapath.h
··· 160 160 #if IS_ENABLED(CONFIG_NETFILTER_CONNCOUNT) 161 161 struct ovs_ct_limit_info *ct_limit_info; 162 162 #endif 163 + 164 + /* Module reference for configuring conntrack. */ 165 + bool xt_label; 163 166 }; 164 167 165 168 /**
+1 -14
net/openvswitch/flow_netlink.c
··· 2317 2317 OVS_FLOW_ATTR_MASK, true, skb); 2318 2318 } 2319 2319 2320 - #define MAX_ACTIONS_BUFSIZE (32 * 1024) 2321 - 2322 2320 static struct sw_flow_actions *nla_alloc_flow_actions(int size) 2323 2321 { 2324 2322 struct sw_flow_actions *sfa; 2325 - 2326 - WARN_ON_ONCE(size > MAX_ACTIONS_BUFSIZE); 2327 2323 2328 2324 sfa = kmalloc(kmalloc_size_roundup(sizeof(*sfa) + size), GFP_KERNEL); 2329 2325 if (!sfa) ··· 2475 2479 goto out; 2476 2480 2477 2481 new_acts_size = max(next_offset + req_size, ksize(*sfa) * 2); 2478 - 2479 - if (new_acts_size > MAX_ACTIONS_BUFSIZE) { 2480 - if ((next_offset + req_size) > MAX_ACTIONS_BUFSIZE) { 2481 - OVS_NLERR(log, "Flow action size exceeds max %u", 2482 - MAX_ACTIONS_BUFSIZE); 2483 - return ERR_PTR(-EMSGSIZE); 2484 - } 2485 - new_acts_size = MAX_ACTIONS_BUFSIZE; 2486 - } 2487 2482 2488 2483 acts = nla_alloc_flow_actions(new_acts_size); 2489 2484 if (IS_ERR(acts)) ··· 3532 3545 int err; 3533 3546 u32 mpls_label_count = 0; 3534 3547 3535 - *sfa = nla_alloc_flow_actions(min(nla_len(attr), MAX_ACTIONS_BUFSIZE)); 3548 + *sfa = nla_alloc_flow_actions(nla_len(attr)); 3536 3549 if (IS_ERR(*sfa)) 3537 3550 return PTR_ERR(*sfa); 3538 3551
+6
net/sched/sch_api.c
··· 2291 2291 return -EOPNOTSUPP; 2292 2292 } 2293 2293 2294 + /* Prevent creation of traffic classes with classid TC_H_ROOT */ 2295 + if (clid == TC_H_ROOT) { 2296 + NL_SET_ERR_MSG(extack, "Cannot create traffic class with classid TC_H_ROOT"); 2297 + return -EINVAL; 2298 + } 2299 + 2294 2300 new_cl = cl; 2295 2301 err = -EOPNOTSUPP; 2296 2302 if (cops->change)
+2 -1
net/sched/sch_gred.c
··· 913 913 for (i = 0; i < table->DPs; i++) 914 914 gred_destroy_vq(table->tab[i]); 915 915 916 - gred_offload(sch, TC_GRED_DESTROY); 916 + if (table->opt) 917 + gred_offload(sch, TC_GRED_DESTROY); 917 918 kfree(table->opt); 918 919 } 919 920
+18 -7
net/switchdev/switchdev.c
··· 472 472 EXPORT_SYMBOL_GPL(switchdev_port_obj_act_is_deferred); 473 473 474 474 static ATOMIC_NOTIFIER_HEAD(switchdev_notif_chain); 475 - static BLOCKING_NOTIFIER_HEAD(switchdev_blocking_notif_chain); 475 + static RAW_NOTIFIER_HEAD(switchdev_blocking_notif_chain); 476 476 477 477 /** 478 478 * register_switchdev_notifier - Register notifier ··· 518 518 519 519 int register_switchdev_blocking_notifier(struct notifier_block *nb) 520 520 { 521 - struct blocking_notifier_head *chain = &switchdev_blocking_notif_chain; 521 + struct raw_notifier_head *chain = &switchdev_blocking_notif_chain; 522 + int err; 522 523 523 - return blocking_notifier_chain_register(chain, nb); 524 + rtnl_lock(); 525 + err = raw_notifier_chain_register(chain, nb); 526 + rtnl_unlock(); 527 + 528 + return err; 524 529 } 525 530 EXPORT_SYMBOL_GPL(register_switchdev_blocking_notifier); 526 531 527 532 int unregister_switchdev_blocking_notifier(struct notifier_block *nb) 528 533 { 529 - struct blocking_notifier_head *chain = &switchdev_blocking_notif_chain; 534 + struct raw_notifier_head *chain = &switchdev_blocking_notif_chain; 535 + int err; 530 536 531 - return blocking_notifier_chain_unregister(chain, nb); 537 + rtnl_lock(); 538 + err = raw_notifier_chain_unregister(chain, nb); 539 + rtnl_unlock(); 540 + 541 + return err; 532 542 } 533 543 EXPORT_SYMBOL_GPL(unregister_switchdev_blocking_notifier); 534 544 ··· 546 536 struct switchdev_notifier_info *info, 547 537 struct netlink_ext_ack *extack) 548 538 { 539 + ASSERT_RTNL(); 549 540 info->dev = dev; 550 541 info->extack = extack; 551 - return blocking_notifier_call_chain(&switchdev_blocking_notif_chain, 552 - val, info); 542 + return raw_notifier_call_chain(&switchdev_blocking_notif_chain, 543 + val, info); 553 544 } 554 545 EXPORT_SYMBOL_GPL(call_switchdev_blocking_notifiers); 555 546
+7
net/wireless/core.c
··· 1191 1191 { 1192 1192 struct cfg80211_internal_bss *scan, *tmp; 1193 1193 struct cfg80211_beacon_registration *reg, *treg; 1194 + unsigned long flags; 1195 + 1196 + spin_lock_irqsave(&rdev->wiphy_work_lock, flags); 1197 + WARN_ON(!list_empty(&rdev->wiphy_work_list)); 1198 + spin_unlock_irqrestore(&rdev->wiphy_work_lock, flags); 1199 + cancel_work_sync(&rdev->wiphy_work); 1200 + 1194 1201 rfkill_destroy(rdev->wiphy.rfkill); 1195 1202 list_for_each_entry_safe(reg, treg, &rdev->beacon_registrations, list) { 1196 1203 list_del(&reg->list);
+8 -4
net/wireless/nl80211.c
··· 11128 11128 11129 11129 static int nl80211_process_links(struct cfg80211_registered_device *rdev, 11130 11130 struct cfg80211_assoc_link *links, 11131 + int assoc_link_id, 11131 11132 const u8 *ssid, int ssid_len, 11132 11133 struct genl_info *info) 11133 11134 { ··· 11159 11158 } 11160 11159 links[link_id].bss = 11161 11160 nl80211_assoc_bss(rdev, ssid, ssid_len, attrs, 11162 - link_id, link_id); 11161 + assoc_link_id, link_id); 11163 11162 if (IS_ERR(links[link_id].bss)) { 11164 11163 err = PTR_ERR(links[link_id].bss); 11165 11164 links[link_id].bss = NULL; ··· 11356 11355 req.ap_mld_addr = nla_data(info->attrs[NL80211_ATTR_MLD_ADDR]); 11357 11356 ap_addr = req.ap_mld_addr; 11358 11357 11359 - err = nl80211_process_links(rdev, req.links, ssid, ssid_len, 11360 - info); 11358 + err = nl80211_process_links(rdev, req.links, req.link_id, 11359 + ssid, ssid_len, info); 11361 11360 if (err) 11362 11361 goto free; 11363 11362 ··· 16512 16511 16513 16512 add_links = 0; 16514 16513 if (info->attrs[NL80211_ATTR_MLO_LINKS]) { 16515 - err = nl80211_process_links(rdev, links, NULL, 0, info); 16514 + err = nl80211_process_links(rdev, links, 16515 + /* mark as MLO, but not assoc */ 16516 + IEEE80211_MLD_MAX_NUM_LINKS, 16517 + NULL, 0, info); 16516 16518 if (err) 16517 16519 return err; 16518 16520
+1 -1
scripts/package/install-extmod-build
··· 63 63 # Clear VPATH and srcroot because the source files reside in the output 64 64 # directory. 65 65 # shellcheck disable=SC2016 # $(MAKE) and $(build) will be expanded by Make 66 - "${MAKE}" run-command KBUILD_RUN_COMMAND='+$(MAKE) HOSTCC='"${CC}"' VPATH= srcroot=. $(build)='"${destdir}"/scripts 66 + "${MAKE}" run-command KBUILD_RUN_COMMAND='+$(MAKE) HOSTCC='"${CC}"' VPATH= srcroot=. $(build)='"$(realpath --relative-base=. "${destdir}")"/scripts 67 67 68 68 rm -f "${destdir}/scripts/Kbuild" 69 69 fi
+30 -16
sound/core/seq/seq_clientmgr.c
··· 106 106 return clienttab[clientid]; 107 107 } 108 108 109 - struct snd_seq_client *snd_seq_client_use_ptr(int clientid) 109 + static struct snd_seq_client *client_use_ptr(int clientid, bool load_module) 110 110 { 111 111 unsigned long flags; 112 112 struct snd_seq_client *client; ··· 126 126 } 127 127 spin_unlock_irqrestore(&clients_lock, flags); 128 128 #ifdef CONFIG_MODULES 129 - if (!in_interrupt()) { 129 + if (load_module) { 130 130 static DECLARE_BITMAP(client_requested, SNDRV_SEQ_GLOBAL_CLIENTS); 131 131 static DECLARE_BITMAP(card_requested, SNDRV_CARDS); 132 132 ··· 168 168 return client; 169 169 } 170 170 171 + /* get snd_seq_client object for the given id quickly */ 172 + struct snd_seq_client *snd_seq_client_use_ptr(int clientid) 173 + { 174 + return client_use_ptr(clientid, false); 175 + } 176 + 177 + /* get snd_seq_client object for the given id; 178 + * if not found, retry after loading the modules 179 + */ 180 + static struct snd_seq_client *client_load_and_use_ptr(int clientid) 181 + { 182 + return client_use_ptr(clientid, IS_ENABLED(CONFIG_MODULES)); 183 + } 184 + 171 185 /* Take refcount and perform ioctl_mutex lock on the given client; 172 186 * used only for OSS sequencer 173 187 * Unlock via snd_seq_client_ioctl_unlock() below ··· 190 176 { 191 177 struct snd_seq_client *client; 192 178 193 - client = snd_seq_client_use_ptr(clientid); 179 + client = client_load_and_use_ptr(clientid); 194 180 if (!client) 195 181 return false; 196 182 mutex_lock(&client->ioctl_mutex); ··· 1209 1195 int err = 0; 1210 1196 1211 1197 /* requested client number */ 1212 - cptr = snd_seq_client_use_ptr(info->client); 1198 + cptr = client_load_and_use_ptr(info->client); 1213 1199 if (cptr == NULL) 1214 1200 return -ENOENT; /* don't change !!! */ 1215 1201 ··· 1271 1257 struct snd_seq_client *cptr; 1272 1258 1273 1259 /* requested client number */ 1274 - cptr = snd_seq_client_use_ptr(client_info->client); 1260 + cptr = client_load_and_use_ptr(client_info->client); 1275 1261 if (cptr == NULL) 1276 1262 return -ENOENT; /* don't change !!! */ 1277 1263 ··· 1410 1396 struct snd_seq_client *cptr; 1411 1397 struct snd_seq_client_port *port; 1412 1398 1413 - cptr = snd_seq_client_use_ptr(info->addr.client); 1399 + cptr = client_load_and_use_ptr(info->addr.client); 1414 1400 if (cptr == NULL) 1415 1401 return -ENXIO; 1416 1402 ··· 1517 1503 struct snd_seq_client *receiver = NULL, *sender = NULL; 1518 1504 struct snd_seq_client_port *sport = NULL, *dport = NULL; 1519 1505 1520 - receiver = snd_seq_client_use_ptr(subs->dest.client); 1506 + receiver = client_load_and_use_ptr(subs->dest.client); 1521 1507 if (!receiver) 1522 1508 goto __end; 1523 - sender = snd_seq_client_use_ptr(subs->sender.client); 1509 + sender = client_load_and_use_ptr(subs->sender.client); 1524 1510 if (!sender) 1525 1511 goto __end; 1526 1512 sport = snd_seq_port_use_ptr(sender, subs->sender.port); ··· 1885 1871 struct snd_seq_client_pool *info = arg; 1886 1872 struct snd_seq_client *cptr; 1887 1873 1888 - cptr = snd_seq_client_use_ptr(info->client); 1874 + cptr = client_load_and_use_ptr(info->client); 1889 1875 if (cptr == NULL) 1890 1876 return -ENOENT; 1891 1877 memset(info, 0, sizeof(*info)); ··· 1989 1975 struct snd_seq_client_port *sport = NULL; 1990 1976 1991 1977 result = -EINVAL; 1992 - sender = snd_seq_client_use_ptr(subs->sender.client); 1978 + sender = client_load_and_use_ptr(subs->sender.client); 1993 1979 if (!sender) 1994 1980 goto __end; 1995 1981 sport = snd_seq_port_use_ptr(sender, subs->sender.port); ··· 2020 2006 struct list_head *p; 2021 2007 int i; 2022 2008 2023 - cptr = snd_seq_client_use_ptr(subs->root.client); 2009 + cptr = client_load_and_use_ptr(subs->root.client); 2024 2010 if (!cptr) 2025 2011 goto __end; 2026 2012 port = snd_seq_port_use_ptr(cptr, subs->root.port); ··· 2087 2073 if (info->client < 0) 2088 2074 info->client = 0; 2089 2075 for (; info->client < SNDRV_SEQ_MAX_CLIENTS; info->client++) { 2090 - cptr = snd_seq_client_use_ptr(info->client); 2076 + cptr = client_load_and_use_ptr(info->client); 2091 2077 if (cptr) 2092 2078 break; /* found */ 2093 2079 } ··· 2110 2096 struct snd_seq_client *cptr; 2111 2097 struct snd_seq_client_port *port = NULL; 2112 2098 2113 - cptr = snd_seq_client_use_ptr(info->addr.client); 2099 + cptr = client_load_and_use_ptr(info->addr.client); 2114 2100 if (cptr == NULL) 2115 2101 return -ENXIO; 2116 2102 ··· 2207 2193 size = sizeof(struct snd_ump_endpoint_info); 2208 2194 else 2209 2195 size = sizeof(struct snd_ump_block_info); 2210 - cptr = snd_seq_client_use_ptr(client); 2196 + cptr = client_load_and_use_ptr(client); 2211 2197 if (!cptr) 2212 2198 return -ENOENT; 2213 2199 ··· 2489 2475 if (check_event_type_and_length(ev)) 2490 2476 return -EINVAL; 2491 2477 2492 - cptr = snd_seq_client_use_ptr(client); 2478 + cptr = client_load_and_use_ptr(client); 2493 2479 if (cptr == NULL) 2494 2480 return -EINVAL; 2495 2481 ··· 2721 2707 2722 2708 /* list the client table */ 2723 2709 for (c = 0; c < SNDRV_SEQ_MAX_CLIENTS; c++) { 2724 - client = snd_seq_client_use_ptr(c); 2710 + client = client_load_and_use_ptr(c); 2725 2711 if (client == NULL) 2726 2712 continue; 2727 2713 if (client->type == NO_CLIENT) {
+1
sound/pci/hda/Kconfig
··· 222 222 223 223 config SND_HDA_CODEC_REALTEK 224 224 tristate "Build Realtek HD-audio codec support" 225 + depends on INPUT 225 226 select SND_HDA_GENERIC 226 227 select SND_HDA_GENERIC_LEDS 227 228 select SND_HDA_SCODEC_COMPONENT
+2
sound/pci/hda/hda_intel.c
··· 2232 2232 SND_PCI_QUIRK(0x1631, 0xe017, "Packard Bell NEC IMEDIA 5204", 0), 2233 2233 /* KONTRON SinglePC may cause a stall at runtime resume */ 2234 2234 SND_PCI_QUIRK(0x1734, 0x1232, "KONTRON SinglePC", 0), 2235 + /* Dell ALC3271 */ 2236 + SND_PCI_QUIRK(0x1028, 0x0962, "Dell ALC3271", 0), 2235 2237 {} 2236 2238 }; 2237 2239
+115 -13
sound/pci/hda/patch_realtek.c
··· 3843 3843 } 3844 3844 } 3845 3845 3846 + static void alc222_init(struct hda_codec *codec) 3847 + { 3848 + struct alc_spec *spec = codec->spec; 3849 + hda_nid_t hp_pin = alc_get_hp_pin(spec); 3850 + bool hp1_pin_sense, hp2_pin_sense; 3851 + 3852 + if (!hp_pin) 3853 + return; 3854 + 3855 + msleep(30); 3856 + 3857 + hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); 3858 + hp2_pin_sense = snd_hda_jack_detect(codec, 0x14); 3859 + 3860 + if (hp1_pin_sense || hp2_pin_sense) { 3861 + msleep(2); 3862 + 3863 + if (hp1_pin_sense) 3864 + snd_hda_codec_write(codec, hp_pin, 0, 3865 + AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); 3866 + if (hp2_pin_sense) 3867 + snd_hda_codec_write(codec, 0x14, 0, 3868 + AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); 3869 + msleep(75); 3870 + 3871 + if (hp1_pin_sense) 3872 + snd_hda_codec_write(codec, hp_pin, 0, 3873 + AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); 3874 + if (hp2_pin_sense) 3875 + snd_hda_codec_write(codec, 0x14, 0, 3876 + AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); 3877 + 3878 + msleep(75); 3879 + } 3880 + } 3881 + 3882 + static void alc222_shutup(struct hda_codec *codec) 3883 + { 3884 + struct alc_spec *spec = codec->spec; 3885 + hda_nid_t hp_pin = alc_get_hp_pin(spec); 3886 + bool hp1_pin_sense, hp2_pin_sense; 3887 + 3888 + if (!hp_pin) 3889 + hp_pin = 0x21; 3890 + 3891 + hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); 3892 + hp2_pin_sense = snd_hda_jack_detect(codec, 0x14); 3893 + 3894 + if (hp1_pin_sense || hp2_pin_sense) { 3895 + msleep(2); 3896 + 3897 + if (hp1_pin_sense) 3898 + snd_hda_codec_write(codec, hp_pin, 0, 3899 + AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); 3900 + if (hp2_pin_sense) 3901 + snd_hda_codec_write(codec, 0x14, 0, 3902 + AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); 3903 + 3904 + msleep(75); 3905 + 3906 + if (hp1_pin_sense) 3907 + snd_hda_codec_write(codec, hp_pin, 0, 3908 + AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0); 3909 + if (hp2_pin_sense) 3910 + snd_hda_codec_write(codec, 0x14, 0, 3911 + AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0); 3912 + 3913 + msleep(75); 3914 + } 3915 + alc_auto_setup_eapd(codec, false); 3916 + alc_shutup_pins(codec); 3917 + } 3918 + 3846 3919 static void alc_default_init(struct hda_codec *codec) 3847 3920 { 3848 3921 struct alc_spec *spec = codec->spec; ··· 5000 4927 alc298_samsung_v2_init_amps(codec, 4); 5001 4928 } 5002 4929 5003 - #if IS_REACHABLE(CONFIG_INPUT) 5004 4930 static void gpio2_mic_hotkey_event(struct hda_codec *codec, 5005 4931 struct hda_jack_callback *event) 5006 4932 { ··· 5108 5036 spec->kb_dev = NULL; 5109 5037 } 5110 5038 } 5111 - #else /* INPUT */ 5112 - #define alc280_fixup_hp_gpio2_mic_hotkey NULL 5113 - #define alc233_fixup_lenovo_line2_mic_hotkey NULL 5114 - #endif /* INPUT */ 5115 5039 5116 5040 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, 5117 5041 const struct hda_fixup *fix, int action) ··· 5119 5051 spec->cap_mute_led_nid = 0x18; 5120 5052 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); 5121 5053 } 5054 + } 5055 + 5056 + static void alc233_fixup_lenovo_low_en_micmute_led(struct hda_codec *codec, 5057 + const struct hda_fixup *fix, int action) 5058 + { 5059 + struct alc_spec *spec = codec->spec; 5060 + 5061 + if (action == HDA_FIXUP_ACT_PRE_PROBE) 5062 + spec->micmute_led_polarity = 1; 5063 + alc233_fixup_lenovo_line2_mic_hotkey(codec, fix, action); 5122 5064 } 5123 5065 5124 5066 static void alc_hp_mute_disable(struct hda_codec *codec, unsigned int delay) ··· 7699 7621 ALC275_FIXUP_DELL_XPS, 7700 7622 ALC293_FIXUP_LENOVO_SPK_NOISE, 7701 7623 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, 7624 + ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED, 7702 7625 ALC255_FIXUP_DELL_SPK_NOISE, 7703 7626 ALC225_FIXUP_DISABLE_MIC_VREF, 7704 7627 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, ··· 7769 7690 ALC285_FIXUP_THINKPAD_X1_GEN7, 7770 7691 ALC285_FIXUP_THINKPAD_HEADSET_JACK, 7771 7692 ALC294_FIXUP_ASUS_ALLY, 7772 - ALC294_FIXUP_ASUS_ALLY_X, 7773 7693 ALC294_FIXUP_ASUS_ALLY_PINS, 7774 7694 ALC294_FIXUP_ASUS_ALLY_VERBS, 7775 7695 ALC294_FIXUP_ASUS_ALLY_SPEAKER, ··· 8694 8616 .type = HDA_FIXUP_FUNC, 8695 8617 .v.func = alc233_fixup_lenovo_line2_mic_hotkey, 8696 8618 }, 8619 + [ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED] = { 8620 + .type = HDA_FIXUP_FUNC, 8621 + .v.func = alc233_fixup_lenovo_low_en_micmute_led, 8622 + }, 8697 8623 [ALC233_FIXUP_INTEL_NUC8_DMIC] = { 8698 8624 .type = HDA_FIXUP_FUNC, 8699 8625 .v.func = alc_fixup_inv_dmic, ··· 9217 9135 [ALC294_FIXUP_ASUS_ALLY] = { 9218 9136 .type = HDA_FIXUP_FUNC, 9219 9137 .v.func = cs35l41_fixup_i2c_two, 9220 - .chained = true, 9221 - .chain_id = ALC294_FIXUP_ASUS_ALLY_PINS 9222 - }, 9223 - [ALC294_FIXUP_ASUS_ALLY_X] = { 9224 - .type = HDA_FIXUP_FUNC, 9225 - .v.func = tas2781_fixup_i2c, 9226 9138 .chained = true, 9227 9139 .chain_id = ALC294_FIXUP_ASUS_ALLY_PINS 9228 9140 }, ··· 10676 10600 SND_PCI_QUIRK(0x103c, 0x8e1a, "HP ZBook Firefly 14 G12A", ALC285_FIXUP_HP_GPIO_LED), 10677 10601 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC), 10678 10602 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300), 10603 + SND_PCI_QUIRK(0x1043, 0x1054, "ASUS G614FH/FM/FP", ALC287_FIXUP_CS35L41_I2C_2), 10679 10604 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 10605 + SND_PCI_QUIRK(0x1043, 0x1074, "ASUS G614PH/PM/PP", ALC287_FIXUP_CS35L41_I2C_2), 10680 10606 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK), 10681 10607 SND_PCI_QUIRK(0x1043, 0x10a4, "ASUS TP3407SA", ALC287_FIXUP_TAS2781_I2C), 10682 10608 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC), ··· 10686 10608 SND_PCI_QUIRK(0x1043, 0x10d3, "ASUS K6500ZC", ALC294_FIXUP_ASUS_SPK), 10687 10609 SND_PCI_QUIRK(0x1043, 0x1154, "ASUS TP3607SH", ALC287_FIXUP_TAS2781_I2C), 10688 10610 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 10611 + SND_PCI_QUIRK(0x1043, 0x1194, "ASUS UM3406KA", ALC287_FIXUP_CS35L41_I2C_2), 10689 10612 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), 10690 10613 SND_PCI_QUIRK(0x1043, 0x1204, "ASUS Strix G615JHR_JMR_JPR", ALC287_FIXUP_TAS2781_I2C), 10691 10614 SND_PCI_QUIRK(0x1043, 0x1214, "ASUS Strix G615LH_LM_LP", ALC287_FIXUP_TAS2781_I2C), 10692 10615 SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), 10693 10616 SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE), 10694 10617 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE), 10618 + SND_PCI_QUIRK(0x1043, 0x1294, "ASUS B3405CVA", ALC245_FIXUP_CS35L41_SPI_2), 10695 10619 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE), 10696 10620 SND_PCI_QUIRK(0x1043, 0x12a3, "Asus N7691ZM", ALC269_FIXUP_ASUS_N7601ZM), 10697 10621 SND_PCI_QUIRK(0x1043, 0x12af, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2), 10622 + SND_PCI_QUIRK(0x1043, 0x12b4, "ASUS B3405CCA / P3405CCA", ALC245_FIXUP_CS35L41_SPI_2), 10698 10623 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC), 10699 10624 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC), 10700 10625 SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE), ··· 10726 10645 SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS), 10727 10646 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK), 10728 10647 SND_PCI_QUIRK(0x1043, 0x17f3, "ROG Ally NR2301L/X", ALC294_FIXUP_ASUS_ALLY), 10729 - SND_PCI_QUIRK(0x1043, 0x1eb3, "ROG Ally X RC72LA", ALC294_FIXUP_ASUS_ALLY_X), 10730 10648 SND_PCI_QUIRK(0x1043, 0x1863, "ASUS UX6404VI/VV", ALC245_FIXUP_CS35L41_SPI_2), 10731 10649 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS), 10732 10650 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC), ··· 10779 10699 SND_PCI_QUIRK(0x1043, 0x1f12, "ASUS UM5302", ALC287_FIXUP_CS35L41_I2C_2), 10780 10700 SND_PCI_QUIRK(0x1043, 0x1f1f, "ASUS H7604JI/JV/J3D", ALC245_FIXUP_CS35L41_SPI_2), 10781 10701 SND_PCI_QUIRK(0x1043, 0x1f62, "ASUS UX7602ZM", ALC245_FIXUP_CS35L41_SPI_2), 10702 + SND_PCI_QUIRK(0x1043, 0x1f63, "ASUS P5405CSA", ALC245_FIXUP_CS35L41_SPI_2), 10782 10703 SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401), 10704 + SND_PCI_QUIRK(0x1043, 0x1fb3, "ASUS ROG Flow Z13 GZ302EA", ALC287_FIXUP_CS35L41_I2C_2), 10705 + SND_PCI_QUIRK(0x1043, 0x3011, "ASUS B5605CVA", ALC245_FIXUP_CS35L41_SPI_2), 10783 10706 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2), 10707 + SND_PCI_QUIRK(0x1043, 0x3061, "ASUS B3405CCA", ALC245_FIXUP_CS35L41_SPI_2), 10708 + SND_PCI_QUIRK(0x1043, 0x3071, "ASUS B5405CCA", ALC245_FIXUP_CS35L41_SPI_2), 10709 + SND_PCI_QUIRK(0x1043, 0x30c1, "ASUS B3605CCA / P3605CCA", ALC245_FIXUP_CS35L41_SPI_2), 10710 + SND_PCI_QUIRK(0x1043, 0x30d1, "ASUS B5405CCA", ALC245_FIXUP_CS35L41_SPI_2), 10711 + SND_PCI_QUIRK(0x1043, 0x30e1, "ASUS B5605CCA", ALC245_FIXUP_CS35L41_SPI_2), 10784 10712 SND_PCI_QUIRK(0x1043, 0x31d0, "ASUS Zen AIO 27 Z272SD_A272SD", ALC274_FIXUP_ASUS_ZEN_AIO_27), 10713 + SND_PCI_QUIRK(0x1043, 0x31e1, "ASUS B5605CCA", ALC245_FIXUP_CS35L41_SPI_2), 10714 + SND_PCI_QUIRK(0x1043, 0x31f1, "ASUS B3605CCA", ALC245_FIXUP_CS35L41_SPI_2), 10785 10715 SND_PCI_QUIRK(0x1043, 0x3a20, "ASUS G614JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS), 10786 10716 SND_PCI_QUIRK(0x1043, 0x3a30, "ASUS G814JVR/JIR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS), 10787 10717 SND_PCI_QUIRK(0x1043, 0x3a40, "ASUS G814JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS), 10788 10718 SND_PCI_QUIRK(0x1043, 0x3a50, "ASUS G834JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS), 10789 10719 SND_PCI_QUIRK(0x1043, 0x3a60, "ASUS G634JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS), 10720 + SND_PCI_QUIRK(0x1043, 0x3d78, "ASUS GA603KH", ALC287_FIXUP_CS35L41_I2C_2), 10721 + SND_PCI_QUIRK(0x1043, 0x3d88, "ASUS GA603KM", ALC287_FIXUP_CS35L41_I2C_2), 10722 + SND_PCI_QUIRK(0x1043, 0x3e00, "ASUS G814FH/FM/FP", ALC287_FIXUP_CS35L41_I2C_2), 10723 + SND_PCI_QUIRK(0x1043, 0x3e20, "ASUS G814PH/PM/PP", ALC287_FIXUP_CS35L41_I2C_2), 10790 10724 SND_PCI_QUIRK(0x1043, 0x3e30, "ASUS TP3607SA", ALC287_FIXUP_TAS2781_I2C), 10791 10725 SND_PCI_QUIRK(0x1043, 0x3ee0, "ASUS Strix G815_JHR_JMR_JPR", ALC287_FIXUP_TAS2781_I2C), 10792 10726 SND_PCI_QUIRK(0x1043, 0x3ef0, "ASUS Strix G635LR_LW_LX", ALC287_FIXUP_TAS2781_I2C), ··· 10808 10714 SND_PCI_QUIRK(0x1043, 0x3f10, "ASUS Strix G835LR_LW_LX", ALC287_FIXUP_TAS2781_I2C), 10809 10715 SND_PCI_QUIRK(0x1043, 0x3f20, "ASUS Strix G615LR_LW", ALC287_FIXUP_TAS2781_I2C), 10810 10716 SND_PCI_QUIRK(0x1043, 0x3f30, "ASUS Strix G815LR_LW", ALC287_FIXUP_TAS2781_I2C), 10717 + SND_PCI_QUIRK(0x1043, 0x3fd0, "ASUS B3605CVA", ALC245_FIXUP_CS35L41_SPI_2), 10718 + SND_PCI_QUIRK(0x1043, 0x3ff0, "ASUS B5405CVA", ALC245_FIXUP_CS35L41_SPI_2), 10811 10719 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), 10812 10720 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC), 10813 10721 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC), ··· 11008 10912 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC), 11009 10913 SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340), 11010 10914 SND_PCI_QUIRK(0x17aa, 0x334b, "Lenovo ThinkCentre M70 Gen5", ALC283_FIXUP_HEADSET_MIC), 10915 + SND_PCI_QUIRK(0x17aa, 0x3384, "ThinkCentre M90a PRO", ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED), 10916 + SND_PCI_QUIRK(0x17aa, 0x3386, "ThinkCentre M90a Gen6", ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED), 10917 + SND_PCI_QUIRK(0x17aa, 0x3387, "ThinkCentre M70a Gen6", ALC233_FIXUP_LENOVO_L2MH_LOW_ENLED), 11011 10918 SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN), 11012 10919 HDA_CODEC_QUIRK(0x17aa, 0x3802, "DuetITL 2021", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS), 11013 10920 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga Pro 9 14IRP8", ALC287_FIXUP_TAS2781_I2C), ··· 11999 11900 spec->codec_variant = ALC269_TYPE_ALC300; 12000 11901 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */ 12001 11902 break; 11903 + case 0x10ec0222: 12002 11904 case 0x10ec0623: 12003 11905 spec->codec_variant = ALC269_TYPE_ALC623; 11906 + spec->shutup = alc222_shutup; 11907 + spec->init_hook = alc222_init; 12004 11908 break; 12005 11909 case 0x10ec0700: 12006 11910 case 0x10ec0701:
+11
sound/usb/usx2y/usbusx2y.c
··· 151 151 static void snd_usx2y_card_private_free(struct snd_card *card); 152 152 static void usx2y_unlinkseq(struct snd_usx2y_async_seq *s); 153 153 154 + #ifdef USX2Y_NRPACKS_VARIABLE 155 + int nrpacks = USX2Y_NRPACKS; /* number of packets per urb */ 156 + module_param(nrpacks, int, 0444); 157 + MODULE_PARM_DESC(nrpacks, "Number of packets per URB."); 158 + #endif 159 + 154 160 /* 155 161 * pipe 4 is used for switching the lamps, setting samplerate, volumes .... 156 162 */ ··· 437 431 struct usb_device *device = interface_to_usbdev(intf); 438 432 struct snd_card *card; 439 433 int err; 434 + 435 + #ifdef USX2Y_NRPACKS_VARIABLE 436 + if (nrpacks < 0 || nrpacks > USX2Y_NRPACKS_MAX) 437 + return -EINVAL; 438 + #endif 440 439 441 440 if (le16_to_cpu(device->descriptor.idVendor) != 0x1604 || 442 441 (le16_to_cpu(device->descriptor.idProduct) != USB_ID_US122 &&
+26
sound/usb/usx2y/usbusx2y.h
··· 7 7 8 8 #define NRURBS 2 9 9 10 + /* Default value used for nr of packs per urb. 11 + * 1 to 4 have been tested ok on uhci. 12 + * To use 3 on ohci, you'd need a patch: 13 + * look for "0000425-linux-2.6.9-rc4-mm1_ohci-hcd.patch.gz" on 14 + * "https://bugtrack.alsa-project.org/alsa-bug/bug_view_page.php?bug_id=0000425" 15 + * 16 + * 1, 2 and 4 work out of the box on ohci, if I recall correctly. 17 + * Bigger is safer operation, smaller gives lower latencies. 18 + */ 19 + #define USX2Y_NRPACKS 4 20 + 21 + #define USX2Y_NRPACKS_MAX 1024 22 + 23 + /* If your system works ok with this module's parameter 24 + * nrpacks set to 1, you might as well comment 25 + * this define out, and thereby produce smaller, faster code. 26 + * You'd also set USX2Y_NRPACKS to 1 then. 27 + */ 28 + #define USX2Y_NRPACKS_VARIABLE 1 29 + 30 + #ifdef USX2Y_NRPACKS_VARIABLE 31 + extern int nrpacks; 32 + #define nr_of_packs() nrpacks 33 + #else 34 + #define nr_of_packs() USX2Y_NRPACKS 35 + #endif 10 36 11 37 #define URBS_ASYNC_SEQ 10 12 38 #define URB_DATA_LEN_ASYNC_SEQ 32
-27
sound/usb/usx2y/usbusx2yaudio.c
··· 28 28 #include "usx2y.h" 29 29 #include "usbusx2y.h" 30 30 31 - /* Default value used for nr of packs per urb. 32 - * 1 to 4 have been tested ok on uhci. 33 - * To use 3 on ohci, you'd need a patch: 34 - * look for "0000425-linux-2.6.9-rc4-mm1_ohci-hcd.patch.gz" on 35 - * "https://bugtrack.alsa-project.org/alsa-bug/bug_view_page.php?bug_id=0000425" 36 - * 37 - * 1, 2 and 4 work out of the box on ohci, if I recall correctly. 38 - * Bigger is safer operation, smaller gives lower latencies. 39 - */ 40 - #define USX2Y_NRPACKS 4 41 - 42 - /* If your system works ok with this module's parameter 43 - * nrpacks set to 1, you might as well comment 44 - * this define out, and thereby produce smaller, faster code. 45 - * You'd also set USX2Y_NRPACKS to 1 then. 46 - */ 47 - #define USX2Y_NRPACKS_VARIABLE 1 48 - 49 - #ifdef USX2Y_NRPACKS_VARIABLE 50 - static int nrpacks = USX2Y_NRPACKS; /* number of packets per urb */ 51 - #define nr_of_packs() nrpacks 52 - module_param(nrpacks, int, 0444); 53 - MODULE_PARM_DESC(nrpacks, "Number of packets per URB."); 54 - #else 55 - #define nr_of_packs() USX2Y_NRPACKS 56 - #endif 57 - 58 31 static int usx2y_urb_capt_retire(struct snd_usx2y_substream *subs) 59 32 { 60 33 struct urb *urb = subs->completed_urb;
+2
tools/testing/selftests/damon/damon_nr_regions.py
··· 65 65 66 66 test_name = 'nr_regions test with %d/%d/%d real/min/max nr_regions' % ( 67 67 real_nr_regions, min_nr_regions, max_nr_regions) 68 + collected_nr_regions.sort() 68 69 if (collected_nr_regions[0] < min_nr_regions or 69 70 collected_nr_regions[-1] > max_nr_regions): 70 71 print('fail %s' % test_name) ··· 110 109 attrs = kdamonds.kdamonds[0].contexts[0].monitoring_attrs 111 110 attrs.min_nr_regions = 3 112 111 attrs.max_nr_regions = 7 112 + attrs.update_us = 100000 113 113 err = kdamonds.kdamonds[0].commit() 114 114 if err is not None: 115 115 proc.terminate()
+6 -3
tools/testing/selftests/damon/damos_quota.py
··· 51 51 nr_quota_exceeds = scheme.stats.qt_exceeds 52 52 53 53 wss_collected.sort() 54 + nr_expected_quota_exceeds = 0 54 55 for wss in wss_collected: 55 56 if wss > sz_quota: 56 57 print('quota is not kept: %s > %s' % (wss, sz_quota)) 57 58 print('collected samples are as below') 58 59 print('\n'.join(['%d' % wss for wss in wss_collected])) 59 60 exit(1) 61 + if wss == sz_quota: 62 + nr_expected_quota_exceeds += 1 60 63 61 - if nr_quota_exceeds < len(wss_collected): 62 - print('quota is not always exceeded: %d > %d' % 63 - (len(wss_collected), nr_quota_exceeds)) 64 + if nr_quota_exceeds < nr_expected_quota_exceeds: 65 + print('quota is exceeded less than expected: %d < %d' % 66 + (nr_quota_exceeds, nr_expected_quota_exceeds)) 64 67 exit(1) 65 68 66 69 if __name__ == '__main__':
+3
tools/testing/selftests/damon/damos_quota_goal.py
··· 63 63 if last_effective_bytes != 0 else -1.0)) 64 64 65 65 if last_effective_bytes == goal.effective_bytes: 66 + # effective quota was already minimum that cannot be more reduced 67 + if expect_increase is False and last_effective_bytes == 1: 68 + continue 66 69 print('efective bytes not changed: %d' % goal.effective_bytes) 67 70 exit(1) 68 71
+2 -2
tools/testing/selftests/drivers/net/bonding/bond_options.sh
··· 11 11 12 12 lib_dir=$(dirname "$0") 13 13 source ${lib_dir}/bond_topo_3d1c.sh 14 - c_maddr="33:33:00:00:00:10" 15 - g_maddr="33:33:00:00:02:54" 14 + c_maddr="33:33:ff:00:00:10" 15 + g_maddr="33:33:ff:00:02:54" 16 16 17 17 skip_prio() 18 18 {
+186 -16
tools/testing/selftests/drivers/net/ping.py
··· 1 1 #!/usr/bin/env python3 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 4 + import os 5 + import random, string, time 4 6 from lib.py import ksft_run, ksft_exit 5 - from lib.py import ksft_eq 6 - from lib.py import NetDrvEpEnv 7 + from lib.py import ksft_eq, KsftSkipEx, KsftFailEx 8 + from lib.py import EthtoolFamily, NetDrvEpEnv 7 9 from lib.py import bkg, cmd, wait_port_listen, rand_port 10 + from lib.py import ethtool, ip 8 11 12 + remote_ifname="" 13 + no_sleep=False 9 14 10 - def test_v4(cfg) -> None: 15 + def _test_v4(cfg) -> None: 11 16 cfg.require_ipver("4") 12 17 13 - cmd("ping -c 1 -W0.5 " + cfg.remote_addr_v["4"]) 14 - cmd("ping -c 1 -W0.5 " + cfg.addr_v["4"], host=cfg.remote) 18 + cmd(f"ping -c 1 -W0.5 {cfg.remote_v4}") 19 + cmd(f"ping -c 1 -W0.5 {cfg.v4}", host=cfg.remote) 20 + cmd(f"ping -s 65000 -c 1 -W0.5 {cfg.remote_v4}") 21 + cmd(f"ping -s 65000 -c 1 -W0.5 {cfg.v4}", host=cfg.remote) 15 22 16 - 17 - def test_v6(cfg) -> None: 23 + def _test_v6(cfg) -> None: 18 24 cfg.require_ipver("6") 19 25 20 - cmd("ping -c 1 -W0.5 " + cfg.remote_addr_v["6"]) 21 - cmd("ping -c 1 -W0.5 " + cfg.addr_v["6"], host=cfg.remote) 26 + cmd(f"ping -c 1 -W5 {cfg.remote_v6}") 27 + cmd(f"ping -c 1 -W5 {cfg.v6}", host=cfg.remote) 28 + cmd(f"ping -s 65000 -c 1 -W0.5 {cfg.remote_v6}") 29 + cmd(f"ping -s 65000 -c 1 -W0.5 {cfg.v6}", host=cfg.remote) 22 30 23 - 24 - def test_tcp(cfg) -> None: 31 + def _test_tcp(cfg) -> None: 25 32 cfg.require_cmd("socat", remote=True) 26 33 27 34 port = rand_port() 28 35 listen_cmd = f"socat -{cfg.addr_ipver} -t 2 -u TCP-LISTEN:{port},reuseport STDOUT" 29 36 37 + test_string = ''.join(random.choice(string.ascii_lowercase) for _ in range(65536)) 30 38 with bkg(listen_cmd, exit_wait=True) as nc: 31 39 wait_port_listen(port) 32 40 33 - cmd(f"echo ping | socat -t 2 -u STDIN TCP:{cfg.baddr}:{port}", 41 + cmd(f"echo {test_string} | socat -t 2 -u STDIN TCP:{cfg.baddr}:{port}", 34 42 shell=True, host=cfg.remote) 35 - ksft_eq(nc.stdout.strip(), "ping") 43 + ksft_eq(nc.stdout.strip(), test_string) 36 44 45 + test_string = ''.join(random.choice(string.ascii_lowercase) for _ in range(65536)) 37 46 with bkg(listen_cmd, host=cfg.remote, exit_wait=True) as nc: 38 47 wait_port_listen(port, host=cfg.remote) 39 48 40 - cmd(f"echo ping | socat -t 2 -u STDIN TCP:{cfg.remote_baddr}:{port}", shell=True) 41 - ksft_eq(nc.stdout.strip(), "ping") 49 + cmd(f"echo {test_string} | socat -t 2 -u STDIN TCP:{cfg.remote_baddr}:{port}", shell=True) 50 + ksft_eq(nc.stdout.strip(), test_string) 42 51 52 + def _set_offload_checksum(cfg, netnl, on) -> None: 53 + try: 54 + ethtool(f" -K {cfg.ifname} rx {on} tx {on} ") 55 + except: 56 + return 57 + 58 + def _set_xdp_generic_sb_on(cfg) -> None: 59 + test_dir = os.path.dirname(os.path.realpath(__file__)) 60 + prog = test_dir + "/../../net/lib/xdp_dummy.bpf.o" 61 + cmd(f"ip link set dev {remote_ifname} mtu 1500", shell=True, host=cfg.remote) 62 + cmd(f"ip link set dev {cfg.ifname} mtu 1500 xdpgeneric obj {prog} sec xdp", shell=True) 63 + 64 + if no_sleep != True: 65 + time.sleep(10) 66 + 67 + def _set_xdp_generic_mb_on(cfg) -> None: 68 + test_dir = os.path.dirname(os.path.realpath(__file__)) 69 + prog = test_dir + "/../../net/lib/xdp_dummy.bpf.o" 70 + cmd(f"ip link set dev {remote_ifname} mtu 9000", shell=True, host=cfg.remote) 71 + ip("link set dev %s mtu 9000 xdpgeneric obj %s sec xdp.frags" % (cfg.ifname, prog)) 72 + 73 + if no_sleep != True: 74 + time.sleep(10) 75 + 76 + def _set_xdp_native_sb_on(cfg) -> None: 77 + test_dir = os.path.dirname(os.path.realpath(__file__)) 78 + prog = test_dir + "/../../net/lib/xdp_dummy.bpf.o" 79 + cmd(f"ip link set dev {remote_ifname} mtu 1500", shell=True, host=cfg.remote) 80 + cmd(f"ip -j link set dev {cfg.ifname} mtu 1500 xdp obj {prog} sec xdp", shell=True) 81 + xdp_info = ip("-d link show %s" % (cfg.ifname), json=True)[0] 82 + if xdp_info['xdp']['mode'] != 1: 83 + """ 84 + If the interface doesn't support native-mode, it falls back to generic mode. 85 + The mode value 1 is native and 2 is generic. 86 + So it raises an exception if mode is not 1(native mode). 87 + """ 88 + raise KsftSkipEx('device does not support native-XDP') 89 + 90 + if no_sleep != True: 91 + time.sleep(10) 92 + 93 + def _set_xdp_native_mb_on(cfg) -> None: 94 + test_dir = os.path.dirname(os.path.realpath(__file__)) 95 + prog = test_dir + "/../../net/lib/xdp_dummy.bpf.o" 96 + cmd(f"ip link set dev {remote_ifname} mtu 9000", shell=True, host=cfg.remote) 97 + try: 98 + cmd(f"ip link set dev {cfg.ifname} mtu 9000 xdp obj {prog} sec xdp.frags", shell=True) 99 + except Exception as e: 100 + cmd(f"ip link set dev {remote_ifname} mtu 1500", shell=True, host=cfg.remote) 101 + raise KsftSkipEx('device does not support native-multi-buffer XDP') 102 + 103 + if no_sleep != True: 104 + time.sleep(10) 105 + 106 + def _set_xdp_offload_on(cfg) -> None: 107 + test_dir = os.path.dirname(os.path.realpath(__file__)) 108 + prog = test_dir + "/../../net/lib/xdp_dummy.bpf.o" 109 + cmd(f"ip link set dev {cfg.ifname} mtu 1500", shell=True) 110 + try: 111 + cmd(f"ip link set dev {cfg.ifname} xdpoffload obj {prog} sec xdp", shell=True) 112 + except Exception as e: 113 + raise KsftSkipEx('device does not support offloaded XDP') 114 + cmd(f"ip link set dev {remote_ifname} mtu 1500", shell=True, host=cfg.remote) 115 + 116 + if no_sleep != True: 117 + time.sleep(10) 118 + 119 + def get_interface_info(cfg) -> None: 120 + global remote_ifname 121 + global no_sleep 122 + 123 + remote_info = cmd(f"ip -4 -o addr show to {cfg.remote_v4} | awk '{{print $2}}'", shell=True, host=cfg.remote).stdout 124 + remote_ifname = remote_info.rstrip('\n') 125 + if remote_ifname == "": 126 + raise KsftFailEx('Can not get remote interface') 127 + local_info = ip("-d link show %s" % (cfg.ifname), json=True)[0] 128 + if 'parentbus' in local_info and local_info['parentbus'] == "netdevsim": 129 + no_sleep=True 130 + if 'linkinfo' in local_info and local_info['linkinfo']['info_kind'] == "veth": 131 + no_sleep=True 132 + 133 + def set_interface_init(cfg) -> None: 134 + cmd(f"ip link set dev {cfg.ifname} mtu 1500", shell=True) 135 + cmd(f"ip link set dev {cfg.ifname} xdp off ", shell=True) 136 + cmd(f"ip link set dev {cfg.ifname} xdpgeneric off ", shell=True) 137 + cmd(f"ip link set dev {cfg.ifname} xdpoffload off", shell=True) 138 + cmd(f"ip link set dev {remote_ifname} mtu 1500", shell=True, host=cfg.remote) 139 + 140 + def test_default(cfg, netnl) -> None: 141 + _set_offload_checksum(cfg, netnl, "off") 142 + _test_v4(cfg) 143 + _test_v6(cfg) 144 + _test_tcp(cfg) 145 + _set_offload_checksum(cfg, netnl, "on") 146 + _test_v4(cfg) 147 + _test_v6(cfg) 148 + _test_tcp(cfg) 149 + 150 + def test_xdp_generic_sb(cfg, netnl) -> None: 151 + _set_xdp_generic_sb_on(cfg) 152 + _set_offload_checksum(cfg, netnl, "off") 153 + _test_v4(cfg) 154 + _test_v6(cfg) 155 + _test_tcp(cfg) 156 + _set_offload_checksum(cfg, netnl, "on") 157 + _test_v4(cfg) 158 + _test_v6(cfg) 159 + _test_tcp(cfg) 160 + ip("link set dev %s xdpgeneric off" % cfg.ifname) 161 + 162 + def test_xdp_generic_mb(cfg, netnl) -> None: 163 + _set_xdp_generic_mb_on(cfg) 164 + _set_offload_checksum(cfg, netnl, "off") 165 + _test_v4(cfg) 166 + _test_v6(cfg) 167 + _test_tcp(cfg) 168 + _set_offload_checksum(cfg, netnl, "on") 169 + _test_v4(cfg) 170 + _test_v6(cfg) 171 + _test_tcp(cfg) 172 + ip("link set dev %s xdpgeneric off" % cfg.ifname) 173 + 174 + def test_xdp_native_sb(cfg, netnl) -> None: 175 + _set_xdp_native_sb_on(cfg) 176 + _set_offload_checksum(cfg, netnl, "off") 177 + _test_v4(cfg) 178 + _test_v6(cfg) 179 + _test_tcp(cfg) 180 + _set_offload_checksum(cfg, netnl, "on") 181 + _test_v4(cfg) 182 + _test_v6(cfg) 183 + _test_tcp(cfg) 184 + ip("link set dev %s xdp off" % cfg.ifname) 185 + 186 + def test_xdp_native_mb(cfg, netnl) -> None: 187 + _set_xdp_native_mb_on(cfg) 188 + _set_offload_checksum(cfg, netnl, "off") 189 + _test_v4(cfg) 190 + _test_v6(cfg) 191 + _test_tcp(cfg) 192 + _set_offload_checksum(cfg, netnl, "on") 193 + _test_v4(cfg) 194 + _test_v6(cfg) 195 + _test_tcp(cfg) 196 + ip("link set dev %s xdp off" % cfg.ifname) 197 + 198 + def test_xdp_offload(cfg, netnl) -> None: 199 + _set_xdp_offload_on(cfg) 200 + _test_v4(cfg) 201 + _test_v6(cfg) 202 + _test_tcp(cfg) 203 + ip("link set dev %s xdpoffload off" % cfg.ifname) 43 204 44 205 def main() -> None: 45 206 with NetDrvEpEnv(__file__) as cfg: 46 - ksft_run(globs=globals(), case_pfx={"test_"}, args=(cfg, )) 207 + get_interface_info(cfg) 208 + set_interface_init(cfg) 209 + ksft_run([test_default, 210 + test_xdp_generic_sb, 211 + test_xdp_generic_mb, 212 + test_xdp_native_sb, 213 + test_xdp_native_mb, 214 + test_xdp_offload], 215 + args=(cfg, EthtoolFamily())) 216 + set_interface_init(cfg) 47 217 ksft_exit() 48 218 49 219
+13 -8
tools/testing/selftests/kvm/mmu_stress_test.c
··· 18 18 #include "ucall_common.h" 19 19 20 20 static bool mprotect_ro_done; 21 + static bool all_vcpus_hit_ro_fault; 21 22 22 23 static void guest_code(uint64_t start_gpa, uint64_t end_gpa, uint64_t stride) 23 24 { ··· 37 36 38 37 /* 39 38 * Write to the region while mprotect(PROT_READ) is underway. Keep 40 - * looping until the memory is guaranteed to be read-only, otherwise 41 - * vCPUs may complete their writes and advance to the next stage 42 - * prematurely. 39 + * looping until the memory is guaranteed to be read-only and a fault 40 + * has occurred, otherwise vCPUs may complete their writes and advance 41 + * to the next stage prematurely. 43 42 * 44 43 * For architectures that support skipping the faulting instruction, 45 44 * generate the store via inline assembly to ensure the exact length ··· 57 56 #else 58 57 vcpu_arch_put_guest(*((volatile uint64_t *)gpa), gpa); 59 58 #endif 60 - } while (!READ_ONCE(mprotect_ro_done)); 59 + } while (!READ_ONCE(mprotect_ro_done) || !READ_ONCE(all_vcpus_hit_ro_fault)); 61 60 62 61 /* 63 62 * Only architectures that write the entire range can explicitly sync, ··· 82 81 83 82 static int nr_vcpus; 84 83 static atomic_t rendezvous; 84 + static atomic_t nr_ro_faults; 85 85 86 86 static void rendezvous_with_boss(void) 87 87 { ··· 150 148 * be stuck on the faulting instruction for other architectures. Go to 151 149 * stage 3 without a rendezvous 152 150 */ 153 - do { 154 - r = _vcpu_run(vcpu); 155 - } while (!r); 151 + r = _vcpu_run(vcpu); 156 152 TEST_ASSERT(r == -1 && errno == EFAULT, 157 153 "Expected EFAULT on write to RO memory, got r = %d, errno = %d", r, errno); 154 + 155 + atomic_inc(&nr_ro_faults); 156 + if (atomic_read(&nr_ro_faults) == nr_vcpus) { 157 + WRITE_ONCE(all_vcpus_hit_ro_fault, true); 158 + sync_global_to_guest(vm, all_vcpus_hit_ro_fault); 159 + } 158 160 159 161 #if defined(__x86_64__) || defined(__aarch64__) 160 162 /* ··· 384 378 rendezvous_with_vcpus(&time_run2, "run 2"); 385 379 386 380 mprotect(mem, slot_size, PROT_READ); 387 - usleep(10); 388 381 mprotect_ro_done = true; 389 382 sync_global_to_guest(vm, mprotect_ro_done); 390 383
+2
tools/testing/selftests/kvm/x86/nested_exceptions_test.c
··· 85 85 86 86 GUEST_ASSERT_EQ(ctrl->exit_code, (SVM_EXIT_EXCP_BASE + vector)); 87 87 GUEST_ASSERT_EQ(ctrl->exit_info_1, error_code); 88 + GUEST_ASSERT(!ctrl->int_state); 88 89 } 89 90 90 91 static void l1_svm_code(struct svm_test_data *svm) ··· 123 122 GUEST_ASSERT_EQ(vmreadz(VM_EXIT_REASON), EXIT_REASON_EXCEPTION_NMI); 124 123 GUEST_ASSERT_EQ((vmreadz(VM_EXIT_INTR_INFO) & 0xff), vector); 125 124 GUEST_ASSERT_EQ(vmreadz(VM_EXIT_INTR_ERROR_CODE), error_code); 125 + GUEST_ASSERT(!vmreadz(GUEST_INTERRUPTIBILITY_INFO)); 126 126 } 127 127 128 128 static void l1_vmx_code(struct vmx_pages *vmx)
+2 -1
tools/testing/selftests/kvm/x86/sev_smoke_test.c
··· 52 52 bool bad = false; 53 53 for (i = 0; i < 4095; i++) { 54 54 if (from_host[i] != from_guest[i]) { 55 - printf("mismatch at %02hhx | %02hhx %02hhx\n", i, from_host[i], from_guest[i]); 55 + printf("mismatch at %u | %02hhx %02hhx\n", 56 + i, from_host[i], from_guest[i]); 56 57 bad = true; 57 58 } 58 59 }
+1 -1
tools/testing/selftests/mm/hugepage-mremap.c
··· 15 15 #define _GNU_SOURCE 16 16 #include <stdlib.h> 17 17 #include <stdio.h> 18 - #include <asm-generic/unistd.h> 18 + #include <unistd.h> 19 19 #include <sys/mman.h> 20 20 #include <errno.h> 21 21 #include <fcntl.h> /* Definition of O_* constants */
+7 -1
tools/testing/selftests/mm/ksm_functional_tests.c
··· 11 11 #include <string.h> 12 12 #include <stdbool.h> 13 13 #include <stdint.h> 14 - #include <asm-generic/unistd.h> 14 + #include <unistd.h> 15 15 #include <errno.h> 16 16 #include <fcntl.h> 17 17 #include <sys/mman.h> ··· 369 369 munmap(map, size); 370 370 } 371 371 372 + #ifdef __NR_userfaultfd 372 373 static void test_unmerge_uffd_wp(void) 373 374 { 374 375 struct uffdio_writeprotect uffd_writeprotect; ··· 430 429 unmap: 431 430 munmap(map, size); 432 431 } 432 + #endif 433 433 434 434 /* Verify that KSM can be enabled / queried with prctl. */ 435 435 static void test_prctl(void) ··· 686 684 exit(test_child_ksm()); 687 685 } 688 686 687 + #ifdef __NR_userfaultfd 689 688 tests++; 689 + #endif 690 690 691 691 ksft_print_header(); 692 692 ksft_set_plan(tests); ··· 700 696 test_unmerge(); 701 697 test_unmerge_zero_pages(); 702 698 test_unmerge_discarded(); 699 + #ifdef __NR_userfaultfd 703 700 test_unmerge_uffd_wp(); 701 + #endif 704 702 705 703 test_prot_none(); 706 704
+13 -1
tools/testing/selftests/mm/memfd_secret.c
··· 17 17 18 18 #include <stdlib.h> 19 19 #include <string.h> 20 - #include <asm-generic/unistd.h> 20 + #include <unistd.h> 21 21 #include <errno.h> 22 22 #include <stdio.h> 23 23 #include <fcntl.h> ··· 27 27 #define fail(fmt, ...) ksft_test_result_fail(fmt, ##__VA_ARGS__) 28 28 #define pass(fmt, ...) ksft_test_result_pass(fmt, ##__VA_ARGS__) 29 29 #define skip(fmt, ...) ksft_test_result_skip(fmt, ##__VA_ARGS__) 30 + 31 + #ifdef __NR_memfd_secret 30 32 31 33 #define PATTERN 0x55 32 34 ··· 334 332 335 333 ksft_finished(); 336 334 } 335 + 336 + #else /* __NR_memfd_secret */ 337 + 338 + int main(int argc, char *argv[]) 339 + { 340 + printf("skip: skipping memfd_secret test (missing __NR_memfd_secret)\n"); 341 + return KSFT_SKIP; 342 + } 343 + 344 + #endif /* __NR_memfd_secret */
+7 -1
tools/testing/selftests/mm/mkdirty.c
··· 9 9 */ 10 10 #include <fcntl.h> 11 11 #include <signal.h> 12 - #include <asm-generic/unistd.h> 12 + #include <unistd.h> 13 13 #include <string.h> 14 14 #include <errno.h> 15 15 #include <stdlib.h> ··· 265 265 munmap(mmap_mem, mmap_size); 266 266 } 267 267 268 + #ifdef __NR_userfaultfd 268 269 static void test_uffdio_copy(void) 269 270 { 270 271 struct uffdio_register uffdio_register; ··· 323 322 munmap(dst, pagesize); 324 323 free(src); 325 324 } 325 + #endif /* __NR_userfaultfd */ 326 326 327 327 int main(void) 328 328 { ··· 336 334 thpsize / 1024); 337 335 tests += 3; 338 336 } 337 + #ifdef __NR_userfaultfd 339 338 tests += 1; 339 + #endif /* __NR_userfaultfd */ 340 340 341 341 ksft_print_header(); 342 342 ksft_set_plan(tests); ··· 368 364 if (thpsize) 369 365 test_pte_mapped_thp(); 370 366 /* Placing a fresh page via userfaultfd may set the PTE dirty. */ 367 + #ifdef __NR_userfaultfd 371 368 test_uffdio_copy(); 369 + #endif /* __NR_userfaultfd */ 372 370 373 371 err = ksft_get_fail_cnt(); 374 372 if (err)
-1
tools/testing/selftests/mm/mlock2.h
··· 3 3 #include <errno.h> 4 4 #include <stdio.h> 5 5 #include <stdlib.h> 6 - #include <asm-generic/unistd.h> 7 6 8 7 static int mlock2_(void *start, size_t len, int flags) 9 8 {
+1 -1
tools/testing/selftests/mm/protection_keys.c
··· 42 42 #include <sys/wait.h> 43 43 #include <sys/stat.h> 44 44 #include <fcntl.h> 45 - #include <asm-generic/unistd.h> 45 + #include <unistd.h> 46 46 #include <sys/ptrace.h> 47 47 #include <setjmp.h> 48 48
+4
tools/testing/selftests/mm/uffd-common.c
··· 673 673 674 674 int uffd_open_sys(unsigned int flags) 675 675 { 676 + #ifdef __NR_userfaultfd 676 677 return syscall(__NR_userfaultfd, flags); 678 + #else 679 + return -1; 680 + #endif 677 681 } 678 682 679 683 int uffd_open(unsigned int flags)
+14 -1
tools/testing/selftests/mm/uffd-stress.c
··· 33 33 * pthread_mutex_lock will also verify the atomicity of the memory 34 34 * transfer (UFFDIO_COPY). 35 35 */ 36 - #include <asm-generic/unistd.h> 36 + 37 37 #include "uffd-common.h" 38 38 39 39 uint64_t features; 40 + #ifdef __NR_userfaultfd 40 41 41 42 #define BOUNCE_RANDOM (1<<0) 42 43 #define BOUNCE_RACINGFAULTS (1<<1) ··· 472 471 nr_pages, nr_pages_per_cpu); 473 472 return userfaultfd_stress(); 474 473 } 474 + 475 + #else /* __NR_userfaultfd */ 476 + 477 + #warning "missing __NR_userfaultfd definition" 478 + 479 + int main(void) 480 + { 481 + printf("skip: Skipping userfaultfd test (missing __NR_userfaultfd)\n"); 482 + return KSFT_SKIP; 483 + } 484 + 485 + #endif /* __NR_userfaultfd */
+13 -1
tools/testing/selftests/mm/uffd-unit-tests.c
··· 5 5 * Copyright (C) 2015-2023 Red Hat, Inc. 6 6 */ 7 7 8 - #include <asm-generic/unistd.h> 9 8 #include "uffd-common.h" 10 9 11 10 #include "../../../../mm/gup_test.h" 11 + 12 + #ifdef __NR_userfaultfd 12 13 13 14 /* The unit test doesn't need a large or random size, make it 32MB for now */ 14 15 #define UFFD_TEST_MEM_SIZE (32UL << 20) ··· 1559 1558 return ksft_get_fail_cnt() ? KSFT_FAIL : KSFT_PASS; 1560 1559 } 1561 1560 1561 + #else /* __NR_userfaultfd */ 1562 + 1563 + #warning "missing __NR_userfaultfd definition" 1564 + 1565 + int main(void) 1566 + { 1567 + printf("Skipping %s (missing __NR_userfaultfd)\n", __file__); 1568 + return KSFT_SKIP; 1569 + } 1570 + 1571 + #endif /* __NR_userfaultfd */
+1
tools/testing/selftests/net/Makefile
··· 31 31 TEST_PROGS += ioam6.sh 32 32 TEST_PROGS += gro.sh 33 33 TEST_PROGS += gre_gso.sh 34 + TEST_PROGS += gre_ipv6_lladdr.sh 34 35 TEST_PROGS += cmsg_so_mark.sh 35 36 TEST_PROGS += cmsg_so_priority.sh 36 37 TEST_PROGS += test_so_rcv.sh
+177
tools/testing/selftests/net/gre_ipv6_lladdr.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + source ./lib.sh 5 + 6 + PAUSE_ON_FAIL="no" 7 + 8 + # The trap function handler 9 + # 10 + exit_cleanup_all() 11 + { 12 + cleanup_all_ns 13 + 14 + exit "${EXIT_STATUS}" 15 + } 16 + 17 + # Add fake IPv4 and IPv6 networks on the loopback device, to be used as 18 + # underlay by future GRE devices. 19 + # 20 + setup_basenet() 21 + { 22 + ip -netns "${NS0}" link set dev lo up 23 + ip -netns "${NS0}" address add dev lo 192.0.2.10/24 24 + ip -netns "${NS0}" address add dev lo 2001:db8::10/64 nodad 25 + } 26 + 27 + # Check if network device has an IPv6 link-local address assigned. 28 + # 29 + # Parameters: 30 + # 31 + # * $1: The network device to test 32 + # * $2: An extra regular expression that should be matched (to verify the 33 + # presence of extra attributes) 34 + # * $3: The expected return code from grep (to allow checking the absence of 35 + # a link-local address) 36 + # * $4: The user visible name for the scenario being tested 37 + # 38 + check_ipv6_ll_addr() 39 + { 40 + local DEV="$1" 41 + local EXTRA_MATCH="$2" 42 + local XRET="$3" 43 + local MSG="$4" 44 + 45 + RET=0 46 + set +e 47 + ip -netns "${NS0}" -6 address show dev "${DEV}" scope link | grep "fe80::" | grep -q "${EXTRA_MATCH}" 48 + check_err_fail "${XRET}" $? "" 49 + log_test "${MSG}" 50 + set -e 51 + } 52 + 53 + # Create a GRE device and verify that it gets an IPv6 link-local address as 54 + # expected. 55 + # 56 + # Parameters: 57 + # 58 + # * $1: The device type (gre, ip6gre, gretap or ip6gretap) 59 + # * $2: The local underlay IP address (can be an IPv4, an IPv6 or "any") 60 + # * $3: The remote underlay IP address (can be an IPv4, an IPv6 or "any") 61 + # * $4: The IPv6 interface identifier generation mode to use for the GRE 62 + # device (eui64, none, stable-privacy or random). 63 + # 64 + test_gre_device() 65 + { 66 + local GRE_TYPE="$1" 67 + local LOCAL_IP="$2" 68 + local REMOTE_IP="$3" 69 + local MODE="$4" 70 + local ADDR_GEN_MODE 71 + local MATCH_REGEXP 72 + local MSG 73 + 74 + ip link add netns "${NS0}" name gretest type "${GRE_TYPE}" local "${LOCAL_IP}" remote "${REMOTE_IP}" 75 + 76 + case "${MODE}" in 77 + "eui64") 78 + ADDR_GEN_MODE=0 79 + MATCH_REGEXP="" 80 + MSG="${GRE_TYPE}, mode: 0 (EUI64), ${LOCAL_IP} -> ${REMOTE_IP}" 81 + XRET=0 82 + ;; 83 + "none") 84 + ADDR_GEN_MODE=1 85 + MATCH_REGEXP="" 86 + MSG="${GRE_TYPE}, mode: 1 (none), ${LOCAL_IP} -> ${REMOTE_IP}" 87 + XRET=1 # No link-local address should be generated 88 + ;; 89 + "stable-privacy") 90 + ADDR_GEN_MODE=2 91 + MATCH_REGEXP="stable-privacy" 92 + MSG="${GRE_TYPE}, mode: 2 (stable privacy), ${LOCAL_IP} -> ${REMOTE_IP}" 93 + XRET=0 94 + # Initialise stable_secret (required for stable-privacy mode) 95 + ip netns exec "${NS0}" sysctl -qw net.ipv6.conf.gretest.stable_secret="2001:db8::abcd" 96 + ;; 97 + "random") 98 + ADDR_GEN_MODE=3 99 + MATCH_REGEXP="stable-privacy" 100 + MSG="${GRE_TYPE}, mode: 3 (random), ${LOCAL_IP} -> ${REMOTE_IP}" 101 + XRET=0 102 + ;; 103 + esac 104 + 105 + # Check that IPv6 link-local address is generated when device goes up 106 + ip netns exec "${NS0}" sysctl -qw net.ipv6.conf.gretest.addr_gen_mode="${ADDR_GEN_MODE}" 107 + ip -netns "${NS0}" link set dev gretest up 108 + check_ipv6_ll_addr gretest "${MATCH_REGEXP}" "${XRET}" "config: ${MSG}" 109 + 110 + # Now disable link-local address generation 111 + ip -netns "${NS0}" link set dev gretest down 112 + ip netns exec "${NS0}" sysctl -qw net.ipv6.conf.gretest.addr_gen_mode=1 113 + ip -netns "${NS0}" link set dev gretest up 114 + 115 + # Check that link-local address generation works when re-enabled while 116 + # the device is already up 117 + ip netns exec "${NS0}" sysctl -qw net.ipv6.conf.gretest.addr_gen_mode="${ADDR_GEN_MODE}" 118 + check_ipv6_ll_addr gretest "${MATCH_REGEXP}" "${XRET}" "update: ${MSG}" 119 + 120 + ip -netns "${NS0}" link del dev gretest 121 + } 122 + 123 + test_gre4() 124 + { 125 + local GRE_TYPE 126 + local MODE 127 + 128 + for GRE_TYPE in "gre" "gretap"; do 129 + printf "\n####\nTesting IPv6 link-local address generation on ${GRE_TYPE} devices\n####\n\n" 130 + 131 + for MODE in "eui64" "none" "stable-privacy" "random"; do 132 + test_gre_device "${GRE_TYPE}" 192.0.2.10 192.0.2.11 "${MODE}" 133 + test_gre_device "${GRE_TYPE}" any 192.0.2.11 "${MODE}" 134 + test_gre_device "${GRE_TYPE}" 192.0.2.10 any "${MODE}" 135 + done 136 + done 137 + } 138 + 139 + test_gre6() 140 + { 141 + local GRE_TYPE 142 + local MODE 143 + 144 + for GRE_TYPE in "ip6gre" "ip6gretap"; do 145 + printf "\n####\nTesting IPv6 link-local address generation on ${GRE_TYPE} devices\n####\n\n" 146 + 147 + for MODE in "eui64" "none" "stable-privacy" "random"; do 148 + test_gre_device "${GRE_TYPE}" 2001:db8::10 2001:db8::11 "${MODE}" 149 + test_gre_device "${GRE_TYPE}" any 2001:db8::11 "${MODE}" 150 + test_gre_device "${GRE_TYPE}" 2001:db8::10 any "${MODE}" 151 + done 152 + done 153 + } 154 + 155 + usage() 156 + { 157 + echo "Usage: $0 [-p]" 158 + exit 1 159 + } 160 + 161 + while getopts :p o 162 + do 163 + case $o in 164 + p) PAUSE_ON_FAIL="yes";; 165 + *) usage;; 166 + esac 167 + done 168 + 169 + setup_ns NS0 170 + 171 + set -e 172 + trap exit_cleanup_all EXIT 173 + 174 + setup_basenet 175 + 176 + test_gre4 177 + test_gre6
+6
tools/testing/selftests/net/lib/xdp_dummy.bpf.c
··· 10 10 return XDP_PASS; 11 11 } 12 12 13 + SEC("xdp.frags") 14 + int xdp_dummy_prog_frags(struct xdp_md *ctx) 15 + { 16 + return XDP_PASS; 17 + } 18 + 13 19 char _license[] SEC("license") = "GPL";
+7
tools/testing/selftests/net/netfilter/br_netfilter.sh
··· 13 13 14 14 checktool "nft --version" "run test without nft tool" 15 15 16 + read t < /proc/sys/kernel/tainted 17 + if [ "$t" -ne 0 ];then 18 + echo SKIP: kernel is tainted 19 + exit $ksft_skip 20 + fi 21 + 16 22 cleanup() { 17 23 cleanup_all_ns 18 24 } ··· 171 165 echo PASS: kernel not tainted 172 166 else 173 167 echo ERROR: kernel is tainted 168 + dmesg 174 169 ret=1 175 170 fi 176 171
+7
tools/testing/selftests/net/netfilter/br_netfilter_queue.sh
··· 4 4 5 5 checktool "nft --version" "run test without nft tool" 6 6 7 + read t < /proc/sys/kernel/tainted 8 + if [ "$t" -ne 0 ];then 9 + echo SKIP: kernel is tainted 10 + exit $ksft_skip 11 + fi 12 + 7 13 cleanup() { 8 14 cleanup_all_ns 9 15 } ··· 78 72 echo PASS: kernel not tainted 79 73 else 80 74 echo ERROR: kernel is tainted 75 + dmesg 81 76 exit 1 82 77 fi 83 78
+1
tools/testing/selftests/net/netfilter/nft_queue.sh
··· 593 593 echo "PASS: queue program exiting while packets queued" 594 594 else 595 595 echo "TAINT: queue program exiting while packets queued" 596 + dmesg 596 597 ret=1 597 598 fi 598 599 }
+25
tools/testing/selftests/tc-testing/tc-tests/qdiscs/drr.json
··· 61 61 "teardown": [ 62 62 "$TC qdisc del dev $DUMMY handle 1: root" 63 63 ] 64 + }, 65 + { 66 + "id": "4009", 67 + "name": "Reject creation of DRR class with classid TC_H_ROOT", 68 + "category": [ 69 + "qdisc", 70 + "drr" 71 + ], 72 + "plugins": { 73 + "requires": "nsPlugin" 74 + }, 75 + "setup": [ 76 + "$TC qdisc add dev $DUMMY root handle ffff: drr", 77 + "$TC filter add dev $DUMMY parent ffff: basic classid ffff:1", 78 + "$TC class add dev $DUMMY parent ffff: classid ffff:1 drr", 79 + "$TC filter add dev $DUMMY parent ffff: prio 1 u32 match u16 0x0000 0xfe00 at 2 flowid ffff:ffff" 80 + ], 81 + "cmdUnderTest": "$TC class add dev $DUMMY parent ffff: classid ffff:ffff drr", 82 + "expExitCode": "2", 83 + "verifyCmd": "$TC class show dev $DUMMY", 84 + "matchPattern": "class drr ffff:ffff", 85 + "matchCount": "0", 86 + "teardown": [ 87 + "$TC qdisc del dev $DUMMY root" 88 + ] 64 89 } 65 90 ]
+5 -5
tools/testing/selftests/vDSO/parse_vdso.c
··· 53 53 /* Symbol table */ 54 54 ELF(Sym) *symtab; 55 55 const char *symstrings; 56 - ELF(Word) *gnu_hash; 56 + ELF(Word) *gnu_hash, *gnu_bucket; 57 57 ELF_HASH_ENTRY *bucket, *chain; 58 58 ELF_HASH_ENTRY nbucket, nchain; 59 59 ··· 185 185 /* The bucket array is located after the header (4 uint32) and the bloom 186 186 * filter (size_t array of gnu_hash[2] elements). 187 187 */ 188 - vdso_info.bucket = vdso_info.gnu_hash + 4 + 189 - sizeof(size_t) / 4 * vdso_info.gnu_hash[2]; 188 + vdso_info.gnu_bucket = vdso_info.gnu_hash + 4 + 189 + sizeof(size_t) / 4 * vdso_info.gnu_hash[2]; 190 190 } else { 191 191 vdso_info.nbucket = hash[0]; 192 192 vdso_info.nchain = hash[1]; ··· 268 268 if (vdso_info.gnu_hash) { 269 269 uint32_t h1 = gnu_hash(name), h2, *hashval; 270 270 271 - i = vdso_info.bucket[h1 % vdso_info.nbucket]; 271 + i = vdso_info.gnu_bucket[h1 % vdso_info.nbucket]; 272 272 if (i == 0) 273 273 return 0; 274 274 h1 |= 1; 275 - hashval = vdso_info.bucket + vdso_info.nbucket + 275 + hashval = vdso_info.gnu_bucket + vdso_info.nbucket + 276 276 (i - vdso_info.gnu_hash[1]); 277 277 for (;; i++) { 278 278 ELF(Sym) *sym = &vdso_info.symtab[i];
+1 -1
usr/include/Makefile
··· 10 10 11 11 # In theory, we do not care -m32 or -m64 for header compile tests. 12 12 # It is here just because CONFIG_CC_CAN_LINK is tested with -m32 or -m64. 13 - UAPI_CFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CFLAGS)) 13 + UAPI_CFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS)) 14 14 15 15 # USERCFLAGS might contain sysroot location for CC. 16 16 UAPI_CFLAGS += $(USERCFLAGS)