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.

Conflicts:

drivers/net/phy/aquantia/aquantia.h
219343755eae ("net: phy: aquantia: add missing include guards")
61578f679378 ("net: phy: aquantia: add support for PHY LEDs")

drivers/net/ethernet/wangxun/libwx/wx_hw.c
bd07a9817846 ("net: txgbe: remove separate irq request for MSI and INTx")
b501d261a5b3 ("net: txgbe: add FDIR ATR support")
https://lore.kernel.org/all/20240703112936.483c1975@canb.auug.org.au/

include/linux/mlx5/mlx5_ifc.h
048a403648fc ("net/mlx5: IFC updates for changing max EQs")
99be56171fa9 ("net/mlx5e: SHAMPO, Re-enable HW-GRO")
https://lore.kernel.org/all/20240701133951.6926b2e3@canb.auug.org.au/

Adjacent changes:

drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
4130c67cd123 ("wifi: iwlwifi: mvm: check vif for NULL/ERR_PTR before dereference")
3f3126515fbe ("wifi: iwlwifi: mvm: add mvm-specific guard")

include/net/mac80211.h
816c6bec09ed ("wifi: mac80211: fix BSS_CHANGED_UNSOL_BCAST_PROBE_RESP")
5a009b42e041 ("wifi: mac80211: track changes in AP's TPE")

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

+3063 -2232
-19
Documentation/admin-guide/kernel-parameters.txt
··· 788 788 Documentation/networking/netconsole.rst for an 789 789 alternative. 790 790 791 - <DEVNAME>:<n>.<n>[,options] 792 - Use the specified serial port on the serial core bus. 793 - The addressing uses DEVNAME of the physical serial port 794 - device, followed by the serial core controller instance, 795 - and the serial port instance. The options are the same 796 - as documented for the ttyS addressing above. 797 - 798 - The mapping of the serial ports to the tty instances 799 - can be viewed with: 800 - 801 - $ ls -d /sys/bus/serial-base/devices/*:*.*/tty/* 802 - /sys/bus/serial-base/devices/00:04:0.0/tty/ttyS0 803 - 804 - In the above example, the console can be addressed with 805 - console=00:04:0.0. Note that a console addressed this 806 - way will only get added when the related device driver 807 - is ready. The use of an earlycon parameter in addition to 808 - the console may be desired for console output early on. 809 - 810 791 uart[8250],io,<addr>[,options] 811 792 uart[8250],mmio,<addr>[,options] 812 793 uart[8250],mmio16,<addr>[,options]
+15
Documentation/driver-api/cxl/memory-devices.rst
··· 328 328 .. kernel-doc:: drivers/cxl/mem.c 329 329 :doc: cxl mem 330 330 331 + .. kernel-doc:: drivers/cxl/cxlmem.h 332 + :internal: 333 + 334 + .. kernel-doc:: drivers/cxl/core/memdev.c 335 + :identifiers: 336 + 331 337 CXL Port 332 338 -------- 333 339 .. kernel-doc:: drivers/cxl/port.c ··· 346 340 347 341 .. kernel-doc:: drivers/cxl/cxl.h 348 342 :internal: 343 + 344 + .. kernel-doc:: drivers/cxl/core/hdm.c 345 + :doc: cxl core hdm 346 + 347 + .. kernel-doc:: drivers/cxl/core/hdm.c 348 + :identifiers: 349 + 350 + .. kernel-doc:: drivers/cxl/core/cdat.c 351 + :identifiers: 349 352 350 353 .. kernel-doc:: drivers/cxl/core/port.c 351 354 :doc: cxl core
+4 -4
Documentation/kbuild/modules.rst
··· 128 128 129 129 modules_install 130 130 Install the external module(s). The default location is 131 - /lib/modules/<kernel_release>/extra/, but a prefix may 131 + /lib/modules/<kernel_release>/updates/, but a prefix may 132 132 be added with INSTALL_MOD_PATH (discussed in section 5). 133 133 134 134 clean ··· 417 417 418 418 And external modules are installed in: 419 419 420 - /lib/modules/$(KERNELRELEASE)/extra/ 420 + /lib/modules/$(KERNELRELEASE)/updates/ 421 421 422 422 5.1 INSTALL_MOD_PATH 423 423 -------------------- ··· 438 438 ------------------- 439 439 440 440 External modules are by default installed to a directory under 441 - /lib/modules/$(KERNELRELEASE)/extra/, but you may wish to 441 + /lib/modules/$(KERNELRELEASE)/updates/, but you may wish to 442 442 locate modules for a specific functionality in a separate 443 443 directory. For this purpose, use INSTALL_MOD_DIR to specify an 444 - alternative name to "extra.":: 444 + alternative name to "updates.":: 445 445 446 446 $ make INSTALL_MOD_DIR=gandalf -C $KDIR \ 447 447 M=$PWD modules_install
+1
Documentation/userspace-api/ioctl/ioctl-number.rst
··· 186 186 'Q' all linux/soundcard.h 187 187 'R' 00-1F linux/random.h conflict! 188 188 'R' 01 linux/rfkill.h conflict! 189 + 'R' 20-2F linux/trace_mmap.h 189 190 'R' C0-DF net/bluetooth/rfcomm.h 190 191 'R' E0 uapi/linux/fsl_mc.h 191 192 'S' all linux/cdrom.h conflict!
+5 -5
MAINTAINERS
··· 1044 1044 R: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> 1045 1045 L: iommu@lists.linux.dev 1046 1046 S: Maintained 1047 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git 1047 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux.git 1048 1048 F: drivers/iommu/amd/ 1049 1049 F: include/linux/amd-iommu.h 1050 1050 ··· 11157 11157 M: Lu Baolu <baolu.lu@linux.intel.com> 11158 11158 L: iommu@lists.linux.dev 11159 11159 S: Supported 11160 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git 11160 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux.git 11161 11161 F: drivers/iommu/intel/ 11162 11162 11163 11163 INTEL IPU3 CSI-2 CIO2 DRIVER ··· 11530 11530 M: Robin Murphy <robin.murphy@arm.com> 11531 11531 L: iommu@lists.linux.dev 11532 11532 S: Maintained 11533 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git 11533 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux.git 11534 11534 F: drivers/iommu/dma-iommu.c 11535 11535 F: drivers/iommu/dma-iommu.h 11536 11536 F: drivers/iommu/iova.c ··· 11542 11542 R: Robin Murphy <robin.murphy@arm.com> 11543 11543 L: iommu@lists.linux.dev 11544 11544 S: Maintained 11545 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git 11545 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux.git 11546 11546 F: Documentation/devicetree/bindings/iommu/ 11547 11547 F: Documentation/userspace-api/iommu.rst 11548 11548 F: drivers/iommu/ ··· 19324 19324 F: drivers/perf/riscv_pmu_sbi.c 19325 19325 19326 19326 RISC-V THEAD SoC SUPPORT 19327 - M: Jisheng Zhang <jszhang@kernel.org> 19327 + M: Drew Fustini <drew@pdp7.com> 19328 19328 M: Guo Ren <guoren@kernel.org> 19329 19329 M: Fu Wei <wefu@redhat.com> 19330 19330 L: linux-riscv@lists.infradead.org
+1 -1
Makefile
··· 2 2 VERSION = 6 3 3 PATCHLEVEL = 10 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc5 5 + EXTRAVERSION = -rc6 6 6 NAME = Baby Opossum Posse 7 7 8 8 # *DOCUMENTATION*
+1
arch/arm/boot/dts/rockchip/rk3066a.dtsi
··· 128 128 pinctrl-0 = <&hdmii2c_xfer>, <&hdmi_hpd>; 129 129 power-domains = <&power RK3066_PD_VIO>; 130 130 rockchip,grf = <&grf>; 131 + #sound-dai-cells = <0>; 131 132 status = "disabled"; 132 133 133 134 ports {
+13 -5
arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts
··· 5 5 */ 6 6 7 7 /dts-v1/; 8 + 9 + #include <dt-bindings/leds/common.h> 8 10 #include "rk3308.dtsi" 9 11 10 12 / { ··· 26 24 leds { 27 25 compatible = "gpio-leds"; 28 26 pinctrl-names = "default"; 29 - pinctrl-0 = <&green_led_gio>, <&heartbeat_led_gpio>; 27 + pinctrl-0 = <&green_led>, <&heartbeat_led>; 30 28 31 29 green-led { 30 + color = <LED_COLOR_ID_GREEN>; 32 31 default-state = "on"; 32 + function = LED_FUNCTION_POWER; 33 33 gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>; 34 34 label = "rockpis:green:power"; 35 35 linux,default-trigger = "default-on"; 36 36 }; 37 37 38 38 blue-led { 39 + color = <LED_COLOR_ID_BLUE>; 39 40 default-state = "on"; 41 + function = LED_FUNCTION_HEARTBEAT; 40 42 gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>; 41 43 label = "rockpis:blue:user"; 42 44 linux,default-trigger = "heartbeat"; ··· 132 126 }; 133 127 134 128 &emmc { 135 - bus-width = <4>; 136 129 cap-mmc-highspeed; 137 - mmc-hs200-1_8v; 130 + cap-sd-highspeed; 131 + no-sdio; 138 132 non-removable; 133 + pinctrl-names = "default"; 134 + pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd>; 139 135 vmmc-supply = <&vcc_io>; 140 136 status = "okay"; 141 137 }; ··· 222 214 pinctrl-0 = <&rtc_32k>; 223 215 224 216 leds { 225 - green_led_gio: green-led-gpio { 217 + green_led: green-led { 226 218 rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; 227 219 }; 228 220 229 - heartbeat_led_gpio: heartbeat-led-gpio { 221 + heartbeat_led: heartbeat-led { 230 222 rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>; 231 223 }; 232 224 };
+1 -1
arch/arm64/boot/dts/rockchip/rk3308.dtsi
··· 811 811 clocks = <&cru SCLK_I2S2_8CH_TX_OUT>, 812 812 <&cru SCLK_I2S2_8CH_RX_OUT>, 813 813 <&cru PCLK_ACODEC>; 814 - reset-names = "codec-reset"; 814 + reset-names = "codec"; 815 815 resets = <&cru SRST_ACODEC_P>; 816 816 #sound-dai-cells = <0>; 817 817 status = "disabled";
+2 -2
arch/arm64/boot/dts/rockchip/rk3328-rock-pi-e.dts
··· 241 241 rk805: pmic@18 { 242 242 compatible = "rockchip,rk805"; 243 243 reg = <0x18>; 244 - interrupt-parent = <&gpio2>; 245 - interrupts = <6 IRQ_TYPE_LEVEL_LOW>; 244 + interrupt-parent = <&gpio0>; 245 + interrupts = <2 IRQ_TYPE_LEVEL_LOW>; 246 246 #clock-cells = <1>; 247 247 clock-output-names = "xin32k", "rk805-clkout2"; 248 248 gpio-controller;
+3
arch/arm64/boot/dts/rockchip/rk3368.dtsi
··· 793 793 dma-names = "tx"; 794 794 pinctrl-names = "default"; 795 795 pinctrl-0 = <&spdif_tx>; 796 + #sound-dai-cells = <0>; 796 797 status = "disabled"; 797 798 }; 798 799 ··· 805 804 clocks = <&cru SCLK_I2S_2CH>, <&cru HCLK_I2S_2CH>; 806 805 dmas = <&dmac_bus 6>, <&dmac_bus 7>; 807 806 dma-names = "tx", "rx"; 807 + #sound-dai-cells = <0>; 808 808 status = "disabled"; 809 809 }; 810 810 ··· 819 817 dma-names = "tx", "rx"; 820 818 pinctrl-names = "default"; 821 819 pinctrl-0 = <&i2s_8ch_bus>; 820 + #sound-dai-cells = <0>; 822 821 status = "disabled"; 823 822 }; 824 823
+1 -1
arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi
··· 450 450 dlg,btn-cfg = <50>; 451 451 dlg,mic-det-thr = <500>; 452 452 dlg,jack-ins-deb = <20>; 453 - dlg,jack-det-rate = "32ms_64ms"; 453 + dlg,jack-det-rate = "32_64"; 454 454 dlg,jack-rem-deb = <1>; 455 455 456 456 dlg,a-d-btn-thr = <0xa>;
+1 -1
arch/arm64/boot/dts/rockchip/rk3566-quartz64-b.dts
··· 289 289 regulator-name = "vdd_gpu"; 290 290 regulator-always-on; 291 291 regulator-boot-on; 292 - regulator-min-microvolt = <900000>; 292 + regulator-min-microvolt = <500000>; 293 293 regulator-max-microvolt = <1350000>; 294 294 regulator-ramp-delay = <6001>; 295 295
+1
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts
··· 444 444 &sdmmc { 445 445 bus-width = <4>; 446 446 cap-sd-highspeed; 447 + cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>; 447 448 disable-wp; 448 449 max-frequency = <150000000>; 449 450 no-sdio;
+1
arch/arm64/boot/dts/rockchip/rk3588-quartzpro64.dts
··· 435 435 &sdmmc { 436 436 bus-width = <4>; 437 437 cap-sd-highspeed; 438 + cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>; 438 439 disable-wp; 439 440 max-frequency = <150000000>; 440 441 no-sdio;
+1
arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts
··· 383 383 bus-width = <4>; 384 384 cap-mmc-highspeed; 385 385 cap-sd-highspeed; 386 + cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>; 386 387 disable-wp; 387 388 sd-uhs-sdr104; 388 389 vmmc-supply = <&vcc_3v3_s3>;
+5
arch/arm64/boot/dts/rockchip/rk3588-tiger.dtsi
··· 344 344 }; 345 345 }; 346 346 347 + &pwm0 { 348 + pinctrl-0 = <&pwm0m1_pins>; 349 + pinctrl-names = "default"; 350 + }; 351 + 347 352 &saradc { 348 353 vref-supply = <&vcc_1v8_s0>; 349 354 status = "okay";
+2 -2
arch/arm64/boot/dts/rockchip/rk3588s-coolpi-4b.dts
··· 288 288 pinctrl-0 = <&i2c7m0_xfer>; 289 289 status = "okay"; 290 290 291 - es8316: audio-codec@11 { 291 + es8316: audio-codec@10 { 292 292 compatible = "everest,es8316"; 293 - reg = <0x11>; 293 + reg = <0x10>; 294 294 assigned-clocks = <&cru I2S0_8CH_MCLKOUT>; 295 295 assigned-clock-rates = <12288000>; 296 296 clocks = <&cru I2S0_8CH_MCLKOUT>;
+2
arch/arm64/boot/dts/rockchip/rk3588s-rock-5a.dts
··· 366 366 bus-width = <4>; 367 367 cap-mmc-highspeed; 368 368 cap-sd-highspeed; 369 + cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>; 369 370 disable-wp; 370 371 max-frequency = <150000000>; 371 372 no-sdio; ··· 394 393 pinctrl-0 = <&pmic_pins>, <&rk806_dvs1_null>, 395 394 <&rk806_dvs2_null>, <&rk806_dvs3_null>; 396 395 spi-max-frequency = <1000000>; 396 + system-power-controller; 397 397 398 398 vcc1-supply = <&vcc5v0_sys>; 399 399 vcc2-supply = <&vcc5v0_sys>;
+1
arch/arm64/include/asm/pgtable-hwdef.h
··· 170 170 #define PTE_CONT (_AT(pteval_t, 1) << 52) /* Contiguous range */ 171 171 #define PTE_PXN (_AT(pteval_t, 1) << 53) /* Privileged XN */ 172 172 #define PTE_UXN (_AT(pteval_t, 1) << 54) /* User XN */ 173 + #define PTE_SWBITS_MASK _AT(pteval_t, (BIT(63) | GENMASK(58, 55))) 173 174 174 175 #define PTE_ADDR_LOW (((_AT(pteval_t, 1) << (50 - PAGE_SHIFT)) - 1) << PAGE_SHIFT) 175 176 #ifdef CONFIG_ARM64_PA_BITS_52
+1 -1
arch/arm64/include/asm/unistd32.h
··· 840 840 #define __NR_ppoll_time64 414 841 841 __SYSCALL(__NR_ppoll_time64, compat_sys_ppoll_time64) 842 842 #define __NR_io_pgetevents_time64 416 843 - __SYSCALL(__NR_io_pgetevents_time64, sys_io_pgetevents) 843 + __SYSCALL(__NR_io_pgetevents_time64, compat_sys_io_pgetevents_time64) 844 844 #define __NR_recvmmsg_time64 417 845 845 __SYSCALL(__NR_recvmmsg_time64, compat_sys_recvmmsg_time64) 846 846 #define __NR_mq_timedsend_time64 418
+1 -1
arch/arm64/kernel/pi/map_kernel.c
··· 173 173 * Don't bother with the FDT, we no longer need it after this. 174 174 */ 175 175 memset(init_idmap_pg_dir, 0, 176 - (u64)init_idmap_pg_dir - (u64)init_idmap_pg_end); 176 + (u64)init_idmap_pg_end - (u64)init_idmap_pg_dir); 177 177 178 178 create_init_idmap(init_idmap_pg_dir, mask); 179 179 dsb(ishst);
+7 -9
arch/arm64/kernel/syscall.c
··· 53 53 syscall_set_return_value(current, regs, 0, ret); 54 54 55 55 /* 56 - * Ultimately, this value will get limited by KSTACK_OFFSET_MAX(), 57 - * but not enough for arm64 stack utilization comfort. To keep 58 - * reasonable stack head room, reduce the maximum offset to 9 bits. 56 + * This value will get limited by KSTACK_OFFSET_MAX(), which is 10 57 + * bits. The actual entropy will be further reduced by the compiler 58 + * when applying stack alignment constraints: the AAPCS mandates a 59 + * 16-byte aligned SP at function boundaries, which will remove the 60 + * 4 low bits from any entropy chosen here. 59 61 * 60 - * The actual entropy will be further reduced by the compiler when 61 - * applying stack alignment constraints: the AAPCS mandates a 62 - * 16-byte (i.e. 4-bit) aligned SP at function boundaries. 63 - * 64 - * The resulting 5 bits of entropy is seen in SP[8:4]. 62 + * The resulting 6 bits of entropy is seen in SP[9:4]. 65 63 */ 66 - choose_random_kstack_offset(get_random_u16() & 0x1FF); 64 + choose_random_kstack_offset(get_random_u16()); 67 65 } 68 66 69 67 static inline bool has_syscall_work(unsigned long flags)
+2 -1
arch/arm64/mm/mmu.c
··· 124 124 * The following mapping attributes may be updated in live 125 125 * kernel mappings without the need for break-before-make. 126 126 */ 127 - pteval_t mask = PTE_PXN | PTE_RDONLY | PTE_WRITE | PTE_NG; 127 + pteval_t mask = PTE_PXN | PTE_RDONLY | PTE_WRITE | PTE_NG | 128 + PTE_SWBITS_MASK; 128 129 129 130 /* creating or taking down mappings is always safe */ 130 131 if (!pte_valid(__pte(old)) || !pte_valid(__pte(new)))
+1
arch/csky/include/uapi/asm/unistd.h
··· 6 6 #define __ARCH_WANT_SYS_CLONE3 7 7 #define __ARCH_WANT_SET_GET_RLIMIT 8 8 #define __ARCH_WANT_TIME32_SYSCALLS 9 + #define __ARCH_WANT_SYNC_FILE_RANGE2 9 10 #include <asm-generic/unistd.h> 10 11 11 12 #define __NR_set_thread_area (__NR_arch_specific_syscall + 0)
+1 -1
arch/csky/kernel/syscall.c
··· 20 20 unsigned long, prot, 21 21 unsigned long, flags, 22 22 unsigned long, fd, 23 - off_t, offset) 23 + unsigned long, offset) 24 24 { 25 25 if (unlikely(offset & (~PAGE_MASK >> 12))) 26 26 return -EINVAL;
+6
arch/hexagon/include/asm/syscalls.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + 3 + #include <asm-generic/syscalls.h> 4 + 5 + asmlinkage long sys_hexagon_fadvise64_64(int fd, int advice, 6 + u32 a2, u32 a3, u32 a4, u32 a5);
+1
arch/hexagon/include/uapi/asm/unistd.h
··· 36 36 #define __ARCH_WANT_SYS_VFORK 37 37 #define __ARCH_WANT_SYS_FORK 38 38 #define __ARCH_WANT_TIME32_SYSCALLS 39 + #define __ARCH_WANT_SYNC_FILE_RANGE2 39 40 40 41 #include <asm-generic/unistd.h>
+7
arch/hexagon/kernel/syscalltab.c
··· 14 14 #undef __SYSCALL 15 15 #define __SYSCALL(nr, call) [nr] = (call), 16 16 17 + SYSCALL_DEFINE6(hexagon_fadvise64_64, int, fd, int, advice, 18 + SC_ARG64(offset), SC_ARG64(len)) 19 + { 20 + return ksys_fadvise64_64(fd, SC_VAL64(loff_t, offset), SC_VAL64(loff_t, len), advice); 21 + } 22 + #define sys_fadvise64_64 sys_hexagon_fadvise64_64 23 + 17 24 void *sys_call_table[__NR_syscalls] = { 18 25 #include <asm/unistd.h> 19 26 };
+1 -1
arch/loongarch/kernel/syscall.c
··· 22 22 #define __SYSCALL(nr, call) [nr] = (call), 23 23 24 24 SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, unsigned long, 25 - prot, unsigned long, flags, unsigned long, fd, off_t, offset) 25 + prot, unsigned long, flags, unsigned long, fd, unsigned long, offset) 26 26 { 27 27 if (offset & ~PAGE_MASK) 28 28 return -EINVAL;
+1 -1
arch/microblaze/kernel/sys_microblaze.c
··· 35 35 36 36 SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, 37 37 unsigned long, prot, unsigned long, flags, unsigned long, fd, 38 - off_t, pgoff) 38 + unsigned long, pgoff) 39 39 { 40 40 if (pgoff & ~PAGE_MASK) 41 41 return -EINVAL;
+1 -1
arch/mips/kernel/syscalls/syscall_n32.tbl
··· 354 354 412 n32 utimensat_time64 sys_utimensat 355 355 413 n32 pselect6_time64 compat_sys_pselect6_time64 356 356 414 n32 ppoll_time64 compat_sys_ppoll_time64 357 - 416 n32 io_pgetevents_time64 sys_io_pgetevents 357 + 416 n32 io_pgetevents_time64 compat_sys_io_pgetevents_time64 358 358 417 n32 recvmmsg_time64 compat_sys_recvmmsg_time64 359 359 418 n32 mq_timedsend_time64 sys_mq_timedsend 360 360 419 n32 mq_timedreceive_time64 sys_mq_timedreceive
+1 -1
arch/mips/kernel/syscalls/syscall_o32.tbl
··· 403 403 412 o32 utimensat_time64 sys_utimensat sys_utimensat 404 404 413 o32 pselect6_time64 sys_pselect6 compat_sys_pselect6_time64 405 405 414 o32 ppoll_time64 sys_ppoll compat_sys_ppoll_time64 406 - 416 o32 io_pgetevents_time64 sys_io_pgetevents sys_io_pgetevents 406 + 416 o32 io_pgetevents_time64 sys_io_pgetevents compat_sys_io_pgetevents_time64 407 407 417 o32 recvmmsg_time64 sys_recvmmsg compat_sys_recvmmsg_time64 408 408 418 o32 mq_timedsend_time64 sys_mq_timedsend sys_mq_timedsend 409 409 419 o32 mq_timedreceive_time64 sys_mq_timedreceive sys_mq_timedreceive
+1
arch/parisc/Kconfig
··· 16 16 select ARCH_HAS_UBSAN 17 17 select ARCH_HAS_PTE_SPECIAL 18 18 select ARCH_NO_SG_CHAIN 19 + select ARCH_SPLIT_ARG64 if !64BIT 19 20 select ARCH_SUPPORTS_HUGETLBFS if PA20 20 21 select ARCH_SUPPORTS_MEMORY_FAILURE 21 22 select ARCH_STACKWALK
-9
arch/parisc/kernel/sys_parisc32.c
··· 23 23 current->comm, current->pid, r20); 24 24 return -ENOSYS; 25 25 } 26 - 27 - asmlinkage long sys32_fanotify_mark(compat_int_t fanotify_fd, compat_uint_t flags, 28 - compat_uint_t mask0, compat_uint_t mask1, compat_int_t dfd, 29 - const char __user * pathname) 30 - { 31 - return sys_fanotify_mark(fanotify_fd, flags, 32 - ((__u64)mask1 << 32) | mask0, 33 - dfd, pathname); 34 - }
+3 -3
arch/parisc/kernel/syscalls/syscall.tbl
··· 108 108 95 common fchown sys_fchown 109 109 96 common getpriority sys_getpriority 110 110 97 common setpriority sys_setpriority 111 - 98 common recv sys_recv 111 + 98 common recv sys_recv compat_sys_recv 112 112 99 common statfs sys_statfs compat_sys_statfs 113 113 100 common fstatfs sys_fstatfs compat_sys_fstatfs 114 114 101 common stat64 sys_stat64 ··· 135 135 120 common clone sys_clone_wrapper 136 136 121 common setdomainname sys_setdomainname 137 137 122 common sendfile sys_sendfile compat_sys_sendfile 138 - 123 common recvfrom sys_recvfrom 138 + 123 common recvfrom sys_recvfrom compat_sys_recvfrom 139 139 124 32 adjtimex sys_adjtimex_time32 140 140 124 64 adjtimex sys_adjtimex 141 141 125 common mprotect sys_mprotect ··· 364 364 320 common accept4 sys_accept4 365 365 321 common prlimit64 sys_prlimit64 366 366 322 common fanotify_init sys_fanotify_init 367 - 323 common fanotify_mark sys_fanotify_mark sys32_fanotify_mark 367 + 323 common fanotify_mark sys_fanotify_mark compat_sys_fanotify_mark 368 368 324 32 clock_adjtime sys_clock_adjtime32 369 369 324 64 clock_adjtime sys_clock_adjtime 370 370 325 common name_to_handle_at sys_name_to_handle_at
+5 -1
arch/powerpc/kernel/syscalls/syscall.tbl
··· 230 230 178 nospu rt_sigsuspend sys_rt_sigsuspend compat_sys_rt_sigsuspend 231 231 179 32 pread64 sys_ppc_pread64 compat_sys_ppc_pread64 232 232 179 64 pread64 sys_pread64 233 + 179 spu pread64 sys_pread64 233 234 180 32 pwrite64 sys_ppc_pwrite64 compat_sys_ppc_pwrite64 234 235 180 64 pwrite64 sys_pwrite64 236 + 180 spu pwrite64 sys_pwrite64 235 237 181 common chown sys_chown 236 238 182 common getcwd sys_getcwd 237 239 183 common capget sys_capget ··· 248 246 190 common ugetrlimit sys_getrlimit compat_sys_getrlimit 249 247 191 32 readahead sys_ppc_readahead compat_sys_ppc_readahead 250 248 191 64 readahead sys_readahead 249 + 191 spu readahead sys_readahead 251 250 192 32 mmap2 sys_mmap2 compat_sys_mmap2 252 251 193 32 truncate64 sys_ppc_truncate64 compat_sys_ppc_truncate64 253 252 194 32 ftruncate64 sys_ppc_ftruncate64 compat_sys_ppc_ftruncate64 ··· 296 293 232 nospu set_tid_address sys_set_tid_address 297 294 233 32 fadvise64 sys_ppc32_fadvise64 compat_sys_ppc32_fadvise64 298 295 233 64 fadvise64 sys_fadvise64 296 + 233 spu fadvise64 sys_fadvise64 299 297 234 nospu exit_group sys_exit_group 300 298 235 nospu lookup_dcookie sys_ni_syscall 301 299 236 common epoll_create sys_epoll_create ··· 506 502 412 32 utimensat_time64 sys_utimensat sys_utimensat 507 503 413 32 pselect6_time64 sys_pselect6 compat_sys_pselect6_time64 508 504 414 32 ppoll_time64 sys_ppoll compat_sys_ppoll_time64 509 - 416 32 io_pgetevents_time64 sys_io_pgetevents sys_io_pgetevents 505 + 416 32 io_pgetevents_time64 sys_io_pgetevents compat_sys_io_pgetevents_time64 510 506 417 32 recvmmsg_time64 sys_recvmmsg compat_sys_recvmmsg_time64 511 507 418 32 mq_timedsend_time64 sys_mq_timedsend sys_mq_timedsend 512 508 419 32 mq_timedreceive_time64 sys_mq_timedreceive sys_mq_timedreceive
+6 -1
arch/riscv/boot/dts/canaan/canaan_kd233.dts
··· 15 15 model = "Kendryte KD233"; 16 16 compatible = "canaan,kendryte-kd233", "canaan,kendryte-k210"; 17 17 18 + aliases { 19 + serial0 = &uarths0; 20 + }; 21 + 18 22 chosen { 19 23 bootargs = "earlycon console=ttySIF0"; 20 24 stdout-path = "serial0:115200n8"; ··· 50 46 &fpioa { 51 47 pinctrl-0 = <&jtag_pinctrl>; 52 48 pinctrl-names = "default"; 53 - status = "okay"; 54 49 55 50 jtag_pinctrl: jtag-pinmux { 56 51 pinmux = <K210_FPIOA(0, K210_PCF_JTAG_TCLK)>, ··· 121 118 #sound-dai-cells = <1>; 122 119 pinctrl-0 = <&i2s0_pinctrl>; 123 120 pinctrl-names = "default"; 121 + status = "okay"; 124 122 }; 125 123 126 124 &spi0 { ··· 129 125 pinctrl-names = "default"; 130 126 num-cs = <1>; 131 127 cs-gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>; 128 + status = "okay"; 132 129 133 130 panel@0 { 134 131 compatible = "canaan,kd233-tft", "ilitek,ili9341";
+16 -7
arch/riscv/boot/dts/canaan/k210.dtsi
··· 16 16 #size-cells = <1>; 17 17 compatible = "canaan,kendryte-k210"; 18 18 19 - aliases { 20 - serial0 = &uarths0; 21 - serial1 = &uart1; 22 - serial2 = &uart2; 23 - serial3 = &uart3; 24 - }; 25 - 26 19 /* 27 20 * The K210 has an sv39 MMU following the privileged specification v1.9. 28 21 * Since this is a non-ratified draft specification, the kernel does not ··· 130 137 reg = <0x38000000 0x1000>; 131 138 interrupts = <33>; 132 139 clocks = <&sysclk K210_CLK_CPU>; 140 + status = "disabled"; 133 141 }; 134 142 135 143 gpio0: gpio-controller@38001000 { ··· 146 152 <62>, <63>, <64>, <65>; 147 153 gpio-controller; 148 154 ngpios = <32>; 155 + status = "disabled"; 149 156 }; 150 157 151 158 dmac0: dma-controller@50000000 { ··· 182 187 <&sysclk K210_CLK_GPIO>; 183 188 clock-names = "bus", "db"; 184 189 resets = <&sysrst K210_RST_GPIO>; 190 + status = "disabled"; 185 191 186 192 gpio1_0: gpio-port@0 { 187 193 #gpio-cells = <2>; ··· 210 214 dsr-override; 211 215 cts-override; 212 216 ri-override; 217 + status = "disabled"; 213 218 }; 214 219 215 220 uart2: serial@50220000 { ··· 227 230 dsr-override; 228 231 cts-override; 229 232 ri-override; 233 + status = "disabled"; 230 234 }; 231 235 232 236 uart3: serial@50230000 { ··· 244 246 dsr-override; 245 247 cts-override; 246 248 ri-override; 249 + status = "disabled"; 247 250 }; 248 251 249 252 spi2: spi@50240000 { ··· 258 259 <&sysclk K210_CLK_APB0>; 259 260 clock-names = "ssi_clk", "pclk"; 260 261 resets = <&sysrst K210_RST_SPI2>; 262 + status = "disabled"; 261 263 }; 262 264 263 265 i2s0: i2s@50250000 { ··· 268 268 clocks = <&sysclk K210_CLK_I2S0>; 269 269 clock-names = "i2sclk"; 270 270 resets = <&sysrst K210_RST_I2S0>; 271 + status = "disabled"; 271 272 }; 272 273 273 274 i2s1: i2s@50260000 { ··· 278 277 clocks = <&sysclk K210_CLK_I2S1>; 279 278 clock-names = "i2sclk"; 280 279 resets = <&sysrst K210_RST_I2S1>; 280 + status = "disabled"; 281 281 }; 282 282 283 283 i2s2: i2s@50270000 { ··· 288 286 clocks = <&sysclk K210_CLK_I2S2>; 289 287 clock-names = "i2sclk"; 290 288 resets = <&sysrst K210_RST_I2S2>; 289 + status = "disabled"; 291 290 }; 292 291 293 292 i2c0: i2c@50280000 { ··· 299 296 <&sysclk K210_CLK_APB0>; 300 297 clock-names = "ref", "pclk"; 301 298 resets = <&sysrst K210_RST_I2C0>; 299 + status = "disabled"; 302 300 }; 303 301 304 302 i2c1: i2c@50290000 { ··· 310 306 <&sysclk K210_CLK_APB0>; 311 307 clock-names = "ref", "pclk"; 312 308 resets = <&sysrst K210_RST_I2C1>; 309 + status = "disabled"; 313 310 }; 314 311 315 312 i2c2: i2c@502a0000 { ··· 321 316 <&sysclk K210_CLK_APB0>; 322 317 clock-names = "ref", "pclk"; 323 318 resets = <&sysrst K210_RST_I2C2>; 319 + status = "disabled"; 324 320 }; 325 321 326 322 fpioa: pinmux@502b0000 { ··· 470 464 reset-names = "spi"; 471 465 num-cs = <4>; 472 466 reg-io-width = <4>; 467 + status = "disabled"; 473 468 }; 474 469 475 470 spi1: spi@53000000 { ··· 486 479 reset-names = "spi"; 487 480 num-cs = <4>; 488 481 reg-io-width = <4>; 482 + status = "disabled"; 489 483 }; 490 484 491 485 spi3: spi@54000000 { ··· 503 495 504 496 num-cs = <4>; 505 497 reg-io-width = <4>; 498 + status = "disabled"; 506 499 }; 507 500 }; 508 501 };
+4 -1
arch/riscv/boot/dts/canaan/k210_generic.dts
··· 15 15 model = "Kendryte K210 generic"; 16 16 compatible = "canaan,kendryte-k210"; 17 17 18 + aliases { 19 + serial0 = &uarths0; 20 + }; 21 + 18 22 chosen { 19 23 bootargs = "earlycon console=ttySIF0"; 20 24 stdout-path = "serial0:115200n8"; ··· 28 24 &fpioa { 29 25 pinctrl-0 = <&jtag_pins>; 30 26 pinctrl-names = "default"; 31 - status = "okay"; 32 27 33 28 jtag_pins: jtag-pinmux { 34 29 pinmux = <K210_FPIOA(0, K210_PCF_JTAG_TCLK)>,
+8 -1
arch/riscv/boot/dts/canaan/sipeed_maix_bit.dts
··· 17 17 compatible = "sipeed,maix-bit", "sipeed,maix-bitm", 18 18 "canaan,kendryte-k210"; 19 19 20 + aliases { 21 + serial0 = &uarths0; 22 + }; 23 + 20 24 chosen { 21 25 bootargs = "earlycon console=ttySIF0"; 22 26 stdout-path = "serial0:115200n8"; ··· 62 58 &fpioa { 63 59 pinctrl-names = "default"; 64 60 pinctrl-0 = <&jtag_pinctrl>; 65 - status = "okay"; 66 61 67 62 jtag_pinctrl: jtag-pinmux { 68 63 pinmux = <K210_FPIOA(0, K210_PCF_JTAG_TCLK)>, ··· 159 156 #sound-dai-cells = <1>; 160 157 pinctrl-0 = <&i2s0_pinctrl>; 161 158 pinctrl-names = "default"; 159 + status = "okay"; 162 160 }; 163 161 164 162 &i2c1 { ··· 174 170 pinctrl-names = "default"; 175 171 num-cs = <1>; 176 172 cs-gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>; 173 + status = "okay"; 177 174 178 175 panel@0 { 179 176 compatible = "sitronix,st7789v"; ··· 204 199 }; 205 200 206 201 &spi3 { 202 + status = "okay"; 203 + 207 204 flash@0 { 208 205 compatible = "jedec,spi-nor"; 209 206 reg = <0>;
+6 -1
arch/riscv/boot/dts/canaan/sipeed_maix_dock.dts
··· 17 17 compatible = "sipeed,maix-dock-m1", "sipeed,maix-dock-m1w", 18 18 "canaan,kendryte-k210"; 19 19 20 + aliases { 21 + serial0 = &uarths0; 22 + }; 23 + 20 24 chosen { 21 25 bootargs = "earlycon console=ttySIF0"; 22 26 stdout-path = "serial0:115200n8"; ··· 67 63 &fpioa { 68 64 pinctrl-0 = <&jtag_pinctrl>; 69 65 pinctrl-names = "default"; 70 - status = "okay"; 71 66 72 67 jtag_pinctrl: jtag-pinmux { 73 68 pinmux = <K210_FPIOA(0, K210_PCF_JTAG_TCLK)>, ··· 162 159 #sound-dai-cells = <1>; 163 160 pinctrl-0 = <&i2s0_pinctrl>; 164 161 pinctrl-names = "default"; 162 + status = "okay"; 165 163 }; 166 164 167 165 &i2c1 { ··· 177 173 pinctrl-names = "default"; 178 174 num-cs = <1>; 179 175 cs-gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>; 176 + status = "okay"; 180 177 181 178 panel@0 { 182 179 compatible = "sitronix,st7789v";
+8 -1
arch/riscv/boot/dts/canaan/sipeed_maix_go.dts
··· 16 16 model = "SiPeed MAIX GO"; 17 17 compatible = "sipeed,maix-go", "canaan,kendryte-k210"; 18 18 19 + aliases { 20 + serial0 = &uarths0; 21 + }; 22 + 19 23 chosen { 20 24 bootargs = "earlycon console=ttySIF0"; 21 25 stdout-path = "serial0:115200n8"; ··· 73 69 &fpioa { 74 70 pinctrl-0 = <&jtag_pinctrl>; 75 71 pinctrl-names = "default"; 76 - status = "okay"; 77 72 78 73 jtag_pinctrl: jtag-pinmux { 79 74 pinmux = <K210_FPIOA(0, K210_PCF_JTAG_TCLK)>, ··· 170 167 #sound-dai-cells = <1>; 171 168 pinctrl-0 = <&i2s0_pinctrl>; 172 169 pinctrl-names = "default"; 170 + status = "okay"; 173 171 }; 174 172 175 173 &i2c1 { ··· 185 181 pinctrl-names = "default"; 186 182 num-cs = <1>; 187 183 cs-gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>; 184 + status = "okay"; 188 185 189 186 panel@0 { 190 187 compatible = "sitronix,st7789v"; ··· 214 209 }; 215 210 216 211 &spi3 { 212 + status = "okay"; 213 + 217 214 flash@0 { 218 215 compatible = "jedec,spi-nor"; 219 216 reg = <0>;
+8 -2
arch/riscv/boot/dts/canaan/sipeed_maixduino.dts
··· 15 15 model = "SiPeed MAIXDUINO"; 16 16 compatible = "sipeed,maixduino", "canaan,kendryte-k210"; 17 17 18 + aliases { 19 + serial0 = &uarths0; 20 + }; 21 + 18 22 chosen { 19 23 bootargs = "earlycon console=ttySIF0"; 20 24 stdout-path = "serial0:115200n8"; ··· 43 39 }; 44 40 45 41 &fpioa { 46 - status = "okay"; 47 - 48 42 uarths_pinctrl: uarths-pinmux { 49 43 pinmux = <K210_FPIOA(4, K210_PCF_UARTHS_RX)>, /* Header "0" */ 50 44 <K210_FPIOA(5, K210_PCF_UARTHS_TX)>; /* Header "1" */ ··· 134 132 #sound-dai-cells = <1>; 135 133 pinctrl-0 = <&i2s0_pinctrl>; 136 134 pinctrl-names = "default"; 135 + status = "okay"; 137 136 }; 138 137 139 138 &i2c1 { ··· 149 146 pinctrl-names = "default"; 150 147 num-cs = <1>; 151 148 cs-gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>; 149 + status = "okay"; 152 150 153 151 panel@0 { 154 152 compatible = "sitronix,st7789v"; ··· 178 174 }; 179 175 180 176 &spi3 { 177 + status = "okay"; 178 + 181 179 flash@0 { 182 180 compatible = "jedec,spi-nor"; 183 181 reg = <0>;
+1 -1
arch/riscv/boot/dts/starfive/jh7110-common.dtsi
··· 244 244 regulator-boot-on; 245 245 regulator-always-on; 246 246 regulator-min-microvolt = <1800000>; 247 - regulator-max-microvolt = <1800000>; 247 + regulator-max-microvolt = <3300000>; 248 248 regulator-name = "emmc_vdd"; 249 249 }; 250 250 };
+1 -1
arch/riscv/include/asm/insn.h
··· 145 145 146 146 /* parts of opcode for RVF, RVD and RVQ */ 147 147 #define RVFDQ_FL_FS_WIDTH_OFF 12 148 - #define RVFDQ_FL_FS_WIDTH_MASK GENMASK(3, 0) 148 + #define RVFDQ_FL_FS_WIDTH_MASK GENMASK(2, 0) 149 149 #define RVFDQ_FL_FS_WIDTH_W 2 150 150 #define RVFDQ_FL_FS_WIDTH_D 3 151 151 #define RVFDQ_LS_FS_WIDTH_Q 4
+2 -5
arch/riscv/kernel/ftrace.c
··· 120 120 out = ftrace_make_nop(mod, rec, MCOUNT_ADDR); 121 121 mutex_unlock(&text_mutex); 122 122 123 - if (!mod) 124 - local_flush_icache_range(rec->ip, rec->ip + MCOUNT_INSN_SIZE); 125 - 126 123 return out; 127 124 } 128 125 ··· 153 156 } else { 154 157 while (atomic_read(&param->cpu_count) <= num_online_cpus()) 155 158 cpu_relax(); 156 - } 157 159 158 - local_flush_icache_all(); 160 + local_flush_icache_all(); 161 + } 159 162 160 163 return 0; 161 164 }
+18 -8
arch/riscv/kernel/patch.c
··· 89 89 90 90 memset(waddr, c, len); 91 91 92 + /* 93 + * We could have just patched a function that is about to be 94 + * called so make sure we don't execute partially patched 95 + * instructions by flushing the icache as soon as possible. 96 + */ 97 + local_flush_icache_range((unsigned long)waddr, 98 + (unsigned long)waddr + len); 99 + 92 100 patch_unmap(FIX_TEXT_POKE0); 93 101 94 102 if (across_pages) ··· 142 134 waddr = patch_map(addr, FIX_TEXT_POKE0); 143 135 144 136 ret = copy_to_kernel_nofault(waddr, insn, len); 137 + 138 + /* 139 + * We could have just patched a function that is about to be 140 + * called so make sure we don't execute partially patched 141 + * instructions by flushing the icache as soon as possible. 142 + */ 143 + local_flush_icache_range((unsigned long)waddr, 144 + (unsigned long)waddr + len); 145 145 146 146 patch_unmap(FIX_TEXT_POKE0); 147 147 ··· 205 189 206 190 ret = patch_insn_set(tp, c, len); 207 191 208 - if (!ret) 209 - flush_icache_range((uintptr_t)tp, (uintptr_t)tp + len); 210 - 211 192 return ret; 212 193 } 213 194 NOKPROBE_SYMBOL(patch_text_set_nosync); ··· 237 224 238 225 ret = patch_insn_write(tp, insns, len); 239 226 240 - if (!ret) 241 - flush_icache_range((uintptr_t) tp, (uintptr_t) tp + len); 242 - 243 227 return ret; 244 228 } 245 229 NOKPROBE_SYMBOL(patch_text_nosync); ··· 263 253 } else { 264 254 while (atomic_read(&patch->cpu_count) <= num_online_cpus()) 265 255 cpu_relax(); 266 - } 267 256 268 - local_flush_icache_all(); 257 + local_flush_icache_all(); 258 + } 269 259 270 260 return ret; 271 261 }
+1 -1
arch/riscv/kernel/stacktrace.c
··· 156 156 return pc; 157 157 } 158 158 159 - noinline void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie, 159 + noinline noinstr void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie, 160 160 struct task_struct *task, struct pt_regs *regs) 161 161 { 162 162 walk_stackframe(task, regs, consume_entry, cookie);
+2 -2
arch/riscv/kernel/sys_riscv.c
··· 23 23 #ifdef CONFIG_64BIT 24 24 SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, 25 25 unsigned long, prot, unsigned long, flags, 26 - unsigned long, fd, off_t, offset) 26 + unsigned long, fd, unsigned long, offset) 27 27 { 28 28 return riscv_sys_mmap(addr, len, prot, flags, fd, offset, 0); 29 29 } ··· 32 32 #if defined(CONFIG_32BIT) || defined(CONFIG_COMPAT) 33 33 SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len, 34 34 unsigned long, prot, unsigned long, flags, 35 - unsigned long, fd, off_t, offset) 35 + unsigned long, fd, unsigned long, offset) 36 36 { 37 37 /* 38 38 * Note that the shift for mmap2 is constant (12),
+7 -4
arch/s390/boot/startup.c
··· 170 170 u64 *entry; 171 171 172 172 /* 173 - * Even without -fPIE, Clang still uses a global offset table for some 174 - * reason. Adjust the GOT entries. 173 + * Adjust GOT entries, except for ones for undefined weak symbols 174 + * that resolved to zero. This also skips the first three reserved 175 + * entries on s390x that are zero. 175 176 */ 176 - for (entry = (u64 *)vmlinux.got_start; entry < (u64 *)vmlinux.got_end; entry++) 177 - *entry += offset - __START_KERNEL; 177 + for (entry = (u64 *)vmlinux.got_start; entry < (u64 *)vmlinux.got_end; entry++) { 178 + if (*entry) 179 + *entry += offset - __START_KERNEL; 180 + } 178 181 } 179 182 180 183 /*
+2 -3
arch/s390/configs/debug_defconfig
··· 601 601 CONFIG_WATCHDOG_NOWAYOUT=y 602 602 CONFIG_SOFT_WATCHDOG=m 603 603 CONFIG_DIAG288_WATCHDOG=m 604 + CONFIG_DRM=m 605 + CONFIG_DRM_VIRTIO_GPU=m 604 606 CONFIG_FB=y 605 607 # CONFIG_FB_DEVICE is not set 606 - CONFIG_FRAMEBUFFER_CONSOLE=y 607 - CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y 608 608 # CONFIG_HID_SUPPORT is not set 609 609 # CONFIG_USB_SUPPORT is not set 610 610 CONFIG_INFINIBAND=m 611 611 CONFIG_INFINIBAND_USER_ACCESS=m 612 612 CONFIG_MLX4_INFINIBAND=m 613 613 CONFIG_MLX5_INFINIBAND=m 614 - CONFIG_SYNC_FILE=y 615 614 CONFIG_VFIO=m 616 615 CONFIG_VFIO_PCI=m 617 616 CONFIG_MLX5_VFIO_PCI=m
+2 -3
arch/s390/configs/defconfig
··· 592 592 CONFIG_WATCHDOG_NOWAYOUT=y 593 593 CONFIG_SOFT_WATCHDOG=m 594 594 CONFIG_DIAG288_WATCHDOG=m 595 + CONFIG_DRM=m 596 + CONFIG_DRM_VIRTIO_GPU=m 595 597 CONFIG_FB=y 596 598 # CONFIG_FB_DEVICE is not set 597 - CONFIG_FRAMEBUFFER_CONSOLE=y 598 - CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y 599 599 # CONFIG_HID_SUPPORT is not set 600 600 # CONFIG_USB_SUPPORT is not set 601 601 CONFIG_INFINIBAND=m 602 602 CONFIG_INFINIBAND_USER_ACCESS=m 603 603 CONFIG_MLX4_INFINIBAND=m 604 604 CONFIG_MLX5_INFINIBAND=m 605 - CONFIG_SYNC_FILE=y 606 605 CONFIG_VFIO=m 607 606 CONFIG_VFIO_PCI=m 608 607 CONFIG_MLX5_VFIO_PCI=m
+1 -1
arch/s390/include/asm/entry-common.h
··· 54 54 static inline void arch_exit_to_user_mode_prepare(struct pt_regs *regs, 55 55 unsigned long ti_work) 56 56 { 57 - choose_random_kstack_offset(get_tod_clock_fast() & 0xff); 57 + choose_random_kstack_offset(get_tod_clock_fast()); 58 58 } 59 59 60 60 #define arch_exit_to_user_mode_prepare arch_exit_to_user_mode_prepare
-27
arch/s390/kernel/syscall.c
··· 38 38 39 39 #include "entry.h" 40 40 41 - /* 42 - * Perform the mmap() system call. Linux for S/390 isn't able to handle more 43 - * than 5 system call parameters, so this system call uses a memory block 44 - * for parameter passing. 45 - */ 46 - 47 - struct s390_mmap_arg_struct { 48 - unsigned long addr; 49 - unsigned long len; 50 - unsigned long prot; 51 - unsigned long flags; 52 - unsigned long fd; 53 - unsigned long offset; 54 - }; 55 - 56 - SYSCALL_DEFINE1(mmap2, struct s390_mmap_arg_struct __user *, arg) 57 - { 58 - struct s390_mmap_arg_struct a; 59 - int error = -EFAULT; 60 - 61 - if (copy_from_user(&a, arg, sizeof(a))) 62 - goto out; 63 - error = ksys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); 64 - out: 65 - return error; 66 - } 67 - 68 41 #ifdef CONFIG_SYSVIPC 69 42 /* 70 43 * sys_ipc() is the de-multiplexer for the SysV IPC calls.
+1 -1
arch/s390/kernel/syscalls/syscall.tbl
··· 418 418 412 32 utimensat_time64 - sys_utimensat 419 419 413 32 pselect6_time64 - compat_sys_pselect6_time64 420 420 414 32 ppoll_time64 - compat_sys_ppoll_time64 421 - 416 32 io_pgetevents_time64 - sys_io_pgetevents 421 + 416 32 io_pgetevents_time64 - compat_sys_io_pgetevents_time64 422 422 417 32 recvmmsg_time64 - compat_sys_recvmmsg_time64 423 423 418 32 mq_timedsend_time64 - sys_mq_timedsend 424 424 419 32 mq_timedreceive_time64 - sys_mq_timedreceive
+1 -1
arch/s390/pci/pci_irq.c
··· 410 410 union zpci_sic_iib iib = {{0}}; 411 411 union zpci_sic_iib ziib = {{0}}; 412 412 413 - iib.cdiib.dibv_addr = (u64) zpci_ibv[smp_processor_id()]->vector; 413 + iib.cdiib.dibv_addr = virt_to_phys(zpci_ibv[smp_processor_id()]->vector); 414 414 415 415 zpci_set_irq_ctrl(SIC_IRQ_MODE_SET_CPU, 0, &iib); 416 416 zpci_set_irq_ctrl(SIC_IRQ_MODE_D_SINGLE, PCI_ISC, &ziib);
+11
arch/sh/kernel/sys_sh32.c
··· 59 59 (u64)len0 << 32 | len1, advice); 60 60 #endif 61 61 } 62 + 63 + /* 64 + * swap the arguments the way that libc wants them instead of 65 + * moving flags ahead of the 64-bit nbytes argument 66 + */ 67 + SYSCALL_DEFINE6(sh_sync_file_range6, int, fd, SC_ARG64(offset), 68 + SC_ARG64(nbytes), unsigned int, flags) 69 + { 70 + return ksys_sync_file_range(fd, SC_VAL64(loff_t, offset), 71 + SC_VAL64(loff_t, nbytes), flags); 72 + }
+2 -1
arch/sh/kernel/syscalls/syscall.tbl
··· 321 321 311 common set_robust_list sys_set_robust_list 322 322 312 common get_robust_list sys_get_robust_list 323 323 313 common splice sys_splice 324 - 314 common sync_file_range sys_sync_file_range 324 + 314 common sync_file_range sys_sh_sync_file_range6 325 325 315 common tee sys_tee 326 326 316 common vmsplice sys_vmsplice 327 327 317 common move_pages sys_move_pages ··· 395 395 385 common pkey_alloc sys_pkey_alloc 396 396 386 common pkey_free sys_pkey_free 397 397 387 common rseq sys_rseq 398 + 388 common sync_file_range2 sys_sync_file_range2 398 399 # room for arch specific syscalls 399 400 393 common semget sys_semget 400 401 394 common semctl sys_semctl
-221
arch/sparc/kernel/sys32.S
··· 18 18 sethi %hi(sys_mmap), %g1 19 19 jmpl %g1 + %lo(sys_mmap), %g0 20 20 sllx %o5, 12, %o5 21 - 22 - .align 32 23 - .globl sys32_socketcall 24 - sys32_socketcall: /* %o0=call, %o1=args */ 25 - cmp %o0, 1 26 - bl,pn %xcc, do_einval 27 - cmp %o0, 18 28 - bg,pn %xcc, do_einval 29 - sub %o0, 1, %o0 30 - sllx %o0, 5, %o0 31 - sethi %hi(__socketcall_table_begin), %g2 32 - or %g2, %lo(__socketcall_table_begin), %g2 33 - jmpl %g2 + %o0, %g0 34 - nop 35 - do_einval: 36 - retl 37 - mov -EINVAL, %o0 38 - 39 - .align 32 40 - __socketcall_table_begin: 41 - 42 - /* Each entry is exactly 32 bytes. */ 43 - do_sys_socket: /* sys_socket(int, int, int) */ 44 - 1: ldswa [%o1 + 0x0] %asi, %o0 45 - sethi %hi(sys_socket), %g1 46 - 2: ldswa [%o1 + 0x8] %asi, %o2 47 - jmpl %g1 + %lo(sys_socket), %g0 48 - 3: ldswa [%o1 + 0x4] %asi, %o1 49 - nop 50 - nop 51 - nop 52 - do_sys_bind: /* sys_bind(int fd, struct sockaddr *, int) */ 53 - 4: ldswa [%o1 + 0x0] %asi, %o0 54 - sethi %hi(sys_bind), %g1 55 - 5: ldswa [%o1 + 0x8] %asi, %o2 56 - jmpl %g1 + %lo(sys_bind), %g0 57 - 6: lduwa [%o1 + 0x4] %asi, %o1 58 - nop 59 - nop 60 - nop 61 - do_sys_connect: /* sys_connect(int, struct sockaddr *, int) */ 62 - 7: ldswa [%o1 + 0x0] %asi, %o0 63 - sethi %hi(sys_connect), %g1 64 - 8: ldswa [%o1 + 0x8] %asi, %o2 65 - jmpl %g1 + %lo(sys_connect), %g0 66 - 9: lduwa [%o1 + 0x4] %asi, %o1 67 - nop 68 - nop 69 - nop 70 - do_sys_listen: /* sys_listen(int, int) */ 71 - 10: ldswa [%o1 + 0x0] %asi, %o0 72 - sethi %hi(sys_listen), %g1 73 - jmpl %g1 + %lo(sys_listen), %g0 74 - 11: ldswa [%o1 + 0x4] %asi, %o1 75 - nop 76 - nop 77 - nop 78 - nop 79 - do_sys_accept: /* sys_accept(int, struct sockaddr *, int *) */ 80 - 12: ldswa [%o1 + 0x0] %asi, %o0 81 - sethi %hi(sys_accept), %g1 82 - 13: lduwa [%o1 + 0x8] %asi, %o2 83 - jmpl %g1 + %lo(sys_accept), %g0 84 - 14: lduwa [%o1 + 0x4] %asi, %o1 85 - nop 86 - nop 87 - nop 88 - do_sys_getsockname: /* sys_getsockname(int, struct sockaddr *, int *) */ 89 - 15: ldswa [%o1 + 0x0] %asi, %o0 90 - sethi %hi(sys_getsockname), %g1 91 - 16: lduwa [%o1 + 0x8] %asi, %o2 92 - jmpl %g1 + %lo(sys_getsockname), %g0 93 - 17: lduwa [%o1 + 0x4] %asi, %o1 94 - nop 95 - nop 96 - nop 97 - do_sys_getpeername: /* sys_getpeername(int, struct sockaddr *, int *) */ 98 - 18: ldswa [%o1 + 0x0] %asi, %o0 99 - sethi %hi(sys_getpeername), %g1 100 - 19: lduwa [%o1 + 0x8] %asi, %o2 101 - jmpl %g1 + %lo(sys_getpeername), %g0 102 - 20: lduwa [%o1 + 0x4] %asi, %o1 103 - nop 104 - nop 105 - nop 106 - do_sys_socketpair: /* sys_socketpair(int, int, int, int *) */ 107 - 21: ldswa [%o1 + 0x0] %asi, %o0 108 - sethi %hi(sys_socketpair), %g1 109 - 22: ldswa [%o1 + 0x8] %asi, %o2 110 - 23: lduwa [%o1 + 0xc] %asi, %o3 111 - jmpl %g1 + %lo(sys_socketpair), %g0 112 - 24: ldswa [%o1 + 0x4] %asi, %o1 113 - nop 114 - nop 115 - do_sys_send: /* sys_send(int, void *, size_t, unsigned int) */ 116 - 25: ldswa [%o1 + 0x0] %asi, %o0 117 - sethi %hi(sys_send), %g1 118 - 26: lduwa [%o1 + 0x8] %asi, %o2 119 - 27: lduwa [%o1 + 0xc] %asi, %o3 120 - jmpl %g1 + %lo(sys_send), %g0 121 - 28: lduwa [%o1 + 0x4] %asi, %o1 122 - nop 123 - nop 124 - do_sys_recv: /* sys_recv(int, void *, size_t, unsigned int) */ 125 - 29: ldswa [%o1 + 0x0] %asi, %o0 126 - sethi %hi(sys_recv), %g1 127 - 30: lduwa [%o1 + 0x8] %asi, %o2 128 - 31: lduwa [%o1 + 0xc] %asi, %o3 129 - jmpl %g1 + %lo(sys_recv), %g0 130 - 32: lduwa [%o1 + 0x4] %asi, %o1 131 - nop 132 - nop 133 - do_sys_sendto: /* sys_sendto(int, u32, compat_size_t, unsigned int, u32, int) */ 134 - 33: ldswa [%o1 + 0x0] %asi, %o0 135 - sethi %hi(sys_sendto), %g1 136 - 34: lduwa [%o1 + 0x8] %asi, %o2 137 - 35: lduwa [%o1 + 0xc] %asi, %o3 138 - 36: lduwa [%o1 + 0x10] %asi, %o4 139 - 37: ldswa [%o1 + 0x14] %asi, %o5 140 - jmpl %g1 + %lo(sys_sendto), %g0 141 - 38: lduwa [%o1 + 0x4] %asi, %o1 142 - do_sys_recvfrom: /* sys_recvfrom(int, u32, compat_size_t, unsigned int, u32, u32) */ 143 - 39: ldswa [%o1 + 0x0] %asi, %o0 144 - sethi %hi(sys_recvfrom), %g1 145 - 40: lduwa [%o1 + 0x8] %asi, %o2 146 - 41: lduwa [%o1 + 0xc] %asi, %o3 147 - 42: lduwa [%o1 + 0x10] %asi, %o4 148 - 43: lduwa [%o1 + 0x14] %asi, %o5 149 - jmpl %g1 + %lo(sys_recvfrom), %g0 150 - 44: lduwa [%o1 + 0x4] %asi, %o1 151 - do_sys_shutdown: /* sys_shutdown(int, int) */ 152 - 45: ldswa [%o1 + 0x0] %asi, %o0 153 - sethi %hi(sys_shutdown), %g1 154 - jmpl %g1 + %lo(sys_shutdown), %g0 155 - 46: ldswa [%o1 + 0x4] %asi, %o1 156 - nop 157 - nop 158 - nop 159 - nop 160 - do_sys_setsockopt: /* sys_setsockopt(int, int, int, char *, int) */ 161 - 47: ldswa [%o1 + 0x0] %asi, %o0 162 - sethi %hi(sys_setsockopt), %g1 163 - 48: ldswa [%o1 + 0x8] %asi, %o2 164 - 49: lduwa [%o1 + 0xc] %asi, %o3 165 - 50: ldswa [%o1 + 0x10] %asi, %o4 166 - jmpl %g1 + %lo(sys_setsockopt), %g0 167 - 51: ldswa [%o1 + 0x4] %asi, %o1 168 - nop 169 - do_sys_getsockopt: /* sys_getsockopt(int, int, int, u32, u32) */ 170 - 52: ldswa [%o1 + 0x0] %asi, %o0 171 - sethi %hi(sys_getsockopt), %g1 172 - 53: ldswa [%o1 + 0x8] %asi, %o2 173 - 54: lduwa [%o1 + 0xc] %asi, %o3 174 - 55: lduwa [%o1 + 0x10] %asi, %o4 175 - jmpl %g1 + %lo(sys_getsockopt), %g0 176 - 56: ldswa [%o1 + 0x4] %asi, %o1 177 - nop 178 - do_sys_sendmsg: /* compat_sys_sendmsg(int, struct compat_msghdr *, unsigned int) */ 179 - 57: ldswa [%o1 + 0x0] %asi, %o0 180 - sethi %hi(compat_sys_sendmsg), %g1 181 - 58: lduwa [%o1 + 0x8] %asi, %o2 182 - jmpl %g1 + %lo(compat_sys_sendmsg), %g0 183 - 59: lduwa [%o1 + 0x4] %asi, %o1 184 - nop 185 - nop 186 - nop 187 - do_sys_recvmsg: /* compat_sys_recvmsg(int, struct compat_msghdr *, unsigned int) */ 188 - 60: ldswa [%o1 + 0x0] %asi, %o0 189 - sethi %hi(compat_sys_recvmsg), %g1 190 - 61: lduwa [%o1 + 0x8] %asi, %o2 191 - jmpl %g1 + %lo(compat_sys_recvmsg), %g0 192 - 62: lduwa [%o1 + 0x4] %asi, %o1 193 - nop 194 - nop 195 - nop 196 - do_sys_accept4: /* sys_accept4(int, struct sockaddr *, int *, int) */ 197 - 63: ldswa [%o1 + 0x0] %asi, %o0 198 - sethi %hi(sys_accept4), %g1 199 - 64: lduwa [%o1 + 0x8] %asi, %o2 200 - 65: ldswa [%o1 + 0xc] %asi, %o3 201 - jmpl %g1 + %lo(sys_accept4), %g0 202 - 66: lduwa [%o1 + 0x4] %asi, %o1 203 - nop 204 - nop 205 - 206 - .section __ex_table,"a" 207 - .align 4 208 - .word 1b, __retl_efault, 2b, __retl_efault 209 - .word 3b, __retl_efault, 4b, __retl_efault 210 - .word 5b, __retl_efault, 6b, __retl_efault 211 - .word 7b, __retl_efault, 8b, __retl_efault 212 - .word 9b, __retl_efault, 10b, __retl_efault 213 - .word 11b, __retl_efault, 12b, __retl_efault 214 - .word 13b, __retl_efault, 14b, __retl_efault 215 - .word 15b, __retl_efault, 16b, __retl_efault 216 - .word 17b, __retl_efault, 18b, __retl_efault 217 - .word 19b, __retl_efault, 20b, __retl_efault 218 - .word 21b, __retl_efault, 22b, __retl_efault 219 - .word 23b, __retl_efault, 24b, __retl_efault 220 - .word 25b, __retl_efault, 26b, __retl_efault 221 - .word 27b, __retl_efault, 28b, __retl_efault 222 - .word 29b, __retl_efault, 30b, __retl_efault 223 - .word 31b, __retl_efault, 32b, __retl_efault 224 - .word 33b, __retl_efault, 34b, __retl_efault 225 - .word 35b, __retl_efault, 36b, __retl_efault 226 - .word 37b, __retl_efault, 38b, __retl_efault 227 - .word 39b, __retl_efault, 40b, __retl_efault 228 - .word 41b, __retl_efault, 42b, __retl_efault 229 - .word 43b, __retl_efault, 44b, __retl_efault 230 - .word 45b, __retl_efault, 46b, __retl_efault 231 - .word 47b, __retl_efault, 48b, __retl_efault 232 - .word 49b, __retl_efault, 50b, __retl_efault 233 - .word 51b, __retl_efault, 52b, __retl_efault 234 - .word 53b, __retl_efault, 54b, __retl_efault 235 - .word 55b, __retl_efault, 56b, __retl_efault 236 - .word 57b, __retl_efault, 58b, __retl_efault 237 - .word 59b, __retl_efault, 60b, __retl_efault 238 - .word 61b, __retl_efault, 62b, __retl_efault 239 - .word 63b, __retl_efault, 64b, __retl_efault 240 - .word 65b, __retl_efault, 66b, __retl_efault 241 - .previous
+4 -4
arch/sparc/kernel/syscalls/syscall.tbl
··· 117 117 90 common dup2 sys_dup2 118 118 91 32 setfsuid32 sys_setfsuid 119 119 92 common fcntl sys_fcntl compat_sys_fcntl 120 - 93 common select sys_select 120 + 93 common select sys_select compat_sys_select 121 121 94 32 setfsgid32 sys_setfsgid 122 122 95 common fsync sys_fsync 123 123 96 common setpriority sys_setpriority ··· 155 155 123 32 fchown sys_fchown16 156 156 123 64 fchown sys_fchown 157 157 124 common fchmod sys_fchmod 158 - 125 common recvfrom sys_recvfrom 158 + 125 common recvfrom sys_recvfrom compat_sys_recvfrom 159 159 126 32 setreuid sys_setreuid16 160 160 126 64 setreuid sys_setreuid 161 161 127 32 setregid sys_setregid16 ··· 247 247 204 32 readdir sys_old_readdir compat_sys_old_readdir 248 248 204 64 readdir sys_nis_syscall 249 249 205 common readahead sys_readahead compat_sys_readahead 250 - 206 common socketcall sys_socketcall sys32_socketcall 250 + 206 common socketcall sys_socketcall compat_sys_socketcall 251 251 207 common syslog sys_syslog 252 252 208 common lookup_dcookie sys_ni_syscall 253 253 209 common fadvise64 sys_fadvise64 compat_sys_fadvise64 ··· 461 461 412 32 utimensat_time64 sys_utimensat sys_utimensat 462 462 413 32 pselect6_time64 sys_pselect6 compat_sys_pselect6_time64 463 463 414 32 ppoll_time64 sys_ppoll compat_sys_ppoll_time64 464 - 416 32 io_pgetevents_time64 sys_io_pgetevents sys_io_pgetevents 464 + 416 32 io_pgetevents_time64 sys_io_pgetevents compat_sys_io_pgetevents_time64 465 465 417 32 recvmmsg_time64 sys_recvmmsg compat_sys_recvmmsg_time64 466 466 418 32 mq_timedsend_time64 sys_mq_timedsend sys_mq_timedsend 467 467 419 32 mq_timedreceive_time64 sys_mq_timedreceive sys_mq_timedreceive
+1 -1
arch/x86/entry/syscalls/syscall_32.tbl
··· 420 420 412 i386 utimensat_time64 sys_utimensat 421 421 413 i386 pselect6_time64 sys_pselect6 compat_sys_pselect6_time64 422 422 414 i386 ppoll_time64 sys_ppoll compat_sys_ppoll_time64 423 - 416 i386 io_pgetevents_time64 sys_io_pgetevents 423 + 416 i386 io_pgetevents_time64 sys_io_pgetevents compat_sys_io_pgetevents_time64 424 424 417 i386 recvmmsg_time64 sys_recvmmsg compat_sys_recvmmsg_time64 425 425 418 i386 mq_timedsend_time64 sys_mq_timedsend 426 426 419 i386 mq_timedreceive_time64 sys_mq_timedreceive
+5 -7
arch/x86/include/asm/cmpxchg_32.h
··· 93 93 \ 94 94 asm volatile(ALTERNATIVE(_lock_loc \ 95 95 "call cmpxchg8b_emu", \ 96 - _lock "cmpxchg8b %[ptr]", X86_FEATURE_CX8) \ 97 - : [ptr] "+m" (*(_ptr)), \ 98 - "+a" (o.low), "+d" (o.high) \ 99 - : "b" (n.low), "c" (n.high), "S" (_ptr) \ 96 + _lock "cmpxchg8b %a[ptr]", X86_FEATURE_CX8) \ 97 + : "+a" (o.low), "+d" (o.high) \ 98 + : "b" (n.low), "c" (n.high), [ptr] "S" (_ptr) \ 100 99 : "memory"); \ 101 100 \ 102 101 o.full; \ ··· 121 122 \ 122 123 asm volatile(ALTERNATIVE(_lock_loc \ 123 124 "call cmpxchg8b_emu", \ 124 - _lock "cmpxchg8b %[ptr]", X86_FEATURE_CX8) \ 125 + _lock "cmpxchg8b %a[ptr]", X86_FEATURE_CX8) \ 125 126 CC_SET(e) \ 126 127 : CC_OUT(e) (ret), \ 127 - [ptr] "+m" (*(_ptr)), \ 128 128 "+a" (o.low), "+d" (o.high) \ 129 - : "b" (n.low), "c" (n.high), "S" (_ptr) \ 129 + : "b" (n.low), "c" (n.high), [ptr] "S" (_ptr) \ 130 130 : "memory"); \ 131 131 \ 132 132 if (unlikely(!ret)) \
+6 -9
arch/x86/include/asm/entry-common.h
··· 73 73 #endif 74 74 75 75 /* 76 - * Ultimately, this value will get limited by KSTACK_OFFSET_MAX(), 77 - * but not enough for x86 stack utilization comfort. To keep 78 - * reasonable stack head room, reduce the maximum offset to 8 bits. 79 - * 80 - * The actual entropy will be further reduced by the compiler when 81 - * applying stack alignment constraints (see cc_stack_align4/8 in 76 + * This value will get limited by KSTACK_OFFSET_MAX(), which is 10 77 + * bits. The actual entropy will be further reduced by the compiler 78 + * when applying stack alignment constraints (see cc_stack_align4/8 in 82 79 * arch/x86/Makefile), which will remove the 3 (x86_64) or 2 (ia32) 83 80 * low bits from any entropy chosen here. 84 81 * 85 - * Therefore, final stack offset entropy will be 5 (x86_64) or 86 - * 6 (ia32) bits. 82 + * Therefore, final stack offset entropy will be 7 (x86_64) or 83 + * 8 (ia32) bits. 87 84 */ 88 - choose_random_kstack_offset(rdtsc() & 0xFF); 85 + choose_random_kstack_offset(rdtsc()); 89 86 } 90 87 #define arch_exit_to_user_mode_prepare arch_exit_to_user_mode_prepare 91 88
+1 -19
arch/x86/kernel/time.c
··· 27 27 28 28 unsigned long profile_pc(struct pt_regs *regs) 29 29 { 30 - unsigned long pc = instruction_pointer(regs); 31 - 32 - if (!user_mode(regs) && in_lock_functions(pc)) { 33 - #ifdef CONFIG_FRAME_POINTER 34 - return *(unsigned long *)(regs->bp + sizeof(long)); 35 - #else 36 - unsigned long *sp = (unsigned long *)regs->sp; 37 - /* 38 - * Return address is either directly at stack pointer 39 - * or above a saved flags. Eflags has bits 22-31 zero, 40 - * kernel addresses don't. 41 - */ 42 - if (sp[0] >> 22) 43 - return sp[0]; 44 - if (sp[1] >> 22) 45 - return sp[1]; 46 - #endif 47 - } 48 - return pc; 30 + return instruction_pointer(regs); 49 31 } 50 32 EXPORT_SYMBOL(profile_pc); 51 33
+12 -5
drivers/ata/ahci.c
··· 1975 1975 n_ports = max(ahci_nr_ports(hpriv->cap), fls(hpriv->port_map)); 1976 1976 1977 1977 host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports); 1978 - if (!host) 1979 - return -ENOMEM; 1978 + if (!host) { 1979 + rc = -ENOMEM; 1980 + goto err_rm_sysfs_file; 1981 + } 1980 1982 host->private_data = hpriv; 1981 1983 1982 1984 if (ahci_init_msi(pdev, n_ports, hpriv) < 0) { ··· 2033 2031 /* initialize adapter */ 2034 2032 rc = ahci_configure_dma_masks(pdev, hpriv); 2035 2033 if (rc) 2036 - return rc; 2034 + goto err_rm_sysfs_file; 2037 2035 2038 2036 rc = ahci_pci_reset_controller(host); 2039 2037 if (rc) 2040 - return rc; 2038 + goto err_rm_sysfs_file; 2041 2039 2042 2040 ahci_pci_init_controller(host); 2043 2041 ahci_pci_print_info(host); ··· 2046 2044 2047 2045 rc = ahci_host_activate(host, &ahci_sht); 2048 2046 if (rc) 2049 - return rc; 2047 + goto err_rm_sysfs_file; 2050 2048 2051 2049 pm_runtime_put_noidle(&pdev->dev); 2052 2050 return 0; 2051 + 2052 + err_rm_sysfs_file: 2053 + sysfs_remove_file_from_group(&pdev->dev.kobj, 2054 + &dev_attr_remapped_nvme.attr, NULL); 2055 + return rc; 2053 2056 } 2054 2057 2055 2058 static void ahci_shutdown_one(struct pci_dev *pdev)
+19 -13
drivers/ata/libata-core.c
··· 4137 4137 { "PIONEER BD-RW BDR-205", NULL, ATA_HORKAGE_NOLPM }, 4138 4138 4139 4139 /* Crucial devices with broken LPM support */ 4140 - { "CT500BX100SSD1", NULL, ATA_HORKAGE_NOLPM }, 4141 - { "CT240BX500SSD1", NULL, ATA_HORKAGE_NOLPM }, 4140 + { "CT*0BX*00SSD1", NULL, ATA_HORKAGE_NOLPM }, 4142 4141 4143 4142 /* 512GB MX100 with MU01 firmware has both queued TRIM and LPM issues */ 4144 4143 { "Crucial_CT512MX100*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | ··· 5489 5490 return ap; 5490 5491 } 5491 5492 5493 + void ata_port_free(struct ata_port *ap) 5494 + { 5495 + if (!ap) 5496 + return; 5497 + 5498 + kfree(ap->pmp_link); 5499 + kfree(ap->slave_link); 5500 + kfree(ap->ncq_sense_buf); 5501 + kfree(ap); 5502 + } 5503 + EXPORT_SYMBOL_GPL(ata_port_free); 5504 + 5492 5505 static void ata_devres_release(struct device *gendev, void *res) 5493 5506 { 5494 5507 struct ata_host *host = dev_get_drvdata(gendev); ··· 5527 5516 int i; 5528 5517 5529 5518 for (i = 0; i < host->n_ports; i++) { 5530 - struct ata_port *ap = host->ports[i]; 5531 - 5532 - kfree(ap->pmp_link); 5533 - kfree(ap->slave_link); 5534 - kfree(ap->ncq_sense_buf); 5535 - kfree(ap); 5519 + ata_port_free(host->ports[i]); 5536 5520 host->ports[i] = NULL; 5537 5521 } 5538 5522 kfree(host); ··· 5577 5571 if (!host) 5578 5572 return NULL; 5579 5573 5580 - if (!devres_open_group(dev, NULL, GFP_KERNEL)) 5581 - goto err_free; 5574 + if (!devres_open_group(dev, NULL, GFP_KERNEL)) { 5575 + kfree(host); 5576 + return NULL; 5577 + } 5582 5578 5583 5579 dr = devres_alloc(ata_devres_release, 0, GFP_KERNEL); 5584 5580 if (!dr) ··· 5612 5604 5613 5605 err_out: 5614 5606 devres_release_group(dev, NULL); 5615 - err_free: 5616 - kfree(host); 5617 5607 return NULL; 5618 5608 } 5619 5609 EXPORT_SYMBOL_GPL(ata_host_alloc); ··· 5910 5904 * allocation time. 5911 5905 */ 5912 5906 for (i = host->n_ports; host->ports[i]; i++) 5913 - kfree(host->ports[i]); 5907 + ata_port_free(host->ports[i]); 5914 5908 5915 5909 /* give ports names and add SCSI hosts */ 5916 5910 for (i = 0; i < host->n_ports; i++) {
+1 -1
drivers/bluetooth/btintel_pcie.c
··· 382 382 383 383 /* The first 4 bytes indicates the Intel PCIe specific packet type */ 384 384 pdata = skb_pull_data(skb, BTINTEL_PCIE_HCI_TYPE_LEN); 385 - if (!data) { 385 + if (!pdata) { 386 386 bt_dev_err(hdev, "Corrupted packet received"); 387 387 ret = -EILSEQ; 388 388 goto exit_error;
+1 -1
drivers/bluetooth/btnxpuart.c
··· 281 281 282 282 /* Default configurations */ 283 283 #define DEFAULT_H2C_WAKEUP_MODE WAKEUP_METHOD_BREAK 284 - #define DEFAULT_PS_MODE PS_MODE_DISABLE 284 + #define DEFAULT_PS_MODE PS_MODE_ENABLE 285 285 #define FW_INIT_BAUDRATE HCI_NXP_PRI_BAUDRATE 286 286 287 287 static struct sk_buff *nxp_drv_send_cmd(struct hci_dev *hdev, u16 opcode,
+9 -1
drivers/bluetooth/hci_bcm4377.c
··· 495 495 * extended scanning 496 496 * broken_mws_transport_config: Set to true if the chip erroneously claims to 497 497 * support MWS Transport Configuration 498 + * broken_le_ext_adv_report_phy: Set to true if this chip stuffs flags inside 499 + * reserved bits of Primary/Secondary_PHY inside 500 + * LE Extended Advertising Report events which 501 + * have to be ignored 498 502 * send_calibration: Optional callback to send calibration data 499 503 * send_ptb: Callback to send "PTB" regulatory/calibration data 500 504 */ ··· 517 513 unsigned long broken_ext_scan : 1; 518 514 unsigned long broken_mws_transport_config : 1; 519 515 unsigned long broken_le_coded : 1; 516 + unsigned long broken_le_ext_adv_report_phy : 1; 520 517 521 518 int (*send_calibration)(struct bcm4377_data *bcm4377); 522 519 int (*send_ptb)(struct bcm4377_data *bcm4377, ··· 721 716 ring->events[msgid] = NULL; 722 717 } 723 718 724 - bitmap_release_region(ring->msgids, msgid, ring->n_entries); 719 + bitmap_release_region(ring->msgids, msgid, 0); 725 720 726 721 unlock: 727 722 spin_unlock_irqrestore(&ring->lock, flags); ··· 2378 2373 set_bit(HCI_QUIRK_BROKEN_EXT_SCAN, &hdev->quirks); 2379 2374 if (bcm4377->hw->broken_le_coded) 2380 2375 set_bit(HCI_QUIRK_BROKEN_LE_CODED, &hdev->quirks); 2376 + if (bcm4377->hw->broken_le_ext_adv_report_phy) 2377 + set_bit(HCI_QUIRK_FIXUP_LE_EXT_ADV_REPORT_PHY, &hdev->quirks); 2381 2378 2382 2379 pci_set_drvdata(pdev, bcm4377); 2383 2380 hci_set_drvdata(hdev, bcm4377); ··· 2484 2477 .clear_pciecfg_subsystem_ctrl_bit19 = true, 2485 2478 .broken_mws_transport_config = true, 2486 2479 .broken_le_coded = true, 2480 + .broken_le_ext_adv_report_phy = true, 2487 2481 .send_calibration = bcm4387_send_calibration, 2488 2482 .send_ptb = bcm4378_send_ptb, 2489 2483 },
+15 -3
drivers/bluetooth/hci_qca.c
··· 2450 2450 struct qca_serdev *qcadev = serdev_device_get_drvdata(serdev); 2451 2451 struct hci_uart *hu = &qcadev->serdev_hu; 2452 2452 struct hci_dev *hdev = hu->hdev; 2453 - struct qca_data *qca = hu->priv; 2454 2453 const u8 ibs_wake_cmd[] = { 0xFD }; 2455 2454 const u8 edl_reset_soc_cmd[] = { 0x01, 0x00, 0xFC, 0x01, 0x05 }; 2456 2455 2457 2456 if (qcadev->btsoc_type == QCA_QCA6390) { 2458 - if (test_bit(QCA_BT_OFF, &qca->flags) || 2459 - !test_bit(HCI_RUNNING, &hdev->flags)) 2457 + /* The purpose of sending the VSC is to reset SOC into a initial 2458 + * state and the state will ensure next hdev->setup() success. 2459 + * if HCI_QUIRK_NON_PERSISTENT_SETUP is set, it means that 2460 + * hdev->setup() can do its job regardless of SoC state, so 2461 + * don't need to send the VSC. 2462 + * if HCI_SETUP is set, it means that hdev->setup() was never 2463 + * invoked and the SOC is already in the initial state, so 2464 + * don't also need to send the VSC. 2465 + */ 2466 + if (test_bit(HCI_QUIRK_NON_PERSISTENT_SETUP, &hdev->quirks) || 2467 + hci_dev_test_flag(hdev, HCI_SETUP)) 2460 2468 return; 2461 2469 2470 + /* The serdev must be in open state when conrol logic arrives 2471 + * here, so also fix the use-after-free issue caused by that 2472 + * the serdev is flushed or wrote after it is closed. 2473 + */ 2462 2474 serdev_device_write_flush(serdev); 2463 2475 ret = serdev_device_write_buf(serdev, ibs_wake_cmd, 2464 2476 sizeof(ibs_wake_cmd));
+6
drivers/counter/ti-eqep.c
··· 6 6 */ 7 7 8 8 #include <linux/bitops.h> 9 + #include <linux/clk.h> 9 10 #include <linux/counter.h> 10 11 #include <linux/kernel.h> 11 12 #include <linux/mod_devicetable.h> ··· 377 376 struct counter_device *counter; 378 377 struct ti_eqep_cnt *priv; 379 378 void __iomem *base; 379 + struct clk *clk; 380 380 int err; 381 381 382 382 counter = devm_counter_alloc(dev, sizeof(*priv)); ··· 416 414 */ 417 415 pm_runtime_enable(dev); 418 416 pm_runtime_get_sync(dev); 417 + 418 + clk = devm_clk_get_enabled(dev, NULL); 419 + if (IS_ERR(clk)) 420 + return dev_err_probe(dev, PTR_ERR(clk), "failed to enable clock\n"); 419 421 420 422 err = counter_add(counter); 421 423 if (err < 0) {
+6 -7
drivers/cpufreq/intel_pstate.c
··· 355 355 int ret; 356 356 357 357 ret = cppc_get_perf_caps(cpu, &cppc_perf); 358 - if (ret) 359 - return; 360 - 361 358 /* 362 - * On some systems with overclocking enabled, CPPC.highest_perf is hardcoded to 0xff. 363 - * In this case we can't use CPPC.highest_perf to enable ITMT. 364 - * In this case we can look at MSR_HWP_CAPABILITIES bits [8:0] to decide. 359 + * If CPPC is not available, fall back to MSR_HWP_CAPABILITIES bits [8:0]. 360 + * 361 + * Also, on some systems with overclocking enabled, CPPC.highest_perf is 362 + * hardcoded to 0xff, so CPPC.highest_perf cannot be used to enable ITMT. 363 + * Fall back to MSR_HWP_CAPABILITIES then too. 365 364 */ 366 - if (cppc_perf.highest_perf == CPPC_MAX_PERF) 365 + if (ret || cppc_perf.highest_perf == CPPC_MAX_PERF) 367 366 cppc_perf.highest_perf = HWP_HIGHEST_PERF(READ_ONCE(all_cpu_data[cpu]->hwp_cap_cached)); 368 367 369 368 /*
+3 -2
drivers/crypto/intel/qat/qat_common/Makefile
··· 39 39 adf_sysfs_rl.o \ 40 40 qat_uclo.o \ 41 41 qat_hal.o \ 42 - qat_bl.o 42 + qat_bl.o \ 43 + qat_mig_dev.o 43 44 44 45 intel_qat-$(CONFIG_DEBUG_FS) += adf_transport_debug.o \ 45 46 adf_fw_counters.o \ ··· 57 56 intel_qat-$(CONFIG_PCI_IOV) += adf_sriov.o adf_vf_isr.o adf_pfvf_utils.o \ 58 57 adf_pfvf_pf_msg.o adf_pfvf_pf_proto.o \ 59 58 adf_pfvf_vf_msg.o adf_pfvf_vf_proto.o \ 60 - adf_gen2_pfvf.o adf_gen4_pfvf.o qat_mig_dev.o 59 + adf_gen2_pfvf.o adf_gen4_pfvf.o 61 60 62 61 intel_qat-$(CONFIG_CRYPTO_DEV_QAT_ERROR_INJECTION) += adf_heartbeat_inject.o
+13
drivers/cxl/core/hdm.c
··· 52 52 struct cxl_dport *dport = NULL; 53 53 int single_port_map[1]; 54 54 unsigned long index; 55 + struct cxl_hdm *cxlhdm = dev_get_drvdata(&port->dev); 56 + 57 + /* 58 + * Capability checks are moot for passthrough decoders, support 59 + * any and all possibilities. 60 + */ 61 + cxlhdm->interleave_mask = ~0U; 62 + cxlhdm->iw_cap_mask = ~0UL; 55 63 56 64 cxlsd = cxl_switch_decoder_alloc(port, 1); 57 65 if (IS_ERR(cxlsd)) ··· 87 79 cxlhdm->interleave_mask |= GENMASK(11, 8); 88 80 if (FIELD_GET(CXL_HDM_DECODER_INTERLEAVE_14_12, hdm_cap)) 89 81 cxlhdm->interleave_mask |= GENMASK(14, 12); 82 + cxlhdm->iw_cap_mask = BIT(1) | BIT(2) | BIT(4) | BIT(8); 83 + if (FIELD_GET(CXL_HDM_DECODER_INTERLEAVE_3_6_12_WAY, hdm_cap)) 84 + cxlhdm->iw_cap_mask |= BIT(3) | BIT(6) | BIT(12); 85 + if (FIELD_GET(CXL_HDM_DECODER_INTERLEAVE_16_WAY, hdm_cap)) 86 + cxlhdm->iw_cap_mask |= BIT(16); 90 87 } 91 88 92 89 static bool should_emulate_decoders(struct cxl_endpoint_dvsec_info *info)
+11 -5
drivers/cxl/core/pmem.c
··· 62 62 return is_cxl_nvdimm_bridge(dev); 63 63 } 64 64 65 - struct cxl_nvdimm_bridge *cxl_find_nvdimm_bridge(struct cxl_memdev *cxlmd) 65 + /** 66 + * cxl_find_nvdimm_bridge() - find a bridge device relative to a port 67 + * @port: any descendant port of an nvdimm-bridge associated 68 + * root-cxl-port 69 + */ 70 + struct cxl_nvdimm_bridge *cxl_find_nvdimm_bridge(struct cxl_port *port) 66 71 { 67 - struct cxl_root *cxl_root __free(put_cxl_root) = 68 - find_cxl_root(cxlmd->endpoint); 72 + struct cxl_root *cxl_root __free(put_cxl_root) = find_cxl_root(port); 69 73 struct device *dev; 70 74 71 75 if (!cxl_root) ··· 246 242 247 243 /** 248 244 * devm_cxl_add_nvdimm() - add a bridge between a cxl_memdev and an nvdimm 245 + * @parent_port: parent port for the (to be added) @cxlmd endpoint port 249 246 * @cxlmd: cxl_memdev instance that will perform LIBNVDIMM operations 250 247 * 251 248 * Return: 0 on success negative error code on failure. 252 249 */ 253 - int devm_cxl_add_nvdimm(struct cxl_memdev *cxlmd) 250 + int devm_cxl_add_nvdimm(struct cxl_port *parent_port, 251 + struct cxl_memdev *cxlmd) 254 252 { 255 253 struct cxl_nvdimm_bridge *cxl_nvb; 256 254 struct cxl_nvdimm *cxl_nvd; 257 255 struct device *dev; 258 256 int rc; 259 257 260 - cxl_nvb = cxl_find_nvdimm_bridge(cxlmd); 258 + cxl_nvb = cxl_find_nvdimm_bridge(parent_port); 261 259 if (!cxl_nvb) 262 260 return -ENODEV; 263 261
+98 -5
drivers/cxl/core/region.c
··· 1101 1101 } 1102 1102 cxld = cxl_rr->decoder; 1103 1103 1104 + /* 1105 + * the number of targets should not exceed the target_count 1106 + * of the decoder 1107 + */ 1108 + if (is_switch_decoder(&cxld->dev)) { 1109 + struct cxl_switch_decoder *cxlsd; 1110 + 1111 + cxlsd = to_cxl_switch_decoder(&cxld->dev); 1112 + if (cxl_rr->nr_targets > cxlsd->nr_targets) { 1113 + dev_dbg(&cxlr->dev, 1114 + "%s:%s %s add: %s:%s @ %d overflows targets: %d\n", 1115 + dev_name(port->uport_dev), dev_name(&port->dev), 1116 + dev_name(&cxld->dev), dev_name(&cxlmd->dev), 1117 + dev_name(&cxled->cxld.dev), pos, 1118 + cxlsd->nr_targets); 1119 + rc = -ENXIO; 1120 + goto out_erase; 1121 + } 1122 + } 1123 + 1104 1124 rc = cxl_rr_ep_add(cxl_rr, cxled); 1105 1125 if (rc) { 1106 1126 dev_dbg(&cxlr->dev, ··· 1226 1206 dev_name(&cxled_peer->cxld.dev)); 1227 1207 return -ENXIO; 1228 1208 } 1209 + 1210 + return 0; 1211 + } 1212 + 1213 + static int check_interleave_cap(struct cxl_decoder *cxld, int iw, int ig) 1214 + { 1215 + struct cxl_port *port = to_cxl_port(cxld->dev.parent); 1216 + struct cxl_hdm *cxlhdm = dev_get_drvdata(&port->dev); 1217 + unsigned int interleave_mask; 1218 + u8 eiw; 1219 + u16 eig; 1220 + int high_pos, low_pos; 1221 + 1222 + if (!test_bit(iw, &cxlhdm->iw_cap_mask)) 1223 + return -ENXIO; 1224 + /* 1225 + * Per CXL specification r3.1(8.2.4.20.13 Decoder Protection), 1226 + * if eiw < 8: 1227 + * DPAOFFSET[51: eig + 8] = HPAOFFSET[51: eig + 8 + eiw] 1228 + * DPAOFFSET[eig + 7: 0] = HPAOFFSET[eig + 7: 0] 1229 + * 1230 + * when the eiw is 0, all the bits of HPAOFFSET[51: 0] are used, the 1231 + * interleave bits are none. 1232 + * 1233 + * if eiw >= 8: 1234 + * DPAOFFSET[51: eig + 8] = HPAOFFSET[51: eig + eiw] / 3 1235 + * DPAOFFSET[eig + 7: 0] = HPAOFFSET[eig + 7: 0] 1236 + * 1237 + * when the eiw is 8, all the bits of HPAOFFSET[51: 0] are used, the 1238 + * interleave bits are none. 1239 + */ 1240 + ways_to_eiw(iw, &eiw); 1241 + if (eiw == 0 || eiw == 8) 1242 + return 0; 1243 + 1244 + granularity_to_eig(ig, &eig); 1245 + if (eiw > 8) 1246 + high_pos = eiw + eig - 1; 1247 + else 1248 + high_pos = eiw + eig + 7; 1249 + low_pos = eig + 8; 1250 + interleave_mask = GENMASK(high_pos, low_pos); 1251 + if (interleave_mask & ~cxlhdm->interleave_mask) 1252 + return -ENXIO; 1229 1253 1230 1254 return 0; 1231 1255 } ··· 1424 1360 return -ENXIO; 1425 1361 } 1426 1362 } else { 1363 + rc = check_interleave_cap(cxld, iw, ig); 1364 + if (rc) { 1365 + dev_dbg(&cxlr->dev, 1366 + "%s:%s iw: %d ig: %d is not supported\n", 1367 + dev_name(port->uport_dev), 1368 + dev_name(&port->dev), iw, ig); 1369 + return rc; 1370 + } 1371 + 1427 1372 cxld->interleave_ways = iw; 1428 1373 cxld->interleave_granularity = ig; 1429 1374 cxld->hpa_range = (struct range) { ··· 1868 1795 struct cxl_port *ep_port, *root_port; 1869 1796 struct cxl_dport *dport; 1870 1797 int rc = -ENXIO; 1798 + 1799 + rc = check_interleave_cap(&cxled->cxld, p->interleave_ways, 1800 + p->interleave_granularity); 1801 + if (rc) { 1802 + dev_dbg(&cxlr->dev, "%s iw: %d ig: %d is not supported\n", 1803 + dev_name(&cxled->cxld.dev), p->interleave_ways, 1804 + p->interleave_granularity); 1805 + return rc; 1806 + } 1871 1807 1872 1808 if (cxled->mode != cxlr->mode) { 1873 1809 dev_dbg(&cxlr->dev, "%s region mode: %d mismatch: %d\n", ··· 2770 2688 { 2771 2689 struct cxl_dpa_to_region_context *ctx = arg; 2772 2690 struct cxl_endpoint_decoder *cxled; 2691 + struct cxl_region *cxlr; 2773 2692 u64 dpa = ctx->dpa; 2774 2693 2775 2694 if (!is_endpoint_decoder(dev)) 2776 2695 return 0; 2777 2696 2778 2697 cxled = to_cxl_endpoint_decoder(dev); 2779 - if (!cxled->dpa_res || !resource_size(cxled->dpa_res)) 2698 + if (!cxled || !cxled->dpa_res || !resource_size(cxled->dpa_res)) 2780 2699 return 0; 2781 2700 2782 2701 if (dpa > cxled->dpa_res->end || dpa < cxled->dpa_res->start) 2783 2702 return 0; 2784 2703 2785 - dev_dbg(dev, "dpa:0x%llx mapped in region:%s\n", dpa, 2786 - dev_name(&cxled->cxld.region->dev)); 2704 + /* 2705 + * Stop the region search (return 1) when an endpoint mapping is 2706 + * found. The region may not be fully constructed so offering 2707 + * the cxlr in the context structure is not guaranteed. 2708 + */ 2709 + cxlr = cxled->cxld.region; 2710 + if (cxlr) 2711 + dev_dbg(dev, "dpa:0x%llx mapped in region:%s\n", dpa, 2712 + dev_name(&cxlr->dev)); 2713 + else 2714 + dev_dbg(dev, "dpa:0x%llx mapped in endpoint:%s\n", dpa, 2715 + dev_name(dev)); 2787 2716 2788 - ctx->cxlr = cxled->cxld.region; 2717 + ctx->cxlr = cxlr; 2789 2718 2790 2719 return 1; 2791 2720 } ··· 2940 2847 * bridge for one device is the same for all. 2941 2848 */ 2942 2849 if (i == 0) { 2943 - cxl_nvb = cxl_find_nvdimm_bridge(cxlmd); 2850 + cxl_nvb = cxl_find_nvdimm_bridge(cxlmd->endpoint); 2944 2851 if (!cxl_nvb) 2945 2852 return -ENODEV; 2946 2853 cxlr->cxl_nvb = cxl_nvb;
+4 -2
drivers/cxl/cxl.h
··· 47 47 #define CXL_HDM_DECODER_TARGET_COUNT_MASK GENMASK(7, 4) 48 48 #define CXL_HDM_DECODER_INTERLEAVE_11_8 BIT(8) 49 49 #define CXL_HDM_DECODER_INTERLEAVE_14_12 BIT(9) 50 + #define CXL_HDM_DECODER_INTERLEAVE_3_6_12_WAY BIT(11) 51 + #define CXL_HDM_DECODER_INTERLEAVE_16_WAY BIT(12) 50 52 #define CXL_HDM_DECODER_CTRL_OFFSET 0x4 51 53 #define CXL_HDM_DECODER_ENABLE BIT(1) 52 54 #define CXL_HDM_DECODER0_BASE_LOW_OFFSET(i) (0x20 * (i) + 0x10) ··· 857 855 struct cxl_nvdimm *to_cxl_nvdimm(struct device *dev); 858 856 bool is_cxl_nvdimm(struct device *dev); 859 857 bool is_cxl_nvdimm_bridge(struct device *dev); 860 - int devm_cxl_add_nvdimm(struct cxl_memdev *cxlmd); 861 - struct cxl_nvdimm_bridge *cxl_find_nvdimm_bridge(struct cxl_memdev *cxlmd); 858 + int devm_cxl_add_nvdimm(struct cxl_port *parent_port, struct cxl_memdev *cxlmd); 859 + struct cxl_nvdimm_bridge *cxl_find_nvdimm_bridge(struct cxl_port *port); 862 860 863 861 #ifdef CONFIG_CXL_REGION 864 862 bool is_cxl_pmem_region(struct device *dev);
+16 -5
drivers/cxl/cxlmem.h
··· 395 395 396 396 /** 397 397 * struct cxl_dpa_perf - DPA performance property entry 398 - * @dpa_range - range for DPA address 399 - * @coord - QoS performance data (i.e. latency, bandwidth) 400 - * @qos_class - QoS Class cookies 398 + * @dpa_range: range for DPA address 399 + * @coord: QoS performance data (i.e. latency, bandwidth) 400 + * @qos_class: QoS Class cookies 401 401 */ 402 402 struct cxl_dpa_perf { 403 403 struct range dpa_range; ··· 464 464 * @active_persistent_bytes: sum of hard + soft persistent 465 465 * @next_volatile_bytes: volatile capacity change pending device reset 466 466 * @next_persistent_bytes: persistent capacity change pending device reset 467 + * @ram_perf: performance data entry matched to RAM partition 468 + * @pmem_perf: performance data entry matched to PMEM partition 467 469 * @event: event log driver state 468 470 * @poison: poison driver state info 469 471 * @security: security driver state info 470 472 * @fw: firmware upload / activation state 473 + * @mbox_wait: RCU wait for mbox send completely 471 474 * @mbox_send: @dev specific transport for transmitting mailbox commands 472 - * @ram_perf: performance data entry matched to RAM partition 473 - * @pmem_perf: performance data entry matched to PMEM partition 474 475 * 475 476 * See CXL 3.0 8.2.9.8.2 Capacity Configuration and Label Storage for 476 477 * details on capacity parameters. ··· 852 851 853 852 int cxl_mem_sanitize(struct cxl_memdev *cxlmd, u16 cmd); 854 853 854 + /** 855 + * struct cxl_hdm - HDM Decoder registers and cached / decoded capabilities 856 + * @regs: mapped registers, see devm_cxl_setup_hdm() 857 + * @decoder_count: number of decoders for this port 858 + * @target_count: for switch decoders, max downstream port targets 859 + * @interleave_mask: interleave granularity capability, see check_interleave_cap() 860 + * @iw_cap_mask: bitmask of supported interleave ways, see check_interleave_cap() 861 + * @port: mapped cxl_port, see devm_cxl_setup_hdm() 862 + */ 855 863 struct cxl_hdm { 856 864 struct cxl_component_regs regs; 857 865 unsigned int decoder_count; 858 866 unsigned int target_count; 859 867 unsigned int interleave_mask; 868 + unsigned long iw_cap_mask; 860 869 struct cxl_port *port; 861 870 }; 862 871
+9 -8
drivers/cxl/mem.c
··· 152 152 return -ENXIO; 153 153 } 154 154 155 + if (resource_size(&cxlds->pmem_res) && IS_ENABLED(CONFIG_CXL_PMEM)) { 156 + rc = devm_cxl_add_nvdimm(parent_port, cxlmd); 157 + if (rc) { 158 + if (rc == -ENODEV) 159 + dev_info(dev, "PMEM disabled by platform\n"); 160 + return rc; 161 + } 162 + } 163 + 155 164 if (dport->rch) 156 165 endpoint_parent = parent_port->uport_dev; 157 166 else ··· 182 173 put_device(&parent_port->dev); 183 174 if (rc) 184 175 return rc; 185 - 186 - if (resource_size(&cxlds->pmem_res) && IS_ENABLED(CONFIG_CXL_PMEM)) { 187 - rc = devm_cxl_add_nvdimm(cxlmd); 188 - if (rc == -ENODEV) 189 - dev_info(dev, "PMEM disabled by platform\n"); 190 - else 191 - return rc; 192 - } 193 176 194 177 /* 195 178 * The kernel may be operating out of CXL memory on this device,
+5
drivers/gpio/gpio-davinci.c
··· 225 225 else 226 226 nirq = DIV_ROUND_UP(ngpio, 16); 227 227 228 + if (nirq > MAX_INT_PER_BANK) { 229 + dev_err(dev, "Too many IRQs!\n"); 230 + return -EINVAL; 231 + } 232 + 228 233 chips = devm_kzalloc(dev, sizeof(*chips), GFP_KERNEL); 229 234 if (!chips) 230 235 return -ENOMEM;
+2
drivers/gpio/gpio-graniterapids.c
··· 296 296 if (!priv) 297 297 return -ENOMEM; 298 298 299 + raw_spin_lock_init(&priv->lock); 300 + 299 301 regs = devm_platform_ioremap_resource(pdev, 0); 300 302 if (IS_ERR(regs)) 301 303 return PTR_ERR(regs);
+2
drivers/gpio/gpio-pca953x.c
··· 758 758 int level; 759 759 760 760 if (chip->driver_data & PCA_PCAL) { 761 + guard(mutex)(&chip->i2c_lock); 762 + 761 763 /* Enable latch on interrupt-enabled inputs */ 762 764 pca953x_write_regs(chip, PCAL953X_IN_LATCH, chip->irq_mask); 763 765
+17 -11
drivers/gpio/gpiolib-cdev.c
··· 89 89 GPIOHANDLE_REQUEST_OPEN_DRAIN | \ 90 90 GPIOHANDLE_REQUEST_OPEN_SOURCE) 91 91 92 + #define GPIOHANDLE_REQUEST_DIRECTION_FLAGS \ 93 + (GPIOHANDLE_REQUEST_INPUT | \ 94 + GPIOHANDLE_REQUEST_OUTPUT) 95 + 92 96 static int linehandle_validate_flags(u32 flags) 93 97 { 94 98 /* Return an error if an unknown flag is set */ ··· 173 169 if (ret) 174 170 return ret; 175 171 172 + /* Lines must be reconfigured explicitly as input or output. */ 173 + if (!(lflags & GPIOHANDLE_REQUEST_DIRECTION_FLAGS)) 174 + return -EINVAL; 175 + 176 176 for (i = 0; i < lh->num_descs; i++) { 177 177 desc = lh->descs[i]; 178 - linehandle_flags_to_desc_flags(gcnf.flags, &desc->flags); 178 + linehandle_flags_to_desc_flags(lflags, &desc->flags); 179 179 180 - /* 181 - * Lines have to be requested explicitly for input 182 - * or output, else the line will be treated "as is". 183 - */ 184 180 if (lflags & GPIOHANDLE_REQUEST_OUTPUT) { 185 181 int val = !!gcnf.default_values[i]; 186 182 187 183 ret = gpiod_direction_output(desc, val); 188 184 if (ret) 189 185 return ret; 190 - } else if (lflags & GPIOHANDLE_REQUEST_INPUT) { 186 + } else { 191 187 ret = gpiod_direction_input(desc); 192 188 if (ret) 193 189 return ret; ··· 1534 1530 line = &lr->lines[i]; 1535 1531 desc = lr->lines[i].desc; 1536 1532 flags = gpio_v2_line_config_flags(&lc, i); 1533 + /* 1534 + * Lines not explicitly reconfigured as input or output 1535 + * are left unchanged. 1536 + */ 1537 + if (!(flags & GPIO_V2_LINE_DIRECTION_FLAGS)) 1538 + continue; 1537 1539 gpio_v2_line_config_flags_to_desc_flags(flags, &desc->flags); 1538 1540 edflags = flags & GPIO_V2_LINE_EDGE_DETECTOR_FLAGS; 1539 - /* 1540 - * Lines have to be requested explicitly for input 1541 - * or output, else the line will be treated "as is". 1542 - */ 1543 1541 if (flags & GPIO_V2_LINE_FLAG_OUTPUT) { 1544 1542 int val = gpio_v2_line_config_output_value(&lc, i); 1545 1543 ··· 1549 1543 ret = gpiod_direction_output(desc, val); 1550 1544 if (ret) 1551 1545 return ret; 1552 - } else if (flags & GPIO_V2_LINE_FLAG_INPUT) { 1546 + } else { 1553 1547 ret = gpiod_direction_input(desc); 1554 1548 if (ret) 1555 1549 return ret;
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
··· 400 400 mem_channel_number = vram_info->v30.channel_num; 401 401 mem_channel_width = vram_info->v30.channel_width; 402 402 if (vram_width) 403 - *vram_width = mem_channel_number * (1 << mem_channel_width); 403 + *vram_width = mem_channel_number * 16; 404 404 break; 405 405 default: 406 406 return -EINVAL;
+5 -2
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 5220 5220 5221 5221 dev_info(adev->dev, "GPU mode1 reset\n"); 5222 5222 5223 + /* Cache the state before bus master disable. The saved config space 5224 + * values are used in other cases like restore after mode-2 reset. 5225 + */ 5226 + amdgpu_device_cache_pci_state(adev->pdev); 5227 + 5223 5228 /* disable BM */ 5224 5229 pci_clear_master(adev->pdev); 5225 - 5226 - amdgpu_device_cache_pci_state(adev->pdev); 5227 5230 5228 5231 if (amdgpu_dpm_is_mode1_reset_supported(adev)) { 5229 5232 dev_info(adev->dev, "GPU smu mode1 reset\n");
+21 -4
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
··· 640 640 } 641 641 } 642 642 643 + static bool psp_err_warn(struct psp_context *psp) 644 + { 645 + struct psp_gfx_cmd_resp *cmd = psp->cmd_buf_mem; 646 + 647 + /* This response indicates reg list is already loaded */ 648 + if (amdgpu_ip_version(psp->adev, MP0_HWIP, 0) == IP_VERSION(13, 0, 2) && 649 + cmd->cmd_id == GFX_CMD_ID_LOAD_IP_FW && 650 + cmd->cmd.cmd_load_ip_fw.fw_type == GFX_FW_TYPE_REG_LIST && 651 + cmd->resp.status == TEE_ERROR_CANCEL) 652 + return false; 653 + 654 + return true; 655 + } 656 + 643 657 static int 644 658 psp_cmd_submit_buf(struct psp_context *psp, 645 659 struct amdgpu_firmware_info *ucode, ··· 713 699 dev_warn(psp->adev->dev, 714 700 "failed to load ucode %s(0x%X) ", 715 701 amdgpu_ucode_name(ucode->ucode_id), ucode->ucode_id); 716 - dev_warn(psp->adev->dev, 717 - "psp gfx command %s(0x%X) failed and response status is (0x%X)\n", 718 - psp_gfx_cmd_name(psp->cmd_buf_mem->cmd_id), psp->cmd_buf_mem->cmd_id, 719 - psp->cmd_buf_mem->resp.status); 702 + if (psp_err_warn(psp)) 703 + dev_warn( 704 + psp->adev->dev, 705 + "psp gfx command %s(0x%X) failed and response status is (0x%X)\n", 706 + psp_gfx_cmd_name(psp->cmd_buf_mem->cmd_id), 707 + psp->cmd_buf_mem->cmd_id, 708 + psp->cmd_buf_mem->resp.status); 720 709 /* If any firmware (including CAP) load fails under SRIOV, it should 721 710 * return failure to stop the VF from initializing. 722 711 * Also return failure in case of timeout
+16 -2
drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
··· 3 3 #include <drm/drm_atomic_helper.h> 4 4 #include <drm/drm_edid.h> 5 5 #include <drm/drm_simple_kms_helper.h> 6 + #include <drm/drm_gem_framebuffer_helper.h> 6 7 #include <drm/drm_vblank.h> 7 8 8 9 #include "amdgpu.h" ··· 315 314 return 0; 316 315 } 317 316 afb = to_amdgpu_framebuffer(new_state->fb); 318 - obj = new_state->fb->obj[0]; 317 + 318 + obj = drm_gem_fb_get_obj(new_state->fb, 0); 319 + if (!obj) { 320 + DRM_ERROR("Failed to get obj from framebuffer\n"); 321 + return -EINVAL; 322 + } 323 + 319 324 rbo = gem_to_amdgpu_bo(obj); 320 325 adev = amdgpu_ttm_adev(rbo->tbo.bdev); 321 326 ··· 375 368 struct drm_plane_state *old_state) 376 369 { 377 370 struct amdgpu_bo *rbo; 371 + struct drm_gem_object *obj; 378 372 int r; 379 373 380 374 if (!old_state->fb) 381 375 return; 382 376 383 - rbo = gem_to_amdgpu_bo(old_state->fb->obj[0]); 377 + obj = drm_gem_fb_get_obj(old_state->fb, 0); 378 + if (!obj) { 379 + DRM_ERROR("Failed to get obj from framebuffer\n"); 380 + return; 381 + } 382 + 383 + rbo = gem_to_amdgpu_bo(obj); 384 384 r = amdgpu_bo_reserve(rbo, false); 385 385 if (unlikely(r)) { 386 386 DRM_ERROR("failed to reserve rbo before unpin\n");
+3 -2
drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h
··· 464 464 #define PSP_ERR_UNKNOWN_COMMAND 0x00000100 465 465 466 466 enum tee_error_code { 467 - TEE_SUCCESS = 0x00000000, 468 - TEE_ERROR_NOT_SUPPORTED = 0xFFFF000A, 467 + TEE_SUCCESS = 0x00000000, 468 + TEE_ERROR_CANCEL = 0xFFFF0002, 469 + TEE_ERROR_NOT_SUPPORTED = 0xFFFF000A, 469 470 }; 470 471 471 472 #endif /* _PSP_TEE_GFX_IF_H_ */
+5
drivers/gpu/drm/amd/display/include/dpcd_defs.h
··· 177 177 #define DP_SINK_PR_PIXEL_DEVIATION_PER_LINE 0x379 178 178 #define DP_SINK_PR_MAX_NUMBER_OF_DEVIATION_LINE 0x37A 179 179 180 + /* Remove once drm_dp_helper.h is updated upstream */ 181 + #ifndef DP_TOTAL_LTTPR_CNT 182 + #define DP_TOTAL_LTTPR_CNT 0xF000A /* 2.1 */ 183 + #endif 184 + 180 185 #endif /* __DAL_DPCD_DEFS_H__ */
+13
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
··· 324 324 return ret; 325 325 } 326 326 327 + static int smu_set_mall_enable(struct smu_context *smu) 328 + { 329 + int ret = 0; 330 + 331 + if (!smu->ppt_funcs->set_mall_enable) 332 + return 0; 333 + 334 + ret = smu->ppt_funcs->set_mall_enable(smu); 335 + 336 + return ret; 337 + } 338 + 327 339 /** 328 340 * smu_dpm_set_power_gate - power gate/ungate the specific IP block 329 341 * ··· 1803 1791 smu_dpm_set_jpeg_enable(smu, true); 1804 1792 smu_dpm_set_vpe_enable(smu, true); 1805 1793 smu_dpm_set_umsch_mm_enable(smu, true); 1794 + smu_set_mall_enable(smu); 1806 1795 smu_set_gfx_cgpg(smu, true); 1807 1796 } 1808 1797
+5
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
··· 1395 1395 int (*dpm_set_umsch_mm_enable)(struct smu_context *smu, bool enable); 1396 1396 1397 1397 /** 1398 + * @set_mall_enable: Init MALL power gating control. 1399 + */ 1400 + int (*set_mall_enable)(struct smu_context *smu); 1401 + 1402 + /** 1398 1403 * @notify_rlc_state: Notify RLC power state to SMU. 1399 1404 */ 1400 1405 int (*notify_rlc_state)(struct smu_context *smu, bool en);
+2 -2
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v14_0_0_ppsmc.h
··· 106 106 #define PPSMC_MSG_DisableLSdma 0x35 ///< Disable LSDMA 107 107 #define PPSMC_MSG_SetSoftMaxVpe 0x36 ///< 108 108 #define PPSMC_MSG_SetSoftMinVpe 0x37 ///< 109 - #define PPSMC_MSG_AllocMALLCache 0x38 ///< Allocating MALL Cache 110 - #define PPSMC_MSG_ReleaseMALLCache 0x39 ///< Releasing MALL Cache 109 + #define PPSMC_MSG_MALLPowerController 0x38 ///< Set MALL control 110 + #define PPSMC_MSG_MALLPowerState 0x39 ///< Enter/Exit MALL PG 111 111 #define PPSMC_Message_Count 0x3A ///< Total number of PPSMC messages 112 112 /** @}*/ 113 113
+3 -1
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
··· 272 272 __SMU_DUMMY_MAP(SetSoftMinVpe), \ 273 273 __SMU_DUMMY_MAP(GetMetricsVersion), \ 274 274 __SMU_DUMMY_MAP(EnableUCLKShadow), \ 275 - __SMU_DUMMY_MAP(RmaDueToBadPageThreshold), 275 + __SMU_DUMMY_MAP(RmaDueToBadPageThreshold), \ 276 + __SMU_DUMMY_MAP(MALLPowerController), \ 277 + __SMU_DUMMY_MAP(MALLPowerState), 276 278 277 279 #undef __SMU_DUMMY_MAP 278 280 #define __SMU_DUMMY_MAP(type) SMU_MSG_##type
+73
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
··· 52 52 #define mmMP1_SMN_C2PMSG_90 0x029a 53 53 #define mmMP1_SMN_C2PMSG_90_BASE_IDX 0 54 54 55 + /* MALLPowerController message arguments (Defines for the Cache mode control) */ 56 + #define SMU_MALL_PMFW_CONTROL 0 57 + #define SMU_MALL_DRIVER_CONTROL 1 58 + 59 + /* 60 + * MALLPowerState message arguments 61 + * (Defines for the Allocate/Release Cache mode if in driver mode) 62 + */ 63 + #define SMU_MALL_EXIT_PG 0 64 + #define SMU_MALL_ENTER_PG 1 65 + 66 + #define SMU_MALL_PG_CONFIG_DEFAULT SMU_MALL_PG_CONFIG_DRIVER_CONTROL_ALWAYS_ON 67 + 55 68 #define FEATURE_MASK(feature) (1ULL << feature) 56 69 #define SMC_DPM_FEATURE ( \ 57 70 FEATURE_MASK(FEATURE_CCLK_DPM_BIT) | \ ··· 78 65 FEATURE_MASK(FEATURE_IPU_DPM_BIT) | \ 79 66 FEATURE_MASK(FEATURE_GFX_DPM_BIT) | \ 80 67 FEATURE_MASK(FEATURE_VPE_DPM_BIT)) 68 + 69 + enum smu_mall_pg_config { 70 + SMU_MALL_PG_CONFIG_PMFW_CONTROL = 0, 71 + SMU_MALL_PG_CONFIG_DRIVER_CONTROL_ALWAYS_ON = 1, 72 + SMU_MALL_PG_CONFIG_DRIVER_CONTROL_ALWAYS_OFF = 2, 73 + }; 81 74 82 75 static struct cmn2asic_msg_mapping smu_v14_0_0_message_map[SMU_MSG_MAX_COUNT] = { 83 76 MSG_MAP(TestMessage, PPSMC_MSG_TestMessage, 1), ··· 132 113 MSG_MAP(PowerDownUmsch, PPSMC_MSG_PowerDownUmsch, 1), 133 114 MSG_MAP(SetSoftMaxVpe, PPSMC_MSG_SetSoftMaxVpe, 1), 134 115 MSG_MAP(SetSoftMinVpe, PPSMC_MSG_SetSoftMinVpe, 1), 116 + MSG_MAP(MALLPowerController, PPSMC_MSG_MALLPowerController, 1), 117 + MSG_MAP(MALLPowerState, PPSMC_MSG_MALLPowerState, 1), 135 118 }; 136 119 137 120 static struct cmn2asic_mapping smu_v14_0_0_feature_mask_map[SMU_FEATURE_COUNT] = { ··· 1444 1423 return 0; 1445 1424 } 1446 1425 1426 + static int smu_v14_0_1_init_mall_power_gating(struct smu_context *smu, enum smu_mall_pg_config pg_config) 1427 + { 1428 + struct amdgpu_device *adev = smu->adev; 1429 + int ret = 0; 1430 + 1431 + if (pg_config == SMU_MALL_PG_CONFIG_PMFW_CONTROL) { 1432 + ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_MALLPowerController, 1433 + SMU_MALL_PMFW_CONTROL, NULL); 1434 + if (ret) { 1435 + dev_err(adev->dev, "Init MALL PMFW CONTROL Failure\n"); 1436 + return ret; 1437 + } 1438 + } else { 1439 + ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_MALLPowerController, 1440 + SMU_MALL_DRIVER_CONTROL, NULL); 1441 + if (ret) { 1442 + dev_err(adev->dev, "Init MALL Driver CONTROL Failure\n"); 1443 + return ret; 1444 + } 1445 + 1446 + if (pg_config == SMU_MALL_PG_CONFIG_DRIVER_CONTROL_ALWAYS_ON) { 1447 + ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_MALLPowerState, 1448 + SMU_MALL_EXIT_PG, NULL); 1449 + if (ret) { 1450 + dev_err(adev->dev, "EXIT MALL PG Failure\n"); 1451 + return ret; 1452 + } 1453 + } else if (pg_config == SMU_MALL_PG_CONFIG_DRIVER_CONTROL_ALWAYS_OFF) { 1454 + ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_MALLPowerState, 1455 + SMU_MALL_ENTER_PG, NULL); 1456 + if (ret) { 1457 + dev_err(adev->dev, "Enter MALL PG Failure\n"); 1458 + return ret; 1459 + } 1460 + } 1461 + } 1462 + 1463 + return ret; 1464 + } 1465 + 1466 + static int smu_v14_0_common_set_mall_enable(struct smu_context *smu) 1467 + { 1468 + enum smu_mall_pg_config pg_config = SMU_MALL_PG_CONFIG_DEFAULT; 1469 + int ret = 0; 1470 + 1471 + if (amdgpu_ip_version(smu->adev, MP1_HWIP, 0) == IP_VERSION(14, 0, 1)) 1472 + ret = smu_v14_0_1_init_mall_power_gating(smu, pg_config); 1473 + 1474 + return ret; 1475 + } 1476 + 1447 1477 static const struct pptable_funcs smu_v14_0_0_ppt_funcs = { 1448 1478 .check_fw_status = smu_v14_0_check_fw_status, 1449 1479 .check_fw_version = smu_v14_0_check_fw_version, ··· 1526 1454 .dpm_set_vpe_enable = smu_v14_0_0_set_vpe_enable, 1527 1455 .dpm_set_umsch_mm_enable = smu_v14_0_0_set_umsch_mm_enable, 1528 1456 .get_dpm_clock_table = smu_v14_0_common_get_dpm_table, 1457 + .set_mall_enable = smu_v14_0_common_set_mall_enable, 1529 1458 }; 1530 1459 1531 1460 static void smu_v14_0_0_set_smu_mailbox_registers(struct smu_context *smu)
+3 -3
drivers/gpu/drm/drm_fb_helper.c
··· 524 524 if (!info) 525 525 return ERR_PTR(-ENOMEM); 526 526 527 + if (!drm_leak_fbdev_smem) 528 + info->flags |= FBINFO_HIDE_SMEM_START; 529 + 527 530 ret = fb_alloc_cmap(&info->cmap, 256, 0); 528 531 if (ret) 529 532 goto err_release; ··· 1862 1859 1863 1860 info = fb_helper->info; 1864 1861 info->var.pixclock = 0; 1865 - 1866 - if (!drm_leak_fbdev_smem) 1867 - info->flags |= FBINFO_HIDE_SMEM_START; 1868 1862 1869 1863 /* Need to drop locks to avoid recursive deadlock in 1870 1864 * register_framebuffer. This is ok because the only thing left to do is
+4 -1
drivers/gpu/drm/drm_fbdev_dma.c
··· 130 130 info->flags |= FBINFO_READS_FAST; /* signal caching */ 131 131 info->screen_size = sizes->surface_height * fb->pitches[0]; 132 132 info->screen_buffer = map.vaddr; 133 - info->fix.smem_start = page_to_phys(virt_to_page(info->screen_buffer)); 133 + if (!(info->flags & FBINFO_HIDE_SMEM_START)) { 134 + if (!drm_WARN_ON(dev, is_vmalloc_addr(info->screen_buffer))) 135 + info->fix.smem_start = page_to_phys(virt_to_page(info->screen_buffer)); 136 + } 134 137 info->fix.smem_len = info->screen_size; 135 138 136 139 return 0;
+3 -5
drivers/gpu/drm/drm_file.c
··· 469 469 470 470 dev = filp->minor->dev; 471 471 mutex_lock(&dev->filelist_mutex); 472 + get_pid(pid); 472 473 old = rcu_replace_pointer(filp->pid, pid, 1); 473 474 mutex_unlock(&dev->filelist_mutex); 474 475 475 - if (pid != old) { 476 - get_pid(pid); 477 - synchronize_rcu(); 478 - put_pid(old); 479 - } 476 + synchronize_rcu(); 477 + put_pid(old); 480 478 } 481 479 482 480 /**
+1
drivers/gpu/drm/i915/gt/intel_ggtt_fencing.c
··· 298 298 return; 299 299 300 300 GEM_BUG_ON(fence->vma != vma); 301 + i915_active_wait(&fence->active); 301 302 GEM_BUG_ON(!i915_active_is_idle(&fence->active)); 302 303 GEM_BUG_ON(atomic_read(&fence->pin_count)); 303 304
+6
drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
··· 209 209 struct drm_display_mode *mode; 210 210 211 211 mode = drm_mode_duplicate(encoder->dev, tv_mode); 212 + if (!mode) 213 + continue; 212 214 213 215 mode->clock = tv_norm->tv_enc_mode.vrefresh * 214 216 mode->htotal / 1000 * ··· 260 258 if (modes[i].hdisplay == output_mode->hdisplay && 261 259 modes[i].vdisplay == output_mode->vdisplay) { 262 260 mode = drm_mode_duplicate(encoder->dev, output_mode); 261 + if (!mode) 262 + continue; 263 263 mode->type |= DRM_MODE_TYPE_PREFERRED; 264 264 265 265 } else { ··· 269 265 modes[i].vdisplay, 60, false, 270 266 (output_mode->flags & 271 267 DRM_MODE_FLAG_INTERLACE), false); 268 + if (!mode) 269 + continue; 272 270 } 273 271 274 272 /* CVT modes are sometimes unsuitable... */
+1
drivers/gpu/drm/panel/panel-simple.c
··· 2752 2752 .vfront_porch = { 3, 5, 10 }, 2753 2753 .vback_porch = { 2, 5, 10 }, 2754 2754 .vsync_len = { 5, 5, 5 }, 2755 + .flags = DISPLAY_FLAGS_DE_HIGH, 2755 2756 }; 2756 2757 2757 2758 static const struct panel_desc koe_tx26d202vm0bwa = {
+2 -4
drivers/i2c/busses/Makefile
··· 29 29 obj-$(CONFIG_I2C_SIS96X) += i2c-sis96x.o 30 30 obj-$(CONFIG_I2C_VIA) += i2c-via.o 31 31 obj-$(CONFIG_I2C_VIAPRO) += i2c-viapro.o 32 - i2c-zhaoxin-objs := i2c-viai2c-zhaoxin.o i2c-viai2c-common.o 33 - obj-$(CONFIG_I2C_ZHAOXIN) += i2c-zhaoxin.o 32 + obj-$(CONFIG_I2C_ZHAOXIN) += i2c-viai2c-zhaoxin.o i2c-viai2c-common.o 34 33 35 34 # Mac SMBus host controller drivers 36 35 obj-$(CONFIG_I2C_HYDRA) += i2c-hydra.o ··· 119 120 obj-$(CONFIG_I2C_UNIPHIER) += i2c-uniphier.o 120 121 obj-$(CONFIG_I2C_UNIPHIER_F) += i2c-uniphier-f.o 121 122 obj-$(CONFIG_I2C_VERSATILE) += i2c-versatile.o 122 - i2c-wmt-objs := i2c-viai2c-wmt.o i2c-viai2c-common.o 123 - obj-$(CONFIG_I2C_WMT) += i2c-wmt.o 123 + obj-$(CONFIG_I2C_WMT) += i2c-viai2c-wmt.o i2c-viai2c-common.o 124 124 i2c-octeon-objs := i2c-octeon-core.o i2c-octeon-platdrv.o 125 125 obj-$(CONFIG_I2C_OCTEON) += i2c-octeon.o 126 126 i2c-thunderx-objs := i2c-octeon-core.o i2c-thunderx-pcidrv.o
+9 -62
drivers/i2c/busses/i2c-viai2c-common.c
··· 17 17 18 18 return 0; 19 19 } 20 + EXPORT_SYMBOL_GPL(viai2c_wait_bus_not_busy); 20 21 21 22 static int viai2c_write(struct viai2c *i2c, struct i2c_msg *pmsg, int last) 22 23 { ··· 122 121 123 122 return (ret < 0) ? ret : i; 124 123 } 124 + EXPORT_SYMBOL_GPL(viai2c_xfer); 125 125 126 126 /* 127 127 * Main process of the byte mode xfer ··· 132 130 * 0: there is still data that needs to be transferred 133 131 * -EIO: error occurred 134 132 */ 135 - static int viai2c_irq_xfer(struct viai2c *i2c) 133 + int viai2c_irq_xfer(struct viai2c *i2c) 136 134 { 137 135 u16 val; 138 136 struct i2c_msg *msg = i2c->msg; ··· 173 171 174 172 return i2c->xfered_len == msg->len; 175 173 } 176 - 177 - int __weak viai2c_fifo_irq_xfer(struct viai2c *i2c, bool irq) 178 - { 179 - return 0; 180 - } 181 - 182 - static irqreturn_t viai2c_isr(int irq, void *data) 183 - { 184 - struct viai2c *i2c = data; 185 - u8 status; 186 - 187 - /* save the status and write-clear it */ 188 - status = readw(i2c->base + VIAI2C_REG_ISR); 189 - if (!status && i2c->platform == VIAI2C_PLAT_ZHAOXIN) 190 - return IRQ_NONE; 191 - 192 - writew(status, i2c->base + VIAI2C_REG_ISR); 193 - 194 - i2c->ret = 0; 195 - if (status & VIAI2C_ISR_NACK_ADDR) 196 - i2c->ret = -EIO; 197 - 198 - if (i2c->platform == VIAI2C_PLAT_WMT && (status & VIAI2C_ISR_SCL_TIMEOUT)) 199 - i2c->ret = -ETIMEDOUT; 200 - 201 - if (!i2c->ret) { 202 - if (i2c->mode == VIAI2C_BYTE_MODE) 203 - i2c->ret = viai2c_irq_xfer(i2c); 204 - else 205 - i2c->ret = viai2c_fifo_irq_xfer(i2c, true); 206 - } 207 - 208 - /* All the data has been successfully transferred or error occurred */ 209 - if (i2c->ret) 210 - complete(&i2c->complete); 211 - 212 - return IRQ_HANDLED; 213 - } 174 + EXPORT_SYMBOL_GPL(viai2c_irq_xfer); 214 175 215 176 int viai2c_init(struct platform_device *pdev, struct viai2c **pi2c, int plat) 216 177 { 217 - int err; 218 - int irq_flags; 219 178 struct viai2c *i2c; 220 - struct device_node *np = pdev->dev.of_node; 221 179 222 180 i2c = devm_kzalloc(&pdev->dev, sizeof(*i2c), GFP_KERNEL); 223 181 if (!i2c) ··· 187 225 if (IS_ERR(i2c->base)) 188 226 return PTR_ERR(i2c->base); 189 227 190 - if (plat == VIAI2C_PLAT_WMT) { 191 - irq_flags = 0; 192 - i2c->irq = irq_of_parse_and_map(np, 0); 193 - if (!i2c->irq) 194 - return -EINVAL; 195 - } else if (plat == VIAI2C_PLAT_ZHAOXIN) { 196 - irq_flags = IRQF_SHARED; 197 - i2c->irq = platform_get_irq(pdev, 0); 198 - if (i2c->irq < 0) 199 - return i2c->irq; 200 - } else { 201 - return dev_err_probe(&pdev->dev, -EINVAL, "wrong platform type\n"); 202 - } 203 - 204 228 i2c->platform = plat; 205 - 206 - err = devm_request_irq(&pdev->dev, i2c->irq, viai2c_isr, 207 - irq_flags, pdev->name, i2c); 208 - if (err) 209 - return dev_err_probe(&pdev->dev, err, 210 - "failed to request irq %i\n", i2c->irq); 211 229 212 230 i2c->dev = &pdev->dev; 213 231 init_completion(&i2c->complete); ··· 196 254 *pi2c = i2c; 197 255 return 0; 198 256 } 257 + EXPORT_SYMBOL_GPL(viai2c_init); 258 + 259 + MODULE_DESCRIPTION("Via/Wondermedia/Zhaoxin I2C master-mode bus adapter"); 260 + MODULE_AUTHOR("Tony Prisk <linux@prisktech.co.nz>"); 261 + MODULE_LICENSE("GPL");
+1 -1
drivers/i2c/busses/i2c-viai2c-common.h
··· 80 80 int viai2c_wait_bus_not_busy(struct viai2c *i2c); 81 81 int viai2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num); 82 82 int viai2c_init(struct platform_device *pdev, struct viai2c **pi2c, int plat); 83 - int viai2c_fifo_irq_xfer(struct viai2c *i2c, bool irq); 83 + int viai2c_irq_xfer(struct viai2c *i2c); 84 84 85 85 #endif
+36
drivers/i2c/busses/i2c-viai2c-wmt.c
··· 72 72 return 0; 73 73 } 74 74 75 + static irqreturn_t wmt_i2c_isr(int irq, void *data) 76 + { 77 + struct viai2c *i2c = data; 78 + u8 status; 79 + 80 + /* save the status and write-clear it */ 81 + status = readw(i2c->base + VIAI2C_REG_ISR); 82 + writew(status, i2c->base + VIAI2C_REG_ISR); 83 + 84 + i2c->ret = 0; 85 + if (status & VIAI2C_ISR_NACK_ADDR) 86 + i2c->ret = -EIO; 87 + 88 + if (status & VIAI2C_ISR_SCL_TIMEOUT) 89 + i2c->ret = -ETIMEDOUT; 90 + 91 + if (!i2c->ret) 92 + i2c->ret = viai2c_irq_xfer(i2c); 93 + 94 + /* All the data has been successfully transferred or error occurred */ 95 + if (i2c->ret) 96 + complete(&i2c->complete); 97 + 98 + return IRQ_HANDLED; 99 + } 100 + 75 101 static int wmt_i2c_probe(struct platform_device *pdev) 76 102 { 77 103 struct device_node *np = pdev->dev.of_node; ··· 109 83 err = viai2c_init(pdev, &i2c, VIAI2C_PLAT_WMT); 110 84 if (err) 111 85 return err; 86 + 87 + i2c->irq = platform_get_irq(pdev, 0); 88 + if (i2c->irq < 0) 89 + return i2c->irq; 90 + 91 + err = devm_request_irq(&pdev->dev, i2c->irq, wmt_i2c_isr, 92 + 0, pdev->name, i2c); 93 + if (err) 94 + return dev_err_probe(&pdev->dev, err, 95 + "failed to request irq %i\n", i2c->irq); 112 96 113 97 i2c->clk = of_clk_get(np, 0); 114 98 if (IS_ERR(i2c->clk)) {
+92 -23
drivers/i2c/busses/i2c-viai2c-zhaoxin.c
··· 49 49 u16 xfer_len; 50 50 }; 51 51 52 - /* 'irq == true' means in interrupt context */ 53 - int viai2c_fifo_irq_xfer(struct viai2c *i2c, bool irq) 52 + static int viai2c_fifo_xfer(struct viai2c *i2c) 54 53 { 55 54 u16 i; 56 55 u8 tmp; ··· 57 58 void __iomem *base = i2c->base; 58 59 bool read = !!(msg->flags & I2C_M_RD); 59 60 struct viai2c_zhaoxin *priv = i2c->pltfm_priv; 60 - 61 - if (irq) { 62 - /* get the received data */ 63 - if (read) 64 - for (i = 0; i < priv->xfer_len; i++) 65 - msg->buf[i2c->xfered_len + i] = ioread8(base + ZXI2C_REG_HRDR); 66 - 67 - i2c->xfered_len += priv->xfer_len; 68 - if (i2c->xfered_len == msg->len) 69 - return 1; 70 - } 71 61 72 62 /* reset fifo buffer */ 73 63 tmp = ioread8(base + ZXI2C_REG_HCR); ··· 80 92 iowrite8(tmp, base + VIAI2C_REG_CR); 81 93 } 82 94 83 - if (irq) { 84 - /* continue transmission */ 85 - tmp = ioread8(base + VIAI2C_REG_CR); 86 - iowrite8(tmp |= VIAI2C_CR_CPU_RDY, base + VIAI2C_REG_CR); 87 - } else { 88 - u16 tcr_val = i2c->tcr; 95 + u16 tcr_val = i2c->tcr; 89 96 90 - /* start transmission */ 91 - tcr_val |= read ? VIAI2C_TCR_READ : 0; 92 - writew(tcr_val | msg->addr, base + VIAI2C_REG_TCR); 97 + /* start transmission */ 98 + tcr_val |= read ? VIAI2C_TCR_READ : 0; 99 + writew(tcr_val | msg->addr, base + VIAI2C_REG_TCR); 100 + 101 + return 0; 102 + } 103 + 104 + static int viai2c_fifo_irq_xfer(struct viai2c *i2c) 105 + { 106 + u16 i; 107 + u8 tmp; 108 + struct i2c_msg *msg = i2c->msg; 109 + void __iomem *base = i2c->base; 110 + bool read = !!(msg->flags & I2C_M_RD); 111 + struct viai2c_zhaoxin *priv = i2c->pltfm_priv; 112 + 113 + /* get the received data */ 114 + if (read) 115 + for (i = 0; i < priv->xfer_len; i++) 116 + msg->buf[i2c->xfered_len + i] = ioread8(base + ZXI2C_REG_HRDR); 117 + 118 + i2c->xfered_len += priv->xfer_len; 119 + if (i2c->xfered_len == msg->len) 120 + return 1; 121 + 122 + /* reset fifo buffer */ 123 + tmp = ioread8(base + ZXI2C_REG_HCR); 124 + iowrite8(tmp | ZXI2C_HCR_RST_FIFO, base + ZXI2C_REG_HCR); 125 + 126 + /* set xfer len */ 127 + priv->xfer_len = min_t(u16, msg->len - i2c->xfered_len, ZXI2C_FIFO_SIZE); 128 + if (read) { 129 + iowrite8(priv->xfer_len - 1, base + ZXI2C_REG_HRLR); 130 + } else { 131 + iowrite8(priv->xfer_len - 1, base + ZXI2C_REG_HTLR); 132 + /* set write data */ 133 + for (i = 0; i < priv->xfer_len; i++) 134 + iowrite8(msg->buf[i2c->xfered_len + i], base + ZXI2C_REG_HTDR); 93 135 } 136 + 137 + /* prepare to stop transmission */ 138 + if (priv->hrv && msg->len == (i2c->xfered_len + priv->xfer_len)) { 139 + tmp = ioread8(base + VIAI2C_REG_CR); 140 + tmp |= read ? VIAI2C_CR_RX_END : VIAI2C_CR_TX_END; 141 + iowrite8(tmp, base + VIAI2C_REG_CR); 142 + } 143 + 144 + /* continue transmission */ 145 + tmp = ioread8(base + VIAI2C_REG_CR); 146 + iowrite8(tmp |= VIAI2C_CR_CPU_RDY, base + VIAI2C_REG_CR); 94 147 95 148 return 0; 96 149 } ··· 164 135 priv->xfer_len = 0; 165 136 i2c->xfered_len = 0; 166 137 167 - viai2c_fifo_irq_xfer(i2c, 0); 138 + viai2c_fifo_xfer(i2c); 168 139 169 140 if (!wait_for_completion_timeout(&i2c->complete, VIAI2C_TIMEOUT)) 170 141 return -ETIMEDOUT; ··· 257 228 dev_info(i2c->dev, "speed mode is %s\n", i2c_freq_mode_string(params[0])); 258 229 } 259 230 231 + static irqreturn_t zxi2c_isr(int irq, void *data) 232 + { 233 + struct viai2c *i2c = data; 234 + u8 status; 235 + 236 + /* save the status and write-clear it */ 237 + status = readw(i2c->base + VIAI2C_REG_ISR); 238 + if (!status) 239 + return IRQ_NONE; 240 + 241 + writew(status, i2c->base + VIAI2C_REG_ISR); 242 + 243 + i2c->ret = 0; 244 + if (status & VIAI2C_ISR_NACK_ADDR) 245 + i2c->ret = -EIO; 246 + 247 + if (!i2c->ret) { 248 + if (i2c->mode == VIAI2C_BYTE_MODE) 249 + i2c->ret = viai2c_irq_xfer(i2c); 250 + else 251 + i2c->ret = viai2c_fifo_irq_xfer(i2c); 252 + } 253 + 254 + /* All the data has been successfully transferred or error occurred */ 255 + if (i2c->ret) 256 + complete(&i2c->complete); 257 + 258 + return IRQ_HANDLED; 259 + } 260 + 260 261 static int zxi2c_probe(struct platform_device *pdev) 261 262 { 262 263 int error; ··· 297 238 error = viai2c_init(pdev, &i2c, VIAI2C_PLAT_ZHAOXIN); 298 239 if (error) 299 240 return error; 241 + 242 + i2c->irq = platform_get_irq(pdev, 0); 243 + if (i2c->irq < 0) 244 + return i2c->irq; 245 + 246 + error = devm_request_irq(&pdev->dev, i2c->irq, zxi2c_isr, 247 + IRQF_SHARED, pdev->name, i2c); 248 + if (error) 249 + return dev_err_probe(&pdev->dev, error, 250 + "failed to request irq %i\n", i2c->irq); 300 251 301 252 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); 302 253 if (!priv)
+4 -1
drivers/i2c/i2c-slave-testunit.c
··· 118 118 queue_delayed_work(system_long_wq, &tu->worker, 119 119 msecs_to_jiffies(10 * tu->regs[TU_REG_DELAY])); 120 120 } 121 - fallthrough; 121 + break; 122 122 123 123 case I2C_SLAVE_WRITE_REQUESTED: 124 + if (test_bit(TU_FLAG_IN_PROCESS, &tu->flags)) 125 + return -EBUSY; 126 + 124 127 memset(tu->regs, 0, TU_NUM_REGS); 125 128 tu->reg_idx = 0; 126 129 break;
+2
drivers/iio/accel/Kconfig
··· 330 330 config FXLS8962AF 331 331 tristate 332 332 depends on I2C || !I2C # cannot be built-in for modular I2C 333 + select IIO_BUFFER 334 + select IIO_KFIFO_BUF 333 335 334 336 config FXLS8962AF_I2C 335 337 tristate "NXP FXLS8962AF/FXLS8964AF Accelerometer I2C Driver"
+2
drivers/iio/adc/ad7266.c
··· 157 157 ret = ad7266_read_single(st, val, chan->address); 158 158 iio_device_release_direct_mode(indio_dev); 159 159 160 + if (ret < 0) 161 + return ret; 160 162 *val = (*val >> 2) & 0xfff; 161 163 if (chan->scan_type.sign == 's') 162 164 *val = sign_extend32(*val,
+6 -2
drivers/iio/adc/xilinx-ams.c
··· 414 414 415 415 /* Run calibration of PS & PL as part of the sequence */ 416 416 scan_mask = BIT(0) | BIT(AMS_PS_SEQ_MAX); 417 - for (i = 0; i < indio_dev->num_channels; i++) 418 - scan_mask |= BIT_ULL(indio_dev->channels[i].scan_index); 417 + for (i = 0; i < indio_dev->num_channels; i++) { 418 + const struct iio_chan_spec *chan = &indio_dev->channels[i]; 419 + 420 + if (chan->scan_index < AMS_CTRL_SEQ_BASE) 421 + scan_mask |= BIT_ULL(chan->scan_index); 422 + } 419 423 420 424 if (ams->ps_base) { 421 425 /* put sysmon in a soft reset to change the sequence */
+2
drivers/iio/chemical/bme680.h
··· 54 54 #define BME680_NB_CONV_MASK GENMASK(3, 0) 55 55 56 56 #define BME680_REG_MEAS_STAT_0 0x1D 57 + #define BME680_NEW_DATA_BIT BIT(7) 57 58 #define BME680_GAS_MEAS_BIT BIT(6) 59 + #define BME680_MEAS_BIT BIT(5) 58 60 59 61 /* Calibration Parameters */ 60 62 #define BME680_T2_LSB_REG 0x8A
+54 -8
drivers/iio/chemical/bme680_core.c
··· 10 10 */ 11 11 #include <linux/acpi.h> 12 12 #include <linux/bitfield.h> 13 + #include <linux/delay.h> 13 14 #include <linux/device.h> 14 15 #include <linux/module.h> 15 16 #include <linux/log2.h> ··· 39 38 s8 par_h3; 40 39 s8 par_h4; 41 40 s8 par_h5; 42 - s8 par_h6; 41 + u8 par_h6; 43 42 s8 par_h7; 44 43 s8 par_gh1; 45 44 s16 par_gh2; ··· 343 342 if (!calib->par_t2) 344 343 bme680_read_calib(data, calib); 345 344 346 - var1 = (adc_temp >> 3) - (calib->par_t1 << 1); 345 + var1 = (adc_temp >> 3) - ((s32)calib->par_t1 << 1); 347 346 var2 = (var1 * calib->par_t2) >> 11; 348 347 var3 = ((var1 >> 1) * (var1 >> 1)) >> 12; 349 - var3 = (var3 * (calib->par_t3 << 4)) >> 14; 348 + var3 = (var3 * ((s32)calib->par_t3 << 4)) >> 14; 350 349 data->t_fine = var2 + var3; 351 350 calc_temp = (data->t_fine * 5 + 128) >> 8; 352 351 ··· 369 368 var1 = (data->t_fine >> 1) - 64000; 370 369 var2 = ((((var1 >> 2) * (var1 >> 2)) >> 11) * calib->par_p6) >> 2; 371 370 var2 = var2 + (var1 * calib->par_p5 << 1); 372 - var2 = (var2 >> 2) + (calib->par_p4 << 16); 371 + var2 = (var2 >> 2) + ((s32)calib->par_p4 << 16); 373 372 var1 = (((((var1 >> 2) * (var1 >> 2)) >> 13) * 374 - (calib->par_p3 << 5)) >> 3) + 373 + ((s32)calib->par_p3 << 5)) >> 3) + 375 374 ((calib->par_p2 * var1) >> 1); 376 375 var1 = var1 >> 18; 377 376 var1 = ((32768 + var1) * calib->par_p1) >> 15; ··· 389 388 var3 = ((press_comp >> 8) * (press_comp >> 8) * 390 389 (press_comp >> 8) * calib->par_p10) >> 17; 391 390 392 - press_comp += (var1 + var2 + var3 + (calib->par_p7 << 7)) >> 4; 391 + press_comp += (var1 + var2 + var3 + ((s32)calib->par_p7 << 7)) >> 4; 393 392 394 393 return press_comp; 395 394 } ··· 415 414 (((temp_scaled * ((temp_scaled * calib->par_h5) / 100)) 416 415 >> 6) / 100) + (1 << 14))) >> 10; 417 416 var3 = var1 * var2; 418 - var4 = calib->par_h6 << 7; 417 + var4 = (s32)calib->par_h6 << 7; 419 418 var4 = (var4 + ((temp_scaled * calib->par_h7) / 100)) >> 4; 420 419 var5 = ((var3 >> 14) * (var3 >> 14)) >> 10; 421 420 var6 = (var4 * var5) >> 1; ··· 533 532 return ilog2(val) + 1; 534 533 } 535 534 535 + /* 536 + * Taken from Bosch BME680 API: 537 + * https://github.com/boschsensortec/BME68x_SensorAPI/blob/v4.4.8/bme68x.c#L490 538 + */ 539 + static int bme680_wait_for_eoc(struct bme680_data *data) 540 + { 541 + struct device *dev = regmap_get_device(data->regmap); 542 + unsigned int check; 543 + int ret; 544 + /* 545 + * (Sum of oversampling ratios * time per oversampling) + 546 + * TPH measurement + gas measurement + wait transition from forced mode 547 + * + heater duration 548 + */ 549 + int wait_eoc_us = ((data->oversampling_temp + data->oversampling_press + 550 + data->oversampling_humid) * 1936) + (477 * 4) + 551 + (477 * 5) + 1000 + (data->heater_dur * 1000); 552 + 553 + usleep_range(wait_eoc_us, wait_eoc_us + 100); 554 + 555 + ret = regmap_read(data->regmap, BME680_REG_MEAS_STAT_0, &check); 556 + if (ret) { 557 + dev_err(dev, "failed to read measurement status register.\n"); 558 + return ret; 559 + } 560 + if (check & BME680_MEAS_BIT) { 561 + dev_err(dev, "Device measurement cycle incomplete.\n"); 562 + return -EBUSY; 563 + } 564 + if (!(check & BME680_NEW_DATA_BIT)) { 565 + dev_err(dev, "No new data available from the device.\n"); 566 + return -ENODATA; 567 + } 568 + 569 + return 0; 570 + } 571 + 536 572 static int bme680_chip_config(struct bme680_data *data) 537 573 { 538 574 struct device *dev = regmap_get_device(data->regmap); ··· 660 622 if (ret < 0) 661 623 return ret; 662 624 625 + ret = bme680_wait_for_eoc(data); 626 + if (ret) 627 + return ret; 628 + 663 629 ret = regmap_bulk_read(data->regmap, BME680_REG_TEMP_MSB, 664 630 &tmp, 3); 665 631 if (ret < 0) { ··· 720 678 } 721 679 722 680 *val = bme680_compensate_press(data, adc_press); 723 - *val2 = 100; 681 + *val2 = 1000; 724 682 return IIO_VAL_FRACTIONAL; 725 683 } 726 684 ··· 778 736 /* set forced mode to trigger measurement */ 779 737 ret = bme680_set_mode(data, true); 780 738 if (ret < 0) 739 + return ret; 740 + 741 + ret = bme680_wait_for_eoc(data); 742 + if (ret) 781 743 return ret; 782 744 783 745 ret = regmap_read(data->regmap, BME680_REG_MEAS_STAT_0, &check);
+1 -1
drivers/iio/dac/Kconfig
··· 133 133 134 134 config AD9739A 135 135 tristate "Analog Devices AD9739A RF DAC spi driver" 136 - depends on SPI || COMPILE_TEST 136 + depends on SPI 137 137 select REGMAP_SPI 138 138 select IIO_BACKEND 139 139 help
+248 -75
drivers/iio/humidity/hdc3020.c
··· 19 19 #include <linux/i2c.h> 20 20 #include <linux/init.h> 21 21 #include <linux/interrupt.h> 22 + #include <linux/math64.h> 22 23 #include <linux/module.h> 23 24 #include <linux/mutex.h> 24 25 #include <linux/pm.h> ··· 67 66 68 67 #define HDC3020_CRC8_POLYNOMIAL 0x31 69 68 70 - #define HDC3020_MIN_TEMP -40 71 - #define HDC3020_MAX_TEMP 125 69 + #define HDC3020_MIN_TEMP_MICRO -39872968 70 + #define HDC3020_MAX_TEMP_MICRO 124875639 71 + #define HDC3020_MAX_TEMP_HYST_MICRO 164748607 72 + #define HDC3020_MAX_HUM_MICRO 99220264 72 73 73 74 struct hdc3020_data { 74 75 struct i2c_client *client; ··· 371 368 return -EINVAL; 372 369 } 373 370 371 + static int hdc3020_thresh_get_temp(u16 thresh) 372 + { 373 + int temp; 374 + 375 + /* 376 + * Get the temperature threshold from 9 LSBs, shift them to get 377 + * the truncated temperature threshold representation and 378 + * calculate the threshold according to the formula in the 379 + * datasheet. Result is degree celsius scaled by 65535. 380 + */ 381 + temp = FIELD_GET(HDC3020_THRESH_TEMP_MASK, thresh) << 382 + HDC3020_THRESH_TEMP_TRUNC_SHIFT; 383 + 384 + return -2949075 + (175 * temp); 385 + } 386 + 387 + static int hdc3020_thresh_get_hum(u16 thresh) 388 + { 389 + int hum; 390 + 391 + /* 392 + * Get the humidity threshold from 7 MSBs, shift them to get the 393 + * truncated humidity threshold representation and calculate the 394 + * threshold according to the formula in the datasheet. Result is 395 + * percent scaled by 65535. 396 + */ 397 + hum = FIELD_GET(HDC3020_THRESH_HUM_MASK, thresh) << 398 + HDC3020_THRESH_HUM_TRUNC_SHIFT; 399 + 400 + return hum * 100; 401 + } 402 + 403 + static u16 hdc3020_thresh_set_temp(int s_temp, u16 curr_thresh) 404 + { 405 + u64 temp; 406 + u16 thresh; 407 + 408 + /* 409 + * Calculate temperature threshold, shift it down to get the 410 + * truncated threshold representation in the 9LSBs while keeping 411 + * the current humidity threshold in the 7 MSBs. 412 + */ 413 + temp = (u64)(s_temp + 45000000) * 65535ULL; 414 + temp = div_u64(temp, 1000000 * 175) >> HDC3020_THRESH_TEMP_TRUNC_SHIFT; 415 + thresh = FIELD_PREP(HDC3020_THRESH_TEMP_MASK, temp); 416 + thresh |= (FIELD_GET(HDC3020_THRESH_HUM_MASK, curr_thresh) << 417 + HDC3020_THRESH_HUM_TRUNC_SHIFT); 418 + 419 + return thresh; 420 + } 421 + 422 + static u16 hdc3020_thresh_set_hum(int s_hum, u16 curr_thresh) 423 + { 424 + u64 hum; 425 + u16 thresh; 426 + 427 + /* 428 + * Calculate humidity threshold, shift it down and up to get the 429 + * truncated threshold representation in the 7MSBs while keeping 430 + * the current temperature threshold in the 9 LSBs. 431 + */ 432 + hum = (u64)(s_hum) * 65535ULL; 433 + hum = div_u64(hum, 1000000 * 100) >> HDC3020_THRESH_HUM_TRUNC_SHIFT; 434 + thresh = FIELD_PREP(HDC3020_THRESH_HUM_MASK, hum); 435 + thresh |= FIELD_GET(HDC3020_THRESH_TEMP_MASK, curr_thresh); 436 + 437 + return thresh; 438 + } 439 + 440 + static 441 + int hdc3020_thresh_clr(s64 s_thresh, s64 s_hyst, enum iio_event_direction dir) 442 + { 443 + s64 s_clr; 444 + 445 + /* 446 + * Include directions when calculation the clear value, 447 + * since hysteresis is unsigned by definition and the 448 + * clear value is an absolute value which is signed. 449 + */ 450 + if (dir == IIO_EV_DIR_RISING) 451 + s_clr = s_thresh - s_hyst; 452 + else 453 + s_clr = s_thresh + s_hyst; 454 + 455 + /* Divide by 65535 to get units of micro */ 456 + return div_s64(s_clr, 65535); 457 + } 458 + 459 + static int _hdc3020_write_thresh(struct hdc3020_data *data, u16 reg, u16 val) 460 + { 461 + u8 buf[5]; 462 + 463 + put_unaligned_be16(reg, buf); 464 + put_unaligned_be16(val, buf + 2); 465 + buf[4] = crc8(hdc3020_crc8_table, buf + 2, 2, CRC8_INIT_VALUE); 466 + 467 + return hdc3020_write_bytes(data, buf, 5); 468 + } 469 + 374 470 static int hdc3020_write_thresh(struct iio_dev *indio_dev, 375 471 const struct iio_chan_spec *chan, 376 472 enum iio_event_type type, ··· 478 376 int val, int val2) 479 377 { 480 378 struct hdc3020_data *data = iio_priv(indio_dev); 481 - u8 buf[5]; 482 - u64 tmp; 483 - u16 reg; 484 - int ret; 379 + u16 reg, reg_val, reg_thresh_rd, reg_clr_rd, reg_thresh_wr, reg_clr_wr; 380 + s64 s_thresh, s_hyst, s_clr; 381 + int s_val, thresh, clr, ret; 485 382 486 - /* Supported temperature range is from –40 to 125 degree celsius */ 487 - if (val < HDC3020_MIN_TEMP || val > HDC3020_MAX_TEMP) 488 - return -EINVAL; 489 - 490 - /* Select threshold register */ 491 - if (info == IIO_EV_INFO_VALUE) { 492 - if (dir == IIO_EV_DIR_RISING) 493 - reg = HDC3020_S_T_RH_THRESH_HIGH; 494 - else 495 - reg = HDC3020_S_T_RH_THRESH_LOW; 383 + /* Select threshold registers */ 384 + if (dir == IIO_EV_DIR_RISING) { 385 + reg_thresh_rd = HDC3020_R_T_RH_THRESH_HIGH; 386 + reg_thresh_wr = HDC3020_S_T_RH_THRESH_HIGH; 387 + reg_clr_rd = HDC3020_R_T_RH_THRESH_HIGH_CLR; 388 + reg_clr_wr = HDC3020_S_T_RH_THRESH_HIGH_CLR; 496 389 } else { 497 - if (dir == IIO_EV_DIR_RISING) 498 - reg = HDC3020_S_T_RH_THRESH_HIGH_CLR; 499 - else 500 - reg = HDC3020_S_T_RH_THRESH_LOW_CLR; 390 + reg_thresh_rd = HDC3020_R_T_RH_THRESH_LOW; 391 + reg_thresh_wr = HDC3020_S_T_RH_THRESH_LOW; 392 + reg_clr_rd = HDC3020_R_T_RH_THRESH_LOW_CLR; 393 + reg_clr_wr = HDC3020_S_T_RH_THRESH_LOW_CLR; 501 394 } 502 395 503 396 guard(mutex)(&data->lock); 504 - ret = hdc3020_read_be16(data, reg); 397 + ret = hdc3020_read_be16(data, reg_thresh_rd); 505 398 if (ret < 0) 506 399 return ret; 507 400 401 + thresh = ret; 402 + ret = hdc3020_read_be16(data, reg_clr_rd); 403 + if (ret < 0) 404 + return ret; 405 + 406 + clr = ret; 407 + /* Scale value to include decimal part into calculations */ 408 + s_val = (val < 0) ? (val * 1000000 - val2) : (val * 1000000 + val2); 508 409 switch (chan->type) { 509 410 case IIO_TEMP: 510 - /* 511 - * Calculate temperature threshold, shift it down to get the 512 - * truncated threshold representation in the 9LSBs while keeping 513 - * the current humidity threshold in the 7 MSBs. 514 - */ 515 - tmp = ((u64)(((val + 45) * MICRO) + val2)) * 65535ULL; 516 - tmp = div_u64(tmp, MICRO * 175); 517 - val = tmp >> HDC3020_THRESH_TEMP_TRUNC_SHIFT; 518 - val = FIELD_PREP(HDC3020_THRESH_TEMP_MASK, val); 519 - val |= (FIELD_GET(HDC3020_THRESH_HUM_MASK, ret) << 520 - HDC3020_THRESH_HUM_TRUNC_SHIFT); 411 + switch (info) { 412 + case IIO_EV_INFO_VALUE: 413 + s_val = max(s_val, HDC3020_MIN_TEMP_MICRO); 414 + s_val = min(s_val, HDC3020_MAX_TEMP_MICRO); 415 + reg = reg_thresh_wr; 416 + reg_val = hdc3020_thresh_set_temp(s_val, thresh); 417 + ret = _hdc3020_write_thresh(data, reg, reg_val); 418 + if (ret < 0) 419 + return ret; 420 + 421 + /* Calculate old hysteresis */ 422 + s_thresh = (s64)hdc3020_thresh_get_temp(thresh) * 1000000; 423 + s_clr = (s64)hdc3020_thresh_get_temp(clr) * 1000000; 424 + s_hyst = div_s64(abs(s_thresh - s_clr), 65535); 425 + /* Set new threshold */ 426 + thresh = reg_val; 427 + /* Set old hysteresis */ 428 + s_val = s_hyst; 429 + fallthrough; 430 + case IIO_EV_INFO_HYSTERESIS: 431 + /* 432 + * Function hdc3020_thresh_get_temp returns temperature 433 + * in degree celsius scaled by 65535. Scale by 1000000 434 + * to be able to subtract scaled hysteresis value. 435 + */ 436 + s_thresh = (s64)hdc3020_thresh_get_temp(thresh) * 1000000; 437 + /* 438 + * Units of s_val are in micro degree celsius, scale by 439 + * 65535 to get same units as s_thresh. 440 + */ 441 + s_val = min(abs(s_val), HDC3020_MAX_TEMP_HYST_MICRO); 442 + s_hyst = (s64)s_val * 65535; 443 + s_clr = hdc3020_thresh_clr(s_thresh, s_hyst, dir); 444 + s_clr = max(s_clr, HDC3020_MIN_TEMP_MICRO); 445 + s_clr = min(s_clr, HDC3020_MAX_TEMP_MICRO); 446 + reg = reg_clr_wr; 447 + reg_val = hdc3020_thresh_set_temp(s_clr, clr); 448 + break; 449 + default: 450 + return -EOPNOTSUPP; 451 + } 521 452 break; 522 453 case IIO_HUMIDITYRELATIVE: 523 - /* 524 - * Calculate humidity threshold, shift it down and up to get the 525 - * truncated threshold representation in the 7MSBs while keeping 526 - * the current temperature threshold in the 9 LSBs. 527 - */ 528 - tmp = ((u64)((val * MICRO) + val2)) * 65535ULL; 529 - tmp = div_u64(tmp, MICRO * 100); 530 - val = tmp >> HDC3020_THRESH_HUM_TRUNC_SHIFT; 531 - val = FIELD_PREP(HDC3020_THRESH_HUM_MASK, val); 532 - val |= FIELD_GET(HDC3020_THRESH_TEMP_MASK, ret); 454 + s_val = (s_val < 0) ? 0 : min(s_val, HDC3020_MAX_HUM_MICRO); 455 + switch (info) { 456 + case IIO_EV_INFO_VALUE: 457 + reg = reg_thresh_wr; 458 + reg_val = hdc3020_thresh_set_hum(s_val, thresh); 459 + ret = _hdc3020_write_thresh(data, reg, reg_val); 460 + if (ret < 0) 461 + return ret; 462 + 463 + /* Calculate old hysteresis */ 464 + s_thresh = (s64)hdc3020_thresh_get_hum(thresh) * 1000000; 465 + s_clr = (s64)hdc3020_thresh_get_hum(clr) * 1000000; 466 + s_hyst = div_s64(abs(s_thresh - s_clr), 65535); 467 + /* Set new threshold */ 468 + thresh = reg_val; 469 + /* Try to set old hysteresis */ 470 + s_val = min(abs(s_hyst), HDC3020_MAX_HUM_MICRO); 471 + fallthrough; 472 + case IIO_EV_INFO_HYSTERESIS: 473 + /* 474 + * Function hdc3020_thresh_get_hum returns relative 475 + * humidity in percent scaled by 65535. Scale by 1000000 476 + * to be able to subtract scaled hysteresis value. 477 + */ 478 + s_thresh = (s64)hdc3020_thresh_get_hum(thresh) * 1000000; 479 + /* 480 + * Units of s_val are in micro percent, scale by 65535 481 + * to get same units as s_thresh. 482 + */ 483 + s_hyst = (s64)s_val * 65535; 484 + s_clr = hdc3020_thresh_clr(s_thresh, s_hyst, dir); 485 + s_clr = max(s_clr, 0); 486 + s_clr = min(s_clr, HDC3020_MAX_HUM_MICRO); 487 + reg = reg_clr_wr; 488 + reg_val = hdc3020_thresh_set_hum(s_clr, clr); 489 + break; 490 + default: 491 + return -EOPNOTSUPP; 492 + } 533 493 break; 534 494 default: 535 495 return -EOPNOTSUPP; 536 496 } 537 497 538 - put_unaligned_be16(reg, buf); 539 - put_unaligned_be16(val, buf + 2); 540 - buf[4] = crc8(hdc3020_crc8_table, buf + 2, 2, CRC8_INIT_VALUE); 541 - return hdc3020_write_bytes(data, buf, 5); 498 + return _hdc3020_write_thresh(data, reg, reg_val); 542 499 } 543 500 544 501 static int hdc3020_read_thresh(struct iio_dev *indio_dev, ··· 608 447 int *val, int *val2) 609 448 { 610 449 struct hdc3020_data *data = iio_priv(indio_dev); 611 - u16 reg; 612 - int ret; 450 + u16 reg_thresh, reg_clr; 451 + int thresh, clr, ret; 613 452 614 - /* Select threshold register */ 615 - if (info == IIO_EV_INFO_VALUE) { 616 - if (dir == IIO_EV_DIR_RISING) 617 - reg = HDC3020_R_T_RH_THRESH_HIGH; 618 - else 619 - reg = HDC3020_R_T_RH_THRESH_LOW; 453 + /* Select threshold registers */ 454 + if (dir == IIO_EV_DIR_RISING) { 455 + reg_thresh = HDC3020_R_T_RH_THRESH_HIGH; 456 + reg_clr = HDC3020_R_T_RH_THRESH_HIGH_CLR; 620 457 } else { 621 - if (dir == IIO_EV_DIR_RISING) 622 - reg = HDC3020_R_T_RH_THRESH_HIGH_CLR; 623 - else 624 - reg = HDC3020_R_T_RH_THRESH_LOW_CLR; 458 + reg_thresh = HDC3020_R_T_RH_THRESH_LOW; 459 + reg_clr = HDC3020_R_T_RH_THRESH_LOW_CLR; 625 460 } 626 461 627 462 guard(mutex)(&data->lock); 628 - ret = hdc3020_read_be16(data, reg); 463 + ret = hdc3020_read_be16(data, reg_thresh); 629 464 if (ret < 0) 630 465 return ret; 631 466 632 467 switch (chan->type) { 633 468 case IIO_TEMP: 634 - /* 635 - * Get the temperature threshold from 9 LSBs, shift them to get 636 - * the truncated temperature threshold representation and 637 - * calculate the threshold according to the formula in the 638 - * datasheet. 639 - */ 640 - *val = FIELD_GET(HDC3020_THRESH_TEMP_MASK, ret); 641 - *val = *val << HDC3020_THRESH_TEMP_TRUNC_SHIFT; 642 - *val = -2949075 + (175 * (*val)); 469 + thresh = hdc3020_thresh_get_temp(ret); 470 + switch (info) { 471 + case IIO_EV_INFO_VALUE: 472 + *val = thresh; 473 + break; 474 + case IIO_EV_INFO_HYSTERESIS: 475 + ret = hdc3020_read_be16(data, reg_clr); 476 + if (ret < 0) 477 + return ret; 478 + 479 + clr = hdc3020_thresh_get_temp(ret); 480 + *val = abs(thresh - clr); 481 + break; 482 + default: 483 + return -EOPNOTSUPP; 484 + } 643 485 *val2 = 65535; 644 486 return IIO_VAL_FRACTIONAL; 645 487 case IIO_HUMIDITYRELATIVE: 646 - /* 647 - * Get the humidity threshold from 7 MSBs, shift them to get the 648 - * truncated humidity threshold representation and calculate the 649 - * threshold according to the formula in the datasheet. 650 - */ 651 - *val = FIELD_GET(HDC3020_THRESH_HUM_MASK, ret); 652 - *val = (*val << HDC3020_THRESH_HUM_TRUNC_SHIFT) * 100; 488 + thresh = hdc3020_thresh_get_hum(ret); 489 + switch (info) { 490 + case IIO_EV_INFO_VALUE: 491 + *val = thresh; 492 + break; 493 + case IIO_EV_INFO_HYSTERESIS: 494 + ret = hdc3020_read_be16(data, reg_clr); 495 + if (ret < 0) 496 + return ret; 497 + 498 + clr = hdc3020_thresh_get_hum(ret); 499 + *val = abs(thresh - clr); 500 + break; 501 + default: 502 + return -EOPNOTSUPP; 503 + } 653 504 *val2 = 65535; 654 505 return IIO_VAL_FRACTIONAL; 655 506 default:
+1
drivers/iommu/amd/init.c
··· 2743 2743 iommu_enable_command_buffer(iommu); 2744 2744 iommu_enable_event_buffer(iommu); 2745 2745 iommu_set_exclusion_range(iommu); 2746 + iommu_enable_gt(iommu); 2746 2747 iommu_enable_ga(iommu); 2747 2748 iommu_enable_xt(iommu); 2748 2749 iommu_enable_irtcachedis(iommu);
+6 -6
drivers/iommu/amd/iommu.c
··· 2061 2061 struct protection_domain *domain = dev_data->domain; 2062 2062 struct amd_iommu *iommu = get_amd_iommu_from_dev_data(dev_data); 2063 2063 2064 + /* Clear DTE and flush the entry */ 2065 + amd_iommu_dev_update_dte(dev_data, false); 2066 + 2067 + /* Flush IOTLB and wait for the flushes to finish */ 2068 + amd_iommu_domain_flush_all(domain); 2069 + 2064 2070 /* Clear GCR3 table */ 2065 2071 if (pdom_is_sva_capable(domain)) 2066 2072 destroy_gcr3_table(dev_data, domain); ··· 2074 2068 /* Update data structures */ 2075 2069 dev_data->domain = NULL; 2076 2070 list_del(&dev_data->list); 2077 - 2078 - /* Clear DTE and flush the entry */ 2079 - amd_iommu_dev_update_dte(dev_data, false); 2080 - 2081 - /* Flush IOTLB and wait for the flushes to finish */ 2082 - amd_iommu_domain_flush_all(domain); 2083 2071 2084 2072 /* decrease reference counters - needs to happen after the flushes */ 2085 2073 domain->dev_iommu[iommu->index] -= 1;
+10 -10
drivers/iommu/intel/iommu.c
··· 2114 2114 if (ret) 2115 2115 return ret; 2116 2116 2117 - ret = cache_tag_assign_domain(domain, dev, IOMMU_NO_PASID); 2118 - if (ret) { 2119 - domain_detach_iommu(domain, iommu); 2120 - return ret; 2121 - } 2122 - 2123 2117 info->domain = domain; 2124 2118 spin_lock_irqsave(&domain->lock, flags); 2125 2119 list_add(&info->link, &domain->devices); ··· 2131 2137 else 2132 2138 ret = intel_pasid_setup_second_level(iommu, domain, dev, IOMMU_NO_PASID); 2133 2139 2134 - if (ret) { 2135 - device_block_translation(dev); 2136 - return ret; 2137 - } 2140 + if (ret) 2141 + goto out_block_translation; 2138 2142 2139 2143 if (sm_supported(info->iommu) || !domain_type_is_si(info->domain)) 2140 2144 iommu_enable_pci_caps(info); 2141 2145 2146 + ret = cache_tag_assign_domain(domain, dev, IOMMU_NO_PASID); 2147 + if (ret) 2148 + goto out_block_translation; 2149 + 2142 2150 return 0; 2151 + 2152 + out_block_translation: 2153 + device_block_translation(dev); 2154 + return ret; 2143 2155 } 2144 2156 2145 2157 /**
+3 -2
drivers/irqchip/irq-loongson-eiointc.c
··· 15 15 #include <linux/irqchip/chained_irq.h> 16 16 #include <linux/kernel.h> 17 17 #include <linux/syscore_ops.h> 18 + #include <asm/numa.h> 18 19 19 20 #define EIOINTC_REG_NODEMAP 0x14a0 20 21 #define EIOINTC_REG_IPMAP 0x14c0 ··· 340 339 int node; 341 340 342 341 if (cpu_has_flatmode) 343 - node = cpu_to_node(eiointc_priv[nr_pics - 1]->node * CORES_PER_EIO_NODE); 342 + node = early_cpu_to_node(eiointc_priv[nr_pics - 1]->node * CORES_PER_EIO_NODE); 344 343 else 345 344 node = eiointc_priv[nr_pics - 1]->node; 346 345 ··· 432 431 goto out_free_handle; 433 432 434 433 if (cpu_has_flatmode) 435 - node = cpu_to_node(acpi_eiointc->node * CORES_PER_EIO_NODE); 434 + node = early_cpu_to_node(acpi_eiointc->node * CORES_PER_EIO_NODE); 436 435 else 437 436 node = acpi_eiointc->node; 438 437 acpi_set_vec_parent(node, priv->eiointc_domain, pch_group);
+2 -2
drivers/irqchip/irq-loongson-liointc.c
··· 28 28 29 29 #define LIOINTC_INTC_CHIP_START 0x20 30 30 31 - #define LIOINTC_REG_INTC_STATUS (LIOINTC_INTC_CHIP_START + 0x20) 31 + #define LIOINTC_REG_INTC_STATUS(core) (LIOINTC_INTC_CHIP_START + 0x20 + (core) * 8) 32 32 #define LIOINTC_REG_INTC_EN_STATUS (LIOINTC_INTC_CHIP_START + 0x04) 33 33 #define LIOINTC_REG_INTC_ENABLE (LIOINTC_INTC_CHIP_START + 0x08) 34 34 #define LIOINTC_REG_INTC_DISABLE (LIOINTC_INTC_CHIP_START + 0x0c) ··· 217 217 goto out_free_priv; 218 218 219 219 for (i = 0; i < LIOINTC_NUM_CORES; i++) 220 - priv->core_isr[i] = base + LIOINTC_REG_INTC_STATUS; 220 + priv->core_isr[i] = base + LIOINTC_REG_INTC_STATUS(i); 221 221 222 222 for (i = 0; i < LIOINTC_NUM_PARENT; i++) 223 223 priv->handler[i].parent_int_map = parent_int_map[i];
+1 -1
drivers/media/pci/intel/ipu6/ipu6-isys-video.c
··· 943 943 return NULL; 944 944 945 945 if (source < 0) { 946 - dev_err(&stream->isys->adev->auxdev.dev, 946 + dev_err(&isys->adev->auxdev.dev, 947 947 "query stream with invalid port number\n"); 948 948 return NULL; 949 949 }
+1 -1
drivers/media/pci/intel/ipu6/ipu6-isys.c
··· 799 799 isys->v4l2_dev.mdev = &isys->media_dev; 800 800 isys->v4l2_dev.ctrl_handler = NULL; 801 801 802 - ret = v4l2_device_register(&pdev->dev, &isys->v4l2_dev); 802 + ret = v4l2_device_register(dev, &isys->v4l2_dev); 803 803 if (ret < 0) 804 804 goto out_media_device_unregister; 805 805
+1
drivers/media/pci/intel/ivsc/Kconfig
··· 4 4 config INTEL_VSC 5 5 tristate "Intel Visual Sensing Controller" 6 6 depends on INTEL_MEI && ACPI && VIDEO_DEV 7 + depends on IPU_BRIDGE || !IPU_BRIDGE 7 8 select MEDIA_CONTROLLER 8 9 select VIDEO_V4L2_SUBDEV_API 9 10 select V4L2_FWNODE
+43 -35
drivers/mmc/host/moxart-mmc.c
··· 131 131 struct dma_async_tx_descriptor *tx_desc; 132 132 struct mmc_host *mmc; 133 133 struct mmc_request *mrq; 134 + struct scatterlist *cur_sg; 134 135 struct completion dma_complete; 135 136 struct completion pio_complete; 136 137 137 - struct sg_mapping_iter sg_miter; 138 + u32 num_sg; 139 + u32 data_remain; 138 140 u32 data_len; 139 141 u32 fifo_width; 140 142 u32 timeout; ··· 147 145 bool have_dma; 148 146 bool is_removed; 149 147 }; 148 + 149 + static inline void moxart_init_sg(struct moxart_host *host, 150 + struct mmc_data *data) 151 + { 152 + host->cur_sg = data->sg; 153 + host->num_sg = data->sg_len; 154 + host->data_remain = host->cur_sg->length; 155 + 156 + if (host->data_remain > host->data_len) 157 + host->data_remain = host->data_len; 158 + } 159 + 160 + static inline int moxart_next_sg(struct moxart_host *host) 161 + { 162 + int remain; 163 + struct mmc_data *data = host->mrq->cmd->data; 164 + 165 + host->cur_sg++; 166 + host->num_sg--; 167 + 168 + if (host->num_sg > 0) { 169 + host->data_remain = host->cur_sg->length; 170 + remain = host->data_len - data->bytes_xfered; 171 + if (remain > 0 && remain < host->data_remain) 172 + host->data_remain = remain; 173 + } 174 + 175 + return host->num_sg; 176 + } 150 177 151 178 static int moxart_wait_for_status(struct moxart_host *host, 152 179 u32 mask, u32 *status) ··· 309 278 310 279 static void moxart_transfer_pio(struct moxart_host *host) 311 280 { 312 - struct sg_mapping_iter *sgm = &host->sg_miter; 313 281 struct mmc_data *data = host->mrq->cmd->data; 314 282 u32 *sgp, len = 0, remain, status; 315 283 316 284 if (host->data_len == data->bytes_xfered) 317 285 return; 318 286 319 - /* 320 - * By updating sgm->consumes this will get a proper pointer into the 321 - * buffer at any time. 322 - */ 323 - if (!sg_miter_next(sgm)) { 324 - /* This shold not happen */ 325 - dev_err(mmc_dev(host->mmc), "ran out of scatterlist prematurely\n"); 326 - data->error = -EINVAL; 327 - complete(&host->pio_complete); 328 - return; 329 - } 330 - sgp = sgm->addr; 331 - remain = sgm->length; 332 - if (remain > host->data_len) 333 - remain = host->data_len; 334 - sgm->consumed = 0; 287 + sgp = sg_virt(host->cur_sg); 288 + remain = host->data_remain; 335 289 336 290 if (data->flags & MMC_DATA_WRITE) { 337 291 while (remain > 0) { ··· 331 315 sgp++; 332 316 len += 4; 333 317 } 334 - sgm->consumed += len; 335 318 remain -= len; 336 319 } 337 320 ··· 347 332 sgp++; 348 333 len += 4; 349 334 } 350 - sgm->consumed += len; 351 335 remain -= len; 352 336 } 353 337 } 354 338 355 - data->bytes_xfered += sgm->consumed; 356 - if (host->data_len == data->bytes_xfered) { 339 + data->bytes_xfered += host->data_remain - remain; 340 + host->data_remain = remain; 341 + 342 + if (host->data_len != data->bytes_xfered) 343 + moxart_next_sg(host); 344 + else 357 345 complete(&host->pio_complete); 358 - return; 359 - } 360 346 } 361 347 362 348 static void moxart_prepare_data(struct moxart_host *host) 363 349 { 364 350 struct mmc_data *data = host->mrq->cmd->data; 365 - unsigned int flags = SG_MITER_ATOMIC; /* Used from IRQ */ 366 351 u32 datactrl; 367 352 int blksz_bits; 368 353 ··· 373 358 blksz_bits = ffs(data->blksz) - 1; 374 359 BUG_ON(1 << blksz_bits != data->blksz); 375 360 361 + moxart_init_sg(host, data); 362 + 376 363 datactrl = DCR_DATA_EN | (blksz_bits & DCR_BLK_SIZE); 377 364 378 - if (data->flags & MMC_DATA_WRITE) { 379 - flags |= SG_MITER_FROM_SG; 365 + if (data->flags & MMC_DATA_WRITE) 380 366 datactrl |= DCR_DATA_WRITE; 381 - } else { 382 - flags |= SG_MITER_TO_SG; 383 - } 384 367 385 368 if (moxart_use_dma(host)) 386 369 datactrl |= DCR_DMA_EN; 387 - else 388 - sg_miter_start(&host->sg_miter, data->sg, data->sg_len, flags); 389 370 390 371 writel(DCR_DATA_FIFO_RESET, host->base + REG_DATA_CONTROL); 391 372 writel(MASK_DATA | FIFO_URUN | FIFO_ORUN, host->base + REG_CLEAR); ··· 454 443 } 455 444 456 445 request_done: 457 - if (!moxart_use_dma(host)) 458 - sg_miter_stop(&host->sg_miter); 459 - 460 446 spin_unlock_irqrestore(&host->lock, flags); 461 447 mmc_request_done(host->mmc, mrq); 462 448 }
+4
drivers/mmc/host/sdhci-brcmstb.c
··· 24 24 #define BRCMSTB_MATCH_FLAGS_NO_64BIT BIT(0) 25 25 #define BRCMSTB_MATCH_FLAGS_BROKEN_TIMEOUT BIT(1) 26 26 #define BRCMSTB_MATCH_FLAGS_HAS_CLOCK_GATE BIT(2) 27 + #define BRCMSTB_MATCH_FLAGS_USE_CARD_BUSY BIT(4) 27 28 28 29 #define BRCMSTB_PRIV_FLAGS_HAS_CQE BIT(0) 29 30 #define BRCMSTB_PRIV_FLAGS_GATE_CLOCK BIT(1) ··· 384 383 385 384 if (match_priv->flags & BRCMSTB_MATCH_FLAGS_BROKEN_TIMEOUT) 386 385 host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; 386 + 387 + if (!(match_priv->flags & BRCMSTB_MATCH_FLAGS_USE_CARD_BUSY)) 388 + host->mmc_host_ops.card_busy = NULL; 387 389 388 390 /* Change the base clock frequency if the DT property exists */ 389 391 if (device_property_read_u32(&pdev->dev, "clock-frequency",
+7 -4
drivers/mmc/host/sdhci-pci-core.c
··· 1326 1326 1327 1327 ret = pci_read_config_byte(chip->pdev, 0xAE, &scratch); 1328 1328 if (ret) 1329 - return ret; 1329 + goto fail; 1330 1330 1331 1331 /* 1332 1332 * Turn PMOS on [bit 0], set over current detection to 2.4 V ··· 1337 1337 else 1338 1338 scratch &= ~0x47; 1339 1339 1340 - return pci_write_config_byte(chip->pdev, 0xAE, scratch); 1340 + ret = pci_write_config_byte(chip->pdev, 0xAE, scratch); 1341 + 1342 + fail: 1343 + return pcibios_err_to_errno(ret); 1341 1344 } 1342 1345 1343 1346 static int jmicron_probe(struct sdhci_pci_chip *chip) ··· 2205 2202 2206 2203 ret = pci_read_config_byte(pdev, PCI_SLOT_INFO, &slots); 2207 2204 if (ret) 2208 - return ret; 2205 + return pcibios_err_to_errno(ret); 2209 2206 2210 2207 slots = PCI_SLOT_INFO_SLOTS(slots) + 1; 2211 2208 dev_dbg(&pdev->dev, "found %d slot(s)\n", slots); ··· 2214 2211 2215 2212 ret = pci_read_config_byte(pdev, PCI_SLOT_INFO, &first_bar); 2216 2213 if (ret) 2217 - return ret; 2214 + return pcibios_err_to_errno(ret); 2218 2215 2219 2216 first_bar &= PCI_SLOT_INFO_FIRST_BAR_MASK; 2220 2217
+22 -19
drivers/mmc/host/sdhci-pci-o2micro.c
··· 823 823 ret = pci_read_config_byte(chip->pdev, 824 824 O2_SD_LOCK_WP, &scratch); 825 825 if (ret) 826 - return ret; 826 + goto read_fail; 827 827 scratch &= 0x7f; 828 828 pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch); 829 829 ··· 834 834 ret = pci_read_config_byte(chip->pdev, 835 835 O2_SD_CLKREQ, &scratch); 836 836 if (ret) 837 - return ret; 837 + goto read_fail; 838 838 scratch |= 0x20; 839 839 pci_write_config_byte(chip->pdev, O2_SD_CLKREQ, scratch); 840 840 ··· 843 843 */ 844 844 ret = pci_read_config_byte(chip->pdev, O2_SD_CAPS, &scratch); 845 845 if (ret) 846 - return ret; 846 + goto read_fail; 847 847 scratch |= 0x01; 848 848 pci_write_config_byte(chip->pdev, O2_SD_CAPS, scratch); 849 849 pci_write_config_byte(chip->pdev, O2_SD_CAPS, 0x73); ··· 856 856 ret = pci_read_config_byte(chip->pdev, 857 857 O2_SD_INF_MOD, &scratch); 858 858 if (ret) 859 - return ret; 859 + goto read_fail; 860 860 scratch |= 0x08; 861 861 pci_write_config_byte(chip->pdev, O2_SD_INF_MOD, scratch); 862 862 ··· 864 864 ret = pci_read_config_byte(chip->pdev, 865 865 O2_SD_LOCK_WP, &scratch); 866 866 if (ret) 867 - return ret; 867 + goto read_fail; 868 868 scratch |= 0x80; 869 869 pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch); 870 870 break; ··· 875 875 ret = pci_read_config_byte(chip->pdev, 876 876 O2_SD_LOCK_WP, &scratch); 877 877 if (ret) 878 - return ret; 878 + goto read_fail; 879 879 880 880 scratch &= 0x7f; 881 881 pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch); ··· 886 886 O2_SD_FUNC_REG0, 887 887 &scratch_32); 888 888 if (ret) 889 - return ret; 889 + goto read_fail; 890 890 scratch_32 = ((scratch_32 & 0xFF000000) >> 24); 891 891 892 892 /* Check Whether subId is 0x11 or 0x12 */ ··· 898 898 O2_SD_FUNC_REG4, 899 899 &scratch_32); 900 900 if (ret) 901 - return ret; 901 + goto read_fail; 902 902 903 903 /* Enable Base Clk setting change */ 904 904 scratch_32 |= O2_SD_FREG4_ENABLE_CLK_SET; ··· 921 921 ret = pci_read_config_dword(chip->pdev, 922 922 O2_SD_CLK_SETTING, &scratch_32); 923 923 if (ret) 924 - return ret; 924 + goto read_fail; 925 925 926 926 scratch_32 &= ~(0xFF00); 927 927 scratch_32 |= 0x07E0C800; ··· 931 931 ret = pci_read_config_dword(chip->pdev, 932 932 O2_SD_CLKREQ, &scratch_32); 933 933 if (ret) 934 - return ret; 934 + goto read_fail; 935 935 scratch_32 |= 0x3; 936 936 pci_write_config_dword(chip->pdev, O2_SD_CLKREQ, scratch_32); 937 937 938 938 ret = pci_read_config_dword(chip->pdev, 939 939 O2_SD_PLL_SETTING, &scratch_32); 940 940 if (ret) 941 - return ret; 941 + goto read_fail; 942 942 943 943 scratch_32 &= ~(0x1F3F070E); 944 944 scratch_32 |= 0x18270106; ··· 949 949 ret = pci_read_config_dword(chip->pdev, 950 950 O2_SD_CAP_REG2, &scratch_32); 951 951 if (ret) 952 - return ret; 952 + goto read_fail; 953 953 scratch_32 &= ~(0xE0); 954 954 pci_write_config_dword(chip->pdev, 955 955 O2_SD_CAP_REG2, scratch_32); ··· 961 961 ret = pci_read_config_byte(chip->pdev, 962 962 O2_SD_LOCK_WP, &scratch); 963 963 if (ret) 964 - return ret; 964 + goto read_fail; 965 965 scratch |= 0x80; 966 966 pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch); 967 967 break; ··· 971 971 ret = pci_read_config_byte(chip->pdev, 972 972 O2_SD_LOCK_WP, &scratch); 973 973 if (ret) 974 - return ret; 974 + goto read_fail; 975 975 976 976 scratch &= 0x7f; 977 977 pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch); ··· 979 979 ret = pci_read_config_dword(chip->pdev, 980 980 O2_SD_PLL_SETTING, &scratch_32); 981 981 if (ret) 982 - return ret; 982 + goto read_fail; 983 983 984 984 if ((scratch_32 & 0xff000000) == 0x01000000) { 985 985 scratch_32 &= 0x0000FFFF; ··· 998 998 O2_SD_FUNC_REG4, 999 999 &scratch_32); 1000 1000 if (ret) 1001 - return ret; 1001 + goto read_fail; 1002 1002 scratch_32 |= (1 << 22); 1003 1003 pci_write_config_dword(chip->pdev, 1004 1004 O2_SD_FUNC_REG4, scratch_32); ··· 1017 1017 ret = pci_read_config_byte(chip->pdev, 1018 1018 O2_SD_LOCK_WP, &scratch); 1019 1019 if (ret) 1020 - return ret; 1020 + goto read_fail; 1021 1021 scratch |= 0x80; 1022 1022 pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch); 1023 1023 break; ··· 1028 1028 /* UnLock WP */ 1029 1029 ret = pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch); 1030 1030 if (ret) 1031 - return ret; 1031 + goto read_fail; 1032 1032 scratch &= 0x7f; 1033 1033 pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch); 1034 1034 ··· 1057 1057 /* Lock WP */ 1058 1058 ret = pci_read_config_byte(chip->pdev, O2_SD_LOCK_WP, &scratch); 1059 1059 if (ret) 1060 - return ret; 1060 + goto read_fail; 1061 1061 scratch |= 0x80; 1062 1062 pci_write_config_byte(chip->pdev, O2_SD_LOCK_WP, scratch); 1063 1063 break; 1064 1064 } 1065 1065 1066 1066 return 0; 1067 + 1068 + read_fail: 1069 + return pcibios_err_to_errno(ret); 1067 1070 } 1068 1071 1069 1072 #ifdef CONFIG_PM_SLEEP
+14 -11
drivers/mmc/host/sdhci.c
··· 2515 2515 2516 2516 static int sdhci_check_ro(struct sdhci_host *host) 2517 2517 { 2518 - unsigned long flags; 2518 + bool allow_invert = false; 2519 2519 int is_readonly; 2520 2520 2521 - spin_lock_irqsave(&host->lock, flags); 2522 - 2523 - if (host->flags & SDHCI_DEVICE_DEAD) 2521 + if (host->flags & SDHCI_DEVICE_DEAD) { 2524 2522 is_readonly = 0; 2525 - else if (host->ops->get_ro) 2523 + } else if (host->ops->get_ro) { 2526 2524 is_readonly = host->ops->get_ro(host); 2527 - else if (mmc_can_gpio_ro(host->mmc)) 2525 + } else if (mmc_can_gpio_ro(host->mmc)) { 2528 2526 is_readonly = mmc_gpio_get_ro(host->mmc); 2529 - else 2527 + /* Do not invert twice */ 2528 + allow_invert = !(host->mmc->caps2 & MMC_CAP2_RO_ACTIVE_HIGH); 2529 + } else { 2530 2530 is_readonly = !(sdhci_readl(host, SDHCI_PRESENT_STATE) 2531 2531 & SDHCI_WRITE_PROTECT); 2532 + allow_invert = true; 2533 + } 2532 2534 2533 - spin_unlock_irqrestore(&host->lock, flags); 2535 + if (is_readonly >= 0 && 2536 + allow_invert && 2537 + (host->quirks & SDHCI_QUIRK_INVERTED_WRITE_PROTECT)) 2538 + is_readonly = !is_readonly; 2534 2539 2535 - /* This quirk needs to be replaced by a callback-function later */ 2536 - return host->quirks & SDHCI_QUIRK_INVERTED_WRITE_PROTECT ? 2537 - !is_readonly : is_readonly; 2540 + return is_readonly; 2538 2541 } 2539 2542 2540 2543 #define SAMPLE_COUNT 5
+41 -27
drivers/mtd/nand/raw/nand_base.c
··· 1093 1093 unsigned int offset_in_page) 1094 1094 { 1095 1095 struct mtd_info *mtd = nand_to_mtd(chip); 1096 + bool ident_stage = !mtd->writesize; 1096 1097 1097 - /* Make sure the offset is less than the actual page size. */ 1098 - if (offset_in_page > mtd->writesize + mtd->oobsize) 1099 - return -EINVAL; 1100 - 1101 - /* 1102 - * On small page NANDs, there's a dedicated command to access the OOB 1103 - * area, and the column address is relative to the start of the OOB 1104 - * area, not the start of the page. Asjust the address accordingly. 1105 - */ 1106 - if (mtd->writesize <= 512 && offset_in_page >= mtd->writesize) 1107 - offset_in_page -= mtd->writesize; 1108 - 1109 - /* 1110 - * The offset in page is expressed in bytes, if the NAND bus is 16-bit 1111 - * wide, then it must be divided by 2. 1112 - */ 1113 - if (chip->options & NAND_BUSWIDTH_16) { 1114 - if (WARN_ON(offset_in_page % 2)) 1098 + /* Bypass all checks during NAND identification */ 1099 + if (likely(!ident_stage)) { 1100 + /* Make sure the offset is less than the actual page size. */ 1101 + if (offset_in_page > mtd->writesize + mtd->oobsize) 1115 1102 return -EINVAL; 1116 1103 1117 - offset_in_page /= 2; 1104 + /* 1105 + * On small page NANDs, there's a dedicated command to access the OOB 1106 + * area, and the column address is relative to the start of the OOB 1107 + * area, not the start of the page. Asjust the address accordingly. 1108 + */ 1109 + if (mtd->writesize <= 512 && offset_in_page >= mtd->writesize) 1110 + offset_in_page -= mtd->writesize; 1111 + 1112 + /* 1113 + * The offset in page is expressed in bytes, if the NAND bus is 16-bit 1114 + * wide, then it must be divided by 2. 1115 + */ 1116 + if (chip->options & NAND_BUSWIDTH_16) { 1117 + if (WARN_ON(offset_in_page % 2)) 1118 + return -EINVAL; 1119 + 1120 + offset_in_page /= 2; 1121 + } 1118 1122 } 1119 1123 1120 1124 addrs[0] = offset_in_page; ··· 1127 1123 * Small page NANDs use 1 cycle for the columns, while large page NANDs 1128 1124 * need 2 1129 1125 */ 1130 - if (mtd->writesize <= 512) 1126 + if (!ident_stage && mtd->writesize <= 512) 1131 1127 return 1; 1132 1128 1133 1129 addrs[1] = offset_in_page >> 8; ··· 1440 1436 unsigned int len, bool force_8bit) 1441 1437 { 1442 1438 struct mtd_info *mtd = nand_to_mtd(chip); 1439 + bool ident_stage = !mtd->writesize; 1443 1440 1444 1441 if (len && !buf) 1445 1442 return -EINVAL; 1446 1443 1447 - if (offset_in_page + len > mtd->writesize + mtd->oobsize) 1448 - return -EINVAL; 1444 + if (!ident_stage) { 1445 + if (offset_in_page + len > mtd->writesize + mtd->oobsize) 1446 + return -EINVAL; 1449 1447 1450 - /* Small page NANDs do not support column change. */ 1451 - if (mtd->writesize <= 512) 1452 - return -ENOTSUPP; 1448 + /* Small page NANDs do not support column change. */ 1449 + if (mtd->writesize <= 512) 1450 + return -ENOTSUPP; 1451 + } 1453 1452 1454 1453 if (nand_has_exec_op(chip)) { 1455 1454 const struct nand_interface_config *conf = ··· 2180 2173 int nand_read_data_op(struct nand_chip *chip, void *buf, unsigned int len, 2181 2174 bool force_8bit, bool check_only) 2182 2175 { 2183 - if (!len || !buf) 2176 + if (!len || (!check_only && !buf)) 2184 2177 return -EINVAL; 2185 2178 2186 2179 if (nand_has_exec_op(chip)) { ··· 6308 6301 static int nand_scan_tail(struct nand_chip *chip) 6309 6302 { 6310 6303 struct mtd_info *mtd = nand_to_mtd(chip); 6304 + struct nand_device *base = &chip->base; 6311 6305 struct nand_ecc_ctrl *ecc = &chip->ecc; 6312 6306 int ret, i; 6313 6307 ··· 6453 6445 if (!ecc->write_oob_raw) 6454 6446 ecc->write_oob_raw = ecc->write_oob; 6455 6447 6456 - /* propagate ecc info to mtd_info */ 6448 + /* Propagate ECC info to the generic NAND and MTD layers */ 6457 6449 mtd->ecc_strength = ecc->strength; 6450 + if (!base->ecc.ctx.conf.strength) 6451 + base->ecc.ctx.conf.strength = ecc->strength; 6458 6452 mtd->ecc_step_size = ecc->size; 6453 + if (!base->ecc.ctx.conf.step_size) 6454 + base->ecc.ctx.conf.step_size = ecc->size; 6459 6455 6460 6456 /* 6461 6457 * Set the number of read / write steps for one page depending on ECC ··· 6467 6455 */ 6468 6456 if (!ecc->steps) 6469 6457 ecc->steps = mtd->writesize / ecc->size; 6458 + if (!base->ecc.ctx.nsteps) 6459 + base->ecc.ctx.nsteps = ecc->steps; 6470 6460 if (ecc->steps * ecc->size != mtd->writesize) { 6471 6461 WARN(1, "Invalid ECC parameters\n"); 6472 6462 ret = -EINVAL;
+3 -3
drivers/mtd/nand/raw/rockchip-nand-controller.c
··· 420 420 u32 rate, tc2rw, trwpw, trw2c; 421 421 u32 temp; 422 422 423 - if (target < 0) 424 - return 0; 425 - 426 423 timings = nand_get_sdr_timings(conf); 427 424 if (IS_ERR(timings)) 428 425 return -EOPNOTSUPP; 426 + 427 + if (target < 0) 428 + return 0; 429 429 430 430 if (IS_ERR(nfc->nfc_clk)) 431 431 rate = clk_get_rate(nfc->ahb_clk);
+3 -3
drivers/net/bonding/bond_options.c
··· 1214 1214 __be32 target; 1215 1215 1216 1216 if (newval->string) { 1217 - if (!in4_pton(newval->string+1, -1, (u8 *)&target, -1, NULL)) { 1218 - netdev_err(bond->dev, "invalid ARP target %pI4 specified\n", 1219 - &target); 1217 + if (strlen(newval->string) < 1 || 1218 + !in4_pton(newval->string + 1, -1, (u8 *)&target, -1, NULL)) { 1219 + netdev_err(bond->dev, "invalid ARP target specified\n"); 1220 1220 return ret; 1221 1221 } 1222 1222 if (newval->string[0] == '+')
+1
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
··· 128 128 129 129 static const struct kvaser_usb_driver_info kvaser_usb_driver_info_leafimx = { 130 130 .quirks = 0, 131 + .family = KVASER_LEAF, 131 132 .ops = &kvaser_usb_leaf_dev_ops, 132 133 }; 133 134
+1 -1
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
··· 1262 1262 1263 1263 struct bnx2x_fw_stats_req { 1264 1264 struct stats_query_header hdr; 1265 - struct stats_query_entry query[FP_SB_MAX_E1x+ 1265 + struct stats_query_entry query[FP_SB_MAX_E2 + 1266 1266 BNX2X_FIRST_QUEUE_QUERY_IDX]; 1267 1267 }; 1268 1268
+5 -1
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 12851 12851 if (!BNXT_NEW_RM(bp)) 12852 12852 return true; 12853 12853 12854 - if (hwr.vnic == bp->hw_resc.resv_vnics && 12854 + /* Do not reduce VNIC and RSS ctx reservations. There is a FW 12855 + * issue that will mess up the default VNIC if we reduce the 12856 + * reservations. 12857 + */ 12858 + if (hwr.vnic <= bp->hw_resc.resv_vnics && 12855 12859 hwr.rss_ctx <= bp->hw_resc.resv_rsscos_ctxs) 12856 12860 return true; 12857 12861
+66 -66
drivers/net/ethernet/intel/e1000e/netdev.c
··· 6363 6363 mac_data |= E1000_EXTCNF_CTRL_GATE_PHY_CFG; 6364 6364 ew32(EXTCNF_CTRL, mac_data); 6365 6365 6366 - /* Enable the Dynamic Power Gating in the MAC */ 6367 - mac_data = er32(FEXTNVM7); 6368 - mac_data |= BIT(22); 6369 - ew32(FEXTNVM7, mac_data); 6370 - 6371 6366 /* Disable disconnected cable conditioning for Power Gating */ 6372 6367 mac_data = er32(DPGFR); 6373 6368 mac_data |= BIT(2); 6374 6369 ew32(DPGFR, mac_data); 6375 6370 6376 - /* Don't wake from dynamic Power Gating with clock request */ 6377 - mac_data = er32(FEXTNVM12); 6378 - mac_data |= BIT(12); 6379 - ew32(FEXTNVM12, mac_data); 6380 - 6381 - /* Ungate PGCB clock */ 6382 - mac_data = er32(FEXTNVM9); 6383 - mac_data &= ~BIT(28); 6384 - ew32(FEXTNVM9, mac_data); 6385 - 6386 - /* Enable K1 off to enable mPHY Power Gating */ 6387 - mac_data = er32(FEXTNVM6); 6388 - mac_data |= BIT(31); 6389 - ew32(FEXTNVM6, mac_data); 6390 - 6391 - /* Enable mPHY power gating for any link and speed */ 6392 - mac_data = er32(FEXTNVM8); 6393 - mac_data |= BIT(9); 6394 - ew32(FEXTNVM8, mac_data); 6395 - 6396 6371 /* Enable the Dynamic Clock Gating in the DMA and MAC */ 6397 6372 mac_data = er32(CTRL_EXT); 6398 6373 mac_data |= E1000_CTRL_EXT_DMA_DYN_CLK_EN; 6399 6374 ew32(CTRL_EXT, mac_data); 6400 - 6401 - /* No MAC DPG gating SLP_S0 in modern standby 6402 - * Switch the logic of the lanphypc to use PMC counter 6403 - */ 6404 - mac_data = er32(FEXTNVM5); 6405 - mac_data |= BIT(7); 6406 - ew32(FEXTNVM5, mac_data); 6407 6375 } 6376 + 6377 + /* Enable the Dynamic Power Gating in the MAC */ 6378 + mac_data = er32(FEXTNVM7); 6379 + mac_data |= BIT(22); 6380 + ew32(FEXTNVM7, mac_data); 6381 + 6382 + /* Don't wake from dynamic Power Gating with clock request */ 6383 + mac_data = er32(FEXTNVM12); 6384 + mac_data |= BIT(12); 6385 + ew32(FEXTNVM12, mac_data); 6386 + 6387 + /* Ungate PGCB clock */ 6388 + mac_data = er32(FEXTNVM9); 6389 + mac_data &= ~BIT(28); 6390 + ew32(FEXTNVM9, mac_data); 6391 + 6392 + /* Enable K1 off to enable mPHY Power Gating */ 6393 + mac_data = er32(FEXTNVM6); 6394 + mac_data |= BIT(31); 6395 + ew32(FEXTNVM6, mac_data); 6396 + 6397 + /* Enable mPHY power gating for any link and speed */ 6398 + mac_data = er32(FEXTNVM8); 6399 + mac_data |= BIT(9); 6400 + ew32(FEXTNVM8, mac_data); 6401 + 6402 + /* No MAC DPG gating SLP_S0 in modern standby 6403 + * Switch the logic of the lanphypc to use PMC counter 6404 + */ 6405 + mac_data = er32(FEXTNVM5); 6406 + mac_data |= BIT(7); 6407 + ew32(FEXTNVM5, mac_data); 6408 6408 6409 6409 /* Disable the time synchronization clock */ 6410 6410 mac_data = er32(FEXTNVM7); ··· 6498 6498 } else { 6499 6499 /* Request driver unconfigure the device from S0ix */ 6500 6500 6501 - /* Disable the Dynamic Power Gating in the MAC */ 6502 - mac_data = er32(FEXTNVM7); 6503 - mac_data &= 0xFFBFFFFF; 6504 - ew32(FEXTNVM7, mac_data); 6505 - 6506 - /* Disable mPHY power gating for any link and speed */ 6507 - mac_data = er32(FEXTNVM8); 6508 - mac_data &= ~BIT(9); 6509 - ew32(FEXTNVM8, mac_data); 6510 - 6511 - /* Disable K1 off */ 6512 - mac_data = er32(FEXTNVM6); 6513 - mac_data &= ~BIT(31); 6514 - ew32(FEXTNVM6, mac_data); 6515 - 6516 - /* Disable Ungate PGCB clock */ 6517 - mac_data = er32(FEXTNVM9); 6518 - mac_data |= BIT(28); 6519 - ew32(FEXTNVM9, mac_data); 6520 - 6521 - /* Cancel not waking from dynamic 6522 - * Power Gating with clock request 6523 - */ 6524 - mac_data = er32(FEXTNVM12); 6525 - mac_data &= ~BIT(12); 6526 - ew32(FEXTNVM12, mac_data); 6527 - 6528 6501 /* Cancel disable disconnected cable conditioning 6529 6502 * for Power Gating 6530 6503 */ ··· 6509 6536 mac_data = er32(CTRL_EXT); 6510 6537 mac_data &= 0xFFF7FFFF; 6511 6538 ew32(CTRL_EXT, mac_data); 6512 - 6513 - /* Revert the lanphypc logic to use the internal Gbe counter 6514 - * and not the PMC counter 6515 - */ 6516 - mac_data = er32(FEXTNVM5); 6517 - mac_data &= 0xFFFFFF7F; 6518 - ew32(FEXTNVM5, mac_data); 6519 6539 6520 6540 /* Enable the periodic inband message, 6521 6541 * Request PCIe clock in K1 page770_17[10:9] =01b ··· 6547 6581 mac_data &= ~BIT(31); 6548 6582 mac_data |= BIT(0); 6549 6583 ew32(FEXTNVM7, mac_data); 6584 + 6585 + /* Disable the Dynamic Power Gating in the MAC */ 6586 + mac_data = er32(FEXTNVM7); 6587 + mac_data &= 0xFFBFFFFF; 6588 + ew32(FEXTNVM7, mac_data); 6589 + 6590 + /* Disable mPHY power gating for any link and speed */ 6591 + mac_data = er32(FEXTNVM8); 6592 + mac_data &= ~BIT(9); 6593 + ew32(FEXTNVM8, mac_data); 6594 + 6595 + /* Disable K1 off */ 6596 + mac_data = er32(FEXTNVM6); 6597 + mac_data &= ~BIT(31); 6598 + ew32(FEXTNVM6, mac_data); 6599 + 6600 + /* Disable Ungate PGCB clock */ 6601 + mac_data = er32(FEXTNVM9); 6602 + mac_data |= BIT(28); 6603 + ew32(FEXTNVM9, mac_data); 6604 + 6605 + /* Cancel not waking from dynamic 6606 + * Power Gating with clock request 6607 + */ 6608 + mac_data = er32(FEXTNVM12); 6609 + mac_data &= ~BIT(12); 6610 + ew32(FEXTNVM12, mac_data); 6611 + 6612 + /* Revert the lanphypc logic to use the internal Gbe counter 6613 + * and not the PMC counter 6614 + */ 6615 + mac_data = er32(FEXTNVM5); 6616 + mac_data &= 0xFFFFFF7F; 6617 + ew32(FEXTNVM5, mac_data); 6550 6618 } 6551 6619 6552 6620 static int e1000e_pm_freeze(struct device *dev)
+1 -1
drivers/net/ethernet/intel/ice/ice_hwmon.c
··· 96 96 97 97 unsigned long sensors = pf->hw.dev_caps.supported_sensors; 98 98 99 - return _test_bit(ICE_SENSOR_SUPPORT_E810_INT_TEMP_BIT, &sensors); 99 + return test_bit(ICE_SENSOR_SUPPORT_E810_INT_TEMP_BIT, &sensors); 100 100 }; 101 101 102 102 void ice_hwmon_init(struct ice_pf *pf)
+101 -30
drivers/net/ethernet/intel/ice/ice_ptp.c
··· 1618 1618 u8 chan, tmr_idx; 1619 1619 u32 hi, lo; 1620 1620 1621 + /* Don't process timestamp events if PTP is not ready */ 1622 + if (pf->ptp.state != ICE_PTP_READY) 1623 + return; 1624 + 1621 1625 tmr_idx = hw->func_caps.ts_func_info.tmr_index_owned; 1622 1626 /* Event time is captured by one of the two matched registers 1623 1627 * GLTSYN_EVNT_L: 32 LSB of sampled time event ··· 1647 1643 /** 1648 1644 * ice_ptp_cfg_extts - Configure EXTTS pin and channel 1649 1645 * @pf: Board private structure 1650 - * @ena: true to enable; false to disable 1651 1646 * @chan: GPIO channel (0-3) 1652 - * @gpio_pin: GPIO pin 1653 - * @extts_flags: request flags from the ptp_extts_request.flags 1647 + * @config: desired EXTTS configuration. 1648 + * @store: If set to true, the values will be stored 1649 + * 1650 + * Configure an external timestamp event on the requested channel. 1651 + * 1652 + * Return: 0 on success, -EOPNOTUSPP on unsupported flags 1654 1653 */ 1655 - static int 1656 - ice_ptp_cfg_extts(struct ice_pf *pf, bool ena, unsigned int chan, u32 gpio_pin, 1657 - unsigned int extts_flags) 1654 + static int ice_ptp_cfg_extts(struct ice_pf *pf, unsigned int chan, 1655 + struct ice_extts_channel *config, bool store) 1658 1656 { 1659 1657 u32 func, aux_reg, gpio_reg, irq_reg; 1660 1658 struct ice_hw *hw = &pf->hw; 1661 1659 u8 tmr_idx; 1662 1660 1663 - if (chan > (unsigned int)pf->ptp.info.n_ext_ts) 1664 - return -EINVAL; 1661 + /* Reject requests with unsupported flags */ 1662 + if (config->flags & ~(PTP_ENABLE_FEATURE | 1663 + PTP_RISING_EDGE | 1664 + PTP_FALLING_EDGE | 1665 + PTP_STRICT_FLAGS)) 1666 + return -EOPNOTSUPP; 1665 1667 1666 1668 tmr_idx = hw->func_caps.ts_func_info.tmr_index_owned; 1667 1669 1668 1670 irq_reg = rd32(hw, PFINT_OICR_ENA); 1669 1671 1670 - if (ena) { 1672 + if (config->ena) { 1671 1673 /* Enable the interrupt */ 1672 1674 irq_reg |= PFINT_OICR_TSYN_EVNT_M; 1673 1675 aux_reg = GLTSYN_AUX_IN_0_INT_ENA_M; ··· 1682 1672 #define GLTSYN_AUX_IN_0_EVNTLVL_FALLING_EDGE BIT(1) 1683 1673 1684 1674 /* set event level to requested edge */ 1685 - if (extts_flags & PTP_FALLING_EDGE) 1675 + if (config->flags & PTP_FALLING_EDGE) 1686 1676 aux_reg |= GLTSYN_AUX_IN_0_EVNTLVL_FALLING_EDGE; 1687 - if (extts_flags & PTP_RISING_EDGE) 1677 + if (config->flags & PTP_RISING_EDGE) 1688 1678 aux_reg |= GLTSYN_AUX_IN_0_EVNTLVL_RISING_EDGE; 1689 1679 1690 1680 /* Write GPIO CTL reg. ··· 1705 1695 1706 1696 wr32(hw, PFINT_OICR_ENA, irq_reg); 1707 1697 wr32(hw, GLTSYN_AUX_IN(chan, tmr_idx), aux_reg); 1708 - wr32(hw, GLGEN_GPIO_CTL(gpio_pin), gpio_reg); 1698 + wr32(hw, GLGEN_GPIO_CTL(config->gpio_pin), gpio_reg); 1699 + 1700 + if (store) 1701 + memcpy(&pf->ptp.extts_channels[chan], config, sizeof(*config)); 1709 1702 1710 1703 return 0; 1704 + } 1705 + 1706 + /** 1707 + * ice_ptp_disable_all_extts - Disable all EXTTS channels 1708 + * @pf: Board private structure 1709 + */ 1710 + static void ice_ptp_disable_all_extts(struct ice_pf *pf) 1711 + { 1712 + struct ice_extts_channel extts_cfg = {}; 1713 + int i; 1714 + 1715 + for (i = 0; i < pf->ptp.info.n_ext_ts; i++) { 1716 + if (pf->ptp.extts_channels[i].ena) { 1717 + extts_cfg.gpio_pin = pf->ptp.extts_channels[i].gpio_pin; 1718 + extts_cfg.ena = false; 1719 + ice_ptp_cfg_extts(pf, i, &extts_cfg, false); 1720 + } 1721 + } 1722 + 1723 + synchronize_irq(pf->oicr_irq.virq); 1724 + } 1725 + 1726 + /** 1727 + * ice_ptp_enable_all_extts - Enable all EXTTS channels 1728 + * @pf: Board private structure 1729 + * 1730 + * Called during reset to restore user configuration. 1731 + */ 1732 + static void ice_ptp_enable_all_extts(struct ice_pf *pf) 1733 + { 1734 + int i; 1735 + 1736 + for (i = 0; i < pf->ptp.info.n_ext_ts; i++) { 1737 + if (pf->ptp.extts_channels[i].ena) 1738 + ice_ptp_cfg_extts(pf, i, &pf->ptp.extts_channels[i], 1739 + false); 1740 + } 1711 1741 } 1712 1742 1713 1743 /** ··· 1767 1717 struct ice_hw *hw = &pf->hw; 1768 1718 u32 func, val, gpio_pin; 1769 1719 u8 tmr_idx; 1720 + 1721 + if (config && config->flags & ~PTP_PEROUT_PHASE) 1722 + return -EOPNOTSUPP; 1770 1723 1771 1724 tmr_idx = hw->func_caps.ts_func_info.tmr_index_owned; 1772 1725 ··· 1906 1853 struct ptp_clock_request *rq, int on) 1907 1854 { 1908 1855 struct ice_pf *pf = ptp_info_to_pf(info); 1909 - struct ice_perout_channel clk_cfg = {0}; 1910 1856 bool sma_pres = false; 1911 1857 unsigned int chan; 1912 1858 u32 gpio_pin; 1913 - int err; 1914 1859 1915 1860 if (ice_is_feature_supported(pf, ICE_F_SMA_CTRL)) 1916 1861 sma_pres = true; 1917 1862 1918 1863 switch (rq->type) { 1919 1864 case PTP_CLK_REQ_PEROUT: 1865 + { 1866 + struct ice_perout_channel clk_cfg = {}; 1867 + 1920 1868 chan = rq->perout.index; 1921 1869 if (sma_pres) { 1922 1870 if (chan == ice_pin_desc_e810t[SMA1].chan) ··· 1937 1883 clk_cfg.gpio_pin = chan; 1938 1884 } 1939 1885 1886 + clk_cfg.flags = rq->perout.flags; 1940 1887 clk_cfg.period = ((rq->perout.period.sec * NSEC_PER_SEC) + 1941 1888 rq->perout.period.nsec); 1942 1889 clk_cfg.start_time = ((rq->perout.start.sec * NSEC_PER_SEC) + 1943 1890 rq->perout.start.nsec); 1944 1891 clk_cfg.ena = !!on; 1945 1892 1946 - err = ice_ptp_cfg_clkout(pf, chan, &clk_cfg, true); 1947 - break; 1893 + return ice_ptp_cfg_clkout(pf, chan, &clk_cfg, true); 1894 + } 1948 1895 case PTP_CLK_REQ_EXTTS: 1896 + { 1897 + struct ice_extts_channel extts_cfg = {}; 1898 + 1949 1899 chan = rq->extts.index; 1950 1900 if (sma_pres) { 1951 1901 if (chan < ice_pin_desc_e810t[SMA2].chan) ··· 1965 1907 gpio_pin = chan; 1966 1908 } 1967 1909 1968 - err = ice_ptp_cfg_extts(pf, !!on, chan, gpio_pin, 1969 - rq->extts.flags); 1970 - break; 1910 + extts_cfg.flags = rq->extts.flags; 1911 + extts_cfg.gpio_pin = gpio_pin; 1912 + extts_cfg.ena = !!on; 1913 + 1914 + return ice_ptp_cfg_extts(pf, chan, &extts_cfg, true); 1915 + } 1971 1916 default: 1972 1917 return -EOPNOTSUPP; 1973 1918 } 1974 - 1975 - return err; 1976 1919 } 1977 1920 1978 1921 /** ··· 1986 1927 struct ptp_clock_request *rq, int on) 1987 1928 { 1988 1929 struct ice_pf *pf = ptp_info_to_pf(info); 1989 - struct ice_perout_channel clk_cfg = {0}; 1990 - int err; 1991 1930 1992 1931 switch (rq->type) { 1993 1932 case PTP_CLK_REQ_PPS: 1933 + { 1934 + struct ice_perout_channel clk_cfg = {}; 1935 + 1936 + clk_cfg.flags = rq->perout.flags; 1994 1937 clk_cfg.gpio_pin = PPS_PIN_INDEX; 1995 1938 clk_cfg.period = NSEC_PER_SEC; 1996 1939 clk_cfg.ena = !!on; 1997 1940 1998 - err = ice_ptp_cfg_clkout(pf, PPS_CLK_GEN_CHAN, &clk_cfg, true); 1999 - break; 1941 + return ice_ptp_cfg_clkout(pf, PPS_CLK_GEN_CHAN, &clk_cfg, true); 1942 + } 2000 1943 case PTP_CLK_REQ_EXTTS: 2001 - err = ice_ptp_cfg_extts(pf, !!on, rq->extts.index, 2002 - TIME_SYNC_PIN_INDEX, rq->extts.flags); 2003 - break; 1944 + { 1945 + struct ice_extts_channel extts_cfg = {}; 1946 + 1947 + extts_cfg.flags = rq->extts.flags; 1948 + extts_cfg.gpio_pin = TIME_SYNC_PIN_INDEX; 1949 + extts_cfg.ena = !!on; 1950 + 1951 + return ice_ptp_cfg_extts(pf, rq->extts.index, &extts_cfg, true); 1952 + } 2004 1953 default: 2005 1954 return -EOPNOTSUPP; 2006 1955 } 2007 - 2008 - return err; 2009 1956 } 2010 1957 2011 1958 /** ··· 2846 2781 ice_ptp_restart_all_phy(pf); 2847 2782 } 2848 2783 2784 + /* Re-enable all periodic outputs and external timestamp events */ 2785 + ice_ptp_enable_all_clkout(pf); 2786 + ice_ptp_enable_all_extts(pf); 2787 + 2849 2788 return 0; 2850 2789 } 2851 2790 ··· 3408 3339 ice_ptp_remove_auxbus_device(pf); 3409 3340 3410 3341 ice_ptp_release_tx_tracker(pf, &pf->ptp.port.tx); 3342 + 3343 + ice_ptp_disable_all_extts(pf); 3411 3344 3412 3345 kthread_cancel_delayed_work_sync(&pf->ptp.work); 3413 3346
+9
drivers/net/ethernet/intel/ice/ice_ptp.h
··· 29 29 struct ice_perout_channel { 30 30 bool ena; 31 31 u32 gpio_pin; 32 + u32 flags; 32 33 u64 period; 33 34 u64 start_time; 35 + }; 36 + 37 + struct ice_extts_channel { 38 + bool ena; 39 + u32 gpio_pin; 40 + u32 flags; 34 41 }; 35 42 36 43 /* The ice hardware captures Tx hardware timestamps in the PHY. The timestamp ··· 234 227 * @ext_ts_irq: the external timestamp IRQ in use 235 228 * @kworker: kwork thread for handling periodic work 236 229 * @perout_channels: periodic output data 230 + * @extts_channels: channels for external timestamps 237 231 * @info: structure defining PTP hardware capabilities 238 232 * @clock: pointer to registered PTP clock device 239 233 * @tstamp_config: hardware timestamping configuration ··· 258 250 u8 ext_ts_irq; 259 251 struct kthread_worker *kworker; 260 252 struct ice_perout_channel perout_channels[GLTSYN_TGT_H_IDX_MAX]; 253 + struct ice_extts_channel extts_channels[GLTSYN_TGT_H_IDX_MAX]; 261 254 struct ptp_clock_info info; 262 255 struct ptp_clock *clock; 263 256 struct hwtstamp_config tstamp_config;
+34 -12
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
··· 989 989 struct mlx5e_ipsec_sa_entry *sa_entry = to_ipsec_sa_entry(x); 990 990 struct mlx5e_ipsec_rule *ipsec_rule = &sa_entry->ipsec_rule; 991 991 struct net *net = dev_net(x->xso.dev); 992 + u64 trailer_packets = 0, trailer_bytes = 0; 993 + u64 replay_packets = 0, replay_bytes = 0; 994 + u64 auth_packets = 0, auth_bytes = 0; 995 + u64 success_packets, success_bytes; 992 996 u64 packets, bytes, lastuse; 997 + size_t headers; 993 998 994 999 lockdep_assert(lockdep_is_held(&x->lock) || 995 1000 lockdep_is_held(&dev_net(x->xso.real_dev)->xfrm.xfrm_cfg_mutex) || ··· 1004 999 return; 1005 1000 1006 1001 if (sa_entry->attrs.dir == XFRM_DEV_OFFLOAD_IN) { 1007 - mlx5_fc_query_cached(ipsec_rule->auth.fc, &bytes, &packets, &lastuse); 1008 - x->stats.integrity_failed += packets; 1009 - XFRM_ADD_STATS(net, LINUX_MIB_XFRMINSTATEPROTOERROR, packets); 1002 + mlx5_fc_query_cached(ipsec_rule->auth.fc, &auth_bytes, 1003 + &auth_packets, &lastuse); 1004 + x->stats.integrity_failed += auth_packets; 1005 + XFRM_ADD_STATS(net, LINUX_MIB_XFRMINSTATEPROTOERROR, auth_packets); 1010 1006 1011 - mlx5_fc_query_cached(ipsec_rule->trailer.fc, &bytes, &packets, &lastuse); 1012 - XFRM_ADD_STATS(net, LINUX_MIB_XFRMINHDRERROR, packets); 1007 + mlx5_fc_query_cached(ipsec_rule->trailer.fc, &trailer_bytes, 1008 + &trailer_packets, &lastuse); 1009 + XFRM_ADD_STATS(net, LINUX_MIB_XFRMINHDRERROR, trailer_packets); 1013 1010 } 1014 1011 1015 1012 if (x->xso.type != XFRM_DEV_OFFLOAD_PACKET) 1016 1013 return; 1017 1014 1018 - mlx5_fc_query_cached(ipsec_rule->fc, &bytes, &packets, &lastuse); 1019 - x->curlft.packets += packets; 1020 - x->curlft.bytes += bytes; 1021 - 1022 1015 if (sa_entry->attrs.dir == XFRM_DEV_OFFLOAD_IN) { 1023 - mlx5_fc_query_cached(ipsec_rule->replay.fc, &bytes, &packets, &lastuse); 1024 - x->stats.replay += packets; 1025 - XFRM_ADD_STATS(net, LINUX_MIB_XFRMINSTATESEQERROR, packets); 1016 + mlx5_fc_query_cached(ipsec_rule->replay.fc, &replay_bytes, 1017 + &replay_packets, &lastuse); 1018 + x->stats.replay += replay_packets; 1019 + XFRM_ADD_STATS(net, LINUX_MIB_XFRMINSTATESEQERROR, replay_packets); 1026 1020 } 1021 + 1022 + mlx5_fc_query_cached(ipsec_rule->fc, &bytes, &packets, &lastuse); 1023 + success_packets = packets - auth_packets - trailer_packets - replay_packets; 1024 + x->curlft.packets += success_packets; 1025 + /* NIC counts all bytes passed through flow steering and doesn't have 1026 + * an ability to count payload data size which is needed for SA. 1027 + * 1028 + * To overcome HW limitestion, let's approximate the payload size 1029 + * by removing always available headers. 1030 + */ 1031 + headers = sizeof(struct ethhdr); 1032 + if (sa_entry->attrs.family == AF_INET) 1033 + headers += sizeof(struct iphdr); 1034 + else 1035 + headers += sizeof(struct ipv6hdr); 1036 + 1037 + success_bytes = bytes - auth_bytes - trailer_bytes - replay_bytes; 1038 + x->curlft.bytes += success_bytes - headers * success_packets; 1027 1039 } 1028 1040 1029 1041 static int mlx5e_xfrm_validate_policy(struct mlx5_core_dev *mdev,
+5
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 6034 6034 kfree(priv->htb_qos_sq_stats[i]); 6035 6035 kvfree(priv->htb_qos_sq_stats); 6036 6036 6037 + if (priv->mqprio_rl) { 6038 + mlx5e_mqprio_rl_cleanup(priv->mqprio_rl); 6039 + mlx5e_mqprio_rl_free(priv->mqprio_rl); 6040 + } 6041 + 6037 6042 memset(priv, 0, sizeof(*priv)); 6038 6043 } 6039 6044
+1 -3
drivers/net/ethernet/mellanox/mlx5/core/eq.c
··· 1197 1197 if (!mlx5_core_is_eth_enabled(dev) && mlx5_eth_supported(dev)) 1198 1198 return 1; 1199 1199 1200 - max_dev_eqs = MLX5_CAP_GEN(dev, max_num_eqs) ? 1201 - MLX5_CAP_GEN(dev, max_num_eqs) : 1202 - 1 << MLX5_CAP_GEN(dev, log_max_eq); 1200 + max_dev_eqs = mlx5_max_eq_cap_get(dev); 1203 1201 1204 1202 num_eqs = min_t(int, mlx5_irq_table_get_num_comp(eq_table->irq_table), 1205 1203 max_dev_eqs - MLX5_MAX_ASYNC_EQS);
+29 -8
drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c
··· 6 6 #include "helper.h" 7 7 #include "ofld.h" 8 8 9 + static int 10 + acl_ingress_ofld_setup(struct mlx5_eswitch *esw, struct mlx5_vport *vport); 11 + 9 12 static bool 10 13 esw_acl_ingress_prio_tag_enabled(struct mlx5_eswitch *esw, 11 14 const struct mlx5_vport *vport) ··· 126 123 { 127 124 struct mlx5_flow_act flow_act = {}; 128 125 struct mlx5_flow_handle *flow_rule; 126 + bool created = false; 129 127 int err = 0; 128 + 129 + if (!vport->ingress.acl) { 130 + err = acl_ingress_ofld_setup(esw, vport); 131 + if (err) 132 + return err; 133 + created = true; 134 + } 130 135 131 136 flow_act.action = MLX5_FLOW_CONTEXT_ACTION_DROP; 132 137 flow_act.fg = vport->ingress.offloads.drop_grp; 133 138 flow_rule = mlx5_add_flow_rules(vport->ingress.acl, NULL, &flow_act, NULL, 0); 134 139 if (IS_ERR(flow_rule)) { 135 140 err = PTR_ERR(flow_rule); 136 - goto out; 141 + goto err_out; 137 142 } 138 143 139 144 vport->ingress.offloads.drop_rule = flow_rule; 140 - out: 145 + 146 + return 0; 147 + err_out: 148 + /* Only destroy ingress acl created in this function. */ 149 + if (created) 150 + esw_acl_ingress_ofld_cleanup(esw, vport); 141 151 return err; 142 152 } 143 153 ··· 315 299 } 316 300 } 317 301 318 - int esw_acl_ingress_ofld_setup(struct mlx5_eswitch *esw, 319 - struct mlx5_vport *vport) 302 + static int 303 + acl_ingress_ofld_setup(struct mlx5_eswitch *esw, struct mlx5_vport *vport) 320 304 { 321 305 int num_ftes = 0; 322 306 int err; 323 - 324 - if (!mlx5_eswitch_vport_match_metadata_enabled(esw) && 325 - !esw_acl_ingress_prio_tag_enabled(esw, vport)) 326 - return 0; 327 307 328 308 esw_acl_ingress_allow_rule_destroy(vport); 329 309 ··· 357 345 group_err: 358 346 esw_acl_ingress_table_destroy(vport); 359 347 return err; 348 + } 349 + 350 + int esw_acl_ingress_ofld_setup(struct mlx5_eswitch *esw, struct mlx5_vport *vport) 351 + { 352 + if (!mlx5_eswitch_vport_match_metadata_enabled(esw) && 353 + !esw_acl_ingress_prio_tag_enabled(esw, vport)) 354 + return 0; 355 + 356 + return acl_ingress_ofld_setup(esw, vport); 360 357 } 361 358 362 359 void esw_acl_ingress_ofld_cleanup(struct mlx5_eswitch *esw,
+17 -5
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
··· 4600 4600 return -EOPNOTSUPP; 4601 4601 } 4602 4602 4603 + if (!MLX5_CAP_GEN_2(esw->dev, max_num_eqs_24b)) { 4604 + NL_SET_ERR_MSG_MOD(extack, 4605 + "Device doesn't support getting the max number of EQs"); 4606 + return -EOPNOTSUPP; 4607 + } 4608 + 4603 4609 query_ctx = kzalloc(query_out_sz, GFP_KERNEL); 4604 4610 if (!query_ctx) 4605 4611 return -ENOMEM; 4606 4612 4607 4613 mutex_lock(&esw->state_lock); 4608 4614 err = mlx5_vport_get_other_func_cap(esw->dev, vport_num, query_ctx, 4609 - MLX5_CAP_GENERAL); 4615 + MLX5_CAP_GENERAL_2); 4610 4616 if (err) { 4611 4617 NL_SET_ERR_MSG_MOD(extack, "Failed getting HCA caps"); 4612 4618 goto out; 4613 4619 } 4614 4620 4615 4621 hca_caps = MLX5_ADDR_OF(query_hca_cap_out, query_ctx, capability); 4616 - max_eqs = MLX5_GET(cmd_hca_cap, hca_caps, max_num_eqs); 4622 + max_eqs = MLX5_GET(cmd_hca_cap_2, hca_caps, max_num_eqs_24b); 4617 4623 if (max_eqs < MLX5_ESW_MAX_CTRL_EQS) 4618 4624 *max_io_eqs = 0; 4619 4625 else ··· 4650 4644 return -EOPNOTSUPP; 4651 4645 } 4652 4646 4647 + if (!MLX5_CAP_GEN_2(esw->dev, max_num_eqs_24b)) { 4648 + NL_SET_ERR_MSG_MOD(extack, 4649 + "Device doesn't support changing the max number of EQs"); 4650 + return -EOPNOTSUPP; 4651 + } 4652 + 4653 4653 if (check_add_overflow(max_io_eqs, MLX5_ESW_MAX_CTRL_EQS, &max_eqs)) { 4654 4654 NL_SET_ERR_MSG_MOD(extack, "Supplied value out of range"); 4655 4655 return -EINVAL; ··· 4667 4655 4668 4656 mutex_lock(&esw->state_lock); 4669 4657 err = mlx5_vport_get_other_func_cap(esw->dev, vport_num, query_ctx, 4670 - MLX5_CAP_GENERAL); 4658 + MLX5_CAP_GENERAL_2); 4671 4659 if (err) { 4672 4660 NL_SET_ERR_MSG_MOD(extack, "Failed getting HCA caps"); 4673 4661 goto out; 4674 4662 } 4675 4663 4676 4664 hca_caps = MLX5_ADDR_OF(query_hca_cap_out, query_ctx, capability); 4677 - MLX5_SET(cmd_hca_cap, hca_caps, max_num_eqs, max_eqs); 4665 + MLX5_SET(cmd_hca_cap_2, hca_caps, max_num_eqs_24b, max_eqs); 4678 4666 4679 4667 err = mlx5_vport_set_other_func_cap(esw->dev, hca_caps, vport_num, 4680 - MLX5_SET_HCA_CAP_OP_MOD_GENERAL_DEVICE); 4668 + MLX5_SET_HCA_CAP_OP_MOD_GENERAL_DEVICE2); 4681 4669 if (err) 4682 4670 NL_SET_ERR_MSG_MOD(extack, "Failed setting HCA caps"); 4683 4671
+10
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
··· 383 383 : vport; 384 384 } 385 385 386 + static inline int mlx5_max_eq_cap_get(const struct mlx5_core_dev *dev) 387 + { 388 + if (MLX5_CAP_GEN_2(dev, max_num_eqs_24b)) 389 + return MLX5_CAP_GEN_2(dev, max_num_eqs_24b); 390 + 391 + if (MLX5_CAP_GEN(dev, max_num_eqs)) 392 + return MLX5_CAP_GEN(dev, max_num_eqs); 393 + 394 + return 1 << MLX5_CAP_GEN(dev, log_max_eq); 395 + } 386 396 #endif /* __MLX5_CORE_H__ */
+1 -3
drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c
··· 711 711 712 712 int mlx5_irq_table_create(struct mlx5_core_dev *dev) 713 713 { 714 - int num_eqs = MLX5_CAP_GEN(dev, max_num_eqs) ? 715 - MLX5_CAP_GEN(dev, max_num_eqs) : 716 - 1 << MLX5_CAP_GEN(dev, log_max_eq); 714 + int num_eqs = mlx5_max_eq_cap_get(dev); 717 715 int total_vec; 718 716 int pcif_vec; 719 717 int req_vec;
+1
drivers/net/ethernet/mellanox/mlxsw/core_linecards.c
··· 1484 1484 vfree(types_info->data); 1485 1485 err_data_alloc: 1486 1486 kfree(types_info); 1487 + linecards->types_info = NULL; 1487 1488 return err; 1488 1489 } 1489 1490
+2 -2
drivers/net/ethernet/renesas/rswitch.c
··· 871 871 dma_rmb(); 872 872 skb = gq->skbs[gq->dirty]; 873 873 if (skb) { 874 + rdev->ndev->stats.tx_packets++; 875 + rdev->ndev->stats.tx_bytes += skb->len; 874 876 dma_unmap_single(ndev->dev.parent, 875 877 gq->unmap_addrs[gq->dirty], 876 878 skb->len, DMA_TO_DEVICE); 877 879 dev_kfree_skb_any(gq->skbs[gq->dirty]); 878 880 gq->skbs[gq->dirty] = NULL; 879 - rdev->ndev->stats.tx_packets++; 880 - rdev->ndev->stats.tx_bytes += skb->len; 881 881 } 882 882 desc->desc.die_dt = DT_EEMPTY; 883 883 }
+1 -1
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
··· 272 272 273 273 static const struct ethqos_emac_driver_data emac_v4_0_0_data = { 274 274 .por = emac_v4_0_0_por, 275 - .num_por = ARRAY_SIZE(emac_v3_0_0_por), 275 + .num_por = ARRAY_SIZE(emac_v4_0_0_por), 276 276 .rgmii_config_loopback_en = false, 277 277 .has_emac_ge_3 = true, 278 278 .link_clk_name = "phyaux",
+4 -3
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 7663 7663 #ifdef STMMAC_VLAN_TAG_USED 7664 7664 /* Both mac100 and gmac support receive VLAN tag detection */ 7665 7665 ndev->features |= NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX; 7666 - ndev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX; 7667 - priv->hw->hw_vlan_en = true; 7668 - 7666 + if (priv->plat->has_gmac4) { 7667 + ndev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX; 7668 + priv->hw->hw_vlan_en = true; 7669 + } 7669 7670 if (priv->dma_cap.vlhash) { 7670 7671 ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; 7671 7672 ndev->features |= NETIF_F_HW_VLAN_STAG_FILTER;
+1
drivers/net/ethernet/wangxun/libwx/wx_hw.c
··· 1978 1978 1979 1979 bitmap_zero(wx->state, WX_STATE_NBITS); 1980 1980 bitmap_zero(wx->flags, WX_PF_FLAGS_NBITS); 1981 + wx->misc_irq_domain = false; 1981 1982 1982 1983 return 0; 1983 1984 }
+7 -3
drivers/net/ethernet/wangxun/libwx/wx_lib.c
··· 1711 1711 } 1712 1712 1713 1713 pdev->irq = pci_irq_vector(pdev, 0); 1714 + wx->num_q_vectors = 1; 1714 1715 1715 1716 return 0; 1716 1717 } ··· 2022 2021 int vector; 2023 2022 2024 2023 if (!(pdev->msix_enabled)) { 2025 - free_irq(pdev->irq, wx); 2024 + if (!wx->misc_irq_domain) 2025 + free_irq(pdev->irq, wx); 2026 2026 return; 2027 2027 } 2028 2028 ··· 2038 2036 free_irq(entry->vector, q_vector); 2039 2037 } 2040 2038 2041 - if (wx->mac.type == wx_mac_em) 2039 + if (!wx->misc_irq_domain) 2042 2040 free_irq(wx->msix_entry->vector, wx); 2043 2041 } 2044 2042 EXPORT_SYMBOL(wx_free_irq); ··· 2052 2050 int wx_setup_isb_resources(struct wx *wx) 2053 2051 { 2054 2052 struct pci_dev *pdev = wx->pdev; 2053 + 2054 + if (wx->isb_mem) 2055 + return 0; 2055 2056 2056 2057 wx->isb_mem = dma_alloc_coherent(&pdev->dev, 2057 2058 sizeof(u32) * 4, ··· 2415 2410 2416 2411 void wx_free_resources(struct wx *wx) 2417 2412 { 2418 - wx_free_isb_resources(wx); 2419 2413 wx_free_all_rx_resources(wx); 2420 2414 wx_free_all_tx_resources(wx); 2421 2415 }
+1
drivers/net/ethernet/wangxun/libwx/wx_type.h
··· 1109 1109 dma_addr_t isb_dma; 1110 1110 u32 *isb_mem; 1111 1111 u32 isb_tag[WX_ISB_MAX]; 1112 + bool misc_irq_domain; 1112 1113 1113 1114 #define WX_MAX_RETA_ENTRIES 128 1114 1115 #define WX_RSS_INDIR_TBL_MAX 64
+2
drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
··· 387 387 err_free_irq: 388 388 wx_free_irq(wx); 389 389 err_free_resources: 390 + wx_free_isb_resources(wx); 390 391 wx_free_resources(wx); 391 392 return err; 392 393 } ··· 409 408 410 409 ngbe_down(wx); 411 410 wx_free_irq(wx); 411 + wx_free_isb_resources(wx); 412 412 wx_free_resources(wx); 413 413 phylink_disconnect_phy(wx->phylink); 414 414 wx_control_hw(wx, false);
+47 -77
drivers/net/ethernet/wangxun/txgbe/txgbe_irq.c
··· 27 27 } 28 28 29 29 /** 30 - * txgbe_intr - msi/legacy mode Interrupt Handler 31 - * @irq: interrupt number 32 - * @data: pointer to a network interface device structure 33 - **/ 34 - static irqreturn_t txgbe_intr(int __always_unused irq, void *data) 35 - { 36 - struct wx_q_vector *q_vector; 37 - struct wx *wx = data; 38 - struct pci_dev *pdev; 39 - u32 eicr; 40 - 41 - q_vector = wx->q_vector[0]; 42 - pdev = wx->pdev; 43 - 44 - eicr = wx_misc_isb(wx, WX_ISB_VEC0); 45 - if (!eicr) { 46 - /* shared interrupt alert! 47 - * the interrupt that we masked before the ICR read. 48 - */ 49 - if (netif_running(wx->netdev)) 50 - txgbe_irq_enable(wx, true); 51 - return IRQ_NONE; /* Not our interrupt */ 52 - } 53 - wx->isb_mem[WX_ISB_VEC0] = 0; 54 - if (!(pdev->msi_enabled)) 55 - wr32(wx, WX_PX_INTA, 1); 56 - 57 - wx->isb_mem[WX_ISB_MISC] = 0; 58 - /* would disable interrupts here but it is auto disabled */ 59 - napi_schedule_irqoff(&q_vector->napi); 60 - 61 - /* re-enable link(maybe) and non-queue interrupts, no flush. 62 - * txgbe_poll will re-enable the queue interrupts 63 - */ 64 - if (netif_running(wx->netdev)) 65 - txgbe_irq_enable(wx, false); 66 - 67 - return IRQ_HANDLED; 68 - } 69 - 70 - /** 71 - * txgbe_request_msix_irqs - Initialize MSI-X interrupts 30 + * txgbe_request_queue_irqs - Initialize MSI-X queue interrupts 72 31 * @wx: board private structure 73 32 * 74 - * Allocate MSI-X vectors and request interrupts from the kernel. 33 + * Allocate MSI-X queue vectors and request interrupts from the kernel. 75 34 **/ 76 - static int txgbe_request_msix_irqs(struct wx *wx) 35 + int txgbe_request_queue_irqs(struct wx *wx) 77 36 { 78 37 struct net_device *netdev = wx->netdev; 79 38 int vector, err; 39 + 40 + if (!wx->pdev->msix_enabled) 41 + return 0; 80 42 81 43 for (vector = 0; vector < wx->num_q_vectors; vector++) { 82 44 struct wx_q_vector *q_vector = wx->q_vector[vector]; ··· 69 107 wx->q_vector[vector]); 70 108 } 71 109 wx_reset_interrupt_capability(wx); 72 - return err; 73 - } 74 - 75 - /** 76 - * txgbe_request_irq - initialize interrupts 77 - * @wx: board private structure 78 - * 79 - * Attempt to configure interrupts using the best available 80 - * capabilities of the hardware and kernel. 81 - **/ 82 - int txgbe_request_irq(struct wx *wx) 83 - { 84 - struct net_device *netdev = wx->netdev; 85 - struct pci_dev *pdev = wx->pdev; 86 - int err; 87 - 88 - if (pdev->msix_enabled) 89 - err = txgbe_request_msix_irqs(wx); 90 - else if (pdev->msi_enabled) 91 - err = request_irq(wx->pdev->irq, &txgbe_intr, 0, 92 - netdev->name, wx); 93 - else 94 - err = request_irq(wx->pdev->irq, &txgbe_intr, IRQF_SHARED, 95 - netdev->name, wx); 96 - 97 - if (err) 98 - wx_err(wx, "request_irq failed, Error %d\n", err); 99 - 100 110 return err; 101 111 } 102 112 ··· 111 177 }; 112 178 113 179 static irqreturn_t txgbe_misc_irq_handle(int irq, void *data) 180 + { 181 + struct wx_q_vector *q_vector; 182 + struct txgbe *txgbe = data; 183 + struct wx *wx = txgbe->wx; 184 + u32 eicr; 185 + 186 + if (wx->pdev->msix_enabled) 187 + return IRQ_WAKE_THREAD; 188 + 189 + eicr = wx_misc_isb(wx, WX_ISB_VEC0); 190 + if (!eicr) { 191 + /* shared interrupt alert! 192 + * the interrupt that we masked before the ICR read. 193 + */ 194 + if (netif_running(wx->netdev)) 195 + txgbe_irq_enable(wx, true); 196 + return IRQ_NONE; /* Not our interrupt */ 197 + } 198 + wx->isb_mem[WX_ISB_VEC0] = 0; 199 + if (!(wx->pdev->msi_enabled)) 200 + wr32(wx, WX_PX_INTA, 1); 201 + 202 + /* would disable interrupts here but it is auto disabled */ 203 + q_vector = wx->q_vector[0]; 204 + napi_schedule_irqoff(&q_vector->napi); 205 + 206 + return IRQ_WAKE_THREAD; 207 + } 208 + 209 + static irqreturn_t txgbe_misc_irq_thread_fn(int irq, void *data) 114 210 { 115 211 struct txgbe *txgbe = data; 116 212 struct wx *wx = txgbe->wx; ··· 187 223 188 224 int txgbe_setup_misc_irq(struct txgbe *txgbe) 189 225 { 226 + unsigned long flags = IRQF_ONESHOT; 190 227 struct wx *wx = txgbe->wx; 191 228 int hwirq, err; 192 229 ··· 201 236 irq_create_mapping(txgbe->misc.domain, hwirq); 202 237 203 238 txgbe->misc.chip = txgbe_irq_chip; 204 - if (wx->pdev->msix_enabled) 239 + if (wx->pdev->msix_enabled) { 205 240 txgbe->misc.irq = wx->msix_entry->vector; 206 - else 241 + } else { 207 242 txgbe->misc.irq = wx->pdev->irq; 243 + if (!wx->pdev->msi_enabled) 244 + flags |= IRQF_SHARED; 245 + } 208 246 209 - err = request_threaded_irq(txgbe->misc.irq, NULL, 210 - txgbe_misc_irq_handle, 211 - IRQF_ONESHOT, 247 + err = request_threaded_irq(txgbe->misc.irq, txgbe_misc_irq_handle, 248 + txgbe_misc_irq_thread_fn, 249 + flags, 212 250 wx->netdev->name, txgbe); 213 251 if (err) 214 252 goto del_misc_irq; ··· 223 255 err = txgbe_request_link_irq(txgbe); 224 256 if (err) 225 257 goto free_gpio_irq; 258 + 259 + wx->misc_irq_domain = true; 226 260 227 261 return 0; 228 262
+1 -1
drivers/net/ethernet/wangxun/txgbe/txgbe_irq.h
··· 2 2 /* Copyright (c) 2015 - 2024 Beijing WangXun Technology Co., Ltd. */ 3 3 4 4 void txgbe_irq_enable(struct wx *wx, bool queues); 5 - int txgbe_request_irq(struct wx *wx); 5 + int txgbe_request_queue_irqs(struct wx *wx); 6 6 void txgbe_free_misc_irq(struct txgbe *txgbe); 7 7 int txgbe_setup_misc_irq(struct txgbe *txgbe);
+5 -4
drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
··· 309 309 310 310 wx_configure(wx); 311 311 312 - err = txgbe_request_irq(wx); 312 + err = txgbe_request_queue_irqs(wx); 313 313 if (err) 314 - goto err_free_isb; 314 + goto err_free_resources; 315 315 316 316 /* Notify the stack of the actual queue counts. */ 317 317 err = netif_set_real_num_tx_queues(netdev, wx->num_tx_queues); ··· 328 328 329 329 err_free_irq: 330 330 wx_free_irq(wx); 331 - err_free_isb: 332 - wx_free_isb_resources(wx); 331 + err_free_resources: 332 + wx_free_resources(wx); 333 333 err_reset: 334 334 txgbe_reset(wx); 335 335 ··· 747 747 748 748 txgbe_remove_phy(txgbe); 749 749 txgbe_free_misc_irq(txgbe); 750 + wx_free_isb_resources(wx); 750 751 751 752 pci_release_selected_regions(pdev, 752 753 pci_select_bars(pdev, IORESOURCE_MEM));
+1 -1
drivers/net/ntb_netdev.c
··· 119 119 skb->protocol = eth_type_trans(skb, ndev); 120 120 skb->ip_summed = CHECKSUM_NONE; 121 121 122 - if (__netif_rx(skb) == NET_RX_DROP) { 122 + if (netif_rx(skb) == NET_RX_DROP) { 123 123 ndev->stats.rx_errors++; 124 124 ndev->stats.rx_dropped++; 125 125 } else {
+4
drivers/net/phy/aquantia/aquantia.h
··· 6 6 * Author: Heiner Kallweit <hkallweit1@gmail.com> 7 7 */ 8 8 9 + #ifndef AQUANTIA_H 10 + #define AQUANTIA_H 11 + 9 12 #include <linux/device.h> 10 13 #include <linux/phy.h> 11 14 ··· 201 198 int aqr_phy_led_active_low_set(struct phy_device *phydev, int index, bool enable); 202 199 int aqr_phy_led_polarity_set(struct phy_device *phydev, int index, 203 200 unsigned long modes); 201 + #endif /* AQUANTIA_H */
+7 -7
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
··· 666 666 hw->wiphy->features |= NL80211_FEATURE_WFA_TPC_IE_IN_PROBES; 667 667 668 668 if (iwl_fw_lookup_cmd_ver(mvm->fw, WOWLAN_KEK_KCK_MATERIAL, 669 - IWL_FW_CMD_VER_UNKNOWN) == 3) 669 + IWL_FW_CMD_VER_UNKNOWN) >= 3) 670 670 hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK; 671 671 672 672 if (fw_has_api(&mvm->fw->ucode_capa, ··· 1698 1698 struct iwl_mvm_vif *mvmvif = 1699 1699 container_of(wk, struct iwl_mvm_vif, prevent_esr_done_wk.work); 1700 1700 struct iwl_mvm *mvm = mvmvif->mvm; 1701 - struct ieee80211_vif *vif = iwl_mvm_get_bss_vif(mvm); 1701 + struct ieee80211_vif *vif = 1702 + container_of((void *)mvmvif, struct ieee80211_vif, drv_priv); 1702 1703 1703 1704 guard(mvm)(mvm); 1704 1705 iwl_mvm_unblock_esr(mvm, vif, IWL_MVM_ESR_BLOCKED_PREVENTION); ··· 1721 1720 struct iwl_mvm_vif *mvmvif = 1722 1721 container_of(wk, struct iwl_mvm_vif, unblock_esr_tpt_wk); 1723 1722 struct iwl_mvm *mvm = mvmvif->mvm; 1724 - struct ieee80211_vif *vif = iwl_mvm_get_bss_vif(mvm); 1723 + struct ieee80211_vif *vif = 1724 + container_of((void *)mvmvif, struct ieee80211_vif, drv_priv); 1725 1725 1726 1726 guard(mvm)(mvm); 1727 1727 iwl_mvm_unblock_esr(mvm, vif, IWL_MVM_ESR_BLOCKED_TPT); ··· 6408 6406 if (sync) { 6409 6407 lockdep_assert_held(&mvm->mutex); 6410 6408 ret = wait_event_timeout(mvm->rx_sync_waitq, 6411 - READ_ONCE(mvm->queue_sync_state) == 0 || 6412 - iwl_mvm_is_radio_hw_killed(mvm), 6409 + READ_ONCE(mvm->queue_sync_state) == 0, 6413 6410 SYNC_RX_QUEUE_TIMEOUT); 6414 - WARN_ONCE(!ret && !iwl_mvm_is_radio_hw_killed(mvm), 6415 - "queue sync: failed to sync, state is 0x%lx, cookie %d\n", 6411 + WARN_ONCE(!ret, "queue sync: failed to sync, state is 0x%lx, cookie %d\n", 6416 6412 mvm->queue_sync_state, 6417 6413 mvm->queue_sync_cookie); 6418 6414 }
+3 -5
drivers/net/wireless/intel/iwlwifi/mvm/ops.c
··· 149 149 struct ieee80211_vif *vif = iwl_mvm_get_bss_vif(mvm); 150 150 151 151 /* FW recommendations is only for entering EMLSR */ 152 - if (!vif || iwl_mvm_vif_from_mac80211(vif)->esr_active) 152 + if (IS_ERR_OR_NULL(vif) || iwl_mvm_vif_from_mac80211(vif)->esr_active) 153 153 return; 154 154 155 155 if (le32_to_cpu(notif->action) == ESR_RECOMMEND_ENTER) ··· 1898 1898 bool rfkill_safe_init_done = READ_ONCE(mvm->rfkill_safe_init_done); 1899 1899 bool unified = iwl_mvm_has_unified_ucode(mvm); 1900 1900 1901 - if (state) { 1901 + if (state) 1902 1902 set_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status); 1903 - wake_up(&mvm->rx_sync_waitq); 1904 - } else { 1903 + else 1905 1904 clear_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status); 1906 - } 1907 1905 1908 1906 iwl_mvm_set_rfkill_state(mvm); 1909 1907
+7 -8
drivers/net/wireless/intel/iwlwifi/mvm/rx.c
··· 557 557 }; 558 558 559 559 static void iwl_mvm_update_link_sig(struct ieee80211_vif *vif, int sig, 560 - struct iwl_mvm_vif_link_info *link_info) 560 + struct iwl_mvm_vif_link_info *link_info, 561 + struct ieee80211_bss_conf *bss_conf) 561 562 { 562 563 struct iwl_mvm *mvm = iwl_mvm_vif_from_mac80211(vif)->mvm; 563 - struct ieee80211_bss_conf *bss_conf = 564 - iwl_mvm_rcu_fw_link_id_to_link_conf(mvm, link_info->fw_link_id, 565 - false); 566 564 int thold = bss_conf->cqm_rssi_thold; 567 565 int hyst = bss_conf->cqm_rssi_hyst; 568 566 int last_event; ··· 668 670 mvmvif->deflink.beacon_stats.num_beacons; 669 671 670 672 /* This is used in pre-MLO API so use deflink */ 671 - iwl_mvm_update_link_sig(vif, sig, &mvmvif->deflink); 673 + iwl_mvm_update_link_sig(vif, sig, &mvmvif->deflink, &vif->bss_conf); 672 674 } 673 675 674 676 static void iwl_mvm_stat_iterator_all_macs(void *_data, u8 *mac, ··· 703 705 sig = -le32_to_cpu(mac_stats->beacon_filter_average_energy); 704 706 705 707 /* This is used in pre-MLO API so use deflink */ 706 - iwl_mvm_update_link_sig(vif, sig, &mvmvif->deflink); 708 + iwl_mvm_update_link_sig(vif, sig, &mvmvif->deflink, &vif->bss_conf); 707 709 } 708 710 709 711 static inline void ··· 919 921 mvmvif->link[link_id]->beacon_stats.num_beacons; 920 922 921 923 sig = -le32_to_cpu(link_stats->beacon_filter_average_energy); 922 - iwl_mvm_update_link_sig(bss_conf->vif, sig, link_info); 924 + iwl_mvm_update_link_sig(bss_conf->vif, sig, link_info, 925 + bss_conf); 923 926 924 927 if (WARN_ONCE(mvmvif->id >= MAC_INDEX_AUX, 925 928 "invalid mvmvif id: %d", mvmvif->id)) ··· 966 967 967 968 lockdep_assert_held(&mvm->mutex); 968 969 969 - if (!bss_vif) 970 + if (IS_ERR_OR_NULL(bss_vif)) 970 971 return; 971 972 972 973 mvmvif = iwl_mvm_vif_from_mac80211(bss_vif);
+2 -1
drivers/net/wireless/microchip/wilc1000/hif.c
··· 382 382 struct ieee80211_p2p_noa_attr noa_attr; 383 383 const struct cfg80211_bss_ies *ies; 384 384 struct wilc_join_bss_param *param; 385 - u8 rates_len = 0, ies_len; 385 + u8 rates_len = 0; 386 + int ies_len; 386 387 int ret; 387 388 388 389 param = kzalloc(sizeof(*param), GFP_KERNEL);
+1
drivers/nvme/host/apple.c
··· 1602 1602 module_platform_driver(apple_nvme_driver); 1603 1603 1604 1604 MODULE_AUTHOR("Sven Peter <sven@svenpeter.dev>"); 1605 + MODULE_DESCRIPTION("Apple ANS NVM Express device driver"); 1605 1606 MODULE_LICENSE("GPL");
+1 -1
drivers/nvme/host/nvme.h
··· 502 502 enum nvme_ns_features { 503 503 NVME_NS_EXT_LBAS = 1 << 0, /* support extended LBA format */ 504 504 NVME_NS_METADATA_SUPPORTED = 1 << 1, /* support getting generated md */ 505 - NVME_NS_DEAC, /* DEAC bit in Write Zeores supported */ 505 + NVME_NS_DEAC = 1 << 2, /* DEAC bit in Write Zeores supported */ 506 506 }; 507 507 508 508 struct nvme_ns {
+31 -10
drivers/nvme/target/configfs.c
··· 410 410 return sprintf(page, "%s\n", nvmet_addr_tsas_rdma[i].name); 411 411 } 412 412 } 413 - return sprintf(page, "reserved\n"); 413 + return sprintf(page, "\n"); 414 + } 415 + 416 + static u8 nvmet_addr_tsas_rdma_store(const char *page) 417 + { 418 + int i; 419 + 420 + for (i = 0; i < ARRAY_SIZE(nvmet_addr_tsas_rdma); i++) { 421 + if (sysfs_streq(page, nvmet_addr_tsas_rdma[i].name)) 422 + return nvmet_addr_tsas_rdma[i].type; 423 + } 424 + return NVMF_RDMA_QPTYPE_INVALID; 425 + } 426 + 427 + static u8 nvmet_addr_tsas_tcp_store(const char *page) 428 + { 429 + int i; 430 + 431 + for (i = 0; i < ARRAY_SIZE(nvmet_addr_tsas_tcp); i++) { 432 + if (sysfs_streq(page, nvmet_addr_tsas_tcp[i].name)) 433 + return nvmet_addr_tsas_tcp[i].type; 434 + } 435 + return NVMF_TCP_SECTYPE_INVALID; 414 436 } 415 437 416 438 static ssize_t nvmet_addr_tsas_store(struct config_item *item, ··· 440 418 { 441 419 struct nvmet_port *port = to_nvmet_port(item); 442 420 u8 treq = nvmet_port_disc_addr_treq_mask(port); 443 - u8 sectype; 444 - int i; 421 + u8 sectype, qptype; 445 422 446 423 if (nvmet_is_port_enabled(port, __func__)) 447 424 return -EACCES; 448 425 449 - if (port->disc_addr.trtype != NVMF_TRTYPE_TCP) 450 - return -EINVAL; 451 - 452 - for (i = 0; i < ARRAY_SIZE(nvmet_addr_tsas_tcp); i++) { 453 - if (sysfs_streq(page, nvmet_addr_tsas_tcp[i].name)) { 454 - sectype = nvmet_addr_tsas_tcp[i].type; 426 + if (port->disc_addr.trtype == NVMF_TRTYPE_RDMA) { 427 + qptype = nvmet_addr_tsas_rdma_store(page); 428 + if (qptype == port->disc_addr.tsas.rdma.qptype) 429 + return count; 430 + } else if (port->disc_addr.trtype == NVMF_TRTYPE_TCP) { 431 + sectype = nvmet_addr_tsas_tcp_store(page); 432 + if (sectype != NVMF_TCP_SECTYPE_INVALID) 455 433 goto found; 456 - } 457 434 } 458 435 459 436 pr_err("Invalid value '%s' for tsas\n", page);
+1 -1
drivers/nvme/target/fc.c
··· 148 148 struct workqueue_struct *work_q; 149 149 struct kref ref; 150 150 /* array of fcp_iods */ 151 - struct nvmet_fc_fcp_iod fod[] __counted_by(sqsize); 151 + struct nvmet_fc_fcp_iod fod[] /* __counted_by(sqsize) */; 152 152 } __aligned(sizeof(unsigned long long)); 153 153 154 154 struct nvmet_fc_hostport {
+8 -2
drivers/pci/msi/msi.c
··· 352 352 struct irq_affinity *affd) 353 353 { 354 354 struct irq_affinity_desc *masks = NULL; 355 - struct msi_desc *entry; 355 + struct msi_desc *entry, desc; 356 356 int ret; 357 357 358 358 /* Reject multi-MSI early on irq domain enabled architectures */ ··· 377 377 /* All MSIs are unmasked by default; mask them all */ 378 378 entry = msi_first_desc(&dev->dev, MSI_DESC_ALL); 379 379 pci_msi_mask(entry, msi_multi_mask(entry)); 380 + /* 381 + * Copy the MSI descriptor for the error path because 382 + * pci_msi_setup_msi_irqs() will free it for the hierarchical 383 + * interrupt domain case. 384 + */ 385 + memcpy(&desc, entry, sizeof(desc)); 380 386 381 387 /* Configure MSI capability structure */ 382 388 ret = pci_msi_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSI); ··· 402 396 goto unlock; 403 397 404 398 err: 405 - pci_msi_unmask(entry, msi_multi_mask(entry)); 399 + pci_msi_unmask(&desc, msi_multi_mask(&desc)); 406 400 pci_free_msi_irqs(dev); 407 401 fail: 408 402 dev->msi_enabled = 0;
+4 -1
drivers/platform/mellanox/nvsw-sn2201.c
··· 1198 1198 static int nvsw_sn2201_probe(struct platform_device *pdev) 1199 1199 { 1200 1200 struct nvsw_sn2201 *nvsw_sn2201; 1201 + int ret; 1201 1202 1202 1203 nvsw_sn2201 = devm_kzalloc(&pdev->dev, sizeof(*nvsw_sn2201), GFP_KERNEL); 1203 1204 if (!nvsw_sn2201) ··· 1206 1205 1207 1206 nvsw_sn2201->dev = &pdev->dev; 1208 1207 platform_set_drvdata(pdev, nvsw_sn2201); 1209 - platform_device_add_resources(pdev, nvsw_sn2201_lpc_io_resources, 1208 + ret = platform_device_add_resources(pdev, nvsw_sn2201_lpc_io_resources, 1210 1209 ARRAY_SIZE(nvsw_sn2201_lpc_io_resources)); 1210 + if (ret) 1211 + return ret; 1211 1212 1212 1213 nvsw_sn2201->main_mux_deferred_nr = NVSW_SN2201_MAIN_MUX_DEFER_NR; 1213 1214 nvsw_sn2201->main_mux_devs = nvsw_sn2201_main_mux_brdinfo;
+1
drivers/platform/x86/amilo-rfkill.c
··· 171 171 } 172 172 173 173 MODULE_AUTHOR("Ben Hutchings <ben@decadent.org.uk>"); 174 + MODULE_DESCRIPTION("Fujitsu-Siemens Amilo rfkill support"); 174 175 MODULE_LICENSE("GPL"); 175 176 MODULE_DEVICE_TABLE(dmi, amilo_rfkill_id_table); 176 177
+1
drivers/platform/x86/firmware_attributes_class.c
··· 49 49 EXPORT_SYMBOL_GPL(fw_attributes_class_put); 50 50 51 51 MODULE_AUTHOR("Mark Pearson <markpearson@lenovo.com>"); 52 + MODULE_DESCRIPTION("Firmware attributes class helper module"); 52 53 MODULE_LICENSE("GPL");
+1
drivers/platform/x86/ibm_rtl.c
··· 29 29 module_param(debug, bool, 0644); 30 30 MODULE_PARM_DESC(debug, "Show debug output"); 31 31 32 + MODULE_DESCRIPTION("IBM Premium Real Time Mode (PRTM) driver"); 32 33 MODULE_LICENSE("GPL"); 33 34 MODULE_AUTHOR("Keith Mannthey <kmmanth@us.ibm.com>"); 34 35 MODULE_AUTHOR("Vernon Mauery <vernux@us.ibm.com>");
+1
drivers/platform/x86/intel/hid.c
··· 38 38 /* When NOT in tablet mode, VGBS returns with the flag 0x40 */ 39 39 #define TABLET_MODE_FLAG BIT(6) 40 40 41 + MODULE_DESCRIPTION("Intel HID Event hotkey driver"); 41 42 MODULE_LICENSE("GPL"); 42 43 MODULE_AUTHOR("Alex Hung"); 43 44
+1
drivers/platform/x86/intel/pmc/pltdrv.c
··· 86 86 87 87 module_init(pmc_core_platform_init); 88 88 module_exit(pmc_core_platform_exit); 89 + MODULE_DESCRIPTION("Intel PMC Core platform driver"); 89 90 MODULE_LICENSE("GPL v2");
+1
drivers/platform/x86/intel/rst.c
··· 7 7 #include <linux/module.h> 8 8 #include <linux/slab.h> 9 9 10 + MODULE_DESCRIPTION("Intel Rapid Start Technology Driver"); 10 11 MODULE_LICENSE("GPL"); 11 12 12 13 static ssize_t irst_show_wakeup_events(struct device *dev,
+1
drivers/platform/x86/intel/smartconnect.c
··· 6 6 #include <linux/acpi.h> 7 7 #include <linux/module.h> 8 8 9 + MODULE_DESCRIPTION("Intel Smart Connect disabling driver"); 9 10 MODULE_LICENSE("GPL"); 10 11 11 12 static int smartconnect_acpi_init(struct acpi_device *acpi)
+1
drivers/platform/x86/intel/vbtn.c
··· 24 24 25 25 #define VGBS_TABLET_MODE_FLAGS (VGBS_TABLET_MODE_FLAG | VGBS_TABLET_MODE_FLAG_ALT) 26 26 27 + MODULE_DESCRIPTION("Intel Virtual Button driver"); 27 28 MODULE_LICENSE("GPL"); 28 29 MODULE_AUTHOR("AceLan Kao"); 29 30
+34 -55
drivers/platform/x86/lg-laptop.c
··· 39 39 #define WMI_METHOD_WMBB "2B4F501A-BD3C-4394-8DCF-00A7D2BC8210" 40 40 #define WMI_EVENT_GUID WMI_EVENT_GUID0 41 41 42 - #define WMAB_METHOD "\\XINI.WMAB" 43 - #define WMBB_METHOD "\\XINI.WMBB" 44 42 #define SB_GGOV_METHOD "\\_SB.GGOV" 45 43 #define GOV_TLED 0x2020008 46 44 #define WM_GET 1 ··· 72 74 73 75 static int battery_limit_use_wmbb; 74 76 static struct led_classdev kbd_backlight; 75 - static enum led_brightness get_kbd_backlight_level(void); 77 + static enum led_brightness get_kbd_backlight_level(struct device *dev); 76 78 77 79 static const struct key_entry wmi_keymap[] = { 78 80 {KE_KEY, 0x70, {KEY_F15} }, /* LG control panel (F1) */ ··· 82 84 * this key both sends an event and 83 85 * changes backlight level. 84 86 */ 85 - {KE_KEY, 0x80, {KEY_RFKILL} }, 86 87 {KE_END, 0} 87 88 }; 88 89 ··· 125 128 return res; 126 129 } 127 130 128 - static union acpi_object *lg_wmab(u32 method, u32 arg1, u32 arg2) 131 + static union acpi_object *lg_wmab(struct device *dev, u32 method, u32 arg1, u32 arg2) 129 132 { 130 133 union acpi_object args[3]; 131 134 acpi_status status; 132 - acpi_handle handle; 133 135 struct acpi_object_list arg; 134 136 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 135 137 ··· 139 143 args[2].type = ACPI_TYPE_INTEGER; 140 144 args[2].integer.value = arg2; 141 145 142 - status = acpi_get_handle(NULL, (acpi_string) WMAB_METHOD, &handle); 143 - if (ACPI_FAILURE(status)) { 144 - pr_err("Cannot get handle"); 145 - return NULL; 146 - } 147 - 148 146 arg.count = 3; 149 147 arg.pointer = args; 150 148 151 - status = acpi_evaluate_object(handle, NULL, &arg, &buffer); 149 + status = acpi_evaluate_object(ACPI_HANDLE(dev), "WMAB", &arg, &buffer); 152 150 if (ACPI_FAILURE(status)) { 153 - acpi_handle_err(handle, "WMAB: call failed.\n"); 151 + dev_err(dev, "WMAB: call failed.\n"); 154 152 return NULL; 155 153 } 156 154 157 155 return buffer.pointer; 158 156 } 159 157 160 - static union acpi_object *lg_wmbb(u32 method_id, u32 arg1, u32 arg2) 158 + static union acpi_object *lg_wmbb(struct device *dev, u32 method_id, u32 arg1, u32 arg2) 161 159 { 162 160 union acpi_object args[3]; 163 161 acpi_status status; 164 - acpi_handle handle; 165 162 struct acpi_object_list arg; 166 163 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 167 164 u8 buf[32]; ··· 170 181 args[2].buffer.length = 32; 171 182 args[2].buffer.pointer = buf; 172 183 173 - status = acpi_get_handle(NULL, (acpi_string)WMBB_METHOD, &handle); 174 - if (ACPI_FAILURE(status)) { 175 - pr_err("Cannot get handle"); 176 - return NULL; 177 - } 178 - 179 184 arg.count = 3; 180 185 arg.pointer = args; 181 186 182 - status = acpi_evaluate_object(handle, NULL, &arg, &buffer); 187 + status = acpi_evaluate_object(ACPI_HANDLE(dev), "WMBB", &arg, &buffer); 183 188 if (ACPI_FAILURE(status)) { 184 - acpi_handle_err(handle, "WMAB: call failed.\n"); 189 + dev_err(dev, "WMBB: call failed.\n"); 185 190 return NULL; 186 191 } 187 192 ··· 206 223 207 224 if (eventcode == 0x10000000) { 208 225 led_classdev_notify_brightness_hw_changed( 209 - &kbd_backlight, get_kbd_backlight_level()); 226 + &kbd_backlight, get_kbd_backlight_level(kbd_backlight.dev->parent)); 210 227 } else { 211 228 key = sparse_keymap_entry_from_scancode( 212 229 wmi_input_dev, eventcode); ··· 255 272 256 273 static void acpi_notify(struct acpi_device *device, u32 event) 257 274 { 258 - struct key_entry *key; 259 - 260 275 acpi_handle_debug(device->handle, "notify: %d\n", event); 261 - if (inited & INIT_SPARSE_KEYMAP) { 262 - key = sparse_keymap_entry_from_scancode(wmi_input_dev, 0x80); 263 - if (key && key->type == KE_KEY) 264 - sparse_keymap_report_entry(wmi_input_dev, key, 1, true); 265 - } 266 276 } 267 277 268 278 static ssize_t fan_mode_store(struct device *dev, ··· 271 295 if (ret) 272 296 return ret; 273 297 274 - r = lg_wmab(WM_FAN_MODE, WM_GET, 0); 298 + r = lg_wmab(dev, WM_FAN_MODE, WM_GET, 0); 275 299 if (!r) 276 300 return -EIO; 277 301 ··· 282 306 283 307 m = r->integer.value; 284 308 kfree(r); 285 - r = lg_wmab(WM_FAN_MODE, WM_SET, (m & 0xffffff0f) | (value << 4)); 309 + r = lg_wmab(dev, WM_FAN_MODE, WM_SET, (m & 0xffffff0f) | (value << 4)); 286 310 kfree(r); 287 - r = lg_wmab(WM_FAN_MODE, WM_SET, (m & 0xfffffff0) | value); 311 + r = lg_wmab(dev, WM_FAN_MODE, WM_SET, (m & 0xfffffff0) | value); 288 312 kfree(r); 289 313 290 314 return count; ··· 296 320 unsigned int status; 297 321 union acpi_object *r; 298 322 299 - r = lg_wmab(WM_FAN_MODE, WM_GET, 0); 323 + r = lg_wmab(dev, WM_FAN_MODE, WM_GET, 0); 300 324 if (!r) 301 325 return -EIO; 302 326 ··· 323 347 if (ret) 324 348 return ret; 325 349 326 - r = lg_wmbb(WMBB_USB_CHARGE, WM_SET, value); 350 + r = lg_wmbb(dev, WMBB_USB_CHARGE, WM_SET, value); 327 351 if (!r) 328 352 return -EIO; 329 353 ··· 337 361 unsigned int status; 338 362 union acpi_object *r; 339 363 340 - r = lg_wmbb(WMBB_USB_CHARGE, WM_GET, 0); 364 + r = lg_wmbb(dev, WMBB_USB_CHARGE, WM_GET, 0); 341 365 if (!r) 342 366 return -EIO; 343 367 ··· 365 389 if (ret) 366 390 return ret; 367 391 368 - r = lg_wmab(WM_READER_MODE, WM_SET, value); 392 + r = lg_wmab(dev, WM_READER_MODE, WM_SET, value); 369 393 if (!r) 370 394 return -EIO; 371 395 ··· 379 403 unsigned int status; 380 404 union acpi_object *r; 381 405 382 - r = lg_wmab(WM_READER_MODE, WM_GET, 0); 406 + r = lg_wmab(dev, WM_READER_MODE, WM_GET, 0); 383 407 if (!r) 384 408 return -EIO; 385 409 ··· 407 431 if (ret) 408 432 return ret; 409 433 410 - r = lg_wmab(WM_FN_LOCK, WM_SET, value); 434 + r = lg_wmab(dev, WM_FN_LOCK, WM_SET, value); 411 435 if (!r) 412 436 return -EIO; 413 437 ··· 421 445 unsigned int status; 422 446 union acpi_object *r; 423 447 424 - r = lg_wmab(WM_FN_LOCK, WM_GET, 0); 448 + r = lg_wmab(dev, WM_FN_LOCK, WM_GET, 0); 425 449 if (!r) 426 450 return -EIO; 427 451 ··· 451 475 union acpi_object *r; 452 476 453 477 if (battery_limit_use_wmbb) 454 - r = lg_wmbb(WMBB_BATT_LIMIT, WM_SET, value); 478 + r = lg_wmbb(&pf_device->dev, WMBB_BATT_LIMIT, WM_SET, value); 455 479 else 456 - r = lg_wmab(WM_BATT_LIMIT, WM_SET, value); 480 + r = lg_wmab(&pf_device->dev, WM_BATT_LIMIT, WM_SET, value); 457 481 if (!r) 458 482 return -EIO; 459 483 ··· 472 496 union acpi_object *r; 473 497 474 498 if (battery_limit_use_wmbb) { 475 - r = lg_wmbb(WMBB_BATT_LIMIT, WM_GET, 0); 499 + r = lg_wmbb(&pf_device->dev, WMBB_BATT_LIMIT, WM_GET, 0); 476 500 if (!r) 477 501 return -EIO; 478 502 ··· 483 507 484 508 status = r->buffer.pointer[0x10]; 485 509 } else { 486 - r = lg_wmab(WM_BATT_LIMIT, WM_GET, 0); 510 + r = lg_wmab(&pf_device->dev, WM_BATT_LIMIT, WM_GET, 0); 487 511 if (!r) 488 512 return -EIO; 489 513 ··· 562 586 { 563 587 union acpi_object *r; 564 588 565 - r = lg_wmab(WM_TLED, WM_SET, brightness > LED_OFF); 589 + r = lg_wmab(cdev->dev->parent, WM_TLED, WM_SET, brightness > LED_OFF); 566 590 kfree(r); 567 591 } 568 592 ··· 584 608 val = 0; 585 609 if (brightness >= LED_FULL) 586 610 val = 0x24; 587 - r = lg_wmab(WM_KEY_LIGHT, WM_SET, val); 611 + r = lg_wmab(cdev->dev->parent, WM_KEY_LIGHT, WM_SET, val); 588 612 kfree(r); 589 613 } 590 614 591 - static enum led_brightness get_kbd_backlight_level(void) 615 + static enum led_brightness get_kbd_backlight_level(struct device *dev) 592 616 { 593 617 union acpi_object *r; 594 618 int val; 595 619 596 - r = lg_wmab(WM_KEY_LIGHT, WM_GET, 0); 620 + r = lg_wmab(dev, WM_KEY_LIGHT, WM_GET, 0); 597 621 598 622 if (!r) 599 623 return LED_OFF; ··· 621 645 622 646 static enum led_brightness kbd_backlight_get(struct led_classdev *cdev) 623 647 { 624 - return get_kbd_backlight_level(); 648 + return get_kbd_backlight_level(cdev->dev->parent); 625 649 } 626 650 627 651 static LED_DEVICE(kbd_backlight, 255, LED_BRIGHT_HW_CHANGED); ··· 648 672 649 673 static int acpi_add(struct acpi_device *device) 650 674 { 675 + struct platform_device_info pdev_info = { 676 + .fwnode = acpi_fwnode_handle(device), 677 + .name = PLATFORM_NAME, 678 + .id = PLATFORM_DEVID_NONE, 679 + }; 651 680 int ret; 652 681 const char *product; 653 682 int year = 2017; ··· 664 683 if (ret) 665 684 return ret; 666 685 667 - pf_device = platform_device_register_simple(PLATFORM_NAME, 668 - PLATFORM_DEVID_NONE, 669 - NULL, 0); 686 + pf_device = platform_device_register_full(&pdev_info); 670 687 if (IS_ERR(pf_device)) { 671 688 ret = PTR_ERR(pf_device); 672 689 pf_device = NULL; ··· 755 776 } 756 777 757 778 static const struct acpi_device_id device_ids[] = { 758 - {"LGEX0815", 0}, 779 + {"LGEX0820", 0}, 759 780 {"", 0} 760 781 }; 761 782 MODULE_DEVICE_TABLE(acpi, device_ids);
+1
drivers/platform/x86/siemens/simatic-ipc-batt-apollolake.c
··· 45 45 46 46 module_platform_driver(simatic_ipc_batt_driver); 47 47 48 + MODULE_DESCRIPTION("CMOS Battery monitoring for Simatic IPCs based on Apollo Lake GPIO"); 48 49 MODULE_LICENSE("GPL"); 49 50 MODULE_ALIAS("platform:" KBUILD_MODNAME); 50 51 MODULE_SOFTDEP("pre: simatic-ipc-batt platform:apollolake-pinctrl");
+1
drivers/platform/x86/siemens/simatic-ipc-batt-elkhartlake.c
··· 45 45 46 46 module_platform_driver(simatic_ipc_batt_driver); 47 47 48 + MODULE_DESCRIPTION("CMOS Battery monitoring for Simatic IPCs based on Elkhart Lake GPIO"); 48 49 MODULE_LICENSE("GPL"); 49 50 MODULE_ALIAS("platform:" KBUILD_MODNAME); 50 51 MODULE_SOFTDEP("pre: simatic-ipc-batt platform:elkhartlake-pinctrl");
+1
drivers/platform/x86/siemens/simatic-ipc-batt-f7188x.c
··· 81 81 82 82 module_platform_driver(simatic_ipc_batt_driver); 83 83 84 + MODULE_DESCRIPTION("CMOS Battery monitoring for Simatic IPCs based on Nuvoton GPIO"); 84 85 MODULE_LICENSE("GPL"); 85 86 MODULE_ALIAS("platform:" KBUILD_MODNAME); 86 87 MODULE_SOFTDEP("pre: simatic-ipc-batt gpio_f7188x platform:elkhartlake-pinctrl platform:alderlake-pinctrl");
+1
drivers/platform/x86/siemens/simatic-ipc-batt.c
··· 247 247 248 248 module_platform_driver(simatic_ipc_batt_driver); 249 249 250 + MODULE_DESCRIPTION("CMOS core battery driver for Siemens Simatic IPCs"); 250 251 MODULE_LICENSE("GPL"); 251 252 MODULE_ALIAS("platform:" KBUILD_MODNAME); 252 253 MODULE_AUTHOR("Henning Schild <henning.schild@siemens.com>");
+1
drivers/platform/x86/siemens/simatic-ipc.c
··· 231 231 module_init(simatic_ipc_init_module); 232 232 module_exit(simatic_ipc_exit_module); 233 233 234 + MODULE_DESCRIPTION("Siemens SIMATIC IPC platform driver"); 234 235 MODULE_LICENSE("GPL v2"); 235 236 MODULE_AUTHOR("Gerd Haeussler <gerd.haeussler.ext@siemens.com>"); 236 237 MODULE_ALIAS("dmi:*:svnSIEMENSAG:*");
+18 -13
drivers/platform/x86/toshiba_acpi.c
··· 3271 3271 */ 3272 3272 #define QUIRK_HCI_HOTKEY_QUICKSTART BIT(1) 3273 3273 3274 - static const struct dmi_system_id toshiba_dmi_quirks[] = { 3274 + static const struct dmi_system_id toshiba_dmi_quirks[] __initconst = { 3275 3275 { 3276 3276 /* Toshiba Portégé R700 */ 3277 3277 /* https://bugzilla.kernel.org/show_bug.cgi?id=21012 */ ··· 3306 3306 struct toshiba_acpi_dev *dev; 3307 3307 const char *hci_method; 3308 3308 u32 dummy; 3309 - const struct dmi_system_id *dmi_id; 3310 - long quirks = 0; 3311 3309 int ret = 0; 3312 3310 3313 3311 if (toshiba_acpi) ··· 3458 3460 } 3459 3461 #endif 3460 3462 3461 - dmi_id = dmi_first_match(toshiba_dmi_quirks); 3462 - if (dmi_id) 3463 - quirks = (long)dmi_id->driver_data; 3464 - 3465 - if (turn_on_panel_on_resume == -1) 3466 - turn_on_panel_on_resume = !!(quirks & QUIRK_TURN_ON_PANEL_ON_RESUME); 3467 - 3468 - if (hci_hotkey_quickstart == -1) 3469 - hci_hotkey_quickstart = !!(quirks & QUIRK_HCI_HOTKEY_QUICKSTART); 3470 - 3471 3463 toshiba_wwan_available(dev); 3472 3464 if (dev->wwan_supported) 3473 3465 toshiba_acpi_setup_wwan_rfkill(dev); ··· 3606 3618 .drv.pm = &toshiba_acpi_pm, 3607 3619 }; 3608 3620 3621 + static void __init toshiba_dmi_init(void) 3622 + { 3623 + const struct dmi_system_id *dmi_id; 3624 + long quirks = 0; 3625 + 3626 + dmi_id = dmi_first_match(toshiba_dmi_quirks); 3627 + if (dmi_id) 3628 + quirks = (long)dmi_id->driver_data; 3629 + 3630 + if (turn_on_panel_on_resume == -1) 3631 + turn_on_panel_on_resume = !!(quirks & QUIRK_TURN_ON_PANEL_ON_RESUME); 3632 + 3633 + if (hci_hotkey_quickstart == -1) 3634 + hci_hotkey_quickstart = !!(quirks & QUIRK_HCI_HOTKEY_QUICKSTART); 3635 + } 3636 + 3609 3637 static int __init toshiba_acpi_init(void) 3610 3638 { 3611 3639 int ret; 3612 3640 3641 + toshiba_dmi_init(); 3613 3642 toshiba_proc_dir = proc_mkdir(PROC_TOSHIBA, acpi_root_dir); 3614 3643 if (!toshiba_proc_dir) { 3615 3644 pr_err("Unable to create proc dir " PROC_TOSHIBA "\n");
+1
drivers/platform/x86/uv_sysfs.c
··· 929 929 module_exit(uv_sysfs_exit); 930 930 931 931 MODULE_AUTHOR("Hewlett Packard Enterprise"); 932 + MODULE_DESCRIPTION("Sysfs structure for HPE UV systems"); 932 933 MODULE_LICENSE("GPL");
+3
drivers/platform/x86/wireless-hotkey.c
··· 14 14 #include <linux/acpi.h> 15 15 #include <acpi/acpi_bus.h> 16 16 17 + MODULE_DESCRIPTION("Airplane mode button for AMD, HP & Xiaomi laptops"); 17 18 MODULE_LICENSE("GPL"); 18 19 MODULE_AUTHOR("Alex Hung"); 19 20 MODULE_ALIAS("acpi*:HPQ6001:*"); 20 21 MODULE_ALIAS("acpi*:WSTADEF:*"); 21 22 MODULE_ALIAS("acpi*:AMDI0051:*"); 23 + MODULE_ALIAS("acpi*:LGEX0815:*"); 22 24 23 25 struct wl_button { 24 26 struct input_dev *input_dev; ··· 31 29 {"HPQ6001", 0}, 32 30 {"WSTADEF", 0}, 33 31 {"AMDI0051", 0}, 32 + {"LGEX0815", 0}, 34 33 {"", 0}, 35 34 }; 36 35
+1
drivers/platform/x86/xo1-rfkill.c
··· 74 74 module_platform_driver(xo1_rfkill_driver); 75 75 76 76 MODULE_AUTHOR("Daniel Drake <dsd@laptop.org>"); 77 + MODULE_DESCRIPTION("OLPC XO-1 software RF kill switch"); 77 78 MODULE_LICENSE("GPL"); 78 79 MODULE_ALIAS("platform:xo1-rfkill");
+1
drivers/reset/Kconfig
··· 68 68 69 69 config RESET_GPIO 70 70 tristate "GPIO reset controller" 71 + depends on GPIOLIB 71 72 help 72 73 This enables a generic reset controller for resets attached via 73 74 GPIOs. Typically for OF platforms this driver expects "reset-gpios"
+1
drivers/reset/hisilicon/hi6220_reset.c
··· 219 219 220 220 postcore_initcall(hi6220_reset_init); 221 221 222 + MODULE_DESCRIPTION("Hisilicon Hi6220 reset controller driver"); 222 223 MODULE_LICENSE("GPL v2");
+2 -2
drivers/s390/block/dasd_eckd.c
··· 4906 4906 ccw++; 4907 4907 if (dst) { 4908 4908 if (ccw->flags & CCW_FLAG_IDA) 4909 - cda = *((char **)dma32_to_virt(ccw->cda)); 4909 + cda = dma64_to_virt(*((dma64_t *)dma32_to_virt(ccw->cda))); 4910 4910 else 4911 4911 cda = dma32_to_virt(ccw->cda); 4912 4912 if (dst != cda) { ··· 5525 5525 5526 5526 /* get pointer to data (consider IDALs) */ 5527 5527 if (from->flags & CCW_FLAG_IDA) 5528 - datap = (char *)*((addr_t *)dma32_to_virt(from->cda)); 5528 + datap = dma64_to_virt(*((dma64_t *)dma32_to_virt(from->cda))); 5529 5529 else 5530 5530 datap = dma32_to_virt(from->cda); 5531 5531
+1 -1
drivers/s390/block/dasd_fba.c
··· 585 585 ccw++; 586 586 if (dst) { 587 587 if (ccw->flags & CCW_FLAG_IDA) 588 - cda = *((char **)dma32_to_virt(ccw->cda)); 588 + cda = dma64_to_virt(*((dma64_t *)dma32_to_virt(ccw->cda))); 589 589 else 590 590 cda = dma32_to_virt(ccw->cda); 591 591 if (dst != cda) {
+1
drivers/s390/char/sclp.c
··· 1293 1293 fail_unregister_reboot_notifier: 1294 1294 unregister_reboot_notifier(&sclp_reboot_notifier); 1295 1295 fail_init_state_uninitialized: 1296 + list_del(&sclp_state_change_event.list); 1296 1297 sclp_init_state = sclp_init_state_uninitialized; 1297 1298 free_page((unsigned long) sclp_read_sccb); 1298 1299 free_page((unsigned long) sclp_init_sccb);
+5 -4
drivers/s390/cio/vfio_ccw_cp.c
··· 490 490 struct channel_program *cp) 491 491 { 492 492 struct ccwchain *iter; 493 - u32 cda, ccw_head; 493 + u32 offset, ccw_head; 494 494 495 495 list_for_each_entry(iter, &cp->ccwchain_list, next) { 496 496 ccw_head = iter->ch_iova; 497 497 if (is_cpa_within_range(ccw->cda, ccw_head, iter->ch_len)) { 498 - cda = (u64)iter->ch_ccw + dma32_to_u32(ccw->cda) - ccw_head; 499 - ccw->cda = u32_to_dma32(cda); 498 + /* Calculate offset of TIC target */ 499 + offset = dma32_to_u32(ccw->cda) - ccw_head; 500 + ccw->cda = virt_to_dma32((void *)iter->ch_ccw + offset); 500 501 return 0; 501 502 } 502 503 } ··· 915 914 * in the ioctl directly. Path status changes etc. 916 915 */ 917 916 list_for_each_entry(chain, &cp->ccwchain_list, next) { 918 - ccw_head = (u32)(u64)chain->ch_ccw; 917 + ccw_head = dma32_to_u32(virt_to_dma32(chain->ch_ccw)); 919 918 /* 920 919 * On successful execution, cpa points just beyond the end 921 920 * of the chain.
+3 -1
drivers/s390/virtio/virtio_ccw.c
··· 698 698 dma64_t *indicatorp = NULL; 699 699 int ret, i, queue_idx = 0; 700 700 struct ccw1 *ccw; 701 + dma32_t indicatorp_dma = 0; 701 702 702 703 ccw = ccw_device_dma_zalloc(vcdev->cdev, sizeof(*ccw), NULL); 703 704 if (!ccw) ··· 726 725 */ 727 726 indicatorp = ccw_device_dma_zalloc(vcdev->cdev, 728 727 sizeof(*indicatorp), 729 - &ccw->cda); 728 + &indicatorp_dma); 730 729 if (!indicatorp) 731 730 goto out; 732 731 *indicatorp = indicators_dma(vcdev); ··· 736 735 /* no error, just fall back to legacy interrupts */ 737 736 vcdev->is_thinint = false; 738 737 } 738 + ccw->cda = indicatorp_dma; 739 739 if (!vcdev->is_thinint) { 740 740 /* Register queue indicators with host. */ 741 741 *indicators(vcdev) = 0;
+3 -3
drivers/scsi/libsas/sas_ata.c
··· 610 610 611 611 rc = ata_sas_tport_add(ata_host->dev, ap); 612 612 if (rc) 613 - goto destroy_port; 613 + goto free_port; 614 614 615 615 found_dev->sata_dev.ata_host = ata_host; 616 616 found_dev->sata_dev.ap = ap; 617 617 618 618 return 0; 619 619 620 - destroy_port: 621 - kfree(ap); 620 + free_port: 621 + ata_port_free(ap); 622 622 free_host: 623 623 ata_host_put(ata_host); 624 624 return rc;
+1 -1
drivers/scsi/libsas/sas_discover.c
··· 301 301 302 302 if (dev_is_sata(dev) && dev->sata_dev.ap) { 303 303 ata_sas_tport_delete(dev->sata_dev.ap); 304 - kfree(dev->sata_dev.ap); 304 + ata_port_free(dev->sata_dev.ap); 305 305 ata_host_put(dev->sata_dev.ata_host); 306 306 dev->sata_dev.ata_host = NULL; 307 307 dev->sata_dev.ap = NULL;
+14
drivers/scsi/libsas/sas_internal.h
··· 145 145 func, dev->parent ? "exp-attached" : 146 146 "direct-attached", 147 147 SAS_ADDR(dev->sas_addr), err); 148 + 149 + /* 150 + * If the device probe failed, the expander phy attached address 151 + * needs to be reset so that the phy will not be treated as flutter 152 + * in the next revalidation 153 + */ 154 + if (dev->parent && !dev_is_expander(dev->dev_type)) { 155 + struct sas_phy *phy = dev->phy; 156 + struct domain_device *parent = dev->parent; 157 + struct ex_phy *ex_phy = &parent->ex_dev.ex_phy[phy->number]; 158 + 159 + memset(ex_phy->attached_sas_addr, 0, SAS_ADDR_SIZE); 160 + } 161 + 148 162 sas_unregister_dev(dev->port, dev); 149 163 } 150 164
+5 -1
drivers/scsi/scsi_debug.c
··· 926 926 static const int condition_met_result = SAM_STAT_CONDITION_MET; 927 927 928 928 static struct dentry *sdebug_debugfs_root; 929 + static ASYNC_DOMAIN_EXCLUSIVE(sdebug_async_domain); 929 930 930 931 static void sdebug_err_free(struct rcu_head *head) 931 932 { ··· 1149 1148 if (!targetip) 1150 1149 return -ENOMEM; 1151 1150 1151 + async_synchronize_full_domain(&sdebug_async_domain); 1152 + 1152 1153 targetip->debugfs_entry = debugfs_create_dir(dev_name(&starget->dev), 1153 1154 sdebug_debugfs_root); 1154 1155 ··· 1177 1174 targetip = (struct sdebug_target_info *)starget->hostdata; 1178 1175 if (targetip) { 1179 1176 starget->hostdata = NULL; 1180 - async_schedule(sdebug_tartget_cleanup_async, targetip); 1177 + async_schedule_domain(sdebug_tartget_cleanup_async, targetip, 1178 + &sdebug_async_domain); 1181 1179 } 1182 1180 } 1183 1181
+1 -1
drivers/soc/litex/Kconfig
··· 7 7 8 8 config LITEX_SOC_CONTROLLER 9 9 tristate "Enable LiteX SoC Controller driver" 10 - depends on OF || COMPILE_TEST 10 + depends on OF 11 11 depends on HAS_IOMEM 12 12 select LITEX 13 13 help
+1 -3
drivers/soc/litex/litex_soc_ctrl.c
··· 82 82 return NOTIFY_DONE; 83 83 } 84 84 85 - #ifdef CONFIG_OF 86 85 static const struct of_device_id litex_soc_ctrl_of_match[] = { 87 86 {.compatible = "litex,soc-controller"}, 88 87 {}, 89 88 }; 90 89 MODULE_DEVICE_TABLE(of, litex_soc_ctrl_of_match); 91 - #endif /* CONFIG_OF */ 92 90 93 91 static int litex_soc_ctrl_probe(struct platform_device *pdev) 94 92 { ··· 128 130 static struct platform_driver litex_soc_ctrl_driver = { 129 131 .driver = { 130 132 .name = "litex-soc-controller", 131 - .of_match_table = of_match_ptr(litex_soc_ctrl_of_match) 133 + .of_match_table = litex_soc_ctrl_of_match, 132 134 }, 133 135 .probe = litex_soc_ctrl_probe, 134 136 .remove_new = litex_soc_ctrl_remove,
+2 -2
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
··· 707 707 * block forever. 708 708 */ 709 709 for (i = 0; i < VCHIQ_INIT_RETRIES; i++) { 710 - if (state) 710 + if (vchiq_remote_initialised(state)) 711 711 break; 712 712 usleep_range(500, 600); 713 713 } ··· 1202 1202 { 1203 1203 int i; 1204 1204 1205 - if (!state) 1205 + if (!vchiq_remote_initialised(state)) 1206 1206 return; 1207 1207 1208 1208 /*
+5
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
··· 413 413 struct opaque_platform_state *platform_state; 414 414 }; 415 415 416 + static inline bool vchiq_remote_initialised(const struct vchiq_state *state) 417 + { 418 + return state->remote && state->remote->initialised; 419 + } 420 + 416 421 struct bulk_waiter { 417 422 struct vchiq_bulk *bulk; 418 423 struct completion event;
+1 -1
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
··· 138 138 139 139 #else /* CONFIG_DEBUG_FS */ 140 140 141 - void vchiq_debugfs_init(void) 141 + void vchiq_debugfs_init(struct vchiq_state *state) 142 142 { 143 143 } 144 144
+6 -1
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c
··· 1170 1170 1171 1171 dev_dbg(state->dev, "arm: vchiq open\n"); 1172 1172 1173 + if (!vchiq_remote_initialised(state)) { 1174 + dev_dbg(state->dev, "arm: vchiq has no connection to VideoCore\n"); 1175 + return -ENOTCONN; 1176 + } 1177 + 1173 1178 instance = kzalloc(sizeof(*instance), GFP_KERNEL); 1174 1179 if (!instance) 1175 1180 return -ENOMEM; ··· 1205 1200 1206 1201 dev_dbg(state->dev, "arm: instance=%p\n", instance); 1207 1202 1208 - if (!state) { 1203 + if (!vchiq_remote_initialised(state)) { 1209 1204 ret = -EPERM; 1210 1205 goto out; 1211 1206 }
+9 -3
drivers/tee/optee/ffa_abi.c
··· 660 660 const struct ffa_ops *ops) 661 661 { 662 662 const struct ffa_msg_ops *msg_ops = ops->msg_ops; 663 - struct ffa_send_direct_data data = { OPTEE_FFA_GET_API_VERSION }; 663 + struct ffa_send_direct_data data = { 664 + .data0 = OPTEE_FFA_GET_API_VERSION, 665 + }; 664 666 int rc; 665 667 666 668 msg_ops->mode_32bit_set(ffa_dev); ··· 679 677 return false; 680 678 } 681 679 682 - data = (struct ffa_send_direct_data){ OPTEE_FFA_GET_OS_VERSION }; 680 + data = (struct ffa_send_direct_data){ 681 + .data0 = OPTEE_FFA_GET_OS_VERSION, 682 + }; 683 683 rc = msg_ops->sync_send_receive(ffa_dev, &data); 684 684 if (rc) { 685 685 pr_err("Unexpected error %d\n", rc); ··· 702 698 unsigned int *rpc_param_count, 703 699 unsigned int *max_notif_value) 704 700 { 705 - struct ffa_send_direct_data data = { OPTEE_FFA_EXCHANGE_CAPABILITIES }; 701 + struct ffa_send_direct_data data = { 702 + .data0 = OPTEE_FFA_EXCHANGE_CAPABILITIES, 703 + }; 706 704 int rc; 707 705 708 706 rc = ops->msg_ops->sync_send_receive(ffa_dev, &data);
+5 -18
drivers/thermal/gov_step_wise.c
··· 55 55 if (cur_state <= instance->lower) 56 56 return THERMAL_NO_TARGET; 57 57 58 - return clamp(cur_state - 1, instance->lower, instance->upper); 58 + /* 59 + * If 'throttle' is false, no mitigation is necessary, so 60 + * request the lower state for this instance. 61 + */ 62 + return instance->lower; 59 63 } 60 64 61 65 return instance->target; ··· 96 92 97 93 if (instance->initialized && old_target == instance->target) 98 94 continue; 99 - 100 - if (trip->type == THERMAL_TRIP_PASSIVE) { 101 - /* 102 - * If the target state for this thermal instance 103 - * changes from THERMAL_NO_TARGET to something else, 104 - * ensure that the zone temperature will be updated 105 - * (assuming enabled passive cooling) until it becomes 106 - * THERMAL_NO_TARGET again, or the cooling device may 107 - * not be reset to its initial state. 108 - */ 109 - if (old_target == THERMAL_NO_TARGET && 110 - instance->target != THERMAL_NO_TARGET) 111 - tz->passive++; 112 - else if (old_target != THERMAL_NO_TARGET && 113 - instance->target == THERMAL_NO_TARGET) 114 - tz->passive--; 115 - } 116 95 117 96 instance->initialized = true; 118 97
+1 -1
drivers/tty/mxser.c
··· 288 288 enum mxser_must_hwid must_hwid; 289 289 speed_t max_baud; 290 290 291 - struct mxser_port ports[] __counted_by(nports); 291 + struct mxser_port ports[] /* __counted_by(nports) */; 292 292 }; 293 293 294 294 static DECLARE_BITMAP(mxser_boards, MXSER_BOARDS);
-5
drivers/tty/serial/8250/8250_core.c
··· 15 15 */ 16 16 17 17 #include <linux/acpi.h> 18 - #include <linux/cleanup.h> 19 18 #include <linux/module.h> 20 19 #include <linux/moduleparam.h> 21 20 #include <linux/ioport.h> ··· 40 41 #endif 41 42 42 43 #include <asm/irq.h> 43 - 44 - #include "../serial_base.h" /* For serial_base_add_isa_preferred_console() */ 45 44 46 45 #include "8250.h" 47 46 ··· 560 563 port->irqflags |= irqflag; 561 564 if (serial8250_isa_config != NULL) 562 565 serial8250_isa_config(i, &up->port, &up->capabilities); 563 - 564 - serial_base_add_isa_preferred_console(serial8250_reg.dev_name, i); 565 566 } 566 567 } 567 568
+20 -5
drivers/tty/serial/8250/8250_omap.c
··· 115 115 /* RX FIFO occupancy indicator */ 116 116 #define UART_OMAP_RX_LVL 0x19 117 117 118 + /* Timeout low and High */ 119 + #define UART_OMAP_TO_L 0x26 120 + #define UART_OMAP_TO_H 0x27 121 + 118 122 /* 119 123 * Copy of the genpd flags for the console. 120 124 * Only used if console suspend is disabled ··· 667 663 668 664 /* 669 665 * On K3 SoCs, it is observed that RX TIMEOUT is signalled after 670 - * FIFO has been drained, in which case a dummy read of RX FIFO 671 - * is required to clear RX TIMEOUT condition. 666 + * FIFO has been drained or erroneously. 667 + * So apply solution of Errata i2310 as mentioned in 668 + * https://www.ti.com/lit/pdf/sprz536 672 669 */ 673 670 if (priv->habit & UART_RX_TIMEOUT_QUIRK && 674 - (iir & UART_IIR_RX_TIMEOUT) == UART_IIR_RX_TIMEOUT && 675 - serial_port_in(port, UART_OMAP_RX_LVL) == 0) { 676 - serial_port_in(port, UART_RX); 671 + (iir & UART_IIR_RX_TIMEOUT) == UART_IIR_RX_TIMEOUT) { 672 + unsigned char efr2, timeout_h, timeout_l; 673 + 674 + efr2 = serial_in(up, UART_OMAP_EFR2); 675 + timeout_h = serial_in(up, UART_OMAP_TO_H); 676 + timeout_l = serial_in(up, UART_OMAP_TO_L); 677 + serial_out(up, UART_OMAP_TO_H, 0xFF); 678 + serial_out(up, UART_OMAP_TO_L, 0xFF); 679 + serial_out(up, UART_OMAP_EFR2, UART_OMAP_EFR2_TIMEOUT_BEHAVE); 680 + serial_in(up, UART_IIR); 681 + serial_out(up, UART_OMAP_EFR2, efr2); 682 + serial_out(up, UART_OMAP_TO_H, timeout_h); 683 + serial_out(up, UART_OMAP_TO_L, timeout_l); 677 684 } 678 685 679 686 /* Stop processing interrupts on input overrun */
+12 -1
drivers/tty/serial/8250/8250_pci.c
··· 1985 1985 MOXA_SUPP_RS485 = BIT(2), 1986 1986 }; 1987 1987 1988 + static unsigned short moxa_get_nports(unsigned short device) 1989 + { 1990 + switch (device) { 1991 + case PCI_DEVICE_ID_MOXA_CP116E_A_A: 1992 + case PCI_DEVICE_ID_MOXA_CP116E_A_B: 1993 + return 8; 1994 + } 1995 + 1996 + return FIELD_GET(0x00F0, device); 1997 + } 1998 + 1988 1999 static bool pci_moxa_is_mini_pcie(unsigned short device) 1989 2000 { 1990 2001 if (device == PCI_DEVICE_ID_MOXA_CP102N || ··· 2049 2038 { 2050 2039 unsigned short device = dev->device; 2051 2040 resource_size_t iobar_addr = pci_resource_start(dev, 2); 2052 - unsigned int num_ports = (device & 0x00F0) >> 4, i; 2041 + unsigned int i, num_ports = moxa_get_nports(device); 2053 2042 u8 val, init_mode = MOXA_RS232; 2054 2043 2055 2044 if (!(pci_moxa_supported_rs(dev) & MOXA_SUPP_RS232)) {
+5 -2
drivers/tty/serial/bcm63xx_uart.c
··· 308 308 309 309 val = bcm_uart_readl(port, UART_MCTL_REG); 310 310 val = (val & UART_MCTL_TXFIFOFILL_MASK) >> UART_MCTL_TXFIFOFILL_SHIFT; 311 - 312 - pending = uart_port_tx_limited(port, ch, port->fifosize - val, 311 + pending = uart_port_tx_limited_flags(port, ch, UART_TX_NOSTOP, 312 + port->fifosize - val, 313 313 true, 314 314 bcm_uart_writel(port, ch, UART_FIFO_REG), 315 315 ({})); ··· 320 320 val = bcm_uart_readl(port, UART_IR_REG); 321 321 val &= ~UART_TX_INT_MASK; 322 322 bcm_uart_writel(port, val, UART_IR_REG); 323 + 324 + if (uart_tx_stopped(port)) 325 + bcm_uart_stop_tx(port); 323 326 } 324 327 325 328 /*
+3 -1
drivers/tty/serial/imx.c
··· 1952 1952 1953 1953 /* Make sure Rx is enabled in case Tx is active with Rx disabled */ 1954 1954 if (!(rs485conf->flags & SER_RS485_ENABLED) || 1955 - rs485conf->flags & SER_RS485_RX_DURING_TX) 1955 + rs485conf->flags & SER_RS485_RX_DURING_TX) { 1956 + imx_uart_setup_ufcr(sport, TXTL_DEFAULT, RXTL_DEFAULT); 1956 1957 imx_uart_start_rx(port); 1958 + } 1957 1959 1958 1960 return 0; 1959 1961 }
+1 -1
drivers/tty/serial/mcf.c
··· 462 462 .verify_port = mcf_verify_port, 463 463 }; 464 464 465 - static struct mcf_uart mcf_ports[4]; 465 + static struct mcf_uart mcf_ports[10]; 466 466 467 467 #define MCF_MAXPORTS ARRAY_SIZE(mcf_ports) 468 468
-30
drivers/tty/serial/serial_base.h
··· 49 49 50 50 int serial_core_register_port(struct uart_driver *drv, struct uart_port *port); 51 51 void serial_core_unregister_port(struct uart_driver *drv, struct uart_port *port); 52 - 53 - #ifdef CONFIG_SERIAL_CORE_CONSOLE 54 - 55 - int serial_base_add_preferred_console(struct uart_driver *drv, 56 - struct uart_port *port); 57 - 58 - #else 59 - 60 - static inline 61 - int serial_base_add_preferred_console(struct uart_driver *drv, 62 - struct uart_port *port) 63 - { 64 - return 0; 65 - } 66 - 67 - #endif 68 - 69 - #ifdef CONFIG_SERIAL_8250_CONSOLE 70 - 71 - int serial_base_add_isa_preferred_console(const char *name, int idx); 72 - 73 - #else 74 - 75 - static inline 76 - int serial_base_add_isa_preferred_console(const char *name, int idx) 77 - { 78 - return 0; 79 - } 80 - 81 - #endif
-129
drivers/tty/serial/serial_base_bus.c
··· 8 8 * The serial core bus manages the serial core controller instances. 9 9 */ 10 10 11 - #include <linux/cleanup.h> 12 11 #include <linux/container_of.h> 13 12 #include <linux/device.h> 14 13 #include <linux/idr.h> ··· 203 204 ida_free(&ctrl_dev->port_ida, port_dev->port->port_id); 204 205 put_device(&port_dev->dev); 205 206 } 206 - 207 - #ifdef CONFIG_SERIAL_CORE_CONSOLE 208 - 209 - static int serial_base_add_one_prefcon(const char *match, const char *dev_name, 210 - int port_id) 211 - { 212 - int ret; 213 - 214 - ret = add_preferred_console_match(match, dev_name, port_id); 215 - if (ret == -ENOENT) 216 - return 0; 217 - 218 - return ret; 219 - } 220 - 221 - #ifdef __sparc__ 222 - 223 - /* Handle Sparc ttya and ttyb options as done in console_setup() */ 224 - static int serial_base_add_sparc_console(const char *dev_name, int idx) 225 - { 226 - const char *name; 227 - 228 - switch (idx) { 229 - case 0: 230 - name = "ttya"; 231 - break; 232 - case 1: 233 - name = "ttyb"; 234 - break; 235 - default: 236 - return 0; 237 - } 238 - 239 - return serial_base_add_one_prefcon(name, dev_name, idx); 240 - } 241 - 242 - #else 243 - 244 - static inline int serial_base_add_sparc_console(const char *dev_name, int idx) 245 - { 246 - return 0; 247 - } 248 - 249 - #endif 250 - 251 - static int serial_base_add_prefcon(const char *name, int idx) 252 - { 253 - const char *char_match __free(kfree) = NULL; 254 - const char *nmbr_match __free(kfree) = NULL; 255 - int ret; 256 - 257 - /* Handle ttyS specific options */ 258 - if (strstarts(name, "ttyS")) { 259 - /* No name, just a number */ 260 - nmbr_match = kasprintf(GFP_KERNEL, "%i", idx); 261 - if (!nmbr_match) 262 - return -ENODEV; 263 - 264 - ret = serial_base_add_one_prefcon(nmbr_match, name, idx); 265 - if (ret) 266 - return ret; 267 - 268 - /* Sparc ttya and ttyb */ 269 - ret = serial_base_add_sparc_console(name, idx); 270 - if (ret) 271 - return ret; 272 - } 273 - 274 - /* Handle the traditional character device name style console=ttyS0 */ 275 - char_match = kasprintf(GFP_KERNEL, "%s%i", name, idx); 276 - if (!char_match) 277 - return -ENOMEM; 278 - 279 - return serial_base_add_one_prefcon(char_match, name, idx); 280 - } 281 - 282 - /** 283 - * serial_base_add_preferred_console - Adds a preferred console 284 - * @drv: Serial port device driver 285 - * @port: Serial port instance 286 - * 287 - * Tries to add a preferred console for a serial port if specified in the 288 - * kernel command line. Supports both the traditional character device such 289 - * as console=ttyS0, and a hardware addressing based console=DEVNAME:0.0 290 - * style name. 291 - * 292 - * Translates the kernel command line option using a hardware based addressing 293 - * console=DEVNAME:0.0 to the serial port character device such as ttyS0. 294 - * Cannot be called early for ISA ports, depends on struct device. 295 - * 296 - * Note that duplicates are ignored by add_preferred_console(). 297 - * 298 - * Return: 0 on success, negative error code on failure. 299 - */ 300 - int serial_base_add_preferred_console(struct uart_driver *drv, 301 - struct uart_port *port) 302 - { 303 - const char *port_match __free(kfree) = NULL; 304 - int ret; 305 - 306 - ret = serial_base_add_prefcon(drv->dev_name, port->line); 307 - if (ret) 308 - return ret; 309 - 310 - port_match = kasprintf(GFP_KERNEL, "%s:%i.%i", dev_name(port->dev), 311 - port->ctrl_id, port->port_id); 312 - if (!port_match) 313 - return -ENOMEM; 314 - 315 - /* Translate a hardware addressing style console=DEVNAME:0.0 */ 316 - return serial_base_add_one_prefcon(port_match, drv->dev_name, port->line); 317 - } 318 - 319 - #endif 320 - 321 - #ifdef CONFIG_SERIAL_8250_CONSOLE 322 - 323 - /* 324 - * Early ISA ports initialize the console before there is no struct device. 325 - * This should be only called from serial8250_isa_init_preferred_console(), 326 - * other callers are likely wrong and should rely on earlycon instead. 327 - */ 328 - int serial_base_add_isa_preferred_console(const char *name, int idx) 329 - { 330 - return serial_base_add_prefcon(name, idx); 331 - } 332 - 333 - #endif 334 207 335 208 static int serial_base_init(void) 336 209 {
-4
drivers/tty/serial/serial_core.c
··· 3422 3422 if (ret) 3423 3423 goto err_unregister_ctrl_dev; 3424 3424 3425 - ret = serial_base_add_preferred_console(drv, port); 3426 - if (ret) 3427 - goto err_unregister_port_dev; 3428 - 3429 3425 ret = serial_core_add_one_port(drv, port); 3430 3426 if (ret) 3431 3427 goto err_unregister_port_dev;
+14
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 1135 int ret; 1135 1136 1136 1137 /* instance init */ ··· 1174 1173 1175 1174 if (!cmd_ep) { 1176 1175 usb_dbg(usbatm_instance, "cxacru_bind: no command endpoint\n"); 1176 + ret = -ENODEV; 1177 + goto fail; 1178 + } 1179 + 1180 + if (usb_endpoint_xfer_int(&cmd_ep->desc)) 1181 + ret = usb_find_common_endpoints(intf->cur_altsetting, 1182 + NULL, NULL, &in, &out); 1183 + else 1184 + ret = usb_find_common_endpoints(intf->cur_altsetting, 1185 + &in, &out, NULL, NULL); 1186 + 1187 + if (ret) { 1188 + usb_err(usbatm_instance, "cxacru_bind: interface has incorrect endpoints\n"); 1177 1189 ret = -ENODEV; 1178 1190 goto fail; 1179 1191 }
+19 -7
drivers/usb/dwc3/core.c
··· 957 957 958 958 static void dwc3_core_setup_global_control(struct dwc3 *dwc) 959 959 { 960 + unsigned int power_opt; 961 + unsigned int hw_mode; 960 962 u32 reg; 961 963 962 964 reg = dwc3_readl(dwc->regs, DWC3_GCTL); 963 965 reg &= ~DWC3_GCTL_SCALEDOWN_MASK; 966 + hw_mode = DWC3_GHWPARAMS0_MODE(dwc->hwparams.hwparams0); 967 + power_opt = DWC3_GHWPARAMS1_EN_PWROPT(dwc->hwparams.hwparams1); 964 968 965 - switch (DWC3_GHWPARAMS1_EN_PWROPT(dwc->hwparams.hwparams1)) { 969 + switch (power_opt) { 966 970 case DWC3_GHWPARAMS1_EN_PWROPT_CLK: 967 971 /** 968 972 * WORKAROUND: DWC3 revisions between 2.10a and 2.50a have an ··· 998 994 /* nothing */ 999 995 break; 1000 996 } 997 + 998 + /* 999 + * This is a workaround for STAR#4846132, which only affects 1000 + * DWC_usb31 version2.00a operating in host mode. 1001 + * 1002 + * There is a problem in DWC_usb31 version 2.00a operating 1003 + * in host mode that would cause a CSR read timeout When CSR 1004 + * read coincides with RAM Clock Gating Entry. By disable 1005 + * Clock Gating, sacrificing power consumption for normal 1006 + * operation. 1007 + */ 1008 + if (power_opt != DWC3_GHWPARAMS1_EN_PWROPT_NO && 1009 + hw_mode != DWC3_GHWPARAMS0_MODE_GADGET && DWC3_VER_IS(DWC31, 200A)) 1010 + reg |= DWC3_GCTL_DSBLCLKGTNG; 1001 1011 1002 1012 /* check if current dwc3 is on simulation board */ 1003 1013 if (dwc->hwparams.hwparams6 & DWC3_GHWPARAMS6_EN_FPGA) { ··· 2268 2250 2269 2251 static int dwc3_suspend_common(struct dwc3 *dwc, pm_message_t msg) 2270 2252 { 2271 - unsigned long flags; 2272 2253 u32 reg; 2273 2254 int i; 2274 2255 ··· 2310 2293 break; 2311 2294 2312 2295 if (dwc->current_otg_role == DWC3_OTG_ROLE_DEVICE) { 2313 - spin_lock_irqsave(&dwc->lock, flags); 2314 2296 dwc3_gadget_suspend(dwc); 2315 - spin_unlock_irqrestore(&dwc->lock, flags); 2316 2297 synchronize_irq(dwc->irq_gadget); 2317 2298 } 2318 2299 ··· 2327 2312 2328 2313 static int dwc3_resume_common(struct dwc3 *dwc, pm_message_t msg) 2329 2314 { 2330 - unsigned long flags; 2331 2315 int ret; 2332 2316 u32 reg; 2333 2317 int i; ··· 2380 2366 if (dwc->current_otg_role == DWC3_OTG_ROLE_HOST) { 2381 2367 dwc3_otg_host_init(dwc); 2382 2368 } else if (dwc->current_otg_role == DWC3_OTG_ROLE_DEVICE) { 2383 - spin_lock_irqsave(&dwc->lock, flags); 2384 2369 dwc3_gadget_resume(dwc); 2385 - spin_unlock_irqrestore(&dwc->lock, flags); 2386 2370 } 2387 2371 2388 2372 break;
+30 -10
drivers/usb/gadget/function/f_printer.c
··· 213 213 struct usb_endpoint_descriptor *ss) 214 214 { 215 215 switch (gadget->speed) { 216 + case USB_SPEED_SUPER_PLUS: 216 217 case USB_SPEED_SUPER: 217 218 return ss; 218 219 case USB_SPEED_HIGH: ··· 450 449 mutex_lock(&dev->lock_printer_io); 451 450 spin_lock_irqsave(&dev->lock, flags); 452 451 453 - if (dev->interface < 0) { 454 - spin_unlock_irqrestore(&dev->lock, flags); 455 - mutex_unlock(&dev->lock_printer_io); 456 - return -ENODEV; 457 - } 452 + if (dev->interface < 0) 453 + goto out_disabled; 458 454 459 455 /* We will use this flag later to check if a printer reset happened 460 456 * after we turn interrupts back on. ··· 459 461 dev->reset_printer = 0; 460 462 461 463 setup_rx_reqs(dev); 464 + /* this dropped the lock - need to retest */ 465 + if (dev->interface < 0) 466 + goto out_disabled; 462 467 463 468 bytes_copied = 0; 464 469 current_rx_req = dev->current_rx_req; ··· 495 494 wait_event_interruptible(dev->rx_wait, 496 495 (likely(!list_empty(&dev->rx_buffers)))); 497 496 spin_lock_irqsave(&dev->lock, flags); 497 + if (dev->interface < 0) 498 + goto out_disabled; 498 499 } 499 500 500 501 /* We have data to return then copy it to the caller's buffer.*/ ··· 540 537 return -EAGAIN; 541 538 } 542 539 540 + if (dev->interface < 0) 541 + goto out_disabled; 542 + 543 543 /* If we not returning all the data left in this RX request 544 544 * buffer then adjust the amount of data left in the buffer. 545 545 * Othewise if we are done with this RX request buffer then ··· 572 566 return bytes_copied; 573 567 else 574 568 return -EAGAIN; 569 + 570 + out_disabled: 571 + spin_unlock_irqrestore(&dev->lock, flags); 572 + mutex_unlock(&dev->lock_printer_io); 573 + return -ENODEV; 575 574 } 576 575 577 576 static ssize_t ··· 597 586 mutex_lock(&dev->lock_printer_io); 598 587 spin_lock_irqsave(&dev->lock, flags); 599 588 600 - if (dev->interface < 0) { 601 - spin_unlock_irqrestore(&dev->lock, flags); 602 - mutex_unlock(&dev->lock_printer_io); 603 - return -ENODEV; 604 - } 589 + if (dev->interface < 0) 590 + goto out_disabled; 605 591 606 592 /* Check if a printer reset happens while we have interrupts on */ 607 593 dev->reset_printer = 0; ··· 621 613 wait_event_interruptible(dev->tx_wait, 622 614 (likely(!list_empty(&dev->tx_reqs)))); 623 615 spin_lock_irqsave(&dev->lock, flags); 616 + if (dev->interface < 0) 617 + goto out_disabled; 624 618 } 625 619 626 620 while (likely(!list_empty(&dev->tx_reqs)) && len) { ··· 672 662 return -EAGAIN; 673 663 } 674 664 665 + if (dev->interface < 0) 666 + goto out_disabled; 667 + 675 668 list_add(&req->list, &dev->tx_reqs_active); 676 669 677 670 /* here, we unlock, and only unlock, to avoid deadlock. */ ··· 687 674 mutex_unlock(&dev->lock_printer_io); 688 675 return -EAGAIN; 689 676 } 677 + if (dev->interface < 0) 678 + goto out_disabled; 690 679 } 691 680 692 681 spin_unlock_irqrestore(&dev->lock, flags); ··· 700 685 return bytes_copied; 701 686 else 702 687 return -EAGAIN; 688 + 689 + out_disabled: 690 + spin_unlock_irqrestore(&dev->lock, flags); 691 + mutex_unlock(&dev->lock_printer_io); 692 + return -ENODEV; 703 693 } 704 694 705 695 static int
+1 -3
drivers/usb/gadget/function/u_ether.c
··· 1163 1163 if (netif_running(dev->net)) 1164 1164 eth_start(dev, GFP_ATOMIC); 1165 1165 1166 - netif_device_attach(dev->net); 1167 - 1168 1166 /* on error, disable any endpoints */ 1169 1167 } else { 1170 1168 (void) usb_ep_disable(link->out_ep); ··· 1200 1202 1201 1203 DBG(dev, "%s\n", __func__); 1202 1204 1203 - netif_device_detach(dev->net); 1205 + netif_stop_queue(dev->net); 1204 1206 netif_carrier_off(dev->net); 1205 1207 1206 1208 /* disable endpoints, forcing (synchronous) completion
+2 -2
drivers/usb/gadget/udc/aspeed_udc.c
··· 66 66 #define USB_UPSTREAM_EN BIT(0) 67 67 68 68 /* Main config reg */ 69 - #define UDC_CFG_SET_ADDR(x) ((x) & 0x3f) 70 - #define UDC_CFG_ADDR_MASK (0x3f) 69 + #define UDC_CFG_SET_ADDR(x) ((x) & UDC_CFG_ADDR_MASK) 70 + #define UDC_CFG_ADDR_MASK GENMASK(6, 0) 71 71 72 72 /* Interrupt ctrl & status reg */ 73 73 #define UDC_IRQ_EP_POOL_NAK BIT(17)
+6 -2
drivers/usb/musb/da8xx.c
··· 556 556 ret = of_platform_populate(pdev->dev.of_node, NULL, 557 557 da8xx_auxdata_lookup, &pdev->dev); 558 558 if (ret) 559 - return ret; 559 + goto err_unregister_phy; 560 560 561 561 pinfo = da8xx_dev_info; 562 562 pinfo.parent = &pdev->dev; ··· 571 571 ret = PTR_ERR_OR_ZERO(glue->musb); 572 572 if (ret) { 573 573 dev_err(&pdev->dev, "failed to register musb device: %d\n", ret); 574 - usb_phy_generic_unregister(glue->usb_phy); 574 + goto err_unregister_phy; 575 575 } 576 576 577 + return 0; 578 + 579 + err_unregister_phy: 580 + usb_phy_generic_unregister(glue->usb_phy); 577 581 return ret; 578 582 } 579 583
+61
drivers/usb/typec/ucsi/ucsi_acpi.c
··· 25 25 unsigned long flags; 26 26 #define UCSI_ACPI_COMMAND_PENDING 1 27 27 #define UCSI_ACPI_ACK_PENDING 2 28 + #define UCSI_ACPI_CHECK_BOGUS_EVENT 3 28 29 guid_t guid; 29 30 u64 cmd; 30 31 }; ··· 129 128 .async_write = ucsi_acpi_async_write 130 129 }; 131 130 131 + static int ucsi_gram_read(struct ucsi *ucsi, unsigned int offset, 132 + void *val, size_t val_len) 133 + { 134 + u16 bogus_change = UCSI_CONSTAT_POWER_LEVEL_CHANGE | 135 + UCSI_CONSTAT_PDOS_CHANGE; 136 + struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi); 137 + struct ucsi_connector_status *status; 138 + int ret; 139 + 140 + ret = ucsi_acpi_read(ucsi, offset, val, val_len); 141 + if (ret < 0) 142 + return ret; 143 + 144 + if (UCSI_COMMAND(ua->cmd) == UCSI_GET_CONNECTOR_STATUS && 145 + test_bit(UCSI_ACPI_CHECK_BOGUS_EVENT, &ua->flags) && 146 + offset == UCSI_MESSAGE_IN) { 147 + status = (struct ucsi_connector_status *)val; 148 + 149 + /* Clear the bogus change */ 150 + if (status->change == bogus_change) 151 + status->change = 0; 152 + 153 + clear_bit(UCSI_ACPI_CHECK_BOGUS_EVENT, &ua->flags); 154 + } 155 + 156 + return ret; 157 + } 158 + 159 + static int ucsi_gram_sync_write(struct ucsi *ucsi, unsigned int offset, 160 + const void *val, size_t val_len) 161 + { 162 + struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi); 163 + int ret; 164 + 165 + ret = ucsi_acpi_sync_write(ucsi, offset, val, val_len); 166 + if (ret < 0) 167 + return ret; 168 + 169 + if (UCSI_COMMAND(ua->cmd) == UCSI_GET_PDOS && 170 + ua->cmd & UCSI_GET_PDOS_PARTNER_PDO(1) && 171 + ua->cmd & UCSI_GET_PDOS_SRC_PDOS) 172 + set_bit(UCSI_ACPI_CHECK_BOGUS_EVENT, &ua->flags); 173 + 174 + return ret; 175 + } 176 + 177 + static const struct ucsi_operations ucsi_gram_ops = { 178 + .read = ucsi_gram_read, 179 + .sync_write = ucsi_gram_sync_write, 180 + .async_write = ucsi_acpi_async_write 181 + }; 182 + 132 183 static const struct dmi_system_id ucsi_acpi_quirks[] = { 133 184 { 134 185 .matches = { ··· 188 135 DMI_MATCH(DMI_PRODUCT_NAME, "ZenBook UX325UA_UM325UA"), 189 136 }, 190 137 .driver_data = (void *)&ucsi_zenbook_ops, 138 + }, 139 + { 140 + .matches = { 141 + DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"), 142 + DMI_MATCH(DMI_PRODUCT_FAMILY, "LG gram PC"), 143 + DMI_MATCH(DMI_PRODUCT_NAME, "90Q"), 144 + }, 145 + .driver_data = (void *)&ucsi_gram_ops, 191 146 }, 192 147 { } 193 148 };
+4 -1
drivers/usb/typec/ucsi/ucsi_glink.c
··· 372 372 ret = fwnode_property_read_u32(fwnode, "reg", &port); 373 373 if (ret < 0) { 374 374 dev_err(dev, "missing reg property of %pOFn\n", fwnode); 375 + fwnode_handle_put(fwnode); 375 376 return ret; 376 377 } 377 378 ··· 387 386 if (!desc) 388 387 continue; 389 388 390 - if (IS_ERR(desc)) 389 + if (IS_ERR(desc)) { 390 + fwnode_handle_put(fwnode); 391 391 return dev_err_probe(dev, PTR_ERR(desc), 392 392 "unable to acquire orientation gpio\n"); 393 + } 393 394 ucsi->port_orientation[port] = desc; 394 395 } 395 396
+15 -4
drivers/usb/typec/ucsi/ucsi_stm32g0.c
··· 65 65 struct device *dev; 66 66 unsigned long flags; 67 67 #define COMMAND_PENDING 1 68 + #define ACK_PENDING 2 68 69 const char *fw_name; 69 70 struct ucsi *ucsi; 70 71 bool suspended; ··· 397 396 size_t len) 398 397 { 399 398 struct ucsi_stm32g0 *g0 = ucsi_get_drvdata(ucsi); 399 + bool ack = UCSI_COMMAND(*(u64 *)val) == UCSI_ACK_CC_CI; 400 400 int ret; 401 401 402 - set_bit(COMMAND_PENDING, &g0->flags); 402 + if (ack) 403 + set_bit(ACK_PENDING, &g0->flags); 404 + else 405 + set_bit(COMMAND_PENDING, &g0->flags); 403 406 404 407 ret = ucsi_stm32g0_async_write(ucsi, offset, val, len); 405 408 if (ret) ··· 411 406 412 407 if (!wait_for_completion_timeout(&g0->complete, msecs_to_jiffies(5000))) 413 408 ret = -ETIMEDOUT; 409 + else 410 + return 0; 414 411 415 412 out_clear_bit: 416 - clear_bit(COMMAND_PENDING, &g0->flags); 413 + if (ack) 414 + clear_bit(ACK_PENDING, &g0->flags); 415 + else 416 + clear_bit(COMMAND_PENDING, &g0->flags); 417 417 418 418 return ret; 419 419 } ··· 439 429 if (UCSI_CCI_CONNECTOR(cci)) 440 430 ucsi_connector_change(g0->ucsi, UCSI_CCI_CONNECTOR(cci)); 441 431 442 - if (test_bit(COMMAND_PENDING, &g0->flags) && 443 - cci & (UCSI_CCI_ACK_COMPLETE | UCSI_CCI_COMMAND_COMPLETE)) 432 + if (cci & UCSI_CCI_ACK_COMPLETE && test_and_clear_bit(ACK_PENDING, &g0->flags)) 433 + complete(&g0->complete); 434 + if (cci & UCSI_CCI_COMMAND_COMPLETE && test_and_clear_bit(COMMAND_PENDING, &g0->flags)) 444 435 complete(&g0->complete); 445 436 446 437 return IRQ_HANDLED;
+1
drivers/watchdog/Kconfig
··· 257 257 config LENOVO_SE10_WDT 258 258 tristate "Lenovo SE10 Watchdog" 259 259 depends on (X86 && DMI) || COMPILE_TEST 260 + depends on HAS_IOPORT 260 261 select WATCHDOG_CORE 261 262 help 262 263 If you say yes here you get support for the watchdog
+1
drivers/watchdog/menz69_wdt.c
··· 161 161 module_mcb_driver(men_z069_driver); 162 162 163 163 MODULE_AUTHOR("Johannes Thumshirn <jth@kernel.org>"); 164 + MODULE_DESCRIPTION("Watchdog driver for the MEN z069 IP-Core"); 164 165 MODULE_LICENSE("GPL v2"); 165 166 MODULE_ALIAS("mcb:16z069"); 166 167 MODULE_IMPORT_NS(MCB);
+1
drivers/watchdog/omap_wdt.c
··· 370 370 module_platform_driver(omap_wdt_driver); 371 371 372 372 MODULE_AUTHOR("George G. Davis"); 373 + MODULE_DESCRIPTION("Driver for the TI OMAP 16xx/24xx/34xx 32KHz (non-secure) watchdog"); 373 374 MODULE_LICENSE("GPL"); 374 375 MODULE_ALIAS("platform:omap_wdt");
+1
drivers/watchdog/simatic-ipc-wdt.c
··· 227 227 228 228 module_platform_driver(simatic_ipc_wdt_driver); 229 229 230 + MODULE_DESCRIPTION("Siemens SIMATIC IPC driver for Watchdogs"); 230 231 MODULE_LICENSE("GPL v2"); 231 232 MODULE_ALIAS("platform:" KBUILD_MODNAME); 232 233 MODULE_AUTHOR("Gerd Haeussler <gerd.haeussler.ext@siemens.com>");
+1
drivers/watchdog/ts4800_wdt.c
··· 200 200 module_platform_driver(ts4800_wdt_driver); 201 201 202 202 MODULE_AUTHOR("Damien Riegel <damien.riegel@savoirfairelinux.com>"); 203 + MODULE_DESCRIPTION("Watchdog driver for TS-4800 based boards"); 203 204 MODULE_LICENSE("GPL v2"); 204 205 MODULE_ALIAS("platform:ts4800_wdt");
+1
drivers/watchdog/twl4030_wdt.c
··· 118 118 module_platform_driver(twl4030_wdt_driver); 119 119 120 120 MODULE_AUTHOR("Nokia Corporation"); 121 + MODULE_DESCRIPTION("TWL4030 Watchdog"); 121 122 MODULE_LICENSE("GPL"); 122 123 MODULE_ALIAS("platform:twl4030_wdt"); 123 124
+2 -2
fs/afs/inode.c
··· 512 512 struct afs_vnode *vnode = AFS_FS_I(inode); 513 513 514 514 vnode->volume = as->volume; 515 - vnode->fid.vid = as->volume->vid, 515 + vnode->fid.vid = as->volume->vid; 516 516 vnode->fid.vnode = 1; 517 517 vnode->fid.unique = 1; 518 518 inode->i_ino = 1; ··· 545 545 BUG_ON(!(inode->i_state & I_NEW)); 546 546 547 547 vnode = AFS_FS_I(inode); 548 - vnode->cb_v_check = atomic_read(&as->volume->cb_v_break), 548 + vnode->cb_v_check = atomic_read(&as->volume->cb_v_break); 549 549 afs_set_netfs_context(vnode); 550 550 551 551 op = afs_alloc_operation(key, as->volume);
+139 -124
fs/bcachefs/alloc_background.c
··· 29 29 #include <linux/sched/task.h> 30 30 #include <linux/sort.h> 31 31 32 - static void bch2_discard_one_bucket_fast(struct bch_fs *c, struct bpos bucket); 32 + static void bch2_discard_one_bucket_fast(struct bch_dev *, u64); 33 33 34 34 /* Persistent alloc info: */ 35 35 ··· 893 893 if (statechange(a->data_type == BCH_DATA_need_discard) && 894 894 !bch2_bucket_is_open_safe(c, new.k->p.inode, new.k->p.offset) && 895 895 bucket_flushed(new_a)) 896 - bch2_discard_one_bucket_fast(c, new.k->p); 896 + bch2_discard_one_bucket_fast(ca, new.k->p.offset); 897 897 898 898 if (statechange(a->data_type == BCH_DATA_cached) && 899 899 !bch2_bucket_is_open(c, new.k->p.inode, new.k->p.offset) && 900 900 should_invalidate_buckets(ca, bch2_dev_usage_read(ca))) 901 - bch2_do_invalidates(c); 901 + bch2_dev_do_invalidates(ca); 902 902 903 903 if (statechange(a->data_type == BCH_DATA_need_gc_gens)) 904 904 bch2_gc_gens_async(c); ··· 1636 1636 return ret; 1637 1637 } 1638 1638 1639 - static int discard_in_flight_add(struct bch_fs *c, struct bpos bucket) 1639 + static int discard_in_flight_add(struct bch_dev *ca, u64 bucket, bool in_progress) 1640 1640 { 1641 1641 int ret; 1642 1642 1643 - mutex_lock(&c->discard_buckets_in_flight_lock); 1644 - darray_for_each(c->discard_buckets_in_flight, i) 1645 - if (bkey_eq(*i, bucket)) { 1643 + mutex_lock(&ca->discard_buckets_in_flight_lock); 1644 + darray_for_each(ca->discard_buckets_in_flight, i) 1645 + if (i->bucket == bucket) { 1646 1646 ret = -BCH_ERR_EEXIST_discard_in_flight_add; 1647 1647 goto out; 1648 1648 } 1649 1649 1650 - ret = darray_push(&c->discard_buckets_in_flight, bucket); 1650 + ret = darray_push(&ca->discard_buckets_in_flight, ((struct discard_in_flight) { 1651 + .in_progress = in_progress, 1652 + .bucket = bucket, 1653 + })); 1651 1654 out: 1652 - mutex_unlock(&c->discard_buckets_in_flight_lock); 1655 + mutex_unlock(&ca->discard_buckets_in_flight_lock); 1653 1656 return ret; 1654 1657 } 1655 1658 1656 - static void discard_in_flight_remove(struct bch_fs *c, struct bpos bucket) 1659 + static void discard_in_flight_remove(struct bch_dev *ca, u64 bucket) 1657 1660 { 1658 - mutex_lock(&c->discard_buckets_in_flight_lock); 1659 - darray_for_each(c->discard_buckets_in_flight, i) 1660 - if (bkey_eq(*i, bucket)) { 1661 - darray_remove_item(&c->discard_buckets_in_flight, i); 1661 + mutex_lock(&ca->discard_buckets_in_flight_lock); 1662 + darray_for_each(ca->discard_buckets_in_flight, i) 1663 + if (i->bucket == bucket) { 1664 + BUG_ON(!i->in_progress); 1665 + darray_remove_item(&ca->discard_buckets_in_flight, i); 1662 1666 goto found; 1663 1667 } 1664 1668 BUG(); 1665 1669 found: 1666 - mutex_unlock(&c->discard_buckets_in_flight_lock); 1670 + mutex_unlock(&ca->discard_buckets_in_flight_lock); 1667 1671 } 1668 1672 1669 1673 struct discard_buckets_state { ··· 1675 1671 u64 open; 1676 1672 u64 need_journal_commit; 1677 1673 u64 discarded; 1678 - struct bch_dev *ca; 1679 1674 u64 need_journal_commit_this_dev; 1680 1675 }; 1681 1676 1682 - static void discard_buckets_next_dev(struct bch_fs *c, struct discard_buckets_state *s, struct bch_dev *ca) 1683 - { 1684 - if (s->ca == ca) 1685 - return; 1686 - 1687 - if (s->ca && s->need_journal_commit_this_dev > 1688 - bch2_dev_usage_read(s->ca).d[BCH_DATA_free].buckets) 1689 - bch2_journal_flush_async(&c->journal, NULL); 1690 - 1691 - if (s->ca) 1692 - percpu_ref_put(&s->ca->io_ref); 1693 - s->ca = ca; 1694 - s->need_journal_commit_this_dev = 0; 1695 - } 1696 - 1697 1677 static int bch2_discard_one_bucket(struct btree_trans *trans, 1678 + struct bch_dev *ca, 1698 1679 struct btree_iter *need_discard_iter, 1699 1680 struct bpos *discard_pos_done, 1700 1681 struct discard_buckets_state *s) ··· 1692 1703 struct printbuf buf = PRINTBUF; 1693 1704 bool discard_locked = false; 1694 1705 int ret = 0; 1695 - 1696 - struct bch_dev *ca = s->ca && s->ca->dev_idx == pos.inode 1697 - ? s->ca 1698 - : bch2_dev_get_ioref(c, pos.inode, WRITE); 1699 - if (!ca) { 1700 - bch2_btree_iter_set_pos(need_discard_iter, POS(pos.inode + 1, 0)); 1701 - return 0; 1702 - } 1703 - 1704 - discard_buckets_next_dev(c, s, ca); 1705 1706 1706 1707 if (bch2_bucket_is_open_safe(c, pos.inode, pos.offset)) { 1707 1708 s->open++; ··· 1752 1773 goto out; 1753 1774 } 1754 1775 1755 - if (discard_in_flight_add(c, SPOS(iter.pos.inode, iter.pos.offset, true))) 1776 + if (discard_in_flight_add(ca, iter.pos.offset, true)) 1756 1777 goto out; 1757 1778 1758 1779 discard_locked = true; ··· 1790 1811 s->discarded++; 1791 1812 out: 1792 1813 if (discard_locked) 1793 - discard_in_flight_remove(c, iter.pos); 1814 + discard_in_flight_remove(ca, iter.pos.offset); 1794 1815 s->seen++; 1795 1816 bch2_trans_iter_exit(trans, &iter); 1796 1817 printbuf_exit(&buf); ··· 1799 1820 1800 1821 static void bch2_do_discards_work(struct work_struct *work) 1801 1822 { 1802 - struct bch_fs *c = container_of(work, struct bch_fs, discard_work); 1823 + struct bch_dev *ca = container_of(work, struct bch_dev, discard_work); 1824 + struct bch_fs *c = ca->fs; 1803 1825 struct discard_buckets_state s = {}; 1804 1826 struct bpos discard_pos_done = POS_MAX; 1805 1827 int ret; ··· 1811 1831 * successful commit: 1812 1832 */ 1813 1833 ret = bch2_trans_run(c, 1814 - for_each_btree_key(trans, iter, 1815 - BTREE_ID_need_discard, POS_MIN, 0, k, 1816 - bch2_discard_one_bucket(trans, &iter, &discard_pos_done, &s))); 1817 - 1818 - discard_buckets_next_dev(c, &s, NULL); 1834 + for_each_btree_key_upto(trans, iter, 1835 + BTREE_ID_need_discard, 1836 + POS(ca->dev_idx, 0), 1837 + POS(ca->dev_idx, U64_MAX), 0, k, 1838 + bch2_discard_one_bucket(trans, ca, &iter, &discard_pos_done, &s))); 1819 1839 1820 1840 trace_discard_buckets(c, s.seen, s.open, s.need_journal_commit, s.discarded, 1821 1841 bch2_err_str(ret)); 1822 1842 1823 1843 bch2_write_ref_put(c, BCH_WRITE_REF_discard); 1844 + percpu_ref_put(&ca->io_ref); 1845 + } 1846 + 1847 + void bch2_dev_do_discards(struct bch_dev *ca) 1848 + { 1849 + struct bch_fs *c = ca->fs; 1850 + 1851 + if (!bch2_dev_get_ioref(c, ca->dev_idx, WRITE)) 1852 + return; 1853 + 1854 + if (!bch2_write_ref_tryget(c, BCH_WRITE_REF_discard)) 1855 + goto put_ioref; 1856 + 1857 + if (queue_work(c->write_ref_wq, &ca->discard_work)) 1858 + return; 1859 + 1860 + bch2_write_ref_put(c, BCH_WRITE_REF_discard); 1861 + put_ioref: 1862 + percpu_ref_put(&ca->io_ref); 1824 1863 } 1825 1864 1826 1865 void bch2_do_discards(struct bch_fs *c) 1827 1866 { 1828 - if (bch2_write_ref_tryget(c, BCH_WRITE_REF_discard) && 1829 - !queue_work(c->write_ref_wq, &c->discard_work)) 1830 - bch2_write_ref_put(c, BCH_WRITE_REF_discard); 1867 + for_each_member_device(c, ca) 1868 + bch2_dev_do_discards(ca); 1831 1869 } 1832 1870 1833 1871 static int bch2_clear_bucket_needs_discard(struct btree_trans *trans, struct bpos bucket) ··· 1874 1876 1875 1877 static void bch2_do_discards_fast_work(struct work_struct *work) 1876 1878 { 1877 - struct bch_fs *c = container_of(work, struct bch_fs, discard_fast_work); 1879 + struct bch_dev *ca = container_of(work, struct bch_dev, discard_fast_work); 1880 + struct bch_fs *c = ca->fs; 1878 1881 1879 1882 while (1) { 1880 1883 bool got_bucket = false; 1881 - struct bpos bucket; 1882 - struct bch_dev *ca; 1884 + u64 bucket; 1883 1885 1884 - mutex_lock(&c->discard_buckets_in_flight_lock); 1885 - darray_for_each(c->discard_buckets_in_flight, i) { 1886 - if (i->snapshot) 1886 + mutex_lock(&ca->discard_buckets_in_flight_lock); 1887 + darray_for_each(ca->discard_buckets_in_flight, i) { 1888 + if (i->in_progress) 1887 1889 continue; 1888 - 1889 - ca = bch2_dev_get_ioref(c, i->inode, WRITE); 1890 - if (!ca) { 1891 - darray_remove_item(&c->discard_buckets_in_flight, i); 1892 - continue; 1893 - } 1894 1890 1895 1891 got_bucket = true; 1896 - bucket = *i; 1897 - i->snapshot = true; 1892 + bucket = i->bucket; 1893 + i->in_progress = true; 1898 1894 break; 1899 1895 } 1900 - mutex_unlock(&c->discard_buckets_in_flight_lock); 1896 + mutex_unlock(&ca->discard_buckets_in_flight_lock); 1901 1897 1902 1898 if (!got_bucket) 1903 1899 break; 1904 1900 1905 1901 if (ca->mi.discard && !c->opts.nochanges) 1906 1902 blkdev_issue_discard(ca->disk_sb.bdev, 1907 - bucket.offset * ca->mi.bucket_size, 1903 + bucket_to_sector(ca, bucket), 1908 1904 ca->mi.bucket_size, 1909 1905 GFP_KERNEL); 1910 1906 1911 1907 int ret = bch2_trans_do(c, NULL, NULL, 1912 - BCH_WATERMARK_btree| 1913 - BCH_TRANS_COMMIT_no_enospc, 1914 - bch2_clear_bucket_needs_discard(trans, bucket)); 1908 + BCH_WATERMARK_btree| 1909 + BCH_TRANS_COMMIT_no_enospc, 1910 + bch2_clear_bucket_needs_discard(trans, POS(ca->dev_idx, bucket))); 1915 1911 bch_err_fn(c, ret); 1916 1912 1917 - percpu_ref_put(&ca->io_ref); 1918 - discard_in_flight_remove(c, bucket); 1913 + discard_in_flight_remove(ca, bucket); 1919 1914 1920 1915 if (ret) 1921 1916 break; 1922 1917 } 1923 1918 1924 1919 bch2_write_ref_put(c, BCH_WRITE_REF_discard_fast); 1920 + percpu_ref_put(&ca->io_ref); 1925 1921 } 1926 1922 1927 - static void bch2_discard_one_bucket_fast(struct bch_fs *c, struct bpos bucket) 1923 + static void bch2_discard_one_bucket_fast(struct bch_dev *ca, u64 bucket) 1928 1924 { 1929 - rcu_read_lock(); 1930 - struct bch_dev *ca = bch2_dev_rcu(c, bucket.inode); 1931 - bool dead = !ca || percpu_ref_is_dying(&ca->io_ref); 1932 - rcu_read_unlock(); 1925 + struct bch_fs *c = ca->fs; 1933 1926 1934 - if (!dead && 1935 - !discard_in_flight_add(c, bucket) && 1936 - bch2_write_ref_tryget(c, BCH_WRITE_REF_discard_fast) && 1937 - !queue_work(c->write_ref_wq, &c->discard_fast_work)) 1938 - bch2_write_ref_put(c, BCH_WRITE_REF_discard_fast); 1927 + if (discard_in_flight_add(ca, bucket, false)) 1928 + return; 1929 + 1930 + if (!bch2_dev_get_ioref(c, ca->dev_idx, WRITE)) 1931 + return; 1932 + 1933 + if (!bch2_write_ref_tryget(c, BCH_WRITE_REF_discard_fast)) 1934 + goto put_ioref; 1935 + 1936 + if (queue_work(c->write_ref_wq, &ca->discard_fast_work)) 1937 + return; 1938 + 1939 + bch2_write_ref_put(c, BCH_WRITE_REF_discard_fast); 1940 + put_ioref: 1941 + percpu_ref_put(&ca->io_ref); 1939 1942 } 1940 1943 1941 1944 static int invalidate_one_bucket(struct btree_trans *trans, ··· 2037 2038 2038 2039 static void bch2_do_invalidates_work(struct work_struct *work) 2039 2040 { 2040 - struct bch_fs *c = container_of(work, struct bch_fs, invalidate_work); 2041 + struct bch_dev *ca = container_of(work, struct bch_dev, invalidate_work); 2042 + struct bch_fs *c = ca->fs; 2041 2043 struct btree_trans *trans = bch2_trans_get(c); 2042 2044 int ret = 0; 2043 2045 ··· 2046 2046 if (ret) 2047 2047 goto err; 2048 2048 2049 - for_each_member_device(c, ca) { 2050 - s64 nr_to_invalidate = 2051 - should_invalidate_buckets(ca, bch2_dev_usage_read(ca)); 2052 - struct btree_iter iter; 2053 - bool wrapped = false; 2049 + s64 nr_to_invalidate = 2050 + should_invalidate_buckets(ca, bch2_dev_usage_read(ca)); 2051 + struct btree_iter iter; 2052 + bool wrapped = false; 2054 2053 2055 - bch2_trans_iter_init(trans, &iter, BTREE_ID_lru, 2056 - lru_pos(ca->dev_idx, 0, 2057 - ((bch2_current_io_time(c, READ) + U32_MAX) & 2058 - LRU_TIME_MAX)), 0); 2054 + bch2_trans_iter_init(trans, &iter, BTREE_ID_lru, 2055 + lru_pos(ca->dev_idx, 0, 2056 + ((bch2_current_io_time(c, READ) + U32_MAX) & 2057 + LRU_TIME_MAX)), 0); 2059 2058 2060 - while (true) { 2061 - bch2_trans_begin(trans); 2059 + while (true) { 2060 + bch2_trans_begin(trans); 2062 2061 2063 - struct bkey_s_c k = next_lru_key(trans, &iter, ca, &wrapped); 2064 - ret = bkey_err(k); 2065 - if (bch2_err_matches(ret, BCH_ERR_transaction_restart)) 2066 - continue; 2067 - if (ret) 2068 - break; 2069 - if (!k.k) 2070 - break; 2071 - 2072 - ret = invalidate_one_bucket(trans, &iter, k, &nr_to_invalidate); 2073 - if (ret) 2074 - break; 2075 - 2076 - bch2_btree_iter_advance(&iter); 2077 - } 2078 - bch2_trans_iter_exit(trans, &iter); 2079 - 2080 - if (ret < 0) { 2081 - bch2_dev_put(ca); 2062 + struct bkey_s_c k = next_lru_key(trans, &iter, ca, &wrapped); 2063 + ret = bkey_err(k); 2064 + if (bch2_err_matches(ret, BCH_ERR_transaction_restart)) 2065 + continue; 2066 + if (ret) 2082 2067 break; 2083 - } 2068 + if (!k.k) 2069 + break; 2070 + 2071 + ret = invalidate_one_bucket(trans, &iter, k, &nr_to_invalidate); 2072 + if (ret) 2073 + break; 2074 + 2075 + bch2_btree_iter_advance(&iter); 2084 2076 } 2077 + bch2_trans_iter_exit(trans, &iter); 2085 2078 err: 2086 2079 bch2_trans_put(trans); 2087 2080 bch2_write_ref_put(c, BCH_WRITE_REF_invalidate); 2081 + percpu_ref_put(&ca->io_ref); 2082 + } 2083 + 2084 + void bch2_dev_do_invalidates(struct bch_dev *ca) 2085 + { 2086 + struct bch_fs *c = ca->fs; 2087 + 2088 + if (!bch2_dev_get_ioref(c, ca->dev_idx, WRITE)) 2089 + return; 2090 + 2091 + if (!bch2_write_ref_tryget(c, BCH_WRITE_REF_invalidate)) 2092 + goto put_ioref; 2093 + 2094 + if (queue_work(c->write_ref_wq, &ca->invalidate_work)) 2095 + return; 2096 + 2097 + bch2_write_ref_put(c, BCH_WRITE_REF_invalidate); 2098 + put_ioref: 2099 + percpu_ref_put(&ca->io_ref); 2088 2100 } 2089 2101 2090 2102 void bch2_do_invalidates(struct bch_fs *c) 2091 2103 { 2092 - if (bch2_write_ref_tryget(c, BCH_WRITE_REF_invalidate) && 2093 - !queue_work(c->write_ref_wq, &c->invalidate_work)) 2094 - bch2_write_ref_put(c, BCH_WRITE_REF_invalidate); 2104 + for_each_member_device(c, ca) 2105 + bch2_dev_do_invalidates(ca); 2095 2106 } 2096 2107 2097 2108 int bch2_dev_freespace_init(struct bch_fs *c, struct bch_dev *ca, ··· 2418 2407 set_bit(ca->dev_idx, c->rw_devs[i].d); 2419 2408 } 2420 2409 2421 - void bch2_fs_allocator_background_exit(struct bch_fs *c) 2410 + void bch2_dev_allocator_background_exit(struct bch_dev *ca) 2422 2411 { 2423 - darray_exit(&c->discard_buckets_in_flight); 2412 + darray_exit(&ca->discard_buckets_in_flight); 2413 + } 2414 + 2415 + void bch2_dev_allocator_background_init(struct bch_dev *ca) 2416 + { 2417 + mutex_init(&ca->discard_buckets_in_flight_lock); 2418 + INIT_WORK(&ca->discard_work, bch2_do_discards_work); 2419 + INIT_WORK(&ca->discard_fast_work, bch2_do_discards_fast_work); 2420 + INIT_WORK(&ca->invalidate_work, bch2_do_invalidates_work); 2424 2421 } 2425 2422 2426 2423 void bch2_fs_allocator_background_init(struct bch_fs *c) 2427 2424 { 2428 2425 spin_lock_init(&c->freelist_lock); 2429 - mutex_init(&c->discard_buckets_in_flight_lock); 2430 - INIT_WORK(&c->discard_work, bch2_do_discards_work); 2431 - INIT_WORK(&c->discard_fast_work, bch2_do_discards_fast_work); 2432 - INIT_WORK(&c->invalidate_work, bch2_do_invalidates_work); 2433 2426 }
+5 -1
fs/bcachefs/alloc_background.h
··· 275 275 enum btree_iter_update_trigger_flags); 276 276 int bch2_check_alloc_info(struct bch_fs *); 277 277 int bch2_check_alloc_to_lru_refs(struct bch_fs *); 278 + void bch2_dev_do_discards(struct bch_dev *); 278 279 void bch2_do_discards(struct bch_fs *); 279 280 280 281 static inline u64 should_invalidate_buckets(struct bch_dev *ca, ··· 290 289 return clamp_t(s64, want_free - free, 0, u.d[BCH_DATA_cached].buckets); 291 290 } 292 291 292 + void bch2_dev_do_invalidates(struct bch_dev *); 293 293 void bch2_do_invalidates(struct bch_fs *); 294 294 295 295 static inline struct bch_backpointer *alloc_v4_backpointers(struct bch_alloc_v4 *a) ··· 314 312 void bch2_dev_allocator_remove(struct bch_fs *, struct bch_dev *); 315 313 void bch2_dev_allocator_add(struct bch_fs *, struct bch_dev *); 316 314 317 - void bch2_fs_allocator_background_exit(struct bch_fs *); 315 + void bch2_dev_allocator_background_exit(struct bch_dev *); 316 + void bch2_dev_allocator_background_init(struct bch_dev *); 317 + 318 318 void bch2_fs_allocator_background_init(struct bch_fs *); 319 319 320 320 #endif /* _BCACHEFS_ALLOC_BACKGROUND_H */
+2 -2
fs/bcachefs/alloc_foreground.c
··· 621 621 avail = dev_buckets_free(ca, *usage, watermark); 622 622 623 623 if (usage->d[BCH_DATA_need_discard].buckets > avail) 624 - bch2_do_discards(c); 624 + bch2_dev_do_discards(ca); 625 625 626 626 if (usage->d[BCH_DATA_need_gc_gens].buckets > avail) 627 627 bch2_gc_gens_async(c); 628 628 629 629 if (should_invalidate_buckets(ca, *usage)) 630 - bch2_do_invalidates(c); 630 + bch2_dev_do_invalidates(ca); 631 631 632 632 if (!avail) { 633 633 if (cl && !waiting) {
+11 -5
fs/bcachefs/bcachefs.h
··· 493 493 u64 sectors[2][BCH_DATA_NR]; 494 494 }; 495 495 496 + struct discard_in_flight { 497 + bool in_progress:1; 498 + u64 bucket:63; 499 + }; 500 + 496 501 struct bch_dev { 497 502 struct kobject kobj; 498 503 #ifdef CONFIG_BCACHEFS_DEBUG ··· 558 553 size_t inc_gen_needs_gc; 559 554 size_t inc_gen_really_needs_gc; 560 555 size_t buckets_waiting_on_journal; 556 + 557 + struct work_struct invalidate_work; 558 + struct work_struct discard_work; 559 + struct mutex discard_buckets_in_flight_lock; 560 + DARRAY(struct discard_in_flight) discard_buckets_in_flight; 561 + struct work_struct discard_fast_work; 561 562 562 563 atomic64_t rebalance_work; 563 564 ··· 926 915 unsigned write_points_nr; 927 916 928 917 struct buckets_waiting_for_journal buckets_waiting_for_journal; 929 - struct work_struct invalidate_work; 930 - struct work_struct discard_work; 931 - struct mutex discard_buckets_in_flight_lock; 932 - DARRAY(struct bpos) discard_buckets_in_flight; 933 - struct work_struct discard_fast_work; 934 918 935 919 /* GARBAGE COLLECTION */ 936 920 struct work_struct gc_gens_work;
+6 -13
fs/bcachefs/btree_iter.c
··· 3130 3130 3131 3131 trans = mempool_alloc(&c->btree_trans_pool, GFP_NOFS); 3132 3132 memset(trans, 0, sizeof(*trans)); 3133 - closure_init_stack(&trans->ref); 3134 3133 3135 3134 seqmutex_lock(&c->btree_trans_lock); 3136 3135 if (IS_ENABLED(CONFIG_BCACHEFS_DEBUG)) { ··· 3149 3150 BUG_ON(pos_task && 3150 3151 pid == pos_task->pid && 3151 3152 pos->locked); 3152 - 3153 - if (pos_task && pid < pos_task->pid) { 3154 - list_add_tail(&trans->list, &pos->list); 3155 - goto list_add_done; 3156 - } 3157 3153 } 3158 3154 } 3159 - list_add_tail(&trans->list, &c->btree_trans_list); 3160 - list_add_done: 3155 + 3156 + list_add(&trans->list, &c->btree_trans_list); 3161 3157 seqmutex_unlock(&c->btree_trans_lock); 3162 3158 got_trans: 3163 - trans->ref.closure_get_happened = false; 3164 3159 trans->c = c; 3165 3160 trans->last_begin_time = local_clock(); 3166 3161 trans->fn_idx = fn_idx; ··· 3193 3200 trans->srcu_idx = srcu_read_lock(&c->btree_trans_barrier); 3194 3201 trans->srcu_lock_time = jiffies; 3195 3202 trans->srcu_held = true; 3203 + 3204 + closure_init_stack_release(&trans->ref); 3196 3205 return trans; 3197 3206 } 3198 3207 ··· 3252 3257 bch2_journal_keys_put(c); 3253 3258 3254 3259 /* 3255 - * trans->ref protects trans->locking_wait.task, btree_paths arary; used 3260 + * trans->ref protects trans->locking_wait.task, btree_paths array; used 3256 3261 * by cycle detector 3257 3262 */ 3258 - closure_sync(&trans->ref); 3263 + closure_return_sync(&trans->ref); 3259 3264 trans->locking_wait.task = NULL; 3260 3265 3261 3266 unsigned long *paths_allocated = trans->paths_allocated; ··· 3380 3385 per_cpu_ptr(c->btree_trans_bufs, cpu)->trans; 3381 3386 3382 3387 if (trans) { 3383 - closure_sync(&trans->ref); 3384 - 3385 3388 seqmutex_lock(&c->btree_trans_lock); 3386 3389 list_del(&trans->list); 3387 3390 seqmutex_unlock(&c->btree_trans_lock);
+6 -3
fs/bcachefs/chardev.c
··· 216 216 217 217 ret = PTR_ERR_OR_ZERO(optstr) ?: 218 218 bch2_parse_mount_opts(NULL, &thr->opts, optstr); 219 - kfree(optstr); 219 + if (!IS_ERR(optstr)) 220 + kfree(optstr); 220 221 221 222 if (ret) 222 223 goto err; ··· 320 319 return ret; 321 320 322 321 ret = bch2_dev_add(c, path); 323 - kfree(path); 322 + if (!IS_ERR(path)) 323 + kfree(path); 324 324 325 325 return ret; 326 326 } ··· 852 850 853 851 ret = PTR_ERR_OR_ZERO(optstr) ?: 854 852 bch2_parse_mount_opts(c, &thr->opts, optstr); 855 - kfree(optstr); 853 + if (!IS_ERR(optstr)) 854 + kfree(optstr); 856 855 857 856 if (ret) 858 857 goto err;
+69 -40
fs/bcachefs/debug.c
··· 568 568 .read = bch2_cached_btree_nodes_read, 569 569 }; 570 570 571 + typedef int (*list_cmp_fn)(const struct list_head *l, const struct list_head *r); 572 + 573 + static void list_sort(struct list_head *head, list_cmp_fn cmp) 574 + { 575 + struct list_head *pos; 576 + 577 + list_for_each(pos, head) 578 + while (!list_is_last(pos, head) && 579 + cmp(pos, pos->next) > 0) { 580 + struct list_head *pos2, *next = pos->next; 581 + 582 + list_del(next); 583 + list_for_each(pos2, head) 584 + if (cmp(next, pos2) < 0) 585 + goto pos_found; 586 + BUG(); 587 + pos_found: 588 + list_add_tail(next, pos2); 589 + } 590 + } 591 + 592 + static int list_ptr_order_cmp(const struct list_head *l, const struct list_head *r) 593 + { 594 + return cmp_int(l, r); 595 + } 596 + 571 597 static ssize_t bch2_btree_transactions_read(struct file *file, char __user *buf, 572 598 size_t size, loff_t *ppos) 573 599 { ··· 601 575 struct bch_fs *c = i->c; 602 576 struct btree_trans *trans; 603 577 ssize_t ret = 0; 604 - u32 seq; 605 578 606 579 i->ubuf = buf; 607 580 i->size = size; 608 581 i->ret = 0; 609 582 restart: 610 583 seqmutex_lock(&c->btree_trans_lock); 611 - list_for_each_entry(trans, &c->btree_trans_list, list) { 612 - struct task_struct *task = READ_ONCE(trans->locking_wait.task); 584 + list_sort(&c->btree_trans_list, list_ptr_order_cmp); 613 585 614 - if (!task || task->pid <= i->iter) 586 + list_for_each_entry(trans, &c->btree_trans_list, list) { 587 + if ((ulong) trans < i->iter) 615 588 continue; 616 589 617 - closure_get(&trans->ref); 618 - seq = seqmutex_seq(&c->btree_trans_lock); 619 - seqmutex_unlock(&c->btree_trans_lock); 590 + i->iter = (ulong) trans; 620 591 621 - ret = flush_buf(i); 622 - if (ret) { 623 - closure_put(&trans->ref); 624 - goto unlocked; 625 - } 592 + if (!closure_get_not_zero(&trans->ref)) 593 + continue; 594 + 595 + u32 seq = seqmutex_unlock(&c->btree_trans_lock); 626 596 627 597 bch2_btree_trans_to_text(&i->buf, trans); 628 598 629 599 prt_printf(&i->buf, "backtrace:\n"); 630 600 printbuf_indent_add(&i->buf, 2); 631 - bch2_prt_task_backtrace(&i->buf, task, 0, GFP_KERNEL); 601 + bch2_prt_task_backtrace(&i->buf, trans->locking_wait.task, 0, GFP_KERNEL); 632 602 printbuf_indent_sub(&i->buf, 2); 633 603 prt_newline(&i->buf); 634 604 635 - i->iter = task->pid; 636 - 637 605 closure_put(&trans->ref); 606 + 607 + ret = flush_buf(i); 608 + if (ret) 609 + goto unlocked; 638 610 639 611 if (!seqmutex_relock(&c->btree_trans_lock, seq)) 640 612 goto restart; ··· 828 804 .read = btree_transaction_stats_read, 829 805 }; 830 806 831 - static ssize_t bch2_btree_deadlock_read(struct file *file, char __user *buf, 832 - size_t size, loff_t *ppos) 807 + /* walk btree transactions until we find a deadlock and print it */ 808 + static void btree_deadlock_to_text(struct printbuf *out, struct bch_fs *c) 833 809 { 834 - struct dump_iter *i = file->private_data; 835 - struct bch_fs *c = i->c; 836 810 struct btree_trans *trans; 837 - ssize_t ret = 0; 838 - u32 seq; 839 - 840 - i->ubuf = buf; 841 - i->size = size; 842 - i->ret = 0; 843 - 844 - if (i->iter) 845 - goto out; 811 + pid_t iter = 0; 846 812 restart: 847 813 seqmutex_lock(&c->btree_trans_lock); 848 814 list_for_each_entry(trans, &c->btree_trans_list, list) { 849 815 struct task_struct *task = READ_ONCE(trans->locking_wait.task); 850 816 851 - if (!task || task->pid <= i->iter) 817 + if (!task || task->pid <= iter) 852 818 continue; 853 819 854 - closure_get(&trans->ref); 855 - seq = seqmutex_seq(&c->btree_trans_lock); 856 - seqmutex_unlock(&c->btree_trans_lock); 820 + iter = task->pid; 857 821 858 - ret = flush_buf(i); 859 - if (ret) { 860 - closure_put(&trans->ref); 861 - goto out; 862 - } 822 + if (!closure_get_not_zero(&trans->ref)) 823 + continue; 863 824 864 - bch2_check_for_deadlock(trans, &i->buf); 825 + u32 seq = seqmutex_unlock(&c->btree_trans_lock); 865 826 866 - i->iter = task->pid; 827 + bool found = bch2_check_for_deadlock(trans, out) != 0; 867 828 868 829 closure_put(&trans->ref); 830 + 831 + if (found) 832 + return; 869 833 870 834 if (!seqmutex_relock(&c->btree_trans_lock, seq)) 871 835 goto restart; 872 836 } 873 837 seqmutex_unlock(&c->btree_trans_lock); 874 - out: 838 + } 839 + 840 + static ssize_t bch2_btree_deadlock_read(struct file *file, char __user *buf, 841 + size_t size, loff_t *ppos) 842 + { 843 + struct dump_iter *i = file->private_data; 844 + struct bch_fs *c = i->c; 845 + ssize_t ret = 0; 846 + 847 + i->ubuf = buf; 848 + i->size = size; 849 + i->ret = 0; 850 + 851 + if (!i->iter) { 852 + btree_deadlock_to_text(&i->buf, c); 853 + i->iter++; 854 + } 855 + 875 856 if (i->buf.allocation_failure) 876 857 ret = -ENOMEM; 877 858
+5
fs/bcachefs/journal.c
··· 1521 1521 struct journal_entry_pin *pin; 1522 1522 1523 1523 spin_lock(&j->lock); 1524 + if (!test_bit(JOURNAL_running, &j->flags)) { 1525 + spin_unlock(&j->lock); 1526 + return true; 1527 + } 1528 + 1524 1529 *seq = max(*seq, j->pin.front); 1525 1530 1526 1531 if (*seq >= j->pin.back) {
+7
fs/bcachefs/journal_io.c
··· 1677 1677 mod_delayed_work(j->wq, &j->write_work, max(0L, delta)); 1678 1678 } 1679 1679 1680 + /* 1681 + * We don't typically trigger journal writes from her - the next journal 1682 + * write will be triggered immediately after the previous one is 1683 + * allocated, in bch2_journal_write() - but the journal write error path 1684 + * is special: 1685 + */ 1686 + bch2_journal_do_writes(j); 1680 1687 spin_unlock(&j->lock); 1681 1688 } 1682 1689
+1 -1
fs/bcachefs/journal_seq_blacklist.c
··· 232 232 BUG_ON(nr != t->nr); 233 233 234 234 unsigned i; 235 - for (src = bl->start, i = eytzinger0_first(t->nr); 235 + for (src = bl->start, i = t->nr == 0 ? 0 : eytzinger0_first(t->nr); 236 236 src < bl->start + nr; 237 237 src++, i = eytzinger0_next(i, nr)) { 238 238 BUG_ON(t->entries[i].start != le64_to_cpu(src->start));
+10 -4
fs/bcachefs/sb-errors.c
··· 110 110 void bch2_sb_errors_from_cpu(struct bch_fs *c) 111 111 { 112 112 bch_sb_errors_cpu *src = &c->fsck_error_counts; 113 - struct bch_sb_field_errors *dst = 114 - bch2_sb_field_resize(&c->disk_sb, errors, 115 - bch2_sb_field_errors_u64s(src->nr)); 113 + struct bch_sb_field_errors *dst; 116 114 unsigned i; 117 115 116 + mutex_lock(&c->fsck_error_counts_lock); 117 + 118 + dst = bch2_sb_field_resize(&c->disk_sb, errors, 119 + bch2_sb_field_errors_u64s(src->nr)); 120 + 118 121 if (!dst) 119 - return; 122 + goto err; 120 123 121 124 for (i = 0; i < src->nr; i++) { 122 125 SET_BCH_SB_ERROR_ENTRY_ID(&dst->entries[i], src->data[i].id); 123 126 SET_BCH_SB_ERROR_ENTRY_NR(&dst->entries[i], src->data[i].nr); 124 127 dst->entries[i].last_error_time = cpu_to_le64(src->data[i].last_error_time); 125 128 } 129 + 130 + err: 131 + mutex_unlock(&c->fsck_error_counts_lock); 126 132 } 127 133 128 134 static int bch2_sb_errors_to_cpu(struct bch_fs *c)
+4 -7
fs/bcachefs/seqmutex.h
··· 19 19 static inline void seqmutex_lock(struct seqmutex *lock) 20 20 { 21 21 mutex_lock(&lock->lock); 22 - } 23 - 24 - static inline void seqmutex_unlock(struct seqmutex *lock) 25 - { 26 22 lock->seq++; 27 - mutex_unlock(&lock->lock); 28 23 } 29 24 30 - static inline u32 seqmutex_seq(struct seqmutex *lock) 25 + static inline u32 seqmutex_unlock(struct seqmutex *lock) 31 26 { 32 - return lock->seq; 27 + u32 seq = lock->seq; 28 + mutex_unlock(&lock->lock); 29 + return seq; 33 30 } 34 31 35 32 static inline bool seqmutex_relock(struct seqmutex *lock, u32 seq)
+3
fs/bcachefs/snapshot.c
··· 168 168 size_t new_bytes = kmalloc_size_roundup(struct_size(new, s, idx + 1)); 169 169 size_t new_size = (new_bytes - sizeof(*new)) / sizeof(new->s[0]); 170 170 171 + if (unlikely(new_bytes > INT_MAX)) 172 + return NULL; 173 + 171 174 new = kvzalloc(new_bytes, GFP_KERNEL); 172 175 if (!new) 173 176 return NULL;
+5 -1
fs/bcachefs/super.c
··· 536 536 537 537 bch2_find_btree_nodes_exit(&c->found_btree_nodes); 538 538 bch2_free_pending_node_rewrites(c); 539 - bch2_fs_allocator_background_exit(c); 540 539 bch2_fs_sb_errors_exit(c); 541 540 bch2_fs_counters_exit(c); 542 541 bch2_fs_snapshots_exit(c); ··· 1194 1195 1195 1196 kfree(ca->buckets_nouse); 1196 1197 bch2_free_super(&ca->disk_sb); 1198 + bch2_dev_allocator_background_exit(ca); 1197 1199 bch2_dev_journal_exit(ca); 1198 1200 1199 1201 free_percpu(ca->io_done); ··· 1316 1316 #else 1317 1317 atomic_long_set(&ca->ref, 1); 1318 1318 #endif 1319 + 1320 + bch2_dev_allocator_background_init(ca); 1319 1321 1320 1322 if (percpu_ref_init(&ca->io_ref, bch2_dev_io_ref_complete, 1321 1323 PERCPU_REF_INIT_DEAD, GFP_KERNEL) || ··· 1531 1529 * The allocator thread itself allocates btree nodes, so stop it first: 1532 1530 */ 1533 1531 bch2_dev_allocator_remove(c, ca); 1532 + bch2_recalc_capacity(c); 1534 1533 bch2_dev_journal_stop(&c->journal, ca); 1535 1534 } 1536 1535 ··· 1543 1540 1544 1541 bch2_dev_allocator_add(c, ca); 1545 1542 bch2_recalc_capacity(c); 1543 + bch2_dev_do_discards(ca); 1546 1544 } 1547 1545 1548 1546 int __bch2_dev_set_state(struct bch_fs *c, struct bch_dev *ca,
+11 -2
fs/btrfs/block-group.c
··· 1924 1924 next: 1925 1925 if (ret) { 1926 1926 /* Refcount held by the reclaim_bgs list after splice. */ 1927 - btrfs_get_block_group(bg); 1928 - list_add_tail(&bg->bg_list, &retry_list); 1927 + spin_lock(&fs_info->unused_bgs_lock); 1928 + /* 1929 + * This block group might be added to the unused list 1930 + * during the above process. Move it back to the 1931 + * reclaim list otherwise. 1932 + */ 1933 + if (list_empty(&bg->bg_list)) { 1934 + btrfs_get_block_group(bg); 1935 + list_add_tail(&bg->bg_list, &retry_list); 1936 + } 1937 + spin_unlock(&fs_info->unused_bgs_lock); 1929 1938 } 1930 1939 btrfs_put_block_group(bg); 1931 1940
+1 -1
fs/btrfs/free-space-cache.c
··· 2697 2697 u64 offset = bytenr - block_group->start; 2698 2698 u64 to_free, to_unusable; 2699 2699 int bg_reclaim_threshold = 0; 2700 - bool initial = (size == block_group->length); 2700 + bool initial = ((size == block_group->length) && (block_group->alloc_offset == 0)); 2701 2701 u64 reclaimable_unusable; 2702 2702 2703 2703 WARN_ON(!initial && offset + size > block_group->zone_capacity);
+2 -2
fs/btrfs/qgroup.c
··· 1351 1351 1352 1352 int btrfs_quota_disable(struct btrfs_fs_info *fs_info) 1353 1353 { 1354 - struct btrfs_root *quota_root; 1354 + struct btrfs_root *quota_root = NULL; 1355 1355 struct btrfs_trans_handle *trans = NULL; 1356 1356 int ret = 0; 1357 1357 ··· 1449 1449 btrfs_free_tree_block(trans, btrfs_root_id(quota_root), 1450 1450 quota_root->node, 0, 1); 1451 1451 1452 - btrfs_put_root(quota_root); 1453 1452 1454 1453 out: 1454 + btrfs_put_root(quota_root); 1455 1455 mutex_unlock(&fs_info->qgroup_ioctl_lock); 1456 1456 if (ret && trans) 1457 1457 btrfs_end_transaction(trans);
+15 -11
fs/btrfs/scrub.c
··· 1688 1688 (i << fs_info->sectorsize_bits); 1689 1689 int err; 1690 1690 1691 + io_stripe.is_scrub = true; 1692 + stripe_len = (nr_sectors - i) << fs_info->sectorsize_bits; 1693 + /* 1694 + * For RST cases, we need to manually split the bbio to 1695 + * follow the RST boundary. 1696 + */ 1697 + err = btrfs_map_block(fs_info, BTRFS_MAP_READ, logical, 1698 + &stripe_len, &bioc, &io_stripe, &mirror); 1699 + btrfs_put_bioc(bioc); 1700 + if (err < 0) { 1701 + set_bit(i, &stripe->io_error_bitmap); 1702 + set_bit(i, &stripe->error_bitmap); 1703 + continue; 1704 + } 1705 + 1691 1706 bbio = btrfs_bio_alloc(stripe->nr_sectors, REQ_OP_READ, 1692 1707 fs_info, scrub_read_endio, stripe); 1693 1708 bbio->bio.bi_iter.bi_sector = logical >> SECTOR_SHIFT; 1694 - 1695 - io_stripe.is_scrub = true; 1696 - err = btrfs_map_block(fs_info, BTRFS_MAP_READ, logical, 1697 - &stripe_len, &bioc, &io_stripe, 1698 - &mirror); 1699 - btrfs_put_bioc(bioc); 1700 - if (err) { 1701 - btrfs_bio_end_io(bbio, 1702 - errno_to_blk_status(err)); 1703 - return; 1704 - } 1705 1709 } 1706 1710 1707 1711 __bio_add_page(&bbio->bio, page, fs_info->sectorsize, pgoff);
+28 -15
fs/btrfs/tree-log.c
··· 138 138 * and once to do all the other items. 139 139 */ 140 140 141 + static struct inode *btrfs_iget_logging(u64 objectid, struct btrfs_root *root) 142 + { 143 + unsigned int nofs_flag; 144 + struct inode *inode; 145 + 146 + /* 147 + * We're holding a transaction handle whether we are logging or 148 + * replaying a log tree, so we must make sure NOFS semantics apply 149 + * because btrfs_alloc_inode() may be triggered and it uses GFP_KERNEL 150 + * to allocate an inode, which can recurse back into the filesystem and 151 + * attempt a transaction commit, resulting in a deadlock. 152 + */ 153 + nofs_flag = memalloc_nofs_save(); 154 + inode = btrfs_iget(root->fs_info->sb, objectid, root); 155 + memalloc_nofs_restore(nofs_flag); 156 + 157 + return inode; 158 + } 159 + 141 160 /* 142 161 * start a sub transaction and setup the log tree 143 162 * this increments the log tree writer count to make the people ··· 619 600 { 620 601 struct inode *inode; 621 602 622 - inode = btrfs_iget(root->fs_info->sb, objectid, root); 603 + inode = btrfs_iget_logging(objectid, root); 623 604 if (IS_ERR(inode)) 624 605 inode = NULL; 625 606 return inode; ··· 5457 5438 struct btrfs_log_ctx *ctx) 5458 5439 { 5459 5440 struct btrfs_root *root = start_inode->root; 5460 - struct btrfs_fs_info *fs_info = root->fs_info; 5461 5441 struct btrfs_path *path; 5462 5442 LIST_HEAD(dir_list); 5463 5443 struct btrfs_dir_list *dir_elem; ··· 5517 5499 continue; 5518 5500 5519 5501 btrfs_release_path(path); 5520 - di_inode = btrfs_iget(fs_info->sb, di_key.objectid, root); 5502 + di_inode = btrfs_iget_logging(di_key.objectid, root); 5521 5503 if (IS_ERR(di_inode)) { 5522 5504 ret = PTR_ERR(di_inode); 5523 5505 goto out; ··· 5577 5559 btrfs_add_delayed_iput(curr_inode); 5578 5560 curr_inode = NULL; 5579 5561 5580 - vfs_inode = btrfs_iget(fs_info->sb, ino, root); 5562 + vfs_inode = btrfs_iget_logging(ino, root); 5581 5563 if (IS_ERR(vfs_inode)) { 5582 5564 ret = PTR_ERR(vfs_inode); 5583 5565 break; ··· 5672 5654 if (ctx->num_conflict_inodes >= MAX_CONFLICT_INODES) 5673 5655 return BTRFS_LOG_FORCE_COMMIT; 5674 5656 5675 - inode = btrfs_iget(root->fs_info->sb, ino, root); 5657 + inode = btrfs_iget_logging(ino, root); 5676 5658 /* 5677 5659 * If the other inode that had a conflicting dir entry was deleted in 5678 5660 * the current transaction then we either: ··· 5773 5755 struct btrfs_root *root, 5774 5756 struct btrfs_log_ctx *ctx) 5775 5757 { 5776 - struct btrfs_fs_info *fs_info = root->fs_info; 5777 5758 int ret = 0; 5778 5759 5779 5760 /* ··· 5803 5786 list_del(&curr->list); 5804 5787 kfree(curr); 5805 5788 5806 - inode = btrfs_iget(fs_info->sb, ino, root); 5789 + inode = btrfs_iget_logging(ino, root); 5807 5790 /* 5808 5791 * If the other inode that had a conflicting dir entry was 5809 5792 * deleted in the current transaction, we need to log its parent ··· 5814 5797 if (ret != -ENOENT) 5815 5798 break; 5816 5799 5817 - inode = btrfs_iget(fs_info->sb, parent, root); 5800 + inode = btrfs_iget_logging(parent, root); 5818 5801 if (IS_ERR(inode)) { 5819 5802 ret = PTR_ERR(inode); 5820 5803 break; ··· 6336 6319 struct btrfs_log_ctx *ctx) 6337 6320 { 6338 6321 const bool orig_log_new_dentries = ctx->log_new_dentries; 6339 - struct btrfs_fs_info *fs_info = trans->fs_info; 6340 6322 struct btrfs_delayed_item *item; 6341 6323 int ret = 0; 6342 6324 ··· 6361 6345 if (key.type == BTRFS_ROOT_ITEM_KEY) 6362 6346 continue; 6363 6347 6364 - di_inode = btrfs_iget(fs_info->sb, key.objectid, inode->root); 6348 + di_inode = btrfs_iget_logging(key.objectid, inode->root); 6365 6349 if (IS_ERR(di_inode)) { 6366 6350 ret = PTR_ERR(di_inode); 6367 6351 break; ··· 6745 6729 struct btrfs_inode *inode, 6746 6730 struct btrfs_log_ctx *ctx) 6747 6731 { 6748 - struct btrfs_fs_info *fs_info = trans->fs_info; 6749 6732 int ret; 6750 6733 struct btrfs_path *path; 6751 6734 struct btrfs_key key; ··· 6809 6794 cur_offset = item_size; 6810 6795 } 6811 6796 6812 - dir_inode = btrfs_iget(fs_info->sb, inode_key.objectid, 6813 - root); 6797 + dir_inode = btrfs_iget_logging(inode_key.objectid, root); 6814 6798 /* 6815 6799 * If the parent inode was deleted, return an error to 6816 6800 * fallback to a transaction commit. This is to prevent ··· 6871 6857 btrfs_item_key_to_cpu(path->nodes[0], &found_key, path->slots[0]); 6872 6858 6873 6859 while (true) { 6874 - struct btrfs_fs_info *fs_info = root->fs_info; 6875 6860 struct extent_buffer *leaf; 6876 6861 int slot; 6877 6862 struct btrfs_key search_key; ··· 6885 6872 search_key.objectid = found_key.offset; 6886 6873 search_key.type = BTRFS_INODE_ITEM_KEY; 6887 6874 search_key.offset = 0; 6888 - inode = btrfs_iget(fs_info->sb, ino, root); 6875 + inode = btrfs_iget_logging(ino, root); 6889 6876 if (IS_ERR(inode)) 6890 6877 return PTR_ERR(inode); 6891 6878
+14 -17
fs/dcache.c
··· 3029 3029 3030 3030 bool is_subdir(struct dentry *new_dentry, struct dentry *old_dentry) 3031 3031 { 3032 - bool result; 3032 + bool subdir; 3033 3033 unsigned seq; 3034 3034 3035 3035 if (new_dentry == old_dentry) 3036 3036 return true; 3037 3037 3038 - do { 3039 - /* for restarting inner loop in case of seq retry */ 3040 - seq = read_seqbegin(&rename_lock); 3041 - /* 3042 - * Need rcu_readlock to protect against the d_parent trashing 3043 - * due to d_move 3044 - */ 3045 - rcu_read_lock(); 3046 - if (d_ancestor(old_dentry, new_dentry)) 3047 - result = true; 3048 - else 3049 - result = false; 3050 - rcu_read_unlock(); 3051 - } while (read_seqretry(&rename_lock, seq)); 3052 - 3053 - return result; 3038 + /* Access d_parent under rcu as d_move() may change it. */ 3039 + rcu_read_lock(); 3040 + seq = read_seqbegin(&rename_lock); 3041 + subdir = d_ancestor(old_dentry, new_dentry); 3042 + /* Try lockless once... */ 3043 + if (read_seqretry(&rename_lock, seq)) { 3044 + /* ...else acquire lock for progress even on deep chains. */ 3045 + read_seqlock_excl(&rename_lock); 3046 + subdir = d_ancestor(old_dentry, new_dentry); 3047 + read_sequnlock_excl(&rename_lock); 3048 + } 3049 + rcu_read_unlock(); 3050 + return subdir; 3054 3051 } 3055 3052 EXPORT_SYMBOL(is_subdir); 3056 3053
+1 -1
fs/erofs/super.c
··· 343 343 sbi->build_time = le64_to_cpu(dsb->build_time); 344 344 sbi->build_time_nsec = le32_to_cpu(dsb->build_time_nsec); 345 345 346 - memcpy(&sb->s_uuid, dsb->uuid, sizeof(dsb->uuid)); 346 + super_set_uuid(sb, (void *)dsb->uuid, sizeof(dsb->uuid)); 347 347 348 348 ret = strscpy(sbi->volume_name, dsb->volume_name, 349 349 sizeof(dsb->volume_name));
+2
fs/erofs/zmap.c
··· 711 711 712 712 err = z_erofs_do_map_blocks(inode, map, flags); 713 713 out: 714 + if (err) 715 + map->m_llen = 0; 714 716 trace_z_erofs_map_blocks_iter_exit(inode, map, flags, err); 715 717 return err; 716 718 }
+4 -4
fs/erofs/zutil.c
··· 148 148 149 149 void z_erofs_gbuf_exit(void) 150 150 { 151 - int i; 151 + int i, j; 152 152 153 153 for (i = 0; i < z_erofs_gbuf_count + (!!z_erofs_rsvbuf); ++i) { 154 154 struct z_erofs_gbuf *gbuf = &z_erofs_gbufpool[i]; ··· 161 161 if (!gbuf->pages) 162 162 continue; 163 163 164 - for (i = 0; i < gbuf->nrpages; ++i) 165 - if (gbuf->pages[i]) 166 - put_page(gbuf->pages[i]); 164 + for (j = 0; j < gbuf->nrpages; ++j) 165 + if (gbuf->pages[j]) 166 + put_page(gbuf->pages[j]); 167 167 kfree(gbuf->pages); 168 168 gbuf->pages = NULL; 169 169 }
+4 -5
fs/locks.c
··· 2448 2448 error = do_lock_file_wait(filp, cmd, file_lock); 2449 2449 2450 2450 /* 2451 - * Attempt to detect a close/fcntl race and recover by releasing the 2452 - * lock that was just acquired. There is no need to do that when we're 2451 + * Detect close/fcntl races and recover by zapping all POSIX locks 2452 + * associated with this file and our files_struct, just like on 2453 + * filp_flush(). There is no need to do that when we're 2453 2454 * unlocking though, or for OFD locks. 2454 2455 */ 2455 2456 if (!error && file_lock->c.flc_type != F_UNLCK && ··· 2465 2464 f = files_lookup_fd_locked(files, fd); 2466 2465 spin_unlock(&files->file_lock); 2467 2466 if (f != filp) { 2468 - file_lock->c.flc_type = F_UNLCK; 2469 - error = do_lock_file_wait(filp, cmd, file_lock); 2470 - WARN_ON_ONCE(error); 2467 + locks_remove_posix(filp, files); 2471 2468 error = -EBADF; 2472 2469 } 2473 2470 }
+8 -2
fs/namei.c
··· 3572 3572 else 3573 3573 inode_lock_shared(dir->d_inode); 3574 3574 dentry = lookup_open(nd, file, op, got_write); 3575 - if (!IS_ERR(dentry) && (file->f_mode & FMODE_CREATED)) 3576 - fsnotify_create(dir->d_inode, dentry); 3575 + if (!IS_ERR(dentry)) { 3576 + if (file->f_mode & FMODE_CREATED) 3577 + fsnotify_create(dir->d_inode, dentry); 3578 + if (file->f_mode & FMODE_OPENED) 3579 + fsnotify_open(file); 3580 + } 3577 3581 if (open_flag & O_CREAT) 3578 3582 inode_unlock(dir->d_inode); 3579 3583 else ··· 3704 3700 mode = vfs_prepare_mode(idmap, dir, mode, mode, mode); 3705 3701 error = dir->i_op->tmpfile(idmap, dir, file, mode); 3706 3702 dput(child); 3703 + if (file->f_mode & FMODE_OPENED) 3704 + fsnotify_open(file); 3707 3705 if (error) 3708 3706 return error; 3709 3707 /* Don't check for other permissions, the inode was just created */
+9 -3
fs/netfs/buffered_write.c
··· 523 523 struct netfs_group *group; 524 524 struct folio *folio = page_folio(vmf->page); 525 525 struct file *file = vmf->vma->vm_file; 526 + struct address_space *mapping = file->f_mapping; 526 527 struct inode *inode = file_inode(file); 527 528 struct netfs_inode *ictx = netfs_inode(inode); 528 529 vm_fault_t ret = VM_FAULT_RETRY; ··· 535 534 536 535 if (folio_lock_killable(folio) < 0) 537 536 goto out; 537 + if (folio->mapping != mapping) { 538 + folio_unlock(folio); 539 + ret = VM_FAULT_NOPAGE; 540 + goto out; 541 + } 538 542 539 543 if (folio_wait_writeback_killable(folio)) { 540 544 ret = VM_FAULT_LOCKED; ··· 555 549 group = netfs_folio_group(folio); 556 550 if (group != netfs_group && group != NETFS_FOLIO_COPY_TO_CACHE) { 557 551 folio_unlock(folio); 558 - err = filemap_fdatawait_range(inode->i_mapping, 559 - folio_pos(folio), 560 - folio_pos(folio) + folio_size(folio)); 552 + err = filemap_fdatawrite_range(mapping, 553 + folio_pos(folio), 554 + folio_pos(folio) + folio_size(folio)); 561 555 switch (err) { 562 556 case 0: 563 557 ret = VM_FAULT_RETRY;
+2 -1
fs/netfs/direct_write.c
··· 92 92 __set_bit(NETFS_RREQ_UPLOAD_TO_SERVER, &wreq->flags); 93 93 if (async) 94 94 wreq->iocb = iocb; 95 + wreq->len = iov_iter_count(&wreq->io_iter); 95 96 wreq->cleanup = netfs_cleanup_dio_write; 96 - ret = netfs_unbuffered_write(wreq, is_sync_kiocb(iocb), iov_iter_count(&wreq->io_iter)); 97 + ret = netfs_unbuffered_write(wreq, is_sync_kiocb(iocb), wreq->len); 97 98 if (ret < 0) { 98 99 _debug("begin = %zd", ret); 99 100 goto out;
-9
fs/netfs/internal.h
··· 63 63 /* 64 64 * misc.c 65 65 */ 66 - #define NETFS_FLAG_PUT_MARK BIT(0) 67 - #define NETFS_FLAG_PAGECACHE_MARK BIT(1) 68 - int netfs_xa_store_and_mark(struct xarray *xa, unsigned long index, 69 - struct folio *folio, unsigned int flags, 70 - gfp_t gfp_mask); 71 - int netfs_add_folios_to_buffer(struct xarray *buffer, 72 - struct address_space *mapping, 73 - pgoff_t index, pgoff_t to, gfp_t gfp_mask); 74 - void netfs_clear_buffer(struct xarray *buffer); 75 66 76 67 /* 77 68 * objects.c
-81
fs/netfs/misc.c
··· 8 8 #include <linux/swap.h> 9 9 #include "internal.h" 10 10 11 - /* 12 - * Attach a folio to the buffer and maybe set marks on it to say that we need 13 - * to put the folio later and twiddle the pagecache flags. 14 - */ 15 - int netfs_xa_store_and_mark(struct xarray *xa, unsigned long index, 16 - struct folio *folio, unsigned int flags, 17 - gfp_t gfp_mask) 18 - { 19 - XA_STATE_ORDER(xas, xa, index, folio_order(folio)); 20 - 21 - retry: 22 - xas_lock(&xas); 23 - for (;;) { 24 - xas_store(&xas, folio); 25 - if (!xas_error(&xas)) 26 - break; 27 - xas_unlock(&xas); 28 - if (!xas_nomem(&xas, gfp_mask)) 29 - return xas_error(&xas); 30 - goto retry; 31 - } 32 - 33 - if (flags & NETFS_FLAG_PUT_MARK) 34 - xas_set_mark(&xas, NETFS_BUF_PUT_MARK); 35 - if (flags & NETFS_FLAG_PAGECACHE_MARK) 36 - xas_set_mark(&xas, NETFS_BUF_PAGECACHE_MARK); 37 - xas_unlock(&xas); 38 - return xas_error(&xas); 39 - } 40 - 41 - /* 42 - * Create the specified range of folios in the buffer attached to the read 43 - * request. The folios are marked with NETFS_BUF_PUT_MARK so that we know that 44 - * these need freeing later. 45 - */ 46 - int netfs_add_folios_to_buffer(struct xarray *buffer, 47 - struct address_space *mapping, 48 - pgoff_t index, pgoff_t to, gfp_t gfp_mask) 49 - { 50 - struct folio *folio; 51 - int ret; 52 - 53 - if (to + 1 == index) /* Page range is inclusive */ 54 - return 0; 55 - 56 - do { 57 - /* TODO: Figure out what order folio can be allocated here */ 58 - folio = filemap_alloc_folio(readahead_gfp_mask(mapping), 0); 59 - if (!folio) 60 - return -ENOMEM; 61 - folio->index = index; 62 - ret = netfs_xa_store_and_mark(buffer, index, folio, 63 - NETFS_FLAG_PUT_MARK, gfp_mask); 64 - if (ret < 0) { 65 - folio_put(folio); 66 - return ret; 67 - } 68 - 69 - index += folio_nr_pages(folio); 70 - } while (index <= to && index != 0); 71 - 72 - return 0; 73 - } 74 - 75 - /* 76 - * Clear an xarray buffer, putting a ref on the folios that have 77 - * NETFS_BUF_PUT_MARK set. 78 - */ 79 - void netfs_clear_buffer(struct xarray *buffer) 80 - { 81 - struct folio *folio; 82 - XA_STATE(xas, buffer, 0); 83 - 84 - rcu_read_lock(); 85 - xas_for_each_marked(&xas, folio, ULONG_MAX, NETFS_BUF_PUT_MARK) { 86 - folio_put(folio); 87 - } 88 - rcu_read_unlock(); 89 - xa_destroy(buffer); 90 - } 91 - 92 11 /** 93 12 * netfs_dirty_folio - Mark folio dirty and pin a cache object for writeback 94 13 * @mapping: The mapping the folio belongs to.
+1 -1
fs/netfs/write_issue.c
··· 483 483 if (!debug) 484 484 kdebug("R=%x: No submit", wreq->debug_id); 485 485 486 - if (flen < fsize) 486 + if (foff + flen < fsize) 487 487 for (int s = 0; s < NR_IO_STREAMS; s++) 488 488 netfs_issue_write(wreq, &wreq->io_streams[s]); 489 489
+2
fs/nfsd/nfsctl.c
··· 2169 2169 nn->nfsd_svcstats.program = &nfsd_program; 2170 2170 nn->nfsd_versions = NULL; 2171 2171 nn->nfsd4_minorversions = NULL; 2172 + nn->nfsd_info.mutex = &nfsd_mutex; 2173 + nn->nfsd_serv = NULL; 2172 2174 nfsd4_init_leases_net(nn); 2173 2175 get_random_bytes(&nn->siphash_key, sizeof(nn->siphash_key)); 2174 2176 seqlock_init(&nn->writeverf_lock);
-1
fs/nfsd/nfssvc.c
··· 672 672 return error; 673 673 } 674 674 spin_lock(&nfsd_notifier_lock); 675 - nn->nfsd_info.mutex = &nfsd_mutex; 676 675 nn->nfsd_serv = serv; 677 676 spin_unlock(&nfsd_notifier_lock); 678 677
+15 -4
fs/nilfs2/alloc.c
··· 377 377 * @target: offset number of an entry in the group (start point) 378 378 * @bsize: size in bits 379 379 * @lock: spin lock protecting @bitmap 380 + * @wrap: whether to wrap around 380 381 */ 381 382 static int nilfs_palloc_find_available_slot(unsigned char *bitmap, 382 383 unsigned long target, 383 384 unsigned int bsize, 384 - spinlock_t *lock) 385 + spinlock_t *lock, bool wrap) 385 386 { 386 387 int pos, end = bsize; 387 388 ··· 398 397 399 398 end = target; 400 399 } 400 + if (!wrap) 401 + return -ENOSPC; 401 402 402 403 /* wrap around */ 403 404 for (pos = 0; pos < end; pos++) { ··· 498 495 * nilfs_palloc_prepare_alloc_entry - prepare to allocate a persistent object 499 496 * @inode: inode of metadata file using this allocator 500 497 * @req: nilfs_palloc_req structure exchanged for the allocation 498 + * @wrap: whether to wrap around 501 499 */ 502 500 int nilfs_palloc_prepare_alloc_entry(struct inode *inode, 503 - struct nilfs_palloc_req *req) 501 + struct nilfs_palloc_req *req, bool wrap) 504 502 { 505 503 struct buffer_head *desc_bh, *bitmap_bh; 506 504 struct nilfs_palloc_group_desc *desc; ··· 520 516 entries_per_group = nilfs_palloc_entries_per_group(inode); 521 517 522 518 for (i = 0; i < ngroups; i += n) { 523 - if (group >= ngroups) { 519 + if (group >= ngroups && wrap) { 524 520 /* wrap around */ 525 521 group = 0; 526 522 maxgroup = nilfs_palloc_group(inode, req->pr_entry_nr, ··· 554 550 bitmap_kaddr = kmap_local_page(bitmap_bh->b_page); 555 551 bitmap = bitmap_kaddr + bh_offset(bitmap_bh); 556 552 pos = nilfs_palloc_find_available_slot( 557 - bitmap, group_offset, entries_per_group, lock); 553 + bitmap, group_offset, entries_per_group, lock, 554 + wrap); 555 + /* 556 + * Since the search for a free slot in the second and 557 + * subsequent bitmap blocks always starts from the 558 + * beginning, the wrap flag only has an effect on the 559 + * first search. 560 + */ 558 561 kunmap_local(bitmap_kaddr); 559 562 if (pos >= 0) 560 563 goto found;
+2 -2
fs/nilfs2/alloc.h
··· 50 50 struct buffer_head *pr_entry_bh; 51 51 }; 52 52 53 - int nilfs_palloc_prepare_alloc_entry(struct inode *, 54 - struct nilfs_palloc_req *); 53 + int nilfs_palloc_prepare_alloc_entry(struct inode *inode, 54 + struct nilfs_palloc_req *req, bool wrap); 55 55 void nilfs_palloc_commit_alloc_entry(struct inode *, 56 56 struct nilfs_palloc_req *); 57 57 void nilfs_palloc_abort_alloc_entry(struct inode *, struct nilfs_palloc_req *);
+1 -1
fs/nilfs2/dat.c
··· 75 75 { 76 76 int ret; 77 77 78 - ret = nilfs_palloc_prepare_alloc_entry(dat, req); 78 + ret = nilfs_palloc_prepare_alloc_entry(dat, req, true); 79 79 if (ret < 0) 80 80 return ret; 81 81
+6
fs/nilfs2/dir.c
··· 135 135 goto Enamelen; 136 136 if (((offs + rec_len - 1) ^ offs) & ~(chunk_size-1)) 137 137 goto Espan; 138 + if (unlikely(p->inode && 139 + NILFS_PRIVATE_INODE(le64_to_cpu(p->inode)))) 140 + goto Einumber; 138 141 } 139 142 if (offs != limit) 140 143 goto Eend; ··· 163 160 goto bad_entry; 164 161 Espan: 165 162 error = "directory entry across blocks"; 163 + goto bad_entry; 164 + Einumber: 165 + error = "disallowed inode number"; 166 166 bad_entry: 167 167 nilfs_error(sb, 168 168 "bad entry in directory #%lu: %s - offset=%lu, inode=%lu, rec_len=%zd, name_len=%d",
+2 -5
fs/nilfs2/ifile.c
··· 56 56 struct nilfs_palloc_req req; 57 57 int ret; 58 58 59 - req.pr_entry_nr = 0; /* 60 - * 0 says find free inode from beginning 61 - * of a group. dull code!! 62 - */ 59 + req.pr_entry_nr = NILFS_FIRST_INO(ifile->i_sb); 63 60 req.pr_entry_bh = NULL; 64 61 65 - ret = nilfs_palloc_prepare_alloc_entry(ifile, &req); 62 + ret = nilfs_palloc_prepare_alloc_entry(ifile, &req, false); 66 63 if (!ret) { 67 64 ret = nilfs_palloc_get_entry_block(ifile, req.pr_entry_nr, 1, 68 65 &req.pr_entry_bh);
+8 -2
fs/nilfs2/nilfs.h
··· 116 116 #define NILFS_FIRST_INO(sb) (((struct the_nilfs *)sb->s_fs_info)->ns_first_ino) 117 117 118 118 #define NILFS_MDT_INODE(sb, ino) \ 119 - ((ino) < NILFS_FIRST_INO(sb) && (NILFS_MDT_INO_BITS & BIT(ino))) 119 + ((ino) < NILFS_USER_INO && (NILFS_MDT_INO_BITS & BIT(ino))) 120 120 #define NILFS_VALID_INODE(sb, ino) \ 121 - ((ino) >= NILFS_FIRST_INO(sb) || (NILFS_SYS_INO_BITS & BIT(ino))) 121 + ((ino) >= NILFS_FIRST_INO(sb) || \ 122 + ((ino) < NILFS_USER_INO && (NILFS_SYS_INO_BITS & BIT(ino)))) 123 + 124 + #define NILFS_PRIVATE_INODE(ino) ({ \ 125 + ino_t __ino = (ino); \ 126 + ((__ino) < NILFS_USER_INO && (__ino) != NILFS_ROOT_INO && \ 127 + (__ino) != NILFS_SKETCH_INO); }) 122 128 123 129 /** 124 130 * struct nilfs_transaction_info: context information for synchronization
+6
fs/nilfs2/the_nilfs.c
··· 452 452 } 453 453 454 454 nilfs->ns_first_ino = le32_to_cpu(sbp->s_first_ino); 455 + if (nilfs->ns_first_ino < NILFS_USER_INO) { 456 + nilfs_err(nilfs->ns_sb, 457 + "too small lower limit for non-reserved inode numbers: %u", 458 + nilfs->ns_first_ino); 459 + return -EINVAL; 460 + } 455 461 456 462 nilfs->ns_blocks_per_segment = le32_to_cpu(sbp->s_blocks_per_segment); 457 463 if (nilfs->ns_blocks_per_segment < NILFS_SEG_MIN_BLOCKS) {
+1 -1
fs/nilfs2/the_nilfs.h
··· 182 182 unsigned long ns_nrsvsegs; 183 183 unsigned long ns_first_data_block; 184 184 int ns_inode_size; 185 - int ns_first_ino; 185 + unsigned int ns_first_ino; 186 186 u32 ns_crc_seed; 187 187 188 188 /* /sys/fs/<nilfs>/<device> */
+17 -9
fs/open.c
··· 202 202 return error; 203 203 } 204 204 205 - SYSCALL_DEFINE2(ftruncate, unsigned int, fd, unsigned long, length) 205 + SYSCALL_DEFINE2(ftruncate, unsigned int, fd, off_t, length) 206 206 { 207 207 return do_sys_ftruncate(fd, length, 1); 208 208 } 209 209 210 210 #ifdef CONFIG_COMPAT 211 - COMPAT_SYSCALL_DEFINE2(ftruncate, unsigned int, fd, compat_ulong_t, length) 211 + COMPAT_SYSCALL_DEFINE2(ftruncate, unsigned int, fd, compat_off_t, length) 212 212 { 213 213 return do_sys_ftruncate(fd, length, 1); 214 214 } ··· 1004 1004 } 1005 1005 } 1006 1006 1007 - /* 1008 - * Once we return a file with FMODE_OPENED, __fput() will call 1009 - * fsnotify_close(), so we need fsnotify_open() here for symmetry. 1010 - */ 1011 - fsnotify_open(f); 1012 1007 return 0; 1013 1008 1014 1009 cleanup_all: ··· 1080 1085 */ 1081 1086 int vfs_open(const struct path *path, struct file *file) 1082 1087 { 1088 + int ret; 1089 + 1083 1090 file->f_path = *path; 1084 - return do_dentry_open(file, NULL); 1091 + ret = do_dentry_open(file, NULL); 1092 + if (!ret) { 1093 + /* 1094 + * Once we return a file with FMODE_OPENED, __fput() will call 1095 + * fsnotify_close(), so we need fsnotify_open() here for 1096 + * symmetry. 1097 + */ 1098 + fsnotify_open(file); 1099 + } 1100 + return ret; 1085 1101 } 1086 1102 1087 1103 struct file *dentry_open(const struct path *path, int flags, ··· 1183 1177 error = do_dentry_open(f, NULL); 1184 1178 if (error) { 1185 1179 fput(f); 1186 - f = ERR_PTR(error); 1180 + return ERR_PTR(error); 1187 1181 } 1182 + 1183 + fsnotify_open(f); 1188 1184 return f; 1189 1185 } 1190 1186 EXPORT_SYMBOL_GPL(kernel_file_open);
+10 -1
fs/super.c
··· 1502 1502 1503 1503 lockdep_assert_held(&bdev->bd_fsfreeze_mutex); 1504 1504 1505 + /* 1506 + * The block device may have been frozen before it was claimed by a 1507 + * filesystem. Concurrently another process might try to mount that 1508 + * frozen block device and has temporarily claimed the block device for 1509 + * that purpose causing a concurrent fs_bdev_thaw() to end up here. The 1510 + * mounter is already about to abort mounting because they still saw an 1511 + * elevanted bdev->bd_fsfreeze_count so get_bdev_super() will return 1512 + * NULL in that case. 1513 + */ 1505 1514 sb = get_bdev_super(bdev); 1506 - if (WARN_ON_ONCE(!sb)) 1515 + if (!sb) 1507 1516 return -EINVAL; 1508 1517 1509 1518 if (sb->s_op->thaw_super)
+27 -4
fs/xfs/libxfs/xfs_bmap.c
··· 4058 4058 xfs_extlen_t indlen; 4059 4059 uint64_t fdblocks; 4060 4060 int error; 4061 - xfs_fileoff_t aoff = off; 4061 + xfs_fileoff_t aoff; 4062 + bool use_cowextszhint = 4063 + whichfork == XFS_COW_FORK && !prealloc; 4062 4064 4065 + retry: 4063 4066 /* 4064 4067 * Cap the alloc length. Keep track of prealloc so we know whether to 4065 4068 * tag the inode before we return. 4066 4069 */ 4070 + aoff = off; 4067 4071 alen = XFS_FILBLKS_MIN(len + prealloc, XFS_MAX_BMBT_EXTLEN); 4068 4072 if (!eof) 4069 4073 alen = XFS_FILBLKS_MIN(alen, got->br_startoff - aoff); 4070 4074 if (prealloc && alen >= len) 4071 4075 prealloc = alen - len; 4072 4076 4073 - /* Figure out the extent size, adjust alen */ 4074 - if (whichfork == XFS_COW_FORK) { 4077 + /* 4078 + * If we're targetting the COW fork but aren't creating a speculative 4079 + * posteof preallocation, try to expand the reservation to align with 4080 + * the COW extent size hint if there's sufficient free space. 4081 + * 4082 + * Unlike the data fork, the CoW cancellation functions will free all 4083 + * the reservations at inactivation, so we don't require that every 4084 + * delalloc reservation have a dirty pagecache. 4085 + */ 4086 + if (use_cowextszhint) { 4075 4087 struct xfs_bmbt_irec prev; 4076 4088 xfs_extlen_t extsz = xfs_get_cowextsz_hint(ip); 4077 4089 ··· 4102 4090 */ 4103 4091 error = xfs_quota_reserve_blkres(ip, alen); 4104 4092 if (error) 4105 - return error; 4093 + goto out; 4106 4094 4107 4095 /* 4108 4096 * Split changing sb for alen and indlen since they could be coming ··· 4152 4140 out_unreserve_quota: 4153 4141 if (XFS_IS_QUOTA_ON(mp)) 4154 4142 xfs_quota_unreserve_blkres(ip, alen); 4143 + out: 4144 + if (error == -ENOSPC || error == -EDQUOT) { 4145 + trace_xfs_delalloc_enospc(ip, off, len); 4146 + 4147 + if (prealloc || use_cowextszhint) { 4148 + /* retry without any preallocation */ 4149 + use_cowextszhint = false; 4150 + prealloc = 0; 4151 + goto retry; 4152 + } 4153 + } 4155 4154 return error; 4156 4155 } 4157 4156
+1 -1
fs/xfs/libxfs/xfs_fs.h
··· 996 996 #define XFS_IOC_FSGEOMETRY _IOR ('X', 126, struct xfs_fsop_geom) 997 997 #define XFS_IOC_BULKSTAT _IOR ('X', 127, struct xfs_bulkstat_req) 998 998 #define XFS_IOC_INUMBERS _IOR ('X', 128, struct xfs_inumbers_req) 999 - #define XFS_IOC_EXCHANGE_RANGE _IOWR('X', 129, struct xfs_exchange_range) 999 + #define XFS_IOC_EXCHANGE_RANGE _IOW ('X', 129, struct xfs_exchange_range) 1000 1000 /* XFS_IOC_GETFSUUID ---------- deprecated 140 */ 1001 1001 1002 1002
+18 -5
fs/xfs/libxfs/xfs_inode_buf.c
··· 379 379 /* 380 380 * A directory small enough to fit in the inode must be stored 381 381 * in local format. The directory sf <-> extents conversion 382 - * code updates the directory size accordingly. 382 + * code updates the directory size accordingly. Directories 383 + * being truncated have zero size and are not subject to this 384 + * check. 383 385 */ 384 386 if (S_ISDIR(mode)) { 385 - if (be64_to_cpu(dip->di_size) <= fork_size && 387 + if (dip->di_size && 388 + be64_to_cpu(dip->di_size) <= fork_size && 386 389 fork_format != XFS_DINODE_FMT_LOCAL) 387 390 return __this_address; 388 391 } ··· 531 528 if (mode && xfs_mode_to_ftype(mode) == XFS_DIR3_FT_UNKNOWN) 532 529 return __this_address; 533 530 534 - /* No zero-length symlinks/dirs. */ 535 - if ((S_ISLNK(mode) || S_ISDIR(mode)) && di_size == 0) 536 - return __this_address; 531 + /* 532 + * No zero-length symlinks/dirs unless they're unlinked and hence being 533 + * inactivated. 534 + */ 535 + if ((S_ISLNK(mode) || S_ISDIR(mode)) && di_size == 0) { 536 + if (dip->di_version > 1) { 537 + if (dip->di_nlink) 538 + return __this_address; 539 + } else { 540 + if (dip->di_onlink) 541 + return __this_address; 542 + } 543 + } 537 544 538 545 fa = xfs_dinode_verify_nrext64(mp, dip); 539 546 if (fa)
+22 -8
fs/xfs/xfs_bmap_util.c
··· 486 486 487 487 /* 488 488 * Test whether it is appropriate to check an inode for and free post EOF 489 - * blocks. The 'force' parameter determines whether we should also consider 490 - * regular files that are marked preallocated or append-only. 489 + * blocks. 491 490 */ 492 491 bool 493 492 xfs_can_free_eofblocks( 494 - struct xfs_inode *ip, 495 - bool force) 493 + struct xfs_inode *ip) 496 494 { 497 495 struct xfs_bmbt_irec imap; 498 496 struct xfs_mount *mp = ip->i_mount; ··· 524 526 return false; 525 527 526 528 /* 527 - * Do not free real preallocated or append-only files unless the file 528 - * has delalloc blocks and we are forced to remove them. 529 + * Only free real extents for inodes with persistent preallocations or 530 + * the append-only flag. 529 531 */ 530 532 if (ip->i_diflags & (XFS_DIFLAG_PREALLOC | XFS_DIFLAG_APPEND)) 531 - if (!force || ip->i_delayed_blks == 0) 533 + if (ip->i_delayed_blks == 0) 532 534 return false; 533 535 534 536 /* ··· 581 583 582 584 /* Wait on dio to ensure i_size has settled. */ 583 585 inode_dio_wait(VFS_I(ip)); 586 + 587 + /* 588 + * For preallocated files only free delayed allocations. 589 + * 590 + * Note that this means we also leave speculative preallocations in 591 + * place for preallocated files. 592 + */ 593 + if (ip->i_diflags & (XFS_DIFLAG_PREALLOC | XFS_DIFLAG_APPEND)) { 594 + if (ip->i_delayed_blks) { 595 + xfs_bmap_punch_delalloc_range(ip, 596 + round_up(XFS_ISIZE(ip), mp->m_sb.sb_blocksize), 597 + LLONG_MAX); 598 + } 599 + xfs_inode_clear_eofblocks_tag(ip); 600 + return 0; 601 + } 584 602 585 603 error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 0, 0, 0, &tp); 586 604 if (error) { ··· 905 891 * Trim eofblocks to avoid shifting uninitialized post-eof preallocation 906 892 * into the accessible region of the file. 907 893 */ 908 - if (xfs_can_free_eofblocks(ip, true)) { 894 + if (xfs_can_free_eofblocks(ip)) { 909 895 error = xfs_free_eofblocks(ip); 910 896 if (error) 911 897 return error;
+1 -1
fs/xfs/xfs_bmap_util.h
··· 63 63 xfs_off_t len); 64 64 65 65 /* EOF block manipulation functions */ 66 - bool xfs_can_free_eofblocks(struct xfs_inode *ip, bool force); 66 + bool xfs_can_free_eofblocks(struct xfs_inode *ip); 67 67 int xfs_free_eofblocks(struct xfs_inode *ip); 68 68 69 69 int xfs_swap_extents(struct xfs_inode *ip, struct xfs_inode *tip,
+1 -1
fs/xfs/xfs_icache.c
··· 1155 1155 } 1156 1156 *lockflags |= XFS_IOLOCK_EXCL; 1157 1157 1158 - if (xfs_can_free_eofblocks(ip, false)) 1158 + if (xfs_can_free_eofblocks(ip)) 1159 1159 return xfs_free_eofblocks(ip); 1160 1160 1161 1161 /* inode could be preallocated or append-only */
+13 -11
fs/xfs/xfs_inode.c
··· 42 42 #include "xfs_pnfs.h" 43 43 #include "xfs_parent.h" 44 44 #include "xfs_xattr.h" 45 + #include "xfs_sb.h" 45 46 46 47 struct kmem_cache *xfs_inode_cache; 47 48 ··· 871 870 * this saves us from needing to run a separate transaction to set the 872 871 * fork offset in the immediate future. 873 872 */ 874 - if (init_xattrs && xfs_has_attr(mp)) { 873 + if (init_xattrs) { 875 874 ip->i_forkoff = xfs_default_attroffset(ip) >> 3; 876 875 xfs_ifork_init_attr(ip, XFS_DINODE_FMT_EXTENTS, 0); 876 + 877 + if (!xfs_has_attr(mp)) { 878 + spin_lock(&mp->m_sb_lock); 879 + xfs_add_attr(mp); 880 + spin_unlock(&mp->m_sb_lock); 881 + xfs_log_sb(tp); 882 + } 877 883 } 878 884 879 885 /* ··· 1603 1595 if (!xfs_ilock_nowait(ip, XFS_IOLOCK_EXCL)) 1604 1596 return 0; 1605 1597 1606 - if (xfs_can_free_eofblocks(ip, false)) { 1598 + if (xfs_can_free_eofblocks(ip)) { 1607 1599 /* 1608 1600 * Check if the inode is being opened, written and closed 1609 1601 * frequently and we have delayed allocation blocks outstanding ··· 1864 1856 1865 1857 /* 1866 1858 * This file isn't being freed, so check if there are post-eof blocks 1867 - * to free. @force is true because we are evicting an inode from the 1868 - * cache. Post-eof blocks must be freed, lest we end up with broken 1869 - * free space accounting. 1859 + * to free. 1870 1860 * 1871 1861 * Note: don't bother with iolock here since lockdep complains about 1872 1862 * acquiring it in reclaim context. We have the only reference to the 1873 1863 * inode at this point anyways. 1874 1864 */ 1875 - return xfs_can_free_eofblocks(ip, true); 1865 + return xfs_can_free_eofblocks(ip); 1876 1866 } 1877 1867 1878 1868 /* ··· 1953 1947 1954 1948 if (VFS_I(ip)->i_nlink != 0) { 1955 1949 /* 1956 - * force is true because we are evicting an inode from the 1957 - * cache. Post-eof blocks must be freed, lest we end up with 1958 - * broken free space accounting. 1959 - * 1960 1950 * Note: don't bother with iolock here since lockdep complains 1961 1951 * about acquiring it in reclaim context. We have the only 1962 1952 * reference to the inode at this point anyways. 1963 1953 */ 1964 - if (xfs_can_free_eofblocks(ip, true)) 1954 + if (xfs_can_free_eofblocks(ip)) 1965 1955 error = xfs_free_eofblocks(ip); 1966 1956 1967 1957 goto out;
+12 -22
fs/xfs/xfs_iomap.c
··· 1148 1148 } 1149 1149 } 1150 1150 1151 - retry: 1152 - error = xfs_bmapi_reserve_delalloc(ip, allocfork, offset_fsb, 1153 - end_fsb - offset_fsb, prealloc_blocks, 1154 - allocfork == XFS_DATA_FORK ? &imap : &cmap, 1155 - allocfork == XFS_DATA_FORK ? &icur : &ccur, 1156 - allocfork == XFS_DATA_FORK ? eof : cow_eof); 1157 - switch (error) { 1158 - case 0: 1159 - break; 1160 - case -ENOSPC: 1161 - case -EDQUOT: 1162 - /* retry without any preallocation */ 1163 - trace_xfs_delalloc_enospc(ip, offset, count); 1164 - if (prealloc_blocks) { 1165 - prealloc_blocks = 0; 1166 - goto retry; 1167 - } 1168 - fallthrough; 1169 - default: 1170 - goto out_unlock; 1171 - } 1172 - 1173 1151 if (allocfork == XFS_COW_FORK) { 1152 + error = xfs_bmapi_reserve_delalloc(ip, allocfork, offset_fsb, 1153 + end_fsb - offset_fsb, prealloc_blocks, &cmap, 1154 + &ccur, cow_eof); 1155 + if (error) 1156 + goto out_unlock; 1157 + 1174 1158 trace_xfs_iomap_alloc(ip, offset, count, allocfork, &cmap); 1175 1159 goto found_cow; 1176 1160 } 1161 + 1162 + error = xfs_bmapi_reserve_delalloc(ip, allocfork, offset_fsb, 1163 + end_fsb - offset_fsb, prealloc_blocks, &imap, &icur, 1164 + eof); 1165 + if (error) 1166 + goto out_unlock; 1177 1167 1178 1168 /* 1179 1169 * Flag newly allocated delalloc blocks with IOMAP_F_NEW so we punch
+1 -1
include/asm-generic/syscalls.h
··· 19 19 #ifndef sys_mmap 20 20 asmlinkage long sys_mmap(unsigned long addr, unsigned long len, 21 21 unsigned long prot, unsigned long flags, 22 - unsigned long fd, off_t pgoff); 22 + unsigned long fd, unsigned long off); 23 23 #endif 24 24 25 25 #ifndef sys_rt_sigreturn
+23
include/linux/closure.h
··· 285 285 } 286 286 287 287 /** 288 + * closure_get_not_zero 289 + */ 290 + static inline bool closure_get_not_zero(struct closure *cl) 291 + { 292 + unsigned old = atomic_read(&cl->remaining); 293 + do { 294 + if (!(old & CLOSURE_REMAINING_MASK)) 295 + return false; 296 + 297 + } while (!atomic_try_cmpxchg_acquire(&cl->remaining, &old, old + 1)); 298 + 299 + return true; 300 + } 301 + 302 + /** 288 303 * closure_init - Initialize a closure, setting the refcount to 1 289 304 * @cl: closure to initialize 290 305 * @parent: parent of the new closure. cl will take a refcount on it for its ··· 323 308 { 324 309 memset(cl, 0, sizeof(struct closure)); 325 310 atomic_set(&cl->remaining, CLOSURE_REMAINING_INITIALIZER); 311 + } 312 + 313 + static inline void closure_init_stack_release(struct closure *cl) 314 + { 315 + memset(cl, 0, sizeof(struct closure)); 316 + atomic_set_release(&cl->remaining, CLOSURE_REMAINING_INITIALIZER); 326 317 } 327 318 328 319 /** ··· 375 354 * thought of as returning to the parent closure. 376 355 */ 377 356 #define closure_return(_cl) continue_at((_cl), NULL, NULL) 357 + 358 + void closure_return_sync(struct closure *cl); 378 359 379 360 /** 380 361 * continue_at_nobarrier - jump to another function without barrier
+1 -1
include/linux/compat.h
··· 608 608 asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, 609 609 struct compat_statfs64 __user *buf); 610 610 asmlinkage long compat_sys_truncate(const char __user *, compat_off_t); 611 - asmlinkage long compat_sys_ftruncate(unsigned int, compat_ulong_t); 611 + asmlinkage long compat_sys_ftruncate(unsigned int, compat_off_t); 612 612 /* No generic prototype for truncate64, ftruncate64, fallocate */ 613 613 asmlinkage long compat_sys_openat(int dfd, const char __user *filename, 614 614 int flags, umode_t mode);
+7 -7
include/linux/filter.h
··· 1313 1313 return false; 1314 1314 } 1315 1315 1316 - const char *__bpf_address_lookup(unsigned long addr, unsigned long *size, 1316 + int __bpf_address_lookup(unsigned long addr, unsigned long *size, 1317 1317 unsigned long *off, char *sym); 1318 1318 bool is_bpf_text_address(unsigned long addr); 1319 1319 int bpf_get_kallsym(unsigned int symnum, unsigned long *value, char *type, 1320 1320 char *sym); 1321 1321 struct bpf_prog *bpf_prog_ksym_find(unsigned long addr); 1322 1322 1323 - static inline const char * 1323 + static inline int 1324 1324 bpf_address_lookup(unsigned long addr, unsigned long *size, 1325 1325 unsigned long *off, char **modname, char *sym) 1326 1326 { 1327 - const char *ret = __bpf_address_lookup(addr, size, off, sym); 1327 + int ret = __bpf_address_lookup(addr, size, off, sym); 1328 1328 1329 1329 if (ret && modname) 1330 1330 *modname = NULL; ··· 1368 1368 return false; 1369 1369 } 1370 1370 1371 - static inline const char * 1371 + static inline int 1372 1372 __bpf_address_lookup(unsigned long addr, unsigned long *size, 1373 1373 unsigned long *off, char *sym) 1374 1374 { 1375 - return NULL; 1375 + return 0; 1376 1376 } 1377 1377 1378 1378 static inline bool is_bpf_text_address(unsigned long addr) ··· 1391 1391 return NULL; 1392 1392 } 1393 1393 1394 - static inline const char * 1394 + static inline int 1395 1395 bpf_address_lookup(unsigned long addr, unsigned long *size, 1396 1396 unsigned long *off, char **modname, char *sym) 1397 1397 { 1398 - return NULL; 1398 + return 0; 1399 1399 } 1400 1400 1401 1401 static inline void bpf_prog_kallsyms_add(struct bpf_prog *fp)
+7 -1
include/linux/fsnotify.h
··· 112 112 { 113 113 const struct path *path; 114 114 115 - if (file->f_mode & FMODE_NONOTIFY) 115 + /* 116 + * FMODE_NONOTIFY are fds generated by fanotify itself which should not 117 + * generate new events. We also don't want to generate events for 118 + * FMODE_PATH fds (involves open & close events) as they are just 119 + * handle creation / destruction events and not "real" file events. 120 + */ 121 + if (file->f_mode & (FMODE_NONOTIFY | FMODE_PATH)) 116 122 return 0; 117 123 118 124 path = &file->f_path;
+3 -3
include/linux/ftrace.h
··· 86 86 87 87 #if defined(CONFIG_FUNCTION_TRACER) && defined(CONFIG_MODULES) && \ 88 88 defined(CONFIG_DYNAMIC_FTRACE) 89 - const char * 89 + int 90 90 ftrace_mod_address_lookup(unsigned long addr, unsigned long *size, 91 91 unsigned long *off, char **modname, char *sym); 92 92 #else 93 - static inline const char * 93 + static inline int 94 94 ftrace_mod_address_lookup(unsigned long addr, unsigned long *size, 95 95 unsigned long *off, char **modname, char *sym) 96 96 { 97 - return NULL; 97 + return 0; 98 98 } 99 99 #endif 100 100
-1
include/linux/io_uring_types.h
··· 207 207 bool need_plug; 208 208 bool cq_flush; 209 209 unsigned short submit_nr; 210 - unsigned int cqes_count; 211 210 struct blk_plug plug; 212 211 }; 213 212
+1
include/linux/libata.h
··· 1249 1249 extern struct ata_port *ata_sas_port_alloc(struct ata_host *, 1250 1250 struct ata_port_info *, struct Scsi_Host *); 1251 1251 extern void ata_port_probe(struct ata_port *ap); 1252 + extern void ata_port_free(struct ata_port *ap); 1252 1253 extern int ata_sas_tport_add(struct device *parent, struct ata_port *ap); 1253 1254 extern void ata_sas_tport_delete(struct ata_port *ap); 1254 1255 int ata_sas_device_configure(struct scsi_device *sdev, struct queue_limits *lim,
+5 -1
include/linux/mlx5/mlx5_ifc.h
··· 2036 2036 u8 min_mkey_log_entity_size_fixed_buffer_valid[0x1]; 2037 2037 u8 reserved_at_402[0x1e]; 2038 2038 2039 - u8 reserved_at_420[0x3e0]; 2039 + u8 reserved_at_420[0x20]; 2040 + 2041 + u8 reserved_at_440[0x8]; 2042 + u8 max_num_eqs_24b[0x18]; 2043 + u8 reserved_at_460[0x3a0]; 2040 2044 }; 2041 2045 2042 2046 enum mlx5_ifc_flow_destination_type {
+7 -7
include/linux/module.h
··· 931 931 * least KSYM_NAME_LEN long: a pointer to namebuf is returned if 932 932 * found, otherwise NULL. 933 933 */ 934 - const char *module_address_lookup(unsigned long addr, 935 - unsigned long *symbolsize, 936 - unsigned long *offset, 937 - char **modname, const unsigned char **modbuildid, 938 - char *namebuf); 934 + int module_address_lookup(unsigned long addr, 935 + unsigned long *symbolsize, 936 + unsigned long *offset, 937 + char **modname, const unsigned char **modbuildid, 938 + char *namebuf); 939 939 int lookup_module_symbol_name(unsigned long addr, char *symname); 940 940 int lookup_module_symbol_attrs(unsigned long addr, 941 941 unsigned long *size, ··· 964 964 } 965 965 966 966 /* For kallsyms to ask for address resolution. NULL means not found. */ 967 - static inline const char *module_address_lookup(unsigned long addr, 967 + static inline int module_address_lookup(unsigned long addr, 968 968 unsigned long *symbolsize, 969 969 unsigned long *offset, 970 970 char **modname, 971 971 const unsigned char **modbuildid, 972 972 char *namebuf) 973 973 { 974 - return NULL; 974 + return 0; 975 975 } 976 976 977 977 static inline int lookup_module_symbol_name(unsigned long addr, char *symname)
+4 -2
include/linux/nvme.h
··· 85 85 enum { 86 86 NVMF_RDMA_QPTYPE_CONNECTED = 1, /* Reliable Connected */ 87 87 NVMF_RDMA_QPTYPE_DATAGRAM = 2, /* Reliable Datagram */ 88 + NVMF_RDMA_QPTYPE_INVALID = 0xff, 88 89 }; 89 90 90 - /* RDMA QP Service Type codes for Discovery Log Page entry TSAS 91 - * RDMA_QPTYPE field 91 + /* RDMA Provider Type codes for Discovery Log Page entry TSAS 92 + * RDMA_PRTYPE field 92 93 */ 93 94 enum { 94 95 NVMF_RDMA_PRTYPE_NOT_SPECIFIED = 1, /* No Provider Specified */ ··· 111 110 NVMF_TCP_SECTYPE_NONE = 0, /* No Security */ 112 111 NVMF_TCP_SECTYPE_TLS12 = 1, /* TLSv1.2, NVMe-oF 1.1 and NVMe-TCP 3.6.1.1 */ 113 112 NVMF_TCP_SECTYPE_TLS13 = 2, /* TLSv1.3, NVMe-oF 1.1 and NVMe-TCP 3.6.1.1 */ 113 + NVMF_TCP_SECTYPE_INVALID = 0xff, 114 114 }; 115 115 116 116 #define NVME_AQ_DEPTH 32
+1 -1
include/linux/phy.h
··· 1126 1126 u8 index, enum led_brightness value); 1127 1127 1128 1128 /** 1129 - * @led_blink_set: Set a PHY LED brightness. Index indicates 1129 + * @led_blink_set: Set a PHY LED blinking. Index indicates 1130 1130 * which of the PHYs led should be configured to blink. Delays 1131 1131 * are in milliseconds and if both are zero then a sensible 1132 1132 * default should be chosen. The call should adjust the
-3
include/linux/printk.h
··· 60 60 #define CONSOLE_LOGLEVEL_DEFAULT CONFIG_CONSOLE_LOGLEVEL_DEFAULT 61 61 #define CONSOLE_LOGLEVEL_QUIET CONFIG_CONSOLE_LOGLEVEL_QUIET 62 62 63 - int add_preferred_console_match(const char *match, const char *name, 64 - const short idx); 65 - 66 63 extern int console_printk[]; 67 64 68 65 #define console_loglevel (console_printk[0])
+19 -2
include/linux/serial_core.h
··· 811 811 if (pending < WAKEUP_CHARS) { \ 812 812 uart_write_wakeup(__port); \ 813 813 \ 814 - if (!((flags) & UART_TX_NOSTOP) && pending == 0 && \ 815 - __port->ops->tx_empty(__port)) \ 814 + if (!((flags) & UART_TX_NOSTOP) && pending == 0) \ 816 815 __port->ops->stop_tx(__port); \ 817 816 } \ 818 817 \ ··· 848 849 unsigned int __count = (count); \ 849 850 __uart_port_tx(port, ch, 0, tx_ready, put_char, tx_done, __count, \ 850 851 __count--); \ 852 + }) 853 + 854 + /** 855 + * uart_port_tx_limited_flags -- transmit helper for uart_port with count limiting with flags 856 + * @port: uart port 857 + * @ch: variable to store a character to be written to the HW 858 + * @flags: %UART_TX_NOSTOP or similar 859 + * @count: a limit of characters to send 860 + * @tx_ready: can HW accept more data function 861 + * @put_char: function to write a character 862 + * @tx_done: function to call after the loop is done 863 + * 864 + * See uart_port_tx_limited() for more details. 865 + */ 866 + #define uart_port_tx_limited_flags(port, ch, flags, count, tx_ready, put_char, tx_done) ({ \ 867 + unsigned int __count = (count); \ 868 + __uart_port_tx(port, ch, flags, tx_ready, put_char, tx_done, __count, \ 869 + __count--); \ 851 870 }) 852 871 853 872 /**
+16 -10
include/linux/syscalls.h
··· 322 322 long nr, 323 323 struct io_event __user *events, 324 324 struct __kernel_timespec __user *timeout, 325 - const struct __aio_sigset *sig); 325 + const struct __aio_sigset __user *sig); 326 326 asmlinkage long sys_io_pgetevents_time32(aio_context_t ctx_id, 327 327 long min_nr, 328 328 long nr, 329 329 struct io_event __user *events, 330 330 struct old_timespec32 __user *timeout, 331 - const struct __aio_sigset *sig); 331 + const struct __aio_sigset __user *sig); 332 332 asmlinkage long sys_io_uring_setup(u32 entries, 333 333 struct io_uring_params __user *p); 334 334 asmlinkage long sys_io_uring_enter(unsigned int fd, u32 to_submit, ··· 418 418 u64 __user *mnt_ids, size_t nr_mnt_ids, 419 419 unsigned int flags); 420 420 asmlinkage long sys_truncate(const char __user *path, long length); 421 - asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length); 421 + asmlinkage long sys_ftruncate(unsigned int fd, off_t length); 422 422 #if BITS_PER_LONG == 32 423 423 asmlinkage long sys_truncate64(const char __user *path, loff_t length); 424 424 asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length); ··· 441 441 asmlinkage long sys_openat(int dfd, const char __user *filename, int flags, 442 442 umode_t mode); 443 443 asmlinkage long sys_openat2(int dfd, const char __user *filename, 444 - struct open_how *how, size_t size); 444 + struct open_how __user *how, size_t size); 445 445 asmlinkage long sys_close(unsigned int fd); 446 446 asmlinkage long sys_close_range(unsigned int fd, unsigned int max_fd, 447 447 unsigned int flags); ··· 555 555 asmlinkage long sys_set_robust_list(struct robust_list_head __user *head, 556 556 size_t len); 557 557 558 - asmlinkage long sys_futex_waitv(struct futex_waitv *waiters, 558 + asmlinkage long sys_futex_waitv(struct futex_waitv __user *waiters, 559 559 unsigned int nr_futexes, unsigned int flags, 560 560 struct __kernel_timespec __user *timeout, clockid_t clockid); 561 561 ··· 859 859 const struct rlimit64 __user *new_rlim, 860 860 struct rlimit64 __user *old_rlim); 861 861 asmlinkage long sys_fanotify_init(unsigned int flags, unsigned int event_f_flags); 862 + #if defined(CONFIG_ARCH_SPLIT_ARG64) 863 + asmlinkage long sys_fanotify_mark(int fanotify_fd, unsigned int flags, 864 + unsigned int mask_1, unsigned int mask_2, 865 + int dfd, const char __user * pathname); 866 + #else 862 867 asmlinkage long sys_fanotify_mark(int fanotify_fd, unsigned int flags, 863 868 u64 mask, int fd, 864 869 const char __user *pathname); 870 + #endif 865 871 asmlinkage long sys_name_to_handle_at(int dfd, const char __user *name, 866 872 struct file_handle __user *handle, 867 873 int __user *mnt_id, int flag); ··· 913 907 asmlinkage long sys_getrandom(char __user *buf, size_t count, 914 908 unsigned int flags); 915 909 asmlinkage long sys_memfd_create(const char __user *uname_ptr, unsigned int flags); 916 - asmlinkage long sys_bpf(int cmd, union bpf_attr *attr, unsigned int size); 910 + asmlinkage long sys_bpf(int cmd, union bpf_attr __user *attr, unsigned int size); 917 911 asmlinkage long sys_execveat(int dfd, const char __user *filename, 918 912 const char __user *const __user *argv, 919 913 const char __user *const __user *envp, int flags); ··· 966 960 struct cachestat_range __user *cstat_range, 967 961 struct cachestat __user *cstat, unsigned int flags); 968 962 asmlinkage long sys_map_shadow_stack(unsigned long addr, unsigned long size, unsigned int flags); 969 - asmlinkage long sys_lsm_get_self_attr(unsigned int attr, struct lsm_ctx *ctx, 970 - u32 *size, u32 flags); 971 - asmlinkage long sys_lsm_set_self_attr(unsigned int attr, struct lsm_ctx *ctx, 963 + asmlinkage long sys_lsm_get_self_attr(unsigned int attr, struct lsm_ctx __user *ctx, 964 + u32 __user *size, u32 flags); 965 + asmlinkage long sys_lsm_set_self_attr(unsigned int attr, struct lsm_ctx __user *ctx, 972 966 u32 size, u32 flags); 973 - asmlinkage long sys_lsm_list_modules(u64 *ids, u32 *size, u32 flags); 967 + asmlinkage long sys_lsm_list_modules(u64 __user *ids, u32 __user *size, u32 flags); 974 968 975 969 /* 976 970 * Architecture-specific system calls
+11
include/net/bluetooth/hci.h
··· 324 324 * claim to support it. 325 325 */ 326 326 HCI_QUIRK_BROKEN_READ_ENC_KEY_SIZE, 327 + 328 + /* 329 + * When this quirk is set, the reserved bits of Primary/Secondary_PHY 330 + * inside the LE Extended Advertising Report events are discarded. 331 + * This is required for some Apple/Broadcom controllers which 332 + * abuse these reserved bits for unrelated flags. 333 + * 334 + * This quirk can be set before hci_register_dev is called or 335 + * during the hdev->setup vendor callback. 336 + */ 337 + HCI_QUIRK_FIXUP_LE_EXT_ADV_REPORT_PHY, 327 338 }; 328 339 329 340 /* HCI device flags */
+2
include/net/bluetooth/hci_sync.h
··· 38 38 int __hci_cmd_sync_status_sk(struct hci_dev *hdev, u16 opcode, u32 plen, 39 39 const void *param, u8 event, u32 timeout, 40 40 struct sock *sk); 41 + int hci_cmd_sync_status(struct hci_dev *hdev, u16 opcode, u32 plen, 42 + const void *param, u32 timeout); 41 43 42 44 void hci_cmd_sync_init(struct hci_dev *hdev); 43 45 void hci_cmd_sync_clear(struct hci_dev *hdev);
+1 -1
include/net/mac80211.h
··· 396 396 BSS_CHANGED_HE_OBSS_PD = 1<<28, 397 397 BSS_CHANGED_HE_BSS_COLOR = 1<<29, 398 398 BSS_CHANGED_FILS_DISCOVERY = 1<<30, 399 - BSS_CHANGED_UNSOL_BCAST_PROBE_RESP = 1<<31, 399 + BSS_CHANGED_UNSOL_BCAST_PROBE_RESP = BIT_ULL(31), 400 400 BSS_CHANGED_MLD_VALID_LINKS = BIT_ULL(33), 401 401 BSS_CHANGED_MLD_TTLM = BIT_ULL(34), 402 402 BSS_CHANGED_TPE = BIT_ULL(35),
+1 -1
include/uapi/asm-generic/unistd.h
··· 737 737 #define __NR_ppoll_time64 414 738 738 __SC_COMP(__NR_ppoll_time64, sys_ppoll, compat_sys_ppoll_time64) 739 739 #define __NR_io_pgetevents_time64 416 740 - __SYSCALL(__NR_io_pgetevents_time64, sys_io_pgetevents) 740 + __SC_COMP(__NR_io_pgetevents_time64, sys_io_pgetevents, compat_sys_io_pgetevents_time64) 741 741 #define __NR_recvmmsg_time64 417 742 742 __SC_COMP(__NR_recvmmsg_time64, sys_recvmmsg, compat_sys_recvmmsg_time64) 743 743 #define __NR_mq_timedsend_time64 418
+1 -1
include/uapi/linux/trace_mmap.h
··· 43 43 __u64 Reserved2; 44 44 }; 45 45 46 - #define TRACE_MMAP_IOCTL_GET_READER _IO('T', 0x1) 46 + #define TRACE_MMAP_IOCTL_GET_READER _IO('R', 0x20) 47 47 48 48 #endif /* _TRACE_MMAP_H_ */
+2 -2
io_uring/io_uring.c
··· 1259 1259 if (ctx->flags & IORING_SETUP_SQPOLL) { 1260 1260 struct io_sq_data *sqd = ctx->sq_data; 1261 1261 1262 - if (wq_has_sleeper(&sqd->wait)) 1263 - wake_up(&sqd->wait); 1262 + if (sqd->thread) 1263 + __set_notify_signal(sqd->thread); 1264 1264 return; 1265 1265 } 1266 1266
+6 -4
io_uring/net.c
··· 1127 1127 flags |= MSG_DONTWAIT; 1128 1128 1129 1129 retry_multishot: 1130 - kmsg->msg.msg_inq = -1; 1131 - kmsg->msg.msg_flags = 0; 1132 - 1133 1130 if (io_do_buffer_select(req)) { 1134 1131 ret = io_recv_buf_select(req, kmsg, &len, issue_flags); 1135 - if (unlikely(ret)) 1132 + if (unlikely(ret)) { 1133 + kmsg->msg.msg_inq = -1; 1136 1134 goto out_free; 1135 + } 1137 1136 sr->buf = NULL; 1138 1137 } 1138 + 1139 + kmsg->msg.msg_flags = 0; 1140 + kmsg->msg.msg_inq = -1; 1139 1141 1140 1142 if (flags & MSG_WAITALL) 1141 1143 min_ret = iov_iter_count(&kmsg->msg.msg_iter);
+3 -4
kernel/bpf/core.c
··· 736 736 return n ? container_of(n, struct bpf_ksym, tnode) : NULL; 737 737 } 738 738 739 - const char *__bpf_address_lookup(unsigned long addr, unsigned long *size, 739 + int __bpf_address_lookup(unsigned long addr, unsigned long *size, 740 740 unsigned long *off, char *sym) 741 741 { 742 742 struct bpf_ksym *ksym; 743 - char *ret = NULL; 743 + int ret = 0; 744 744 745 745 rcu_read_lock(); 746 746 ksym = bpf_ksym_find(addr); ··· 748 748 unsigned long symbol_start = ksym->start; 749 749 unsigned long symbol_end = ksym->end; 750 750 751 - strscpy(sym, ksym->name, KSYM_NAME_LEN); 751 + ret = strscpy(sym, ksym->name, KSYM_NAME_LEN); 752 752 753 - ret = sym; 754 753 if (size) 755 754 *size = symbol_end - symbol_start; 756 755 if (off)
+7 -4
kernel/cpu.c
··· 1859 1859 1860 1860 void __init bringup_nonboot_cpus(unsigned int max_cpus) 1861 1861 { 1862 + if (!max_cpus) 1863 + return; 1864 + 1862 1865 /* Try parallel bringup optimization if enabled */ 1863 1866 if (cpuhp_bringup_cpus_parallel(max_cpus)) 1864 1867 return; ··· 2449 2446 * The caller needs to hold cpus read locked while calling this function. 2450 2447 * Return: 2451 2448 * On success: 2452 - * Positive state number if @state is CPUHP_AP_ONLINE_DYN; 2449 + * Positive state number if @state is CPUHP_AP_ONLINE_DYN or CPUHP_BP_PREPARE_DYN; 2453 2450 * 0 for all other states 2454 2451 * On failure: proper (negative) error code 2455 2452 */ ··· 2472 2469 ret = cpuhp_store_callbacks(state, name, startup, teardown, 2473 2470 multi_instance); 2474 2471 2475 - dynstate = state == CPUHP_AP_ONLINE_DYN; 2472 + dynstate = state == CPUHP_AP_ONLINE_DYN || state == CPUHP_BP_PREPARE_DYN; 2476 2473 if (ret > 0 && dynstate) { 2477 2474 state = ret; 2478 2475 ret = 0; ··· 2503 2500 out: 2504 2501 mutex_unlock(&cpuhp_state_mutex); 2505 2502 /* 2506 - * If the requested state is CPUHP_AP_ONLINE_DYN, return the 2507 - * dynamically allocated state in case of success. 2503 + * If the requested state is CPUHP_AP_ONLINE_DYN or CPUHP_BP_PREPARE_DYN, 2504 + * return the dynamically allocated state in case of success. 2508 2505 */ 2509 2506 if (!ret && dynstate) 2510 2507 return state;
+2
kernel/exit.c
··· 484 484 * Search through everything else, we should not get here often. 485 485 */ 486 486 for_each_process(g) { 487 + if (atomic_read(&mm->mm_users) <= 1) 488 + break; 487 489 if (g->flags & PF_KTHREAD) 488 490 continue; 489 491 for_each_thread(g, c) {
+12 -11
kernel/kallsyms.c
··· 388 388 !!__bpf_address_lookup(addr, symbolsize, offset, namebuf); 389 389 } 390 390 391 - static const char *kallsyms_lookup_buildid(unsigned long addr, 391 + static int kallsyms_lookup_buildid(unsigned long addr, 392 392 unsigned long *symbolsize, 393 393 unsigned long *offset, char **modname, 394 394 const unsigned char **modbuildid, char *namebuf) 395 395 { 396 - const char *ret; 396 + int ret; 397 397 398 398 namebuf[KSYM_NAME_LEN - 1] = 0; 399 399 namebuf[0] = 0; ··· 410 410 if (modbuildid) 411 411 *modbuildid = NULL; 412 412 413 - ret = namebuf; 413 + ret = strlen(namebuf); 414 414 goto found; 415 415 } 416 416 ··· 442 442 unsigned long *offset, 443 443 char **modname, char *namebuf) 444 444 { 445 - return kallsyms_lookup_buildid(addr, symbolsize, offset, modname, 446 - NULL, namebuf); 445 + int ret = kallsyms_lookup_buildid(addr, symbolsize, offset, modname, 446 + NULL, namebuf); 447 + 448 + if (!ret) 449 + return NULL; 450 + 451 + return namebuf; 447 452 } 448 453 449 454 int lookup_symbol_name(unsigned long addr, char *symname) ··· 483 478 { 484 479 char *modname; 485 480 const unsigned char *buildid; 486 - const char *name; 487 481 unsigned long offset, size; 488 482 int len; 489 483 490 484 address += symbol_offset; 491 - name = kallsyms_lookup_buildid(address, &size, &offset, &modname, &buildid, 485 + len = kallsyms_lookup_buildid(address, &size, &offset, &modname, &buildid, 492 486 buffer); 493 - if (!name) 487 + if (!len) 494 488 return sprintf(buffer, "0x%lx", address - symbol_offset); 495 489 496 - if (name != buffer) 497 - strcpy(buffer, name); 498 - len = strlen(buffer); 499 490 offset -= symbol_offset; 500 491 501 492 if (add_offset)
+12 -13
kernel/module/kallsyms.c
··· 321 321 * For kallsyms to ask for address resolution. NULL means not found. Careful 322 322 * not to lock to avoid deadlock on oopses, simply disable preemption. 323 323 */ 324 - const char *module_address_lookup(unsigned long addr, 325 - unsigned long *size, 326 - unsigned long *offset, 327 - char **modname, 328 - const unsigned char **modbuildid, 329 - char *namebuf) 324 + int module_address_lookup(unsigned long addr, 325 + unsigned long *size, 326 + unsigned long *offset, 327 + char **modname, 328 + const unsigned char **modbuildid, 329 + char *namebuf) 330 330 { 331 - const char *ret = NULL; 331 + const char *sym; 332 + int ret = 0; 332 333 struct module *mod; 333 334 334 335 preempt_disable(); ··· 345 344 #endif 346 345 } 347 346 348 - ret = find_kallsyms_symbol(mod, addr, size, offset); 349 - } 350 - /* Make a copy in here where it's safe */ 351 - if (ret) { 352 - strscpy(namebuf, ret, KSYM_NAME_LEN); 353 - ret = namebuf; 347 + sym = find_kallsyms_symbol(mod, addr, size, offset); 348 + 349 + if (sym) 350 + ret = strscpy(namebuf, sym, KSYM_NAME_LEN); 354 351 } 355 352 preempt_enable(); 356 353
+1 -1
kernel/printk/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 - obj-y = printk.o conopt.o 2 + obj-y = printk.o 3 3 obj-$(CONFIG_PRINTK) += printk_safe.o nbcon.o 4 4 obj-$(CONFIG_A11Y_BRAILLE_CONSOLE) += braille.o 5 5 obj-$(CONFIG_PRINTK_INDEX) += index.o
-146
kernel/printk/conopt.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * Kernel command line console options for hardware based addressing 4 - * 5 - * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/ 6 - * Author: Tony Lindgren <tony@atomide.com> 7 - */ 8 - 9 - #include <linux/console.h> 10 - #include <linux/init.h> 11 - #include <linux/string.h> 12 - #include <linux/types.h> 13 - 14 - #include <asm/errno.h> 15 - 16 - #include "console_cmdline.h" 17 - 18 - /* 19 - * Allow longer DEVNAME:0.0 style console naming such as abcd0000.serial:0.0 20 - * in addition to the legacy ttyS0 style naming. 21 - */ 22 - #define CONSOLE_NAME_MAX 32 23 - 24 - #define CONSOLE_OPT_MAX 16 25 - #define CONSOLE_BRL_OPT_MAX 16 26 - 27 - struct console_option { 28 - char name[CONSOLE_NAME_MAX]; 29 - char opt[CONSOLE_OPT_MAX]; 30 - char brl_opt[CONSOLE_BRL_OPT_MAX]; 31 - u8 has_brl_opt:1; 32 - }; 33 - 34 - /* Updated only at console_setup() time, no locking needed */ 35 - static struct console_option conopt[MAX_CMDLINECONSOLES]; 36 - 37 - /** 38 - * console_opt_save - Saves kernel command line console option for driver use 39 - * @str: Kernel command line console name and option 40 - * @brl_opt: Braille console options 41 - * 42 - * Saves a kernel command line console option for driver subsystems to use for 43 - * adding a preferred console during init. Called from console_setup() only. 44 - * 45 - * Return: 0 on success, negative error code on failure. 46 - */ 47 - int __init console_opt_save(const char *str, const char *brl_opt) 48 - { 49 - struct console_option *con; 50 - size_t namelen, optlen; 51 - const char *opt; 52 - int i; 53 - 54 - namelen = strcspn(str, ","); 55 - if (namelen == 0 || namelen >= CONSOLE_NAME_MAX) 56 - return -EINVAL; 57 - 58 - opt = str + namelen; 59 - if (*opt == ',') 60 - opt++; 61 - 62 - optlen = strlen(opt); 63 - if (optlen >= CONSOLE_OPT_MAX) 64 - return -EINVAL; 65 - 66 - for (i = 0; i < MAX_CMDLINECONSOLES; i++) { 67 - con = &conopt[i]; 68 - 69 - if (con->name[0]) { 70 - if (!strncmp(str, con->name, namelen)) 71 - return 0; 72 - continue; 73 - } 74 - 75 - /* 76 - * The name isn't terminated, only opt is. Empty opt is fine, 77 - * but brl_opt can be either empty or NULL. For more info, see 78 - * _braille_console_setup(). 79 - */ 80 - strscpy(con->name, str, namelen + 1); 81 - strscpy(con->opt, opt, CONSOLE_OPT_MAX); 82 - if (brl_opt) { 83 - strscpy(con->brl_opt, brl_opt, CONSOLE_BRL_OPT_MAX); 84 - con->has_brl_opt = 1; 85 - } 86 - 87 - return 0; 88 - } 89 - 90 - return -ENOMEM; 91 - } 92 - 93 - static struct console_option *console_opt_find(const char *name) 94 - { 95 - struct console_option *con; 96 - int i; 97 - 98 - for (i = 0; i < MAX_CMDLINECONSOLES; i++) { 99 - con = &conopt[i]; 100 - if (!strcmp(name, con->name)) 101 - return con; 102 - } 103 - 104 - return NULL; 105 - } 106 - 107 - /** 108 - * add_preferred_console_match - Adds a preferred console if a match is found 109 - * @match: Expected console on kernel command line, such as console=DEVNAME:0.0 110 - * @name: Name of the console character device to add such as ttyS 111 - * @idx: Index for the console 112 - * 113 - * Allows driver subsystems to add a console after translating the command 114 - * line name to the character device name used for the console. Options are 115 - * added automatically based on the kernel command line. Duplicate preferred 116 - * consoles are ignored by __add_preferred_console(). 117 - * 118 - * Return: 0 on success, negative error code on failure. 119 - */ 120 - int add_preferred_console_match(const char *match, const char *name, 121 - const short idx) 122 - { 123 - struct console_option *con; 124 - char *brl_opt = NULL; 125 - 126 - if (!match || !strlen(match) || !name || !strlen(name) || 127 - idx < 0) 128 - return -EINVAL; 129 - 130 - con = console_opt_find(match); 131 - if (!con) 132 - return -ENOENT; 133 - 134 - /* 135 - * See __add_preferred_console(). It checks for NULL brl_options to set 136 - * the preferred_console flag. Empty brl_opt instead of NULL leads into 137 - * the preferred_console flag not set, and CON_CONSDEV not being set, 138 - * and the boot console won't get disabled at the end of console_setup(). 139 - */ 140 - if (con->has_brl_opt) 141 - brl_opt = con->brl_opt; 142 - 143 - console_opt_add_preferred_console(name, idx, con->opt, brl_opt); 144 - 145 - return 0; 146 - }
-6
kernel/printk/console_cmdline.h
··· 2 2 #ifndef _CONSOLE_CMDLINE_H 3 3 #define _CONSOLE_CMDLINE_H 4 4 5 - #define MAX_CMDLINECONSOLES 8 6 - 7 - int console_opt_save(const char *str, const char *brl_opt); 8 - int console_opt_add_preferred_console(const char *name, const short idx, 9 - char *options, char *brl_options); 10 - 11 5 struct console_cmdline 12 6 { 13 7 char name[16]; /* Name of the driver */
+4 -19
kernel/printk/printk.c
··· 383 383 /* 384 384 * Array of consoles built from command line options (console=) 385 385 */ 386 + 387 + #define MAX_CMDLINECONSOLES 8 388 + 386 389 static struct console_cmdline console_cmdline[MAX_CMDLINECONSOLES]; 387 390 388 391 static int preferred_console = -1; ··· 2503 2500 if (_braille_console_setup(&str, &brl_options)) 2504 2501 return 1; 2505 2502 2506 - /* Save the console for driver subsystem use */ 2507 - if (console_opt_save(str, brl_options)) 2508 - return 1; 2509 - 2510 - /* Flag register_console() to not call try_enable_default_console() */ 2511 - console_set_on_cmdline = 1; 2512 - 2513 - /* Don't attempt to parse a DEVNAME:0.0 style console */ 2514 - if (strchr(str, ':')) 2515 - return 1; 2516 - 2517 2503 /* 2518 2504 * Decode str into name, index, options. 2519 2505 */ ··· 2532 2540 return 1; 2533 2541 } 2534 2542 __setup("console=", console_setup); 2535 - 2536 - /* Only called from add_preferred_console_match() */ 2537 - int console_opt_add_preferred_console(const char *name, const short idx, 2538 - char *options, char *brl_options) 2539 - { 2540 - return __add_preferred_console(name, idx, options, brl_options, true); 2541 - } 2542 2543 2543 2544 /** 2544 2545 * add_preferred_console - add a device to the list of preferred consoles. ··· 3507 3522 * Note that a console with tty binding will have CON_CONSDEV 3508 3523 * flag set and will be first in the list. 3509 3524 */ 3510 - if (preferred_console < 0 && !console_set_on_cmdline) { 3525 + if (preferred_console < 0) { 3511 3526 if (hlist_empty(&console_list) || !console_first()->device || 3512 3527 console_first()->flags & CON_BOOT) { 3513 3528 try_enable_default_console(newcon);
+1 -1
kernel/sys_ni.c
··· 46 46 COND_SYSCALL(io_getevents); 47 47 COND_SYSCALL(io_pgetevents_time32); 48 48 COND_SYSCALL(io_pgetevents); 49 - COND_SYSCALL_COMPAT(io_pgetevents_time32); 50 49 COND_SYSCALL_COMPAT(io_pgetevents); 50 + COND_SYSCALL_COMPAT(io_pgetevents_time64); 51 51 COND_SYSCALL(io_uring_setup); 52 52 COND_SYSCALL(io_uring_enter); 53 53 COND_SYSCALL(io_uring_register);
+2
kernel/time/hrtimer.c
··· 1285 1285 struct hrtimer_clock_base *base; 1286 1286 unsigned long flags; 1287 1287 1288 + if (WARN_ON_ONCE(!timer->function)) 1289 + return; 1288 1290 /* 1289 1291 * Check whether the HRTIMER_MODE_SOFT bit and hrtimer.is_soft 1290 1292 * match on CONFIG_PREEMPT_RT = n. With PREEMPT_RT check the hard
+5 -8
kernel/trace/ftrace.c
··· 6969 6969 return mod_map; 6970 6970 } 6971 6971 6972 - static const char * 6972 + static int 6973 6973 ftrace_func_address_lookup(struct ftrace_mod_map *mod_map, 6974 6974 unsigned long addr, unsigned long *size, 6975 6975 unsigned long *off, char *sym) ··· 6990 6990 *size = found_func->size; 6991 6991 if (off) 6992 6992 *off = addr - found_func->ip; 6993 - if (sym) 6994 - strscpy(sym, found_func->name, KSYM_NAME_LEN); 6995 - 6996 - return found_func->name; 6993 + return strscpy(sym, found_func->name, KSYM_NAME_LEN); 6997 6994 } 6998 6995 6999 - return NULL; 6996 + return 0; 7000 6997 } 7001 6998 7002 - const char * 6999 + int 7003 7000 ftrace_mod_address_lookup(unsigned long addr, unsigned long *size, 7004 7001 unsigned long *off, char **modname, char *sym) 7005 7002 { 7006 7003 struct ftrace_mod_map *mod_map; 7007 - const char *ret = NULL; 7004 + int ret = 0; 7008 7005 7009 7006 /* mod_map is freed via call_rcu() */ 7010 7007 preempt_disable();
+46 -6
lib/closure.c
··· 13 13 #include <linux/seq_file.h> 14 14 #include <linux/sched/debug.h> 15 15 16 - static inline void closure_put_after_sub(struct closure *cl, int flags) 16 + static inline void closure_put_after_sub_checks(int flags) 17 17 { 18 18 int r = flags & CLOSURE_REMAINING_MASK; 19 19 ··· 22 22 flags & CLOSURE_GUARD_MASK, (unsigned) __fls(r))) 23 23 r &= ~CLOSURE_GUARD_MASK; 24 24 25 - if (!r) { 26 - smp_acquire__after_ctrl_dep(); 25 + WARN(!r && (flags & ~CLOSURE_DESTRUCTOR), 26 + "closure ref hit 0 with incorrect flags set: %x (%u)", 27 + flags & ~CLOSURE_DESTRUCTOR, (unsigned) __fls(flags)); 28 + } 27 29 28 - WARN(flags & ~CLOSURE_DESTRUCTOR, 29 - "closure ref hit 0 with incorrect flags set: %x (%u)", 30 - flags & ~CLOSURE_DESTRUCTOR, (unsigned) __fls(flags)); 30 + static inline void closure_put_after_sub(struct closure *cl, int flags) 31 + { 32 + closure_put_after_sub_checks(flags); 33 + 34 + if (!(flags & CLOSURE_REMAINING_MASK)) { 35 + smp_acquire__after_ctrl_dep(); 31 36 32 37 cl->closure_get_happened = false; 33 38 ··· 149 144 __set_current_state(TASK_RUNNING); 150 145 } 151 146 EXPORT_SYMBOL(__closure_sync); 147 + 148 + /* 149 + * closure_return_sync - finish running a closure, synchronously (i.e. waiting 150 + * for outstanding get()s to finish) and returning once closure refcount is 0. 151 + * 152 + * Unlike closure_sync() this doesn't reinit the ref to 1; subsequent 153 + * closure_get_not_zero() calls waill fail. 154 + */ 155 + void __sched closure_return_sync(struct closure *cl) 156 + { 157 + struct closure_syncer s = { .task = current }; 158 + 159 + cl->s = &s; 160 + set_closure_fn(cl, closure_sync_fn, NULL); 161 + 162 + unsigned flags = atomic_sub_return_release(1 + CLOSURE_RUNNING - CLOSURE_DESTRUCTOR, 163 + &cl->remaining); 164 + 165 + closure_put_after_sub_checks(flags); 166 + 167 + if (unlikely(flags & CLOSURE_REMAINING_MASK)) { 168 + while (1) { 169 + set_current_state(TASK_UNINTERRUPTIBLE); 170 + if (s.done) 171 + break; 172 + schedule(); 173 + } 174 + 175 + __set_current_state(TASK_RUNNING); 176 + } 177 + 178 + if (cl->parent) 179 + closure_put(cl->parent); 180 + } 181 + EXPORT_SYMBOL(closure_return_sync); 152 182 153 183 int __sched __closure_sync_timeout(struct closure *cl, unsigned long timeout) 154 184 {
+1
lib/string_helpers_kunit.c
··· 625 625 626 626 kunit_test_suites(&string_helpers_test_suite); 627 627 628 + MODULE_DESCRIPTION("Test cases for string helpers module"); 628 629 MODULE_LICENSE("Dual BSD/GPL");
+1
lib/string_kunit.c
··· 633 633 634 634 kunit_test_suites(&string_test_suite); 635 635 636 + MODULE_DESCRIPTION("Test cases for string functions"); 636 637 MODULE_LICENSE("GPL v2");
+27 -5
mm/page-writeback.c
··· 415 415 else 416 416 bg_thresh = (bg_ratio * available_memory) / PAGE_SIZE; 417 417 418 - if (bg_thresh >= thresh) 419 - bg_thresh = thresh / 2; 420 418 tsk = current; 421 419 if (rt_task(tsk)) { 422 420 bg_thresh += bg_thresh / 4 + global_wb_domain.dirty_limit / 32; 423 421 thresh += thresh / 4 + global_wb_domain.dirty_limit / 32; 424 422 } 423 + /* 424 + * Dirty throttling logic assumes the limits in page units fit into 425 + * 32-bits. This gives 16TB dirty limits max which is hopefully enough. 426 + */ 427 + if (thresh > UINT_MAX) 428 + thresh = UINT_MAX; 429 + /* This makes sure bg_thresh is within 32-bits as well */ 430 + if (bg_thresh >= thresh) 431 + bg_thresh = thresh / 2; 425 432 dtc->thresh = thresh; 426 433 dtc->bg_thresh = bg_thresh; 427 434 ··· 478 471 if (rt_task(tsk)) 479 472 dirty += dirty / 4; 480 473 481 - return dirty; 474 + /* 475 + * Dirty throttling logic assumes the limits in page units fit into 476 + * 32-bits. This gives 16TB dirty limits max which is hopefully enough. 477 + */ 478 + return min_t(unsigned long, dirty, UINT_MAX); 482 479 } 483 480 484 481 /** ··· 519 508 void *buffer, size_t *lenp, loff_t *ppos) 520 509 { 521 510 int ret; 511 + unsigned long old_bytes = dirty_background_bytes; 522 512 523 513 ret = proc_doulongvec_minmax(table, write, buffer, lenp, ppos); 524 - if (ret == 0 && write) 514 + if (ret == 0 && write) { 515 + if (DIV_ROUND_UP(dirty_background_bytes, PAGE_SIZE) > 516 + UINT_MAX) { 517 + dirty_background_bytes = old_bytes; 518 + return -ERANGE; 519 + } 525 520 dirty_background_ratio = 0; 521 + } 526 522 return ret; 527 523 } 528 524 ··· 555 537 556 538 ret = proc_doulongvec_minmax(table, write, buffer, lenp, ppos); 557 539 if (ret == 0 && write && vm_dirty_bytes != old_bytes) { 540 + if (DIV_ROUND_UP(vm_dirty_bytes, PAGE_SIZE) > UINT_MAX) { 541 + vm_dirty_bytes = old_bytes; 542 + return -ERANGE; 543 + } 558 544 writeback_set_ratelimit(); 559 545 vm_dirty_ratio = 0; 560 546 } ··· 1682 1660 */ 1683 1661 dtc->wb_thresh = __wb_calc_thresh(dtc, dtc->thresh); 1684 1662 dtc->wb_bg_thresh = dtc->thresh ? 1685 - div64_u64(dtc->wb_thresh * dtc->bg_thresh, dtc->thresh) : 0; 1663 + div_u64((u64)dtc->wb_thresh * dtc->bg_thresh, dtc->thresh) : 0; 1686 1664 1687 1665 /* 1688 1666 * In order to avoid the stacked BDI deadlock we need
+12 -3
net/bluetooth/hci_conn.c
··· 899 899 U16_MAX, GFP_ATOMIC); 900 900 } 901 901 902 - struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst, 903 - u8 role, u16 handle) 902 + static struct hci_conn *__hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst, 903 + u8 role, u16 handle) 904 904 { 905 905 struct hci_conn *conn; 906 906 ··· 1041 1041 if (unlikely(handle < 0)) 1042 1042 return ERR_PTR(-ECONNREFUSED); 1043 1043 1044 - return hci_conn_add(hdev, type, dst, role, handle); 1044 + return __hci_conn_add(hdev, type, dst, role, handle); 1045 + } 1046 + 1047 + struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst, 1048 + u8 role, u16 handle) 1049 + { 1050 + if (handle > HCI_CONN_HANDLE_MAX) 1051 + return ERR_PTR(-EINVAL); 1052 + 1053 + return __hci_conn_add(hdev, type, dst, role, handle); 1045 1054 } 1046 1055 1047 1056 static void hci_conn_cleanup_child(struct hci_conn *conn, u8 reason)
+22 -54
net/bluetooth/hci_core.c
··· 63 63 /* HCI ID Numbering */ 64 64 static DEFINE_IDA(hci_index_ida); 65 65 66 - static int hci_scan_req(struct hci_request *req, unsigned long opt) 67 - { 68 - __u8 scan = opt; 69 - 70 - BT_DBG("%s %x", req->hdev->name, scan); 71 - 72 - /* Inquiry and Page scans */ 73 - hci_req_add(req, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan); 74 - return 0; 75 - } 76 - 77 - static int hci_auth_req(struct hci_request *req, unsigned long opt) 78 - { 79 - __u8 auth = opt; 80 - 81 - BT_DBG("%s %x", req->hdev->name, auth); 82 - 83 - /* Authentication */ 84 - hci_req_add(req, HCI_OP_WRITE_AUTH_ENABLE, 1, &auth); 85 - return 0; 86 - } 87 - 88 - static int hci_encrypt_req(struct hci_request *req, unsigned long opt) 89 - { 90 - __u8 encrypt = opt; 91 - 92 - BT_DBG("%s %x", req->hdev->name, encrypt); 93 - 94 - /* Encryption */ 95 - hci_req_add(req, HCI_OP_WRITE_ENCRYPT_MODE, 1, &encrypt); 96 - return 0; 97 - } 98 - 99 - static int hci_linkpol_req(struct hci_request *req, unsigned long opt) 100 - { 101 - __le16 policy = cpu_to_le16(opt); 102 - 103 - BT_DBG("%s %x", req->hdev->name, policy); 104 - 105 - /* Default link policy */ 106 - hci_req_add(req, HCI_OP_WRITE_DEF_LINK_POLICY, 2, &policy); 107 - return 0; 108 - } 109 - 110 66 /* Get HCI device by index. 111 67 * Device is held on return. */ 112 68 struct hci_dev *hci_dev_get(int index) ··· 691 735 { 692 736 struct hci_dev *hdev; 693 737 struct hci_dev_req dr; 738 + __le16 policy; 694 739 int err = 0; 695 740 696 741 if (copy_from_user(&dr, arg, sizeof(dr))) ··· 718 761 719 762 switch (cmd) { 720 763 case HCISETAUTH: 721 - err = hci_req_sync(hdev, hci_auth_req, dr.dev_opt, 722 - HCI_INIT_TIMEOUT, NULL); 764 + err = __hci_cmd_sync_status(hdev, HCI_OP_WRITE_AUTH_ENABLE, 765 + 1, &dr.dev_opt, HCI_CMD_TIMEOUT); 723 766 break; 724 767 725 768 case HCISETENCRYPT: ··· 730 773 731 774 if (!test_bit(HCI_AUTH, &hdev->flags)) { 732 775 /* Auth must be enabled first */ 733 - err = hci_req_sync(hdev, hci_auth_req, dr.dev_opt, 734 - HCI_INIT_TIMEOUT, NULL); 776 + err = __hci_cmd_sync_status(hdev, 777 + HCI_OP_WRITE_AUTH_ENABLE, 778 + 1, &dr.dev_opt, 779 + HCI_CMD_TIMEOUT); 735 780 if (err) 736 781 break; 737 782 } 738 783 739 - err = hci_req_sync(hdev, hci_encrypt_req, dr.dev_opt, 740 - HCI_INIT_TIMEOUT, NULL); 784 + err = __hci_cmd_sync_status(hdev, HCI_OP_WRITE_ENCRYPT_MODE, 785 + 1, &dr.dev_opt, 786 + HCI_CMD_TIMEOUT); 741 787 break; 742 788 743 789 case HCISETSCAN: 744 - err = hci_req_sync(hdev, hci_scan_req, dr.dev_opt, 745 - HCI_INIT_TIMEOUT, NULL); 790 + err = __hci_cmd_sync_status(hdev, HCI_OP_WRITE_SCAN_ENABLE, 791 + 1, &dr.dev_opt, 792 + HCI_CMD_TIMEOUT); 746 793 747 794 /* Ensure that the connectable and discoverable states 748 795 * get correctly modified as this was a non-mgmt change. ··· 756 795 break; 757 796 758 797 case HCISETLINKPOL: 759 - err = hci_req_sync(hdev, hci_linkpol_req, dr.dev_opt, 760 - HCI_INIT_TIMEOUT, NULL); 798 + policy = cpu_to_le16(dr.dev_opt); 799 + 800 + err = __hci_cmd_sync_status(hdev, HCI_OP_WRITE_DEF_LINK_POLICY, 801 + 2, &policy, 802 + HCI_CMD_TIMEOUT); 761 803 break; 762 804 763 805 case HCISETLINKMODE: ··· 2715 2751 list_del(&hdev->list); 2716 2752 write_unlock(&hci_dev_list_lock); 2717 2753 2754 + cancel_work_sync(&hdev->rx_work); 2755 + cancel_work_sync(&hdev->cmd_work); 2756 + cancel_work_sync(&hdev->tx_work); 2718 2757 cancel_work_sync(&hdev->power_on); 2758 + cancel_work_sync(&hdev->error_reset); 2719 2759 2720 2760 hci_cmd_sync_clear(hdev); 2721 2761
+30 -3
net/bluetooth/hci_event.c
··· 6311 6311 6312 6312 evt_type = __le16_to_cpu(info->type) & LE_EXT_ADV_EVT_TYPE_MASK; 6313 6313 legacy_evt_type = ext_evt_type_to_legacy(hdev, evt_type); 6314 + 6315 + if (test_bit(HCI_QUIRK_FIXUP_LE_EXT_ADV_REPORT_PHY, 6316 + &hdev->quirks)) { 6317 + info->primary_phy &= 0x1f; 6318 + info->secondary_phy &= 0x1f; 6319 + } 6320 + 6314 6321 if (legacy_evt_type != LE_ADV_INVALID) { 6315 6322 process_adv_report(hdev, legacy_evt_type, &info->bdaddr, 6316 6323 info->bdaddr_type, NULL, 0, ··· 6667 6660 struct bt_iso_qos *qos; 6668 6661 bool pending = false; 6669 6662 u16 handle = __le16_to_cpu(ev->handle); 6663 + u32 c_sdu_interval, p_sdu_interval; 6670 6664 6671 6665 bt_dev_dbg(hdev, "status 0x%2.2x", ev->status); 6672 6666 ··· 6692 6684 6693 6685 pending = test_and_clear_bit(HCI_CONN_CREATE_CIS, &conn->flags); 6694 6686 6695 - /* Convert ISO Interval (1.25 ms slots) to SDU Interval (us) */ 6696 - qos->ucast.in.interval = le16_to_cpu(ev->interval) * 1250; 6697 - qos->ucast.out.interval = qos->ucast.in.interval; 6687 + /* BLUETOOTH CORE SPECIFICATION Version 5.4 | Vol 6, Part G 6688 + * page 3075: 6689 + * Transport_Latency_C_To_P = CIG_Sync_Delay + (FT_C_To_P) × 6690 + * ISO_Interval + SDU_Interval_C_To_P 6691 + * ... 6692 + * SDU_Interval = (CIG_Sync_Delay + (FT) x ISO_Interval) - 6693 + * Transport_Latency 6694 + */ 6695 + c_sdu_interval = (get_unaligned_le24(ev->cig_sync_delay) + 6696 + (ev->c_ft * le16_to_cpu(ev->interval) * 1250)) - 6697 + get_unaligned_le24(ev->c_latency); 6698 + p_sdu_interval = (get_unaligned_le24(ev->cig_sync_delay) + 6699 + (ev->p_ft * le16_to_cpu(ev->interval) * 1250)) - 6700 + get_unaligned_le24(ev->p_latency); 6698 6701 6699 6702 switch (conn->role) { 6700 6703 case HCI_ROLE_SLAVE: 6704 + qos->ucast.in.interval = c_sdu_interval; 6705 + qos->ucast.out.interval = p_sdu_interval; 6701 6706 /* Convert Transport Latency (us) to Latency (msec) */ 6702 6707 qos->ucast.in.latency = 6703 6708 DIV_ROUND_CLOSEST(get_unaligned_le24(ev->c_latency), ··· 6724 6703 qos->ucast.out.phy = ev->p_phy; 6725 6704 break; 6726 6705 case HCI_ROLE_MASTER: 6706 + qos->ucast.in.interval = p_sdu_interval; 6707 + qos->ucast.out.interval = c_sdu_interval; 6727 6708 /* Convert Transport Latency (us) to Latency (msec) */ 6728 6709 qos->ucast.out.latency = 6729 6710 DIV_ROUND_CLOSEST(get_unaligned_le24(ev->c_latency), ··· 6916 6893 6917 6894 bis = hci_conn_hash_lookup_handle(hdev, handle); 6918 6895 if (!bis) { 6896 + if (handle > HCI_CONN_HANDLE_MAX) { 6897 + bt_dev_dbg(hdev, "ignore too large handle %u", handle); 6898 + continue; 6899 + } 6919 6900 bis = hci_conn_add(hdev, ISO_LINK, BDADDR_ANY, 6920 6901 HCI_ROLE_SLAVE, handle); 6921 6902 if (IS_ERR(bis))
+13
net/bluetooth/hci_sync.c
··· 280 280 } 281 281 EXPORT_SYMBOL(__hci_cmd_sync_status); 282 282 283 + int hci_cmd_sync_status(struct hci_dev *hdev, u16 opcode, u32 plen, 284 + const void *param, u32 timeout) 285 + { 286 + int err; 287 + 288 + hci_req_sync_lock(hdev); 289 + err = __hci_cmd_sync_status(hdev, opcode, plen, param, timeout); 290 + hci_req_sync_unlock(hdev); 291 + 292 + return err; 293 + } 294 + EXPORT_SYMBOL(hci_cmd_sync_status); 295 + 283 296 static void hci_cmd_sync_work(struct work_struct *work) 284 297 { 285 298 struct hci_dev *hdev = container_of(work, struct hci_dev, cmd_sync_work);
+1 -2
net/bluetooth/iso.c
··· 1356 1356 lock_sock(sk); 1357 1357 switch (sk->sk_state) { 1358 1358 case BT_CONNECT2: 1359 - if (pi->conn->hcon && 1360 - test_bit(HCI_CONN_PA_SYNC, &pi->conn->hcon->flags)) { 1359 + if (test_bit(BT_SK_PA_SYNC, &pi->flags)) { 1361 1360 iso_conn_big_sync(sk); 1362 1361 sk->sk_state = BT_LISTEN; 1363 1362 } else {
+3
net/bluetooth/l2cap_core.c
··· 6761 6761 6762 6762 BT_DBG("chan %p, len %d", chan, skb->len); 6763 6763 6764 + l2cap_chan_lock(chan); 6765 + 6764 6766 if (chan->state != BT_BOUND && chan->state != BT_CONNECTED) 6765 6767 goto drop; 6766 6768 ··· 6779 6777 } 6780 6778 6781 6779 drop: 6780 + l2cap_chan_unlock(chan); 6782 6781 l2cap_chan_put(chan); 6783 6782 free_skb: 6784 6783 kfree_skb(skb);
+11 -3
net/bluetooth/l2cap_sock.c
··· 1239 1239 1240 1240 BT_DBG("sk %p state %s", sk, state_to_string(sk->sk_state)); 1241 1241 1242 + /* Sock is dead, so set chan data to NULL, avoid other task use invalid 1243 + * sock pointer. 1244 + */ 1245 + l2cap_pi(sk)->chan->data = NULL; 1242 1246 /* Kill poor orphan */ 1243 1247 1244 1248 l2cap_chan_put(l2cap_pi(sk)->chan); ··· 1485 1481 1486 1482 static int l2cap_sock_recv_cb(struct l2cap_chan *chan, struct sk_buff *skb) 1487 1483 { 1488 - struct sock *sk = chan->data; 1489 - struct l2cap_pinfo *pi = l2cap_pi(sk); 1484 + struct sock *sk; 1485 + struct l2cap_pinfo *pi; 1490 1486 int err; 1491 1487 1492 - lock_sock(sk); 1488 + sk = chan->data; 1489 + if (!sk) 1490 + return -ENXIO; 1493 1491 1492 + pi = l2cap_pi(sk); 1493 + lock_sock(sk); 1494 1494 if (chan->mode == L2CAP_MODE_ERTM && !list_empty(&pi->rx_busy)) { 1495 1495 err = -ENOMEM; 1496 1496 goto done;
+13 -6
net/core/datagram.c
··· 416 416 417 417 end = start + skb_frag_size(frag); 418 418 if ((copy = end - offset) > 0) { 419 - struct page *page = skb_frag_page(frag); 420 - u8 *vaddr = kmap(page); 419 + u32 p_off, p_len, copied; 420 + struct page *p; 421 + u8 *vaddr; 421 422 422 423 if (copy > len) 423 424 copy = len; 424 - n = INDIRECT_CALL_1(cb, simple_copy_to_iter, 425 - vaddr + skb_frag_off(frag) + offset - start, 426 - copy, data, to); 427 - kunmap(page); 425 + 426 + skb_frag_foreach_page(frag, 427 + skb_frag_off(frag) + offset - start, 428 + copy, p, p_off, p_len, copied) { 429 + vaddr = kmap_local_page(p); 430 + n = INDIRECT_CALL_1(cb, simple_copy_to_iter, 431 + vaddr + p_off, p_len, data, to); 432 + kunmap_local(vaddr); 433 + } 434 + 428 435 offset += n; 429 436 if (n != copy) 430 437 goto short_copy;
+2
net/ipv4/inet_diag.c
··· 1383 1383 req.sdiag_family = AF_UNSPEC; /* compatibility */ 1384 1384 req.sdiag_protocol = inet_diag_type2proto(cb->nlh->nlmsg_type); 1385 1385 req.idiag_ext = rc->idiag_ext; 1386 + req.pad = 0; 1386 1387 req.idiag_states = rc->idiag_states; 1387 1388 req.id = rc->id; 1388 1389 ··· 1399 1398 req.sdiag_family = rc->idiag_family; 1400 1399 req.sdiag_protocol = inet_diag_type2proto(nlh->nlmsg_type); 1401 1400 req.idiag_ext = rc->idiag_ext; 1401 + req.pad = 0; 1402 1402 req.idiag_states = rc->idiag_states; 1403 1403 req.id = rc->id; 1404 1404
+8 -1
net/ipv4/tcp_input.c
··· 3077 3077 return; 3078 3078 3079 3079 if (tcp_try_undo_dsack(sk)) 3080 - tcp_try_keep_open(sk); 3080 + tcp_try_to_open(sk, flag); 3081 3081 3082 3082 tcp_identify_packet_loss(sk, ack_flag); 3083 3083 if (icsk->icsk_ca_state != TCP_CA_Recovery) { ··· 4225 4225 case TCPOPT_MD5SIG: 4226 4226 /* The MD5 Hash has already been 4227 4227 * checked (see tcp_v{4,6}_rcv()). 4228 + */ 4229 + break; 4230 + #endif 4231 + #ifdef CONFIG_TCP_AO 4232 + case TCPOPT_AO: 4233 + /* TCP AO has already been checked 4234 + * (see tcp_inbound_ao_hash()). 4228 4235 */ 4229 4236 break; 4230 4237 #endif
+1
net/ipv4/tcp_metrics.c
··· 619 619 [TCP_METRICS_ATTR_ADDR_IPV4] = { .type = NLA_U32, }, 620 620 [TCP_METRICS_ATTR_ADDR_IPV6] = { .type = NLA_BINARY, 621 621 .len = sizeof(struct in6_addr), }, 622 + [TCP_METRICS_ATTR_SADDR_IPV4] = { .type = NLA_U32, }, 622 623 /* Following attributes are not received for GET/DEL, 623 624 * we keep them for reference 624 625 */
+8 -6
net/mac802154/main.c
··· 161 161 } 162 162 163 163 phy->symbol_duration = duration; 164 - phy->lifs_period = (IEEE802154_LIFS_PERIOD * phy->symbol_duration) / NSEC_PER_SEC; 165 - phy->sifs_period = (IEEE802154_SIFS_PERIOD * phy->symbol_duration) / NSEC_PER_SEC; 164 + phy->lifs_period = 165 + (IEEE802154_LIFS_PERIOD * phy->symbol_duration) / NSEC_PER_USEC; 166 + phy->sifs_period = 167 + (IEEE802154_SIFS_PERIOD * phy->symbol_duration) / NSEC_PER_USEC; 166 168 } 167 169 EXPORT_SYMBOL(ieee802154_configure_durations); 168 170 ··· 186 184 * Should be done when all drivers sets this value. 187 185 */ 188 186 189 - wpan_phy->lifs_period = 190 - (IEEE802154_LIFS_PERIOD * wpan_phy->symbol_duration) / 1000; 191 - wpan_phy->sifs_period = 192 - (IEEE802154_SIFS_PERIOD * wpan_phy->symbol_duration) / 1000; 187 + wpan_phy->lifs_period = (IEEE802154_LIFS_PERIOD * 188 + wpan_phy->symbol_duration) / NSEC_PER_USEC; 189 + wpan_phy->sifs_period = (IEEE802154_SIFS_PERIOD * 190 + wpan_phy->symbol_duration) / NSEC_PER_USEC; 193 191 } 194 192 195 193 int ieee802154_register_hw(struct ieee802154_hw *hw)
+4 -4
net/mac802154/tx.c
··· 34 34 if (res) 35 35 goto err_tx; 36 36 37 - dev->stats.tx_packets++; 38 - dev->stats.tx_bytes += skb->len; 37 + DEV_STATS_INC(dev, tx_packets); 38 + DEV_STATS_ADD(dev, tx_bytes, skb->len); 39 39 40 40 ieee802154_xmit_complete(&local->hw, skb, false); 41 41 ··· 90 90 if (ret) 91 91 goto err_wake_netif_queue; 92 92 93 - dev->stats.tx_packets++; 94 - dev->stats.tx_bytes += len; 93 + DEV_STATS_INC(dev, tx_packets); 94 + DEV_STATS_ADD(dev, tx_bytes, len); 95 95 } else { 96 96 local->tx_skb = skb; 97 97 queue_work(local->workqueue, &local->sync_tx_work);
+1 -2
net/netfilter/nf_tables_api.c
··· 11552 11552 11553 11553 gc_seq = nft_gc_seq_begin(nft_net); 11554 11554 11555 - if (!list_empty(&nf_tables_destroy_list)) 11556 - nf_tables_trans_destroy_flush_work(); 11555 + nf_tables_trans_destroy_flush_work(); 11557 11556 again: 11558 11557 list_for_each_entry(table, &nft_net->tables, list) { 11559 11558 if (nft_table_has_owner(table) &&
+4 -1
net/sunrpc/svc.c
··· 1557 1557 */ 1558 1558 void svc_process_bc(struct rpc_rqst *req, struct svc_rqst *rqstp) 1559 1559 { 1560 + struct rpc_timeout timeout = { 1561 + .to_increment = 0, 1562 + }; 1560 1563 struct rpc_task *task; 1561 1564 int proc_error; 1562 - struct rpc_timeout timeout; 1563 1565 1564 1566 /* Build the svc_rqst used by the common processing routine */ 1565 1567 rqstp->rq_xid = req->rq_xid; ··· 1614 1612 timeout.to_initval = req->rq_xprt->timeout->to_initval; 1615 1613 timeout.to_retries = req->rq_xprt->timeout->to_retries; 1616 1614 } 1615 + timeout.to_maxval = timeout.to_initval; 1617 1616 memcpy(&req->rq_snd_buf, &rqstp->rq_res, sizeof(req->rq_snd_buf)); 1618 1617 task = rpc_run_bc_task(req, &timeout); 1619 1618
+3 -5
net/sunrpc/svc_xprt.c
··· 1421 1421 1422 1422 dprintk("svc_pool_stats_start, *pidx=%u\n", pidx); 1423 1423 1424 - if (!si->serv) 1425 - return NULL; 1426 - 1427 1424 mutex_lock(si->mutex); 1428 1425 1429 1426 if (!pidx) 1430 1427 return SEQ_START_TOKEN; 1428 + if (!si->serv) 1429 + return NULL; 1431 1430 return pidx > si->serv->sv_nrpools ? NULL 1432 1431 : &si->serv->sv_pools[pidx - 1]; 1433 1432 } ··· 1458 1459 { 1459 1460 struct svc_info *si = m->private; 1460 1461 1461 - if (si->serv) 1462 - mutex_unlock(si->mutex); 1462 + mutex_unlock(si->mutex); 1463 1463 } 1464 1464 1465 1465 static int svc_pool_stats_show(struct seq_file *m, void *p)
+5 -4
net/unix/garbage.c
··· 470 470 } 471 471 472 472 if (vertex->index == vertex->scc_index) { 473 + struct unix_vertex *v; 473 474 struct list_head scc; 474 475 bool scc_dead = true; 475 476 ··· 481 480 */ 482 481 __list_cut_position(&scc, &vertex_stack, &vertex->scc_entry); 483 482 484 - list_for_each_entry_reverse(vertex, &scc, scc_entry) { 483 + list_for_each_entry_reverse(v, &scc, scc_entry) { 485 484 /* Don't restart DFS from this vertex in unix_walk_scc(). */ 486 - list_move_tail(&vertex->entry, &unix_visited_vertices); 485 + list_move_tail(&v->entry, &unix_visited_vertices); 487 486 488 487 /* Mark vertex as off-stack. */ 489 - vertex->index = unix_vertex_grouped_index; 488 + v->index = unix_vertex_grouped_index; 490 489 491 490 if (scc_dead) 492 - scc_dead = unix_vertex_dead(vertex); 491 + scc_dead = unix_vertex_dead(v); 493 492 } 494 493 495 494 if (scc_dead)
+1 -1
scripts/Makefile.dtbinst
··· 17 17 dst := $(INSTALL_DTBS_PATH) 18 18 19 19 quiet_cmd_dtb_install = INSTALL $@ 20 - cmd_dtb_install = install -D $< $@ 20 + cmd_dtb_install = install -D -m 0644 $< $@ 21 21 22 22 $(dst)/%: $(obj)/% 23 23 $(call cmd,dtb_install)
+1 -1
scripts/Makefile.host
··· 146 146 # Create .o file from a single .cc (C++) file 147 147 quiet_cmd_host-cxxobjs = HOSTCXX $@ 148 148 cmd_host-cxxobjs = $(HOSTCXX) $(hostcxx_flags) -c -o $@ $< 149 - $(host-cxxobjs): $(obj)/%.o: $(src)/%.cc FORCE 149 + $(host-cxxobjs): $(obj)/%.o: $(obj)/%.cc FORCE 150 150 $(call if_changed_dep,host-cxxobjs) 151 151 152 152 # Create executable from a single Rust crate (which may consist of
+1 -1
scripts/Makefile.package
··· 103 103 debian-orig: private orig-name = $(source)_$(version).orig.tar$(debian-orig-suffix) 104 104 debian-orig: mkdebian-opts = --need-source 105 105 debian-orig: linux.tar$(debian-orig-suffix) debian 106 - $(Q)if [ "$(df --output=target .. 2>/dev/null)" = "$(df --output=target $< 2>/dev/null)" ]; then \ 106 + $(Q)if [ "$$(df --output=target .. 2>/dev/null)" = "$$(df --output=target $< 2>/dev/null)" ]; then \ 107 107 ln -f $< ../$(orig-name); \ 108 108 else \ 109 109 cp $< ../$(orig-name); \
+1 -1
scripts/gdb/linux/Makefile
··· 5 5 symlinks := $(patsubst $(src)/%,%,$(wildcard $(src)/*.py)) 6 6 7 7 quiet_cmd_symlink = SYMLINK $@ 8 - cmd_symlink = ln -fsn $(patsubst $(obj)/%,$(src)/%,$@) $@ 8 + cmd_symlink = ln -fsn $(patsubst $(obj)/%,$(abspath $(src))/%,$@) $@ 9 9 10 10 always-y += $(symlinks) 11 11 $(addprefix $(obj)/, $(symlinks)): FORCE
+3 -5
scripts/package/kernel.spec
··· 57 57 %install 58 58 mkdir -p %{buildroot}/lib/modules/%{KERNELRELEASE} 59 59 cp $(%{make} %{makeflags} -s image_name) %{buildroot}/lib/modules/%{KERNELRELEASE}/vmlinuz 60 - %{make} %{makeflags} INSTALL_MOD_PATH=%{buildroot} modules_install 60 + # DEPMOD=true makes depmod no-op. We do not package depmod-generated files. 61 + %{make} %{makeflags} INSTALL_MOD_PATH=%{buildroot} DEPMOD=true modules_install 61 62 %{make} %{makeflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install 62 63 cp System.map %{buildroot}/lib/modules/%{KERNELRELEASE} 63 64 cp .config %{buildroot}/lib/modules/%{KERNELRELEASE}/config ··· 71 70 %endif 72 71 73 72 { 74 - for x in System.map config kernel modules.builtin \ 75 - modules.builtin.modinfo modules.order vmlinuz; do 76 - echo "/lib/modules/%{KERNELRELEASE}/${x}" 77 - done 73 + echo "/lib/modules/%{KERNELRELEASE}" 78 74 79 75 for x in alias alias.bin builtin.alias.bin builtin.bin dep dep.bin \ 80 76 devname softdep symbols symbols.bin; do
+5 -1
tools/power/x86/turbostat/Makefile
··· 14 14 override CFLAGS += -O2 -Wall -Wextra -I../../../include 15 15 override CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"' 16 16 override CFLAGS += -DINTEL_FAMILY_HEADER='"../../../../arch/x86/include/asm/intel-family.h"' 17 + override CFLAGS += -DBUILD_BUG_HEADER='"../../../../include/linux/build_bug.h"' 17 18 override CFLAGS += -D_FILE_OFFSET_BITS=64 18 19 override CFLAGS += -D_FORTIFY_SOURCE=2 19 20 ··· 45 44 @echo "#define GENMASK(h, l) (((~0UL) << (l)) & (~0UL >> (sizeof(long) * 8 - 1 - (h))))" >> $(SNAPSHOT)/bits.h 46 45 @echo "#define GENMASK_ULL(h, l) (((~0ULL) << (l)) & (~0ULL >> (sizeof(long long) * 8 - 1 - (h))))" >> $(SNAPSHOT)/bits.h 47 46 47 + @echo '#define BUILD_BUG_ON(cond) do { enum { compile_time_check ## __COUNTER__ = 1/(!(cond)) }; } while (0)' > $(SNAPSHOT)/build_bug.h 48 + 48 49 @echo PWD=. > $(SNAPSHOT)/Makefile 49 50 @echo "CFLAGS += -DMSRHEADER='\"msr-index.h\"'" >> $(SNAPSHOT)/Makefile 50 51 @echo "CFLAGS += -DINTEL_FAMILY_HEADER='\"intel-family.h\"'" >> $(SNAPSHOT)/Makefile 51 - @sed -e's/.*MSRHEADER.*//' -e's/.*INTEL_FAMILY_HEADER.*//' Makefile >> $(SNAPSHOT)/Makefile 52 + @echo "CFLAGS += -DBUILD_BUG_HEADER='\"build_bug.h\"'" >> $(SNAPSHOT)/Makefile 53 + @sed -e's/.*MSRHEADER.*//' -e's/.*INTEL_FAMILY_HEADER.*//' -e's/.*BUILD_BUG_HEADER.*//' Makefile >> $(SNAPSHOT)/Makefile 52 54 53 55 @rm -f $(SNAPSHOT).tar.gz 54 56 tar cvzf $(SNAPSHOT).tar.gz $(SNAPSHOT)
+10 -10
tools/power/x86/turbostat/turbostat.c
··· 10 10 #define _GNU_SOURCE 11 11 #include MSRHEADER 12 12 #include INTEL_FAMILY_HEADER 13 + #include BUILD_BUG_HEADER 13 14 #include <stdarg.h> 14 15 #include <stdio.h> 15 16 #include <err.h> ··· 39 38 #include <stdbool.h> 40 39 #include <assert.h> 41 40 #include <linux/kernel.h> 42 - #include <linux/build_bug.h> 43 41 44 42 #define UNUSED(x) (void)(x) 45 43 ··· 5695 5695 if (access("/sys/devices/system/cpu/intel_uncore_frequency/uncore00/current_freq_khz", R_OK)) 5696 5696 return; 5697 5697 5698 - if (quiet) 5699 - return; 5700 - 5701 5698 for (uncore_max_id = 0;; ++uncore_max_id) { 5702 5699 5703 5700 sprintf(path_base, "/sys/devices/system/cpu/intel_uncore_frequency/uncore%02d", uncore_max_id); ··· 5724 5727 sprintf(path, "%s/fabric_cluster_id", path_base); 5725 5728 cluster_id = read_sysfs_int(path); 5726 5729 5730 + sprintf(path, "%s/current_freq_khz", path_base); 5731 + sprintf(name_buf, "UMHz%d.%d", domain_id, cluster_id); 5732 + 5733 + add_counter(0, path, name_buf, 0, SCOPE_PACKAGE, COUNTER_K2M, FORMAT_AVERAGE, 0, package_id); 5734 + 5735 + if (quiet) 5736 + continue; 5737 + 5727 5738 sprintf(path, "%s/min_freq_khz", path_base); 5728 5739 k = read_sysfs_int(path); 5729 5740 sprintf(path, "%s/max_freq_khz", path_base); ··· 5748 5743 sprintf(path, "%s/current_freq_khz", path_base); 5749 5744 k = read_sysfs_int(path); 5750 5745 fprintf(outf, " %d MHz\n", k / 1000); 5751 - 5752 - sprintf(path, "%s/current_freq_khz", path_base); 5753 - sprintf(name_buf, "UMHz%d.%d", domain_id, cluster_id); 5754 - 5755 - add_counter(0, path, name_buf, 0, SCOPE_PACKAGE, COUNTER_K2M, FORMAT_AVERAGE, 0, package_id); 5756 5746 } 5757 5747 } 5758 5748 ··· 8424 8424 * Parse some options early, because they may make other options invalid, 8425 8425 * like adding the MSR counter with --add and at the same time using --no-msr. 8426 8426 */ 8427 - while ((opt = getopt_long_only(argc, argv, "MP", long_options, &option_index)) != -1) { 8427 + while ((opt = getopt_long_only(argc, argv, "MPn:", long_options, &option_index)) != -1) { 8428 8428 switch (opt) { 8429 8429 case 'M': 8430 8430 no_msr = 1;
+4
tools/testing/cxl/test/cxl.c
··· 630 630 struct cxl_endpoint_dvsec_info *info) 631 631 { 632 632 struct cxl_hdm *cxlhdm = devm_kzalloc(&port->dev, sizeof(*cxlhdm), GFP_KERNEL); 633 + struct device *dev = &port->dev; 633 634 634 635 if (!cxlhdm) 635 636 return ERR_PTR(-ENOMEM); 636 637 637 638 cxlhdm->port = port; 639 + cxlhdm->interleave_mask = ~0U; 640 + cxlhdm->iw_cap_mask = ~0UL; 641 + dev_set_drvdata(dev, cxlhdm); 638 642 return cxlhdm; 639 643 } 640 644
+24 -19
tools/testing/selftests/kselftest_harness.h
··· 66 66 #include <sys/wait.h> 67 67 #include <unistd.h> 68 68 #include <setjmp.h> 69 - #include <syscall.h> 70 - #include <linux/sched.h> 71 69 72 70 #include "kselftest.h" 73 71 ··· 79 81 #ifndef TH_LOG_ENABLED 80 82 # define TH_LOG_ENABLED 1 81 83 #endif 82 - 83 - /* Wait for the child process to end but without sharing memory mapping. */ 84 - static inline pid_t clone3_vfork(void) 85 - { 86 - struct clone_args args = { 87 - .flags = CLONE_VFORK, 88 - .exit_signal = SIGCHLD, 89 - }; 90 - 91 - return syscall(__NR_clone3, &args, sizeof(args)); 92 - } 93 84 94 85 /** 95 86 * TH_LOG() ··· 424 437 } \ 425 438 if (setjmp(_metadata->env) == 0) { \ 426 439 /* _metadata and potentially self are shared with all forks. */ \ 427 - child = clone3_vfork(); \ 440 + child = fork(); \ 428 441 if (child == 0) { \ 429 442 fixture_name##_setup(_metadata, self, variant->data); \ 430 443 /* Let setup failure terminate early. */ \ ··· 1003 1016 .sa_flags = SA_SIGINFO, 1004 1017 }; 1005 1018 struct sigaction saved_action; 1006 - int status; 1019 + /* 1020 + * Sets status so that WIFEXITED(status) returns true and 1021 + * WEXITSTATUS(status) returns KSFT_FAIL. This safe default value 1022 + * should never be evaluated because of the waitpid(2) check and 1023 + * SIGALRM handling. 1024 + */ 1025 + int status = KSFT_FAIL << 8; 1026 + int child; 1007 1027 1008 1028 if (sigaction(SIGALRM, &action, &saved_action)) { 1009 1029 t->exit_code = KSFT_FAIL; ··· 1022 1028 __active_test = t; 1023 1029 t->timed_out = false; 1024 1030 alarm(t->timeout); 1025 - waitpid(t->pid, &status, 0); 1031 + child = waitpid(t->pid, &status, 0); 1032 + if (child == -1 && errno != EINTR) { 1033 + t->exit_code = KSFT_FAIL; 1034 + fprintf(TH_LOG_STREAM, 1035 + "# %s: Failed to wait for PID %d (errno: %d)\n", 1036 + t->name, t->pid, errno); 1037 + return; 1038 + } 1039 + 1026 1040 alarm(0); 1027 1041 if (sigaction(SIGALRM, &saved_action, NULL)) { 1028 1042 t->exit_code = KSFT_FAIL; ··· 1085 1083 WTERMSIG(status)); 1086 1084 } 1087 1085 } else { 1086 + t->exit_code = KSFT_FAIL; 1088 1087 fprintf(TH_LOG_STREAM, 1089 1088 "# %s: Test ended in some other way [%u]\n", 1090 1089 t->name, ··· 1221 1218 struct __test_xfail *xfail; 1222 1219 char test_name[1024]; 1223 1220 const char *diagnostic; 1221 + int child; 1224 1222 1225 1223 /* reset test struct */ 1226 1224 t->exit_code = KSFT_PASS; ··· 1240 1236 fflush(stdout); 1241 1237 fflush(stderr); 1242 1238 1243 - t->pid = clone3_vfork(); 1244 - if (t->pid < 0) { 1239 + child = fork(); 1240 + if (child < 0) { 1245 1241 ksft_print_msg("ERROR SPAWNING TEST CHILD\n"); 1246 1242 t->exit_code = KSFT_FAIL; 1247 - } else if (t->pid == 0) { 1243 + } else if (child == 0) { 1248 1244 setpgrp(); 1249 1245 t->fn(t, variant); 1250 1246 _exit(t->exit_code); 1251 1247 } else { 1248 + t->pid = child; 1252 1249 __wait_for_test(t); 1253 1250 } 1254 1251 ksft_print_msg(" %4s %s\n",
+23 -2
tools/testing/selftests/net/af_unix/scm_rights.c
··· 14 14 15 15 FIXTURE(scm_rights) 16 16 { 17 - int fd[16]; 17 + int fd[32]; 18 18 }; 19 19 20 20 FIXTURE_VARIANT(scm_rights) 21 21 { 22 - char name[16]; 22 + char name[32]; 23 23 int type; 24 24 int flags; 25 25 bool test_listener; ··· 172 172 const FIXTURE_VARIANT(scm_rights) *variant, 173 173 int n) 174 174 { 175 + ASSERT_LE(n * 2, sizeof(self->fd) / sizeof(self->fd[0])); 176 + 175 177 if (variant->test_listener) 176 178 create_listeners(_metadata, self, n); 177 179 else ··· 283 281 send_fd(7, 6); 284 282 285 283 close_sockets(8); 284 + } 285 + 286 + TEST_F(scm_rights, backtrack_from_scc) 287 + { 288 + create_sockets(10); 289 + 290 + send_fd(0, 1); 291 + send_fd(0, 4); 292 + send_fd(1, 2); 293 + send_fd(2, 3); 294 + send_fd(3, 1); 295 + 296 + send_fd(5, 6); 297 + send_fd(5, 9); 298 + send_fd(6, 7); 299 + send_fd(7, 8); 300 + send_fd(8, 6); 301 + 302 + close_sockets(10); 286 303 } 287 304 288 305 TEST_HARNESS_MAIN
+12 -2
tools/testing/selftests/net/msg_zerocopy.c
··· 85 85 static int cfg_runtime_ms = 4200; 86 86 static int cfg_verbose; 87 87 static int cfg_waittime_ms = 500; 88 + static int cfg_notification_limit = 32; 88 89 static bool cfg_zerocopy; 89 90 90 91 static socklen_t cfg_alen; ··· 96 95 static long packets, bytes, completions, expected_completions; 97 96 static int zerocopied = -1; 98 97 static uint32_t next_completion; 98 + static uint32_t sends_since_notify; 99 99 100 100 static unsigned long gettimeofday_ms(void) 101 101 { ··· 210 208 error(1, errno, "send"); 211 209 if (cfg_verbose && ret != len) 212 210 fprintf(stderr, "send: ret=%u != %u\n", ret, len); 211 + sends_since_notify++; 213 212 214 213 if (len) { 215 214 packets++; ··· 438 435 /* Detect notification gaps. These should not happen often, if at all. 439 436 * Gaps can occur due to drops, reordering and retransmissions. 440 437 */ 441 - if (lo != next_completion) 438 + if (cfg_verbose && lo != next_completion) 442 439 fprintf(stderr, "gap: %u..%u does not append to %u\n", 443 440 lo, hi, next_completion); 444 441 next_completion = hi + 1; ··· 463 460 static void do_recv_completions(int fd, int domain) 464 461 { 465 462 while (do_recv_completion(fd, domain)) {} 463 + sends_since_notify = 0; 466 464 } 467 465 468 466 /* Wait for all remaining completions on the errqueue */ ··· 552 548 do_sendmsg_corked(fd, &msg); 553 549 else 554 550 do_sendmsg(fd, &msg, cfg_zerocopy, domain); 551 + 552 + if (cfg_zerocopy && sends_since_notify >= cfg_notification_limit) 553 + do_recv_completions(fd, domain); 555 554 556 555 while (!do_poll(fd, POLLOUT)) { 557 556 if (cfg_zerocopy) ··· 715 708 716 709 cfg_payload_len = max_payload_len; 717 710 718 - while ((c = getopt(argc, argv, "46c:C:D:i:mp:rs:S:t:vz")) != -1) { 711 + while ((c = getopt(argc, argv, "46c:C:D:i:l:mp:rs:S:t:vz")) != -1) { 719 712 switch (c) { 720 713 case '4': 721 714 if (cfg_family != PF_UNSPEC) ··· 742 735 cfg_ifindex = if_nametoindex(optarg); 743 736 if (cfg_ifindex == 0) 744 737 error(1, errno, "invalid iface: %s", optarg); 738 + break; 739 + case 'l': 740 + cfg_notification_limit = strtoul(optarg, NULL, 0); 745 741 break; 746 742 case 'm': 747 743 cfg_cork_mixed = true;
+22 -10
tools/testing/selftests/resctrl/cat_test.c
··· 291 291 return ret; 292 292 } 293 293 294 + static bool arch_supports_noncont_cat(const struct resctrl_test *test) 295 + { 296 + unsigned int eax, ebx, ecx, edx; 297 + 298 + /* AMD always supports non-contiguous CBM. */ 299 + if (get_vendor() == ARCH_AMD) 300 + return true; 301 + 302 + /* Intel support for non-contiguous CBM needs to be discovered. */ 303 + if (!strcmp(test->resource, "L3")) 304 + __cpuid_count(0x10, 1, eax, ebx, ecx, edx); 305 + else if (!strcmp(test->resource, "L2")) 306 + __cpuid_count(0x10, 2, eax, ebx, ecx, edx); 307 + else 308 + return false; 309 + 310 + return ((ecx >> 3) & 1); 311 + } 312 + 294 313 static int noncont_cat_run_test(const struct resctrl_test *test, 295 314 const struct user_params *uparams) 296 315 { 297 316 unsigned long full_cache_mask, cont_mask, noncont_mask; 298 - unsigned int eax, ebx, ecx, edx, sparse_masks; 317 + unsigned int sparse_masks; 299 318 int bit_center, ret; 300 319 char schemata[64]; 301 320 ··· 323 304 if (ret) 324 305 return ret; 325 306 326 - if (!strcmp(test->resource, "L3")) 327 - __cpuid_count(0x10, 1, eax, ebx, ecx, edx); 328 - else if (!strcmp(test->resource, "L2")) 329 - __cpuid_count(0x10, 2, eax, ebx, ecx, edx); 330 - else 331 - return -EINVAL; 332 - 333 - if (sparse_masks != ((ecx >> 3) & 1)) { 334 - ksft_print_msg("CPUID output doesn't match 'sparse_masks' file content!\n"); 307 + if (arch_supports_noncont_cat(test) != sparse_masks) { 308 + ksft_print_msg("Hardware and kernel differ on non-contiguous CBM support!\n"); 335 309 return 1; 336 310 } 337 311