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

Configure Feed

Select the types of activity you want to include in your feed.

ALSA: Various fixes for Cirrus Logic CS35L56 support

Merge series from Richard Fitzgerald <rf@opensource.cirrus.com>:

These patches fixe various things that were undocumented, unknown or
uncertain when the original driver code was written. And also a few
things that were just bugs.

+4325 -2095
+1
Documentation/ABI/testing/sysfs-platform-silicom
··· 10 10 Date: November 2023 11 11 KernelVersion: 6.7 12 12 Contact: Henry Shi <henrys@silicom-usa.com> 13 + Description: 13 14 This file allow user to power cycle the platform. 14 15 Default value is 0; when set to 1, it powers down 15 16 the platform, waits 5 seconds, then powers on the
+2 -2
Documentation/accel/introduction.rst
··· 101 101 email threads 102 102 ------------- 103 103 104 - * `Initial discussion on the New subsystem for acceleration devices <https://lkml.org/lkml/2022/7/31/83>`_ - Oded Gabbay (2022) 105 - * `patch-set to add the new subsystem <https://lkml.org/lkml/2022/10/22/544>`_ - Oded Gabbay (2022) 104 + * `Initial discussion on the New subsystem for acceleration devices <https://lore.kernel.org/lkml/CAFCwf11=9qpNAepL7NL+YAV_QO=Wv6pnWPhKHKAepK3fNn+2Dg@mail.gmail.com/>`_ - Oded Gabbay (2022) 105 + * `patch-set to add the new subsystem <https://lore.kernel.org/lkml/20221022214622.18042-1-ogabbay@kernel.org/>`_ - Oded Gabbay (2022) 106 106 107 107 Conference talks 108 108 ----------------
-5
Documentation/admin-guide/kernel-parameters.rst
··· 218 218 219 219 .. include:: kernel-parameters.txt 220 220 :literal: 221 - 222 - Todo 223 - ---- 224 - 225 - Add more DRM drivers.
+6 -10
Documentation/admin-guide/kernel-per-CPU-kthreads.rst
··· 243 243 3. Do any of the following needed to avoid jitter that your 244 244 application cannot tolerate: 245 245 246 - a. Build your kernel with CONFIG_SLUB=y rather than 247 - CONFIG_SLAB=y, thus avoiding the slab allocator's periodic 248 - use of each CPU's workqueues to run its cache_reap() 249 - function. 250 - b. Avoid using oprofile, thus avoiding OS jitter from 246 + a. Avoid using oprofile, thus avoiding OS jitter from 251 247 wq_sync_buffer(). 252 - c. Limit your CPU frequency so that a CPU-frequency 248 + b. Limit your CPU frequency so that a CPU-frequency 253 249 governor is not required, possibly enlisting the aid of 254 250 special heatsinks or other cooling technologies. If done 255 251 correctly, and if you CPU architecture permits, you should ··· 255 259 256 260 WARNING: Please check your CPU specifications to 257 261 make sure that this is safe on your particular system. 258 - d. As of v3.18, Christoph Lameter's on-demand vmstat workers 262 + c. As of v3.18, Christoph Lameter's on-demand vmstat workers 259 263 commit prevents OS jitter due to vmstat_update() on 260 264 CONFIG_SMP=y systems. Before v3.18, is not possible 261 265 to entirely get rid of the OS jitter, but you can ··· 270 274 (based on an earlier one from Gilad Ben-Yossef) that 271 275 reduces or even eliminates vmstat overhead for some 272 276 workloads at https://lore.kernel.org/r/00000140e9dfd6bd-40db3d4f-c1be-434f-8132-7820f81bb586-000000@email.amazonses.com. 273 - e. If running on high-end powerpc servers, build with 277 + d. If running on high-end powerpc servers, build with 274 278 CONFIG_PPC_RTAS_DAEMON=n. This prevents the RTAS 275 279 daemon from running on each CPU every second or so. 276 280 (This will require editing Kconfig files and will defeat ··· 278 282 due to the rtas_event_scan() function. 279 283 WARNING: Please check your CPU specifications to 280 284 make sure that this is safe on your particular system. 281 - f. If running on Cell Processor, build your kernel with 285 + e. If running on Cell Processor, build your kernel with 282 286 CBE_CPUFREQ_SPU_GOVERNOR=n to avoid OS jitter from 283 287 spu_gov_work(). 284 288 WARNING: Please check your CPU specifications to 285 289 make sure that this is safe on your particular system. 286 - g. If running on PowerMAC, build your kernel with 290 + f. If running on PowerMAC, build your kernel with 287 291 CONFIG_PMAC_RACKMETER=n to disable the CPU-meter, 288 292 avoiding OS jitter from rackmeter_do_timer(). 289 293
+3 -3
Documentation/devicetree/bindings/display/samsung/samsung,exynos-mixer.yaml
··· 85 85 clocks: 86 86 minItems: 6 87 87 maxItems: 6 88 - regs: 88 + reg: 89 89 minItems: 2 90 90 maxItems: 2 91 91 ··· 99 99 clocks: 100 100 minItems: 4 101 101 maxItems: 4 102 - regs: 102 + reg: 103 103 minItems: 2 104 104 maxItems: 2 105 105 ··· 116 116 clocks: 117 117 minItems: 3 118 118 maxItems: 3 119 - regs: 119 + reg: 120 120 minItems: 1 121 121 maxItems: 1 122 122
+2 -2
Documentation/devicetree/bindings/media/cnm,wave521c.yaml
··· 17 17 compatible: 18 18 items: 19 19 - enum: 20 - - ti,k3-j721s2-wave521c 20 + - ti,j721s2-wave521c 21 21 - const: cnm,wave521c 22 22 23 23 reg: ··· 53 53 examples: 54 54 - | 55 55 vpu: video-codec@12345678 { 56 - compatible = "ti,k3-j721s2-wave521c", "cnm,wave521c"; 56 + compatible = "ti,j721s2-wave521c", "cnm,wave521c"; 57 57 reg = <0x12345678 0x1000>; 58 58 clocks = <&clks 42>; 59 59 interrupts = <42>;
+13 -3
Documentation/filesystems/overlayfs.rst
··· 145 145 that files have been removed. This is done using whiteouts and opaque 146 146 directories (non-directories are always opaque). 147 147 148 - A whiteout is created as a character device with 0/0 device number. 148 + A whiteout is created as a character device with 0/0 device number or 149 + as a zero-size regular file with the xattr "trusted.overlay.whiteout". 150 + 149 151 When a whiteout is found in the upper level of a merged directory, any 150 152 matching name in the lower level is ignored, and the whiteout itself 151 153 is also hidden. ··· 155 153 A directory is made opaque by setting the xattr "trusted.overlay.opaque" 156 154 to "y". Where the upper filesystem contains an opaque directory, any 157 155 directory in the lower filesystem with the same name is ignored. 156 + 157 + An opaque directory should not conntain any whiteouts, because they do not 158 + serve any purpose. A merge directory containing regular files with the xattr 159 + "trusted.overlay.whiteout", should be additionally marked by setting the xattr 160 + "trusted.overlay.opaque" to "x" on the merge directory itself. 161 + This is needed to avoid the overhead of checking the "trusted.overlay.whiteout" 162 + on all entries during readdir in the common case. 158 163 159 164 readdir 160 165 ------- ··· 543 534 mount, so to support storing an effective whiteout file in an overlayfs mount an 544 535 alternative form of whiteout is supported. This form is a regular, zero-size 545 536 file with the "overlay.whiteout" xattr set, inside a directory with the 546 - "overlay.whiteouts" xattr set. Such whiteouts are never created by overlayfs, 547 - but can be used by userspace tools (like containers) that generate lower layers. 537 + "overlay.opaque" xattr set to "x" (see `whiteouts and opaque directories`_). 538 + These alternative whiteouts are never created by overlayfs, but can be used by 539 + userspace tools (like containers) that generate lower layers. 548 540 These alternative whiteouts can be escaped using the standard xattr escape 549 541 mechanism in order to properly nest to any depth. 550 542
+3 -1
Documentation/sphinx/templates/kernel-toc.html
··· 12 12 <script type="text/javascript"> <!-- 13 13 var sbar = document.getElementsByClassName("sphinxsidebar")[0]; 14 14 let currents = document.getElementsByClassName("current") 15 - sbar.scrollTop = currents[currents.length - 1].offsetTop; 15 + if (currents.length) { 16 + sbar.scrollTop = currents[currents.length - 1].offsetTop; 17 + } 16 18 --> </script>
+8 -6
MAINTAINERS
··· 3168 3168 3169 3169 ASUS NOTEBOOKS AND EEEPC ACPI/WMI EXTRAS DRIVERS 3170 3170 M: Corentin Chary <corentin.chary@gmail.com> 3171 - L: acpi4asus-user@lists.sourceforge.net 3171 + M: Luke D. Jones <luke@ljones.dev> 3172 3172 L: platform-driver-x86@vger.kernel.org 3173 3173 S: Maintained 3174 - W: http://acpi4asus.sf.net 3174 + W: https://asus-linux.org/ 3175 3175 F: drivers/platform/x86/asus*.c 3176 3176 F: drivers/platform/x86/eeepc*.c 3177 3177 ··· 4547 4547 4548 4548 CACHEFILES: FS-CACHE BACKEND FOR CACHING ON MOUNTED FILESYSTEMS 4549 4549 M: David Howells <dhowells@redhat.com> 4550 - L: linux-cachefs@redhat.com (moderated for non-subscribers) 4550 + L: netfs@lists.linux.dev 4551 4551 S: Supported 4552 4552 F: Documentation/filesystems/caching/cachefiles.rst 4553 4553 F: fs/cachefiles/ ··· 5958 5958 F: drivers/platform/x86/dell/dell-wmi-descriptor.c 5959 5959 5960 5960 DELL WMI HARDWARE PRIVACY SUPPORT 5961 - M: Perry Yuan <Perry.Yuan@dell.com> 5962 5961 L: Dell.Client.Kernel@dell.com 5963 5962 L: platform-driver-x86@vger.kernel.org 5964 5963 S: Maintained ··· 7954 7955 S: Maintained 7955 7956 F: rust/kernel/net/phy.rs 7956 7957 7957 - EXEC & BINFMT API 7958 + EXEC & BINFMT API, ELF 7958 7959 R: Eric Biederman <ebiederm@xmission.com> 7959 7960 R: Kees Cook <keescook@chromium.org> 7960 7961 L: linux-mm@kvack.org 7961 7962 S: Supported 7962 7963 T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/execve 7964 + F: Documentation/userspace-api/ELF.rst 7963 7965 F: fs/*binfmt_*.c 7964 7966 F: fs/exec.c 7965 7967 F: include/linux/binfmts.h ··· 8223 8223 8224 8224 FILESYSTEMS [NETFS LIBRARY] 8225 8225 M: David Howells <dhowells@redhat.com> 8226 - L: linux-cachefs@redhat.com (moderated for non-subscribers) 8226 + R: Jeff Layton <jlayton@kernel.org> 8227 + L: netfs@lists.linux.dev 8227 8228 L: linux-fsdevel@vger.kernel.org 8228 8229 S: Supported 8229 8230 F: Documentation/filesystems/caching/ ··· 20550 20549 20551 20550 SPARC + UltraSPARC (sparc/sparc64) 20552 20551 M: "David S. Miller" <davem@davemloft.net> 20552 + M: Andreas Larsson <andreas@gaisler.com> 20553 20553 L: sparclinux@vger.kernel.org 20554 20554 S: Maintained 20555 20555 Q: http://patchwork.ozlabs.org/project/sparclinux/list/
+5 -1
Makefile
··· 2 2 VERSION = 6 3 3 PATCHLEVEL = 8 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc1 5 + EXTRAVERSION = -rc2 6 6 NAME = Hurr durr I'ma ninja sloth 7 7 8 8 # *DOCUMENTATION* ··· 985 985 # arrays. Enforce this for everything that may examine structure sizes and 986 986 # perform bounds checking. 987 987 KBUILD_CFLAGS += $(call cc-option, -fstrict-flex-arrays=3) 988 + 989 + #Currently, disable -Wstringop-overflow for GCC 11, globally. 990 + KBUILD_CFLAGS-$(CONFIG_CC_NO_STRINGOP_OVERFLOW) += $(call cc-option, -Wno-stringop-overflow) 991 + KBUILD_CFLAGS-$(CONFIG_CC_STRINGOP_OVERFLOW) += $(call cc-option, -Wstringop-overflow) 988 992 989 993 # disable invalid "can't wrap" optimizations for signed / pointers 990 994 KBUILD_CFLAGS += -fno-strict-overflow
+2 -2
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-bletchley.dts
··· 45 45 num-chipselects = <1>; 46 46 cs-gpios = <&gpio0 ASPEED_GPIO(Z, 0) GPIO_ACTIVE_LOW>; 47 47 48 - tpmdev@0 { 49 - compatible = "tcg,tpm_tis-spi"; 48 + tpm@0 { 49 + compatible = "infineon,slb9670", "tcg,tpm_tis-spi"; 50 50 spi-max-frequency = <33000000>; 51 51 reg = <0>; 52 52 };
+2 -2
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-wedge400.dts
··· 80 80 gpio-miso = <&gpio ASPEED_GPIO(R, 5) GPIO_ACTIVE_HIGH>; 81 81 num-chipselects = <1>; 82 82 83 - tpmdev@0 { 84 - compatible = "tcg,tpm_tis-spi"; 83 + tpm@0 { 84 + compatible = "infineon,slb9670", "tcg,tpm_tis-spi"; 85 85 spi-max-frequency = <33000000>; 86 86 reg = <0>; 87 87 };
+1 -1
arch/arm/boot/dts/aspeed/aspeed-bmc-opp-tacoma.dts
··· 456 456 status = "okay"; 457 457 458 458 tpm: tpm@2e { 459 - compatible = "tcg,tpm-tis-i2c"; 459 + compatible = "nuvoton,npct75x", "tcg,tpm-tis-i2c"; 460 460 reg = <0x2e>; 461 461 }; 462 462 };
+2 -2
arch/arm/boot/dts/aspeed/ast2600-facebook-netbmc-common.dtsi
··· 35 35 gpio-mosi = <&gpio0 ASPEED_GPIO(X, 4) GPIO_ACTIVE_HIGH>; 36 36 gpio-miso = <&gpio0 ASPEED_GPIO(X, 5) GPIO_ACTIVE_HIGH>; 37 37 38 - tpmdev@0 { 39 - compatible = "tcg,tpm_tis-spi"; 38 + tpm@0 { 39 + compatible = "infineon,slb9670", "tcg,tpm_tis-spi"; 40 40 spi-max-frequency = <33000000>; 41 41 reg = <0>; 42 42 };
+1 -1
arch/arm/boot/dts/nxp/imx/imx6ull-phytec-tauri.dtsi
··· 116 116 tpm_tis: tpm@1 { 117 117 pinctrl-names = "default"; 118 118 pinctrl-0 = <&pinctrl_tpm>; 119 - compatible = "tcg,tpm_tis-spi"; 119 + compatible = "infineon,slb9670", "tcg,tpm_tis-spi"; 120 120 reg = <1>; 121 121 spi-max-frequency = <20000000>; 122 122 interrupt-parent = <&gpio5>;
+1 -1
arch/arm/boot/dts/nxp/imx/imx7d-flex-concentrator.dts
··· 130 130 * TCG specification - Section 6.4.1 Clocking: 131 131 * TPM shall support a SPI clock frequency range of 10-24 MHz. 132 132 */ 133 - st33htph: tpm-tis@0 { 133 + st33htph: tpm@0 { 134 134 compatible = "st,st33htpm-spi", "tcg,tpm_tis-spi"; 135 135 reg = <0>; 136 136 spi-max-frequency = <24000000>;
+1
arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi
··· 434 434 }; 435 435 436 436 &fimd { 437 + samsung,invert-vclk; 437 438 status = "okay"; 438 439 }; 439 440
+1 -1
arch/arm/boot/dts/ti/omap/am335x-moxa-uc-2100-common.dtsi
··· 217 217 pinctrl-names = "default"; 218 218 pinctrl-0 = <&spi1_pins>; 219 219 220 - tpm_spi_tis@0 { 220 + tpm@0 { 221 221 compatible = "tcg,tpm_tis-spi"; 222 222 reg = <0>; 223 223 spi-max-frequency = <500000>;
+1 -1
arch/arm64/boot/dts/exynos/google/gs101.dtsi
··· 289 289 #clock-cells = <1>; 290 290 clocks = <&cmu_top CLK_DOUT_CMU_MISC_BUS>, 291 291 <&cmu_top CLK_DOUT_CMU_MISC_SSS>; 292 - clock-names = "dout_cmu_misc_bus", "dout_cmu_misc_sss"; 292 + clock-names = "bus", "sss"; 293 293 }; 294 294 295 295 watchdog_cl0: watchdog@10060000 {
+1 -1
arch/arm64/boot/dts/freescale/imx8mm-phygate-tauri-l.dts
··· 120 120 }; 121 121 122 122 tpm: tpm@1 { 123 - compatible = "tcg,tpm_tis-spi"; 123 + compatible = "infineon,slb9670", "tcg,tpm_tis-spi"; 124 124 interrupts = <11 IRQ_TYPE_LEVEL_LOW>; 125 125 interrupt-parent = <&gpio2>; 126 126 pinctrl-names = "default";
+1 -1
arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx.dtsi
··· 89 89 status = "okay"; 90 90 91 91 tpm@1 { 92 - compatible = "tcg,tpm_tis-spi"; 92 + compatible = "atmel,attpm20p", "tcg,tpm_tis-spi"; 93 93 reg = <0x1>; 94 94 spi-max-frequency = <36000000>; 95 95 };
+1 -1
arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx.dtsi
··· 109 109 status = "okay"; 110 110 111 111 tpm@1 { 112 - compatible = "tcg,tpm_tis-spi"; 112 + compatible = "atmel,attpm20p", "tcg,tpm_tis-spi"; 113 113 reg = <0x1>; 114 114 spi-max-frequency = <36000000>; 115 115 };
+1 -1
arch/arm64/boot/dts/freescale/imx8mp-beacon-kit.dts
··· 234 234 status = "okay"; 235 235 236 236 tpm: tpm@0 { 237 - compatible = "infineon,slb9670"; 237 + compatible = "infineon,slb9670", "tcg,tpm_tis-spi"; 238 238 reg = <0>; 239 239 pinctrl-names = "default"; 240 240 pinctrl-0 = <&pinctrl_tpm>;
+1 -1
arch/arm64/boot/dts/freescale/imx8mp-venice-gw72xx.dtsi
··· 103 103 status = "okay"; 104 104 105 105 tpm@1 { 106 - compatible = "tcg,tpm_tis-spi"; 106 + compatible = "atmel,attpm20p", "tcg,tpm_tis-spi"; 107 107 reg = <0x1>; 108 108 spi-max-frequency = <36000000>; 109 109 };
+1 -1
arch/arm64/boot/dts/freescale/imx8mp-venice-gw73xx.dtsi
··· 115 115 status = "okay"; 116 116 117 117 tpm@1 { 118 - compatible = "tcg,tpm_tis-spi"; 118 + compatible = "atmel,attpm20p", "tcg,tpm_tis-spi"; 119 119 reg = <0x1>; 120 120 spi-max-frequency = <36000000>; 121 121 };
+1 -1
arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts
··· 196 196 status = "okay"; 197 197 198 198 tpm@0 { 199 - compatible = "tcg,tpm_tis-spi"; 199 + compatible = "atmel,attpm20p", "tcg,tpm_tis-spi"; 200 200 reg = <0x0>; 201 201 spi-max-frequency = <36000000>; 202 202 };
+1 -1
arch/arm64/boot/dts/freescale/imx8mq-kontron-pitx-imx8m.dts
··· 65 65 status = "okay"; 66 66 67 67 tpm@0 { 68 - compatible = "infineon,slb9670"; 68 + compatible = "infineon,slb9670", "tcg,tpm_tis-spi"; 69 69 reg = <0>; 70 70 spi-max-frequency = <43000000>; 71 71 };
+1 -1
arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
··· 888 888 status = "okay"; 889 889 cs-gpios = <&pio 86 GPIO_ACTIVE_LOW>; 890 890 891 - cr50@0 { 891 + tpm@0 { 892 892 compatible = "google,cr50"; 893 893 reg = <0>; 894 894 spi-max-frequency = <1000000>;
+1 -1
arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi
··· 1402 1402 pinctrl-names = "default"; 1403 1403 pinctrl-0 = <&spi5_pins>; 1404 1404 1405 - cr50@0 { 1405 + tpm@0 { 1406 1406 compatible = "google,cr50"; 1407 1407 reg = <0>; 1408 1408 interrupts-extended = <&pio 171 IRQ_TYPE_EDGE_RISING>;
+1 -1
arch/arm64/boot/dts/rockchip/rk3399-gru-bob.dts
··· 70 70 &spi0 { 71 71 status = "okay"; 72 72 73 - cr50@0 { 73 + tpm@0 { 74 74 compatible = "google,cr50"; 75 75 reg = <0>; 76 76 interrupt-parent = <&gpio0>;
+1 -1
arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet.dtsi
··· 706 706 &spi2 { 707 707 status = "okay"; 708 708 709 - cr50@0 { 709 + tpm@0 { 710 710 compatible = "google,cr50"; 711 711 reg = <0>; 712 712 interrupt-parent = <&gpio1>;
+2 -2
arch/loongarch/include/asm/kvm_vcpu.h
··· 60 60 void kvm_save_lsx(struct loongarch_fpu *fpu); 61 61 void kvm_restore_lsx(struct loongarch_fpu *fpu); 62 62 #else 63 - static inline int kvm_own_lsx(struct kvm_vcpu *vcpu) { } 63 + static inline int kvm_own_lsx(struct kvm_vcpu *vcpu) { return -EINVAL; } 64 64 static inline void kvm_save_lsx(struct loongarch_fpu *fpu) { } 65 65 static inline void kvm_restore_lsx(struct loongarch_fpu *fpu) { } 66 66 #endif ··· 70 70 void kvm_save_lasx(struct loongarch_fpu *fpu); 71 71 void kvm_restore_lasx(struct loongarch_fpu *fpu); 72 72 #else 73 - static inline int kvm_own_lasx(struct kvm_vcpu *vcpu) { } 73 + static inline int kvm_own_lasx(struct kvm_vcpu *vcpu) { return -EINVAL; } 74 74 static inline void kvm_save_lasx(struct loongarch_fpu *fpu) { } 75 75 static inline void kvm_restore_lasx(struct loongarch_fpu *fpu) { } 76 76 #endif
-1
arch/loongarch/kernel/smp.c
··· 509 509 sync_counter(); 510 510 cpu = raw_smp_processor_id(); 511 511 set_my_cpu_offset(per_cpu_offset(cpu)); 512 - rcutree_report_cpu_starting(cpu); 513 512 514 513 cpu_probe(); 515 514 constant_clockevent_init();
+2 -2
arch/loongarch/kvm/mmu.c
··· 675 675 * 676 676 * There are several ways to safely use this helper: 677 677 * 678 - * - Check mmu_invalidate_retry_hva() after grabbing the mapping level, before 678 + * - Check mmu_invalidate_retry_gfn() after grabbing the mapping level, before 679 679 * consuming it. In this case, mmu_lock doesn't need to be held during the 680 680 * lookup, but it does need to be held while checking the MMU notifier. 681 681 * ··· 855 855 856 856 /* Check if an invalidation has taken place since we got pfn */ 857 857 spin_lock(&kvm->mmu_lock); 858 - if (mmu_invalidate_retry_hva(kvm, mmu_seq, hva)) { 858 + if (mmu_invalidate_retry_gfn(kvm, mmu_seq, gfn)) { 859 859 /* 860 860 * This can happen when mappings are changed asynchronously, but 861 861 * also synchronously if a COW is triggered by
+10 -6
arch/loongarch/mm/tlb.c
··· 284 284 set_handler(EXCCODE_TLBNR * VECSIZE, handle_tlb_protect, VECSIZE); 285 285 set_handler(EXCCODE_TLBNX * VECSIZE, handle_tlb_protect, VECSIZE); 286 286 set_handler(EXCCODE_TLBPE * VECSIZE, handle_tlb_protect, VECSIZE); 287 - } 287 + } else { 288 + int vec_sz __maybe_unused; 289 + void *addr __maybe_unused; 290 + struct page *page __maybe_unused; 291 + 292 + /* Avoid lockdep warning */ 293 + rcutree_report_cpu_starting(cpu); 294 + 288 295 #ifdef CONFIG_NUMA 289 - else { 290 - void *addr; 291 - struct page *page; 292 - const int vec_sz = sizeof(exception_handlers); 296 + vec_sz = sizeof(exception_handlers); 293 297 294 298 if (pcpu_handlers[cpu]) 295 299 return; ··· 309 305 csr_write64(pcpu_handlers[cpu], LOONGARCH_CSR_EENTRY); 310 306 csr_write64(pcpu_handlers[cpu], LOONGARCH_CSR_MERRENTRY); 311 307 csr_write64(pcpu_handlers[cpu] + 80*VECSIZE, LOONGARCH_CSR_TLBRENTRY); 312 - } 313 308 #endif 309 + } 314 310 } 315 311 316 312 void tlb_init(int cpu)
+1
arch/mips/alchemy/common/prom.c
··· 40 40 #include <linux/string.h> 41 41 42 42 #include <asm/bootinfo.h> 43 + #include <prom.h> 43 44 44 45 int prom_argc; 45 46 char **prom_argv;
+1 -3
arch/mips/alchemy/common/setup.c
··· 30 30 #include <linux/mm.h> 31 31 #include <linux/dma-map-ops.h> /* for dma_default_coherent */ 32 32 33 + #include <asm/bootinfo.h> 33 34 #include <asm/mipsregs.h> 34 35 35 36 #include <au1000.h> 36 - 37 - extern void __init board_setup(void); 38 - extern void __init alchemy_set_lpj(void); 39 37 40 38 static bool alchemy_dma_coherent(void) 41 39 {
+1 -1
arch/mips/bcm63xx/boards/board_bcm963xx.c
··· 702 702 .boardflags_hi = 0x0000, 703 703 }; 704 704 705 - int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out) 705 + static int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out) 706 706 { 707 707 if (bus->bustype == SSB_BUSTYPE_PCI) { 708 708 memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom));
+1 -1
arch/mips/bcm63xx/dev-rng.c
··· 26 26 .resource = rng_resources, 27 27 }; 28 28 29 - int __init bcm63xx_rng_register(void) 29 + static int __init bcm63xx_rng_register(void) 30 30 { 31 31 if (!BCMCPU_IS_6368()) 32 32 return -ENODEV;
+1
arch/mips/bcm63xx/dev-uart.c
··· 10 10 #include <linux/kernel.h> 11 11 #include <linux/platform_device.h> 12 12 #include <bcm63xx_cpu.h> 13 + #include <bcm63xx_dev_uart.h> 13 14 14 15 static struct resource uart0_resources[] = { 15 16 {
+1 -1
arch/mips/bcm63xx/dev-wdt.c
··· 34 34 }, 35 35 }; 36 36 37 - int __init bcm63xx_wdt_register(void) 37 + static int __init bcm63xx_wdt_register(void) 38 38 { 39 39 wdt_resources[0].start = bcm63xx_regset_address(RSET_WDT); 40 40 wdt_resources[0].end = wdt_resources[0].start;
+1 -1
arch/mips/bcm63xx/irq.c
··· 72 72 */ 73 73 74 74 #define BUILD_IPIC_INTERNAL(width) \ 75 - void __dispatch_internal_##width(int cpu) \ 75 + static void __dispatch_internal_##width(int cpu) \ 76 76 { \ 77 77 u32 pending[width / 32]; \ 78 78 unsigned int src, tgt; \
+1 -1
arch/mips/bcm63xx/setup.c
··· 159 159 board_setup(); 160 160 } 161 161 162 - int __init bcm63xx_register_devices(void) 162 + static int __init bcm63xx_register_devices(void) 163 163 { 164 164 /* register gpiochip */ 165 165 bcm63xx_gpio_init();
+1 -1
arch/mips/bcm63xx/timer.c
··· 178 178 179 179 EXPORT_SYMBOL(bcm63xx_timer_set); 180 180 181 - int bcm63xx_timer_init(void) 181 + static int bcm63xx_timer_init(void) 182 182 { 183 183 int ret, irq; 184 184 u32 reg;
-3
arch/mips/cobalt/setup.c
··· 23 23 24 24 #include <cobalt.h> 25 25 26 - extern void cobalt_machine_restart(char *command); 27 - extern void cobalt_machine_halt(void); 28 - 29 26 const char *get_system_type(void) 30 27 { 31 28 switch (cobalt_board_id) {
+1 -1
arch/mips/fw/arc/memory.c
··· 37 37 */ 38 38 #define ARC_PAGE_SHIFT 12 39 39 40 - struct linux_mdesc * __init ArcGetMemoryDescriptor(struct linux_mdesc *Current) 40 + static struct linux_mdesc * __init ArcGetMemoryDescriptor(struct linux_mdesc *Current) 41 41 { 42 42 return (struct linux_mdesc *) ARC_CALL1(get_mdesc, Current); 43 43 }
+3
arch/mips/include/asm/mach-au1x00/au1000.h
··· 597 597 598 598 #include <asm/cpu.h> 599 599 600 + void alchemy_set_lpj(void); 601 + void board_setup(void); 602 + 600 603 /* helpers to access the SYS_* registers */ 601 604 static inline unsigned long alchemy_rdsys(int regofs) 602 605 {
+3
arch/mips/include/asm/mach-cobalt/cobalt.h
··· 19 19 #define COBALT_BRD_ID_QUBE2 0x5 20 20 #define COBALT_BRD_ID_RAQ2 0x6 21 21 22 + void cobalt_machine_halt(void); 23 + void cobalt_machine_restart(char *command); 24 + 22 25 #endif /* __ASM_COBALT_H */
+6
arch/mips/kernel/elf.c
··· 11 11 12 12 #include <asm/cpu-features.h> 13 13 #include <asm/cpu-info.h> 14 + #include <asm/fpu.h> 14 15 15 16 #ifdef CONFIG_MIPS_FP_SUPPORT 16 17 ··· 309 308 { 310 309 struct cpuinfo_mips *c = &boot_cpu_data; 311 310 struct task_struct *t = current; 311 + 312 + /* Do this early so t->thread.fpu.fcr31 won't be clobbered in case 313 + * we are preempted before the lose_fpu(0) in start_thread. 314 + */ 315 + lose_fpu(0); 312 316 313 317 t->thread.fpu.fcr31 = c->fpu_csr31; 314 318 switch (state->nan_2008) {
+7 -1
arch/mips/kernel/traps.c
··· 2007 2007 2008 2008 void reserve_exception_space(phys_addr_t addr, unsigned long size) 2009 2009 { 2010 - memblock_reserve(addr, size); 2010 + /* 2011 + * reserve exception space on CPUs other than CPU0 2012 + * is too late, since memblock is unavailable when APs 2013 + * up 2014 + */ 2015 + if (smp_processor_id() == 0) 2016 + memblock_reserve(addr, size); 2011 2017 } 2012 2018 2013 2019 void __init *set_except_vector(int n, void *addr)
+3 -4
arch/mips/lantiq/prom.c
··· 108 108 prom_init_cmdline(); 109 109 110 110 #if defined(CONFIG_MIPS_MT_SMP) 111 - if (cpu_has_mipsmt) { 112 - lantiq_smp_ops = vsmp_smp_ops; 111 + lantiq_smp_ops = vsmp_smp_ops; 112 + if (cpu_has_mipsmt) 113 113 lantiq_smp_ops.init_secondary = lantiq_init_secondary; 114 - register_smp_ops(&lantiq_smp_ops); 115 - } 114 + register_smp_ops(&lantiq_smp_ops); 116 115 #endif 117 116 }
+3
arch/mips/loongson64/init.c
··· 103 103 if (loongson_sysconf.vgabios_addr) 104 104 memblock_reserve(virt_to_phys((void *)loongson_sysconf.vgabios_addr), 105 105 SZ_256K); 106 + /* set nid for reserved memory */ 107 + memblock_set_node((u64)node << 44, (u64)(node + 1) << 44, 108 + &memblock.reserved, node); 106 109 } 107 110 108 111 #ifndef CONFIG_NUMA
+2
arch/mips/loongson64/numa.c
··· 132 132 133 133 /* Reserve pfn range 0~node[0]->node_start_pfn */ 134 134 memblock_reserve(0, PAGE_SIZE * start_pfn); 135 + /* set nid for reserved memory on node 0 */ 136 + memblock_set_node(0, 1ULL << 44, &memblock.reserved, 0); 135 137 } 136 138 } 137 139
+1 -1
arch/mips/sgi-ip27/Makefile
··· 5 5 6 6 obj-y := ip27-berr.o ip27-irq.o ip27-init.o ip27-klconfig.o \ 7 7 ip27-klnuma.o ip27-memory.o ip27-nmi.o ip27-reset.o ip27-timer.o \ 8 - ip27-hubio.o ip27-xtalk.o 8 + ip27-xtalk.o 9 9 10 10 obj-$(CONFIG_EARLY_PRINTK) += ip27-console.o 11 11 obj-$(CONFIG_SMP) += ip27-smp.o
+3 -1
arch/mips/sgi-ip27/ip27-berr.c
··· 22 22 #include <asm/traps.h> 23 23 #include <linux/uaccess.h> 24 24 25 + #include "ip27-common.h" 26 + 25 27 static void dump_hub_information(unsigned long errst0, unsigned long errst1) 26 28 { 27 29 static char *err_type[2][8] = { ··· 59 57 [st0.pi_stat0_fmt.s0_err_type] ? : "invalid"); 60 58 } 61 59 62 - int ip27_be_handler(struct pt_regs *regs, int is_fixup) 60 + static int ip27_be_handler(struct pt_regs *regs, int is_fixup) 63 61 { 64 62 unsigned long errst0, errst1; 65 63 int data = regs->cp0_cause & 4;
+2
arch/mips/sgi-ip27/ip27-common.h
··· 10 10 extern void hub_rtc_init(nasid_t nasid); 11 11 extern void install_cpu_nmi_handler(int slice); 12 12 extern void install_ipi(void); 13 + extern void ip27_be_init(void); 13 14 extern void ip27_reboot_setup(void); 14 15 extern const struct plat_smp_ops ip27_smp_ops; 15 16 extern unsigned long node_getfirstfree(nasid_t nasid); 16 17 extern void per_cpu_init(void); 17 18 extern void replicate_kernel_text(void); 18 19 extern void setup_replication_mask(void); 20 + 19 21 20 22 #endif /* __IP27_COMMON_H */
-185
arch/mips/sgi-ip27/ip27-hubio.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Copyright (C) 1992-1997, 2000-2003 Silicon Graphics, Inc. 4 - * Copyright (C) 2004 Christoph Hellwig. 5 - * 6 - * Support functions for the HUB ASIC - mostly PIO mapping related. 7 - */ 8 - 9 - #include <linux/bitops.h> 10 - #include <linux/string.h> 11 - #include <linux/mmzone.h> 12 - #include <asm/sn/addrs.h> 13 - #include <asm/sn/arch.h> 14 - #include <asm/sn/agent.h> 15 - #include <asm/sn/io.h> 16 - #include <asm/xtalk/xtalk.h> 17 - 18 - 19 - static int force_fire_and_forget = 1; 20 - 21 - /** 22 - * hub_pio_map - establish a HUB PIO mapping 23 - * 24 - * @nasid: nasid to perform PIO mapping on 25 - * @widget: widget ID to perform PIO mapping for 26 - * @xtalk_addr: xtalk_address that needs to be mapped 27 - * @size: size of the PIO mapping 28 - * 29 - **/ 30 - unsigned long hub_pio_map(nasid_t nasid, xwidgetnum_t widget, 31 - unsigned long xtalk_addr, size_t size) 32 - { 33 - unsigned i; 34 - 35 - /* use small-window mapping if possible */ 36 - if ((xtalk_addr % SWIN_SIZE) + size <= SWIN_SIZE) 37 - return NODE_SWIN_BASE(nasid, widget) + (xtalk_addr % SWIN_SIZE); 38 - 39 - if ((xtalk_addr % BWIN_SIZE) + size > BWIN_SIZE) { 40 - printk(KERN_WARNING "PIO mapping at hub %d widget %d addr 0x%lx" 41 - " too big (%ld)\n", 42 - nasid, widget, xtalk_addr, size); 43 - return 0; 44 - } 45 - 46 - xtalk_addr &= ~(BWIN_SIZE-1); 47 - for (i = 0; i < HUB_NUM_BIG_WINDOW; i++) { 48 - if (test_and_set_bit(i, hub_data(nasid)->h_bigwin_used)) 49 - continue; 50 - 51 - /* 52 - * The code below does a PIO write to setup an ITTE entry. 53 - * 54 - * We need to prevent other CPUs from seeing our updated 55 - * memory shadow of the ITTE (in the piomap) until the ITTE 56 - * entry is actually set up; otherwise, another CPU might 57 - * attempt a PIO prematurely. 58 - * 59 - * Also, the only way we can know that an entry has been 60 - * received by the hub and can be used by future PIO reads/ 61 - * writes is by reading back the ITTE entry after writing it. 62 - * 63 - * For these two reasons, we PIO read back the ITTE entry 64 - * after we write it. 65 - */ 66 - IIO_ITTE_PUT(nasid, i, HUB_PIO_MAP_TO_MEM, widget, xtalk_addr); 67 - __raw_readq(IIO_ITTE_GET(nasid, i)); 68 - 69 - return NODE_BWIN_BASE(nasid, widget) + (xtalk_addr % BWIN_SIZE); 70 - } 71 - 72 - printk(KERN_WARNING "unable to establish PIO mapping for at" 73 - " hub %d widget %d addr 0x%lx\n", 74 - nasid, widget, xtalk_addr); 75 - return 0; 76 - } 77 - 78 - 79 - /* 80 - * hub_setup_prb(nasid, prbnum, credits, conveyor) 81 - * 82 - * Put a PRB into fire-and-forget mode if conveyor isn't set. Otherwise, 83 - * put it into conveyor belt mode with the specified number of credits. 84 - */ 85 - static void hub_setup_prb(nasid_t nasid, int prbnum, int credits) 86 - { 87 - union iprb_u prb; 88 - int prb_offset; 89 - 90 - /* 91 - * Get the current register value. 92 - */ 93 - prb_offset = IIO_IOPRB(prbnum); 94 - prb.iprb_regval = REMOTE_HUB_L(nasid, prb_offset); 95 - 96 - /* 97 - * Clear out some fields. 98 - */ 99 - prb.iprb_ovflow = 1; 100 - prb.iprb_bnakctr = 0; 101 - prb.iprb_anakctr = 0; 102 - 103 - /* 104 - * Enable or disable fire-and-forget mode. 105 - */ 106 - prb.iprb_ff = force_fire_and_forget ? 1 : 0; 107 - 108 - /* 109 - * Set the appropriate number of PIO credits for the widget. 110 - */ 111 - prb.iprb_xtalkctr = credits; 112 - 113 - /* 114 - * Store the new value to the register. 115 - */ 116 - REMOTE_HUB_S(nasid, prb_offset, prb.iprb_regval); 117 - } 118 - 119 - /** 120 - * hub_set_piomode - set pio mode for a given hub 121 - * 122 - * @nasid: physical node ID for the hub in question 123 - * 124 - * Put the hub into either "PIO conveyor belt" mode or "fire-and-forget" mode. 125 - * To do this, we have to make absolutely sure that no PIOs are in progress 126 - * so we turn off access to all widgets for the duration of the function. 127 - * 128 - * XXX - This code should really check what kind of widget we're talking 129 - * to. Bridges can only handle three requests, but XG will do more. 130 - * How many can crossbow handle to widget 0? We're assuming 1. 131 - * 132 - * XXX - There is a bug in the crossbow that link reset PIOs do not 133 - * return write responses. The easiest solution to this problem is to 134 - * leave widget 0 (xbow) in fire-and-forget mode at all times. This 135 - * only affects pio's to xbow registers, which should be rare. 136 - **/ 137 - static void hub_set_piomode(nasid_t nasid) 138 - { 139 - u64 ii_iowa; 140 - union hubii_wcr_u ii_wcr; 141 - unsigned i; 142 - 143 - ii_iowa = REMOTE_HUB_L(nasid, IIO_OUTWIDGET_ACCESS); 144 - REMOTE_HUB_S(nasid, IIO_OUTWIDGET_ACCESS, 0); 145 - 146 - ii_wcr.wcr_reg_value = REMOTE_HUB_L(nasid, IIO_WCR); 147 - 148 - if (ii_wcr.iwcr_dir_con) { 149 - /* 150 - * Assume a bridge here. 151 - */ 152 - hub_setup_prb(nasid, 0, 3); 153 - } else { 154 - /* 155 - * Assume a crossbow here. 156 - */ 157 - hub_setup_prb(nasid, 0, 1); 158 - } 159 - 160 - /* 161 - * XXX - Here's where we should take the widget type into 162 - * when account assigning credits. 163 - */ 164 - for (i = HUB_WIDGET_ID_MIN; i <= HUB_WIDGET_ID_MAX; i++) 165 - hub_setup_prb(nasid, i, 3); 166 - 167 - REMOTE_HUB_S(nasid, IIO_OUTWIDGET_ACCESS, ii_iowa); 168 - } 169 - 170 - /* 171 - * hub_pio_init - PIO-related hub initialization 172 - * 173 - * @hub: hubinfo structure for our hub 174 - */ 175 - void hub_pio_init(nasid_t nasid) 176 - { 177 - unsigned i; 178 - 179 - /* initialize big window piomaps for this hub */ 180 - bitmap_zero(hub_data(nasid)->h_bigwin_used, HUB_NUM_BIG_WINDOW); 181 - for (i = 0; i < HUB_NUM_BIG_WINDOW; i++) 182 - IIO_ITTE_DISABLE(nasid, i); 183 - 184 - hub_set_piomode(nasid); 185 - }
+2
arch/mips/sgi-ip27/ip27-irq.c
··· 23 23 #include <asm/sn/intr.h> 24 24 #include <asm/sn/irq_alloc.h> 25 25 26 + #include "ip27-common.h" 27 + 26 28 struct hub_irq_data { 27 29 u64 *irq_mask[2]; 28 30 cpuid_t cpu;
+1
arch/mips/sgi-ip27/ip27-memory.c
··· 23 23 #include <asm/page.h> 24 24 #include <asm/pgalloc.h> 25 25 #include <asm/sections.h> 26 + #include <asm/sgialib.h> 26 27 27 28 #include <asm/sn/arch.h> 28 29 #include <asm/sn/agent.h>
+8 -17
arch/mips/sgi-ip27/ip27-nmi.c
··· 11 11 #include <asm/sn/arch.h> 12 12 #include <asm/sn/agent.h> 13 13 14 + #include "ip27-common.h" 15 + 14 16 #if 0 15 17 #define NODE_NUM_CPUS(n) CNODE_NUM_CPUS(n) 16 18 #else ··· 25 23 typedef unsigned long machreg_t; 26 24 27 25 static arch_spinlock_t nmi_lock = __ARCH_SPIN_LOCK_UNLOCKED; 28 - 29 - /* 30 - * Let's see what else we need to do here. Set up sp, gp? 31 - */ 32 - void nmi_dump(void) 33 - { 34 - void cont_nmi_dump(void); 35 - 36 - cont_nmi_dump(); 37 - } 26 + static void nmi_dump(void); 38 27 39 28 void install_cpu_nmi_handler(int slice) 40 29 { ··· 46 53 * into the eframe format for the node under consideration. 47 54 */ 48 55 49 - void nmi_cpu_eframe_save(nasid_t nasid, int slice) 56 + static void nmi_cpu_eframe_save(nasid_t nasid, int slice) 50 57 { 51 58 struct reg_struct *nr; 52 59 int i; ··· 122 129 pr_emerg("\n"); 123 130 } 124 131 125 - void nmi_dump_hub_irq(nasid_t nasid, int slice) 132 + static void nmi_dump_hub_irq(nasid_t nasid, int slice) 126 133 { 127 134 u64 mask0, mask1, pend0, pend1; 128 135 ··· 146 153 * Copy the cpu registers which have been saved in the IP27prom format 147 154 * into the eframe format for the node under consideration. 148 155 */ 149 - void nmi_node_eframe_save(nasid_t nasid) 156 + static void nmi_node_eframe_save(nasid_t nasid) 150 157 { 151 158 int slice; 152 159 ··· 163 170 /* 164 171 * Save the nmi cpu registers for all cpus in the system. 165 172 */ 166 - void 167 - nmi_eframes_save(void) 173 + static void nmi_eframes_save(void) 168 174 { 169 175 nasid_t nasid; 170 176 ··· 171 179 nmi_node_eframe_save(nasid); 172 180 } 173 181 174 - void 175 - cont_nmi_dump(void) 182 + static void nmi_dump(void) 176 183 { 177 184 #ifndef REAL_NMI_SIGNAL 178 185 static atomic_t nmied_cpus = ATOMIC_INIT(0);
+1
arch/mips/sgi-ip30/ip30-console.c
··· 3 3 #include <linux/io.h> 4 4 5 5 #include <asm/sn/ioc3.h> 6 + #include <asm/setup.h> 6 7 7 8 static inline struct ioc3_uartregs *console_uart(void) 8 9 {
+1
arch/mips/sgi-ip30/ip30-setup.c
··· 14 14 #include <linux/percpu.h> 15 15 #include <linux/memblock.h> 16 16 17 + #include <asm/bootinfo.h> 17 18 #include <asm/smp-ops.h> 18 19 #include <asm/sgialib.h> 19 20 #include <asm/time.h>
+4 -2
arch/mips/sgi-ip32/crime.c
··· 18 18 #include <asm/ip32/crime.h> 19 19 #include <asm/ip32/mace.h> 20 20 21 + #include "ip32-common.h" 22 + 21 23 struct sgi_crime __iomem *crime; 22 24 struct sgi_mace __iomem *mace; 23 25 ··· 41 39 id, rev, field, (unsigned long) CRIME_BASE); 42 40 } 43 41 44 - irqreturn_t crime_memerr_intr(unsigned int irq, void *dev_id) 42 + irqreturn_t crime_memerr_intr(int irq, void *dev_id) 45 43 { 46 44 unsigned long stat, addr; 47 45 int fatal = 0; ··· 92 90 return IRQ_HANDLED; 93 91 } 94 92 95 - irqreturn_t crime_cpuerr_intr(unsigned int irq, void *dev_id) 93 + irqreturn_t crime_cpuerr_intr(int irq, void *dev_id) 96 94 { 97 95 unsigned long stat = crime->cpu_error_stat & CRIME_CPU_ERROR_MASK; 98 96 unsigned long addr = crime->cpu_error_addr & CRIME_CPU_ERROR_ADDR_MASK;
+2
arch/mips/sgi-ip32/ip32-berr.c
··· 18 18 #include <asm/ptrace.h> 19 19 #include <asm/tlbdebug.h> 20 20 21 + #include "ip32-common.h" 22 + 21 23 static int ip32_be_handler(struct pt_regs *regs, int is_fixup) 22 24 { 23 25 int data = regs->cp0_cause & 4;
+15
arch/mips/sgi-ip32/ip32-common.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + 3 + #ifndef __IP32_COMMON_H 4 + #define __IP32_COMMON_H 5 + 6 + #include <linux/init.h> 7 + #include <linux/interrupt.h> 8 + 9 + void __init crime_init(void); 10 + irqreturn_t crime_memerr_intr(int irq, void *dev_id); 11 + irqreturn_t crime_cpuerr_intr(int irq, void *dev_id); 12 + void __init ip32_be_init(void); 13 + void ip32_prepare_poweroff(void); 14 + 15 + #endif /* __IP32_COMMON_H */
+2 -4
arch/mips/sgi-ip32/ip32-irq.c
··· 28 28 #include <asm/ip32/mace.h> 29 29 #include <asm/ip32/ip32_ints.h> 30 30 31 + #include "ip32-common.h" 32 + 31 33 /* issue a PIO read to make sure no PIO writes are pending */ 32 34 static inline void flush_crime_bus(void) 33 35 { ··· 108 106 * different IRQ map than IRIX uses, but that's OK as Linux irq handling 109 107 * is quite different anyway. 110 108 */ 111 - 112 - /* Some initial interrupts to set up */ 113 - extern irqreturn_t crime_memerr_intr(int irq, void *dev_id); 114 - extern irqreturn_t crime_cpuerr_intr(int irq, void *dev_id); 115 109 116 110 /* 117 111 * This is for pure CRIME interrupts - ie not MACE. The advantage?
+1
arch/mips/sgi-ip32/ip32-memory.c
··· 15 15 #include <asm/ip32/crime.h> 16 16 #include <asm/bootinfo.h> 17 17 #include <asm/page.h> 18 + #include <asm/sgialib.h> 18 19 19 20 extern void crime_init(void); 20 21
+2
arch/mips/sgi-ip32/ip32-reset.c
··· 29 29 #include <asm/ip32/crime.h> 30 30 #include <asm/ip32/ip32_ints.h> 31 31 32 + #include "ip32-common.h" 33 + 32 34 #define POWERDOWN_TIMEOUT 120 33 35 /* 34 36 * Blink frequency during reboot grace period and when panicked.
+1 -2
arch/mips/sgi-ip32/ip32-setup.c
··· 26 26 #include <asm/ip32/mace.h> 27 27 #include <asm/ip32/ip32_ints.h> 28 28 29 - extern void ip32_be_init(void); 30 - extern void crime_init(void); 29 + #include "ip32-common.h" 31 30 32 31 #ifdef CONFIG_SGI_O2MACE_ETH 33 32 /*
+48 -32
arch/riscv/boot/dts/sophgo/sg2042.dtsi
··· 93 93 <&cpu63_intc 3>; 94 94 }; 95 95 96 - clint_mtimer0: timer@70ac000000 { 96 + clint_mtimer0: timer@70ac004000 { 97 97 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer"; 98 - reg = <0x00000070 0xac000000 0x00000000 0x00007ff8>; 98 + reg = <0x00000070 0xac004000 0x00000000 0x0000c000>; 99 + reg-names = "mtimecmp"; 99 100 interrupts-extended = <&cpu0_intc 7>, 100 101 <&cpu1_intc 7>, 101 102 <&cpu2_intc 7>, 102 103 <&cpu3_intc 7>; 103 104 }; 104 105 105 - clint_mtimer1: timer@70ac010000 { 106 + clint_mtimer1: timer@70ac014000 { 106 107 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer"; 107 - reg = <0x00000070 0xac010000 0x00000000 0x00007ff8>; 108 + reg = <0x00000070 0xac014000 0x00000000 0x0000c000>; 109 + reg-names = "mtimecmp"; 108 110 interrupts-extended = <&cpu4_intc 7>, 109 111 <&cpu5_intc 7>, 110 112 <&cpu6_intc 7>, 111 113 <&cpu7_intc 7>; 112 114 }; 113 115 114 - clint_mtimer2: timer@70ac020000 { 116 + clint_mtimer2: timer@70ac024000 { 115 117 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer"; 116 - reg = <0x00000070 0xac020000 0x00000000 0x00007ff8>; 118 + reg = <0x00000070 0xac024000 0x00000000 0x0000c000>; 119 + reg-names = "mtimecmp"; 117 120 interrupts-extended = <&cpu8_intc 7>, 118 121 <&cpu9_intc 7>, 119 122 <&cpu10_intc 7>, 120 123 <&cpu11_intc 7>; 121 124 }; 122 125 123 - clint_mtimer3: timer@70ac030000 { 126 + clint_mtimer3: timer@70ac034000 { 124 127 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer"; 125 - reg = <0x00000070 0xac030000 0x00000000 0x00007ff8>; 128 + reg = <0x00000070 0xac034000 0x00000000 0x0000c000>; 129 + reg-names = "mtimecmp"; 126 130 interrupts-extended = <&cpu12_intc 7>, 127 131 <&cpu13_intc 7>, 128 132 <&cpu14_intc 7>, 129 133 <&cpu15_intc 7>; 130 134 }; 131 135 132 - clint_mtimer4: timer@70ac040000 { 136 + clint_mtimer4: timer@70ac044000 { 133 137 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer"; 134 - reg = <0x00000070 0xac040000 0x00000000 0x00007ff8>; 138 + reg = <0x00000070 0xac044000 0x00000000 0x0000c000>; 139 + reg-names = "mtimecmp"; 135 140 interrupts-extended = <&cpu16_intc 7>, 136 141 <&cpu17_intc 7>, 137 142 <&cpu18_intc 7>, 138 143 <&cpu19_intc 7>; 139 144 }; 140 145 141 - clint_mtimer5: timer@70ac050000 { 146 + clint_mtimer5: timer@70ac054000 { 142 147 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer"; 143 - reg = <0x00000070 0xac050000 0x00000000 0x00007ff8>; 148 + reg = <0x00000070 0xac054000 0x00000000 0x0000c000>; 149 + reg-names = "mtimecmp"; 144 150 interrupts-extended = <&cpu20_intc 7>, 145 151 <&cpu21_intc 7>, 146 152 <&cpu22_intc 7>, 147 153 <&cpu23_intc 7>; 148 154 }; 149 155 150 - clint_mtimer6: timer@70ac060000 { 156 + clint_mtimer6: timer@70ac064000 { 151 157 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer"; 152 - reg = <0x00000070 0xac060000 0x00000000 0x00007ff8>; 158 + reg = <0x00000070 0xac064000 0x00000000 0x0000c000>; 159 + reg-names = "mtimecmp"; 153 160 interrupts-extended = <&cpu24_intc 7>, 154 161 <&cpu25_intc 7>, 155 162 <&cpu26_intc 7>, 156 163 <&cpu27_intc 7>; 157 164 }; 158 165 159 - clint_mtimer7: timer@70ac070000 { 166 + clint_mtimer7: timer@70ac074000 { 160 167 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer"; 161 - reg = <0x00000070 0xac070000 0x00000000 0x00007ff8>; 168 + reg = <0x00000070 0xac074000 0x00000000 0x0000c000>; 169 + reg-names = "mtimecmp"; 162 170 interrupts-extended = <&cpu28_intc 7>, 163 171 <&cpu29_intc 7>, 164 172 <&cpu30_intc 7>, 165 173 <&cpu31_intc 7>; 166 174 }; 167 175 168 - clint_mtimer8: timer@70ac080000 { 176 + clint_mtimer8: timer@70ac084000 { 169 177 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer"; 170 - reg = <0x00000070 0xac080000 0x00000000 0x00007ff8>; 178 + reg = <0x00000070 0xac084000 0x00000000 0x0000c000>; 179 + reg-names = "mtimecmp"; 171 180 interrupts-extended = <&cpu32_intc 7>, 172 181 <&cpu33_intc 7>, 173 182 <&cpu34_intc 7>, 174 183 <&cpu35_intc 7>; 175 184 }; 176 185 177 - clint_mtimer9: timer@70ac090000 { 186 + clint_mtimer9: timer@70ac094000 { 178 187 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer"; 179 - reg = <0x00000070 0xac090000 0x00000000 0x00007ff8>; 188 + reg = <0x00000070 0xac094000 0x00000000 0x0000c000>; 189 + reg-names = "mtimecmp"; 180 190 interrupts-extended = <&cpu36_intc 7>, 181 191 <&cpu37_intc 7>, 182 192 <&cpu38_intc 7>, 183 193 <&cpu39_intc 7>; 184 194 }; 185 195 186 - clint_mtimer10: timer@70ac0a0000 { 196 + clint_mtimer10: timer@70ac0a4000 { 187 197 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer"; 188 - reg = <0x00000070 0xac0a0000 0x00000000 0x00007ff8>; 198 + reg = <0x00000070 0xac0a4000 0x00000000 0x0000c000>; 199 + reg-names = "mtimecmp"; 189 200 interrupts-extended = <&cpu40_intc 7>, 190 201 <&cpu41_intc 7>, 191 202 <&cpu42_intc 7>, 192 203 <&cpu43_intc 7>; 193 204 }; 194 205 195 - clint_mtimer11: timer@70ac0b0000 { 206 + clint_mtimer11: timer@70ac0b4000 { 196 207 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer"; 197 - reg = <0x00000070 0xac0b0000 0x00000000 0x00007ff8>; 208 + reg = <0x00000070 0xac0b4000 0x00000000 0x0000c000>; 209 + reg-names = "mtimecmp"; 198 210 interrupts-extended = <&cpu44_intc 7>, 199 211 <&cpu45_intc 7>, 200 212 <&cpu46_intc 7>, 201 213 <&cpu47_intc 7>; 202 214 }; 203 215 204 - clint_mtimer12: timer@70ac0c0000 { 216 + clint_mtimer12: timer@70ac0c4000 { 205 217 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer"; 206 - reg = <0x00000070 0xac0c0000 0x00000000 0x00007ff8>; 218 + reg = <0x00000070 0xac0c4000 0x00000000 0x0000c000>; 219 + reg-names = "mtimecmp"; 207 220 interrupts-extended = <&cpu48_intc 7>, 208 221 <&cpu49_intc 7>, 209 222 <&cpu50_intc 7>, 210 223 <&cpu51_intc 7>; 211 224 }; 212 225 213 - clint_mtimer13: timer@70ac0d0000 { 226 + clint_mtimer13: timer@70ac0d4000 { 214 227 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer"; 215 - reg = <0x00000070 0xac0d0000 0x00000000 0x00007ff8>; 228 + reg = <0x00000070 0xac0d4000 0x00000000 0x0000c000>; 229 + reg-names = "mtimecmp"; 216 230 interrupts-extended = <&cpu52_intc 7>, 217 231 <&cpu53_intc 7>, 218 232 <&cpu54_intc 7>, 219 233 <&cpu55_intc 7>; 220 234 }; 221 235 222 - clint_mtimer14: timer@70ac0e0000 { 236 + clint_mtimer14: timer@70ac0e4000 { 223 237 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer"; 224 - reg = <0x00000070 0xac0e0000 0x00000000 0x00007ff8>; 238 + reg = <0x00000070 0xac0e4000 0x00000000 0x0000c000>; 239 + reg-names = "mtimecmp"; 225 240 interrupts-extended = <&cpu56_intc 7>, 226 241 <&cpu57_intc 7>, 227 242 <&cpu58_intc 7>, 228 243 <&cpu59_intc 7>; 229 244 }; 230 245 231 - clint_mtimer15: timer@70ac0f0000 { 246 + clint_mtimer15: timer@70ac0f4000 { 232 247 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer"; 233 - reg = <0x00000070 0xac0f0000 0x00000000 0x00007ff8>; 248 + reg = <0x00000070 0xac0f4000 0x00000000 0x0000c000>; 249 + reg-names = "mtimecmp"; 234 250 interrupts-extended = <&cpu60_intc 7>, 235 251 <&cpu61_intc 7>, 236 252 <&cpu62_intc 7>,
+3 -2
arch/riscv/net/bpf_jit_comp64.c
··· 795 795 struct bpf_tramp_links *fentry = &tlinks[BPF_TRAMP_FENTRY]; 796 796 struct bpf_tramp_links *fexit = &tlinks[BPF_TRAMP_FEXIT]; 797 797 struct bpf_tramp_links *fmod_ret = &tlinks[BPF_TRAMP_MODIFY_RETURN]; 798 + bool is_struct_ops = flags & BPF_TRAMP_F_INDIRECT; 798 799 void *orig_call = func_addr; 799 800 bool save_ret; 800 801 u32 insn; ··· 879 878 880 879 stack_size = round_up(stack_size, 16); 881 880 882 - if (func_addr) { 881 + if (!is_struct_ops) { 883 882 /* For the trampoline called from function entry, 884 883 * the frame of traced function and the frame of 885 884 * trampoline need to be considered. ··· 999 998 1000 999 emit_ld(RV_REG_S1, -sreg_off, RV_REG_FP, ctx); 1001 1000 1002 - if (func_addr) { 1001 + if (!is_struct_ops) { 1003 1002 /* trampoline called from function entry */ 1004 1003 emit_ld(RV_REG_T0, stack_size - 8, RV_REG_SP, ctx); 1005 1004 emit_ld(RV_REG_FP, stack_size - 16, RV_REG_SP, ctx);
+1 -3
arch/x86/include/asm/cpufeatures.h
··· 81 81 #define X86_FEATURE_K6_MTRR ( 3*32+ 1) /* AMD K6 nonstandard MTRRs */ 82 82 #define X86_FEATURE_CYRIX_ARR ( 3*32+ 2) /* Cyrix ARRs (= MTRRs) */ 83 83 #define X86_FEATURE_CENTAUR_MCR ( 3*32+ 3) /* Centaur MCRs (= MTRRs) */ 84 - 85 - /* CPU types for specific tunings: */ 86 84 #define X86_FEATURE_K8 ( 3*32+ 4) /* "" Opteron, Athlon64 */ 87 - /* FREE, was #define X86_FEATURE_K7 ( 3*32+ 5) "" Athlon */ 85 + #define X86_FEATURE_ZEN5 ( 3*32+ 5) /* "" CPU based on Zen5 microarchitecture */ 88 86 #define X86_FEATURE_P3 ( 3*32+ 6) /* "" P3 */ 89 87 #define X86_FEATURE_P4 ( 3*32+ 7) /* "" P4 */ 90 88 #define X86_FEATURE_CONSTANT_TSC ( 3*32+ 8) /* TSC ticks at a constant rate */
+2
arch/x86/include/asm/intel-family.h
··· 162 162 #define INTEL_FAM6_ATOM_CRESTMONT_X 0xAF /* Sierra Forest */ 163 163 #define INTEL_FAM6_ATOM_CRESTMONT 0xB6 /* Grand Ridge */ 164 164 165 + #define INTEL_FAM6_ATOM_DARKMONT_X 0xDD /* Clearwater Forest */ 166 + 165 167 /* Xeon Phi */ 166 168 167 169 #define INTEL_FAM6_XEON_PHI_KNL 0x57 /* Knights Landing */
+21 -4
arch/x86/include/asm/syscall_wrapper.h
··· 58 58 ,,regs->di,,regs->si,,regs->dx \ 59 59 ,,regs->r10,,regs->r8,,regs->r9) \ 60 60 61 + 62 + /* SYSCALL_PT_ARGS is Adapted from s390x */ 63 + #define SYSCALL_PT_ARG6(m, t1, t2, t3, t4, t5, t6) \ 64 + SYSCALL_PT_ARG5(m, t1, t2, t3, t4, t5), m(t6, (regs->bp)) 65 + #define SYSCALL_PT_ARG5(m, t1, t2, t3, t4, t5) \ 66 + SYSCALL_PT_ARG4(m, t1, t2, t3, t4), m(t5, (regs->di)) 67 + #define SYSCALL_PT_ARG4(m, t1, t2, t3, t4) \ 68 + SYSCALL_PT_ARG3(m, t1, t2, t3), m(t4, (regs->si)) 69 + #define SYSCALL_PT_ARG3(m, t1, t2, t3) \ 70 + SYSCALL_PT_ARG2(m, t1, t2), m(t3, (regs->dx)) 71 + #define SYSCALL_PT_ARG2(m, t1, t2) \ 72 + SYSCALL_PT_ARG1(m, t1), m(t2, (regs->cx)) 73 + #define SYSCALL_PT_ARG1(m, t1) m(t1, (regs->bx)) 74 + #define SYSCALL_PT_ARGS(x, ...) SYSCALL_PT_ARG##x(__VA_ARGS__) 75 + 76 + #define __SC_COMPAT_CAST(t, a) \ 77 + (__typeof(__builtin_choose_expr(__TYPE_IS_L(t), 0, 0U))) \ 78 + (unsigned int)a 79 + 61 80 /* Mapping of registers to parameters for syscalls on i386 */ 62 81 #define SC_IA32_REGS_TO_ARGS(x, ...) \ 63 - __MAP(x,__SC_ARGS \ 64 - ,,(unsigned int)regs->bx,,(unsigned int)regs->cx \ 65 - ,,(unsigned int)regs->dx,,(unsigned int)regs->si \ 66 - ,,(unsigned int)regs->di,,(unsigned int)regs->bp) 82 + SYSCALL_PT_ARGS(x, __SC_COMPAT_CAST, \ 83 + __MAP(x, __SC_TYPE, __VA_ARGS__)) \ 67 84 68 85 #define __SYS_STUB0(abi, name) \ 69 86 long __##abi##_##name(const struct pt_regs *regs); \
+1 -1
arch/x86/kernel/alternative.c
··· 403 403 { 404 404 BUG(); 405 405 } 406 - EXPORT_SYMBOL_GPL(BUG_func); 406 + EXPORT_SYMBOL(BUG_func); 407 407 408 408 #define CALL_RIP_REL_OPCODE 0xff 409 409 #define CALL_RIP_REL_MODRM 0x15
+24 -4
arch/x86/kernel/cpu/amd.c
··· 538 538 539 539 /* Figure out Zen generations: */ 540 540 switch (c->x86) { 541 - case 0x17: { 541 + case 0x17: 542 542 switch (c->x86_model) { 543 543 case 0x00 ... 0x2f: 544 544 case 0x50 ... 0x5f: ··· 554 554 goto warn; 555 555 } 556 556 break; 557 - } 558 - case 0x19: { 557 + 558 + case 0x19: 559 559 switch (c->x86_model) { 560 560 case 0x00 ... 0x0f: 561 561 case 0x20 ... 0x5f: ··· 569 569 goto warn; 570 570 } 571 571 break; 572 - } 572 + 573 + case 0x1a: 574 + switch (c->x86_model) { 575 + case 0x00 ... 0x0f: 576 + case 0x20 ... 0x2f: 577 + case 0x40 ... 0x4f: 578 + case 0x70 ... 0x7f: 579 + setup_force_cpu_cap(X86_FEATURE_ZEN5); 580 + break; 581 + default: 582 + goto warn; 583 + } 584 + break; 585 + 573 586 default: 574 587 break; 575 588 } ··· 1052 1039 msr_set_bit(MSR_ZEN4_BP_CFG, MSR_ZEN4_BP_CFG_SHARED_BTB_FIX_BIT); 1053 1040 } 1054 1041 1042 + static void init_amd_zen5(struct cpuinfo_x86 *c) 1043 + { 1044 + init_amd_zen_common(); 1045 + } 1046 + 1055 1047 static void init_amd(struct cpuinfo_x86 *c) 1056 1048 { 1057 1049 u64 vm_cr; ··· 1102 1084 init_amd_zen3(c); 1103 1085 else if (boot_cpu_has(X86_FEATURE_ZEN4)) 1104 1086 init_amd_zen4(c); 1087 + else if (boot_cpu_has(X86_FEATURE_ZEN5)) 1088 + init_amd_zen5(c); 1105 1089 1106 1090 /* 1107 1091 * Enable workaround for FXSAVE leak on CPUs
+10 -3
block/blk-map.c
··· 205 205 /* 206 206 * success 207 207 */ 208 - if ((iov_iter_rw(iter) == WRITE && 209 - (!map_data || !map_data->null_mapped)) || 210 - (map_data && map_data->from_user)) { 208 + if (iov_iter_rw(iter) == WRITE && 209 + (!map_data || !map_data->null_mapped)) { 211 210 ret = bio_copy_from_iter(bio, iter); 211 + if (ret) 212 + goto cleanup; 213 + } else if (map_data && map_data->from_user) { 214 + struct iov_iter iter2 = *iter; 215 + 216 + /* This is the copy-in part of SG_DXFER_TO_FROM_DEV. */ 217 + iter2.data_source = ITER_SOURCE; 218 + ret = bio_copy_from_iter(bio, &iter2); 212 219 if (ret) 213 220 goto cleanup; 214 221 } else {
-2
block/ioctl.c
··· 20 20 struct blkpg_partition p; 21 21 sector_t start, length; 22 22 23 - if (disk->flags & GENHD_FL_NO_PART) 24 - return -EINVAL; 25 23 if (!capable(CAP_SYS_ADMIN)) 26 24 return -EACCES; 27 25 if (copy_from_user(&p, upart, sizeof(struct blkpg_partition)))
+5
block/partitions/core.c
··· 439 439 goto out; 440 440 } 441 441 442 + if (disk->flags & GENHD_FL_NO_PART) { 443 + ret = -EINVAL; 444 + goto out; 445 + } 446 + 442 447 if (partition_overlaps(disk, start, length, -1)) { 443 448 ret = -EBUSY; 444 449 goto out;
+16 -4
drivers/accel/ivpu/ivpu_debugfs.c
··· 102 102 { 103 103 struct ivpu_device *vdev = seq_to_ivpu(s); 104 104 105 - seq_printf(s, "%d\n", atomic_read(&vdev->pm->in_reset)); 105 + seq_printf(s, "%d\n", atomic_read(&vdev->pm->reset_pending)); 106 106 return 0; 107 107 } 108 108 ··· 130 130 131 131 fw->dvfs_mode = dvfs_mode; 132 132 133 - ivpu_pm_schedule_recovery(vdev); 133 + ret = pci_try_reset_function(to_pci_dev(vdev->drm.dev)); 134 + if (ret) 135 + return ret; 134 136 135 137 return size; 136 138 } ··· 192 190 return ret; 193 191 194 192 ivpu_hw_profiling_freq_drive(vdev, enable); 195 - ivpu_pm_schedule_recovery(vdev); 193 + 194 + ret = pci_try_reset_function(to_pci_dev(vdev->drm.dev)); 195 + if (ret) 196 + return ret; 196 197 197 198 return size; 198 199 } ··· 306 301 ivpu_force_recovery_fn(struct file *file, const char __user *user_buf, size_t size, loff_t *pos) 307 302 { 308 303 struct ivpu_device *vdev = file->private_data; 304 + int ret; 309 305 310 306 if (!size) 311 307 return -EINVAL; 312 308 313 - ivpu_pm_schedule_recovery(vdev); 309 + ret = ivpu_rpm_get(vdev); 310 + if (ret) 311 + return ret; 312 + 313 + ivpu_pm_trigger_recovery(vdev, "debugfs"); 314 + flush_work(&vdev->pm->recovery_work); 315 + ivpu_rpm_put(vdev); 314 316 return size; 315 317 } 316 318
+70 -54
drivers/accel/ivpu/ivpu_drv.c
··· 6 6 #include <linux/firmware.h> 7 7 #include <linux/module.h> 8 8 #include <linux/pci.h> 9 + #include <linux/pm_runtime.h> 9 10 10 11 #include <drm/drm_accel.h> 11 12 #include <drm/drm_file.h> ··· 18 17 #include "ivpu_debugfs.h" 19 18 #include "ivpu_drv.h" 20 19 #include "ivpu_fw.h" 20 + #include "ivpu_fw_log.h" 21 21 #include "ivpu_gem.h" 22 22 #include "ivpu_hw.h" 23 23 #include "ivpu_ipc.h" ··· 67 65 return file_priv; 68 66 } 69 67 70 - struct ivpu_file_priv *ivpu_file_priv_get_by_ctx_id(struct ivpu_device *vdev, unsigned long id) 68 + static void file_priv_unbind(struct ivpu_device *vdev, struct ivpu_file_priv *file_priv) 71 69 { 72 - struct ivpu_file_priv *file_priv; 70 + mutex_lock(&file_priv->lock); 71 + if (file_priv->bound) { 72 + ivpu_dbg(vdev, FILE, "file_priv unbind: ctx %u\n", file_priv->ctx.id); 73 73 74 - xa_lock_irq(&vdev->context_xa); 75 - file_priv = xa_load(&vdev->context_xa, id); 76 - /* file_priv may still be in context_xa during file_priv_release() */ 77 - if (file_priv && !kref_get_unless_zero(&file_priv->ref)) 78 - file_priv = NULL; 79 - xa_unlock_irq(&vdev->context_xa); 80 - 81 - if (file_priv) 82 - ivpu_dbg(vdev, KREF, "file_priv get by id: ctx %u refcount %u\n", 83 - file_priv->ctx.id, kref_read(&file_priv->ref)); 84 - 85 - return file_priv; 74 + ivpu_cmdq_release_all_locked(file_priv); 75 + ivpu_jsm_context_release(vdev, file_priv->ctx.id); 76 + ivpu_bo_unbind_all_bos_from_context(vdev, &file_priv->ctx); 77 + ivpu_mmu_user_context_fini(vdev, &file_priv->ctx); 78 + file_priv->bound = false; 79 + drm_WARN_ON(&vdev->drm, !xa_erase_irq(&vdev->context_xa, file_priv->ctx.id)); 80 + } 81 + mutex_unlock(&file_priv->lock); 86 82 } 87 83 88 84 static void file_priv_release(struct kref *ref) ··· 88 88 struct ivpu_file_priv *file_priv = container_of(ref, struct ivpu_file_priv, ref); 89 89 struct ivpu_device *vdev = file_priv->vdev; 90 90 91 - ivpu_dbg(vdev, FILE, "file_priv release: ctx %u\n", file_priv->ctx.id); 91 + ivpu_dbg(vdev, FILE, "file_priv release: ctx %u bound %d\n", 92 + file_priv->ctx.id, (bool)file_priv->bound); 92 93 93 - ivpu_cmdq_release_all(file_priv); 94 - ivpu_jsm_context_release(vdev, file_priv->ctx.id); 95 - ivpu_bo_remove_all_bos_from_context(vdev, &file_priv->ctx); 96 - ivpu_mmu_user_context_fini(vdev, &file_priv->ctx); 97 - drm_WARN_ON(&vdev->drm, xa_erase_irq(&vdev->context_xa, file_priv->ctx.id) != file_priv); 94 + pm_runtime_get_sync(vdev->drm.dev); 95 + mutex_lock(&vdev->context_list_lock); 96 + file_priv_unbind(vdev, file_priv); 97 + mutex_unlock(&vdev->context_list_lock); 98 + pm_runtime_put_autosuspend(vdev->drm.dev); 99 + 98 100 mutex_destroy(&file_priv->lock); 99 101 kfree(file_priv); 100 102 } ··· 178 176 case DRM_IVPU_PARAM_CONTEXT_BASE_ADDRESS: 179 177 args->value = vdev->hw->ranges.user.start; 180 178 break; 181 - case DRM_IVPU_PARAM_CONTEXT_PRIORITY: 182 - args->value = file_priv->priority; 183 - break; 184 179 case DRM_IVPU_PARAM_CONTEXT_ID: 185 180 args->value = file_priv->ctx.id; 186 181 break; ··· 217 218 218 219 static int ivpu_set_param_ioctl(struct drm_device *dev, void *data, struct drm_file *file) 219 220 { 220 - struct ivpu_file_priv *file_priv = file->driver_priv; 221 221 struct drm_ivpu_param *args = data; 222 222 int ret = 0; 223 223 224 224 switch (args->param) { 225 - case DRM_IVPU_PARAM_CONTEXT_PRIORITY: 226 - if (args->value <= DRM_IVPU_CONTEXT_PRIORITY_REALTIME) 227 - file_priv->priority = args->value; 228 - else 229 - ret = -EINVAL; 230 - break; 231 225 default: 232 226 ret = -EINVAL; 233 227 } ··· 233 241 struct ivpu_device *vdev = to_ivpu_device(dev); 234 242 struct ivpu_file_priv *file_priv; 235 243 u32 ctx_id; 236 - void *old; 237 - int ret; 244 + int idx, ret; 238 245 239 - ret = xa_alloc_irq(&vdev->context_xa, &ctx_id, NULL, vdev->context_xa_limit, GFP_KERNEL); 240 - if (ret) { 241 - ivpu_err(vdev, "Failed to allocate context id: %d\n", ret); 242 - return ret; 243 - } 246 + if (!drm_dev_enter(dev, &idx)) 247 + return -ENODEV; 244 248 245 249 file_priv = kzalloc(sizeof(*file_priv), GFP_KERNEL); 246 250 if (!file_priv) { 247 251 ret = -ENOMEM; 248 - goto err_xa_erase; 252 + goto err_dev_exit; 249 253 } 250 254 251 255 file_priv->vdev = vdev; 252 - file_priv->priority = DRM_IVPU_CONTEXT_PRIORITY_NORMAL; 256 + file_priv->bound = true; 253 257 kref_init(&file_priv->ref); 254 258 mutex_init(&file_priv->lock); 255 259 260 + mutex_lock(&vdev->context_list_lock); 261 + 262 + ret = xa_alloc_irq(&vdev->context_xa, &ctx_id, file_priv, 263 + vdev->context_xa_limit, GFP_KERNEL); 264 + if (ret) { 265 + ivpu_err(vdev, "Failed to allocate context id: %d\n", ret); 266 + goto err_unlock; 267 + } 268 + 256 269 ret = ivpu_mmu_user_context_init(vdev, &file_priv->ctx, ctx_id); 257 270 if (ret) 258 - goto err_mutex_destroy; 271 + goto err_xa_erase; 259 272 260 - old = xa_store_irq(&vdev->context_xa, ctx_id, file_priv, GFP_KERNEL); 261 - if (xa_is_err(old)) { 262 - ret = xa_err(old); 263 - ivpu_err(vdev, "Failed to store context %u: %d\n", ctx_id, ret); 264 - goto err_ctx_fini; 265 - } 273 + mutex_unlock(&vdev->context_list_lock); 274 + drm_dev_exit(idx); 275 + 276 + file->driver_priv = file_priv; 266 277 267 278 ivpu_dbg(vdev, FILE, "file_priv create: ctx %u process %s pid %d\n", 268 279 ctx_id, current->comm, task_pid_nr(current)); 269 280 270 - file->driver_priv = file_priv; 271 281 return 0; 272 282 273 - err_ctx_fini: 274 - ivpu_mmu_user_context_fini(vdev, &file_priv->ctx); 275 - err_mutex_destroy: 276 - mutex_destroy(&file_priv->lock); 277 - kfree(file_priv); 278 283 err_xa_erase: 279 284 xa_erase_irq(&vdev->context_xa, ctx_id); 285 + err_unlock: 286 + mutex_unlock(&vdev->context_list_lock); 287 + mutex_destroy(&file_priv->lock); 288 + kfree(file_priv); 289 + err_dev_exit: 290 + drm_dev_exit(idx); 280 291 return ret; 281 292 } 282 293 ··· 335 340 336 341 if (!ret) 337 342 ivpu_dbg(vdev, PM, "VPU ready message received successfully\n"); 338 - else 339 - ivpu_hw_diagnose_failure(vdev); 340 343 341 344 return ret; 342 345 } ··· 362 369 ret = ivpu_wait_for_ready(vdev); 363 370 if (ret) { 364 371 ivpu_err(vdev, "Failed to boot the firmware: %d\n", ret); 372 + ivpu_hw_diagnose_failure(vdev); 373 + ivpu_mmu_evtq_dump(vdev); 374 + ivpu_fw_log_dump(vdev); 365 375 return ret; 366 376 } 367 377 ··· 536 540 lockdep_set_class(&vdev->submitted_jobs_xa.xa_lock, &submitted_jobs_xa_lock_class_key); 537 541 INIT_LIST_HEAD(&vdev->bo_list); 538 542 543 + ret = drmm_mutex_init(&vdev->drm, &vdev->context_list_lock); 544 + if (ret) 545 + goto err_xa_destroy; 546 + 539 547 ret = drmm_mutex_init(&vdev->drm, &vdev->bo_list_lock); 540 548 if (ret) 541 549 goto err_xa_destroy; ··· 611 611 return ret; 612 612 } 613 613 614 + static void ivpu_bo_unbind_all_user_contexts(struct ivpu_device *vdev) 615 + { 616 + struct ivpu_file_priv *file_priv; 617 + unsigned long ctx_id; 618 + 619 + mutex_lock(&vdev->context_list_lock); 620 + 621 + xa_for_each(&vdev->context_xa, ctx_id, file_priv) 622 + file_priv_unbind(vdev, file_priv); 623 + 624 + mutex_unlock(&vdev->context_list_lock); 625 + } 626 + 614 627 static void ivpu_dev_fini(struct ivpu_device *vdev) 615 628 { 616 629 ivpu_pm_disable(vdev); 617 630 ivpu_shutdown(vdev); 618 631 if (IVPU_WA(d3hot_after_power_off)) 619 632 pci_set_power_state(to_pci_dev(vdev->drm.dev), PCI_D3hot); 633 + 634 + ivpu_jobs_abort_all(vdev); 620 635 ivpu_job_done_consumer_fini(vdev); 621 636 ivpu_pm_cancel_recovery(vdev); 637 + ivpu_bo_unbind_all_user_contexts(vdev); 622 638 623 639 ivpu_ipc_fini(vdev); 624 640 ivpu_fw_fini(vdev);
+3 -2
drivers/accel/ivpu/ivpu_drv.h
··· 56 56 #define IVPU_DBG_JSM BIT(10) 57 57 #define IVPU_DBG_KREF BIT(11) 58 58 #define IVPU_DBG_RPM BIT(12) 59 + #define IVPU_DBG_MMU_MAP BIT(13) 59 60 60 61 #define ivpu_err(vdev, fmt, ...) \ 61 62 drm_err(&(vdev)->drm, "%s(): " fmt, __func__, ##__VA_ARGS__) ··· 115 114 116 115 struct ivpu_mmu_context gctx; 117 116 struct ivpu_mmu_context rctx; 117 + struct mutex context_list_lock; /* Protects user context addition/removal */ 118 118 struct xarray context_xa; 119 119 struct xa_limit context_xa_limit; 120 120 ··· 147 145 struct mutex lock; /* Protects cmdq */ 148 146 struct ivpu_cmdq *cmdq[IVPU_NUM_ENGINES]; 149 147 struct ivpu_mmu_context ctx; 150 - u32 priority; 151 148 bool has_mmu_faults; 149 + bool bound; 152 150 }; 153 151 154 152 extern int ivpu_dbg_mask; ··· 164 162 extern int ivpu_test_mode; 165 163 166 164 struct ivpu_file_priv *ivpu_file_priv_get(struct ivpu_file_priv *file_priv); 167 - struct ivpu_file_priv *ivpu_file_priv_get_by_ctx_id(struct ivpu_device *vdev, unsigned long id); 168 165 void ivpu_file_priv_put(struct ivpu_file_priv **link); 169 166 170 167 int ivpu_boot(struct ivpu_device *vdev);
+53 -91
drivers/accel/ivpu/ivpu_gem.c
··· 24 24 25 25 static inline void ivpu_dbg_bo(struct ivpu_device *vdev, struct ivpu_bo *bo, const char *action) 26 26 { 27 - if (bo->ctx) 28 - ivpu_dbg(vdev, BO, "%6s: size %zu has_pages %d dma_mapped %d handle %u ctx %d vpu_addr 0x%llx mmu_mapped %d\n", 29 - action, ivpu_bo_size(bo), (bool)bo->base.pages, (bool)bo->base.sgt, 30 - bo->handle, bo->ctx->id, bo->vpu_addr, bo->mmu_mapped); 31 - else 32 - ivpu_dbg(vdev, BO, "%6s: size %zu has_pages %d dma_mapped %d handle %u (not added to context)\n", 33 - action, ivpu_bo_size(bo), (bool)bo->base.pages, (bool)bo->base.sgt, 34 - bo->handle); 27 + ivpu_dbg(vdev, BO, 28 + "%6s: bo %8p vpu_addr %9llx size %8zu ctx %d has_pages %d dma_mapped %d mmu_mapped %d wc %d imported %d\n", 29 + action, bo, bo->vpu_addr, ivpu_bo_size(bo), bo->ctx ? bo->ctx->id : 0, 30 + (bool)bo->base.pages, (bool)bo->base.sgt, bo->mmu_mapped, bo->base.map_wc, 31 + (bool)bo->base.base.import_attach); 35 32 } 36 33 37 34 /* ··· 46 49 mutex_lock(&bo->lock); 47 50 48 51 ivpu_dbg_bo(vdev, bo, "pin"); 49 - 50 - if (!bo->ctx) { 51 - ivpu_err(vdev, "vpu_addr not allocated for BO %d\n", bo->handle); 52 - ret = -EINVAL; 53 - goto unlock; 54 - } 52 + drm_WARN_ON(&vdev->drm, !bo->ctx); 55 53 56 54 if (!bo->mmu_mapped) { 57 55 struct sg_table *sgt = drm_gem_shmem_get_pages_sgt(&bo->base); ··· 77 85 const struct ivpu_addr_range *range) 78 86 { 79 87 struct ivpu_device *vdev = ivpu_bo_to_vdev(bo); 80 - int ret; 88 + int idx, ret; 89 + 90 + if (!drm_dev_enter(&vdev->drm, &idx)) 91 + return -ENODEV; 81 92 82 93 mutex_lock(&bo->lock); 83 94 ··· 96 101 97 102 mutex_unlock(&bo->lock); 98 103 104 + drm_dev_exit(idx); 105 + 99 106 return ret; 100 107 } 101 108 ··· 105 108 { 106 109 struct ivpu_device *vdev = ivpu_bo_to_vdev(bo); 107 110 108 - lockdep_assert_held(&bo->lock); 109 - 110 - ivpu_dbg_bo(vdev, bo, "unbind"); 111 - 112 - /* TODO: dma_unmap */ 111 + lockdep_assert(lockdep_is_held(&bo->lock) || !kref_read(&bo->base.base.refcount)); 113 112 114 113 if (bo->mmu_mapped) { 115 114 drm_WARN_ON(&vdev->drm, !bo->ctx); ··· 117 124 118 125 if (bo->ctx) { 119 126 ivpu_mmu_context_remove_node(bo->ctx, &bo->mm_node); 120 - bo->vpu_addr = 0; 121 127 bo->ctx = NULL; 122 128 } 129 + 130 + if (bo->base.base.import_attach) 131 + return; 132 + 133 + dma_resv_lock(bo->base.base.resv, NULL); 134 + if (bo->base.sgt) { 135 + dma_unmap_sgtable(vdev->drm.dev, bo->base.sgt, DMA_BIDIRECTIONAL, 0); 136 + sg_free_table(bo->base.sgt); 137 + kfree(bo->base.sgt); 138 + bo->base.sgt = NULL; 139 + } 140 + dma_resv_unlock(bo->base.base.resv); 123 141 } 124 142 125 - static void ivpu_bo_unbind(struct ivpu_bo *bo) 126 - { 127 - mutex_lock(&bo->lock); 128 - ivpu_bo_unbind_locked(bo); 129 - mutex_unlock(&bo->lock); 130 - } 131 - 132 - void ivpu_bo_remove_all_bos_from_context(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx) 143 + void ivpu_bo_unbind_all_bos_from_context(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx) 133 144 { 134 145 struct ivpu_bo *bo; 135 146 ··· 143 146 mutex_lock(&vdev->bo_list_lock); 144 147 list_for_each_entry(bo, &vdev->bo_list, bo_list_node) { 145 148 mutex_lock(&bo->lock); 146 - if (bo->ctx == ctx) 149 + if (bo->ctx == ctx) { 150 + ivpu_dbg_bo(vdev, bo, "unbind"); 147 151 ivpu_bo_unbind_locked(bo); 152 + } 148 153 mutex_unlock(&bo->lock); 149 154 } 150 155 mutex_unlock(&vdev->bo_list_lock); ··· 198 199 list_add_tail(&bo->bo_list_node, &vdev->bo_list); 199 200 mutex_unlock(&vdev->bo_list_lock); 200 201 201 - ivpu_dbg(vdev, BO, "create: vpu_addr 0x%llx size %zu flags 0x%x\n", 202 - bo->vpu_addr, bo->base.base.size, flags); 203 - 204 202 return bo; 205 203 } 206 204 ··· 207 211 struct ivpu_device *vdev = file_priv->vdev; 208 212 struct ivpu_bo *bo = to_ivpu_bo(obj); 209 213 struct ivpu_addr_range *range; 214 + 215 + if (bo->ctx) { 216 + ivpu_warn(vdev, "Can't add BO to ctx %u: already in ctx %u\n", 217 + file_priv->ctx.id, bo->ctx->id); 218 + return -EALREADY; 219 + } 210 220 211 221 if (bo->flags & DRM_IVPU_BO_SHAVE_MEM) 212 222 range = &vdev->hw->ranges.shave; ··· 229 227 struct ivpu_device *vdev = to_ivpu_device(obj->dev); 230 228 struct ivpu_bo *bo = to_ivpu_bo(obj); 231 229 230 + ivpu_dbg_bo(vdev, bo, "free"); 231 + 232 232 mutex_lock(&vdev->bo_list_lock); 233 233 list_del(&bo->bo_list_node); 234 234 mutex_unlock(&vdev->bo_list_lock); 235 235 236 236 drm_WARN_ON(&vdev->drm, !dma_resv_test_signaled(obj->resv, DMA_RESV_USAGE_READ)); 237 237 238 - ivpu_dbg_bo(vdev, bo, "free"); 239 - 240 - ivpu_bo_unbind(bo); 238 + ivpu_bo_unbind_locked(bo); 241 239 mutex_destroy(&bo->lock); 242 240 243 241 drm_WARN_ON(obj->dev, bo->base.pages_use_count > 1); 244 242 drm_gem_shmem_free(&bo->base); 245 243 } 246 244 247 - static const struct dma_buf_ops ivpu_bo_dmabuf_ops = { 248 - .cache_sgt_mapping = true, 249 - .attach = drm_gem_map_attach, 250 - .detach = drm_gem_map_detach, 251 - .map_dma_buf = drm_gem_map_dma_buf, 252 - .unmap_dma_buf = drm_gem_unmap_dma_buf, 253 - .release = drm_gem_dmabuf_release, 254 - .mmap = drm_gem_dmabuf_mmap, 255 - .vmap = drm_gem_dmabuf_vmap, 256 - .vunmap = drm_gem_dmabuf_vunmap, 257 - }; 258 - 259 - static struct dma_buf *ivpu_bo_export(struct drm_gem_object *obj, int flags) 260 - { 261 - struct drm_device *dev = obj->dev; 262 - struct dma_buf_export_info exp_info = { 263 - .exp_name = KBUILD_MODNAME, 264 - .owner = dev->driver->fops->owner, 265 - .ops = &ivpu_bo_dmabuf_ops, 266 - .size = obj->size, 267 - .flags = flags, 268 - .priv = obj, 269 - .resv = obj->resv, 270 - }; 271 - void *sgt; 272 - 273 - /* 274 - * Make sure that pages are allocated and dma-mapped before exporting the bo. 275 - * DMA-mapping is required if the bo will be imported to the same device. 276 - */ 277 - sgt = drm_gem_shmem_get_pages_sgt(to_drm_gem_shmem_obj(obj)); 278 - if (IS_ERR(sgt)) 279 - return sgt; 280 - 281 - return drm_gem_dmabuf_export(dev, &exp_info); 282 - } 283 - 284 245 static const struct drm_gem_object_funcs ivpu_gem_funcs = { 285 246 .free = ivpu_bo_free, 286 247 .open = ivpu_bo_open, 287 - .export = ivpu_bo_export, 288 248 .print_info = drm_gem_shmem_object_print_info, 289 249 .pin = drm_gem_shmem_object_pin, 290 250 .unpin = drm_gem_shmem_object_unpin, ··· 279 315 return PTR_ERR(bo); 280 316 } 281 317 282 - ret = drm_gem_handle_create(file, &bo->base.base, &bo->handle); 283 - if (!ret) { 318 + ret = drm_gem_handle_create(file, &bo->base.base, &args->handle); 319 + if (!ret) 284 320 args->vpu_addr = bo->vpu_addr; 285 - args->handle = bo->handle; 286 - } 287 321 288 322 drm_gem_object_put(&bo->base.base); 289 323 ··· 323 361 if (ret) 324 362 goto err_put; 325 363 364 + dma_resv_lock(bo->base.base.resv, NULL); 326 365 ret = drm_gem_shmem_vmap(&bo->base, &map); 366 + dma_resv_unlock(bo->base.base.resv); 327 367 if (ret) 328 368 goto err_put; 329 369 ··· 340 376 { 341 377 struct iosys_map map = IOSYS_MAP_INIT_VADDR(bo->base.vaddr); 342 378 379 + dma_resv_lock(bo->base.base.resv, NULL); 343 380 drm_gem_shmem_vunmap(&bo->base, &map); 381 + dma_resv_unlock(bo->base.base.resv); 382 + 344 383 drm_gem_object_put(&bo->base.base); 345 384 } 346 385 ··· 399 432 400 433 static void ivpu_bo_print_info(struct ivpu_bo *bo, struct drm_printer *p) 401 434 { 402 - unsigned long dma_refcount = 0; 403 - 404 435 mutex_lock(&bo->lock); 405 436 406 - if (bo->base.base.dma_buf && bo->base.base.dma_buf->file) 407 - dma_refcount = atomic_long_read(&bo->base.base.dma_buf->file->f_count); 408 - 409 - drm_printf(p, "%-3u %-6d 0x%-12llx %-10lu 0x%-8x %-4u %-8lu", 410 - bo->ctx->id, bo->handle, bo->vpu_addr, bo->base.base.size, 411 - bo->flags, kref_read(&bo->base.base.refcount), dma_refcount); 412 - 413 - if (bo->base.base.import_attach) 414 - drm_printf(p, " imported"); 437 + drm_printf(p, "%-9p %-3u 0x%-12llx %-10lu 0x%-8x %-4u", 438 + bo, bo->ctx->id, bo->vpu_addr, bo->base.base.size, 439 + bo->flags, kref_read(&bo->base.base.refcount)); 415 440 416 441 if (bo->base.pages) 417 442 drm_printf(p, " has_pages"); 418 443 419 444 if (bo->mmu_mapped) 420 445 drm_printf(p, " mmu_mapped"); 446 + 447 + if (bo->base.base.import_attach) 448 + drm_printf(p, " imported"); 421 449 422 450 drm_printf(p, "\n"); 423 451 ··· 424 462 struct ivpu_device *vdev = to_ivpu_device(dev); 425 463 struct ivpu_bo *bo; 426 464 427 - drm_printf(p, "%-3s %-6s %-14s %-10s %-10s %-4s %-8s %s\n", 428 - "ctx", "handle", "vpu_addr", "size", "flags", "refs", "dma_refs", "attribs"); 465 + drm_printf(p, "%-9s %-3s %-14s %-10s %-10s %-4s %s\n", 466 + "bo", "ctx", "vpu_addr", "size", "flags", "refs", "attribs"); 429 467 430 468 mutex_lock(&vdev->bo_list_lock); 431 469 list_for_each_entry(bo, &vdev->bo_list, bo_list_node)
+1 -2
drivers/accel/ivpu/ivpu_gem.h
··· 19 19 20 20 struct mutex lock; /* Protects: ctx, mmu_mapped, vpu_addr */ 21 21 u64 vpu_addr; 22 - u32 handle; 23 22 u32 flags; 24 23 u32 job_status; /* Valid only for command buffer */ 25 24 bool mmu_mapped; 26 25 }; 27 26 28 27 int ivpu_bo_pin(struct ivpu_bo *bo); 29 - void ivpu_bo_remove_all_bos_from_context(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx); 28 + void ivpu_bo_unbind_all_bos_from_context(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx); 30 29 31 30 struct drm_gem_object *ivpu_gem_create_object(struct drm_device *dev, size_t size); 32 31 struct ivpu_bo *ivpu_bo_alloc_internal(struct ivpu_device *vdev, u64 vpu_addr, u64 size, u32 flags);
+4 -10
drivers/accel/ivpu/ivpu_hw_37xx.c
··· 875 875 876 876 static void ivpu_hw_37xx_irq_wdt_nce_handler(struct ivpu_device *vdev) 877 877 { 878 - ivpu_err_ratelimited(vdev, "WDT NCE irq\n"); 879 - 880 - ivpu_pm_schedule_recovery(vdev); 878 + ivpu_pm_trigger_recovery(vdev, "WDT NCE IRQ"); 881 879 } 882 880 883 881 static void ivpu_hw_37xx_irq_wdt_mss_handler(struct ivpu_device *vdev) 884 882 { 885 - ivpu_err_ratelimited(vdev, "WDT MSS irq\n"); 886 - 887 883 ivpu_hw_wdt_disable(vdev); 888 - ivpu_pm_schedule_recovery(vdev); 884 + ivpu_pm_trigger_recovery(vdev, "WDT MSS IRQ"); 889 885 } 890 886 891 887 static void ivpu_hw_37xx_irq_noc_firewall_handler(struct ivpu_device *vdev) 892 888 { 893 - ivpu_err_ratelimited(vdev, "NOC Firewall irq\n"); 894 - 895 - ivpu_pm_schedule_recovery(vdev); 889 + ivpu_pm_trigger_recovery(vdev, "NOC Firewall IRQ"); 896 890 } 897 891 898 892 /* Handler for IRQs from VPU core (irqV) */ ··· 964 970 REGB_WR32(VPU_37XX_BUTTRESS_INTERRUPT_STAT, status); 965 971 966 972 if (schedule_recovery) 967 - ivpu_pm_schedule_recovery(vdev); 973 + ivpu_pm_trigger_recovery(vdev, "Buttress IRQ"); 968 974 969 975 return true; 970 976 }
+23 -6
drivers/accel/ivpu/ivpu_hw_40xx.c
··· 746 746 return 0; 747 747 } 748 748 749 - static int ivpu_hw_40xx_reset(struct ivpu_device *vdev) 749 + static int ivpu_hw_40xx_ip_reset(struct ivpu_device *vdev) 750 750 { 751 751 int ret; 752 752 u32 val; ··· 764 764 ret = REGB_POLL_FLD(VPU_40XX_BUTTRESS_IP_RESET, TRIGGER, 0, TIMEOUT_US); 765 765 if (ret) 766 766 ivpu_err(vdev, "Timed out waiting for RESET completion\n"); 767 + 768 + return ret; 769 + } 770 + 771 + static int ivpu_hw_40xx_reset(struct ivpu_device *vdev) 772 + { 773 + int ret = 0; 774 + 775 + if (ivpu_hw_40xx_ip_reset(vdev)) { 776 + ivpu_err(vdev, "Failed to reset VPU IP\n"); 777 + ret = -EIO; 778 + } 779 + 780 + if (ivpu_pll_disable(vdev)) { 781 + ivpu_err(vdev, "Failed to disable PLL\n"); 782 + ret = -EIO; 783 + } 767 784 768 785 return ret; 769 786 } ··· 930 913 931 914 ivpu_hw_40xx_save_d0i3_entry_timestamp(vdev); 932 915 933 - if (!ivpu_hw_40xx_is_idle(vdev) && ivpu_hw_40xx_reset(vdev)) 916 + if (!ivpu_hw_40xx_is_idle(vdev) && ivpu_hw_40xx_ip_reset(vdev)) 934 917 ivpu_warn(vdev, "Failed to reset the VPU\n"); 935 918 936 919 if (ivpu_pll_disable(vdev)) { ··· 1049 1032 static void ivpu_hw_40xx_irq_wdt_nce_handler(struct ivpu_device *vdev) 1050 1033 { 1051 1034 /* TODO: For LNN hang consider engine reset instead of full recovery */ 1052 - ivpu_pm_schedule_recovery(vdev); 1035 + ivpu_pm_trigger_recovery(vdev, "WDT NCE IRQ"); 1053 1036 } 1054 1037 1055 1038 static void ivpu_hw_40xx_irq_wdt_mss_handler(struct ivpu_device *vdev) 1056 1039 { 1057 1040 ivpu_hw_wdt_disable(vdev); 1058 - ivpu_pm_schedule_recovery(vdev); 1041 + ivpu_pm_trigger_recovery(vdev, "WDT MSS IRQ"); 1059 1042 } 1060 1043 1061 1044 static void ivpu_hw_40xx_irq_noc_firewall_handler(struct ivpu_device *vdev) 1062 1045 { 1063 - ivpu_pm_schedule_recovery(vdev); 1046 + ivpu_pm_trigger_recovery(vdev, "NOC Firewall IRQ"); 1064 1047 } 1065 1048 1066 1049 /* Handler for IRQs from VPU core (irqV) */ ··· 1154 1137 REGB_WR32(VPU_40XX_BUTTRESS_INTERRUPT_STAT, status); 1155 1138 1156 1139 if (schedule_recovery) 1157 - ivpu_pm_schedule_recovery(vdev); 1140 + ivpu_pm_trigger_recovery(vdev, "Buttress IRQ"); 1158 1141 1159 1142 return true; 1160 1143 }
+2 -4
drivers/accel/ivpu/ivpu_ipc.c
··· 343 343 hb_ret = ivpu_ipc_send_receive_internal(vdev, &hb_req, VPU_JSM_MSG_QUERY_ENGINE_HB_DONE, 344 344 &hb_resp, VPU_IPC_CHAN_ASYNC_CMD, 345 345 vdev->timeout.jsm); 346 - if (hb_ret == -ETIMEDOUT) { 347 - ivpu_hw_diagnose_failure(vdev); 348 - ivpu_pm_schedule_recovery(vdev); 349 - } 346 + if (hb_ret == -ETIMEDOUT) 347 + ivpu_pm_trigger_recovery(vdev, "IPC timeout"); 350 348 351 349 return ret; 352 350 }
+73 -87
drivers/accel/ivpu/ivpu_job.c
··· 112 112 } 113 113 } 114 114 115 - void ivpu_cmdq_release_all(struct ivpu_file_priv *file_priv) 115 + void ivpu_cmdq_release_all_locked(struct ivpu_file_priv *file_priv) 116 116 { 117 117 int i; 118 118 119 - mutex_lock(&file_priv->lock); 119 + lockdep_assert_held(&file_priv->lock); 120 120 121 121 for (i = 0; i < IVPU_NUM_ENGINES; i++) 122 122 ivpu_cmdq_release_locked(file_priv, i); 123 - 124 - mutex_unlock(&file_priv->lock); 125 123 } 126 124 127 125 /* 128 126 * Mark the doorbell as unregistered and reset job queue pointers. 129 127 * This function needs to be called when the VPU hardware is restarted 130 - * and FW looses job queue state. The next time job queue is used it 128 + * and FW loses job queue state. The next time job queue is used it 131 129 * will be registered again. 132 130 */ 133 131 static void ivpu_cmdq_reset_locked(struct ivpu_file_priv *file_priv, u16 engine) ··· 159 161 struct ivpu_file_priv *file_priv; 160 162 unsigned long ctx_id; 161 163 162 - xa_for_each(&vdev->context_xa, ctx_id, file_priv) { 163 - file_priv = ivpu_file_priv_get_by_ctx_id(vdev, ctx_id); 164 - if (!file_priv) 165 - continue; 164 + mutex_lock(&vdev->context_list_lock); 166 165 166 + xa_for_each(&vdev->context_xa, ctx_id, file_priv) 167 167 ivpu_cmdq_reset_all(file_priv); 168 168 169 - ivpu_file_priv_put(&file_priv); 170 - } 169 + mutex_unlock(&vdev->context_list_lock); 170 + 171 171 } 172 172 173 173 static int ivpu_cmdq_push_job(struct ivpu_cmdq *cmdq, struct ivpu_job *job) ··· 239 243 return &fence->base; 240 244 } 241 245 242 - static void job_get(struct ivpu_job *job, struct ivpu_job **link) 246 + static void ivpu_job_destroy(struct ivpu_job *job) 243 247 { 244 - struct ivpu_device *vdev = job->vdev; 245 - 246 - kref_get(&job->ref); 247 - *link = job; 248 - 249 - ivpu_dbg(vdev, KREF, "Job get: id %u refcount %u\n", job->job_id, kref_read(&job->ref)); 250 - } 251 - 252 - static void job_release(struct kref *ref) 253 - { 254 - struct ivpu_job *job = container_of(ref, struct ivpu_job, ref); 255 248 struct ivpu_device *vdev = job->vdev; 256 249 u32 i; 250 + 251 + ivpu_dbg(vdev, JOB, "Job destroyed: id %3u ctx %2d engine %d", 252 + job->job_id, job->file_priv->ctx.id, job->engine_idx); 257 253 258 254 for (i = 0; i < job->bo_count; i++) 259 255 if (job->bos[i]) ··· 253 265 254 266 dma_fence_put(job->done_fence); 255 267 ivpu_file_priv_put(&job->file_priv); 256 - 257 - ivpu_dbg(vdev, KREF, "Job released: id %u\n", job->job_id); 258 268 kfree(job); 259 - 260 - /* Allow the VPU to get suspended, must be called after ivpu_file_priv_put() */ 261 - ivpu_rpm_put(vdev); 262 - } 263 - 264 - static void job_put(struct ivpu_job *job) 265 - { 266 - struct ivpu_device *vdev = job->vdev; 267 - 268 - ivpu_dbg(vdev, KREF, "Job put: id %u refcount %u\n", job->job_id, kref_read(&job->ref)); 269 - kref_put(&job->ref, job_release); 270 269 } 271 270 272 271 static struct ivpu_job * 273 - ivpu_create_job(struct ivpu_file_priv *file_priv, u32 engine_idx, u32 bo_count) 272 + ivpu_job_create(struct ivpu_file_priv *file_priv, u32 engine_idx, u32 bo_count) 274 273 { 275 274 struct ivpu_device *vdev = file_priv->vdev; 276 275 struct ivpu_job *job; 277 - int ret; 278 - 279 - ret = ivpu_rpm_get(vdev); 280 - if (ret < 0) 281 - return NULL; 282 276 283 277 job = kzalloc(struct_size(job, bos, bo_count), GFP_KERNEL); 284 278 if (!job) 285 - goto err_rpm_put; 286 - 287 - kref_init(&job->ref); 279 + return NULL; 288 280 289 281 job->vdev = vdev; 290 282 job->engine_idx = engine_idx; ··· 278 310 job->file_priv = ivpu_file_priv_get(file_priv); 279 311 280 312 ivpu_dbg(vdev, JOB, "Job created: ctx %2d engine %d", file_priv->ctx.id, job->engine_idx); 281 - 282 313 return job; 283 314 284 315 err_free_job: 285 316 kfree(job); 286 - err_rpm_put: 287 - ivpu_rpm_put(vdev); 288 317 return NULL; 289 318 } 290 319 291 - static int ivpu_job_done(struct ivpu_device *vdev, u32 job_id, u32 job_status) 320 + static int ivpu_job_signal_and_destroy(struct ivpu_device *vdev, u32 job_id, u32 job_status) 292 321 { 293 322 struct ivpu_job *job; 294 323 ··· 302 337 ivpu_dbg(vdev, JOB, "Job complete: id %3u ctx %2d engine %d status 0x%x\n", 303 338 job->job_id, job->file_priv->ctx.id, job->engine_idx, job_status); 304 339 340 + ivpu_job_destroy(job); 305 341 ivpu_stop_job_timeout_detection(vdev); 306 342 307 - job_put(job); 343 + ivpu_rpm_put(vdev); 308 344 return 0; 309 345 } 310 346 ··· 315 349 unsigned long id; 316 350 317 351 xa_for_each(&vdev->submitted_jobs_xa, id, job) 318 - ivpu_job_done(vdev, id, VPU_JSM_STATUS_ABORTED); 352 + ivpu_job_signal_and_destroy(vdev, id, VPU_JSM_STATUS_ABORTED); 319 353 } 320 354 321 - static int ivpu_direct_job_submission(struct ivpu_job *job) 355 + static int ivpu_job_submit(struct ivpu_job *job) 322 356 { 323 357 struct ivpu_file_priv *file_priv = job->file_priv; 324 358 struct ivpu_device *vdev = job->vdev; ··· 326 360 struct ivpu_cmdq *cmdq; 327 361 int ret; 328 362 363 + ret = ivpu_rpm_get(vdev); 364 + if (ret < 0) 365 + return ret; 366 + 329 367 mutex_lock(&file_priv->lock); 330 368 331 369 cmdq = ivpu_cmdq_acquire(job->file_priv, job->engine_idx); 332 370 if (!cmdq) { 333 - ivpu_warn(vdev, "Failed get job queue, ctx %d engine %d\n", 334 - file_priv->ctx.id, job->engine_idx); 371 + ivpu_warn_ratelimited(vdev, "Failed get job queue, ctx %d engine %d\n", 372 + file_priv->ctx.id, job->engine_idx); 335 373 ret = -EINVAL; 336 - goto err_unlock; 374 + goto err_unlock_file_priv; 337 375 } 338 376 339 377 job_id_range.min = FIELD_PREP(JOB_ID_CONTEXT_MASK, (file_priv->ctx.id - 1)); 340 378 job_id_range.max = job_id_range.min | JOB_ID_JOB_MASK; 341 379 342 - job_get(job, &job); 343 - ret = xa_alloc(&vdev->submitted_jobs_xa, &job->job_id, job, job_id_range, GFP_KERNEL); 380 + xa_lock(&vdev->submitted_jobs_xa); 381 + ret = __xa_alloc(&vdev->submitted_jobs_xa, &job->job_id, job, job_id_range, GFP_KERNEL); 344 382 if (ret) { 345 - ivpu_warn_ratelimited(vdev, "Failed to allocate job id: %d\n", ret); 346 - goto err_job_put; 383 + ivpu_dbg(vdev, JOB, "Too many active jobs in ctx %d\n", 384 + file_priv->ctx.id); 385 + ret = -EBUSY; 386 + goto err_unlock_submitted_jobs_xa; 347 387 } 348 388 349 389 ret = ivpu_cmdq_push_job(cmdq, job); 350 390 if (ret) 351 - goto err_xa_erase; 391 + goto err_erase_xa; 352 392 353 393 ivpu_start_job_timeout_detection(vdev); 354 394 355 - ivpu_dbg(vdev, JOB, "Job submitted: id %3u addr 0x%llx ctx %2d engine %d next %d\n", 356 - job->job_id, job->cmd_buf_vpu_addr, file_priv->ctx.id, 357 - job->engine_idx, cmdq->jobq->header.tail); 358 - 359 - if (ivpu_test_mode & IVPU_TEST_MODE_NULL_HW) { 360 - ivpu_job_done(vdev, job->job_id, VPU_JSM_STATUS_SUCCESS); 395 + if (unlikely(ivpu_test_mode & IVPU_TEST_MODE_NULL_HW)) { 361 396 cmdq->jobq->header.head = cmdq->jobq->header.tail; 362 397 wmb(); /* Flush WC buffer for jobq header */ 363 398 } else { 364 399 ivpu_cmdq_ring_db(vdev, cmdq); 365 400 } 366 401 402 + ivpu_dbg(vdev, JOB, "Job submitted: id %3u ctx %2d engine %d addr 0x%llx next %d\n", 403 + job->job_id, file_priv->ctx.id, job->engine_idx, 404 + job->cmd_buf_vpu_addr, cmdq->jobq->header.tail); 405 + 406 + xa_unlock(&vdev->submitted_jobs_xa); 407 + 367 408 mutex_unlock(&file_priv->lock); 409 + 410 + if (unlikely(ivpu_test_mode & IVPU_TEST_MODE_NULL_HW)) 411 + ivpu_job_signal_and_destroy(vdev, job->job_id, VPU_JSM_STATUS_SUCCESS); 412 + 368 413 return 0; 369 414 370 - err_xa_erase: 371 - xa_erase(&vdev->submitted_jobs_xa, job->job_id); 372 - err_job_put: 373 - job_put(job); 374 - err_unlock: 415 + err_erase_xa: 416 + __xa_erase(&vdev->submitted_jobs_xa, job->job_id); 417 + err_unlock_submitted_jobs_xa: 418 + xa_unlock(&vdev->submitted_jobs_xa); 419 + err_unlock_file_priv: 375 420 mutex_unlock(&file_priv->lock); 421 + ivpu_rpm_put(vdev); 376 422 return ret; 377 423 } 378 424 ··· 466 488 if (params->engine > DRM_IVPU_ENGINE_COPY) 467 489 return -EINVAL; 468 490 491 + if (params->priority > DRM_IVPU_JOB_PRIORITY_REALTIME) 492 + return -EINVAL; 493 + 469 494 if (params->buffer_count == 0 || params->buffer_count > JOB_MAX_BUFFER_COUNT) 470 495 return -EINVAL; 471 496 ··· 490 509 params->buffer_count * sizeof(u32)); 491 510 if (ret) { 492 511 ret = -EFAULT; 493 - goto free_handles; 512 + goto err_free_handles; 494 513 } 495 514 496 515 if (!drm_dev_enter(&vdev->drm, &idx)) { 497 516 ret = -ENODEV; 498 - goto free_handles; 517 + goto err_free_handles; 499 518 } 500 519 501 520 ivpu_dbg(vdev, JOB, "Submit ioctl: ctx %u buf_count %u\n", 502 521 file_priv->ctx.id, params->buffer_count); 503 522 504 - job = ivpu_create_job(file_priv, params->engine, params->buffer_count); 523 + job = ivpu_job_create(file_priv, params->engine, params->buffer_count); 505 524 if (!job) { 506 525 ivpu_err(vdev, "Failed to create job\n"); 507 526 ret = -ENOMEM; 508 - goto dev_exit; 527 + goto err_exit_dev; 509 528 } 510 529 511 530 ret = ivpu_job_prepare_bos_for_submit(file, job, buf_handles, params->buffer_count, 512 531 params->commands_offset); 513 532 if (ret) { 514 - ivpu_err(vdev, "Failed to prepare job, ret %d\n", ret); 515 - goto job_put; 533 + ivpu_err(vdev, "Failed to prepare job: %d\n", ret); 534 + goto err_destroy_job; 516 535 } 517 536 518 - ret = ivpu_direct_job_submission(job); 519 - if (ret) { 520 - dma_fence_signal(job->done_fence); 521 - ivpu_err(vdev, "Failed to submit job to the HW, ret %d\n", ret); 522 - } 537 + down_read(&vdev->pm->reset_lock); 538 + ret = ivpu_job_submit(job); 539 + up_read(&vdev->pm->reset_lock); 540 + if (ret) 541 + goto err_signal_fence; 523 542 524 - job_put: 525 - job_put(job); 526 - dev_exit: 527 543 drm_dev_exit(idx); 528 - free_handles: 529 544 kfree(buf_handles); 545 + return ret; 530 546 547 + err_signal_fence: 548 + dma_fence_signal(job->done_fence); 549 + err_destroy_job: 550 + ivpu_job_destroy(job); 551 + err_exit_dev: 552 + drm_dev_exit(idx); 553 + err_free_handles: 554 + kfree(buf_handles); 531 555 return ret; 532 556 } 533 557 ··· 554 568 } 555 569 556 570 payload = (struct vpu_ipc_msg_payload_job_done *)&jsm_msg->payload; 557 - ret = ivpu_job_done(vdev, payload->job_id, payload->job_status); 571 + ret = ivpu_job_signal_and_destroy(vdev, payload->job_id, payload->job_status); 558 572 if (!ret && !xa_empty(&vdev->submitted_jobs_xa)) 559 573 ivpu_start_job_timeout_detection(vdev); 560 574 }
+1 -2
drivers/accel/ivpu/ivpu_job.h
··· 43 43 will update the job status 44 44 */ 45 45 struct ivpu_job { 46 - struct kref ref; 47 46 struct ivpu_device *vdev; 48 47 struct ivpu_file_priv *file_priv; 49 48 struct dma_fence *done_fence; ··· 55 56 56 57 int ivpu_submit_ioctl(struct drm_device *dev, void *data, struct drm_file *file); 57 58 58 - void ivpu_cmdq_release_all(struct ivpu_file_priv *file_priv); 59 + void ivpu_cmdq_release_all_locked(struct ivpu_file_priv *file_priv); 59 60 void ivpu_cmdq_reset_all_contexts(struct ivpu_device *vdev); 60 61 61 62 void ivpu_job_done_consumer_init(struct ivpu_device *vdev);
+16 -8
drivers/accel/ivpu/ivpu_mmu.c
··· 7 7 #include <linux/highmem.h> 8 8 9 9 #include "ivpu_drv.h" 10 + #include "ivpu_hw.h" 10 11 #include "ivpu_hw_reg_io.h" 11 12 #include "ivpu_mmu.h" 12 13 #include "ivpu_mmu_context.h" ··· 519 518 520 519 ivpu_err(vdev, "Timed out waiting for MMU consumer: %d, error: %s\n", ret, 521 520 ivpu_mmu_cmdq_err_to_str(err)); 521 + ivpu_hw_diagnose_failure(vdev); 522 522 } 523 523 524 524 return ret; ··· 887 885 888 886 void ivpu_mmu_irq_evtq_handler(struct ivpu_device *vdev) 889 887 { 890 - bool schedule_recovery = false; 891 888 u32 *event; 892 889 u32 ssid; 893 890 ··· 896 895 ivpu_mmu_dump_event(vdev, event); 897 896 898 897 ssid = FIELD_GET(IVPU_MMU_EVT_SSID_MASK, event[0]); 899 - if (ssid == IVPU_GLOBAL_CONTEXT_MMU_SSID) 900 - schedule_recovery = true; 901 - else 902 - ivpu_mmu_user_context_mark_invalid(vdev, ssid); 903 - } 898 + if (ssid == IVPU_GLOBAL_CONTEXT_MMU_SSID) { 899 + ivpu_pm_trigger_recovery(vdev, "MMU event"); 900 + return; 901 + } 904 902 905 - if (schedule_recovery) 906 - ivpu_pm_schedule_recovery(vdev); 903 + ivpu_mmu_user_context_mark_invalid(vdev, ssid); 904 + } 905 + } 906 + 907 + void ivpu_mmu_evtq_dump(struct ivpu_device *vdev) 908 + { 909 + u32 *event; 910 + 911 + while ((event = ivpu_mmu_get_event(vdev)) != NULL) 912 + ivpu_mmu_dump_event(vdev, event); 907 913 } 908 914 909 915 void ivpu_mmu_irq_gerr_handler(struct ivpu_device *vdev)
+1
drivers/accel/ivpu/ivpu_mmu.h
··· 46 46 47 47 void ivpu_mmu_irq_evtq_handler(struct ivpu_device *vdev); 48 48 void ivpu_mmu_irq_gerr_handler(struct ivpu_device *vdev); 49 + void ivpu_mmu_evtq_dump(struct ivpu_device *vdev); 49 50 50 51 #endif /* __IVPU_MMU_H__ */
+9
drivers/accel/ivpu/ivpu_mmu_context.c
··· 355 355 dma_addr_t dma_addr = sg_dma_address(sg) - sg->offset; 356 356 size_t size = sg_dma_len(sg) + sg->offset; 357 357 358 + ivpu_dbg(vdev, MMU_MAP, "Map ctx: %u dma_addr: 0x%llx vpu_addr: 0x%llx size: %lu\n", 359 + ctx->id, dma_addr, vpu_addr, size); 360 + 358 361 ret = ivpu_mmu_context_map_pages(vdev, ctx, vpu_addr, dma_addr, size, prot); 359 362 if (ret) { 360 363 ivpu_err(vdev, "Failed to map context pages\n"); ··· 369 366 370 367 /* Ensure page table modifications are flushed from wc buffers to memory */ 371 368 wmb(); 369 + 372 370 mutex_unlock(&ctx->lock); 373 371 374 372 ret = ivpu_mmu_invalidate_tlb(vdev, ctx->id); ··· 392 388 mutex_lock(&ctx->lock); 393 389 394 390 for_each_sgtable_dma_sg(sgt, sg, i) { 391 + dma_addr_t dma_addr = sg_dma_address(sg) - sg->offset; 395 392 size_t size = sg_dma_len(sg) + sg->offset; 393 + 394 + ivpu_dbg(vdev, MMU_MAP, "Unmap ctx: %u dma_addr: 0x%llx vpu_addr: 0x%llx size: %lu\n", 395 + ctx->id, dma_addr, vpu_addr, size); 396 396 397 397 ivpu_mmu_context_unmap_pages(ctx, vpu_addr, size); 398 398 vpu_addr += size; ··· 404 396 405 397 /* Ensure page table modifications are flushed from wc buffers to memory */ 406 398 wmb(); 399 + 407 400 mutex_unlock(&ctx->lock); 408 401 409 402 ret = ivpu_mmu_invalidate_tlb(vdev, ctx->id);
+35 -17
drivers/accel/ivpu/ivpu_pm.c
··· 13 13 #include "ivpu_drv.h" 14 14 #include "ivpu_hw.h" 15 15 #include "ivpu_fw.h" 16 + #include "ivpu_fw_log.h" 16 17 #include "ivpu_ipc.h" 17 18 #include "ivpu_job.h" 18 19 #include "ivpu_jsm_msg.h" ··· 112 111 char *evt[2] = {"IVPU_PM_EVENT=IVPU_RECOVER", NULL}; 113 112 int ret; 114 113 114 + ivpu_err(vdev, "Recovering the VPU (reset #%d)\n", atomic_read(&vdev->pm->reset_counter)); 115 + 116 + ret = pm_runtime_resume_and_get(vdev->drm.dev); 117 + if (ret) 118 + ivpu_err(vdev, "Failed to resume VPU: %d\n", ret); 119 + 120 + ivpu_fw_log_dump(vdev); 121 + 115 122 retry: 116 123 ret = pci_try_reset_function(to_pci_dev(vdev->drm.dev)); 117 124 if (ret == -EAGAIN && !drm_dev_is_unplugged(&vdev->drm)) { ··· 131 122 ivpu_err(vdev, "Failed to reset VPU: %d\n", ret); 132 123 133 124 kobject_uevent_env(&vdev->drm.dev->kobj, KOBJ_CHANGE, evt); 125 + pm_runtime_mark_last_busy(vdev->drm.dev); 126 + pm_runtime_put_autosuspend(vdev->drm.dev); 134 127 } 135 128 136 - void ivpu_pm_schedule_recovery(struct ivpu_device *vdev) 129 + void ivpu_pm_trigger_recovery(struct ivpu_device *vdev, const char *reason) 137 130 { 138 - struct ivpu_pm_info *pm = vdev->pm; 131 + ivpu_err(vdev, "Recovery triggered by %s\n", reason); 139 132 140 133 if (ivpu_disable_recovery) { 141 134 ivpu_err(vdev, "Recovery not available when disable_recovery param is set\n"); ··· 149 138 return; 150 139 } 151 140 152 - /* Schedule recovery if it's not in progress */ 153 - if (atomic_cmpxchg(&pm->in_reset, 0, 1) == 0) { 154 - ivpu_hw_irq_disable(vdev); 155 - queue_work(system_long_wq, &pm->recovery_work); 141 + /* Trigger recovery if it's not in progress */ 142 + if (atomic_cmpxchg(&vdev->pm->reset_pending, 0, 1) == 0) { 143 + ivpu_hw_diagnose_failure(vdev); 144 + ivpu_hw_irq_disable(vdev); /* Disable IRQ early to protect from IRQ storm */ 145 + queue_work(system_long_wq, &vdev->pm->recovery_work); 156 146 } 157 147 } 158 148 ··· 161 149 { 162 150 struct ivpu_pm_info *pm = container_of(work, struct ivpu_pm_info, job_timeout_work.work); 163 151 struct ivpu_device *vdev = pm->vdev; 164 - unsigned long timeout_ms = ivpu_tdr_timeout_ms ? ivpu_tdr_timeout_ms : vdev->timeout.tdr; 165 152 166 - ivpu_err(vdev, "TDR detected, timeout %lu ms", timeout_ms); 167 - ivpu_hw_diagnose_failure(vdev); 168 - 169 - ivpu_pm_schedule_recovery(vdev); 153 + ivpu_pm_trigger_recovery(vdev, "TDR"); 170 154 } 171 155 172 156 void ivpu_start_job_timeout_detection(struct ivpu_device *vdev) ··· 235 227 bool hw_is_idle = true; 236 228 int ret; 237 229 230 + drm_WARN_ON(&vdev->drm, !xa_empty(&vdev->submitted_jobs_xa)); 231 + drm_WARN_ON(&vdev->drm, work_pending(&vdev->pm->recovery_work)); 232 + 238 233 ivpu_dbg(vdev, PM, "Runtime suspend..\n"); 239 234 240 235 if (!ivpu_hw_is_idle(vdev) && vdev->pm->suspend_reschedule_counter) { ··· 258 247 ivpu_err(vdev, "Failed to set suspend VPU: %d\n", ret); 259 248 260 249 if (!hw_is_idle) { 261 - ivpu_warn(vdev, "VPU failed to enter idle, force suspended.\n"); 250 + ivpu_err(vdev, "VPU failed to enter idle, force suspended.\n"); 251 + ivpu_fw_log_dump(vdev); 262 252 ivpu_pm_prepare_cold_boot(vdev); 263 253 } else { 264 254 ivpu_pm_prepare_warm_boot(vdev); ··· 320 308 { 321 309 struct ivpu_device *vdev = pci_get_drvdata(pdev); 322 310 323 - pm_runtime_get_sync(vdev->drm.dev); 324 - 325 311 ivpu_dbg(vdev, PM, "Pre-reset..\n"); 326 312 atomic_inc(&vdev->pm->reset_counter); 327 - atomic_set(&vdev->pm->in_reset, 1); 313 + atomic_set(&vdev->pm->reset_pending, 1); 314 + 315 + pm_runtime_get_sync(vdev->drm.dev); 316 + down_write(&vdev->pm->reset_lock); 328 317 ivpu_prepare_for_reset(vdev); 329 318 ivpu_hw_reset(vdev); 330 319 ivpu_pm_prepare_cold_boot(vdev); ··· 342 329 ret = ivpu_resume(vdev); 343 330 if (ret) 344 331 ivpu_err(vdev, "Failed to set RESUME state: %d\n", ret); 345 - atomic_set(&vdev->pm->in_reset, 0); 332 + up_write(&vdev->pm->reset_lock); 333 + atomic_set(&vdev->pm->reset_pending, 0); 346 334 ivpu_dbg(vdev, PM, "Post-reset done.\n"); 347 335 336 + pm_runtime_mark_last_busy(vdev->drm.dev); 348 337 pm_runtime_put_autosuspend(vdev->drm.dev); 349 338 } 350 339 ··· 359 344 pm->vdev = vdev; 360 345 pm->suspend_reschedule_counter = PM_RESCHEDULE_LIMIT; 361 346 362 - atomic_set(&pm->in_reset, 0); 347 + init_rwsem(&pm->reset_lock); 348 + atomic_set(&pm->reset_pending, 0); 349 + atomic_set(&pm->reset_counter, 0); 350 + 363 351 INIT_WORK(&pm->recovery_work, ivpu_pm_recovery_work); 364 352 INIT_DELAYED_WORK(&pm->job_timeout_work, ivpu_job_timeout_work); 365 353
+4 -2
drivers/accel/ivpu/ivpu_pm.h
··· 6 6 #ifndef __IVPU_PM_H__ 7 7 #define __IVPU_PM_H__ 8 8 9 + #include <linux/rwsem.h> 9 10 #include <linux/types.h> 10 11 11 12 struct ivpu_device; ··· 15 14 struct ivpu_device *vdev; 16 15 struct delayed_work job_timeout_work; 17 16 struct work_struct recovery_work; 18 - atomic_t in_reset; 17 + struct rw_semaphore reset_lock; 19 18 atomic_t reset_counter; 19 + atomic_t reset_pending; 20 20 bool is_warmboot; 21 21 u32 suspend_reschedule_counter; 22 22 }; ··· 39 37 int __must_check ivpu_rpm_get_if_active(struct ivpu_device *vdev); 40 38 void ivpu_rpm_put(struct ivpu_device *vdev); 41 39 42 - void ivpu_pm_schedule_recovery(struct ivpu_device *vdev); 40 + void ivpu_pm_trigger_recovery(struct ivpu_device *vdev, const char *reason); 43 41 void ivpu_start_job_timeout_detection(struct ivpu_device *vdev); 44 42 void ivpu_stop_job_timeout_detection(struct ivpu_device *vdev); 45 43
+28 -6
drivers/ata/ahci.c
··· 48 48 enum board_ids { 49 49 /* board IDs by feature in alphabetical order */ 50 50 board_ahci, 51 + board_ahci_43bit_dma, 51 52 board_ahci_ign_iferr, 52 53 board_ahci_low_power, 53 54 board_ahci_no_debounce_delay, ··· 124 123 static const struct ata_port_info ahci_port_info[] = { 125 124 /* by features */ 126 125 [board_ahci] = { 126 + .flags = AHCI_FLAG_COMMON, 127 + .pio_mask = ATA_PIO4, 128 + .udma_mask = ATA_UDMA6, 129 + .port_ops = &ahci_ops, 130 + }, 131 + [board_ahci_43bit_dma] = { 132 + AHCI_HFLAGS (AHCI_HFLAG_43BIT_ONLY), 127 133 .flags = AHCI_FLAG_COMMON, 128 134 .pio_mask = ATA_PIO4, 129 135 .udma_mask = ATA_UDMA6, ··· 605 597 { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 */ 606 598 { PCI_VDEVICE(PROMISE, 0x3781), board_ahci }, /* FastTrak TX8660 ahci-mode */ 607 599 608 - /* Asmedia */ 600 + /* ASMedia */ 609 601 { PCI_VDEVICE(ASMEDIA, 0x0601), board_ahci }, /* ASM1060 */ 610 602 { PCI_VDEVICE(ASMEDIA, 0x0602), board_ahci }, /* ASM1060 */ 611 - { PCI_VDEVICE(ASMEDIA, 0x0611), board_ahci }, /* ASM1061 */ 612 - { PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci }, /* ASM1062 */ 603 + { PCI_VDEVICE(ASMEDIA, 0x0611), board_ahci_43bit_dma }, /* ASM1061 */ 604 + { PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci_43bit_dma }, /* ASM1061/1062 */ 613 605 { PCI_VDEVICE(ASMEDIA, 0x0621), board_ahci }, /* ASM1061R */ 614 606 { PCI_VDEVICE(ASMEDIA, 0x0622), board_ahci }, /* ASM1062R */ 615 607 { PCI_VDEVICE(ASMEDIA, 0x0624), board_ahci }, /* ASM1062+JMB575 */ ··· 671 663 static void ahci_pci_save_initial_config(struct pci_dev *pdev, 672 664 struct ahci_host_priv *hpriv) 673 665 { 666 + if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && pdev->device == 0x1166) { 667 + dev_info(&pdev->dev, "ASM1166 has only six ports\n"); 668 + hpriv->saved_port_map = 0x3f; 669 + } 670 + 674 671 if (pdev->vendor == PCI_VENDOR_ID_JMICRON && pdev->device == 0x2361) { 675 672 dev_info(&pdev->dev, "JMB361 has only one port\n"); 676 673 hpriv->saved_port_map = 1; ··· 962 949 963 950 #endif /* CONFIG_PM */ 964 951 965 - static int ahci_configure_dma_masks(struct pci_dev *pdev, int using_dac) 952 + static int ahci_configure_dma_masks(struct pci_dev *pdev, 953 + struct ahci_host_priv *hpriv) 966 954 { 967 - const int dma_bits = using_dac ? 64 : 32; 955 + int dma_bits; 968 956 int rc; 957 + 958 + if (hpriv->cap & HOST_CAP_64) { 959 + dma_bits = 64; 960 + if (hpriv->flags & AHCI_HFLAG_43BIT_ONLY) 961 + dma_bits = 43; 962 + } else { 963 + dma_bits = 32; 964 + } 969 965 970 966 /* 971 967 * If the device fixup already set the dma_mask to some non-standard ··· 1948 1926 ahci_gtf_filter_workaround(host); 1949 1927 1950 1928 /* initialize adapter */ 1951 - rc = ahci_configure_dma_masks(pdev, hpriv->cap & HOST_CAP_64); 1929 + rc = ahci_configure_dma_masks(pdev, hpriv); 1952 1930 if (rc) 1953 1931 return rc; 1954 1932
+1
drivers/ata/ahci.h
··· 247 247 AHCI_HFLAG_SUSPEND_PHYS = BIT(26), /* handle PHYs during 248 248 suspend/resume */ 249 249 AHCI_HFLAG_NO_SXS = BIT(28), /* SXS not supported */ 250 + AHCI_HFLAG_43BIT_ONLY = BIT(29), /* 43bit DMA addr limit */ 250 251 251 252 /* ap->flags bits */ 252 253
+1 -1
drivers/ata/libata-sata.c
··· 784 784 EXPORT_SYMBOL_GPL(sata_lpm_ignore_phy_events); 785 785 786 786 static const char *ata_lpm_policy_names[] = { 787 - [ATA_LPM_UNKNOWN] = "max_performance", 787 + [ATA_LPM_UNKNOWN] = "keep_firmware_settings", 788 788 [ATA_LPM_MAX_POWER] = "max_performance", 789 789 [ATA_LPM_MED_POWER] = "medium_power", 790 790 [ATA_LPM_MED_POWER_WITH_DIPM] = "med_power_with_dipm",
+4 -1
drivers/block/aoe/aoeblk.c
··· 333 333 struct gendisk *gd; 334 334 mempool_t *mp; 335 335 struct blk_mq_tag_set *set; 336 + sector_t ssize; 336 337 ulong flags; 337 338 int late = 0; 338 339 int err; ··· 397 396 gd->minors = AOE_PARTITIONS; 398 397 gd->fops = &aoe_bdops; 399 398 gd->private_data = d; 400 - set_capacity(gd, d->ssize); 399 + ssize = d->ssize; 401 400 snprintf(gd->disk_name, sizeof gd->disk_name, "etherd/e%ld.%d", 402 401 d->aoemajor, d->aoeminor); 403 402 ··· 405 404 d->flags |= DEVFL_UP; 406 405 407 406 spin_unlock_irqrestore(&d->lock, flags); 407 + 408 + set_capacity(gd, ssize); 408 409 409 410 err = device_add_disk(NULL, gd, aoe_attr_groups); 410 411 if (err)
+19 -13
drivers/block/rbd.c
··· 3452 3452 static void rbd_lock_del_request(struct rbd_img_request *img_req) 3453 3453 { 3454 3454 struct rbd_device *rbd_dev = img_req->rbd_dev; 3455 - bool need_wakeup; 3455 + bool need_wakeup = false; 3456 3456 3457 3457 lockdep_assert_held(&rbd_dev->lock_rwsem); 3458 3458 spin_lock(&rbd_dev->lock_lists_lock); 3459 - rbd_assert(!list_empty(&img_req->lock_item)); 3460 - list_del_init(&img_req->lock_item); 3461 - need_wakeup = (rbd_dev->lock_state == RBD_LOCK_STATE_RELEASING && 3462 - list_empty(&rbd_dev->running_list)); 3459 + if (!list_empty(&img_req->lock_item)) { 3460 + list_del_init(&img_req->lock_item); 3461 + need_wakeup = (rbd_dev->lock_state == RBD_LOCK_STATE_RELEASING && 3462 + list_empty(&rbd_dev->running_list)); 3463 + } 3463 3464 spin_unlock(&rbd_dev->lock_lists_lock); 3464 3465 if (need_wakeup) 3465 3466 complete(&rbd_dev->releasing_wait); ··· 3843 3842 return; 3844 3843 } 3845 3844 3846 - list_for_each_entry(img_req, &rbd_dev->acquiring_list, lock_item) { 3845 + while (!list_empty(&rbd_dev->acquiring_list)) { 3846 + img_req = list_first_entry(&rbd_dev->acquiring_list, 3847 + struct rbd_img_request, lock_item); 3847 3848 mutex_lock(&img_req->state_mutex); 3848 3849 rbd_assert(img_req->state == RBD_IMG_EXCLUSIVE_LOCK); 3850 + if (!result) 3851 + list_move_tail(&img_req->lock_item, 3852 + &rbd_dev->running_list); 3853 + else 3854 + list_del_init(&img_req->lock_item); 3849 3855 rbd_img_schedule(img_req, result); 3850 3856 mutex_unlock(&img_req->state_mutex); 3851 3857 } 3852 - 3853 - list_splice_tail_init(&rbd_dev->acquiring_list, &rbd_dev->running_list); 3854 3858 } 3855 3859 3856 3860 static bool locker_equal(const struct ceph_locker *lhs, ··· 5332 5326 5333 5327 if (need_put) { 5334 5328 destroy_workqueue(rbd_dev->task_wq); 5335 - ida_simple_remove(&rbd_dev_id_ida, rbd_dev->dev_id); 5329 + ida_free(&rbd_dev_id_ida, rbd_dev->dev_id); 5336 5330 } 5337 5331 5338 5332 rbd_dev_free(rbd_dev); ··· 5408 5402 return NULL; 5409 5403 5410 5404 /* get an id and fill in device name */ 5411 - rbd_dev->dev_id = ida_simple_get(&rbd_dev_id_ida, 0, 5412 - minor_to_rbd_dev_id(1 << MINORBITS), 5413 - GFP_KERNEL); 5405 + rbd_dev->dev_id = ida_alloc_max(&rbd_dev_id_ida, 5406 + minor_to_rbd_dev_id(1 << MINORBITS) - 1, 5407 + GFP_KERNEL); 5414 5408 if (rbd_dev->dev_id < 0) 5415 5409 goto fail_rbd_dev; 5416 5410 ··· 5431 5425 return rbd_dev; 5432 5426 5433 5427 fail_dev_id: 5434 - ida_simple_remove(&rbd_dev_id_ida, rbd_dev->dev_id); 5428 + ida_free(&rbd_dev_id_ida, rbd_dev->dev_id); 5435 5429 fail_rbd_dev: 5436 5430 rbd_dev_free(rbd_dev); 5437 5431 return NULL;
+3 -4
drivers/cpufreq/amd-pstate.c
··· 1232 1232 max_limit_perf = div_u64(policy->max * cpudata->highest_perf, cpudata->max_freq); 1233 1233 min_limit_perf = div_u64(policy->min * cpudata->highest_perf, cpudata->max_freq); 1234 1234 1235 + WRITE_ONCE(cpudata->max_limit_perf, max_limit_perf); 1236 + WRITE_ONCE(cpudata->min_limit_perf, min_limit_perf); 1237 + 1235 1238 max_perf = clamp_t(unsigned long, max_perf, cpudata->min_limit_perf, 1236 1239 cpudata->max_limit_perf); 1237 1240 min_perf = clamp_t(unsigned long, min_perf, cpudata->min_limit_perf, 1238 1241 cpudata->max_limit_perf); 1239 - 1240 - WRITE_ONCE(cpudata->max_limit_perf, max_limit_perf); 1241 - WRITE_ONCE(cpudata->min_limit_perf, min_limit_perf); 1242 - 1243 1242 value = READ_ONCE(cpudata->cppc_req_cached); 1244 1243 1245 1244 if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE)
+34 -21
drivers/cpufreq/intel_pstate.c
··· 529 529 } 530 530 #endif /* CONFIG_ACPI_CPPC_LIB */ 531 531 532 + static int intel_pstate_freq_to_hwp_rel(struct cpudata *cpu, int freq, 533 + unsigned int relation) 534 + { 535 + if (freq == cpu->pstate.turbo_freq) 536 + return cpu->pstate.turbo_pstate; 537 + 538 + if (freq == cpu->pstate.max_freq) 539 + return cpu->pstate.max_pstate; 540 + 541 + switch (relation) { 542 + case CPUFREQ_RELATION_H: 543 + return freq / cpu->pstate.scaling; 544 + case CPUFREQ_RELATION_C: 545 + return DIV_ROUND_CLOSEST(freq, cpu->pstate.scaling); 546 + } 547 + 548 + return DIV_ROUND_UP(freq, cpu->pstate.scaling); 549 + } 550 + 551 + static int intel_pstate_freq_to_hwp(struct cpudata *cpu, int freq) 552 + { 553 + return intel_pstate_freq_to_hwp_rel(cpu, freq, CPUFREQ_RELATION_L); 554 + } 555 + 532 556 /** 533 557 * intel_pstate_hybrid_hwp_adjust - Calibrate HWP performance levels. 534 558 * @cpu: Target CPU. ··· 570 546 int perf_ctl_scaling = cpu->pstate.perf_ctl_scaling; 571 547 int perf_ctl_turbo = pstate_funcs.get_turbo(cpu->cpu); 572 548 int scaling = cpu->pstate.scaling; 549 + int freq; 573 550 574 551 pr_debug("CPU%d: perf_ctl_max_phys = %d\n", cpu->cpu, perf_ctl_max_phys); 575 552 pr_debug("CPU%d: perf_ctl_turbo = %d\n", cpu->cpu, perf_ctl_turbo); ··· 584 559 cpu->pstate.max_freq = rounddown(cpu->pstate.max_pstate * scaling, 585 560 perf_ctl_scaling); 586 561 587 - cpu->pstate.max_pstate_physical = 588 - DIV_ROUND_UP(perf_ctl_max_phys * perf_ctl_scaling, 589 - scaling); 562 + freq = perf_ctl_max_phys * perf_ctl_scaling; 563 + cpu->pstate.max_pstate_physical = intel_pstate_freq_to_hwp(cpu, freq); 590 564 591 - cpu->pstate.min_freq = cpu->pstate.min_pstate * perf_ctl_scaling; 565 + freq = cpu->pstate.min_pstate * perf_ctl_scaling; 566 + cpu->pstate.min_freq = freq; 592 567 /* 593 568 * Cast the min P-state value retrieved via pstate_funcs.get_min() to 594 569 * the effective range of HWP performance levels. 595 570 */ 596 - cpu->pstate.min_pstate = DIV_ROUND_UP(cpu->pstate.min_freq, scaling); 571 + cpu->pstate.min_pstate = intel_pstate_freq_to_hwp(cpu, freq); 597 572 } 598 573 599 574 static inline void update_turbo_state(void) ··· 2553 2528 * abstract values to represent performance rather than pure ratios. 2554 2529 */ 2555 2530 if (hwp_active && cpu->pstate.scaling != perf_ctl_scaling) { 2556 - int scaling = cpu->pstate.scaling; 2557 2531 int freq; 2558 2532 2559 2533 freq = max_policy_perf * perf_ctl_scaling; 2560 - max_policy_perf = DIV_ROUND_UP(freq, scaling); 2534 + max_policy_perf = intel_pstate_freq_to_hwp(cpu, freq); 2561 2535 freq = min_policy_perf * perf_ctl_scaling; 2562 - min_policy_perf = DIV_ROUND_UP(freq, scaling); 2536 + min_policy_perf = intel_pstate_freq_to_hwp(cpu, freq); 2563 2537 } 2564 2538 2565 2539 pr_debug("cpu:%d min_policy_perf:%d max_policy_perf:%d\n", ··· 2932 2908 2933 2909 cpufreq_freq_transition_begin(policy, &freqs); 2934 2910 2935 - switch (relation) { 2936 - case CPUFREQ_RELATION_L: 2937 - target_pstate = DIV_ROUND_UP(freqs.new, cpu->pstate.scaling); 2938 - break; 2939 - case CPUFREQ_RELATION_H: 2940 - target_pstate = freqs.new / cpu->pstate.scaling; 2941 - break; 2942 - default: 2943 - target_pstate = DIV_ROUND_CLOSEST(freqs.new, cpu->pstate.scaling); 2944 - break; 2945 - } 2946 - 2911 + target_pstate = intel_pstate_freq_to_hwp_rel(cpu, freqs.new, relation); 2947 2912 target_pstate = intel_cpufreq_update_pstate(policy, target_pstate, false); 2948 2913 2949 2914 freqs.new = target_pstate * cpu->pstate.scaling; ··· 2950 2937 2951 2938 update_turbo_state(); 2952 2939 2953 - target_pstate = DIV_ROUND_UP(target_freq, cpu->pstate.scaling); 2940 + target_pstate = intel_pstate_freq_to_hwp(cpu, target_freq); 2954 2941 2955 2942 target_pstate = intel_cpufreq_update_pstate(policy, target_pstate, true); 2956 2943
+2 -2
drivers/cxl/core/region.c
··· 525 525 struct cxl_root_decoder *cxlrd = to_cxl_root_decoder(cxlr->dev.parent); 526 526 struct cxl_region_params *p = &cxlr->params; 527 527 struct resource *res; 528 - u32 remainder = 0; 528 + u64 remainder = 0; 529 529 530 530 lockdep_assert_held_write(&cxl_region_rwsem); 531 531 ··· 545 545 (cxlr->mode == CXL_DECODER_PMEM && uuid_is_null(&p->uuid))) 546 546 return -ENXIO; 547 547 548 - div_u64_rem(size, SZ_256M * p->interleave_ways, &remainder); 548 + div64_u64_rem(size, (u64)SZ_256M * p->interleave_ways, &remainder); 549 549 if (remainder) 550 550 return -EINVAL; 551 551
+15 -11
drivers/cxl/pci.c
··· 382 382 return rc; 383 383 } 384 384 385 - static int cxl_pci_setup_mailbox(struct cxl_memdev_state *mds) 385 + static int cxl_pci_setup_mailbox(struct cxl_memdev_state *mds, bool irq_avail) 386 386 { 387 387 struct cxl_dev_state *cxlds = &mds->cxlds; 388 388 const int cap = readl(cxlds->regs.mbox + CXLDEV_MBOX_CAPS_OFFSET); ··· 441 441 INIT_DELAYED_WORK(&mds->security.poll_dwork, cxl_mbox_sanitize_work); 442 442 443 443 /* background command interrupts are optional */ 444 - if (!(cap & CXLDEV_MBOX_CAP_BG_CMD_IRQ)) 444 + if (!(cap & CXLDEV_MBOX_CAP_BG_CMD_IRQ) || !irq_avail) 445 445 return 0; 446 446 447 447 msgnum = FIELD_GET(CXLDEV_MBOX_CAP_IRQ_MSGNUM_MASK, cap); ··· 588 588 return devm_add_action_or_reset(mds->cxlds.dev, free_event_buf, buf); 589 589 } 590 590 591 - static int cxl_alloc_irq_vectors(struct pci_dev *pdev) 591 + static bool cxl_alloc_irq_vectors(struct pci_dev *pdev) 592 592 { 593 593 int nvecs; 594 594 ··· 605 605 PCI_IRQ_MSIX | PCI_IRQ_MSI); 606 606 if (nvecs < 1) { 607 607 dev_dbg(&pdev->dev, "Failed to alloc irq vectors: %d\n", nvecs); 608 - return -ENXIO; 608 + return false; 609 609 } 610 - return 0; 610 + return true; 611 611 } 612 612 613 613 static irqreturn_t cxl_event_thread(int irq, void *id) ··· 743 743 } 744 744 745 745 static int cxl_event_config(struct pci_host_bridge *host_bridge, 746 - struct cxl_memdev_state *mds) 746 + struct cxl_memdev_state *mds, bool irq_avail) 747 747 { 748 748 struct cxl_event_interrupt_policy policy; 749 749 int rc; ··· 754 754 */ 755 755 if (!host_bridge->native_cxl_error) 756 756 return 0; 757 + 758 + if (!irq_avail) { 759 + dev_info(mds->cxlds.dev, "No interrupt support, disable event processing.\n"); 760 + return 0; 761 + } 757 762 758 763 rc = cxl_mem_alloc_event_buf(mds); 759 764 if (rc) ··· 794 789 struct cxl_register_map map; 795 790 struct cxl_memdev *cxlmd; 796 791 int i, rc, pmu_count; 792 + bool irq_avail; 797 793 798 794 /* 799 795 * Double check the anonymous union trickery in struct cxl_regs ··· 852 846 else 853 847 dev_warn(&pdev->dev, "Media not active (%d)\n", rc); 854 848 855 - rc = cxl_alloc_irq_vectors(pdev); 856 - if (rc) 857 - return rc; 849 + irq_avail = cxl_alloc_irq_vectors(pdev); 858 850 859 - rc = cxl_pci_setup_mailbox(mds); 851 + rc = cxl_pci_setup_mailbox(mds, irq_avail); 860 852 if (rc) 861 853 return rc; 862 854 ··· 913 909 } 914 910 } 915 911 916 - rc = cxl_event_config(host_bridge, mds); 912 + rc = cxl_event_config(host_bridge, mds, irq_avail); 917 913 if (rc) 918 914 return rc; 919 915
+57 -11
drivers/dpll/dpll_core.c
··· 29 29 WARN_ON_ONCE(!xa_get_mark(&dpll_device_xa, (d)->id, DPLL_REGISTERED)) 30 30 #define ASSERT_DPLL_NOT_REGISTERED(d) \ 31 31 WARN_ON_ONCE(xa_get_mark(&dpll_device_xa, (d)->id, DPLL_REGISTERED)) 32 - #define ASSERT_PIN_REGISTERED(p) \ 33 - WARN_ON_ONCE(!xa_get_mark(&dpll_pin_xa, (p)->id, DPLL_REGISTERED)) 34 32 35 33 struct dpll_device_registration { 36 34 struct list_head list; ··· 423 425 } 424 426 EXPORT_SYMBOL_GPL(dpll_device_unregister); 425 427 428 + static void dpll_pin_prop_free(struct dpll_pin_properties *prop) 429 + { 430 + kfree(prop->package_label); 431 + kfree(prop->panel_label); 432 + kfree(prop->board_label); 433 + kfree(prop->freq_supported); 434 + } 435 + 436 + static int dpll_pin_prop_dup(const struct dpll_pin_properties *src, 437 + struct dpll_pin_properties *dst) 438 + { 439 + memcpy(dst, src, sizeof(*dst)); 440 + if (src->freq_supported && src->freq_supported_num) { 441 + size_t freq_size = src->freq_supported_num * 442 + sizeof(*src->freq_supported); 443 + dst->freq_supported = kmemdup(src->freq_supported, 444 + freq_size, GFP_KERNEL); 445 + if (!src->freq_supported) 446 + return -ENOMEM; 447 + } 448 + if (src->board_label) { 449 + dst->board_label = kstrdup(src->board_label, GFP_KERNEL); 450 + if (!dst->board_label) 451 + goto err_board_label; 452 + } 453 + if (src->panel_label) { 454 + dst->panel_label = kstrdup(src->panel_label, GFP_KERNEL); 455 + if (!dst->panel_label) 456 + goto err_panel_label; 457 + } 458 + if (src->package_label) { 459 + dst->package_label = kstrdup(src->package_label, GFP_KERNEL); 460 + if (!dst->package_label) 461 + goto err_package_label; 462 + } 463 + 464 + return 0; 465 + 466 + err_package_label: 467 + kfree(dst->panel_label); 468 + err_panel_label: 469 + kfree(dst->board_label); 470 + err_board_label: 471 + kfree(dst->freq_supported); 472 + return -ENOMEM; 473 + } 474 + 426 475 static struct dpll_pin * 427 476 dpll_pin_alloc(u64 clock_id, u32 pin_idx, struct module *module, 428 477 const struct dpll_pin_properties *prop) ··· 486 441 if (WARN_ON(prop->type < DPLL_PIN_TYPE_MUX || 487 442 prop->type > DPLL_PIN_TYPE_MAX)) { 488 443 ret = -EINVAL; 489 - goto err; 444 + goto err_pin_prop; 490 445 } 491 - pin->prop = prop; 446 + ret = dpll_pin_prop_dup(prop, &pin->prop); 447 + if (ret) 448 + goto err_pin_prop; 492 449 refcount_set(&pin->refcount, 1); 493 450 xa_init_flags(&pin->dpll_refs, XA_FLAGS_ALLOC); 494 451 xa_init_flags(&pin->parent_refs, XA_FLAGS_ALLOC); 495 452 ret = xa_alloc_cyclic(&dpll_pin_xa, &pin->id, pin, xa_limit_32b, 496 453 &dpll_pin_xa_id, GFP_KERNEL); 497 454 if (ret) 498 - goto err; 455 + goto err_xa_alloc; 499 456 return pin; 500 - err: 457 + err_xa_alloc: 501 458 xa_destroy(&pin->dpll_refs); 502 459 xa_destroy(&pin->parent_refs); 460 + dpll_pin_prop_free(&pin->prop); 461 + err_pin_prop: 503 462 kfree(pin); 504 463 return ERR_PTR(ret); 505 464 } ··· 563 514 xa_destroy(&pin->dpll_refs); 564 515 xa_destroy(&pin->parent_refs); 565 516 xa_erase(&dpll_pin_xa, pin->id); 517 + dpll_pin_prop_free(&pin->prop); 566 518 kfree(pin); 567 519 } 568 520 mutex_unlock(&dpll_lock); ··· 613 563 if (WARN_ON(!ops) || 614 564 WARN_ON(!ops->state_on_dpll_get) || 615 565 WARN_ON(!ops->direction_get)) 616 - return -EINVAL; 617 - if (ASSERT_DPLL_REGISTERED(dpll)) 618 566 return -EINVAL; 619 567 620 568 mutex_lock(&dpll_lock); ··· 684 636 unsigned long i, stop; 685 637 int ret; 686 638 687 - if (WARN_ON(parent->prop->type != DPLL_PIN_TYPE_MUX)) 639 + if (WARN_ON(parent->prop.type != DPLL_PIN_TYPE_MUX)) 688 640 return -EINVAL; 689 641 690 642 if (WARN_ON(!ops) || 691 643 WARN_ON(!ops->state_on_pin_get) || 692 644 WARN_ON(!ops->direction_get)) 693 - return -EINVAL; 694 - if (ASSERT_PIN_REGISTERED(parent)) 695 645 return -EINVAL; 696 646 697 647 mutex_lock(&dpll_lock);
+2 -2
drivers/dpll/dpll_core.h
··· 44 44 * @module: module of creator 45 45 * @dpll_refs: hold referencees to dplls pin was registered with 46 46 * @parent_refs: hold references to parent pins pin was registered with 47 - * @prop: pointer to pin properties given by registerer 47 + * @prop: pin properties copied from the registerer 48 48 * @rclk_dev_name: holds name of device when pin can recover clock from it 49 49 * @refcount: refcount 50 50 **/ ··· 55 55 struct module *module; 56 56 struct xarray dpll_refs; 57 57 struct xarray parent_refs; 58 - const struct dpll_pin_properties *prop; 58 + struct dpll_pin_properties prop; 59 59 refcount_t refcount; 60 60 }; 61 61
+41 -16
drivers/dpll/dpll_netlink.c
··· 303 303 if (nla_put_64bit(msg, DPLL_A_PIN_FREQUENCY, sizeof(freq), &freq, 304 304 DPLL_A_PIN_PAD)) 305 305 return -EMSGSIZE; 306 - for (fs = 0; fs < pin->prop->freq_supported_num; fs++) { 306 + for (fs = 0; fs < pin->prop.freq_supported_num; fs++) { 307 307 nest = nla_nest_start(msg, DPLL_A_PIN_FREQUENCY_SUPPORTED); 308 308 if (!nest) 309 309 return -EMSGSIZE; 310 - freq = pin->prop->freq_supported[fs].min; 310 + freq = pin->prop.freq_supported[fs].min; 311 311 if (nla_put_64bit(msg, DPLL_A_PIN_FREQUENCY_MIN, sizeof(freq), 312 312 &freq, DPLL_A_PIN_PAD)) { 313 313 nla_nest_cancel(msg, nest); 314 314 return -EMSGSIZE; 315 315 } 316 - freq = pin->prop->freq_supported[fs].max; 316 + freq = pin->prop.freq_supported[fs].max; 317 317 if (nla_put_64bit(msg, DPLL_A_PIN_FREQUENCY_MAX, sizeof(freq), 318 318 &freq, DPLL_A_PIN_PAD)) { 319 319 nla_nest_cancel(msg, nest); ··· 329 329 { 330 330 int fs; 331 331 332 - for (fs = 0; fs < pin->prop->freq_supported_num; fs++) 333 - if (freq >= pin->prop->freq_supported[fs].min && 334 - freq <= pin->prop->freq_supported[fs].max) 332 + for (fs = 0; fs < pin->prop.freq_supported_num; fs++) 333 + if (freq >= pin->prop.freq_supported[fs].min && 334 + freq <= pin->prop.freq_supported[fs].max) 335 335 return true; 336 336 return false; 337 337 } ··· 421 421 dpll_cmd_pin_get_one(struct sk_buff *msg, struct dpll_pin *pin, 422 422 struct netlink_ext_ack *extack) 423 423 { 424 - const struct dpll_pin_properties *prop = pin->prop; 424 + const struct dpll_pin_properties *prop = &pin->prop; 425 425 struct dpll_pin_ref *ref; 426 426 int ret; 427 427 ··· 553 553 return dpll_device_event_send(DPLL_CMD_DEVICE_CHANGE_NTF, dpll); 554 554 } 555 555 556 + static bool dpll_pin_available(struct dpll_pin *pin) 557 + { 558 + struct dpll_pin_ref *par_ref; 559 + unsigned long i; 560 + 561 + if (!xa_get_mark(&dpll_pin_xa, pin->id, DPLL_REGISTERED)) 562 + return false; 563 + xa_for_each(&pin->parent_refs, i, par_ref) 564 + if (xa_get_mark(&dpll_pin_xa, par_ref->pin->id, 565 + DPLL_REGISTERED)) 566 + return true; 567 + xa_for_each(&pin->dpll_refs, i, par_ref) 568 + if (xa_get_mark(&dpll_device_xa, par_ref->dpll->id, 569 + DPLL_REGISTERED)) 570 + return true; 571 + return false; 572 + } 573 + 556 574 /** 557 575 * dpll_device_change_ntf - notify that the dpll device has been changed 558 576 * @dpll: registered dpll pointer ··· 597 579 int ret = -ENOMEM; 598 580 void *hdr; 599 581 600 - if (WARN_ON(!xa_get_mark(&dpll_pin_xa, pin->id, DPLL_REGISTERED))) 582 + if (!dpll_pin_available(pin)) 601 583 return -ENODEV; 602 584 603 585 msg = genlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); ··· 735 717 int ret; 736 718 737 719 if (!(DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE & 738 - pin->prop->capabilities)) { 720 + pin->prop.capabilities)) { 739 721 NL_SET_ERR_MSG(extack, "state changing is not allowed"); 740 722 return -EOPNOTSUPP; 741 723 } ··· 771 753 int ret; 772 754 773 755 if (!(DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE & 774 - pin->prop->capabilities)) { 756 + pin->prop.capabilities)) { 775 757 NL_SET_ERR_MSG(extack, "state changing is not allowed"); 776 758 return -EOPNOTSUPP; 777 759 } ··· 798 780 int ret; 799 781 800 782 if (!(DPLL_PIN_CAPABILITIES_PRIORITY_CAN_CHANGE & 801 - pin->prop->capabilities)) { 783 + pin->prop.capabilities)) { 802 784 NL_SET_ERR_MSG(extack, "prio changing is not allowed"); 803 785 return -EOPNOTSUPP; 804 786 } ··· 826 808 int ret; 827 809 828 810 if (!(DPLL_PIN_CAPABILITIES_DIRECTION_CAN_CHANGE & 829 - pin->prop->capabilities)) { 811 + pin->prop.capabilities)) { 830 812 NL_SET_ERR_MSG(extack, "direction changing is not allowed"); 831 813 return -EOPNOTSUPP; 832 814 } ··· 856 838 int ret; 857 839 858 840 phase_adj = nla_get_s32(phase_adj_attr); 859 - if (phase_adj > pin->prop->phase_range.max || 860 - phase_adj < pin->prop->phase_range.min) { 841 + if (phase_adj > pin->prop.phase_range.max || 842 + phase_adj < pin->prop.phase_range.min) { 861 843 NL_SET_ERR_MSG_ATTR(extack, phase_adj_attr, 862 844 "phase adjust value not supported"); 863 845 return -EINVAL; ··· 1041 1023 unsigned long i; 1042 1024 1043 1025 xa_for_each_marked(&dpll_pin_xa, i, pin, DPLL_REGISTERED) { 1044 - prop = pin->prop; 1026 + prop = &pin->prop; 1045 1027 cid_match = clock_id ? pin->clock_id == clock_id : true; 1046 1028 mod_match = mod_name_attr && module_name(pin->module) ? 1047 1029 !nla_strcmp(mod_name_attr, ··· 1148 1130 } 1149 1131 pin = dpll_pin_find_from_nlattr(info); 1150 1132 if (!IS_ERR(pin)) { 1133 + if (!dpll_pin_available(pin)) { 1134 + nlmsg_free(msg); 1135 + return -ENODEV; 1136 + } 1151 1137 ret = dpll_msg_add_pin_handle(msg, pin); 1152 1138 if (ret) { 1153 1139 nlmsg_free(msg); ··· 1201 1179 1202 1180 xa_for_each_marked_start(&dpll_pin_xa, i, pin, DPLL_REGISTERED, 1203 1181 ctx->idx) { 1182 + if (!dpll_pin_available(pin)) 1183 + continue; 1204 1184 hdr = genlmsg_put(skb, NETLINK_CB(cb->skb).portid, 1205 1185 cb->nlh->nlmsg_seq, 1206 1186 &dpll_nl_family, NLM_F_MULTI, ··· 1465 1441 } 1466 1442 info->user_ptr[0] = xa_load(&dpll_pin_xa, 1467 1443 nla_get_u32(info->attrs[DPLL_A_PIN_ID])); 1468 - if (!info->user_ptr[0]) { 1444 + if (!info->user_ptr[0] || 1445 + !dpll_pin_available(info->user_ptr[0])) { 1469 1446 NL_SET_ERR_MSG(info->extack, "pin not found"); 1470 1447 ret = -ENODEV; 1471 1448 goto unlock_dev;
+57 -28
drivers/firmware/arm_ffa/driver.c
··· 107 107 struct work_struct notif_pcpu_work; 108 108 struct work_struct irq_work; 109 109 struct xarray partition_info; 110 - unsigned int partition_count; 111 110 DECLARE_HASHTABLE(notifier_hash, ilog2(FFA_MAX_NOTIFICATIONS)); 112 111 struct mutex notify_lock; /* lock to protect notifier hashtable */ 113 112 }; 114 113 115 114 static struct ffa_drv_info *drv_info; 115 + static void ffa_partitions_cleanup(void); 116 116 117 117 /* 118 118 * The driver must be able to support all the versions from the earliest ··· 733 733 void *cb_data; 734 734 735 735 partition = xa_load(&drv_info->partition_info, part_id); 736 + if (!partition) { 737 + pr_err("%s: Invalid partition ID 0x%x\n", __func__, part_id); 738 + return; 739 + } 740 + 736 741 read_lock(&partition->rw_lock); 737 742 callback = partition->callback; 738 743 cb_data = partition->cb_data; ··· 920 915 return -EOPNOTSUPP; 921 916 922 917 partition = xa_load(&drv_info->partition_info, part_id); 918 + if (!partition) { 919 + pr_err("%s: Invalid partition ID 0x%x\n", __func__, part_id); 920 + return -EINVAL; 921 + } 922 + 923 923 write_lock(&partition->rw_lock); 924 924 925 925 cb_valid = !!partition->callback; ··· 1196 1186 kfree(pbuf); 1197 1187 } 1198 1188 1199 - static void ffa_setup_partitions(void) 1189 + static int ffa_setup_partitions(void) 1200 1190 { 1201 - int count, idx; 1191 + int count, idx, ret; 1202 1192 uuid_t uuid; 1203 1193 struct ffa_device *ffa_dev; 1204 1194 struct ffa_dev_part_info *info; ··· 1207 1197 count = ffa_partition_probe(&uuid_null, &pbuf); 1208 1198 if (count <= 0) { 1209 1199 pr_info("%s: No partitions found, error %d\n", __func__, count); 1210 - return; 1200 + return -EINVAL; 1211 1201 } 1212 1202 1213 1203 xa_init(&drv_info->partition_info); ··· 1236 1226 ffa_device_unregister(ffa_dev); 1237 1227 continue; 1238 1228 } 1239 - xa_store(&drv_info->partition_info, tpbuf->id, info, GFP_KERNEL); 1229 + rwlock_init(&info->rw_lock); 1230 + ret = xa_insert(&drv_info->partition_info, tpbuf->id, 1231 + info, GFP_KERNEL); 1232 + if (ret) { 1233 + pr_err("%s: failed to save partition ID 0x%x - ret:%d\n", 1234 + __func__, tpbuf->id, ret); 1235 + ffa_device_unregister(ffa_dev); 1236 + kfree(info); 1237 + } 1240 1238 } 1241 - drv_info->partition_count = count; 1242 1239 1243 1240 kfree(pbuf); 1244 1241 1245 1242 /* Allocate for the host */ 1246 1243 info = kzalloc(sizeof(*info), GFP_KERNEL); 1247 - if (!info) 1248 - return; 1249 - xa_store(&drv_info->partition_info, drv_info->vm_id, info, GFP_KERNEL); 1250 - drv_info->partition_count++; 1244 + if (!info) { 1245 + pr_err("%s: failed to alloc Host partition ID 0x%x. Abort.\n", 1246 + __func__, drv_info->vm_id); 1247 + /* Already registered devices are freed on bus_exit */ 1248 + ffa_partitions_cleanup(); 1249 + return -ENOMEM; 1250 + } 1251 + 1252 + rwlock_init(&info->rw_lock); 1253 + ret = xa_insert(&drv_info->partition_info, drv_info->vm_id, 1254 + info, GFP_KERNEL); 1255 + if (ret) { 1256 + pr_err("%s: failed to save Host partition ID 0x%x - ret:%d. Abort.\n", 1257 + __func__, drv_info->vm_id, ret); 1258 + kfree(info); 1259 + /* Already registered devices are freed on bus_exit */ 1260 + ffa_partitions_cleanup(); 1261 + } 1262 + 1263 + return ret; 1251 1264 } 1252 1265 1253 1266 static void ffa_partitions_cleanup(void) 1254 1267 { 1255 - struct ffa_dev_part_info **info; 1256 - int idx, count = drv_info->partition_count; 1268 + struct ffa_dev_part_info *info; 1269 + unsigned long idx; 1257 1270 1258 - if (!count) 1259 - return; 1271 + xa_for_each(&drv_info->partition_info, idx, info) { 1272 + xa_erase(&drv_info->partition_info, idx); 1273 + kfree(info); 1274 + } 1260 1275 1261 - info = kcalloc(count, sizeof(*info), GFP_KERNEL); 1262 - if (!info) 1263 - return; 1264 - 1265 - xa_extract(&drv_info->partition_info, (void **)info, 0, VM_ID_MASK, 1266 - count, XA_PRESENT); 1267 - 1268 - for (idx = 0; idx < count; idx++) 1269 - kfree(info[idx]); 1270 - kfree(info); 1271 - 1272 - drv_info->partition_count = 0; 1273 1276 xa_destroy(&drv_info->partition_info); 1274 1277 } 1275 1278 ··· 1531 1508 1532 1509 ffa_notifications_setup(); 1533 1510 1534 - ffa_setup_partitions(); 1511 + ret = ffa_setup_partitions(); 1512 + if (ret) { 1513 + pr_err("failed to setup partitions\n"); 1514 + goto cleanup_notifs; 1515 + } 1535 1516 1536 1517 ret = ffa_sched_recv_cb_update(drv_info->vm_id, ffa_self_notif_handle, 1537 1518 drv_info, true); ··· 1543 1516 pr_info("Failed to register driver sched callback %d\n", ret); 1544 1517 1545 1518 return 0; 1519 + 1520 + cleanup_notifs: 1521 + ffa_notifications_cleanup(); 1546 1522 free_pages: 1547 1523 if (drv_info->tx_buffer) 1548 1524 free_pages_exact(drv_info->tx_buffer, RXTX_BUFFER_SIZE); ··· 1565 1535 ffa_rxtx_unmap(drv_info->vm_id); 1566 1536 free_pages_exact(drv_info->tx_buffer, RXTX_BUFFER_SIZE); 1567 1537 free_pages_exact(drv_info->rx_buffer, RXTX_BUFFER_SIZE); 1568 - xa_destroy(&drv_info->partition_info); 1569 1538 kfree(drv_info); 1570 1539 arm_ffa_bus_exit(); 1571 1540 }
+2 -3
drivers/firmware/arm_scmi/clock.c
··· 13 13 #include "notify.h" 14 14 15 15 /* Updated only after ALL the mandatory features for that version are merged */ 16 - #define SCMI_PROTOCOL_SUPPORTED_VERSION 0x20001 16 + #define SCMI_PROTOCOL_SUPPORTED_VERSION 0x20000 17 17 18 18 enum scmi_clock_protocol_cmd { 19 19 CLOCK_ATTRIBUTES = 0x3, ··· 954 954 scmi_clock_describe_rates_get(ph, clkid, clk); 955 955 } 956 956 957 - if (PROTOCOL_REV_MAJOR(version) >= 0x2 && 958 - PROTOCOL_REV_MINOR(version) >= 0x1) { 957 + if (PROTOCOL_REV_MAJOR(version) >= 0x3) { 959 958 cinfo->clock_config_set = scmi_clock_config_set_v2; 960 959 cinfo->clock_config_get = scmi_clock_config_get_v2; 961 960 } else {
+1
drivers/firmware/arm_scmi/common.h
··· 314 314 void shmem_clear_channel(struct scmi_shared_mem __iomem *shmem); 315 315 bool shmem_poll_done(struct scmi_shared_mem __iomem *shmem, 316 316 struct scmi_xfer *xfer); 317 + bool shmem_channel_free(struct scmi_shared_mem __iomem *shmem); 317 318 318 319 /* declarations for message passing transports */ 319 320 struct scmi_msg_payld;
+14
drivers/firmware/arm_scmi/mailbox.c
··· 45 45 { 46 46 struct scmi_mailbox *smbox = client_to_scmi_mailbox(cl); 47 47 48 + /* 49 + * An A2P IRQ is NOT valid when received while the platform still has 50 + * the ownership of the channel, because the platform at first releases 51 + * the SMT channel and then sends the completion interrupt. 52 + * 53 + * This addresses a possible race condition in which a spurious IRQ from 54 + * a previous timed-out reply which arrived late could be wrongly 55 + * associated with the next pending transaction. 56 + */ 57 + if (cl->knows_txdone && !shmem_channel_free(smbox->shmem)) { 58 + dev_warn(smbox->cinfo->dev, "Ignoring spurious A2P IRQ !\n"); 59 + return; 60 + } 61 + 48 62 scmi_rx_callback(smbox->cinfo, shmem_read_header(smbox->shmem), NULL); 49 63 } 50 64
+18 -5
drivers/firmware/arm_scmi/perf.c
··· 350 350 } 351 351 352 352 static inline void 353 - process_response_opp_v4(struct perf_dom_info *dom, struct scmi_opp *opp, 354 - unsigned int loop_idx, 353 + process_response_opp_v4(struct device *dev, struct perf_dom_info *dom, 354 + struct scmi_opp *opp, unsigned int loop_idx, 355 355 const struct scmi_msg_resp_perf_describe_levels_v4 *r) 356 356 { 357 357 opp->perf = le32_to_cpu(r->opp[loop_idx].perf_val); ··· 362 362 /* Note that PERF v4 reports always five 32-bit words */ 363 363 opp->indicative_freq = le32_to_cpu(r->opp[loop_idx].indicative_freq); 364 364 if (dom->level_indexing_mode) { 365 + int ret; 366 + 365 367 opp->level_index = le32_to_cpu(r->opp[loop_idx].level_index); 366 368 367 - xa_store(&dom->opps_by_idx, opp->level_index, opp, GFP_KERNEL); 368 - xa_store(&dom->opps_by_lvl, opp->perf, opp, GFP_KERNEL); 369 + ret = xa_insert(&dom->opps_by_idx, opp->level_index, opp, 370 + GFP_KERNEL); 371 + if (ret) 372 + dev_warn(dev, 373 + "Failed to add opps_by_idx at %d - ret:%d\n", 374 + opp->level_index, ret); 375 + 376 + ret = xa_insert(&dom->opps_by_lvl, opp->perf, opp, GFP_KERNEL); 377 + if (ret) 378 + dev_warn(dev, 379 + "Failed to add opps_by_lvl at %d - ret:%d\n", 380 + opp->perf, ret); 381 + 369 382 hash_add(dom->opps_by_freq, &opp->hash, opp->indicative_freq); 370 383 } 371 384 } ··· 395 382 if (PROTOCOL_REV_MAJOR(p->version) <= 0x3) 396 383 process_response_opp(opp, st->loop_idx, response); 397 384 else 398 - process_response_opp_v4(p->perf_dom, opp, st->loop_idx, 385 + process_response_opp_v4(ph->dev, p->perf_dom, opp, st->loop_idx, 399 386 response); 400 387 p->perf_dom->opp_count++; 401 388
+8 -4
drivers/firmware/arm_scmi/raw_mode.c
··· 1111 1111 int i; 1112 1112 1113 1113 for (i = 0; i < num_chans; i++) { 1114 - void *xret; 1115 1114 struct scmi_raw_queue *q; 1116 1115 1117 1116 q = scmi_raw_queue_init(raw); ··· 1119 1120 goto err_xa; 1120 1121 } 1121 1122 1122 - xret = xa_store(&raw->chans_q, channels[i], q, 1123 + ret = xa_insert(&raw->chans_q, channels[i], q, 1123 1124 GFP_KERNEL); 1124 - if (xa_err(xret)) { 1125 + if (ret) { 1125 1126 dev_err(dev, 1126 1127 "Fail to allocate Raw queue 0x%02X\n", 1127 1128 channels[i]); 1128 - ret = xa_err(xret); 1129 1129 goto err_xa; 1130 1130 } 1131 1131 } ··· 1320 1322 dev = raw->handle->dev; 1321 1323 q = scmi_raw_queue_select(raw, idx, 1322 1324 SCMI_XFER_IS_CHAN_SET(xfer) ? chan_id : 0); 1325 + if (!q) { 1326 + dev_warn(dev, 1327 + "RAW[%d] - NO queue for chan 0x%X. Dropping report.\n", 1328 + idx, chan_id); 1329 + return; 1330 + } 1323 1331 1324 1332 /* 1325 1333 * Grab the msg_q_lock upfront to avoid a possible race between
+7 -1
drivers/firmware/arm_scmi/shmem.c
··· 10 10 #include <linux/processor.h> 11 11 #include <linux/types.h> 12 12 13 - #include <asm-generic/bug.h> 13 + #include <linux/bug.h> 14 14 15 15 #include "common.h" 16 16 ··· 121 121 return ioread32(&shmem->channel_status) & 122 122 (SCMI_SHMEM_CHAN_STAT_CHANNEL_ERROR | 123 123 SCMI_SHMEM_CHAN_STAT_CHANNEL_FREE); 124 + } 125 + 126 + bool shmem_channel_free(struct scmi_shared_mem __iomem *shmem) 127 + { 128 + return (ioread32(&shmem->channel_status) & 129 + SCMI_SHMEM_CHAN_STAT_CHANNEL_FREE); 124 130 }
+1 -1
drivers/firmware/sysfb.c
··· 128 128 } 129 129 130 130 /* must execute after PCI subsystem for EFI quirks */ 131 - subsys_initcall_sync(sysfb_init); 131 + device_initcall(sysfb_init);
+28 -4
drivers/gpio/gpio-eic-sprd.c
··· 330 330 switch (flow_type) { 331 331 case IRQ_TYPE_LEVEL_HIGH: 332 332 sprd_eic_update(chip, offset, SPRD_EIC_DBNC_IEV, 1); 333 + sprd_eic_update(chip, offset, SPRD_EIC_DBNC_IC, 1); 333 334 break; 334 335 case IRQ_TYPE_LEVEL_LOW: 335 336 sprd_eic_update(chip, offset, SPRD_EIC_DBNC_IEV, 0); 337 + sprd_eic_update(chip, offset, SPRD_EIC_DBNC_IC, 1); 336 338 break; 337 339 case IRQ_TYPE_EDGE_RISING: 338 340 case IRQ_TYPE_EDGE_FALLING: 339 341 case IRQ_TYPE_EDGE_BOTH: 340 342 state = sprd_eic_get(chip, offset); 341 - if (state) 343 + if (state) { 342 344 sprd_eic_update(chip, offset, 343 345 SPRD_EIC_DBNC_IEV, 0); 344 - else 346 + sprd_eic_update(chip, offset, 347 + SPRD_EIC_DBNC_IC, 1); 348 + } else { 345 349 sprd_eic_update(chip, offset, 346 350 SPRD_EIC_DBNC_IEV, 1); 351 + sprd_eic_update(chip, offset, 352 + SPRD_EIC_DBNC_IC, 1); 353 + } 347 354 break; 348 355 default: 349 356 return -ENOTSUPP; ··· 362 355 switch (flow_type) { 363 356 case IRQ_TYPE_LEVEL_HIGH: 364 357 sprd_eic_update(chip, offset, SPRD_EIC_LATCH_INTPOL, 0); 358 + sprd_eic_update(chip, offset, SPRD_EIC_LATCH_INTCLR, 1); 365 359 break; 366 360 case IRQ_TYPE_LEVEL_LOW: 367 361 sprd_eic_update(chip, offset, SPRD_EIC_LATCH_INTPOL, 1); 362 + sprd_eic_update(chip, offset, SPRD_EIC_LATCH_INTCLR, 1); 368 363 break; 369 364 case IRQ_TYPE_EDGE_RISING: 370 365 case IRQ_TYPE_EDGE_FALLING: 371 366 case IRQ_TYPE_EDGE_BOTH: 372 367 state = sprd_eic_get(chip, offset); 373 - if (state) 368 + if (state) { 374 369 sprd_eic_update(chip, offset, 375 370 SPRD_EIC_LATCH_INTPOL, 0); 376 - else 371 + sprd_eic_update(chip, offset, 372 + SPRD_EIC_LATCH_INTCLR, 1); 373 + } else { 377 374 sprd_eic_update(chip, offset, 378 375 SPRD_EIC_LATCH_INTPOL, 1); 376 + sprd_eic_update(chip, offset, 377 + SPRD_EIC_LATCH_INTCLR, 1); 378 + } 379 379 break; 380 380 default: 381 381 return -ENOTSUPP; ··· 396 382 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTBOTH, 0); 397 383 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTMODE, 0); 398 384 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTPOL, 1); 385 + sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTCLR, 1); 399 386 irq_set_handler_locked(data, handle_edge_irq); 400 387 break; 401 388 case IRQ_TYPE_EDGE_FALLING: 402 389 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTBOTH, 0); 403 390 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTMODE, 0); 404 391 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTPOL, 0); 392 + sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTCLR, 1); 405 393 irq_set_handler_locked(data, handle_edge_irq); 406 394 break; 407 395 case IRQ_TYPE_EDGE_BOTH: 408 396 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTMODE, 0); 409 397 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTBOTH, 1); 398 + sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTCLR, 1); 410 399 irq_set_handler_locked(data, handle_edge_irq); 411 400 break; 412 401 case IRQ_TYPE_LEVEL_HIGH: 413 402 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTBOTH, 0); 414 403 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTMODE, 1); 415 404 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTPOL, 1); 405 + sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTCLR, 1); 416 406 irq_set_handler_locked(data, handle_level_irq); 417 407 break; 418 408 case IRQ_TYPE_LEVEL_LOW: 419 409 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTBOTH, 0); 420 410 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTMODE, 1); 421 411 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTPOL, 0); 412 + sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTCLR, 1); 422 413 irq_set_handler_locked(data, handle_level_irq); 423 414 break; 424 415 default: ··· 436 417 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTBOTH, 0); 437 418 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTMODE, 0); 438 419 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTPOL, 1); 420 + sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTCLR, 1); 439 421 irq_set_handler_locked(data, handle_edge_irq); 440 422 break; 441 423 case IRQ_TYPE_EDGE_FALLING: 442 424 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTBOTH, 0); 443 425 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTMODE, 0); 444 426 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTPOL, 0); 427 + sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTCLR, 1); 445 428 irq_set_handler_locked(data, handle_edge_irq); 446 429 break; 447 430 case IRQ_TYPE_EDGE_BOTH: 448 431 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTMODE, 0); 449 432 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTBOTH, 1); 433 + sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTCLR, 1); 450 434 irq_set_handler_locked(data, handle_edge_irq); 451 435 break; 452 436 case IRQ_TYPE_LEVEL_HIGH: 453 437 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTBOTH, 0); 454 438 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTMODE, 1); 455 439 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTPOL, 1); 440 + sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTCLR, 1); 456 441 irq_set_handler_locked(data, handle_level_irq); 457 442 break; 458 443 case IRQ_TYPE_LEVEL_LOW: 459 444 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTBOTH, 0); 460 445 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTMODE, 1); 461 446 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTPOL, 0); 447 + sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTCLR, 1); 462 448 irq_set_handler_locked(data, handle_level_irq); 463 449 break; 464 450 default:
+14
drivers/gpio/gpiolib-acpi.c
··· 1651 1651 .ignore_interrupt = "INT33FC:00@3", 1652 1652 }, 1653 1653 }, 1654 + { 1655 + /* 1656 + * Spurious wakeups from TP_ATTN# pin 1657 + * Found in BIOS 0.35 1658 + * https://gitlab.freedesktop.org/drm/amd/-/issues/3073 1659 + */ 1660 + .matches = { 1661 + DMI_MATCH(DMI_SYS_VENDOR, "GPD"), 1662 + DMI_MATCH(DMI_PRODUCT_NAME, "G1619-04"), 1663 + }, 1664 + .driver_data = &(struct acpi_gpiolib_dmi_quirk) { 1665 + .ignore_wake = "PNP0C50:00@8", 1666 + }, 1667 + }, 1654 1668 {} /* Terminating entry */ 1655 1669 }; 1656 1670
+8
drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
··· 121 121 struct amdgpu_bo_param bp; 122 122 dma_addr_t dma_addr; 123 123 struct page *p; 124 + unsigned long x; 124 125 int ret; 125 126 126 127 if (adev->gart.bo != NULL) ··· 130 129 p = alloc_pages(gfp_flags, order); 131 130 if (!p) 132 131 return -ENOMEM; 132 + 133 + /* assign pages to this device */ 134 + for (x = 0; x < (1UL << order); x++) 135 + p[x].mapping = adev->mman.bdev.dev_mapping; 133 136 134 137 /* If the hardware does not support UTCL2 snooping of the CPU caches 135 138 * then set_memory_wc() could be used as a workaround to mark the pages ··· 228 223 unsigned int order = get_order(adev->gart.table_size); 229 224 struct sg_table *sg = adev->gart.bo->tbo.sg; 230 225 struct page *p; 226 + unsigned long x; 231 227 int ret; 232 228 233 229 ret = amdgpu_bo_reserve(adev->gart.bo, false); ··· 240 234 sg_free_table(sg); 241 235 kfree(sg); 242 236 p = virt_to_page(adev->gart.ptr); 237 + for (x = 0; x < (1UL << order); x++) 238 + p[x].mapping = NULL; 243 239 __free_pages(p, order); 244 240 245 241 adev->gart.ptr = NULL;
+16 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
··· 221 221 NULL 222 222 }; 223 223 224 + static umode_t amdgpu_vram_attrs_is_visible(struct kobject *kobj, 225 + struct attribute *attr, int i) 226 + { 227 + struct device *dev = kobj_to_dev(kobj); 228 + struct drm_device *ddev = dev_get_drvdata(dev); 229 + struct amdgpu_device *adev = drm_to_adev(ddev); 230 + 231 + if (attr == &dev_attr_mem_info_vram_vendor.attr && 232 + !adev->gmc.vram_vendor) 233 + return 0; 234 + 235 + return attr->mode; 236 + } 237 + 224 238 const struct attribute_group amdgpu_vram_mgr_attr_group = { 225 - .attrs = amdgpu_vram_mgr_attributes 239 + .attrs = amdgpu_vram_mgr_attributes, 240 + .is_visible = amdgpu_vram_attrs_is_visible 226 241 }; 227 242 228 243 /**
+1 -1
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
··· 6589 6589 #ifdef __BIG_ENDIAN 6590 6590 tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, ENDIAN_SWAP, 1); 6591 6591 #endif 6592 - tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, UNORD_DISPATCH, 0); 6592 + tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, UNORD_DISPATCH, 1); 6593 6593 tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, TUNNEL_DISPATCH, 6594 6594 prop->allow_tunneling); 6595 6595 tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, PRIV_STATE, 1);
+1 -1
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
··· 3846 3846 (order_base_2(prop->queue_size / 4) - 1)); 3847 3847 tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, RPTR_BLOCK_SIZE, 3848 3848 (order_base_2(AMDGPU_GPU_PAGE_SIZE / 4) - 1)); 3849 - tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, UNORD_DISPATCH, 0); 3849 + tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, UNORD_DISPATCH, 1); 3850 3850 tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, TUNNEL_DISPATCH, 3851 3851 prop->allow_tunneling); 3852 3852 tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, PRIV_STATE, 1);
+2 -1
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
··· 1950 1950 static const u32 regBIF_BIOS_SCRATCH_4 = 0x50; 1951 1951 u32 vram_info; 1952 1952 1953 - if (!amdgpu_sriov_vf(adev)) { 1953 + /* Only for dGPU, vendor informaton is reliable */ 1954 + if (!amdgpu_sriov_vf(adev) && !(adev->flags & AMD_IS_APU)) { 1954 1955 vram_info = RREG32(regBIF_BIOS_SCRATCH_4); 1955 1956 adev->gmc.vram_vendor = vram_info & 0xF; 1956 1957 }
+1
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c
··· 170 170 m->cp_hqd_pq_control = 5 << CP_HQD_PQ_CONTROL__RPTR_BLOCK_SIZE__SHIFT; 171 171 m->cp_hqd_pq_control |= 172 172 ffs(q->queue_size / sizeof(unsigned int)) - 1 - 1; 173 + m->cp_hqd_pq_control |= CP_HQD_PQ_CONTROL__UNORD_DISPATCH_MASK; 173 174 pr_debug("cp_hqd_pq_control 0x%x\n", m->cp_hqd_pq_control); 174 175 175 176 m->cp_hqd_pq_base_lo = lower_32_bits((uint64_t)q->queue_address >> 8);
+1
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c
··· 224 224 m->cp_hqd_pq_control = 5 << CP_HQD_PQ_CONTROL__RPTR_BLOCK_SIZE__SHIFT; 225 225 m->cp_hqd_pq_control |= 226 226 ffs(q->queue_size / sizeof(unsigned int)) - 1 - 1; 227 + m->cp_hqd_pq_control |= CP_HQD_PQ_CONTROL__UNORD_DISPATCH_MASK; 227 228 pr_debug("cp_hqd_pq_control 0x%x\n", m->cp_hqd_pq_control); 228 229 229 230 m->cp_hqd_pq_base_lo = lower_32_bits((uint64_t)q->queue_address >> 8);
+10 -11
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 272 272 { 273 273 u32 v_blank_start, v_blank_end, h_position, v_position; 274 274 struct amdgpu_crtc *acrtc = NULL; 275 + struct dc *dc = adev->dm.dc; 275 276 276 277 if ((crtc < 0) || (crtc >= adev->mode_info.num_crtc)) 277 278 return -EINVAL; ··· 284 283 crtc); 285 284 return 0; 286 285 } 286 + 287 + if (dc && dc->caps.ips_support && dc->idle_optimizations_allowed) 288 + dc_allow_idle_optimizations(dc, false); 287 289 288 290 /* 289 291 * TODO rework base driver to use values directly. ··· 1719 1715 init_data.nbio_reg_offsets = adev->reg_offset[NBIO_HWIP][0]; 1720 1716 init_data.clk_reg_offsets = adev->reg_offset[CLK_HWIP][0]; 1721 1717 1722 - init_data.flags.disable_ips = DMUB_IPS_DISABLE_ALL; 1718 + if (amdgpu_dc_debug_mask & DC_DISABLE_IPS) 1719 + init_data.flags.disable_ips = DMUB_IPS_DISABLE_ALL; 1720 + 1721 + init_data.flags.disable_ips_in_vpb = 1; 1723 1722 1724 1723 /* Enable DWB for tested platforms only */ 1725 1724 if (amdgpu_ip_version(adev, DCE_HWIP, 0) >= IP_VERSION(3, 0, 0)) ··· 8983 8976 8984 8977 trace_amdgpu_dm_atomic_commit_tail_begin(state); 8985 8978 8986 - if (dm->dc->caps.ips_support) { 8987 - for_each_oldnew_connector_in_state(state, connector, old_con_state, new_con_state, i) { 8988 - if (new_con_state->crtc && 8989 - new_con_state->crtc->state->active && 8990 - drm_atomic_crtc_needs_modeset(new_con_state->crtc->state)) { 8991 - dc_dmub_srv_apply_idle_power_optimizations(dm->dc, false); 8992 - break; 8993 - } 8994 - } 8995 - } 8979 + if (dm->dc->caps.ips_support && dm->dc->idle_optimizations_allowed) 8980 + dc_allow_idle_optimizations(dm->dc, false); 8996 8981 8997 8982 drm_atomic_helper_update_legacy_modeset_state(dev, state); 8998 8983 drm_dp_mst_atomic_wait_for_dependencies(state);
+4 -1
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c
··· 711 711 { 712 712 bool st; 713 713 enum dc_irq_source irq_source; 714 - 714 + struct dc *dc = adev->dm.dc; 715 715 struct amdgpu_crtc *acrtc = adev->mode_info.crtcs[crtc_id]; 716 716 717 717 if (!acrtc) { ··· 728 728 irq_source = dal_irq_type + acrtc->otg_inst; 729 729 730 730 st = (state == AMDGPU_IRQ_STATE_ENABLE); 731 + 732 + if (dc && dc->caps.ips_support && dc->idle_optimizations_allowed) 733 + dc_allow_idle_optimizations(dc, false); 731 734 732 735 dc_interrupt_set(adev->dm.dc, irq_source, st); 733 736 return 0;
+1
drivers/gpu/drm/amd/display/dc/dc.h
··· 434 434 bool EnableMinDispClkODM; 435 435 bool enable_auto_dpm_test_logs; 436 436 unsigned int disable_ips; 437 + unsigned int disable_ips_in_vpb; 437 438 }; 438 439 439 440 enum visual_confirm {
+5
drivers/gpu/drm/amd/display/dc/dc_types.h
··· 1034 1034 Replay_Msg_Not_Support = -1, 1035 1035 Replay_Set_Timing_Sync_Supported, 1036 1036 Replay_Set_Residency_Frameupdate_Timer, 1037 + Replay_Set_Pseudo_VTotal, 1037 1038 }; 1038 1039 1039 1040 union replay_error_status { ··· 1090 1089 uint16_t coasting_vtotal_table[PR_COASTING_TYPE_NUM]; 1091 1090 /* Maximum link off frame count */ 1092 1091 enum replay_link_off_frame_count_level link_off_frame_count_level; 1092 + /* Replay pseudo vtotal for abm + ips on full screen video which can improve ips residency */ 1093 + uint16_t abm_with_ips_on_full_screen_video_pseudo_vtotal; 1094 + /* Replay last pseudo vtotal set to DMUB */ 1095 + uint16_t last_pseudo_vtotal; 1093 1096 }; 1094 1097 1095 1098 /* To split out "global" and "per-panel" config settings.
+8 -1
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c
··· 680 680 bool dcn35_apply_idle_power_optimizations(struct dc *dc, bool enable) 681 681 { 682 682 struct dc_link *edp_links[MAX_NUM_EDP]; 683 - int edp_num; 683 + int i, edp_num; 684 684 if (dc->debug.dmcub_emulation) 685 685 return true; 686 686 ··· 688 688 dc_get_edp_links(dc, edp_links, &edp_num); 689 689 if (edp_num == 0 || edp_num > 1) 690 690 return false; 691 + 692 + for (i = 0; i < dc->current_state->stream_count; ++i) { 693 + struct dc_stream_state *stream = dc->current_state->streams[i]; 694 + 695 + if (!stream->dpms_off && !dc_is_embedded_signal(stream->signal)) 696 + return false; 697 + } 691 698 } 692 699 693 700 // TODO: review other cases when idle optimization is allowed
+47
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
··· 2832 2832 #define REPLAY_RESIDENCY_MODE_MASK (0x1 << REPLAY_RESIDENCY_MODE_SHIFT) 2833 2833 # define REPLAY_RESIDENCY_MODE_PHY (0x0 << REPLAY_RESIDENCY_MODE_SHIFT) 2834 2834 # define REPLAY_RESIDENCY_MODE_ALPM (0x1 << REPLAY_RESIDENCY_MODE_SHIFT) 2835 + # define REPLAY_RESIDENCY_MODE_IPS 0x10 2835 2836 2836 2837 #define REPLAY_RESIDENCY_ENABLE_MASK (0x1 << REPLAY_RESIDENCY_ENABLE_SHIFT) 2837 2838 # define REPLAY_RESIDENCY_DISABLE (0x0 << REPLAY_RESIDENCY_ENABLE_SHIFT) ··· 2895 2894 * Set Residency Frameupdate Timer. 2896 2895 */ 2897 2896 DMUB_CMD__REPLAY_SET_RESIDENCY_FRAMEUPDATE_TIMER = 6, 2897 + /** 2898 + * Set pseudo vtotal 2899 + */ 2900 + DMUB_CMD__REPLAY_SET_PSEUDO_VTOTAL = 7, 2898 2901 }; 2899 2902 2900 2903 /** ··· 3082 3077 }; 3083 3078 3084 3079 /** 3080 + * Data passed from driver to FW in a DMUB_CMD__REPLAY_SET_PSEUDO_VTOTAL command. 3081 + */ 3082 + struct dmub_cmd_replay_set_pseudo_vtotal { 3083 + /** 3084 + * Panel Instance. 3085 + * Panel isntance to identify which replay_state to use 3086 + * Currently the support is only for 0 or 1 3087 + */ 3088 + uint8_t panel_inst; 3089 + /** 3090 + * Source Vtotal that Replay + IPS + ABM full screen video src vtotal 3091 + */ 3092 + uint16_t vtotal; 3093 + /** 3094 + * Explicit padding to 4 byte boundary. 3095 + */ 3096 + uint8_t pad; 3097 + }; 3098 + 3099 + /** 3085 3100 * Definition of a DMUB_CMD__SET_REPLAY_POWER_OPT command. 3086 3101 */ 3087 3102 struct dmub_rb_cmd_replay_set_power_opt { ··· 3182 3157 }; 3183 3158 3184 3159 /** 3160 + * Definition of a DMUB_CMD__REPLAY_SET_PSEUDO_VTOTAL command. 3161 + */ 3162 + struct dmub_rb_cmd_replay_set_pseudo_vtotal { 3163 + /** 3164 + * Command header. 3165 + */ 3166 + struct dmub_cmd_header header; 3167 + /** 3168 + * Definition of DMUB_CMD__REPLAY_SET_PSEUDO_VTOTAL command. 3169 + */ 3170 + struct dmub_cmd_replay_set_pseudo_vtotal data; 3171 + }; 3172 + 3173 + /** 3185 3174 * Data passed from driver to FW in DMUB_CMD__REPLAY_SET_RESIDENCY_FRAMEUPDATE_TIMER command. 3186 3175 */ 3187 3176 struct dmub_cmd_replay_frameupdate_timer_data { ··· 3246 3207 * Definition of DMUB_CMD__REPLAY_SET_RESIDENCY_FRAMEUPDATE_TIMER command data. 3247 3208 */ 3248 3209 struct dmub_cmd_replay_frameupdate_timer_data timer_data; 3210 + /** 3211 + * Definition of DMUB_CMD__REPLAY_SET_PSEUDO_VTOTAL command data. 3212 + */ 3213 + struct dmub_cmd_replay_set_pseudo_vtotal pseudo_vtotal_data; 3249 3214 }; 3250 3215 3251 3216 /** ··· 4401 4358 * Definition of a DMUB_CMD__REPLAY_SET_RESIDENCY_FRAMEUPDATE_TIMER command. 4402 4359 */ 4403 4360 struct dmub_rb_cmd_replay_set_frameupdate_timer replay_set_frameupdate_timer; 4361 + /** 4362 + * Definition of a DMUB_CMD__REPLAY_SET_PSEUDO_VTOTAL command. 4363 + */ 4364 + struct dmub_rb_cmd_replay_set_pseudo_vtotal replay_set_pseudo_vtotal; 4404 4365 }; 4405 4366 4406 4367 /**
+5
drivers/gpu/drm/amd/display/modules/power/power_helpers.c
··· 980 980 link->replay_settings.coasting_vtotal_table[type] = vtotal; 981 981 } 982 982 983 + void set_replay_ips_full_screen_video_src_vtotal(struct dc_link *link, uint16_t vtotal) 984 + { 985 + link->replay_settings.abm_with_ips_on_full_screen_video_pseudo_vtotal = vtotal; 986 + } 987 + 983 988 void calculate_replay_link_off_frame_count(struct dc_link *link, 984 989 uint16_t vtotal, uint16_t htotal) 985 990 {
+1
drivers/gpu/drm/amd/display/modules/power/power_helpers.h
··· 57 57 void set_replay_coasting_vtotal(struct dc_link *link, 58 58 enum replay_coasting_vtotal_type type, 59 59 uint16_t vtotal); 60 + void set_replay_ips_full_screen_video_src_vtotal(struct dc_link *link, uint16_t vtotal); 60 61 void calculate_replay_link_off_frame_count(struct dc_link *link, 61 62 uint16_t vtotal, uint16_t htotal); 62 63
+1
drivers/gpu/drm/amd/include/amd_shared.h
··· 258 258 DC_ENABLE_DML2 = 0x100, 259 259 DC_DISABLE_PSR_SU = 0x200, 260 260 DC_DISABLE_REPLAY = 0x400, 261 + DC_DISABLE_IPS = 0x800, 261 262 }; 262 263 263 264 enum amd_dpm_forced_level;
+1 -1
drivers/gpu/drm/amd/include/amdgpu_reg_state.h
··· 138 138 } 139 139 140 140 #define amdgpu_asic_get_reg_state_supported(adev) \ 141 - ((adev)->asic_funcs->get_reg_state ? 1 : 0) 141 + (((adev)->asic_funcs && (adev)->asic_funcs->get_reg_state) ? 1 : 0) 142 142 143 143 #define amdgpu_asic_get_reg_state(adev, state, buf, size) \ 144 144 ((adev)->asic_funcs->get_reg_state ? \
+4 -10
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
··· 24 24 25 25 #include <linux/firmware.h> 26 26 #include <linux/pci.h> 27 + #include <linux/power_supply.h> 27 28 #include <linux/reboot.h> 28 29 29 30 #include "amdgpu.h" ··· 818 817 * handle the switch automatically. Driver involvement 819 818 * is unnecessary. 820 819 */ 821 - if (!smu->dc_controlled_by_gpio) { 822 - ret = smu_set_power_source(smu, 823 - adev->pm.ac_power ? SMU_POWER_SOURCE_AC : 824 - SMU_POWER_SOURCE_DC); 825 - if (ret) { 826 - dev_err(adev->dev, "Failed to switch to %s mode!\n", 827 - adev->pm.ac_power ? "AC" : "DC"); 828 - return ret; 829 - } 830 - } 820 + adev->pm.ac_power = power_supply_is_system_supplied() > 0; 821 + smu_set_ac_dc(smu); 831 822 832 823 if ((amdgpu_ip_version(adev, MP1_HWIP, 0) == IP_VERSION(13, 0, 1)) || 833 824 (amdgpu_ip_version(adev, MP1_HWIP, 0) == IP_VERSION(13, 0, 3))) ··· 2703 2710 case SMU_PPT_LIMIT_CURRENT: 2704 2711 switch (amdgpu_ip_version(adev, MP1_HWIP, 0)) { 2705 2712 case IP_VERSION(13, 0, 2): 2713 + case IP_VERSION(13, 0, 6): 2706 2714 case IP_VERSION(11, 0, 7): 2707 2715 case IP_VERSION(11, 0, 11): 2708 2716 case IP_VERSION(11, 0, 12):
+2
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
··· 1442 1442 case 0x3: 1443 1443 dev_dbg(adev->dev, "Switched to AC mode!\n"); 1444 1444 schedule_work(&smu->interrupt_work); 1445 + adev->pm.ac_power = true; 1445 1446 break; 1446 1447 case 0x4: 1447 1448 dev_dbg(adev->dev, "Switched to DC mode!\n"); 1448 1449 schedule_work(&smu->interrupt_work); 1450 + adev->pm.ac_power = false; 1449 1451 break; 1450 1452 case 0x7: 1451 1453 /*
+2
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
··· 1379 1379 case 0x3: 1380 1380 dev_dbg(adev->dev, "Switched to AC mode!\n"); 1381 1381 smu_v13_0_ack_ac_dc_interrupt(smu); 1382 + adev->pm.ac_power = true; 1382 1383 break; 1383 1384 case 0x4: 1384 1385 dev_dbg(adev->dev, "Switched to DC mode!\n"); 1385 1386 smu_v13_0_ack_ac_dc_interrupt(smu); 1387 + adev->pm.ac_power = false; 1386 1388 break; 1387 1389 case 0x7: 1388 1390 /*
+52 -2
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
··· 2357 2357 PPTable_t *pptable = table_context->driver_pptable; 2358 2358 SkuTable_t *skutable = &pptable->SkuTable; 2359 2359 uint32_t power_limit, od_percent_upper, od_percent_lower; 2360 + uint32_t msg_limit = skutable->MsgLimits.Power[PPT_THROTTLER_PPT0][POWER_SOURCE_AC]; 2360 2361 2361 2362 if (smu_v13_0_get_current_power_limit(smu, &power_limit)) 2362 2363 power_limit = smu->adev->pm.ac_power ? ··· 2381 2380 od_percent_upper, od_percent_lower, power_limit); 2382 2381 2383 2382 if (max_power_limit) { 2384 - *max_power_limit = power_limit * (100 + od_percent_upper); 2383 + *max_power_limit = msg_limit * (100 + od_percent_upper); 2385 2384 *max_power_limit /= 100; 2386 2385 } 2387 2386 ··· 2960 2959 } 2961 2960 } 2962 2961 2962 + static int smu_v13_0_0_set_power_limit(struct smu_context *smu, 2963 + enum smu_ppt_limit_type limit_type, 2964 + uint32_t limit) 2965 + { 2966 + PPTable_t *pptable = smu->smu_table.driver_pptable; 2967 + SkuTable_t *skutable = &pptable->SkuTable; 2968 + uint32_t msg_limit = skutable->MsgLimits.Power[PPT_THROTTLER_PPT0][POWER_SOURCE_AC]; 2969 + struct smu_table_context *table_context = &smu->smu_table; 2970 + OverDriveTableExternal_t *od_table = 2971 + (OverDriveTableExternal_t *)table_context->overdrive_table; 2972 + int ret = 0; 2973 + 2974 + if (limit_type != SMU_DEFAULT_PPT_LIMIT) 2975 + return -EINVAL; 2976 + 2977 + if (limit <= msg_limit) { 2978 + if (smu->current_power_limit > msg_limit) { 2979 + od_table->OverDriveTable.Ppt = 0; 2980 + od_table->OverDriveTable.FeatureCtrlMask |= 1U << PP_OD_FEATURE_PPT_BIT; 2981 + 2982 + ret = smu_v13_0_0_upload_overdrive_table(smu, od_table); 2983 + if (ret) { 2984 + dev_err(smu->adev->dev, "Failed to upload overdrive table!\n"); 2985 + return ret; 2986 + } 2987 + } 2988 + return smu_v13_0_set_power_limit(smu, limit_type, limit); 2989 + } else if (smu->od_enabled) { 2990 + ret = smu_v13_0_set_power_limit(smu, limit_type, msg_limit); 2991 + if (ret) 2992 + return ret; 2993 + 2994 + od_table->OverDriveTable.Ppt = (limit * 100) / msg_limit - 100; 2995 + od_table->OverDriveTable.FeatureCtrlMask |= 1U << PP_OD_FEATURE_PPT_BIT; 2996 + 2997 + ret = smu_v13_0_0_upload_overdrive_table(smu, od_table); 2998 + if (ret) { 2999 + dev_err(smu->adev->dev, "Failed to upload overdrive table!\n"); 3000 + return ret; 3001 + } 3002 + 3003 + smu->current_power_limit = limit; 3004 + } else { 3005 + return -EINVAL; 3006 + } 3007 + 3008 + return 0; 3009 + } 3010 + 2963 3011 static const struct pptable_funcs smu_v13_0_0_ppt_funcs = { 2964 3012 .get_allowed_feature_mask = smu_v13_0_0_get_allowed_feature_mask, 2965 3013 .set_default_dpm_table = smu_v13_0_0_set_default_dpm_table, ··· 3063 3013 .set_fan_control_mode = smu_v13_0_set_fan_control_mode, 3064 3014 .enable_mgpu_fan_boost = smu_v13_0_0_enable_mgpu_fan_boost, 3065 3015 .get_power_limit = smu_v13_0_0_get_power_limit, 3066 - .set_power_limit = smu_v13_0_set_power_limit, 3016 + .set_power_limit = smu_v13_0_0_set_power_limit, 3067 3017 .set_power_source = smu_v13_0_set_power_source, 3068 3018 .get_power_profile_mode = smu_v13_0_0_get_power_profile_mode, 3069 3019 .set_power_profile_mode = smu_v13_0_0_set_power_profile_mode,
+2 -2
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
··· 160 160 MSG_MAP(GfxDriverResetRecovery, PPSMC_MSG_GfxDriverResetRecovery, 0), 161 161 MSG_MAP(GetMinGfxclkFrequency, PPSMC_MSG_GetMinGfxDpmFreq, 1), 162 162 MSG_MAP(GetMaxGfxclkFrequency, PPSMC_MSG_GetMaxGfxDpmFreq, 1), 163 - MSG_MAP(SetSoftMinGfxclk, PPSMC_MSG_SetSoftMinGfxClk, 0), 164 - MSG_MAP(SetSoftMaxGfxClk, PPSMC_MSG_SetSoftMaxGfxClk, 0), 163 + MSG_MAP(SetSoftMinGfxclk, PPSMC_MSG_SetSoftMinGfxClk, 1), 164 + MSG_MAP(SetSoftMaxGfxClk, PPSMC_MSG_SetSoftMaxGfxClk, 1), 165 165 MSG_MAP(PrepareMp1ForUnload, PPSMC_MSG_PrepareForDriverUnload, 0), 166 166 MSG_MAP(GetCTFLimit, PPSMC_MSG_GetCTFLimit, 0), 167 167 MSG_MAP(GetThermalLimit, PPSMC_MSG_ReadThrottlerLimit, 0),
+52 -2
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
··· 2321 2321 PPTable_t *pptable = table_context->driver_pptable; 2322 2322 SkuTable_t *skutable = &pptable->SkuTable; 2323 2323 uint32_t power_limit, od_percent_upper, od_percent_lower; 2324 + uint32_t msg_limit = skutable->MsgLimits.Power[PPT_THROTTLER_PPT0][POWER_SOURCE_AC]; 2324 2325 2325 2326 if (smu_v13_0_get_current_power_limit(smu, &power_limit)) 2326 2327 power_limit = smu->adev->pm.ac_power ? ··· 2345 2344 od_percent_upper, od_percent_lower, power_limit); 2346 2345 2347 2346 if (max_power_limit) { 2348 - *max_power_limit = power_limit * (100 + od_percent_upper); 2347 + *max_power_limit = msg_limit * (100 + od_percent_upper); 2349 2348 *max_power_limit /= 100; 2350 2349 } 2351 2350 ··· 2546 2545 return smu->smc_fw_version > 0x00524600; 2547 2546 } 2548 2547 2548 + static int smu_v13_0_7_set_power_limit(struct smu_context *smu, 2549 + enum smu_ppt_limit_type limit_type, 2550 + uint32_t limit) 2551 + { 2552 + PPTable_t *pptable = smu->smu_table.driver_pptable; 2553 + SkuTable_t *skutable = &pptable->SkuTable; 2554 + uint32_t msg_limit = skutable->MsgLimits.Power[PPT_THROTTLER_PPT0][POWER_SOURCE_AC]; 2555 + struct smu_table_context *table_context = &smu->smu_table; 2556 + OverDriveTableExternal_t *od_table = 2557 + (OverDriveTableExternal_t *)table_context->overdrive_table; 2558 + int ret = 0; 2559 + 2560 + if (limit_type != SMU_DEFAULT_PPT_LIMIT) 2561 + return -EINVAL; 2562 + 2563 + if (limit <= msg_limit) { 2564 + if (smu->current_power_limit > msg_limit) { 2565 + od_table->OverDriveTable.Ppt = 0; 2566 + od_table->OverDriveTable.FeatureCtrlMask |= 1U << PP_OD_FEATURE_PPT_BIT; 2567 + 2568 + ret = smu_v13_0_7_upload_overdrive_table(smu, od_table); 2569 + if (ret) { 2570 + dev_err(smu->adev->dev, "Failed to upload overdrive table!\n"); 2571 + return ret; 2572 + } 2573 + } 2574 + return smu_v13_0_set_power_limit(smu, limit_type, limit); 2575 + } else if (smu->od_enabled) { 2576 + ret = smu_v13_0_set_power_limit(smu, limit_type, msg_limit); 2577 + if (ret) 2578 + return ret; 2579 + 2580 + od_table->OverDriveTable.Ppt = (limit * 100) / msg_limit - 100; 2581 + od_table->OverDriveTable.FeatureCtrlMask |= 1U << PP_OD_FEATURE_PPT_BIT; 2582 + 2583 + ret = smu_v13_0_7_upload_overdrive_table(smu, od_table); 2584 + if (ret) { 2585 + dev_err(smu->adev->dev, "Failed to upload overdrive table!\n"); 2586 + return ret; 2587 + } 2588 + 2589 + smu->current_power_limit = limit; 2590 + } else { 2591 + return -EINVAL; 2592 + } 2593 + 2594 + return 0; 2595 + } 2596 + 2549 2597 static const struct pptable_funcs smu_v13_0_7_ppt_funcs = { 2550 2598 .get_allowed_feature_mask = smu_v13_0_7_get_allowed_feature_mask, 2551 2599 .set_default_dpm_table = smu_v13_0_7_set_default_dpm_table, ··· 2646 2596 .set_fan_control_mode = smu_v13_0_set_fan_control_mode, 2647 2597 .enable_mgpu_fan_boost = smu_v13_0_7_enable_mgpu_fan_boost, 2648 2598 .get_power_limit = smu_v13_0_7_get_power_limit, 2649 - .set_power_limit = smu_v13_0_set_power_limit, 2599 + .set_power_limit = smu_v13_0_7_set_power_limit, 2650 2600 .set_power_source = smu_v13_0_set_power_source, 2651 2601 .get_power_profile_mode = smu_v13_0_7_get_power_profile_mode, 2652 2602 .set_power_profile_mode = smu_v13_0_7_set_power_profile_mode,
+6 -1
drivers/gpu/drm/bridge/analogix/anx7625.c
··· 1762 1762 u8 request = msg->request & ~DP_AUX_I2C_MOT; 1763 1763 int ret = 0; 1764 1764 1765 + mutex_lock(&ctx->aux_lock); 1765 1766 pm_runtime_get_sync(dev); 1766 1767 msg->reply = 0; 1767 1768 switch (request) { ··· 1779 1778 msg->size, msg->buffer); 1780 1779 pm_runtime_mark_last_busy(dev); 1781 1780 pm_runtime_put_autosuspend(dev); 1781 + mutex_unlock(&ctx->aux_lock); 1782 1782 1783 1783 return ret; 1784 1784 } ··· 2476 2474 ctx->connector = NULL; 2477 2475 anx7625_dp_stop(ctx); 2478 2476 2479 - pm_runtime_put_sync(dev); 2477 + mutex_lock(&ctx->aux_lock); 2478 + pm_runtime_put_sync_suspend(dev); 2479 + mutex_unlock(&ctx->aux_lock); 2480 2480 } 2481 2481 2482 2482 static enum drm_connector_status ··· 2672 2668 2673 2669 mutex_init(&platform->lock); 2674 2670 mutex_init(&platform->hdcp_wq_lock); 2671 + mutex_init(&platform->aux_lock); 2675 2672 2676 2673 INIT_DELAYED_WORK(&platform->hdcp_work, hdcp_check_work_func); 2677 2674 platform->hdcp_workqueue = create_workqueue("hdcp workqueue");
+2
drivers/gpu/drm/bridge/analogix/anx7625.h
··· 475 475 struct workqueue_struct *hdcp_workqueue; 476 476 /* Lock for hdcp work queue */ 477 477 struct mutex hdcp_wq_lock; 478 + /* Lock for aux transfer and disable */ 479 + struct mutex aux_lock; 478 480 char edid_block; 479 481 struct display_timing dt; 480 482 u8 display_timing_valid;
+23
drivers/gpu/drm/bridge/parade-ps8640.c
··· 107 107 struct device_link *link; 108 108 bool pre_enabled; 109 109 bool need_post_hpd_delay; 110 + struct mutex aux_lock; 110 111 }; 111 112 112 113 static const struct regmap_config ps8640_regmap_config[] = { ··· 346 345 struct device *dev = &ps_bridge->page[PAGE0_DP_CNTL]->dev; 347 346 int ret; 348 347 348 + mutex_lock(&ps_bridge->aux_lock); 349 349 pm_runtime_get_sync(dev); 350 + ret = _ps8640_wait_hpd_asserted(ps_bridge, 200 * 1000); 351 + if (ret) { 352 + pm_runtime_put_sync_suspend(dev); 353 + goto exit; 354 + } 350 355 ret = ps8640_aux_transfer_msg(aux, msg); 351 356 pm_runtime_mark_last_busy(dev); 352 357 pm_runtime_put_autosuspend(dev); 358 + 359 + exit: 360 + mutex_unlock(&ps_bridge->aux_lock); 353 361 354 362 return ret; 355 363 } ··· 480 470 ps_bridge->pre_enabled = false; 481 471 482 472 ps8640_bridge_vdo_control(ps_bridge, DISABLE); 473 + 474 + /* 475 + * The bridge seems to expect everything to be power cycled at the 476 + * disable process, so grab a lock here to make sure 477 + * ps8640_aux_transfer() is not holding a runtime PM reference and 478 + * preventing the bridge from suspend. 479 + */ 480 + mutex_lock(&ps_bridge->aux_lock); 481 + 483 482 pm_runtime_put_sync_suspend(&ps_bridge->page[PAGE0_DP_CNTL]->dev); 483 + 484 + mutex_unlock(&ps_bridge->aux_lock); 484 485 } 485 486 486 487 static int ps8640_bridge_attach(struct drm_bridge *bridge, ··· 639 618 ps_bridge = devm_kzalloc(dev, sizeof(*ps_bridge), GFP_KERNEL); 640 619 if (!ps_bridge) 641 620 return -ENOMEM; 621 + 622 + mutex_init(&ps_bridge->aux_lock); 642 623 643 624 ps_bridge->supplies[0].supply = "vdd12"; 644 625 ps_bridge->supplies[1].supply = "vdd33";
+2 -30
drivers/gpu/drm/bridge/samsung-dsim.c
··· 969 969 reg = samsung_dsim_read(dsi, DSIM_ESCMODE_REG); 970 970 reg &= ~DSIM_STOP_STATE_CNT_MASK; 971 971 reg |= DSIM_STOP_STATE_CNT(driver_data->reg_values[STOP_STATE_CNT]); 972 - 973 - if (!samsung_dsim_hw_is_exynos(dsi->plat_data->hw_type)) 974 - reg |= DSIM_FORCE_STOP_STATE; 975 - 976 972 samsung_dsim_write(dsi, DSIM_ESCMODE_REG, reg); 977 973 978 974 reg = DSIM_BTA_TIMEOUT(0xff) | DSIM_LPDR_TIMEOUT(0xffff); ··· 1427 1431 disable_irq(dsi->irq); 1428 1432 } 1429 1433 1430 - static void samsung_dsim_set_stop_state(struct samsung_dsim *dsi, bool enable) 1431 - { 1432 - u32 reg = samsung_dsim_read(dsi, DSIM_ESCMODE_REG); 1433 - 1434 - if (enable) 1435 - reg |= DSIM_FORCE_STOP_STATE; 1436 - else 1437 - reg &= ~DSIM_FORCE_STOP_STATE; 1438 - 1439 - samsung_dsim_write(dsi, DSIM_ESCMODE_REG, reg); 1440 - } 1441 - 1442 1434 static int samsung_dsim_init(struct samsung_dsim *dsi) 1443 1435 { 1444 1436 const struct samsung_dsim_driver_data *driver_data = dsi->driver_data; ··· 1476 1492 ret = samsung_dsim_init(dsi); 1477 1493 if (ret) 1478 1494 return; 1479 - 1480 - samsung_dsim_set_display_mode(dsi); 1481 - samsung_dsim_set_display_enable(dsi, true); 1482 1495 } 1483 1496 } 1484 1497 ··· 1484 1503 { 1485 1504 struct samsung_dsim *dsi = bridge_to_dsi(bridge); 1486 1505 1487 - if (samsung_dsim_hw_is_exynos(dsi->plat_data->hw_type)) { 1488 - samsung_dsim_set_display_mode(dsi); 1489 - samsung_dsim_set_display_enable(dsi, true); 1490 - } else { 1491 - samsung_dsim_set_stop_state(dsi, false); 1492 - } 1506 + samsung_dsim_set_display_mode(dsi); 1507 + samsung_dsim_set_display_enable(dsi, true); 1493 1508 1494 1509 dsi->state |= DSIM_STATE_VIDOUT_AVAILABLE; 1495 1510 } ··· 1497 1520 1498 1521 if (!(dsi->state & DSIM_STATE_ENABLED)) 1499 1522 return; 1500 - 1501 - if (!samsung_dsim_hw_is_exynos(dsi->plat_data->hw_type)) 1502 - samsung_dsim_set_stop_state(dsi, true); 1503 1523 1504 1524 dsi->state &= ~DSIM_STATE_VIDOUT_AVAILABLE; 1505 1525 } ··· 1801 1827 ret = samsung_dsim_init(dsi); 1802 1828 if (ret) 1803 1829 return ret; 1804 - 1805 - samsung_dsim_set_stop_state(dsi, false); 1806 1830 1807 1831 ret = mipi_dsi_create_packet(&xfer.packet, msg); 1808 1832 if (ret < 0)
+29 -13
drivers/gpu/drm/bridge/sii902x.c
··· 1080 1080 return ret; 1081 1081 } 1082 1082 1083 + ret = sii902x_audio_codec_init(sii902x, dev); 1084 + if (ret) 1085 + return ret; 1086 + 1087 + i2c_set_clientdata(sii902x->i2c, sii902x); 1088 + 1089 + sii902x->i2cmux = i2c_mux_alloc(sii902x->i2c->adapter, dev, 1090 + 1, 0, I2C_MUX_GATE, 1091 + sii902x_i2c_bypass_select, 1092 + sii902x_i2c_bypass_deselect); 1093 + if (!sii902x->i2cmux) { 1094 + ret = -ENOMEM; 1095 + goto err_unreg_audio; 1096 + } 1097 + 1098 + sii902x->i2cmux->priv = sii902x; 1099 + ret = i2c_mux_add_adapter(sii902x->i2cmux, 0, 0, 0); 1100 + if (ret) 1101 + goto err_unreg_audio; 1102 + 1083 1103 sii902x->bridge.funcs = &sii902x_bridge_funcs; 1084 1104 sii902x->bridge.of_node = dev->of_node; 1085 1105 sii902x->bridge.timings = &default_sii902x_timings; ··· 1110 1090 1111 1091 drm_bridge_add(&sii902x->bridge); 1112 1092 1113 - sii902x_audio_codec_init(sii902x, dev); 1093 + return 0; 1114 1094 1115 - i2c_set_clientdata(sii902x->i2c, sii902x); 1095 + err_unreg_audio: 1096 + if (!PTR_ERR_OR_ZERO(sii902x->audio.pdev)) 1097 + platform_device_unregister(sii902x->audio.pdev); 1116 1098 1117 - sii902x->i2cmux = i2c_mux_alloc(sii902x->i2c->adapter, dev, 1118 - 1, 0, I2C_MUX_GATE, 1119 - sii902x_i2c_bypass_select, 1120 - sii902x_i2c_bypass_deselect); 1121 - if (!sii902x->i2cmux) 1122 - return -ENOMEM; 1123 - 1124 - sii902x->i2cmux->priv = sii902x; 1125 - return i2c_mux_add_adapter(sii902x->i2cmux, 0, 0, 0); 1099 + return ret; 1126 1100 } 1127 1101 1128 1102 static int sii902x_probe(struct i2c_client *client) ··· 1184 1170 } 1185 1171 1186 1172 static void sii902x_remove(struct i2c_client *client) 1187 - 1188 1173 { 1189 1174 struct sii902x *sii902x = i2c_get_clientdata(client); 1190 1175 1191 - i2c_mux_del_adapters(sii902x->i2cmux); 1192 1176 drm_bridge_remove(&sii902x->bridge); 1177 + i2c_mux_del_adapters(sii902x->i2cmux); 1178 + 1179 + if (!PTR_ERR_OR_ZERO(sii902x->audio.pdev)) 1180 + platform_device_unregister(sii902x->audio.pdev); 1193 1181 } 1194 1182 1195 1183 static const struct of_device_id sii902x_dt_ids[] = {
+2
drivers/gpu/drm/display/drm_dp_mst_topology.c
··· 5491 5491 * - 0 if the new state is valid 5492 5492 * - %-ENOSPC, if the new state is invalid, because of BW limitation 5493 5493 * @failing_port is set to: 5494 + * 5494 5495 * - The non-root port where a BW limit check failed 5495 5496 * with all the ports downstream of @failing_port passing 5496 5497 * the BW limit check. ··· 5500 5499 * - %NULL if the BW limit check failed at the root port 5501 5500 * with all the ports downstream of the root port passing 5502 5501 * the BW limit check. 5502 + * 5503 5503 * - %-EINVAL, if the new state is invalid, because the root port has 5504 5504 * too many payloads. 5505 5505 */
+2 -2
drivers/gpu/drm/exynos/exynos5433_drm_decon.c
··· 319 319 static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win, 320 320 struct drm_framebuffer *fb) 321 321 { 322 - struct exynos_drm_plane plane = ctx->planes[win]; 322 + struct exynos_drm_plane *plane = &ctx->planes[win]; 323 323 struct exynos_drm_plane_state *state = 324 - to_exynos_plane_state(plane.base.state); 324 + to_exynos_plane_state(plane->base.state); 325 325 unsigned int alpha = state->base.alpha; 326 326 unsigned int pixel_alpha; 327 327 unsigned long val;
+3 -3
drivers/gpu/drm/exynos/exynos_drm_fimd.c
··· 480 480 struct fimd_context *ctx = crtc->ctx; 481 481 struct drm_display_mode *mode = &crtc->base.state->adjusted_mode; 482 482 const struct fimd_driver_data *driver_data = ctx->driver_data; 483 - void *timing_base = ctx->regs + driver_data->timing_base; 483 + void __iomem *timing_base = ctx->regs + driver_data->timing_base; 484 484 u32 val; 485 485 486 486 if (ctx->suspended) ··· 661 661 static void fimd_win_set_pixfmt(struct fimd_context *ctx, unsigned int win, 662 662 struct drm_framebuffer *fb, int width) 663 663 { 664 - struct exynos_drm_plane plane = ctx->planes[win]; 664 + struct exynos_drm_plane *plane = &ctx->planes[win]; 665 665 struct exynos_drm_plane_state *state = 666 - to_exynos_plane_state(plane.base.state); 666 + to_exynos_plane_state(plane->base.state); 667 667 uint32_t pixel_format = fb->format->format; 668 668 unsigned int alpha = state->base.alpha; 669 669 u32 val = WINCONx_ENWIN;
+1 -1
drivers/gpu/drm/exynos/exynos_drm_gsc.c
··· 1341 1341 for (i = 0; i < ctx->num_clocks; i++) { 1342 1342 ret = clk_prepare_enable(ctx->clocks[i]); 1343 1343 if (ret) { 1344 - while (--i > 0) 1344 + while (--i >= 0) 1345 1345 clk_disable_unprepare(ctx->clocks[i]); 1346 1346 return ret; 1347 1347 }
-1
drivers/gpu/drm/i915/Makefile
··· 17 17 subdir-ccflags-y += $(call cc-option, -Wpacked-not-aligned) 18 18 subdir-ccflags-y += $(call cc-option, -Wformat-overflow) 19 19 subdir-ccflags-y += $(call cc-option, -Wformat-truncation) 20 - subdir-ccflags-y += $(call cc-option, -Wstringop-overflow) 21 20 subdir-ccflags-y += $(call cc-option, -Wstringop-truncation) 22 21 # The following turn off the warnings enabled by -Wextra 23 22 ifeq ($(findstring 2, $(KBUILD_EXTRA_WARN)),)
+1 -2
drivers/gpu/drm/i915/display/icl_dsi.c
··· 1155 1155 } 1156 1156 1157 1157 intel_dsi_vbt_exec_sequence(intel_dsi, MIPI_SEQ_INIT_OTP); 1158 + intel_dsi_vbt_exec_sequence(intel_dsi, MIPI_SEQ_DISPLAY_ON); 1158 1159 1159 1160 /* ensure all panel commands dispatched before enabling transcoder */ 1160 1161 wait_for_cmds_dispatched_to_panel(encoder); ··· 1255 1254 1256 1255 /* step6d: enable dsi transcoder */ 1257 1256 gen11_dsi_enable_transcoder(encoder); 1258 - 1259 - intel_dsi_vbt_exec_sequence(intel_dsi, MIPI_SEQ_DISPLAY_ON); 1260 1257 1261 1258 /* step7: enable backlight */ 1262 1259 intel_backlight_enable(crtc_state, conn_state);
+12 -2
drivers/gpu/drm/i915/display/intel_psr.c
··· 1525 1525 * can rely on frontbuffer tracking. 1526 1526 */ 1527 1527 mask = EDP_PSR_DEBUG_MASK_MEMUP | 1528 - EDP_PSR_DEBUG_MASK_HPD | 1529 - EDP_PSR_DEBUG_MASK_LPSP; 1528 + EDP_PSR_DEBUG_MASK_HPD; 1529 + 1530 + /* 1531 + * For some unknown reason on HSW non-ULT (or at least on 1532 + * Dell Latitude E6540) external displays start to flicker 1533 + * when PSR is enabled on the eDP. SR/PC6 residency is much 1534 + * higher than should be possible with an external display. 1535 + * As a workaround leave LPSP unmasked to prevent PSR entry 1536 + * when external displays are active. 1537 + */ 1538 + if (DISPLAY_VER(dev_priv) >= 8 || IS_HASWELL_ULT(dev_priv)) 1539 + mask |= EDP_PSR_DEBUG_MASK_LPSP; 1530 1540 1531 1541 if (DISPLAY_VER(dev_priv) < 20) 1532 1542 mask |= EDP_PSR_DEBUG_MASK_MAX_SLEEP;
+5 -23
drivers/gpu/drm/nouveau/nouveau_fence.c
··· 62 62 if (test_bit(DMA_FENCE_FLAG_USER_BITS, &fence->base.flags)) { 63 63 struct nouveau_fence_chan *fctx = nouveau_fctx(fence); 64 64 65 - if (atomic_dec_and_test(&fctx->notify_ref)) 65 + if (!--fctx->notify_ref) 66 66 drop = 1; 67 67 } 68 68 ··· 103 103 void 104 104 nouveau_fence_context_del(struct nouveau_fence_chan *fctx) 105 105 { 106 - cancel_work_sync(&fctx->allow_block_work); 107 106 nouveau_fence_context_kill(fctx, 0); 108 107 nvif_event_dtor(&fctx->event); 109 108 fctx->dead = 1; ··· 167 168 return ret; 168 169 } 169 170 170 - static void 171 - nouveau_fence_work_allow_block(struct work_struct *work) 172 - { 173 - struct nouveau_fence_chan *fctx = container_of(work, struct nouveau_fence_chan, 174 - allow_block_work); 175 - 176 - if (atomic_read(&fctx->notify_ref) == 0) 177 - nvif_event_block(&fctx->event); 178 - else 179 - nvif_event_allow(&fctx->event); 180 - } 181 - 182 171 void 183 172 nouveau_fence_context_new(struct nouveau_channel *chan, struct nouveau_fence_chan *fctx) 184 173 { ··· 178 191 } args; 179 192 int ret; 180 193 181 - INIT_WORK(&fctx->allow_block_work, nouveau_fence_work_allow_block); 182 194 INIT_LIST_HEAD(&fctx->flip); 183 195 INIT_LIST_HEAD(&fctx->pending); 184 196 spin_lock_init(&fctx->lock); ··· 521 535 struct nouveau_fence *fence = from_fence(f); 522 536 struct nouveau_fence_chan *fctx = nouveau_fctx(fence); 523 537 bool ret; 524 - bool do_work; 525 538 526 - if (atomic_inc_return(&fctx->notify_ref) == 0) 527 - do_work = true; 539 + if (!fctx->notify_ref++) 540 + nvif_event_allow(&fctx->event); 528 541 529 542 ret = nouveau_fence_no_signaling(f); 530 543 if (ret) 531 544 set_bit(DMA_FENCE_FLAG_USER_BITS, &fence->base.flags); 532 - else if (atomic_dec_and_test(&fctx->notify_ref)) 533 - do_work = true; 534 - 535 - if (do_work) 536 - schedule_work(&fctx->allow_block_work); 545 + else if (!--fctx->notify_ref) 546 + nvif_event_block(&fctx->event); 537 547 538 548 return ret; 539 549 }
+1 -4
drivers/gpu/drm/nouveau/nouveau_fence.h
··· 3 3 #define __NOUVEAU_FENCE_H__ 4 4 5 5 #include <linux/dma-fence.h> 6 - #include <linux/workqueue.h> 7 6 #include <nvif/event.h> 8 7 9 8 struct nouveau_drm; ··· 45 46 char name[32]; 46 47 47 48 struct nvif_event event; 48 - struct work_struct allow_block_work; 49 - atomic_t notify_ref; 50 - int dead, killed; 49 + int notify_ref, dead, killed; 51 50 }; 52 51 53 52 struct nouveau_fence_priv {
+2
drivers/gpu/drm/panel/Kconfig
··· 539 539 depends on OF 540 540 depends on DRM_MIPI_DSI 541 541 depends on BACKLIGHT_CLASS_DEVICE 542 + select DRM_DISPLAY_DP_HELPER 543 + select DRM_DISPLAY_HELPER 542 544 help 543 545 Say Y here if you want to enable support for Raydium RM692E5-based 544 546 display panels, such as the one found in the Fairphone 5 smartphone.
+1 -1
drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c
··· 309 309 .off_func = s6d7aa0_lsl080al02_off, 310 310 .drm_mode = &s6d7aa0_lsl080al02_mode, 311 311 .mode_flags = MIPI_DSI_MODE_VSYNC_FLUSH | MIPI_DSI_MODE_VIDEO_NO_HFP, 312 - .bus_flags = DRM_BUS_FLAG_DE_HIGH, 312 + .bus_flags = 0, 313 313 314 314 .has_backlight = false, 315 315 .use_passwd3 = false,
+2
drivers/gpu/drm/panel/panel-simple.c
··· 3948 3948 }, 3949 3949 .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG, 3950 3950 .connector_type = DRM_MODE_CONNECTOR_LVDS, 3951 + .bus_flags = DRM_BUS_FLAG_DE_HIGH, 3951 3952 }; 3952 3953 3953 3954 static const struct panel_desc tianma_tm070jvhg33 = { ··· 3961 3960 }, 3962 3961 .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG, 3963 3962 .connector_type = DRM_MODE_CONNECTOR_LVDS, 3963 + .bus_flags = DRM_BUS_FLAG_DE_HIGH, 3964 3964 }; 3965 3965 3966 3966 static const struct display_timing tianma_tm070rvhg71_timing = {
+8 -9
drivers/gpu/drm/scheduler/sched_main.c
··· 1178 1178 struct drm_sched_entity *entity; 1179 1179 struct dma_fence *fence; 1180 1180 struct drm_sched_fence *s_fence; 1181 - struct drm_sched_job *sched_job; 1181 + struct drm_sched_job *sched_job = NULL; 1182 1182 int r; 1183 1183 1184 1184 if (READ_ONCE(sched->pause_submit)) 1185 1185 return; 1186 1186 1187 - entity = drm_sched_select_entity(sched); 1188 - if (!entity) 1189 - return; 1190 - 1191 - sched_job = drm_sched_entity_pop_job(entity); 1192 - if (!sched_job) { 1193 - complete_all(&entity->entity_idle); 1194 - return; /* No more work */ 1187 + /* Find entity with a ready job */ 1188 + while (!sched_job && (entity = drm_sched_select_entity(sched))) { 1189 + sched_job = drm_sched_entity_pop_job(entity); 1190 + if (!sched_job) 1191 + complete_all(&entity->entity_idle); 1195 1192 } 1193 + if (!entity) 1194 + return; /* No more work */ 1196 1195 1197 1196 s_fence = sched_job->s_fence; 1198 1197
+4 -1
drivers/gpu/drm/tests/drm_mm_test.c
··· 188 188 189 189 static void drm_test_mm_debug(struct kunit *test) 190 190 { 191 + struct drm_printer p = drm_debug_printer(test->name); 191 192 struct drm_mm mm; 192 193 struct drm_mm_node nodes[2]; 193 194 194 195 /* Create a small drm_mm with a couple of nodes and a few holes, and 195 196 * check that the debug iterator doesn't explode over a trivial drm_mm. 196 197 */ 197 - 198 198 drm_mm_init(&mm, 0, 4096); 199 199 200 200 memset(nodes, 0, sizeof(nodes)); ··· 209 209 KUNIT_ASSERT_FALSE_MSG(test, drm_mm_reserve_node(&mm, &nodes[1]), 210 210 "failed to reserve node[0] {start=%lld, size=%lld)\n", 211 211 nodes[0].start, nodes[0].size); 212 + 213 + drm_mm_print(&mm, &p); 214 + KUNIT_SUCCEED(test); 212 215 } 213 216 214 217 static bool expect_insert(struct kunit *test, struct drm_mm *mm,
+16 -5
drivers/gpu/drm/ttm/ttm_device.c
··· 95 95 ttm_pool_mgr_init(num_pages); 96 96 ttm_tt_mgr_init(num_pages, num_dma32); 97 97 98 - glob->dummy_read_page = alloc_page(__GFP_ZERO | GFP_DMA32); 98 + glob->dummy_read_page = alloc_page(__GFP_ZERO | GFP_DMA32 | 99 + __GFP_NOWARN); 99 100 101 + /* Retry without GFP_DMA32 for platforms DMA32 is not available */ 100 102 if (unlikely(glob->dummy_read_page == NULL)) { 101 - ret = -ENOMEM; 102 - goto out; 103 + glob->dummy_read_page = alloc_page(__GFP_ZERO); 104 + if (unlikely(glob->dummy_read_page == NULL)) { 105 + ret = -ENOMEM; 106 + goto out; 107 + } 108 + pr_warn("Using GFP_DMA32 fallback for dummy_read_page\n"); 103 109 } 104 110 105 111 INIT_LIST_HEAD(&glob->device_list); ··· 201 195 bool use_dma_alloc, bool use_dma32) 202 196 { 203 197 struct ttm_global *glob = &ttm_glob; 204 - int ret; 198 + int ret, nid; 205 199 206 200 if (WARN_ON(vma_manager == NULL)) 207 201 return -EINVAL; ··· 221 215 222 216 ttm_sys_man_init(bdev); 223 217 224 - ttm_pool_init(&bdev->pool, dev, dev_to_node(dev), use_dma_alloc, use_dma32); 218 + if (dev) 219 + nid = dev_to_node(dev); 220 + else 221 + nid = NUMA_NO_NODE; 222 + 223 + ttm_pool_init(&bdev->pool, dev, nid, use_dma_alloc, use_dma32); 225 224 226 225 bdev->vma_manager = vma_manager; 227 226 spin_lock_init(&bdev->lru_lock);
+28 -7
drivers/gpu/drm/v3d/v3d_submit.c
··· 147 147 return 0; 148 148 } 149 149 150 + static void 151 + v3d_job_deallocate(void **container) 152 + { 153 + kfree(*container); 154 + *container = NULL; 155 + } 156 + 150 157 static int 151 158 v3d_job_init(struct v3d_dev *v3d, struct drm_file *file_priv, 152 159 struct v3d_job *job, void (*free)(struct kref *ref), ··· 280 273 281 274 ret = v3d_job_init(v3d, file_priv, &(*job)->base, 282 275 v3d_job_free, args->in_sync, se, V3D_CSD); 283 - if (ret) 276 + if (ret) { 277 + v3d_job_deallocate((void *)job); 284 278 return ret; 279 + } 285 280 286 281 ret = v3d_job_allocate((void *)clean_job, sizeof(**clean_job)); 287 282 if (ret) ··· 291 282 292 283 ret = v3d_job_init(v3d, file_priv, *clean_job, 293 284 v3d_job_free, 0, NULL, V3D_CACHE_CLEAN); 294 - if (ret) 285 + if (ret) { 286 + v3d_job_deallocate((void *)clean_job); 295 287 return ret; 288 + } 296 289 297 290 (*job)->args = *args; 298 291 ··· 871 860 872 861 ret = v3d_job_init(v3d, file_priv, &render->base, 873 862 v3d_render_job_free, args->in_sync_rcl, &se, V3D_RENDER); 874 - if (ret) 863 + if (ret) { 864 + v3d_job_deallocate((void *)&render); 875 865 goto fail; 866 + } 876 867 877 868 render->start = args->rcl_start; 878 869 render->end = args->rcl_end; ··· 887 874 888 875 ret = v3d_job_init(v3d, file_priv, &bin->base, 889 876 v3d_job_free, args->in_sync_bcl, &se, V3D_BIN); 890 - if (ret) 877 + if (ret) { 878 + v3d_job_deallocate((void *)&bin); 891 879 goto fail; 880 + } 892 881 893 882 bin->start = args->bcl_start; 894 883 bin->end = args->bcl_end; ··· 907 892 908 893 ret = v3d_job_init(v3d, file_priv, clean_job, 909 894 v3d_job_free, 0, NULL, V3D_CACHE_CLEAN); 910 - if (ret) 895 + if (ret) { 896 + v3d_job_deallocate((void *)&clean_job); 911 897 goto fail; 898 + } 912 899 913 900 last_job = clean_job; 914 901 } else { ··· 1032 1015 1033 1016 ret = v3d_job_init(v3d, file_priv, &job->base, 1034 1017 v3d_job_free, args->in_sync, &se, V3D_TFU); 1035 - if (ret) 1018 + if (ret) { 1019 + v3d_job_deallocate((void *)&job); 1036 1020 goto fail; 1021 + } 1037 1022 1038 1023 job->base.bo = kcalloc(ARRAY_SIZE(args->bo_handles), 1039 1024 sizeof(*job->base.bo), GFP_KERNEL); ··· 1252 1233 1253 1234 ret = v3d_job_init(v3d, file_priv, &cpu_job->base, 1254 1235 v3d_job_free, 0, &se, V3D_CPU); 1255 - if (ret) 1236 + if (ret) { 1237 + v3d_job_deallocate((void *)&cpu_job); 1256 1238 goto fail; 1239 + } 1257 1240 1258 1241 clean_job = cpu_job->indirect_csd.clean_job; 1259 1242 csd_job = cpu_job->indirect_csd.job;
+5 -6
drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object.h
··· 35 35 u32 ofs, u64 *ptr, u32 size) 36 36 { 37 37 struct ttm_bo_kmap_obj map; 38 - void *virtual; 38 + void *src; 39 39 bool is_iomem; 40 40 int ret; 41 - 42 - XE_WARN_ON(size != 8); 43 41 44 42 ret = xe_bo_lock(bo, true); 45 43 if (ret) ··· 48 50 goto out_unlock; 49 51 50 52 ofs &= ~PAGE_MASK; 51 - virtual = ttm_kmap_obj_virtual(&map, &is_iomem); 53 + src = ttm_kmap_obj_virtual(&map, &is_iomem); 54 + src += ofs; 52 55 if (is_iomem) 53 - *ptr = readq((void __iomem *)(virtual + ofs)); 56 + memcpy_fromio(ptr, (void __iomem *)src, size); 54 57 else 55 - *ptr = *(u64 *)(virtual + ofs); 58 + memcpy(ptr, src, size); 56 59 57 60 ttm_bo_kunmap(&map); 58 61 out_unlock:
-3
drivers/gpu/drm/xe/tests/xe_wa_test.c
··· 74 74 SUBPLATFORM_CASE(DG2, G11, B1), 75 75 SUBPLATFORM_CASE(DG2, G12, A0), 76 76 SUBPLATFORM_CASE(DG2, G12, A1), 77 - PLATFORM_CASE(PVC, B0), 78 - PLATFORM_CASE(PVC, B1), 79 - PLATFORM_CASE(PVC, C0), 80 77 GMDID_CASE(METEORLAKE, 1270, A0, 1300, A0), 81 78 GMDID_CASE(METEORLAKE, 1271, A0, 1300, A0), 82 79 GMDID_CASE(LUNARLAKE, 2004, A0, 2000, A0),
+1 -1
drivers/gpu/drm/xe/xe_device.c
··· 613 613 u32 xe_device_ccs_bytes(struct xe_device *xe, u64 size) 614 614 { 615 615 return xe_device_has_flat_ccs(xe) ? 616 - DIV_ROUND_UP(size, NUM_BYTES_PER_CCS_BYTE(xe)) : 0; 616 + DIV_ROUND_UP_ULL(size, NUM_BYTES_PER_CCS_BYTE(xe)) : 0; 617 617 } 618 618 619 619 bool xe_device_mem_access_ongoing(struct xe_device *xe)
+1 -1
drivers/gpu/drm/xe/xe_dma_buf.c
··· 175 175 return 0; 176 176 } 177 177 178 - const struct dma_buf_ops xe_dmabuf_ops = { 178 + static const struct dma_buf_ops xe_dmabuf_ops = { 179 179 .attach = xe_dma_buf_attach, 180 180 .detach = xe_dma_buf_detach, 181 181 .pin = xe_dma_buf_pin,
+1 -1
drivers/gpu/drm/xe/xe_hwmon.c
··· 419 419 420 420 return xe_pcode_read(gt, PCODE_MBOX(PCODE_POWER_SETUP, 421 421 POWER_SETUP_SUBCOMMAND_READ_I1, 0), 422 - uval, 0); 422 + uval, NULL); 423 423 } 424 424 425 425 static int xe_hwmon_pcode_write_i1(struct xe_gt *gt, u32 uval)
+7 -7
drivers/gpu/drm/xe/xe_migrate.c
··· 472 472 /* Indirect access needs compression enabled uncached PAT index */ 473 473 if (GRAPHICS_VERx100(xe) >= 2000) 474 474 pat_index = is_comp_pte ? xe->pat.idx[XE_CACHE_NONE_COMPRESSION] : 475 - xe->pat.idx[XE_CACHE_NONE]; 475 + xe->pat.idx[XE_CACHE_WB]; 476 476 else 477 477 pat_index = xe->pat.idx[XE_CACHE_WB]; 478 478 ··· 760 760 if (src_is_vram && xe_migrate_allow_identity(src_L0, &src_it)) 761 761 xe_res_next(&src_it, src_L0); 762 762 else 763 - emit_pte(m, bb, src_L0_pt, src_is_vram, true, &src_it, src_L0, 764 - src); 763 + emit_pte(m, bb, src_L0_pt, src_is_vram, copy_system_ccs, 764 + &src_it, src_L0, src); 765 765 766 766 if (dst_is_vram && xe_migrate_allow_identity(src_L0, &dst_it)) 767 767 xe_res_next(&dst_it, src_L0); 768 768 else 769 - emit_pte(m, bb, dst_L0_pt, dst_is_vram, true, &dst_it, src_L0, 770 - dst); 769 + emit_pte(m, bb, dst_L0_pt, dst_is_vram, copy_system_ccs, 770 + &dst_it, src_L0, dst); 771 771 772 772 if (copy_system_ccs) 773 773 emit_pte(m, bb, ccs_pt, false, false, &ccs_it, ccs_size, src); ··· 1009 1009 if (clear_vram && xe_migrate_allow_identity(clear_L0, &src_it)) 1010 1010 xe_res_next(&src_it, clear_L0); 1011 1011 else 1012 - emit_pte(m, bb, clear_L0_pt, clear_vram, true, &src_it, clear_L0, 1013 - dst); 1012 + emit_pte(m, bb, clear_L0_pt, clear_vram, clear_system_ccs, 1013 + &src_it, clear_L0, dst); 1014 1014 1015 1015 bb->cs[bb->len++] = MI_BATCH_BUFFER_END; 1016 1016 update_idx = bb->len;
+2 -2
drivers/gpu/drm/xe/xe_mmio.c
··· 272 272 drm_info(&xe->drm, "VRAM[%u, %u]: Actual physical size %pa, usable size exclude stolen %pa, CPU accessible size %pa\n", id, 273 273 tile->id, &tile->mem.vram.actual_physical_size, &tile->mem.vram.usable_size, &tile->mem.vram.io_size); 274 274 drm_info(&xe->drm, "VRAM[%u, %u]: DPA range: [%pa-%llx], io range: [%pa-%llx]\n", id, tile->id, 275 - &tile->mem.vram.dpa_base, tile->mem.vram.dpa_base + tile->mem.vram.actual_physical_size, 276 - &tile->mem.vram.io_start, tile->mem.vram.io_start + tile->mem.vram.io_size); 275 + &tile->mem.vram.dpa_base, tile->mem.vram.dpa_base + (u64)tile->mem.vram.actual_physical_size, 276 + &tile->mem.vram.io_start, tile->mem.vram.io_start + (u64)tile->mem.vram.io_size); 277 277 278 278 /* calculate total size using tile size to get the correct HW sizing */ 279 279 total_size += tile_size;
+14 -9
drivers/gpu/drm/xe/xe_vm.c
··· 1855 1855 mutex_lock(&xef->vm.lock); 1856 1856 err = xa_alloc(&xef->vm.xa, &id, vm, xa_limit_32b, GFP_KERNEL); 1857 1857 mutex_unlock(&xef->vm.lock); 1858 - if (err) { 1859 - xe_vm_close_and_put(vm); 1860 - return err; 1861 - } 1858 + if (err) 1859 + goto err_close_and_put; 1862 1860 1863 1861 if (xe->info.has_asid) { 1864 1862 mutex_lock(&xe->usm.lock); ··· 1864 1866 XA_LIMIT(1, XE_MAX_ASID - 1), 1865 1867 &xe->usm.next_asid, GFP_KERNEL); 1866 1868 mutex_unlock(&xe->usm.lock); 1867 - if (err < 0) { 1868 - xe_vm_close_and_put(vm); 1869 - return err; 1870 - } 1871 - err = 0; 1869 + if (err < 0) 1870 + goto err_free_id; 1871 + 1872 1872 vm->usm.asid = asid; 1873 1873 } 1874 1874 ··· 1884 1888 #endif 1885 1889 1886 1890 return 0; 1891 + 1892 + err_free_id: 1893 + mutex_lock(&xef->vm.lock); 1894 + xa_erase(&xef->vm.xa, id); 1895 + mutex_unlock(&xef->vm.lock); 1896 + err_close_and_put: 1897 + xe_vm_close_and_put(vm); 1898 + 1899 + return err; 1887 1900 } 1888 1901 1889 1902 int xe_vm_destroy_ioctl(struct drm_device *dev, void *data,
+1 -1
drivers/md/raid1.c
··· 2262 2262 int sectors = r1_bio->sectors; 2263 2263 int read_disk = r1_bio->read_disk; 2264 2264 struct mddev *mddev = conf->mddev; 2265 - struct md_rdev *rdev = rcu_dereference(conf->mirrors[read_disk].rdev); 2265 + struct md_rdev *rdev = conf->mirrors[read_disk].rdev; 2266 2266 2267 2267 if (exceed_read_errors(mddev, rdev)) { 2268 2268 r1_bio->bios[r1_bio->read_disk] = IO_BLOCKED;
+1 -1
drivers/media/common/videobuf2/videobuf2-core.c
··· 989 989 bool no_previous_buffers = !q_num_bufs; 990 990 int ret = 0; 991 991 992 - if (q->num_buffers == q->max_num_buffers) { 992 + if (q_num_bufs == q->max_num_buffers) { 993 993 dprintk(q, 1, "maximum number of buffers already allocated\n"); 994 994 return -ENOBUFS; 995 995 }
+26 -29
drivers/media/common/videobuf2/videobuf2-v4l2.c
··· 671 671 } 672 672 EXPORT_SYMBOL(vb2_querybuf); 673 673 674 - static void fill_buf_caps(struct vb2_queue *q, u32 *caps) 674 + static void vb2_set_flags_and_caps(struct vb2_queue *q, u32 memory, 675 + u32 *flags, u32 *caps, u32 *max_num_bufs) 675 676 { 677 + if (!q->allow_cache_hints || memory != V4L2_MEMORY_MMAP) { 678 + /* 679 + * This needs to clear V4L2_MEMORY_FLAG_NON_COHERENT only, 680 + * but in order to avoid bugs we zero out all bits. 681 + */ 682 + *flags = 0; 683 + } else { 684 + /* Clear all unknown flags. */ 685 + *flags &= V4L2_MEMORY_FLAG_NON_COHERENT; 686 + } 687 + 676 688 *caps = V4L2_BUF_CAP_SUPPORTS_ORPHANED_BUFS; 677 689 if (q->io_modes & VB2_MMAP) 678 690 *caps |= V4L2_BUF_CAP_SUPPORTS_MMAP; ··· 698 686 *caps |= V4L2_BUF_CAP_SUPPORTS_MMAP_CACHE_HINTS; 699 687 if (q->supports_requests) 700 688 *caps |= V4L2_BUF_CAP_SUPPORTS_REQUESTS; 701 - } 702 - 703 - static void validate_memory_flags(struct vb2_queue *q, 704 - int memory, 705 - u32 *flags) 706 - { 707 - if (!q->allow_cache_hints || memory != V4L2_MEMORY_MMAP) { 708 - /* 709 - * This needs to clear V4L2_MEMORY_FLAG_NON_COHERENT only, 710 - * but in order to avoid bugs we zero out all bits. 711 - */ 712 - *flags = 0; 713 - } else { 714 - /* Clear all unknown flags. */ 715 - *flags &= V4L2_MEMORY_FLAG_NON_COHERENT; 689 + if (max_num_bufs) { 690 + *max_num_bufs = q->max_num_buffers; 691 + *caps |= V4L2_BUF_CAP_SUPPORTS_MAX_NUM_BUFFERS; 716 692 } 717 693 } 718 694 ··· 709 709 int ret = vb2_verify_memory_type(q, req->memory, req->type); 710 710 u32 flags = req->flags; 711 711 712 - fill_buf_caps(q, &req->capabilities); 713 - validate_memory_flags(q, req->memory, &flags); 712 + vb2_set_flags_and_caps(q, req->memory, &flags, 713 + &req->capabilities, NULL); 714 714 req->flags = flags; 715 715 return ret ? ret : vb2_core_reqbufs(q, req->memory, 716 716 req->flags, &req->count); ··· 751 751 int ret = vb2_verify_memory_type(q, create->memory, f->type); 752 752 unsigned i; 753 753 754 - fill_buf_caps(q, &create->capabilities); 755 - validate_memory_flags(q, create->memory, &create->flags); 756 754 create->index = vb2_get_num_buffers(q); 757 - create->max_num_buffers = q->max_num_buffers; 758 - create->capabilities |= V4L2_BUF_CAP_SUPPORTS_MAX_NUM_BUFFERS; 755 + vb2_set_flags_and_caps(q, create->memory, &create->flags, 756 + &create->capabilities, &create->max_num_buffers); 759 757 if (create->count == 0) 760 758 return ret != -EBUSY ? ret : 0; 761 759 ··· 1004 1006 int res = vb2_verify_memory_type(vdev->queue, p->memory, p->type); 1005 1007 u32 flags = p->flags; 1006 1008 1007 - fill_buf_caps(vdev->queue, &p->capabilities); 1008 - validate_memory_flags(vdev->queue, p->memory, &flags); 1009 + vb2_set_flags_and_caps(vdev->queue, p->memory, &flags, 1010 + &p->capabilities, NULL); 1009 1011 p->flags = flags; 1010 1012 if (res) 1011 1013 return res; ··· 1024 1026 struct v4l2_create_buffers *p) 1025 1027 { 1026 1028 struct video_device *vdev = video_devdata(file); 1027 - int res = vb2_verify_memory_type(vdev->queue, p->memory, 1028 - p->format.type); 1029 + int res = vb2_verify_memory_type(vdev->queue, p->memory, p->format.type); 1029 1030 1030 - p->index = vdev->queue->num_buffers; 1031 - fill_buf_caps(vdev->queue, &p->capabilities); 1032 - validate_memory_flags(vdev->queue, p->memory, &p->flags); 1031 + p->index = vb2_get_num_buffers(vdev->queue); 1032 + vb2_set_flags_and_caps(vdev->queue, p->memory, &p->flags, 1033 + &p->capabilities, &p->max_num_buffers); 1033 1034 /* 1034 1035 * If count == 0, then just check if memory and type are valid. 1035 1036 * Any -EBUSY result from vb2_verify_memory_type can be mapped to 0.
+1 -1
drivers/media/platform/chips-media/wave5/wave5-vpu.c
··· 272 272 }; 273 273 274 274 static const struct of_device_id wave5_dt_ids[] = { 275 - { .compatible = "ti,k3-j721s2-wave521c", .data = &ti_wave521c_data }, 275 + { .compatible = "ti,j721s2-wave521c", .data = &ti_wave521c_data }, 276 276 { /* sentinel */ } 277 277 }; 278 278 MODULE_DEVICE_TABLE(of, wave5_dt_ids);
+1
drivers/net/ethernet/8390/8390.c
··· 100 100 module_init(ns8390_module_init); 101 101 module_exit(ns8390_module_exit); 102 102 #endif /* MODULE */ 103 + MODULE_DESCRIPTION("National Semiconductor 8390 core driver"); 103 104 MODULE_LICENSE("GPL");
+1
drivers/net/ethernet/8390/8390p.c
··· 102 102 103 103 module_init(NS8390p_init_module); 104 104 module_exit(NS8390p_cleanup_module); 105 + MODULE_DESCRIPTION("National Semiconductor 8390 core for ISA driver"); 105 106 MODULE_LICENSE("GPL");
+1
drivers/net/ethernet/8390/apne.c
··· 610 610 return 1; 611 611 } 612 612 613 + MODULE_DESCRIPTION("National Semiconductor 8390 Amiga PCMCIA ethernet driver"); 613 614 MODULE_LICENSE("GPL");
+1
drivers/net/ethernet/8390/hydra.c
··· 270 270 module_init(hydra_init_module); 271 271 module_exit(hydra_cleanup_module); 272 272 273 + MODULE_DESCRIPTION("Zorro-II Hydra 8390 ethernet driver"); 273 274 MODULE_LICENSE("GPL");
+1
drivers/net/ethernet/8390/stnic.c
··· 296 296 297 297 module_init(stnic_probe); 298 298 module_exit(stnic_cleanup); 299 + MODULE_DESCRIPTION("National Semiconductor DP83902AV ethernet driver"); 299 300 MODULE_LICENSE("GPL");
+1
drivers/net/ethernet/8390/zorro8390.c
··· 443 443 module_init(zorro8390_init_module); 444 444 module_exit(zorro8390_cleanup_module); 445 445 446 + MODULE_DESCRIPTION("Zorro NS8390-based ethernet driver"); 446 447 MODULE_LICENSE("GPL");
+1
drivers/net/ethernet/broadcom/bcm4908_enet.c
··· 793 793 }; 794 794 module_platform_driver(bcm4908_enet_driver); 795 795 796 + MODULE_DESCRIPTION("Broadcom BCM4908 Gigabit Ethernet driver"); 796 797 MODULE_LICENSE("GPL v2"); 797 798 MODULE_DEVICE_TABLE(of, bcm4908_enet_of_match);
+1
drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c
··· 260 260 EXPORT_SYMBOL_GPL(bcma_mdio_mii_unregister); 261 261 262 262 MODULE_AUTHOR("Rafał Miłecki"); 263 + MODULE_DESCRIPTION("Broadcom iProc GBit BCMA MDIO helpers"); 263 264 MODULE_LICENSE("GPL");
+1
drivers/net/ethernet/broadcom/bgmac-bcma.c
··· 362 362 module_exit(bgmac_exit) 363 363 364 364 MODULE_AUTHOR("Rafał Miłecki"); 365 + MODULE_DESCRIPTION("Broadcom iProc GBit BCMA interface driver"); 365 366 MODULE_LICENSE("GPL");
+1
drivers/net/ethernet/broadcom/bgmac-platform.c
··· 298 298 }; 299 299 300 300 module_platform_driver(bgmac_enet_driver); 301 + MODULE_DESCRIPTION("Broadcom iProc GBit platform interface driver"); 301 302 MODULE_LICENSE("GPL");
+1
drivers/net/ethernet/broadcom/bgmac.c
··· 1626 1626 EXPORT_SYMBOL_GPL(bgmac_enet_resume); 1627 1627 1628 1628 MODULE_AUTHOR("Rafał Miłecki"); 1629 + MODULE_DESCRIPTION("Broadcom iProc GBit driver"); 1629 1630 MODULE_LICENSE("GPL");
+35 -14
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 3817 3817 { 3818 3818 bool sh = !!(bp->flags & BNXT_FLAG_SHARED_RINGS); 3819 3819 int i, j, rc, ulp_base_vec, ulp_msix; 3820 - int tcs = netdev_get_num_tc(bp->dev); 3820 + int tcs = bp->num_tc; 3821 3821 3822 3822 if (!tcs) 3823 3823 tcs = 1; ··· 5935 5935 5936 5936 int bnxt_get_nr_rss_ctxs(struct bnxt *bp, int rx_rings) 5937 5937 { 5938 - if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) 5939 - return DIV_ROUND_UP(rx_rings, BNXT_RSS_TABLE_ENTRIES_P5); 5938 + if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) { 5939 + if (!rx_rings) 5940 + return 0; 5941 + return bnxt_calc_nr_ring_pages(rx_rings - 1, 5942 + BNXT_RSS_TABLE_ENTRIES_P5); 5943 + } 5940 5944 if (BNXT_CHIP_TYPE_NITRO_A0(bp)) 5941 5945 return 2; 5942 5946 return 1; ··· 6930 6926 if (cp < (rx + tx)) { 6931 6927 rc = __bnxt_trim_rings(bp, &rx, &tx, cp, false); 6932 6928 if (rc) 6933 - return rc; 6929 + goto get_rings_exit; 6934 6930 if (bp->flags & BNXT_FLAG_AGG_RINGS) 6935 6931 rx <<= 1; 6936 6932 hw_resc->resv_rx_rings = rx; ··· 6942 6938 hw_resc->resv_cp_rings = cp; 6943 6939 hw_resc->resv_stat_ctxs = stats; 6944 6940 } 6941 + get_rings_exit: 6945 6942 hwrm_req_drop(bp, req); 6946 - return 0; 6943 + return rc; 6947 6944 } 6948 6945 6949 6946 int __bnxt_hwrm_get_tx_rings(struct bnxt *bp, u16 fid, int *tx_rings) ··· 7005 7000 7006 7001 req->num_rx_rings = cpu_to_le16(rx_rings); 7007 7002 if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) { 7003 + u16 rss_ctx = bnxt_get_nr_rss_ctxs(bp, ring_grps); 7004 + 7008 7005 req->num_cmpl_rings = cpu_to_le16(tx_rings + ring_grps); 7009 7006 req->num_msix = cpu_to_le16(cp_rings); 7010 - req->num_rsscos_ctxs = 7011 - cpu_to_le16(DIV_ROUND_UP(ring_grps, 64)); 7007 + req->num_rsscos_ctxs = cpu_to_le16(rss_ctx); 7012 7008 } else { 7013 7009 req->num_cmpl_rings = cpu_to_le16(cp_rings); 7014 7010 req->num_hw_ring_grps = cpu_to_le16(ring_grps); ··· 7056 7050 req->num_tx_rings = cpu_to_le16(tx_rings); 7057 7051 req->num_rx_rings = cpu_to_le16(rx_rings); 7058 7052 if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) { 7053 + u16 rss_ctx = bnxt_get_nr_rss_ctxs(bp, ring_grps); 7054 + 7059 7055 req->num_cmpl_rings = cpu_to_le16(tx_rings + ring_grps); 7060 - req->num_rsscos_ctxs = cpu_to_le16(DIV_ROUND_UP(ring_grps, 64)); 7056 + req->num_rsscos_ctxs = cpu_to_le16(rss_ctx); 7061 7057 } else { 7062 7058 req->num_cmpl_rings = cpu_to_le16(cp_rings); 7063 7059 req->num_hw_ring_grps = cpu_to_le16(ring_grps); ··· 9946 9938 9947 9939 int bnxt_num_tx_to_cp(struct bnxt *bp, int tx) 9948 9940 { 9949 - int tcs = netdev_get_num_tc(bp->dev); 9941 + int tcs = bp->num_tc; 9950 9942 9951 9943 if (!tcs) 9952 9944 tcs = 1; ··· 9955 9947 9956 9948 static int bnxt_num_cp_to_tx(struct bnxt *bp, int tx_cp) 9957 9949 { 9958 - int tcs = netdev_get_num_tc(bp->dev); 9950 + int tcs = bp->num_tc; 9959 9951 9960 9952 return (tx_cp - bp->tx_nr_rings_xdp) * tcs + 9961 9953 bp->tx_nr_rings_xdp; ··· 9985 9977 struct net_device *dev = bp->dev; 9986 9978 int tcs, i; 9987 9979 9988 - tcs = netdev_get_num_tc(dev); 9980 + tcs = bp->num_tc; 9989 9981 if (tcs) { 9990 9982 int i, off, count; 9991 9983 ··· 10017 10009 { 10018 10010 const int len = sizeof(bp->irq_tbl[0].name); 10019 10011 10020 - if (netdev_get_num_tc(bp->dev)) 10012 + if (bp->num_tc) { 10021 10013 netdev_reset_tc(bp->dev); 10014 + bp->num_tc = 0; 10015 + } 10022 10016 10023 10017 snprintf(bp->irq_tbl[0].name, len, "%s-%s-%d", bp->dev->name, "TxRx", 10024 10018 0); ··· 10246 10236 10247 10237 int bnxt_reserve_rings(struct bnxt *bp, bool irq_re_init) 10248 10238 { 10249 - int tcs = netdev_get_num_tc(bp->dev); 10250 10239 bool irq_cleared = false; 10240 + int tcs = bp->num_tc; 10251 10241 int rc; 10252 10242 10253 10243 if (!bnxt_need_reserve_rings(bp)) ··· 10273 10263 bp->tx_nr_rings - bp->tx_nr_rings_xdp)) { 10274 10264 netdev_err(bp->dev, "tx ring reservation failure\n"); 10275 10265 netdev_reset_tc(bp->dev); 10266 + bp->num_tc = 0; 10276 10267 if (bp->tx_nr_rings_xdp) 10277 10268 bp->tx_nr_rings_per_tc = bp->tx_nr_rings_xdp; 10278 10269 else ··· 11575 11564 netdev_err(bp->dev, "bnxt_alloc_mem err: %x\n", rc); 11576 11565 goto half_open_err; 11577 11566 } 11567 + bnxt_init_napi(bp); 11578 11568 set_bit(BNXT_STATE_HALF_OPEN, &bp->state); 11579 11569 rc = bnxt_init_nic(bp, true); 11580 11570 if (rc) { 11581 11571 clear_bit(BNXT_STATE_HALF_OPEN, &bp->state); 11572 + bnxt_del_napi(bp); 11582 11573 netdev_err(bp->dev, "bnxt_init_nic err: %x\n", rc); 11583 11574 goto half_open_err; 11584 11575 } ··· 11599 11586 void bnxt_half_close_nic(struct bnxt *bp) 11600 11587 { 11601 11588 bnxt_hwrm_resource_free(bp, false, true); 11589 + bnxt_del_napi(bp); 11602 11590 bnxt_free_skbs(bp); 11603 11591 bnxt_free_mem(bp, true); 11604 11592 clear_bit(BNXT_STATE_HALF_OPEN, &bp->state); ··· 13246 13232 13247 13233 bp->fw_cap = 0; 13248 13234 rc = bnxt_hwrm_ver_get(bp); 13235 + /* FW may be unresponsive after FLR. FLR must complete within 100 msec 13236 + * so wait before continuing with recovery. 13237 + */ 13238 + if (rc) 13239 + msleep(100); 13249 13240 bnxt_try_map_fw_health_reg(bp); 13250 13241 if (rc) { 13251 13242 rc = bnxt_try_recover_fw(bp); ··· 13803 13784 return -EINVAL; 13804 13785 } 13805 13786 13806 - if (netdev_get_num_tc(dev) == tc) 13787 + if (bp->num_tc == tc) 13807 13788 return 0; 13808 13789 13809 13790 if (bp->flags & BNXT_FLAG_SHARED_RINGS) ··· 13821 13802 if (tc) { 13822 13803 bp->tx_nr_rings = bp->tx_nr_rings_per_tc * tc; 13823 13804 netdev_set_num_tc(dev, tc); 13805 + bp->num_tc = tc; 13824 13806 } else { 13825 13807 bp->tx_nr_rings = bp->tx_nr_rings_per_tc; 13826 13808 netdev_reset_tc(dev); 13809 + bp->num_tc = 0; 13827 13810 } 13828 13811 bp->tx_nr_rings += bp->tx_nr_rings_xdp; 13829 13812 tx_cp = bnxt_num_tx_to_cp(bp, bp->tx_nr_rings);
+1
drivers/net/ethernet/broadcom/bnxt/bnxt.h
··· 2225 2225 u8 tc_to_qidx[BNXT_MAX_QUEUE]; 2226 2226 u8 q_ids[BNXT_MAX_QUEUE]; 2227 2227 u8 max_q; 2228 + u8 num_tc; 2228 2229 2229 2230 unsigned int current_interval; 2230 2231 #define BNXT_TIMER_INTERVAL HZ
+1 -1
drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c
··· 228 228 } 229 229 } 230 230 if (bp->ieee_ets) { 231 - int tc = netdev_get_num_tc(bp->dev); 231 + int tc = bp->num_tc; 232 232 233 233 if (!tc) 234 234 tc = 1;
+4 -3
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
··· 884 884 if (max_tx_sch_inputs) 885 885 max_tx_rings = min_t(int, max_tx_rings, max_tx_sch_inputs); 886 886 887 - tcs = netdev_get_num_tc(dev); 887 + tcs = bp->num_tc; 888 888 tx_grps = max(tcs, 1); 889 889 if (bp->tx_nr_rings_xdp) 890 890 tx_grps++; ··· 944 944 if (channel->combined_count) 945 945 sh = true; 946 946 947 - tcs = netdev_get_num_tc(dev); 947 + tcs = bp->num_tc; 948 948 949 949 req_tx_rings = sh ? channel->combined_count : channel->tx_count; 950 950 req_rx_rings = sh ? channel->combined_count : channel->rx_count; ··· 1574 1574 struct bnxt *bp = netdev_priv(dev); 1575 1575 1576 1576 if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) 1577 - return ALIGN(bp->rx_nr_rings, BNXT_RSS_TABLE_ENTRIES_P5); 1577 + return bnxt_get_nr_rss_ctxs(bp, bp->rx_nr_rings) * 1578 + BNXT_RSS_TABLE_ENTRIES_P5; 1578 1579 return HW_HASH_INDEX_SIZE; 1579 1580 } 1580 1581
+1 -1
drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c
··· 407 407 if (prog) 408 408 tx_xdp = bp->rx_nr_rings; 409 409 410 - tc = netdev_get_num_tc(dev); 410 + tc = bp->num_tc; 411 411 if (!tc) 412 412 tc = 1; 413 413 rc = bnxt_check_rings(bp, bp->tx_nr_rings_per_tc, bp->rx_nr_rings,
+1
drivers/net/ethernet/cavium/liquidio/lio_core.c
··· 27 27 #include "octeon_network.h" 28 28 29 29 MODULE_AUTHOR("Cavium Networks, <support@cavium.com>"); 30 + MODULE_DESCRIPTION("Cavium LiquidIO Intelligent Server Adapter Core"); 30 31 MODULE_LICENSE("GPL"); 31 32 32 33 /* OOM task polling interval */
+1
drivers/net/ethernet/cirrus/ep93xx_eth.c
··· 868 868 869 869 module_platform_driver(ep93xx_eth_driver); 870 870 871 + MODULE_DESCRIPTION("Cirrus EP93xx Ethernet driver"); 871 872 MODULE_LICENSE("GPL"); 872 873 MODULE_ALIAS("platform:ep93xx-eth");
+15 -2
drivers/net/ethernet/engleder/tsnep_main.c
··· 1485 1485 1486 1486 xdp_prepare_buff(&xdp, page_address(entry->page), 1487 1487 XDP_PACKET_HEADROOM + TSNEP_RX_INLINE_METADATA_SIZE, 1488 - length, false); 1488 + length - ETH_FCS_LEN, false); 1489 1489 1490 1490 consume = tsnep_xdp_run_prog(rx, prog, &xdp, 1491 1491 &xdp_status, tx_nq, tx); ··· 1568 1568 prefetch(entry->xdp->data); 1569 1569 length = __le32_to_cpu(entry->desc_wb->properties) & 1570 1570 TSNEP_DESC_LENGTH_MASK; 1571 - xsk_buff_set_size(entry->xdp, length); 1571 + xsk_buff_set_size(entry->xdp, length - ETH_FCS_LEN); 1572 1572 xsk_buff_dma_sync_for_cpu(entry->xdp, rx->xsk_pool); 1573 1573 1574 1574 /* RX metadata with timestamps is in front of actual data, ··· 1761 1761 1762 1762 allocated--; 1763 1763 } 1764 + } 1765 + 1766 + /* set need wakeup flag immediately if ring is not filled completely, 1767 + * first polling would be too late as need wakeup signalisation would 1768 + * be delayed for an indefinite time 1769 + */ 1770 + if (xsk_uses_need_wakeup(rx->xsk_pool)) { 1771 + int desc_available = tsnep_rx_desc_available(rx); 1772 + 1773 + if (desc_available) 1774 + xsk_set_rx_need_wakeup(rx->xsk_pool); 1775 + else 1776 + xsk_clear_rx_need_wakeup(rx->xsk_pool); 1764 1777 } 1765 1778 } 1766 1779
+1
drivers/net/ethernet/ezchip/nps_enet.c
··· 661 661 module_platform_driver(nps_enet_driver); 662 662 663 663 MODULE_AUTHOR("EZchip Semiconductor"); 664 + MODULE_DESCRIPTION("EZchip NPS Ethernet driver"); 664 665 MODULE_LICENSE("GPL v2");
+1
drivers/net/ethernet/freescale/enetc/enetc.c
··· 3216 3216 } 3217 3217 EXPORT_SYMBOL_GPL(enetc_pci_remove); 3218 3218 3219 + MODULE_DESCRIPTION("NXP ENETC Ethernet driver"); 3219 3220 MODULE_LICENSE("Dual BSD/GPL");
+3
drivers/net/ethernet/freescale/fec_main.c
··· 2036 2036 2037 2037 /* if any of the above changed restart the FEC */ 2038 2038 if (status_change) { 2039 + netif_stop_queue(ndev); 2039 2040 napi_disable(&fep->napi); 2040 2041 netif_tx_lock_bh(ndev); 2041 2042 fec_restart(ndev); ··· 2046 2045 } 2047 2046 } else { 2048 2047 if (fep->link) { 2048 + netif_stop_queue(ndev); 2049 2049 napi_disable(&fep->napi); 2050 2050 netif_tx_lock_bh(ndev); 2051 2051 fec_stop(ndev); ··· 4771 4769 4772 4770 module_platform_driver(fec_driver); 4773 4771 4772 + MODULE_DESCRIPTION("NXP Fast Ethernet Controller (FEC) driver"); 4774 4773 MODULE_LICENSE("GPL");
+1
drivers/net/ethernet/freescale/fsl_pq_mdio.c
··· 531 531 532 532 module_platform_driver(fsl_pq_mdio_driver); 533 533 534 + MODULE_DESCRIPTION("Freescale PQ MDIO helpers"); 534 535 MODULE_LICENSE("GPL");
+31 -16
drivers/net/ethernet/intel/i40e/i40e_main.c
··· 3588 3588 struct i40e_hmc_obj_rxq rx_ctx; 3589 3589 int err = 0; 3590 3590 bool ok; 3591 - int ret; 3592 3591 3593 3592 bitmap_zero(ring->state, __I40E_RING_STATE_NBITS); 3594 3593 3595 3594 /* clear the context structure first */ 3596 3595 memset(&rx_ctx, 0, sizeof(rx_ctx)); 3597 3596 3598 - if (ring->vsi->type == I40E_VSI_MAIN) 3599 - xdp_rxq_info_unreg_mem_model(&ring->xdp_rxq); 3597 + ring->rx_buf_len = vsi->rx_buf_len; 3598 + 3599 + /* XDP RX-queue info only needed for RX rings exposed to XDP */ 3600 + if (ring->vsi->type != I40E_VSI_MAIN) 3601 + goto skip; 3602 + 3603 + if (!xdp_rxq_info_is_reg(&ring->xdp_rxq)) { 3604 + err = __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev, 3605 + ring->queue_index, 3606 + ring->q_vector->napi.napi_id, 3607 + ring->rx_buf_len); 3608 + if (err) 3609 + return err; 3610 + } 3600 3611 3601 3612 ring->xsk_pool = i40e_xsk_pool(ring); 3602 3613 if (ring->xsk_pool) { 3603 - ring->rx_buf_len = 3604 - xsk_pool_get_rx_frame_size(ring->xsk_pool); 3605 - ret = xdp_rxq_info_reg_mem_model(&ring->xdp_rxq, 3614 + xdp_rxq_info_unreg(&ring->xdp_rxq); 3615 + ring->rx_buf_len = xsk_pool_get_rx_frame_size(ring->xsk_pool); 3616 + err = __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev, 3617 + ring->queue_index, 3618 + ring->q_vector->napi.napi_id, 3619 + ring->rx_buf_len); 3620 + if (err) 3621 + return err; 3622 + err = xdp_rxq_info_reg_mem_model(&ring->xdp_rxq, 3606 3623 MEM_TYPE_XSK_BUFF_POOL, 3607 3624 NULL); 3608 - if (ret) 3609 - return ret; 3625 + if (err) 3626 + return err; 3610 3627 dev_info(&vsi->back->pdev->dev, 3611 3628 "Registered XDP mem model MEM_TYPE_XSK_BUFF_POOL on Rx ring %d\n", 3612 3629 ring->queue_index); 3613 3630 3614 3631 } else { 3615 - ring->rx_buf_len = vsi->rx_buf_len; 3616 - if (ring->vsi->type == I40E_VSI_MAIN) { 3617 - ret = xdp_rxq_info_reg_mem_model(&ring->xdp_rxq, 3618 - MEM_TYPE_PAGE_SHARED, 3619 - NULL); 3620 - if (ret) 3621 - return ret; 3622 - } 3632 + err = xdp_rxq_info_reg_mem_model(&ring->xdp_rxq, 3633 + MEM_TYPE_PAGE_SHARED, 3634 + NULL); 3635 + if (err) 3636 + return err; 3623 3637 } 3624 3638 3639 + skip: 3625 3640 xdp_init_buff(&ring->xdp, i40e_rx_pg_size(ring) / 2, &ring->xdp_rxq); 3626 3641 3627 3642 rx_ctx.dbuff = DIV_ROUND_UP(ring->rx_buf_len,
+23 -26
drivers/net/ethernet/intel/i40e/i40e_txrx.c
··· 1548 1548 int i40e_setup_rx_descriptors(struct i40e_ring *rx_ring) 1549 1549 { 1550 1550 struct device *dev = rx_ring->dev; 1551 - int err; 1552 1551 1553 1552 u64_stats_init(&rx_ring->syncp); 1554 1553 ··· 1567 1568 rx_ring->next_to_clean = 0; 1568 1569 rx_ring->next_to_process = 0; 1569 1570 rx_ring->next_to_use = 0; 1570 - 1571 - /* XDP RX-queue info only needed for RX rings exposed to XDP */ 1572 - if (rx_ring->vsi->type == I40E_VSI_MAIN) { 1573 - err = xdp_rxq_info_reg(&rx_ring->xdp_rxq, rx_ring->netdev, 1574 - rx_ring->queue_index, rx_ring->q_vector->napi.napi_id); 1575 - if (err < 0) 1576 - return err; 1577 - } 1578 1571 1579 1572 rx_ring->xdp_prog = rx_ring->vsi->xdp_prog; 1580 1573 ··· 2078 2087 static void i40e_process_rx_buffs(struct i40e_ring *rx_ring, int xdp_res, 2079 2088 struct xdp_buff *xdp) 2080 2089 { 2081 - u32 next = rx_ring->next_to_clean; 2090 + u32 nr_frags = xdp_get_shared_info_from_buff(xdp)->nr_frags; 2091 + u32 next = rx_ring->next_to_clean, i = 0; 2082 2092 struct i40e_rx_buffer *rx_buffer; 2083 2093 2084 2094 xdp->flags = 0; ··· 2092 2100 if (!rx_buffer->page) 2093 2101 continue; 2094 2102 2095 - if (xdp_res == I40E_XDP_CONSUMED) 2096 - rx_buffer->pagecnt_bias++; 2097 - else 2103 + if (xdp_res != I40E_XDP_CONSUMED) 2098 2104 i40e_rx_buffer_flip(rx_buffer, xdp->frame_sz); 2105 + else if (i++ <= nr_frags) 2106 + rx_buffer->pagecnt_bias++; 2099 2107 2100 2108 /* EOP buffer will be put in i40e_clean_rx_irq() */ 2101 2109 if (next == rx_ring->next_to_process) ··· 2109 2117 * i40e_construct_skb - Allocate skb and populate it 2110 2118 * @rx_ring: rx descriptor ring to transact packets on 2111 2119 * @xdp: xdp_buff pointing to the data 2112 - * @nr_frags: number of buffers for the packet 2113 2120 * 2114 2121 * This function allocates an skb. It then populates it with the page 2115 2122 * data from the current receive descriptor, taking care to set up the 2116 2123 * skb correctly. 2117 2124 */ 2118 2125 static struct sk_buff *i40e_construct_skb(struct i40e_ring *rx_ring, 2119 - struct xdp_buff *xdp, 2120 - u32 nr_frags) 2126 + struct xdp_buff *xdp) 2121 2127 { 2122 2128 unsigned int size = xdp->data_end - xdp->data; 2123 2129 struct i40e_rx_buffer *rx_buffer; 2130 + struct skb_shared_info *sinfo; 2124 2131 unsigned int headlen; 2125 2132 struct sk_buff *skb; 2133 + u32 nr_frags = 0; 2126 2134 2127 2135 /* prefetch first cache line of first page */ 2128 2136 net_prefetch(xdp->data); ··· 2160 2168 memcpy(__skb_put(skb, headlen), xdp->data, 2161 2169 ALIGN(headlen, sizeof(long))); 2162 2170 2171 + if (unlikely(xdp_buff_has_frags(xdp))) { 2172 + sinfo = xdp_get_shared_info_from_buff(xdp); 2173 + nr_frags = sinfo->nr_frags; 2174 + } 2163 2175 rx_buffer = i40e_rx_bi(rx_ring, rx_ring->next_to_clean); 2164 2176 /* update all of the pointers */ 2165 2177 size -= headlen; ··· 2183 2187 } 2184 2188 2185 2189 if (unlikely(xdp_buff_has_frags(xdp))) { 2186 - struct skb_shared_info *sinfo, *skinfo = skb_shinfo(skb); 2190 + struct skb_shared_info *skinfo = skb_shinfo(skb); 2187 2191 2188 - sinfo = xdp_get_shared_info_from_buff(xdp); 2189 2192 memcpy(&skinfo->frags[skinfo->nr_frags], &sinfo->frags[0], 2190 2193 sizeof(skb_frag_t) * nr_frags); 2191 2194 ··· 2207 2212 * i40e_build_skb - Build skb around an existing buffer 2208 2213 * @rx_ring: Rx descriptor ring to transact packets on 2209 2214 * @xdp: xdp_buff pointing to the data 2210 - * @nr_frags: number of buffers for the packet 2211 2215 * 2212 2216 * This function builds an skb around an existing Rx buffer, taking care 2213 2217 * to set up the skb correctly and avoid any memcpy overhead. 2214 2218 */ 2215 2219 static struct sk_buff *i40e_build_skb(struct i40e_ring *rx_ring, 2216 - struct xdp_buff *xdp, 2217 - u32 nr_frags) 2220 + struct xdp_buff *xdp) 2218 2221 { 2219 2222 unsigned int metasize = xdp->data - xdp->data_meta; 2223 + struct skb_shared_info *sinfo; 2220 2224 struct sk_buff *skb; 2225 + u32 nr_frags; 2221 2226 2222 2227 /* Prefetch first cache line of first page. If xdp->data_meta 2223 2228 * is unused, this points exactly as xdp->data, otherwise we ··· 2225 2230 * data, and then actual data. 2226 2231 */ 2227 2232 net_prefetch(xdp->data_meta); 2233 + 2234 + if (unlikely(xdp_buff_has_frags(xdp))) { 2235 + sinfo = xdp_get_shared_info_from_buff(xdp); 2236 + nr_frags = sinfo->nr_frags; 2237 + } 2228 2238 2229 2239 /* build an skb around the page buffer */ 2230 2240 skb = napi_build_skb(xdp->data_hard_start, xdp->frame_sz); ··· 2243 2243 skb_metadata_set(skb, metasize); 2244 2244 2245 2245 if (unlikely(xdp_buff_has_frags(xdp))) { 2246 - struct skb_shared_info *sinfo; 2247 - 2248 - sinfo = xdp_get_shared_info_from_buff(xdp); 2249 2246 xdp_update_skb_shared_info(skb, nr_frags, 2250 2247 sinfo->xdp_frags_size, 2251 2248 nr_frags * xdp->frame_sz, ··· 2586 2589 total_rx_bytes += size; 2587 2590 } else { 2588 2591 if (ring_uses_build_skb(rx_ring)) 2589 - skb = i40e_build_skb(rx_ring, xdp, nfrags); 2592 + skb = i40e_build_skb(rx_ring, xdp); 2590 2593 else 2591 - skb = i40e_construct_skb(rx_ring, xdp, nfrags); 2594 + skb = i40e_construct_skb(rx_ring, xdp); 2592 2595 2593 2596 /* drop if we failed to retrieve a buffer */ 2594 2597 if (!skb) {
+2 -2
drivers/net/ethernet/intel/i40e/i40e_xsk.c
··· 414 414 } 415 415 416 416 __skb_fill_page_desc_noacc(sinfo, sinfo->nr_frags++, 417 - virt_to_page(xdp->data_hard_start), 0, size); 417 + virt_to_page(xdp->data_hard_start), 418 + XDP_PACKET_HEADROOM, size); 418 419 sinfo->xdp_frags_size += size; 419 420 xsk_buff_add_frag(xdp); 420 421 ··· 499 498 xdp_res = i40e_run_xdp_zc(rx_ring, first, xdp_prog); 500 499 i40e_handle_xdp_result_zc(rx_ring, first, rx_desc, &rx_packets, 501 500 &rx_bytes, xdp_res, &failure); 502 - first->flags = 0; 503 501 next_to_clean = next_to_process; 504 502 if (failure) 505 503 break;
+23 -14
drivers/net/ethernet/intel/ice/ice_base.c
··· 547 547 ring->rx_buf_len = ring->vsi->rx_buf_len; 548 548 549 549 if (ring->vsi->type == ICE_VSI_PF) { 550 - if (!xdp_rxq_info_is_reg(&ring->xdp_rxq)) 551 - /* coverity[check_return] */ 552 - __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev, 553 - ring->q_index, 554 - ring->q_vector->napi.napi_id, 555 - ring->vsi->rx_buf_len); 550 + if (!xdp_rxq_info_is_reg(&ring->xdp_rxq)) { 551 + err = __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev, 552 + ring->q_index, 553 + ring->q_vector->napi.napi_id, 554 + ring->rx_buf_len); 555 + if (err) 556 + return err; 557 + } 556 558 557 559 ring->xsk_pool = ice_xsk_pool(ring); 558 560 if (ring->xsk_pool) { 559 - xdp_rxq_info_unreg_mem_model(&ring->xdp_rxq); 561 + xdp_rxq_info_unreg(&ring->xdp_rxq); 560 562 561 563 ring->rx_buf_len = 562 564 xsk_pool_get_rx_frame_size(ring->xsk_pool); 565 + err = __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev, 566 + ring->q_index, 567 + ring->q_vector->napi.napi_id, 568 + ring->rx_buf_len); 569 + if (err) 570 + return err; 563 571 err = xdp_rxq_info_reg_mem_model(&ring->xdp_rxq, 564 572 MEM_TYPE_XSK_BUFF_POOL, 565 573 NULL); ··· 579 571 dev_info(dev, "Registered XDP mem model MEM_TYPE_XSK_BUFF_POOL on Rx ring %d\n", 580 572 ring->q_index); 581 573 } else { 582 - if (!xdp_rxq_info_is_reg(&ring->xdp_rxq)) 583 - /* coverity[check_return] */ 584 - __xdp_rxq_info_reg(&ring->xdp_rxq, 585 - ring->netdev, 586 - ring->q_index, 587 - ring->q_vector->napi.napi_id, 588 - ring->vsi->rx_buf_len); 574 + if (!xdp_rxq_info_is_reg(&ring->xdp_rxq)) { 575 + err = __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev, 576 + ring->q_index, 577 + ring->q_vector->napi.napi_id, 578 + ring->rx_buf_len); 579 + if (err) 580 + return err; 581 + } 589 582 590 583 err = xdp_rxq_info_reg_mem_model(&ring->xdp_rxq, 591 584 MEM_TYPE_PAGE_SHARED,
+9 -10
drivers/net/ethernet/intel/ice/ice_txrx.c
··· 513 513 if (ice_is_xdp_ena_vsi(rx_ring->vsi)) 514 514 WRITE_ONCE(rx_ring->xdp_prog, rx_ring->vsi->xdp_prog); 515 515 516 - if (rx_ring->vsi->type == ICE_VSI_PF && 517 - !xdp_rxq_info_is_reg(&rx_ring->xdp_rxq)) 518 - if (xdp_rxq_info_reg(&rx_ring->xdp_rxq, rx_ring->netdev, 519 - rx_ring->q_index, rx_ring->q_vector->napi.napi_id)) 520 - goto err; 521 516 return 0; 522 517 523 518 err: ··· 598 603 ret = ICE_XDP_CONSUMED; 599 604 } 600 605 exit: 601 - rx_buf->act = ret; 602 - if (unlikely(xdp_buff_has_frags(xdp))) 603 - ice_set_rx_bufs_act(xdp, rx_ring, ret); 606 + ice_set_rx_bufs_act(xdp, rx_ring, ret); 604 607 } 605 608 606 609 /** ··· 886 893 } 887 894 888 895 if (unlikely(sinfo->nr_frags == MAX_SKB_FRAGS)) { 889 - if (unlikely(xdp_buff_has_frags(xdp))) 890 - ice_set_rx_bufs_act(xdp, rx_ring, ICE_XDP_CONSUMED); 896 + ice_set_rx_bufs_act(xdp, rx_ring, ICE_XDP_CONSUMED); 891 897 return -ENOMEM; 892 898 } 893 899 894 900 __skb_fill_page_desc_noacc(sinfo, sinfo->nr_frags++, rx_buf->page, 895 901 rx_buf->page_offset, size); 896 902 sinfo->xdp_frags_size += size; 903 + /* remember frag count before XDP prog execution; bpf_xdp_adjust_tail() 904 + * can pop off frags but driver has to handle it on its own 905 + */ 906 + rx_ring->nr_frags = sinfo->nr_frags; 897 907 898 908 if (page_is_pfmemalloc(rx_buf->page)) 899 909 xdp_buff_set_frag_pfmemalloc(xdp); ··· 1247 1251 1248 1252 xdp->data = NULL; 1249 1253 rx_ring->first_desc = ntc; 1254 + rx_ring->nr_frags = 0; 1250 1255 continue; 1251 1256 construct_skb: 1252 1257 if (likely(ice_ring_uses_build_skb(rx_ring))) ··· 1263 1266 ICE_XDP_CONSUMED); 1264 1267 xdp->data = NULL; 1265 1268 rx_ring->first_desc = ntc; 1269 + rx_ring->nr_frags = 0; 1266 1270 break; 1267 1271 } 1268 1272 xdp->data = NULL; 1269 1273 rx_ring->first_desc = ntc; 1274 + rx_ring->nr_frags = 0; 1270 1275 1271 1276 stat_err_bits = BIT(ICE_RX_FLEX_DESC_STATUS0_RXE_S); 1272 1277 if (unlikely(ice_test_staterr(rx_desc->wb.status_error0,
+1
drivers/net/ethernet/intel/ice/ice_txrx.h
··· 358 358 struct ice_tx_ring *xdp_ring; 359 359 struct ice_rx_ring *next; /* pointer to next ring in q_vector */ 360 360 struct xsk_buff_pool *xsk_pool; 361 + u32 nr_frags; 361 362 dma_addr_t dma; /* physical address of ring */ 362 363 u16 rx_buf_len; 363 364 u8 dcb_tc; /* Traffic class of ring */
+22 -9
drivers/net/ethernet/intel/ice/ice_txrx_lib.h
··· 12 12 * act: action to store onto Rx buffers related to XDP buffer parts 13 13 * 14 14 * Set action that should be taken before putting Rx buffer from first frag 15 - * to one before last. Last one is handled by caller of this function as it 16 - * is the EOP frag that is currently being processed. This function is 17 - * supposed to be called only when XDP buffer contains frags. 15 + * to the last. 18 16 */ 19 17 static inline void 20 18 ice_set_rx_bufs_act(struct xdp_buff *xdp, const struct ice_rx_ring *rx_ring, 21 19 const unsigned int act) 22 20 { 23 - const struct skb_shared_info *sinfo = xdp_get_shared_info_from_buff(xdp); 24 - u32 first = rx_ring->first_desc; 25 - u32 nr_frags = sinfo->nr_frags; 21 + u32 sinfo_frags = xdp_get_shared_info_from_buff(xdp)->nr_frags; 22 + u32 nr_frags = rx_ring->nr_frags + 1; 23 + u32 idx = rx_ring->first_desc; 26 24 u32 cnt = rx_ring->count; 27 25 struct ice_rx_buf *buf; 28 26 29 27 for (int i = 0; i < nr_frags; i++) { 30 - buf = &rx_ring->rx_buf[first]; 28 + buf = &rx_ring->rx_buf[idx]; 31 29 buf->act = act; 32 30 33 - if (++first == cnt) 34 - first = 0; 31 + if (++idx == cnt) 32 + idx = 0; 33 + } 34 + 35 + /* adjust pagecnt_bias on frags freed by XDP prog */ 36 + if (sinfo_frags < rx_ring->nr_frags && act == ICE_XDP_CONSUMED) { 37 + u32 delta = rx_ring->nr_frags - sinfo_frags; 38 + 39 + while (delta) { 40 + if (idx == 0) 41 + idx = cnt - 1; 42 + else 43 + idx--; 44 + buf = &rx_ring->rx_buf[idx]; 45 + buf->pagecnt_bias--; 46 + delta--; 47 + } 35 48 } 36 49 } 37 50
+2 -2
drivers/net/ethernet/intel/ice/ice_xsk.c
··· 825 825 } 826 826 827 827 __skb_fill_page_desc_noacc(sinfo, sinfo->nr_frags++, 828 - virt_to_page(xdp->data_hard_start), 0, size); 828 + virt_to_page(xdp->data_hard_start), 829 + XDP_PACKET_HEADROOM, size); 829 830 sinfo->xdp_frags_size += size; 830 831 xsk_buff_add_frag(xdp); 831 832 ··· 896 895 897 896 if (!first) { 898 897 first = xdp; 899 - xdp_buff_clear_frags_flag(first); 900 898 } else if (ice_add_xsk_frag(rx_ring, first, xdp, size)) { 901 899 break; 902 900 }
+2
drivers/net/ethernet/intel/idpf/idpf_lib.c
··· 783 783 /* setup watchdog timeout value to be 5 second */ 784 784 netdev->watchdog_timeo = 5 * HZ; 785 785 786 + netdev->dev_port = idx; 787 + 786 788 /* configure default MTU size */ 787 789 netdev->min_mtu = ETH_MIN_MTU; 788 790 netdev->max_mtu = vport->max_mtu;
+1
drivers/net/ethernet/litex/litex_liteeth.c
··· 318 318 module_platform_driver(liteeth_driver); 319 319 320 320 MODULE_AUTHOR("Joel Stanley <joel@jms.id.au>"); 321 + MODULE_DESCRIPTION("LiteX Liteeth Ethernet driver"); 321 322 MODULE_LICENSE("GPL");
+26 -1
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
··· 614 614 mvpp2_write(priv, MVPP22_BM_POOL_BASE_ADDR_HIGH_REG, val); 615 615 } 616 616 617 + /* Cleanup pool before actual initialization in the OS */ 618 + static void mvpp2_bm_pool_cleanup(struct mvpp2 *priv, int pool_id) 619 + { 620 + unsigned int thread = mvpp2_cpu_to_thread(priv, get_cpu()); 621 + u32 val; 622 + int i; 623 + 624 + /* Drain the BM from all possible residues left by firmware */ 625 + for (i = 0; i < MVPP2_BM_POOL_SIZE_MAX; i++) 626 + mvpp2_thread_read(priv, thread, MVPP2_BM_PHY_ALLOC_REG(pool_id)); 627 + 628 + put_cpu(); 629 + 630 + /* Stop the BM pool */ 631 + val = mvpp2_read(priv, MVPP2_BM_POOL_CTRL_REG(pool_id)); 632 + val |= MVPP2_BM_STOP_MASK; 633 + mvpp2_write(priv, MVPP2_BM_POOL_CTRL_REG(pool_id), val); 634 + } 635 + 617 636 static int mvpp2_bm_init(struct device *dev, struct mvpp2 *priv) 618 637 { 619 638 enum dma_data_direction dma_dir = DMA_FROM_DEVICE; 620 639 int i, err, poolnum = MVPP2_BM_POOLS_NUM; 621 640 struct mvpp2_port *port; 641 + 642 + if (priv->percpu_pools) 643 + poolnum = mvpp2_get_nrxqs(priv) * 2; 644 + 645 + /* Clean up the pool state in case it contains stale state */ 646 + for (i = 0; i < poolnum; i++) 647 + mvpp2_bm_pool_cleanup(priv, i); 622 648 623 649 if (priv->percpu_pools) { 624 650 for (i = 0; i < priv->port_count; i++) { ··· 655 629 } 656 630 } 657 631 658 - poolnum = mvpp2_get_nrxqs(priv) * 2; 659 632 for (i = 0; i < poolnum; i++) { 660 633 /* the pool in use */ 661 634 int pn = i / (poolnum / 2);
+1
drivers/net/ethernet/marvell/octeontx2/af/mbox.c
··· 413 413 EXPORT_SYMBOL(otx2_mbox_id2name); 414 414 415 415 MODULE_AUTHOR("Marvell."); 416 + MODULE_DESCRIPTION("Marvell RVU NIC Mbox helpers"); 416 417 MODULE_LICENSE("GPL v2");
+3 -2
drivers/net/ethernet/mellanox/mlx5/core/cmd.c
··· 1923 1923 { 1924 1924 const char *namep = mlx5_command_str(opcode); 1925 1925 struct mlx5_cmd_stats *stats; 1926 + unsigned long flags; 1926 1927 1927 1928 if (!err || !(strcmp(namep, "unknown command opcode"))) 1928 1929 return; ··· 1931 1930 stats = xa_load(&dev->cmd.stats, opcode); 1932 1931 if (!stats) 1933 1932 return; 1934 - spin_lock_irq(&stats->lock); 1933 + spin_lock_irqsave(&stats->lock, flags); 1935 1934 stats->failed++; 1936 1935 if (err < 0) 1937 1936 stats->last_failed_errno = -err; ··· 1940 1939 stats->last_failed_mbox_status = status; 1941 1940 stats->last_failed_syndrome = syndrome; 1942 1941 } 1943 - spin_unlock_irq(&stats->lock); 1942 + spin_unlock_irqrestore(&stats->lock, flags); 1944 1943 } 1945 1944 1946 1945 /* preserve -EREMOTEIO for outbox.status != OK, otherwise return err as is */
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en.h
··· 1124 1124 extern const struct ethtool_ops mlx5e_ethtool_ops; 1125 1125 1126 1126 int mlx5e_create_mkey(struct mlx5_core_dev *mdev, u32 pdn, u32 *mkey); 1127 - int mlx5e_create_mdev_resources(struct mlx5_core_dev *mdev); 1127 + int mlx5e_create_mdev_resources(struct mlx5_core_dev *mdev, bool create_tises); 1128 1128 void mlx5e_destroy_mdev_resources(struct mlx5_core_dev *mdev); 1129 1129 int mlx5e_refresh_tirs(struct mlx5e_priv *priv, bool enable_uc_lb, 1130 1130 bool enable_mc_lb);
+1
drivers/net/ethernet/mellanox/mlx5/core/en/fs_tt_redirect.c
··· 436 436 in = kvzalloc(inlen, GFP_KERNEL); 437 437 if (!in || !ft->g) { 438 438 kfree(ft->g); 439 + ft->g = NULL; 439 440 kvfree(in); 440 441 return -ENOMEM; 441 442 }
+2 -2
drivers/net/ethernet/mellanox/mlx5/core/en/params.c
··· 1064 1064 void *wq = MLX5_ADDR_OF(sqc, sqc, wq); 1065 1065 bool allow_swp; 1066 1066 1067 - allow_swp = 1068 - mlx5_geneve_tx_allowed(mdev) || !!mlx5_ipsec_device_caps(mdev); 1067 + allow_swp = mlx5_geneve_tx_allowed(mdev) || 1068 + (mlx5_ipsec_device_caps(mdev) & MLX5_IPSEC_CAP_CRYPTO); 1069 1069 mlx5e_build_sq_param_common(mdev, param); 1070 1070 MLX5_SET(wq, wq, log_wq_sz, params->log_sq_size); 1071 1071 MLX5_SET(sqc, sqc, allow_swp, allow_swp);
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c
··· 213 213 mlx5e_ptpsq_mark_ts_cqes_undelivered(ptpsq, hwtstamp); 214 214 out: 215 215 napi_consume_skb(skb, budget); 216 - md_buff[*md_buff_sz++] = metadata_id; 216 + md_buff[(*md_buff_sz)++] = metadata_id; 217 217 if (unlikely(mlx5e_ptp_metadata_map_unhealthy(&ptpsq->metadata_map)) && 218 218 !test_and_set_bit(MLX5E_SQ_STATE_RECOVERING, &sq->state)) 219 219 queue_work(ptpsq->txqsq.priv->wq, &ptpsq->report_unhealthy_work);
+8 -2
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
··· 336 336 /* iv len */ 337 337 aes_gcm->icv_len = x->aead->alg_icv_len; 338 338 339 + attrs->dir = x->xso.dir; 340 + 339 341 /* esn */ 340 342 if (x->props.flags & XFRM_STATE_ESN) { 341 343 attrs->replay_esn.trigger = true; 342 344 attrs->replay_esn.esn = sa_entry->esn_state.esn; 343 345 attrs->replay_esn.esn_msb = sa_entry->esn_state.esn_msb; 344 346 attrs->replay_esn.overlap = sa_entry->esn_state.overlap; 347 + if (attrs->dir == XFRM_DEV_OFFLOAD_OUT) 348 + goto skip_replay_window; 349 + 345 350 switch (x->replay_esn->replay_window) { 346 351 case 32: 347 352 attrs->replay_esn.replay_window = ··· 370 365 } 371 366 } 372 367 373 - attrs->dir = x->xso.dir; 368 + skip_replay_window: 374 369 /* spi */ 375 370 attrs->spi = be32_to_cpu(x->id.spi); 376 371 ··· 506 501 return -EINVAL; 507 502 } 508 503 509 - if (x->replay_esn && x->replay_esn->replay_window != 32 && 504 + if (x->replay_esn && x->xso.dir == XFRM_DEV_OFFLOAD_IN && 505 + x->replay_esn->replay_window != 32 && 510 506 x->replay_esn->replay_window != 64 && 511 507 x->replay_esn->replay_window != 128 && 512 508 x->replay_esn->replay_window != 256) {
+15 -11
drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c
··· 254 254 255 255 ft->g = kcalloc(MLX5E_ARFS_NUM_GROUPS, 256 256 sizeof(*ft->g), GFP_KERNEL); 257 - in = kvzalloc(inlen, GFP_KERNEL); 258 - if (!in || !ft->g) { 259 - kfree(ft->g); 260 - kvfree(in); 257 + if (!ft->g) 261 258 return -ENOMEM; 259 + 260 + in = kvzalloc(inlen, GFP_KERNEL); 261 + if (!in) { 262 + err = -ENOMEM; 263 + goto err_free_g; 262 264 } 263 265 264 266 mc = MLX5_ADDR_OF(create_flow_group_in, in, match_criteria); ··· 280 278 break; 281 279 default: 282 280 err = -EINVAL; 283 - goto out; 281 + goto err_free_in; 284 282 } 285 283 286 284 switch (type) { ··· 302 300 break; 303 301 default: 304 302 err = -EINVAL; 305 - goto out; 303 + goto err_free_in; 306 304 } 307 305 308 306 MLX5_SET_CFG(in, match_criteria_enable, MLX5_MATCH_OUTER_HEADERS); ··· 311 309 MLX5_SET_CFG(in, end_flow_index, ix - 1); 312 310 ft->g[ft->num_groups] = mlx5_create_flow_group(ft->t, in); 313 311 if (IS_ERR(ft->g[ft->num_groups])) 314 - goto err; 312 + goto err_clean_group; 315 313 ft->num_groups++; 316 314 317 315 memset(in, 0, inlen); ··· 320 318 MLX5_SET_CFG(in, end_flow_index, ix - 1); 321 319 ft->g[ft->num_groups] = mlx5_create_flow_group(ft->t, in); 322 320 if (IS_ERR(ft->g[ft->num_groups])) 323 - goto err; 321 + goto err_clean_group; 324 322 ft->num_groups++; 325 323 326 324 kvfree(in); 327 325 return 0; 328 326 329 - err: 327 + err_clean_group: 330 328 err = PTR_ERR(ft->g[ft->num_groups]); 331 329 ft->g[ft->num_groups] = NULL; 332 - out: 330 + err_free_in: 333 331 kvfree(in); 334 - 332 + err_free_g: 333 + kfree(ft->g); 334 + ft->g = NULL; 335 335 return err; 336 336 } 337 337
+13 -8
drivers/net/ethernet/mellanox/mlx5/core/en_common.c
··· 95 95 { 96 96 int tc, i; 97 97 98 - for (i = 0; i < MLX5_MAX_PORTS; i++) 98 + for (i = 0; i < mlx5e_get_num_lag_ports(mdev); i++) 99 99 for (tc = 0; tc < MLX5_MAX_NUM_TC; tc++) 100 100 mlx5e_destroy_tis(mdev, tisn[i][tc]); 101 101 } ··· 110 110 int tc, i; 111 111 int err; 112 112 113 - for (i = 0; i < MLX5_MAX_PORTS; i++) { 113 + for (i = 0; i < mlx5e_get_num_lag_ports(mdev); i++) { 114 114 for (tc = 0; tc < MLX5_MAX_NUM_TC; tc++) { 115 115 u32 in[MLX5_ST_SZ_DW(create_tis_in)] = {}; 116 116 void *tisc; ··· 140 140 return err; 141 141 } 142 142 143 - int mlx5e_create_mdev_resources(struct mlx5_core_dev *mdev) 143 + int mlx5e_create_mdev_resources(struct mlx5_core_dev *mdev, bool create_tises) 144 144 { 145 145 struct mlx5e_hw_objs *res = &mdev->mlx5e_res.hw_objs; 146 146 int err; ··· 169 169 goto err_destroy_mkey; 170 170 } 171 171 172 - err = mlx5e_create_tises(mdev, res->tisn); 173 - if (err) { 174 - mlx5_core_err(mdev, "alloc tises failed, %d\n", err); 175 - goto err_destroy_bfreg; 172 + if (create_tises) { 173 + err = mlx5e_create_tises(mdev, res->tisn); 174 + if (err) { 175 + mlx5_core_err(mdev, "alloc tises failed, %d\n", err); 176 + goto err_destroy_bfreg; 177 + } 178 + res->tisn_valid = true; 176 179 } 180 + 177 181 INIT_LIST_HEAD(&res->td.tirs_list); 178 182 mutex_init(&res->td.list_lock); 179 183 ··· 207 203 208 204 mlx5_crypto_dek_cleanup(mdev->mlx5e_res.dek_priv); 209 205 mdev->mlx5e_res.dek_priv = NULL; 210 - mlx5e_destroy_tises(mdev, res->tisn); 206 + if (res->tisn_valid) 207 + mlx5e_destroy_tises(mdev, res->tisn); 211 208 mlx5_free_bfreg(mdev, &res->bfreg); 212 209 mlx5_core_destroy_mkey(mdev, res->mkey); 213 210 mlx5_core_dealloc_transport_domain(mdev, res->td.tdn);
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 5992 5992 if (netif_device_present(netdev)) 5993 5993 return 0; 5994 5994 5995 - err = mlx5e_create_mdev_resources(mdev); 5995 + err = mlx5e_create_mdev_resources(mdev, true); 5996 5996 if (err) 5997 5997 return err; 5998 5998
+3 -2
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
··· 761 761 762 762 err = mlx5e_rss_params_indir_init(&indir, mdev, 763 763 mlx5e_rqt_size(mdev, hp->num_channels), 764 - mlx5e_rqt_size(mdev, priv->max_nch)); 764 + mlx5e_rqt_size(mdev, hp->num_channels)); 765 765 if (err) 766 766 return err; 767 767 ··· 2014 2014 list_for_each_entry_safe(peer_flow, tmp, &flow->peer_flows, peer_flows) { 2015 2015 if (peer_index != mlx5_get_dev_index(peer_flow->priv->mdev)) 2016 2016 continue; 2017 + 2018 + list_del(&peer_flow->peer_flows); 2017 2019 if (refcount_dec_and_test(&peer_flow->refcnt)) { 2018 2020 mlx5e_tc_del_fdb_flow(peer_flow->priv, peer_flow); 2019 - list_del(&peer_flow->peer_flows); 2020 2021 kfree(peer_flow); 2021 2022 } 2022 2023 }
+3
drivers/net/ethernet/mellanox/mlx5/core/esw/bridge_mcast.c
··· 83 83 i++; 84 84 } 85 85 86 + rule_spec->flow_context.flags |= FLOW_CONTEXT_UPLINK_HAIRPIN_EN; 86 87 rule_spec->match_criteria_enable = MLX5_MATCH_OUTER_HEADERS; 87 88 dmac_v = MLX5_ADDR_OF(fte_match_param, rule_spec->match_value, outer_headers.dmac_47_16); 88 89 ether_addr_copy(dmac_v, entry->key.addr); ··· 588 587 if (!rule_spec) 589 588 return ERR_PTR(-ENOMEM); 590 589 590 + rule_spec->flow_context.flags |= FLOW_CONTEXT_UPLINK_HAIRPIN_EN; 591 591 rule_spec->match_criteria_enable = MLX5_MATCH_OUTER_HEADERS; 592 592 593 593 flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT; ··· 664 662 dest.vport.flags = MLX5_FLOW_DEST_VPORT_VHCA_ID; 665 663 dest.vport.vhca_id = port->esw_owner_vhca_id; 666 664 } 665 + rule_spec->flow_context.flags |= FLOW_CONTEXT_UPLINK_HAIRPIN_EN; 667 666 handle = mlx5_add_flow_rules(port->mcast.ft, rule_spec, &flow_act, &dest, 1); 668 667 669 668 kvfree(rule_spec);
+2
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
··· 566 566 fte->flow_context.flow_tag); 567 567 MLX5_SET(flow_context, in_flow_context, flow_source, 568 568 fte->flow_context.flow_source); 569 + MLX5_SET(flow_context, in_flow_context, uplink_hairpin_en, 570 + !!(fte->flow_context.flags & FLOW_CONTEXT_UPLINK_HAIRPIN_EN)); 569 571 570 572 MLX5_SET(flow_context, in_flow_context, extended_destination, 571 573 extended_dest);
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
··· 783 783 } 784 784 785 785 /* This should only be called once per mdev */ 786 - err = mlx5e_create_mdev_resources(mdev); 786 + err = mlx5e_create_mdev_resources(mdev, false); 787 787 if (err) 788 788 goto destroy_ht; 789 789 }
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/lib/aso.c
··· 98 98 mlx5_fill_page_frag_array(&cq->wq_ctrl.buf, 99 99 (__be64 *)MLX5_ADDR_OF(create_cq_in, in, pas)); 100 100 101 - MLX5_SET(cqc, cqc, cq_period_mode, DIM_CQ_PERIOD_MODE_START_FROM_EQE); 101 + MLX5_SET(cqc, cqc, cq_period_mode, MLX5_CQ_PERIOD_MODE_START_FROM_EQE); 102 102 MLX5_SET(cqc, cqc, c_eqn_or_apu_element, eqn); 103 103 MLX5_SET(cqc, cqc, uar_page, mdev->priv.uar->index); 104 104 MLX5_SET(cqc, cqc, log_page_size, cq->wq_ctrl.buf.page_shift -
+12 -5
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c
··· 788 788 switch (action_type) { 789 789 case DR_ACTION_TYP_DROP: 790 790 attr.final_icm_addr = nic_dmn->drop_icm_addr; 791 + attr.hit_gvmi = nic_dmn->drop_icm_addr >> 48; 791 792 break; 792 793 case DR_ACTION_TYP_FT: 793 794 dest_action = action; ··· 874 873 action->sampler->tx_icm_addr; 875 874 break; 876 875 case DR_ACTION_TYP_VPORT: 877 - attr.hit_gvmi = action->vport->caps->vhca_gvmi; 878 - dest_action = action; 879 - attr.final_icm_addr = rx_rule ? 880 - action->vport->caps->icm_address_rx : 881 - action->vport->caps->icm_address_tx; 876 + if (unlikely(rx_rule && action->vport->caps->num == MLX5_VPORT_UPLINK)) { 877 + /* can't go to uplink on RX rule - dropping instead */ 878 + attr.final_icm_addr = nic_dmn->drop_icm_addr; 879 + attr.hit_gvmi = nic_dmn->drop_icm_addr >> 48; 880 + } else { 881 + attr.hit_gvmi = action->vport->caps->vhca_gvmi; 882 + dest_action = action; 883 + attr.final_icm_addr = rx_rule ? 884 + action->vport->caps->icm_address_rx : 885 + action->vport->caps->icm_address_tx; 886 + } 882 887 break; 883 888 case DR_ACTION_TYP_POP_VLAN: 884 889 if (!rx_rule && !(dmn->ste_ctx->actions_caps &
+21
drivers/net/ethernet/mellanox/mlx5/core/vport.c
··· 440 440 } 441 441 EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_system_image_guid); 442 442 443 + int mlx5_query_nic_vport_sd_group(struct mlx5_core_dev *mdev, u8 *sd_group) 444 + { 445 + int outlen = MLX5_ST_SZ_BYTES(query_nic_vport_context_out); 446 + u32 *out; 447 + int err; 448 + 449 + out = kvzalloc(outlen, GFP_KERNEL); 450 + if (!out) 451 + return -ENOMEM; 452 + 453 + err = mlx5_query_nic_vport_context(mdev, 0, out); 454 + if (err) 455 + goto out; 456 + 457 + *sd_group = MLX5_GET(query_nic_vport_context_out, out, 458 + nic_vport_context.sd_group); 459 + out: 460 + kvfree(out); 461 + return err; 462 + } 463 + 443 464 int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid) 444 465 { 445 466 u32 *out;
+3
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 7542 7542 dev_err(priv->device, "unable to bring out of ahb reset: %pe\n", 7543 7543 ERR_PTR(ret)); 7544 7544 7545 + /* Wait a bit for the reset to take effect */ 7546 + udelay(10); 7547 + 7545 7548 /* Init MAC and get the capabilities */ 7546 7549 ret = stmmac_hw_init(priv); 7547 7550 if (ret)
+30 -7
drivers/net/fjes/fjes_hw.c
··· 221 221 222 222 mem_size = FJES_DEV_REQ_BUF_SIZE(hw->max_epid); 223 223 hw->hw_info.req_buf = kzalloc(mem_size, GFP_KERNEL); 224 - if (!(hw->hw_info.req_buf)) 225 - return -ENOMEM; 224 + if (!(hw->hw_info.req_buf)) { 225 + result = -ENOMEM; 226 + goto free_ep_info; 227 + } 226 228 227 229 hw->hw_info.req_buf_size = mem_size; 228 230 229 231 mem_size = FJES_DEV_RES_BUF_SIZE(hw->max_epid); 230 232 hw->hw_info.res_buf = kzalloc(mem_size, GFP_KERNEL); 231 - if (!(hw->hw_info.res_buf)) 232 - return -ENOMEM; 233 + if (!(hw->hw_info.res_buf)) { 234 + result = -ENOMEM; 235 + goto free_req_buf; 236 + } 233 237 234 238 hw->hw_info.res_buf_size = mem_size; 235 239 236 240 result = fjes_hw_alloc_shared_status_region(hw); 237 241 if (result) 238 - return result; 242 + goto free_res_buf; 239 243 240 244 hw->hw_info.buffer_share_bit = 0; 241 245 hw->hw_info.buffer_unshare_reserve_bit = 0; ··· 250 246 251 247 result = fjes_hw_alloc_epbuf(&buf_pair->tx); 252 248 if (result) 253 - return result; 249 + goto free_epbuf; 254 250 255 251 result = fjes_hw_alloc_epbuf(&buf_pair->rx); 256 252 if (result) 257 - return result; 253 + goto free_epbuf; 258 254 259 255 spin_lock_irqsave(&hw->rx_status_lock, flags); 260 256 fjes_hw_setup_epbuf(&buf_pair->tx, mac, ··· 277 273 fjes_hw_init_command_registers(hw, &param); 278 274 279 275 return 0; 276 + 277 + free_epbuf: 278 + for (epidx = 0; epidx < hw->max_epid ; epidx++) { 279 + if (epidx == hw->my_epid) 280 + continue; 281 + fjes_hw_free_epbuf(&hw->ep_shm_info[epidx].tx); 282 + fjes_hw_free_epbuf(&hw->ep_shm_info[epidx].rx); 283 + } 284 + fjes_hw_free_shared_status_region(hw); 285 + free_res_buf: 286 + kfree(hw->hw_info.res_buf); 287 + hw->hw_info.res_buf = NULL; 288 + free_req_buf: 289 + kfree(hw->hw_info.req_buf); 290 + hw->hw_info.req_buf = NULL; 291 + free_ep_info: 292 + kfree(hw->ep_shm_info); 293 + hw->ep_shm_info = NULL; 294 + return result; 280 295 } 281 296 282 297 static void fjes_hw_cleanup(struct fjes_hw *hw)
+2 -2
drivers/net/hyperv/netvsc_drv.c
··· 44 44 45 45 static unsigned int ring_size __ro_after_init = 128; 46 46 module_param(ring_size, uint, 0444); 47 - MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)"); 47 + MODULE_PARM_DESC(ring_size, "Ring buffer size (# of 4K pages)"); 48 48 unsigned int netvsc_ring_bytes __ro_after_init; 49 49 50 50 static const u32 default_msg = NETIF_MSG_DRV | NETIF_MSG_PROBE | ··· 2807 2807 pr_info("Increased ring_size to %u (min allowed)\n", 2808 2808 ring_size); 2809 2809 } 2810 - netvsc_ring_bytes = ring_size * PAGE_SIZE; 2810 + netvsc_ring_bytes = VMBUS_RING_SIZE(ring_size * 4096); 2811 2811 2812 2812 register_netdevice_notifier(&netvsc_netdev_notifier); 2813 2813
+20 -5
drivers/net/macsec.c
··· 607 607 return ERR_PTR(-EINVAL); 608 608 } 609 609 610 - ret = skb_ensure_writable_head_tail(skb, dev); 611 - if (unlikely(ret < 0)) { 612 - macsec_txsa_put(tx_sa); 613 - kfree_skb(skb); 614 - return ERR_PTR(ret); 610 + if (unlikely(skb_headroom(skb) < MACSEC_NEEDED_HEADROOM || 611 + skb_tailroom(skb) < MACSEC_NEEDED_TAILROOM)) { 612 + struct sk_buff *nskb = skb_copy_expand(skb, 613 + MACSEC_NEEDED_HEADROOM, 614 + MACSEC_NEEDED_TAILROOM, 615 + GFP_ATOMIC); 616 + if (likely(nskb)) { 617 + consume_skb(skb); 618 + skb = nskb; 619 + } else { 620 + macsec_txsa_put(tx_sa); 621 + kfree_skb(skb); 622 + return ERR_PTR(-ENOMEM); 623 + } 624 + } else { 625 + skb = skb_unshare(skb, GFP_ATOMIC); 626 + if (!skb) { 627 + macsec_txsa_put(tx_sa); 628 + return ERR_PTR(-ENOMEM); 629 + } 615 630 } 616 631 617 632 unprotected_len = skb->len;
+11
drivers/net/phy/micrel.c
··· 120 120 */ 121 121 #define LAN8814_1PPM_FORMAT 17179 122 122 123 + #define PTP_RX_VERSION 0x0248 124 + #define PTP_TX_VERSION 0x0288 125 + #define PTP_MAX_VERSION(x) (((x) & GENMASK(7, 0)) << 8) 126 + #define PTP_MIN_VERSION(x) ((x) & GENMASK(7, 0)) 127 + 123 128 #define PTP_RX_MOD 0x024F 124 129 #define PTP_RX_MOD_BAD_UDPV4_CHKSUM_FORCE_FCS_DIS_ BIT(3) 125 130 #define PTP_RX_TIMESTAMP_EN 0x024D ··· 3154 3149 lanphy_write_page_reg(phydev, 5, PTP_RX_PARSE_L2_ADDR_EN, 0); 3155 3150 lanphy_write_page_reg(phydev, 5, PTP_TX_PARSE_IP_ADDR_EN, 0); 3156 3151 lanphy_write_page_reg(phydev, 5, PTP_RX_PARSE_IP_ADDR_EN, 0); 3152 + 3153 + /* Disable checking for minorVersionPTP field */ 3154 + lanphy_write_page_reg(phydev, 5, PTP_RX_VERSION, 3155 + PTP_MAX_VERSION(0xff) | PTP_MIN_VERSION(0x0)); 3156 + lanphy_write_page_reg(phydev, 5, PTP_TX_VERSION, 3157 + PTP_MAX_VERSION(0xff) | PTP_MIN_VERSION(0x0)); 3157 3158 3158 3159 skb_queue_head_init(&ptp_priv->tx_queue); 3159 3160 skb_queue_head_init(&ptp_priv->rx_queue);
+8 -2
drivers/net/tun.c
··· 1630 1630 switch (act) { 1631 1631 case XDP_REDIRECT: 1632 1632 err = xdp_do_redirect(tun->dev, xdp, xdp_prog); 1633 - if (err) 1633 + if (err) { 1634 + dev_core_stats_rx_dropped_inc(tun->dev); 1634 1635 return err; 1636 + } 1637 + dev_sw_netstats_rx_add(tun->dev, xdp->data_end - xdp->data); 1635 1638 break; 1636 1639 case XDP_TX: 1637 1640 err = tun_xdp_tx(tun->dev, xdp); 1638 - if (err < 0) 1641 + if (err < 0) { 1642 + dev_core_stats_rx_dropped_inc(tun->dev); 1639 1643 return err; 1644 + } 1645 + dev_sw_netstats_rx_add(tun->dev, xdp->data_end - xdp->data); 1640 1646 break; 1641 1647 case XDP_PASS: 1642 1648 break;
-4
drivers/net/wireless/ath/ath11k/core.h
··· 368 368 struct ieee80211_chanctx_conf chanctx; 369 369 struct ath11k_arp_ns_offload arp_ns_offload; 370 370 struct ath11k_rekey_data rekey_data; 371 - 372 - #ifdef CONFIG_ATH11K_DEBUGFS 373 - struct dentry *debugfs_twt; 374 - #endif /* CONFIG_ATH11K_DEBUGFS */ 375 371 }; 376 372 377 373 struct ath11k_vif_iter {
+10 -15
drivers/net/wireless/ath/ath11k/debugfs.c
··· 1894 1894 .open = simple_open 1895 1895 }; 1896 1896 1897 - void ath11k_debugfs_add_interface(struct ath11k_vif *arvif) 1897 + void ath11k_debugfs_op_vif_add(struct ieee80211_hw *hw, 1898 + struct ieee80211_vif *vif) 1898 1899 { 1900 + struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); 1899 1901 struct ath11k_base *ab = arvif->ar->ab; 1902 + struct dentry *debugfs_twt; 1900 1903 1901 1904 if (arvif->vif->type != NL80211_IFTYPE_AP && 1902 1905 !(arvif->vif->type == NL80211_IFTYPE_STATION && 1903 1906 test_bit(WMI_TLV_SERVICE_STA_TWT, ab->wmi_ab.svc_map))) 1904 1907 return; 1905 1908 1906 - arvif->debugfs_twt = debugfs_create_dir("twt", 1907 - arvif->vif->debugfs_dir); 1908 - debugfs_create_file("add_dialog", 0200, arvif->debugfs_twt, 1909 + debugfs_twt = debugfs_create_dir("twt", 1910 + arvif->vif->debugfs_dir); 1911 + debugfs_create_file("add_dialog", 0200, debugfs_twt, 1909 1912 arvif, &ath11k_fops_twt_add_dialog); 1910 1913 1911 - debugfs_create_file("del_dialog", 0200, arvif->debugfs_twt, 1914 + debugfs_create_file("del_dialog", 0200, debugfs_twt, 1912 1915 arvif, &ath11k_fops_twt_del_dialog); 1913 1916 1914 - debugfs_create_file("pause_dialog", 0200, arvif->debugfs_twt, 1917 + debugfs_create_file("pause_dialog", 0200, debugfs_twt, 1915 1918 arvif, &ath11k_fops_twt_pause_dialog); 1916 1919 1917 - debugfs_create_file("resume_dialog", 0200, arvif->debugfs_twt, 1920 + debugfs_create_file("resume_dialog", 0200, debugfs_twt, 1918 1921 arvif, &ath11k_fops_twt_resume_dialog); 1919 1922 } 1920 1923 1921 - void ath11k_debugfs_remove_interface(struct ath11k_vif *arvif) 1922 - { 1923 - if (!arvif->debugfs_twt) 1924 - return; 1925 - 1926 - debugfs_remove_recursive(arvif->debugfs_twt); 1927 - arvif->debugfs_twt = NULL; 1928 - }
+2 -10
drivers/net/wireless/ath/ath11k/debugfs.h
··· 307 307 return ar->debug.rx_filter; 308 308 } 309 309 310 - void ath11k_debugfs_add_interface(struct ath11k_vif *arvif); 311 - void ath11k_debugfs_remove_interface(struct ath11k_vif *arvif); 310 + void ath11k_debugfs_op_vif_add(struct ieee80211_hw *hw, 311 + struct ieee80211_vif *vif); 312 312 void ath11k_debugfs_add_dbring_entry(struct ath11k *ar, 313 313 enum wmi_direct_buffer_module id, 314 314 enum ath11k_dbg_dbr_event event, ··· 385 385 u32 pdev_id, u32 vdev_id, u32 stats_id) 386 386 { 387 387 return 0; 388 - } 389 - 390 - static inline void ath11k_debugfs_add_interface(struct ath11k_vif *arvif) 391 - { 392 - } 393 - 394 - static inline void ath11k_debugfs_remove_interface(struct ath11k_vif *arvif) 395 - { 396 388 } 397 389 398 390 static inline void
+1 -11
drivers/net/wireless/ath/ath11k/mac.c
··· 6756 6756 goto err; 6757 6757 } 6758 6758 6759 - /* In the case of hardware recovery, debugfs files are 6760 - * not deleted since ieee80211_ops.remove_interface() is 6761 - * not invoked. In such cases, try to delete the files. 6762 - * These will be re-created later. 6763 - */ 6764 - ath11k_debugfs_remove_interface(arvif); 6765 - 6766 6759 memset(arvif, 0, sizeof(*arvif)); 6767 6760 6768 6761 arvif->ar = ar; ··· 6932 6939 6933 6940 ath11k_dp_vdev_tx_attach(ar, arvif); 6934 6941 6935 - ath11k_debugfs_add_interface(arvif); 6936 - 6937 6942 if (vif->type != NL80211_IFTYPE_MONITOR && 6938 6943 test_bit(ATH11K_FLAG_MONITOR_CONF_ENABLED, &ar->monitor_flags)) { 6939 6944 ret = ath11k_mac_monitor_vdev_create(ar); ··· 7046 7055 7047 7056 /* Recalc txpower for remaining vdev */ 7048 7057 ath11k_mac_txpower_recalc(ar); 7049 - 7050 - ath11k_debugfs_remove_interface(arvif); 7051 7058 7052 7059 /* TODO: recal traffic pause state based on the available vdevs */ 7053 7060 ··· 9142 9153 #endif 9143 9154 9144 9155 #ifdef CONFIG_ATH11K_DEBUGFS 9156 + .vif_add_debugfs = ath11k_debugfs_op_vif_add, 9145 9157 .sta_add_debugfs = ath11k_debugfs_sta_op_add, 9146 9158 #endif 9147 9159
+2 -2
drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause 2 2 /* 3 - * Copyright (C) 2018-2023 Intel Corporation 3 + * Copyright (C) 2018-2024 Intel Corporation 4 4 */ 5 5 #include <linux/firmware.h> 6 6 #include "iwl-drv.h" ··· 1096 1096 node_trig = (void *)node_tlv->data; 1097 1097 } 1098 1098 1099 - memcpy(node_trig->data + offset, trig->data, trig_data_len); 1099 + memcpy((u8 *)node_trig->data + offset, trig->data, trig_data_len); 1100 1100 node_tlv->length = cpu_to_le32(size); 1101 1101 1102 1102 if (policy & IWL_FW_INI_APPLY_POLICY_OVERRIDE_CFG) {
+1 -1
drivers/net/wireless/intersil/p54/fwio.c
··· 125 125 "FW rev %s - Softmac protocol %x.%x\n", 126 126 fw_version, priv->fw_var >> 8, priv->fw_var & 0xff); 127 127 snprintf(dev->wiphy->fw_version, sizeof(dev->wiphy->fw_version), 128 - "%s - %x.%x", fw_version, 128 + "%.19s - %x.%x", fw_version, 129 129 priv->fw_var >> 8, priv->fw_var & 0xff); 130 130 } 131 131
+38 -6
drivers/net/xen-netback/netback.c
··· 463 463 } 464 464 465 465 for (shinfo->nr_frags = 0; nr_slots > 0 && shinfo->nr_frags < MAX_SKB_FRAGS; 466 - shinfo->nr_frags++, gop++, nr_slots--) { 466 + nr_slots--) { 467 + if (unlikely(!txp->size)) { 468 + unsigned long flags; 469 + 470 + spin_lock_irqsave(&queue->response_lock, flags); 471 + make_tx_response(queue, txp, 0, XEN_NETIF_RSP_OKAY); 472 + push_tx_responses(queue); 473 + spin_unlock_irqrestore(&queue->response_lock, flags); 474 + ++txp; 475 + continue; 476 + } 477 + 467 478 index = pending_index(queue->pending_cons++); 468 479 pending_idx = queue->pending_ring[index]; 469 480 xenvif_tx_create_map_op(queue, pending_idx, txp, 470 481 txp == first ? extra_count : 0, gop); 471 482 frag_set_pending_idx(&frags[shinfo->nr_frags], pending_idx); 483 + ++shinfo->nr_frags; 484 + ++gop; 472 485 473 486 if (txp == first) 474 487 txp = txfrags; ··· 494 481 shinfo = skb_shinfo(nskb); 495 482 frags = shinfo->frags; 496 483 497 - for (shinfo->nr_frags = 0; shinfo->nr_frags < nr_slots; 498 - shinfo->nr_frags++, txp++, gop++) { 484 + for (shinfo->nr_frags = 0; shinfo->nr_frags < nr_slots; ++txp) { 485 + if (unlikely(!txp->size)) { 486 + unsigned long flags; 487 + 488 + spin_lock_irqsave(&queue->response_lock, flags); 489 + make_tx_response(queue, txp, 0, 490 + XEN_NETIF_RSP_OKAY); 491 + push_tx_responses(queue); 492 + spin_unlock_irqrestore(&queue->response_lock, 493 + flags); 494 + continue; 495 + } 496 + 499 497 index = pending_index(queue->pending_cons++); 500 498 pending_idx = queue->pending_ring[index]; 501 499 xenvif_tx_create_map_op(queue, pending_idx, txp, 0, 502 500 gop); 503 501 frag_set_pending_idx(&frags[shinfo->nr_frags], 504 502 pending_idx); 503 + ++shinfo->nr_frags; 504 + ++gop; 505 505 } 506 506 507 - skb_shinfo(skb)->frag_list = nskb; 508 - } else if (nskb) { 507 + if (shinfo->nr_frags) { 508 + skb_shinfo(skb)->frag_list = nskb; 509 + nskb = NULL; 510 + } 511 + } 512 + 513 + if (nskb) { 509 514 /* A frag_list skb was allocated but it is no longer needed 510 - * because enough slots were converted to copy ops above. 515 + * because enough slots were converted to copy ops above or some 516 + * were empty. 511 517 */ 512 518 kfree_skb(nskb); 513 519 }
+2 -2
drivers/platform/mellanox/mlxbf-pmc.c
··· 1170 1170 int ret; 1171 1171 1172 1172 addr = pmc->block[blk_num].mmio_base + 1173 - (rounddown(cnt_num, 2) * MLXBF_PMC_CRSPACE_PERFSEL_SZ); 1173 + ((cnt_num / 2) * MLXBF_PMC_CRSPACE_PERFSEL_SZ); 1174 1174 ret = mlxbf_pmc_readl(addr, &word); 1175 1175 if (ret) 1176 1176 return ret; ··· 1413 1413 int ret; 1414 1414 1415 1415 addr = pmc->block[blk_num].mmio_base + 1416 - (rounddown(cnt_num, 2) * MLXBF_PMC_CRSPACE_PERFSEL_SZ); 1416 + ((cnt_num / 2) * MLXBF_PMC_CRSPACE_PERFSEL_SZ); 1417 1417 ret = mlxbf_pmc_readl(addr, &word); 1418 1418 if (ret) 1419 1419 return ret;
+67
drivers/platform/mellanox/mlxbf-tmfifo.c
··· 47 47 /* Message with data needs at least two words (for header & data). */ 48 48 #define MLXBF_TMFIFO_DATA_MIN_WORDS 2 49 49 50 + /* Tx timeout in milliseconds. */ 51 + #define TMFIFO_TX_TIMEOUT 2000 52 + 50 53 /* ACPI UID for BlueField-3. */ 51 54 #define TMFIFO_BF3_UID 1 52 55 ··· 65 62 * @drop_desc: dummy desc for packet dropping 66 63 * @cur_len: processed length of the current descriptor 67 64 * @rem_len: remaining length of the pending packet 65 + * @rem_padding: remaining bytes to send as paddings 68 66 * @pkt_len: total length of the pending packet 69 67 * @next_avail: next avail descriptor id 70 68 * @num: vring size (number of descriptors) 71 69 * @align: vring alignment size 72 70 * @index: vring index 73 71 * @vdev_id: vring virtio id (VIRTIO_ID_xxx) 72 + * @tx_timeout: expire time of last tx packet 74 73 * @fifo: pointer to the tmfifo structure 75 74 */ 76 75 struct mlxbf_tmfifo_vring { ··· 84 79 struct vring_desc drop_desc; 85 80 int cur_len; 86 81 int rem_len; 82 + int rem_padding; 87 83 u32 pkt_len; 88 84 u16 next_avail; 89 85 int num; 90 86 int align; 91 87 int index; 92 88 int vdev_id; 89 + unsigned long tx_timeout; 93 90 struct mlxbf_tmfifo *fifo; 94 91 }; 95 92 ··· 826 819 return true; 827 820 } 828 821 822 + static void mlxbf_tmfifo_check_tx_timeout(struct mlxbf_tmfifo_vring *vring) 823 + { 824 + unsigned long flags; 825 + 826 + /* Only handle Tx timeout for network vdev. */ 827 + if (vring->vdev_id != VIRTIO_ID_NET) 828 + return; 829 + 830 + /* Initialize the timeout or return if not expired. */ 831 + if (!vring->tx_timeout) { 832 + /* Initialize the timeout. */ 833 + vring->tx_timeout = jiffies + 834 + msecs_to_jiffies(TMFIFO_TX_TIMEOUT); 835 + return; 836 + } else if (time_before(jiffies, vring->tx_timeout)) { 837 + /* Return if not timeout yet. */ 838 + return; 839 + } 840 + 841 + /* 842 + * Drop the packet after timeout. The outstanding packet is 843 + * released and the remaining bytes will be sent with padding byte 0x00 844 + * as a recovery. On the peer(host) side, the padding bytes 0x00 will be 845 + * either dropped directly, or appended into existing outstanding packet 846 + * thus dropped as corrupted network packet. 847 + */ 848 + vring->rem_padding = round_up(vring->rem_len, sizeof(u64)); 849 + mlxbf_tmfifo_release_pkt(vring); 850 + vring->cur_len = 0; 851 + vring->rem_len = 0; 852 + vring->fifo->vring[0] = NULL; 853 + 854 + /* 855 + * Make sure the load/store are in order before 856 + * returning back to virtio. 857 + */ 858 + virtio_mb(false); 859 + 860 + /* Notify upper layer. */ 861 + spin_lock_irqsave(&vring->fifo->spin_lock[0], flags); 862 + vring_interrupt(0, vring->vq); 863 + spin_unlock_irqrestore(&vring->fifo->spin_lock[0], flags); 864 + } 865 + 829 866 /* Rx & Tx processing of a queue. */ 830 867 static void mlxbf_tmfifo_rxtx(struct mlxbf_tmfifo_vring *vring, bool is_rx) 831 868 { ··· 892 841 return; 893 842 894 843 do { 844 + retry: 895 845 /* Get available FIFO space. */ 896 846 if (avail == 0) { 897 847 if (is_rx) ··· 901 849 avail = mlxbf_tmfifo_get_tx_avail(fifo, devid); 902 850 if (avail <= 0) 903 851 break; 852 + } 853 + 854 + /* Insert paddings for discarded Tx packet. */ 855 + if (!is_rx) { 856 + vring->tx_timeout = 0; 857 + while (vring->rem_padding >= sizeof(u64)) { 858 + writeq(0, vring->fifo->tx.data); 859 + vring->rem_padding -= sizeof(u64); 860 + if (--avail == 0) 861 + goto retry; 862 + } 904 863 } 905 864 906 865 /* Console output always comes from the Tx buffer. */ ··· 923 860 /* Handle one descriptor. */ 924 861 more = mlxbf_tmfifo_rxtx_one_desc(vring, is_rx, &avail); 925 862 } while (more); 863 + 864 + /* Check Tx timeout. */ 865 + if (avail <= 0 && !is_rx) 866 + mlxbf_tmfifo_check_tx_timeout(vring); 926 867 } 927 868 928 869 /* Handle Rx or Tx queues. */
+1
drivers/platform/x86/amd/pmf/Kconfig
··· 10 10 depends on AMD_NB 11 11 select ACPI_PLATFORM_PROFILE 12 12 depends on TEE && AMDTEE 13 + depends on AMD_SFH_HID 13 14 help 14 15 This driver provides support for the AMD Platform Management Framework. 15 16 The goal is to enhance end user experience by making AMD PCs smarter,
+36
drivers/platform/x86/amd/pmf/spc.c
··· 10 10 */ 11 11 12 12 #include <acpi/button.h> 13 + #include <linux/amd-pmf-io.h> 13 14 #include <linux/power_supply.h> 14 15 #include <linux/units.h> 15 16 #include "pmf.h" ··· 45 44 dev_dbg(dev->dev, "Max C0 Residency: %u\n", in->ev_info.max_c0residency); 46 45 dev_dbg(dev->dev, "GFX Busy: %u\n", in->ev_info.gfx_busy); 47 46 dev_dbg(dev->dev, "LID State: %s\n", in->ev_info.lid_state ? "close" : "open"); 47 + dev_dbg(dev->dev, "User Presence: %s\n", in->ev_info.user_present ? "Present" : "Away"); 48 + dev_dbg(dev->dev, "Ambient Light: %d\n", in->ev_info.ambient_light); 48 49 dev_dbg(dev->dev, "==== TA inputs END ====\n"); 49 50 } 50 51 #else ··· 150 147 return 0; 151 148 } 152 149 150 + static int amd_pmf_get_sensor_info(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in) 151 + { 152 + struct amd_sfh_info sfh_info; 153 + int ret; 154 + 155 + /* Get ALS data */ 156 + ret = amd_get_sfh_info(&sfh_info, MT_ALS); 157 + if (!ret) 158 + in->ev_info.ambient_light = sfh_info.ambient_light; 159 + else 160 + return ret; 161 + 162 + /* get HPD data */ 163 + ret = amd_get_sfh_info(&sfh_info, MT_HPD); 164 + if (ret) 165 + return ret; 166 + 167 + switch (sfh_info.user_present) { 168 + case SFH_NOT_DETECTED: 169 + in->ev_info.user_present = 0xff; /* assume no sensors connected */ 170 + break; 171 + case SFH_USER_PRESENT: 172 + in->ev_info.user_present = 1; 173 + break; 174 + case SFH_USER_AWAY: 175 + in->ev_info.user_present = 0; 176 + break; 177 + } 178 + 179 + return 0; 180 + } 181 + 153 182 void amd_pmf_populate_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in) 154 183 { 155 184 /* TA side lid open is 1 and close is 0, hence the ! here */ ··· 190 155 amd_pmf_get_smu_info(dev, in); 191 156 amd_pmf_get_battery_info(dev, in); 192 157 amd_pmf_get_slider_info(dev, in); 158 + amd_pmf_get_sensor_info(dev, in); 193 159 }
+3 -1
drivers/platform/x86/amd/pmf/tee-if.c
··· 298 298 if (!new_policy_buf) 299 299 return -ENOMEM; 300 300 301 - if (copy_from_user(new_policy_buf, buf, length)) 301 + if (copy_from_user(new_policy_buf, buf, length)) { 302 + kfree(new_policy_buf); 302 303 return -EFAULT; 304 + } 303 305 304 306 kfree(dev->policy_buf); 305 307 dev->policy_buf = new_policy_buf;
+2 -1
drivers/platform/x86/intel/ifs/load.c
··· 399 399 if (fw->size != expected_size) { 400 400 dev_err(dev, "File size mismatch (expected %u, actual %zu). Corrupted IFS image.\n", 401 401 expected_size, fw->size); 402 - return -EINVAL; 402 + ret = -EINVAL; 403 + goto release; 403 404 } 404 405 405 406 ret = image_sanity_check(dev, (struct microcode_header_intel *)fw->data);
+41 -41
drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c
··· 23 23 static int (*uncore_write)(struct uncore_data *data, unsigned int input, unsigned int min_max); 24 24 static int (*uncore_read_freq)(struct uncore_data *data, unsigned int *freq); 25 25 26 - static ssize_t show_domain_id(struct device *dev, struct device_attribute *attr, char *buf) 26 + static ssize_t show_domain_id(struct kobject *kobj, struct kobj_attribute *attr, char *buf) 27 27 { 28 - struct uncore_data *data = container_of(attr, struct uncore_data, domain_id_dev_attr); 28 + struct uncore_data *data = container_of(attr, struct uncore_data, domain_id_kobj_attr); 29 29 30 30 return sprintf(buf, "%u\n", data->domain_id); 31 31 } 32 32 33 - static ssize_t show_fabric_cluster_id(struct device *dev, struct device_attribute *attr, char *buf) 33 + static ssize_t show_fabric_cluster_id(struct kobject *kobj, struct kobj_attribute *attr, char *buf) 34 34 { 35 - struct uncore_data *data = container_of(attr, struct uncore_data, fabric_cluster_id_dev_attr); 35 + struct uncore_data *data = container_of(attr, struct uncore_data, fabric_cluster_id_kobj_attr); 36 36 37 37 return sprintf(buf, "%u\n", data->cluster_id); 38 38 } 39 39 40 - static ssize_t show_package_id(struct device *dev, struct device_attribute *attr, char *buf) 40 + static ssize_t show_package_id(struct kobject *kobj, struct kobj_attribute *attr, char *buf) 41 41 { 42 - struct uncore_data *data = container_of(attr, struct uncore_data, package_id_dev_attr); 42 + struct uncore_data *data = container_of(attr, struct uncore_data, package_id_kobj_attr); 43 43 44 44 return sprintf(buf, "%u\n", data->package_id); 45 45 } ··· 97 97 } 98 98 99 99 #define store_uncore_min_max(name, min_max) \ 100 - static ssize_t store_##name(struct device *dev, \ 101 - struct device_attribute *attr, \ 100 + static ssize_t store_##name(struct kobject *kobj, \ 101 + struct kobj_attribute *attr, \ 102 102 const char *buf, size_t count) \ 103 103 { \ 104 - struct uncore_data *data = container_of(attr, struct uncore_data, name##_dev_attr);\ 104 + struct uncore_data *data = container_of(attr, struct uncore_data, name##_kobj_attr);\ 105 105 \ 106 106 return store_min_max_freq_khz(data, buf, count, \ 107 107 min_max); \ 108 108 } 109 109 110 110 #define show_uncore_min_max(name, min_max) \ 111 - static ssize_t show_##name(struct device *dev, \ 112 - struct device_attribute *attr, char *buf)\ 111 + static ssize_t show_##name(struct kobject *kobj, \ 112 + struct kobj_attribute *attr, char *buf)\ 113 113 { \ 114 - struct uncore_data *data = container_of(attr, struct uncore_data, name##_dev_attr);\ 114 + struct uncore_data *data = container_of(attr, struct uncore_data, name##_kobj_attr);\ 115 115 \ 116 116 return show_min_max_freq_khz(data, buf, min_max); \ 117 117 } 118 118 119 119 #define show_uncore_perf_status(name) \ 120 - static ssize_t show_##name(struct device *dev, \ 121 - struct device_attribute *attr, char *buf)\ 120 + static ssize_t show_##name(struct kobject *kobj, \ 121 + struct kobj_attribute *attr, char *buf)\ 122 122 { \ 123 - struct uncore_data *data = container_of(attr, struct uncore_data, name##_dev_attr);\ 123 + struct uncore_data *data = container_of(attr, struct uncore_data, name##_kobj_attr);\ 124 124 \ 125 125 return show_perf_status_freq_khz(data, buf); \ 126 126 } ··· 134 134 show_uncore_perf_status(current_freq_khz); 135 135 136 136 #define show_uncore_data(member_name) \ 137 - static ssize_t show_##member_name(struct device *dev, \ 138 - struct device_attribute *attr, char *buf)\ 137 + static ssize_t show_##member_name(struct kobject *kobj, \ 138 + struct kobj_attribute *attr, char *buf)\ 139 139 { \ 140 140 struct uncore_data *data = container_of(attr, struct uncore_data,\ 141 - member_name##_dev_attr);\ 141 + member_name##_kobj_attr);\ 142 142 \ 143 143 return sysfs_emit(buf, "%u\n", \ 144 144 data->member_name); \ ··· 149 149 150 150 #define init_attribute_rw(_name) \ 151 151 do { \ 152 - sysfs_attr_init(&data->_name##_dev_attr.attr); \ 153 - data->_name##_dev_attr.show = show_##_name; \ 154 - data->_name##_dev_attr.store = store_##_name; \ 155 - data->_name##_dev_attr.attr.name = #_name; \ 156 - data->_name##_dev_attr.attr.mode = 0644; \ 152 + sysfs_attr_init(&data->_name##_kobj_attr.attr); \ 153 + data->_name##_kobj_attr.show = show_##_name; \ 154 + data->_name##_kobj_attr.store = store_##_name; \ 155 + data->_name##_kobj_attr.attr.name = #_name; \ 156 + data->_name##_kobj_attr.attr.mode = 0644; \ 157 157 } while (0) 158 158 159 159 #define init_attribute_ro(_name) \ 160 160 do { \ 161 - sysfs_attr_init(&data->_name##_dev_attr.attr); \ 162 - data->_name##_dev_attr.show = show_##_name; \ 163 - data->_name##_dev_attr.store = NULL; \ 164 - data->_name##_dev_attr.attr.name = #_name; \ 165 - data->_name##_dev_attr.attr.mode = 0444; \ 161 + sysfs_attr_init(&data->_name##_kobj_attr.attr); \ 162 + data->_name##_kobj_attr.show = show_##_name; \ 163 + data->_name##_kobj_attr.store = NULL; \ 164 + data->_name##_kobj_attr.attr.name = #_name; \ 165 + data->_name##_kobj_attr.attr.mode = 0444; \ 166 166 } while (0) 167 167 168 168 #define init_attribute_root_ro(_name) \ 169 169 do { \ 170 - sysfs_attr_init(&data->_name##_dev_attr.attr); \ 171 - data->_name##_dev_attr.show = show_##_name; \ 172 - data->_name##_dev_attr.store = NULL; \ 173 - data->_name##_dev_attr.attr.name = #_name; \ 174 - data->_name##_dev_attr.attr.mode = 0400; \ 170 + sysfs_attr_init(&data->_name##_kobj_attr.attr); \ 171 + data->_name##_kobj_attr.show = show_##_name; \ 172 + data->_name##_kobj_attr.store = NULL; \ 173 + data->_name##_kobj_attr.attr.name = #_name; \ 174 + data->_name##_kobj_attr.attr.mode = 0400; \ 175 175 } while (0) 176 176 177 177 static int create_attr_group(struct uncore_data *data, char *name) ··· 186 186 187 187 if (data->domain_id != UNCORE_DOMAIN_ID_INVALID) { 188 188 init_attribute_root_ro(domain_id); 189 - data->uncore_attrs[index++] = &data->domain_id_dev_attr.attr; 189 + data->uncore_attrs[index++] = &data->domain_id_kobj_attr.attr; 190 190 init_attribute_root_ro(fabric_cluster_id); 191 - data->uncore_attrs[index++] = &data->fabric_cluster_id_dev_attr.attr; 191 + data->uncore_attrs[index++] = &data->fabric_cluster_id_kobj_attr.attr; 192 192 init_attribute_root_ro(package_id); 193 - data->uncore_attrs[index++] = &data->package_id_dev_attr.attr; 193 + data->uncore_attrs[index++] = &data->package_id_kobj_attr.attr; 194 194 } 195 195 196 - data->uncore_attrs[index++] = &data->max_freq_khz_dev_attr.attr; 197 - data->uncore_attrs[index++] = &data->min_freq_khz_dev_attr.attr; 198 - data->uncore_attrs[index++] = &data->initial_min_freq_khz_dev_attr.attr; 199 - data->uncore_attrs[index++] = &data->initial_max_freq_khz_dev_attr.attr; 196 + data->uncore_attrs[index++] = &data->max_freq_khz_kobj_attr.attr; 197 + data->uncore_attrs[index++] = &data->min_freq_khz_kobj_attr.attr; 198 + data->uncore_attrs[index++] = &data->initial_min_freq_khz_kobj_attr.attr; 199 + data->uncore_attrs[index++] = &data->initial_max_freq_khz_kobj_attr.attr; 200 200 201 201 ret = uncore_read_freq(data, &freq); 202 202 if (!ret) 203 - data->uncore_attrs[index++] = &data->current_freq_khz_dev_attr.attr; 203 + data->uncore_attrs[index++] = &data->current_freq_khz_kobj_attr.attr; 204 204 205 205 data->uncore_attrs[index] = NULL; 206 206
+16 -16
drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.h
··· 26 26 * @instance_id: Unique instance id to append to directory name 27 27 * @name: Sysfs entry name for this instance 28 28 * @uncore_attr_group: Attribute group storage 29 - * @max_freq_khz_dev_attr: Storage for device attribute max_freq_khz 30 - * @mix_freq_khz_dev_attr: Storage for device attribute min_freq_khz 31 - * @initial_max_freq_khz_dev_attr: Storage for device attribute initial_max_freq_khz 32 - * @initial_min_freq_khz_dev_attr: Storage for device attribute initial_min_freq_khz 33 - * @current_freq_khz_dev_attr: Storage for device attribute current_freq_khz 34 - * @domain_id_dev_attr: Storage for device attribute domain_id 35 - * @fabric_cluster_id_dev_attr: Storage for device attribute fabric_cluster_id 36 - * @package_id_dev_attr: Storage for device attribute package_id 29 + * @max_freq_khz_kobj_attr: Storage for kobject attribute max_freq_khz 30 + * @mix_freq_khz_kobj_attr: Storage for kobject attribute min_freq_khz 31 + * @initial_max_freq_khz_kobj_attr: Storage for kobject attribute initial_max_freq_khz 32 + * @initial_min_freq_khz_kobj_attr: Storage for kobject attribute initial_min_freq_khz 33 + * @current_freq_khz_kobj_attr: Storage for kobject attribute current_freq_khz 34 + * @domain_id_kobj_attr: Storage for kobject attribute domain_id 35 + * @fabric_cluster_id_kobj_attr: Storage for kobject attribute fabric_cluster_id 36 + * @package_id_kobj_attr: Storage for kobject attribute package_id 37 37 * @uncore_attrs: Attribute storage for group creation 38 38 * 39 39 * This structure is used to encapsulate all data related to uncore sysfs ··· 53 53 char name[32]; 54 54 55 55 struct attribute_group uncore_attr_group; 56 - struct device_attribute max_freq_khz_dev_attr; 57 - struct device_attribute min_freq_khz_dev_attr; 58 - struct device_attribute initial_max_freq_khz_dev_attr; 59 - struct device_attribute initial_min_freq_khz_dev_attr; 60 - struct device_attribute current_freq_khz_dev_attr; 61 - struct device_attribute domain_id_dev_attr; 62 - struct device_attribute fabric_cluster_id_dev_attr; 63 - struct device_attribute package_id_dev_attr; 56 + struct kobj_attribute max_freq_khz_kobj_attr; 57 + struct kobj_attribute min_freq_khz_kobj_attr; 58 + struct kobj_attribute initial_max_freq_khz_kobj_attr; 59 + struct kobj_attribute initial_min_freq_khz_kobj_attr; 60 + struct kobj_attribute current_freq_khz_kobj_attr; 61 + struct kobj_attribute domain_id_kobj_attr; 62 + struct kobj_attribute fabric_cluster_id_kobj_attr; 63 + struct kobj_attribute package_id_kobj_attr; 64 64 struct attribute *uncore_attrs[9]; 65 65 }; 66 66
+2 -2
drivers/platform/x86/intel/wmi/sbl-fw-update.c
··· 32 32 return -ENODEV; 33 33 34 34 if (obj->type != ACPI_TYPE_INTEGER) { 35 - dev_warn(dev, "wmi_query_block returned invalid value\n"); 35 + dev_warn(dev, "wmidev_block_query returned invalid value\n"); 36 36 kfree(obj); 37 37 return -EINVAL; 38 38 } ··· 55 55 56 56 status = wmidev_block_set(to_wmi_device(dev), 0, &input); 57 57 if (ACPI_FAILURE(status)) { 58 - dev_err(dev, "wmi_set_block failed\n"); 58 + dev_err(dev, "wmidev_block_set failed\n"); 59 59 return -ENODEV; 60 60 } 61 61
+152 -54
drivers/platform/x86/p2sb.c
··· 26 26 {} 27 27 }; 28 28 29 + /* 30 + * Cache BAR0 of P2SB device functions 0 to 7. 31 + * TODO: The constant 8 is the number of functions that PCI specification 32 + * defines. Same definitions exist tree-wide. Unify this definition and 33 + * the other definitions then move to include/uapi/linux/pci.h. 34 + */ 35 + #define NR_P2SB_RES_CACHE 8 36 + 37 + struct p2sb_res_cache { 38 + u32 bus_dev_id; 39 + struct resource res; 40 + }; 41 + 42 + static struct p2sb_res_cache p2sb_resources[NR_P2SB_RES_CACHE]; 43 + 29 44 static int p2sb_get_devfn(unsigned int *devfn) 30 45 { 31 46 unsigned int fn = P2SB_DEVFN_DEFAULT; ··· 54 39 return 0; 55 40 } 56 41 57 - /* Copy resource from the first BAR of the device in question */ 58 - static int p2sb_read_bar0(struct pci_dev *pdev, struct resource *mem) 42 + static bool p2sb_valid_resource(struct resource *res) 59 43 { 60 - struct resource *bar0 = &pdev->resource[0]; 44 + if (res->flags) 45 + return true; 46 + 47 + return false; 48 + } 49 + 50 + /* Copy resource from the first BAR of the device in question */ 51 + static void p2sb_read_bar0(struct pci_dev *pdev, struct resource *mem) 52 + { 53 + struct resource *bar0 = pci_resource_n(pdev, 0); 61 54 62 55 /* Make sure we have no dangling pointers in the output */ 63 56 memset(mem, 0, sizeof(*mem)); ··· 79 56 mem->end = bar0->end; 80 57 mem->flags = bar0->flags; 81 58 mem->desc = bar0->desc; 59 + } 60 + 61 + static void p2sb_scan_and_cache_devfn(struct pci_bus *bus, unsigned int devfn) 62 + { 63 + struct p2sb_res_cache *cache = &p2sb_resources[PCI_FUNC(devfn)]; 64 + struct pci_dev *pdev; 65 + 66 + pdev = pci_scan_single_device(bus, devfn); 67 + if (!pdev) 68 + return; 69 + 70 + p2sb_read_bar0(pdev, &cache->res); 71 + cache->bus_dev_id = bus->dev.id; 72 + 73 + pci_stop_and_remove_bus_device(pdev); 74 + } 75 + 76 + static int p2sb_scan_and_cache(struct pci_bus *bus, unsigned int devfn) 77 + { 78 + unsigned int slot, fn; 79 + 80 + if (PCI_FUNC(devfn) == 0) { 81 + /* 82 + * When function number of the P2SB device is zero, scan it and 83 + * other function numbers, and if devices are available, cache 84 + * their BAR0s. 85 + */ 86 + slot = PCI_SLOT(devfn); 87 + for (fn = 0; fn < NR_P2SB_RES_CACHE; fn++) 88 + p2sb_scan_and_cache_devfn(bus, PCI_DEVFN(slot, fn)); 89 + } else { 90 + /* Scan the P2SB device and cache its BAR0 */ 91 + p2sb_scan_and_cache_devfn(bus, devfn); 92 + } 93 + 94 + if (!p2sb_valid_resource(&p2sb_resources[PCI_FUNC(devfn)].res)) 95 + return -ENOENT; 82 96 83 97 return 0; 84 98 } 85 99 86 - static int p2sb_scan_and_read(struct pci_bus *bus, unsigned int devfn, struct resource *mem) 100 + static struct pci_bus *p2sb_get_bus(struct pci_bus *bus) 87 101 { 88 - struct pci_dev *pdev; 102 + static struct pci_bus *p2sb_bus; 103 + 104 + bus = bus ?: p2sb_bus; 105 + if (bus) 106 + return bus; 107 + 108 + /* Assume P2SB is on the bus 0 in domain 0 */ 109 + p2sb_bus = pci_find_bus(0, 0); 110 + return p2sb_bus; 111 + } 112 + 113 + static int p2sb_cache_resources(void) 114 + { 115 + unsigned int devfn_p2sb; 116 + u32 value = P2SBC_HIDE; 117 + struct pci_bus *bus; 118 + u16 class; 89 119 int ret; 90 120 91 - pdev = pci_scan_single_device(bus, devfn); 92 - if (!pdev) 121 + /* Get devfn for P2SB device itself */ 122 + ret = p2sb_get_devfn(&devfn_p2sb); 123 + if (ret) 124 + return ret; 125 + 126 + bus = p2sb_get_bus(NULL); 127 + if (!bus) 93 128 return -ENODEV; 94 129 95 - ret = p2sb_read_bar0(pdev, mem); 130 + /* 131 + * When a device with same devfn exists and its device class is not 132 + * PCI_CLASS_MEMORY_OTHER for P2SB, do not touch it. 133 + */ 134 + pci_bus_read_config_word(bus, devfn_p2sb, PCI_CLASS_DEVICE, &class); 135 + if (!PCI_POSSIBLE_ERROR(class) && class != PCI_CLASS_MEMORY_OTHER) 136 + return -ENODEV; 96 137 97 - pci_stop_and_remove_bus_device(pdev); 138 + /* 139 + * Prevent concurrent PCI bus scan from seeing the P2SB device and 140 + * removing via sysfs while it is temporarily exposed. 141 + */ 142 + pci_lock_rescan_remove(); 143 + 144 + /* 145 + * The BIOS prevents the P2SB device from being enumerated by the PCI 146 + * subsystem, so we need to unhide and hide it back to lookup the BAR. 147 + * Unhide the P2SB device here, if needed. 148 + */ 149 + pci_bus_read_config_dword(bus, devfn_p2sb, P2SBC, &value); 150 + if (value & P2SBC_HIDE) 151 + pci_bus_write_config_dword(bus, devfn_p2sb, P2SBC, 0); 152 + 153 + ret = p2sb_scan_and_cache(bus, devfn_p2sb); 154 + 155 + /* Hide the P2SB device, if it was hidden */ 156 + if (value & P2SBC_HIDE) 157 + pci_bus_write_config_dword(bus, devfn_p2sb, P2SBC, P2SBC_HIDE); 158 + 159 + pci_unlock_rescan_remove(); 160 + 98 161 return ret; 99 162 } 100 163 ··· 190 81 * @devfn: PCI slot and function to communicate with 191 82 * @mem: memory resource to be filled in 192 83 * 193 - * The BIOS prevents the P2SB device from being enumerated by the PCI 194 - * subsystem, so we need to unhide and hide it back to lookup the BAR. 195 - * 196 - * if @bus is NULL, the bus 0 in domain 0 will be used. 84 + * If @bus is NULL, the bus 0 in domain 0 will be used. 197 85 * If @devfn is 0, it will be replaced by devfn of the P2SB device. 198 86 * 199 87 * Caller must provide a valid pointer to @mem. 200 - * 201 - * Locking is handled by pci_rescan_remove_lock mutex. 202 88 * 203 89 * Return: 204 90 * 0 on success or appropriate errno value on error. 205 91 */ 206 92 int p2sb_bar(struct pci_bus *bus, unsigned int devfn, struct resource *mem) 207 93 { 208 - struct pci_dev *pdev_p2sb; 209 - unsigned int devfn_p2sb; 210 - u32 value = P2SBC_HIDE; 94 + struct p2sb_res_cache *cache; 211 95 int ret; 212 96 213 - /* Get devfn for P2SB device itself */ 214 - ret = p2sb_get_devfn(&devfn_p2sb); 215 - if (ret) 216 - return ret; 217 - 218 - /* if @bus is NULL, use bus 0 in domain 0 */ 219 - bus = bus ?: pci_find_bus(0, 0); 220 - 221 - /* 222 - * Prevent concurrent PCI bus scan from seeing the P2SB device and 223 - * removing via sysfs while it is temporarily exposed. 224 - */ 225 - pci_lock_rescan_remove(); 226 - 227 - /* Unhide the P2SB device, if needed */ 228 - pci_bus_read_config_dword(bus, devfn_p2sb, P2SBC, &value); 229 - if (value & P2SBC_HIDE) 230 - pci_bus_write_config_dword(bus, devfn_p2sb, P2SBC, 0); 231 - 232 - pdev_p2sb = pci_scan_single_device(bus, devfn_p2sb); 233 - if (devfn) 234 - ret = p2sb_scan_and_read(bus, devfn, mem); 235 - else 236 - ret = p2sb_read_bar0(pdev_p2sb, mem); 237 - pci_stop_and_remove_bus_device(pdev_p2sb); 238 - 239 - /* Hide the P2SB device, if it was hidden */ 240 - if (value & P2SBC_HIDE) 241 - pci_bus_write_config_dword(bus, devfn_p2sb, P2SBC, P2SBC_HIDE); 242 - 243 - pci_unlock_rescan_remove(); 244 - 245 - if (ret) 246 - return ret; 247 - 248 - if (mem->flags == 0) 97 + bus = p2sb_get_bus(bus); 98 + if (!bus) 249 99 return -ENODEV; 250 100 101 + if (!devfn) { 102 + ret = p2sb_get_devfn(&devfn); 103 + if (ret) 104 + return ret; 105 + } 106 + 107 + cache = &p2sb_resources[PCI_FUNC(devfn)]; 108 + if (cache->bus_dev_id != bus->dev.id) 109 + return -ENODEV; 110 + 111 + if (!p2sb_valid_resource(&cache->res)) 112 + return -ENOENT; 113 + 114 + memcpy(mem, &cache->res, sizeof(*mem)); 251 115 return 0; 252 116 } 253 117 EXPORT_SYMBOL_GPL(p2sb_bar); 118 + 119 + static int __init p2sb_fs_init(void) 120 + { 121 + p2sb_cache_resources(); 122 + return 0; 123 + } 124 + 125 + /* 126 + * pci_rescan_remove_lock to avoid access to unhidden P2SB devices can 127 + * not be locked in sysfs pci bus rescan path because of deadlock. To 128 + * avoid the deadlock, access to P2SB devices with the lock at an early 129 + * step in kernel initialization and cache required resources. This 130 + * should happen after subsys_initcall which initializes PCI subsystem 131 + * and before device_initcall which requires P2SB resources. 132 + */ 133 + fs_initcall(p2sb_fs_init);
+35
drivers/platform/x86/touchscreen_dmi.c
··· 944 944 .properties = teclast_tbook11_props, 945 945 }; 946 946 947 + static const struct property_entry teclast_x16_plus_props[] = { 948 + PROPERTY_ENTRY_U32("touchscreen-min-x", 8), 949 + PROPERTY_ENTRY_U32("touchscreen-min-y", 14), 950 + PROPERTY_ENTRY_U32("touchscreen-size-x", 1916), 951 + PROPERTY_ENTRY_U32("touchscreen-size-y", 1264), 952 + PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"), 953 + PROPERTY_ENTRY_STRING("firmware-name", "gsl3692-teclast-x16-plus.fw"), 954 + PROPERTY_ENTRY_U32("silead,max-fingers", 10), 955 + PROPERTY_ENTRY_BOOL("silead,home-button"), 956 + { } 957 + }; 958 + 959 + static const struct ts_dmi_data teclast_x16_plus_data = { 960 + .embedded_fw = { 961 + .name = "silead/gsl3692-teclast-x16-plus.fw", 962 + .prefix = { 0xf0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 }, 963 + .length = 43560, 964 + .sha256 = { 0x9d, 0xb0, 0x3d, 0xf1, 0x00, 0x3c, 0xb5, 0x25, 965 + 0x62, 0x8a, 0xa0, 0x93, 0x4b, 0xe0, 0x4e, 0x75, 966 + 0xd1, 0x27, 0xb1, 0x65, 0x3c, 0xba, 0xa5, 0x0f, 967 + 0xcd, 0xb4, 0xbe, 0x00, 0xbb, 0xf6, 0x43, 0x29 }, 968 + }, 969 + .acpi_name = "MSSL1680:00", 970 + .properties = teclast_x16_plus_props, 971 + }; 972 + 947 973 static const struct property_entry teclast_x3_plus_props[] = { 948 974 PROPERTY_ENTRY_U32("touchscreen-size-x", 1980), 949 975 PROPERTY_ENTRY_U32("touchscreen-size-y", 1500), ··· 1636 1610 DMI_MATCH(DMI_SYS_VENDOR, "TECLAST"), 1637 1611 DMI_MATCH(DMI_PRODUCT_NAME, "TbooK 11"), 1638 1612 DMI_MATCH(DMI_PRODUCT_SKU, "E5A6_A1"), 1613 + }, 1614 + }, 1615 + { 1616 + /* Teclast X16 Plus */ 1617 + .driver_data = (void *)&teclast_x16_plus_data, 1618 + .matches = { 1619 + DMI_MATCH(DMI_SYS_VENDOR, "TECLAST"), 1620 + DMI_MATCH(DMI_PRODUCT_NAME, "Default string"), 1621 + DMI_MATCH(DMI_PRODUCT_SKU, "D3A5_A1"), 1639 1622 }, 1640 1623 }, 1641 1624 {
+112 -69
drivers/platform/x86/wmi.c
··· 25 25 #include <linux/list.h> 26 26 #include <linux/module.h> 27 27 #include <linux/platform_device.h> 28 + #include <linux/rwsem.h> 28 29 #include <linux/slab.h> 29 30 #include <linux/sysfs.h> 30 31 #include <linux/types.h> ··· 57 56 58 57 enum { /* wmi_block flags */ 59 58 WMI_READ_TAKES_NO_ARGS, 60 - WMI_PROBED, 61 59 }; 62 60 63 61 struct wmi_block { ··· 64 64 struct list_head list; 65 65 struct guid_block gblock; 66 66 struct acpi_device *acpi_device; 67 + struct rw_semaphore notify_lock; /* Protects notify callback add/remove */ 67 68 wmi_notify_handler handler; 68 69 void *handler_data; 70 + bool driver_ready; 69 71 unsigned long flags; 70 72 }; 71 73 ··· 221 219 return 0; 222 220 } 223 221 222 + static int wmidev_match_notify_id(struct device *dev, const void *data) 223 + { 224 + struct wmi_block *wblock = dev_to_wblock(dev); 225 + const u32 *notify_id = data; 226 + 227 + if (wblock->gblock.flags & ACPI_WMI_EVENT && wblock->gblock.notify_id == *notify_id) 228 + return 1; 229 + 230 + return 0; 231 + } 232 + 224 233 static struct bus_type wmi_bus_type; 225 234 226 235 static struct wmi_device *wmi_find_device_by_guid(const char *guid_string) ··· 249 236 return ERR_PTR(-ENODEV); 250 237 251 238 return dev_to_wdev(dev); 239 + } 240 + 241 + static struct wmi_device *wmi_find_event_by_notify_id(const u32 notify_id) 242 + { 243 + struct device *dev; 244 + 245 + dev = bus_find_device(&wmi_bus_type, NULL, &notify_id, wmidev_match_notify_id); 246 + if (!dev) 247 + return ERR_PTR(-ENODEV); 248 + 249 + return to_wmi_device(dev); 252 250 } 253 251 254 252 static void wmi_device_put(struct wmi_device *wdev) ··· 596 572 wmi_notify_handler handler, 597 573 void *data) 598 574 { 599 - struct wmi_block *block; 600 - acpi_status status = AE_NOT_EXIST; 601 - guid_t guid_input; 575 + struct wmi_block *wblock; 576 + struct wmi_device *wdev; 577 + acpi_status status; 602 578 603 - if (!guid || !handler) 604 - return AE_BAD_PARAMETER; 579 + wdev = wmi_find_device_by_guid(guid); 580 + if (IS_ERR(wdev)) 581 + return AE_ERROR; 605 582 606 - if (guid_parse(guid, &guid_input)) 607 - return AE_BAD_PARAMETER; 583 + wblock = container_of(wdev, struct wmi_block, dev); 608 584 609 - list_for_each_entry(block, &wmi_block_list, list) { 610 - acpi_status wmi_status; 585 + down_write(&wblock->notify_lock); 586 + if (wblock->handler) { 587 + status = AE_ALREADY_ACQUIRED; 588 + } else { 589 + wblock->handler = handler; 590 + wblock->handler_data = data; 611 591 612 - if (guid_equal(&block->gblock.guid, &guid_input)) { 613 - if (block->handler) 614 - return AE_ALREADY_ACQUIRED; 592 + if (ACPI_FAILURE(wmi_method_enable(wblock, true))) 593 + dev_warn(&wblock->dev.dev, "Failed to enable device\n"); 615 594 616 - block->handler = handler; 617 - block->handler_data = data; 618 - 619 - wmi_status = wmi_method_enable(block, true); 620 - if ((wmi_status != AE_OK) || 621 - ((wmi_status == AE_OK) && (status == AE_NOT_EXIST))) 622 - status = wmi_status; 623 - } 595 + status = AE_OK; 624 596 } 597 + up_write(&wblock->notify_lock); 598 + 599 + wmi_device_put(wdev); 625 600 626 601 return status; 627 602 } ··· 636 613 */ 637 614 acpi_status wmi_remove_notify_handler(const char *guid) 638 615 { 639 - struct wmi_block *block; 640 - acpi_status status = AE_NOT_EXIST; 641 - guid_t guid_input; 616 + struct wmi_block *wblock; 617 + struct wmi_device *wdev; 618 + acpi_status status; 642 619 643 - if (!guid) 644 - return AE_BAD_PARAMETER; 620 + wdev = wmi_find_device_by_guid(guid); 621 + if (IS_ERR(wdev)) 622 + return AE_ERROR; 645 623 646 - if (guid_parse(guid, &guid_input)) 647 - return AE_BAD_PARAMETER; 624 + wblock = container_of(wdev, struct wmi_block, dev); 648 625 649 - list_for_each_entry(block, &wmi_block_list, list) { 650 - acpi_status wmi_status; 626 + down_write(&wblock->notify_lock); 627 + if (!wblock->handler) { 628 + status = AE_NULL_ENTRY; 629 + } else { 630 + if (ACPI_FAILURE(wmi_method_enable(wblock, false))) 631 + dev_warn(&wblock->dev.dev, "Failed to disable device\n"); 651 632 652 - if (guid_equal(&block->gblock.guid, &guid_input)) { 653 - if (!block->handler) 654 - return AE_NULL_ENTRY; 633 + wblock->handler = NULL; 634 + wblock->handler_data = NULL; 655 635 656 - wmi_status = wmi_method_enable(block, false); 657 - block->handler = NULL; 658 - block->handler_data = NULL; 659 - if (wmi_status != AE_OK || (wmi_status == AE_OK && status == AE_NOT_EXIST)) 660 - status = wmi_status; 661 - } 636 + status = AE_OK; 662 637 } 638 + up_write(&wblock->notify_lock); 639 + 640 + wmi_device_put(wdev); 663 641 664 642 return status; 665 643 } ··· 679 655 acpi_status wmi_get_event_data(u32 event, struct acpi_buffer *out) 680 656 { 681 657 struct wmi_block *wblock; 658 + struct wmi_device *wdev; 659 + acpi_status status; 682 660 683 - list_for_each_entry(wblock, &wmi_block_list, list) { 684 - struct guid_block *gblock = &wblock->gblock; 661 + wdev = wmi_find_event_by_notify_id(event); 662 + if (IS_ERR(wdev)) 663 + return AE_NOT_FOUND; 685 664 686 - if ((gblock->flags & ACPI_WMI_EVENT) && gblock->notify_id == event) 687 - return get_event_data(wblock, out); 688 - } 665 + wblock = container_of(wdev, struct wmi_block, dev); 666 + status = get_event_data(wblock, out); 689 667 690 - return AE_NOT_FOUND; 668 + wmi_device_put(wdev); 669 + 670 + return status; 691 671 } 692 672 EXPORT_SYMBOL_GPL(wmi_get_event_data); 693 673 ··· 896 868 if (wdriver->probe) { 897 869 ret = wdriver->probe(dev_to_wdev(dev), 898 870 find_guid_context(wblock, wdriver)); 899 - if (!ret) { 871 + if (ret) { 900 872 if (ACPI_FAILURE(wmi_method_enable(wblock, false))) 901 873 dev_warn(dev, "Failed to disable device\n"); 902 874 ··· 904 876 } 905 877 } 906 878 907 - set_bit(WMI_PROBED, &wblock->flags); 879 + down_write(&wblock->notify_lock); 880 + wblock->driver_ready = true; 881 + up_write(&wblock->notify_lock); 908 882 909 883 return 0; 910 884 } ··· 916 886 struct wmi_block *wblock = dev_to_wblock(dev); 917 887 struct wmi_driver *wdriver = drv_to_wdrv(dev->driver); 918 888 919 - clear_bit(WMI_PROBED, &wblock->flags); 889 + down_write(&wblock->notify_lock); 890 + wblock->driver_ready = false; 891 + up_write(&wblock->notify_lock); 920 892 921 893 if (wdriver->remove) 922 894 wdriver->remove(dev_to_wdev(dev)); ··· 1031 999 wblock->dev.setable = true; 1032 1000 1033 1001 out_init: 1002 + init_rwsem(&wblock->notify_lock); 1003 + wblock->driver_ready = false; 1034 1004 wblock->dev.dev.bus = &wmi_bus_type; 1035 1005 wblock->dev.dev.parent = wmi_bus_dev; 1036 1006 ··· 1205 1171 } 1206 1172 } 1207 1173 1174 + static void wmi_notify_driver(struct wmi_block *wblock) 1175 + { 1176 + struct wmi_driver *driver = drv_to_wdrv(wblock->dev.dev.driver); 1177 + struct acpi_buffer data = { ACPI_ALLOCATE_BUFFER, NULL }; 1178 + acpi_status status; 1179 + 1180 + if (!driver->no_notify_data) { 1181 + status = get_event_data(wblock, &data); 1182 + if (ACPI_FAILURE(status)) { 1183 + dev_warn(&wblock->dev.dev, "Failed to get event data\n"); 1184 + return; 1185 + } 1186 + } 1187 + 1188 + if (driver->notify) 1189 + driver->notify(&wblock->dev, data.pointer); 1190 + 1191 + kfree(data.pointer); 1192 + } 1193 + 1208 1194 static int wmi_notify_device(struct device *dev, void *data) 1209 1195 { 1210 1196 struct wmi_block *wblock = dev_to_wblock(dev); ··· 1233 1179 if (!(wblock->gblock.flags & ACPI_WMI_EVENT && wblock->gblock.notify_id == *event)) 1234 1180 return 0; 1235 1181 1236 - /* If a driver is bound, then notify the driver. */ 1237 - if (test_bit(WMI_PROBED, &wblock->flags) && wblock->dev.dev.driver) { 1238 - struct wmi_driver *driver = drv_to_wdrv(wblock->dev.dev.driver); 1239 - struct acpi_buffer evdata = { ACPI_ALLOCATE_BUFFER, NULL }; 1240 - acpi_status status; 1241 - 1242 - if (!driver->no_notify_data) { 1243 - status = get_event_data(wblock, &evdata); 1244 - if (ACPI_FAILURE(status)) { 1245 - dev_warn(&wblock->dev.dev, "failed to get event data\n"); 1246 - return -EIO; 1247 - } 1248 - } 1249 - 1250 - if (driver->notify) 1251 - driver->notify(&wblock->dev, evdata.pointer); 1252 - 1253 - kfree(evdata.pointer); 1254 - } else if (wblock->handler) { 1255 - /* Legacy handler */ 1256 - wblock->handler(*event, wblock->handler_data); 1182 + down_read(&wblock->notify_lock); 1183 + /* The WMI driver notify handler conflicts with the legacy WMI handler. 1184 + * Because of this the WMI driver notify handler takes precedence. 1185 + */ 1186 + if (wblock->dev.dev.driver && wblock->driver_ready) { 1187 + wmi_notify_driver(wblock); 1188 + } else { 1189 + if (wblock->handler) 1190 + wblock->handler(*event, wblock->handler_data); 1257 1191 } 1192 + up_read(&wblock->notify_lock); 1258 1193 1259 1194 acpi_bus_generate_netlink_event(wblock->acpi_device->pnp.device_class, 1260 1195 dev_name(&wblock->dev.dev), *event, 0);
+2 -2
drivers/spi/spi-bcm-qspi.c
··· 19 19 #include <linux/platform_device.h> 20 20 #include <linux/slab.h> 21 21 #include <linux/spi/spi.h> 22 - #include <linux/spi/spi-mem.h> 22 + #include <linux/mtd/spi-nor.h> 23 23 #include <linux/sysfs.h> 24 24 #include <linux/types.h> 25 25 #include "spi-bcm-qspi.h" ··· 1221 1221 1222 1222 /* non-aligned and very short transfers are handled by MSPI */ 1223 1223 if (!IS_ALIGNED((uintptr_t)addr, 4) || !IS_ALIGNED((uintptr_t)buf, 4) || 1224 - len < 4) 1224 + len < 4 || op->cmd.opcode == SPINOR_OP_RDSFDP) 1225 1225 mspi_read = true; 1226 1226 1227 1227 if (!has_bspi(qspi) || mspi_read)
+9 -8
drivers/spi/spi-cadence.c
··· 317 317 xspi->rx_bytes -= nrx; 318 318 319 319 while (ntx || nrx) { 320 + if (nrx) { 321 + u8 data = cdns_spi_read(xspi, CDNS_SPI_RXD); 322 + 323 + if (xspi->rxbuf) 324 + *xspi->rxbuf++ = data; 325 + 326 + nrx--; 327 + } 328 + 320 329 if (ntx) { 321 330 if (xspi->txbuf) 322 331 cdns_spi_write(xspi, CDNS_SPI_TXD, *xspi->txbuf++); ··· 335 326 ntx--; 336 327 } 337 328 338 - if (nrx) { 339 - u8 data = cdns_spi_read(xspi, CDNS_SPI_RXD); 340 - 341 - if (xspi->rxbuf) 342 - *xspi->rxbuf++ = data; 343 - 344 - nrx--; 345 - } 346 329 } 347 330 } 348 331
+4 -1
drivers/spi/spi-cs42l43.c
··· 244 244 priv->ctlr->use_gpio_descriptors = true; 245 245 priv->ctlr->auto_runtime_pm = true; 246 246 247 - devm_pm_runtime_enable(priv->dev); 247 + ret = devm_pm_runtime_enable(priv->dev); 248 + if (ret) 249 + return ret; 250 + 248 251 pm_runtime_idle(priv->dev); 249 252 250 253 regmap_write(priv->regmap, CS42L43_TRAN_CONFIG6, CS42L43_FIFO_SIZE - 1);
+5
drivers/spi/spi-hisi-sfc-v3xx.c
··· 377 377 static irqreturn_t hisi_sfc_v3xx_isr(int irq, void *data) 378 378 { 379 379 struct hisi_sfc_v3xx_host *host = data; 380 + u32 reg; 381 + 382 + reg = readl(host->regbase + HISI_SFC_V3XX_INT_STAT); 383 + if (!reg) 384 + return IRQ_NONE; 380 385 381 386 hisi_sfc_v3xx_disable_int(host); 382 387
+2 -2
drivers/spi/spi-imx.c
··· 1344 1344 controller->dma_tx = dma_request_chan(dev, "tx"); 1345 1345 if (IS_ERR(controller->dma_tx)) { 1346 1346 ret = PTR_ERR(controller->dma_tx); 1347 - dev_dbg(dev, "can't get the TX DMA channel, error %d!\n", ret); 1347 + dev_err_probe(dev, ret, "can't get the TX DMA channel!\n"); 1348 1348 controller->dma_tx = NULL; 1349 1349 goto err; 1350 1350 } ··· 1353 1353 controller->dma_rx = dma_request_chan(dev, "rx"); 1354 1354 if (IS_ERR(controller->dma_rx)) { 1355 1355 ret = PTR_ERR(controller->dma_rx); 1356 - dev_dbg(dev, "can't get the RX DMA channel, error %d\n", ret); 1356 + dev_err_probe(dev, ret, "can't get the RX DMA channel!\n"); 1357 1357 controller->dma_rx = NULL; 1358 1358 goto err; 1359 1359 }
+1 -1
drivers/spi/spi-intel-pci.c
··· 76 76 { PCI_VDEVICE(INTEL, 0x7a24), (unsigned long)&cnl_info }, 77 77 { PCI_VDEVICE(INTEL, 0x7aa4), (unsigned long)&cnl_info }, 78 78 { PCI_VDEVICE(INTEL, 0x7e23), (unsigned long)&cnl_info }, 79 + { PCI_VDEVICE(INTEL, 0x7f24), (unsigned long)&cnl_info }, 79 80 { PCI_VDEVICE(INTEL, 0x9d24), (unsigned long)&cnl_info }, 80 81 { PCI_VDEVICE(INTEL, 0x9da4), (unsigned long)&cnl_info }, 81 82 { PCI_VDEVICE(INTEL, 0xa0a4), (unsigned long)&cnl_info }, ··· 85 84 { PCI_VDEVICE(INTEL, 0xa2a4), (unsigned long)&cnl_info }, 86 85 { PCI_VDEVICE(INTEL, 0xa324), (unsigned long)&cnl_info }, 87 86 { PCI_VDEVICE(INTEL, 0xa3a4), (unsigned long)&cnl_info }, 88 - { PCI_VDEVICE(INTEL, 0xae23), (unsigned long)&cnl_info }, 89 87 { }, 90 88 }; 91 89 MODULE_DEVICE_TABLE(pci, intel_spi_pci_ids);
+4
drivers/spi/spi.c
··· 1717 1717 pm_runtime_put_noidle(ctlr->dev.parent); 1718 1718 dev_err(&ctlr->dev, "Failed to power device: %d\n", 1719 1719 ret); 1720 + 1721 + msg->status = ret; 1722 + spi_finalize_current_message(ctlr); 1723 + 1720 1724 return ret; 1721 1725 } 1722 1726 }
-32
drivers/thermal/intel/intel_powerclamp.c
··· 49 49 */ 50 50 #define DEFAULT_DURATION_JIFFIES (6) 51 51 52 - static unsigned int target_mwait; 53 52 static struct dentry *debug_dir; 54 53 static bool poll_pkg_cstate_enable; 55 54 ··· 310 311 "\tpowerclamp controls idle ratio within this window. larger\n" 311 312 "\twindow size results in slower response time but more smooth\n" 312 313 "\tclamping results. default to 2."); 313 - 314 - static void find_target_mwait(void) 315 - { 316 - unsigned int eax, ebx, ecx, edx; 317 - unsigned int highest_cstate = 0; 318 - unsigned int highest_subcstate = 0; 319 - int i; 320 - 321 - if (boot_cpu_data.cpuid_level < CPUID_MWAIT_LEAF) 322 - return; 323 - 324 - cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx); 325 - 326 - if (!(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) || 327 - !(ecx & CPUID5_ECX_INTERRUPT_BREAK)) 328 - return; 329 - 330 - edx >>= MWAIT_SUBSTATE_SIZE; 331 - for (i = 0; i < 7 && edx; i++, edx >>= MWAIT_SUBSTATE_SIZE) { 332 - if (edx & MWAIT_SUBSTATE_MASK) { 333 - highest_cstate = i; 334 - highest_subcstate = edx & MWAIT_SUBSTATE_MASK; 335 - } 336 - } 337 - target_mwait = (highest_cstate << MWAIT_SUBSTATE_SIZE) | 338 - (highest_subcstate - 1); 339 - 340 - } 341 314 342 315 struct pkg_cstate_info { 343 316 bool skip; ··· 729 758 pr_info("No package C-state available\n"); 730 759 return -ENODEV; 731 760 } 732 - 733 - /* find the deepest mwait value */ 734 - find_target_mwait(); 735 761 736 762 return 0; 737 763 }
+1 -2
drivers/video/fbdev/core/fbcon.c
··· 631 631 632 632 if (logo_lines > vc->vc_bottom) { 633 633 logo_shown = FBCON_LOGO_CANSHOW; 634 - printk(KERN_INFO 635 - "fbcon_init: disable boot-logo (boot-logo bigger than screen).\n"); 634 + pr_info("fbcon: disable boot-logo (boot-logo bigger than screen).\n"); 636 635 } else { 637 636 logo_shown = FBCON_LOGO_DRAW; 638 637 vc->vc_top = logo_lines;
+3
drivers/video/fbdev/savage/savagefb_driver.c
··· 869 869 870 870 DBG("savagefb_check_var"); 871 871 872 + if (!var->pixclock) 873 + return -EINVAL; 874 + 872 875 var->transp.offset = 0; 873 876 var->transp.length = 0; 874 877 switch (var->bits_per_pixel) {
+2
drivers/video/fbdev/sis/sis_main.c
··· 1444 1444 1445 1445 vtotal = var->upper_margin + var->lower_margin + var->vsync_len; 1446 1446 1447 + if (!var->pixclock) 1448 + return -EINVAL; 1447 1449 pixclock = var->pixclock; 1448 1450 1449 1451 if((var->vmode & FB_VMODE_MASK) == FB_VMODE_NONINTERLACED) {
+1 -1
drivers/video/fbdev/stifb.c
··· 1158 1158 } 1159 1159 break; 1160 1160 } 1161 - stifb_blank(0, (struct fb_info *)fb); /* 0=enable screen */ 1161 + stifb_blank(0, fb->info); /* 0=enable screen */ 1162 1162 1163 1163 SETUP_FB(fb); 1164 1164 }
-1
drivers/video/fbdev/vt8500lcdfb.c
··· 374 374 375 375 irq = platform_get_irq(pdev, 0); 376 376 if (irq < 0) { 377 - dev_err(&pdev->dev, "no IRQ defined\n"); 378 377 ret = -ENODEV; 379 378 goto failed_free_palette; 380 379 }
+22 -8
fs/afs/dir.c
··· 124 124 if (xas_retry(&xas, folio)) 125 125 continue; 126 126 BUG_ON(xa_is_value(folio)); 127 - ASSERTCMP(folio_file_mapping(folio), ==, mapping); 127 + ASSERTCMP(folio->mapping, ==, mapping); 128 128 129 129 folio_put(folio); 130 130 } ··· 202 202 if (xas_retry(&xas, folio)) 203 203 continue; 204 204 205 - BUG_ON(folio_file_mapping(folio) != mapping); 205 + BUG_ON(folio->mapping != mapping); 206 206 207 207 size = min_t(loff_t, folio_size(folio), req->actual_len - folio_pos(folio)); 208 208 for (offset = 0; offset < size; offset += sizeof(*block)) { 209 209 block = kmap_local_folio(folio, offset); 210 - pr_warn("[%02lx] %32phN\n", folio_index(folio) + offset, block); 210 + pr_warn("[%02lx] %32phN\n", folio->index + offset, block); 211 211 kunmap_local(block); 212 212 } 213 213 } ··· 233 233 if (xas_retry(&xas, folio)) 234 234 continue; 235 235 236 - BUG_ON(folio_file_mapping(folio) != mapping); 236 + BUG_ON(folio->mapping != mapping); 237 237 238 238 if (!afs_dir_check_folio(dvnode, folio, req->actual_len)) { 239 239 afs_dir_dump(dvnode, req); ··· 474 474 continue; 475 475 } 476 476 477 + /* Don't expose silly rename entries to userspace. */ 478 + if (nlen > 6 && 479 + dire->u.name[0] == '.' && 480 + ctx->actor != afs_lookup_filldir && 481 + ctx->actor != afs_lookup_one_filldir && 482 + memcmp(dire->u.name, ".__afs", 6) == 0) 483 + continue; 484 + 477 485 /* found the next entry */ 478 486 if (!dir_emit(ctx, dire->u.name, nlen, 479 487 ntohl(dire->u.vnode), ··· 716 708 break; 717 709 } 718 710 711 + if (vp->scb.status.abort_code) 712 + trace_afs_bulkstat_error(op, &vp->fid, i, vp->scb.status.abort_code); 719 713 if (!vp->scb.have_status && !vp->scb.have_error) 720 714 continue; 721 715 ··· 907 897 afs_begin_vnode_operation(op); 908 898 afs_wait_for_operation(op); 909 899 } 910 - inode = ERR_PTR(afs_op_error(op)); 911 900 912 901 out_op: 913 902 if (!afs_op_error(op)) { 914 - inode = &op->file[1].vnode->netfs.inode; 915 - op->file[1].vnode = NULL; 903 + if (op->file[1].scb.status.abort_code) { 904 + afs_op_accumulate_error(op, -ECONNABORTED, 905 + op->file[1].scb.status.abort_code); 906 + } else { 907 + inode = &op->file[1].vnode->netfs.inode; 908 + op->file[1].vnode = NULL; 909 + } 916 910 } 917 911 918 912 if (op->file[0].scb.have_status) ··· 2036 2022 { 2037 2023 struct afs_vnode *dvnode = AFS_FS_I(folio_inode(folio)); 2038 2024 2039 - _enter("{{%llx:%llu}[%lu]}", dvnode->fid.vid, dvnode->fid.vnode, folio_index(folio)); 2025 + _enter("{{%llx:%llu}[%lu]}", dvnode->fid.vid, dvnode->fid.vnode, folio->index); 2040 2026 2041 2027 folio_detach_private(folio); 2042 2028
-9
fs/afs/dynroot.c
··· 258 258 .lookup = afs_dynroot_lookup, 259 259 }; 260 260 261 - /* 262 - * Dirs in the dynamic root don't need revalidation. 263 - */ 264 - static int afs_dynroot_d_revalidate(struct dentry *dentry, unsigned int flags) 265 - { 266 - return 1; 267 - } 268 - 269 261 const struct dentry_operations afs_dynroot_dentry_operations = { 270 - .d_revalidate = afs_dynroot_d_revalidate, 271 262 .d_delete = always_delete_dentry, 272 263 .d_release = afs_d_release, 273 264 .d_automount = afs_d_automount,
+3 -2
fs/afs/proc.c
··· 166 166 167 167 if (!preflist) { 168 168 seq_puts(m, "NO PREFS\n"); 169 - return 0; 169 + goto out; 170 170 } 171 171 172 172 seq_printf(m, "PROT SUBNET PRIOR (v=%u n=%u/%u/%u)\n", ··· 191 191 } 192 192 } 193 193 194 - rcu_read_lock(); 194 + out: 195 + rcu_read_unlock(); 195 196 return 0; 196 197 } 197 198
+1 -1
fs/bcachefs/alloc_background.c
··· 1715 1715 * This works without any other locks because this is the only 1716 1716 * thread that removes items from the need_discard tree 1717 1717 */ 1718 - bch2_trans_unlock(trans); 1718 + bch2_trans_unlock_long(trans); 1719 1719 blkdev_issue_discard(ca->disk_sb.bdev, 1720 1720 k.k->p.offset * ca->mi.bucket_size, 1721 1721 ca->mi.bucket_size,
+2 -2
fs/bcachefs/btree_locking.c
··· 92 92 continue; 93 93 94 94 bch2_btree_trans_to_text(out, i->trans); 95 - bch2_prt_task_backtrace(out, task, i == g->g ? 5 : 1); 95 + bch2_prt_task_backtrace(out, task, i == g->g ? 5 : 1, GFP_NOWAIT); 96 96 } 97 97 } 98 98 ··· 227 227 prt_printf(&buf, "backtrace:"); 228 228 prt_newline(&buf); 229 229 printbuf_indent_add(&buf, 2); 230 - bch2_prt_task_backtrace(&buf, trans->locking_wait.task, 2); 230 + bch2_prt_task_backtrace(&buf, trans->locking_wait.task, 2, GFP_NOWAIT); 231 231 printbuf_indent_sub(&buf, 2); 232 232 prt_newline(&buf); 233 233 }
+1 -1
fs/bcachefs/debug.c
··· 627 627 prt_printf(&i->buf, "backtrace:"); 628 628 prt_newline(&i->buf); 629 629 printbuf_indent_add(&i->buf, 2); 630 - bch2_prt_task_backtrace(&i->buf, task, 0); 630 + bch2_prt_task_backtrace(&i->buf, task, 0, GFP_KERNEL); 631 631 printbuf_indent_sub(&i->buf, 2); 632 632 prt_newline(&i->buf); 633 633
+1 -1
fs/bcachefs/fs-io.c
··· 79 79 continue; 80 80 81 81 bio = container_of(bio_alloc_bioset(ca->disk_sb.bdev, 0, 82 - REQ_OP_FLUSH, 82 + REQ_OP_WRITE|REQ_PREFLUSH, 83 83 GFP_KERNEL, 84 84 &c->nocow_flush_bioset), 85 85 struct nocow_flush, bio);
+12 -11
fs/bcachefs/fsck.c
··· 119 119 if (!ret) 120 120 *snapshot = iter.pos.snapshot; 121 121 err: 122 - bch_err_msg(trans->c, ret, "fetching inode %llu:%u", inode_nr, *snapshot); 123 122 bch2_trans_iter_exit(trans, &iter); 124 123 return ret; 125 124 } 126 125 127 - static int __lookup_dirent(struct btree_trans *trans, 126 + static int lookup_dirent_in_snapshot(struct btree_trans *trans, 128 127 struct bch_hash_info hash_info, 129 128 subvol_inum dir, struct qstr *name, 130 - u64 *target, unsigned *type) 129 + u64 *target, unsigned *type, u32 snapshot) 131 130 { 132 131 struct btree_iter iter; 133 132 struct bkey_s_c_dirent d; 134 - int ret; 135 - 136 - ret = bch2_hash_lookup(trans, &iter, bch2_dirent_hash_desc, 137 - &hash_info, dir, name, 0); 133 + int ret = bch2_hash_lookup_in_snapshot(trans, &iter, bch2_dirent_hash_desc, 134 + &hash_info, dir, name, 0, snapshot); 138 135 if (ret) 139 136 return ret; 140 137 ··· 222 225 223 226 struct bch_inode_unpacked root_inode; 224 227 struct bch_hash_info root_hash_info; 225 - ret = lookup_inode(trans, root_inum.inum, &root_inode, &snapshot); 228 + u32 root_inode_snapshot = snapshot; 229 + ret = lookup_inode(trans, root_inum.inum, &root_inode, &root_inode_snapshot); 226 230 bch_err_msg(c, ret, "looking up root inode"); 227 231 if (ret) 228 232 return ret; 229 233 230 234 root_hash_info = bch2_hash_info_init(c, &root_inode); 231 235 232 - ret = __lookup_dirent(trans, root_hash_info, root_inum, 233 - &lostfound_str, &inum, &d_type); 236 + ret = lookup_dirent_in_snapshot(trans, root_hash_info, root_inum, 237 + &lostfound_str, &inum, &d_type, snapshot); 234 238 if (bch2_err_matches(ret, ENOENT)) 235 239 goto create_lostfound; 236 240 ··· 248 250 * The bch2_check_dirents pass has already run, dangling dirents 249 251 * shouldn't exist here: 250 252 */ 251 - return lookup_inode(trans, inum, lostfound, &snapshot); 253 + ret = lookup_inode(trans, inum, lostfound, &snapshot); 254 + bch_err_msg(c, ret, "looking up lost+found %llu:%u in (root inode %llu, snapshot root %u)", 255 + inum, snapshot, root_inum.inum, bch2_snapshot_root(c, snapshot)); 256 + return ret; 252 257 253 258 create_lostfound: 254 259 /*
+1 -1
fs/bcachefs/journal.c
··· 233 233 prt_str(&pbuf, "entry size: "); 234 234 prt_human_readable_u64(&pbuf, vstruct_bytes(buf->data)); 235 235 prt_newline(&pbuf); 236 - bch2_prt_task_backtrace(&pbuf, current, 1); 236 + bch2_prt_task_backtrace(&pbuf, current, 1, GFP_NOWAIT); 237 237 trace_journal_entry_close(c, pbuf.buf); 238 238 printbuf_exit(&pbuf); 239 239 }
+2 -1
fs/bcachefs/journal_io.c
··· 1988 1988 percpu_ref_get(&ca->io_ref); 1989 1989 1990 1990 bio = ca->journal.bio; 1991 - bio_reset(bio, ca->disk_sb.bdev, REQ_OP_FLUSH); 1991 + bio_reset(bio, ca->disk_sb.bdev, 1992 + REQ_OP_WRITE|REQ_PREFLUSH); 1992 1993 bio->bi_end_io = journal_write_endio; 1993 1994 bio->bi_private = ca; 1994 1995 closure_bio_submit(bio, cl);
+15 -7
fs/bcachefs/str_hash.h
··· 160 160 } 161 161 162 162 static __always_inline int 163 - bch2_hash_lookup(struct btree_trans *trans, 163 + bch2_hash_lookup_in_snapshot(struct btree_trans *trans, 164 164 struct btree_iter *iter, 165 165 const struct bch_hash_desc desc, 166 166 const struct bch_hash_info *info, 167 167 subvol_inum inum, const void *key, 168 - unsigned flags) 168 + unsigned flags, u32 snapshot) 169 169 { 170 170 struct bkey_s_c k; 171 - u32 snapshot; 172 171 int ret; 173 - 174 - ret = bch2_subvolume_get_snapshot(trans, inum.subvol, &snapshot); 175 - if (ret) 176 - return ret; 177 172 178 173 for_each_btree_key_upto_norestart(trans, *iter, desc.btree_id, 179 174 SPOS(inum.inum, desc.hash_key(info, key), snapshot), ··· 187 192 bch2_trans_iter_exit(trans, iter); 188 193 189 194 return ret ?: -BCH_ERR_ENOENT_str_hash_lookup; 195 + } 196 + 197 + static __always_inline int 198 + bch2_hash_lookup(struct btree_trans *trans, 199 + struct btree_iter *iter, 200 + const struct bch_hash_desc desc, 201 + const struct bch_hash_info *info, 202 + subvol_inum inum, const void *key, 203 + unsigned flags) 204 + { 205 + u32 snapshot; 206 + return bch2_subvolume_get_snapshot(trans, inum.subvol, &snapshot) ?: 207 + bch2_hash_lookup_in_snapshot(trans, iter, desc, info, inum, key, flags, snapshot); 190 208 } 191 209 192 210 static __always_inline int
+5 -5
fs/bcachefs/util.c
··· 272 272 console_unlock(); 273 273 } 274 274 275 - int bch2_save_backtrace(bch_stacktrace *stack, struct task_struct *task, unsigned skipnr) 275 + int bch2_save_backtrace(bch_stacktrace *stack, struct task_struct *task, unsigned skipnr, 276 + gfp_t gfp) 276 277 { 277 278 #ifdef CONFIG_STACKTRACE 278 279 unsigned nr_entries = 0; 279 - int ret = 0; 280 280 281 281 stack->nr = 0; 282 - ret = darray_make_room(stack, 32); 282 + int ret = darray_make_room_gfp(stack, 32, gfp); 283 283 if (ret) 284 284 return ret; 285 285 ··· 308 308 } 309 309 } 310 310 311 - int bch2_prt_task_backtrace(struct printbuf *out, struct task_struct *task, unsigned skipnr) 311 + int bch2_prt_task_backtrace(struct printbuf *out, struct task_struct *task, unsigned skipnr, gfp_t gfp) 312 312 { 313 313 bch_stacktrace stack = { 0 }; 314 - int ret = bch2_save_backtrace(&stack, task, skipnr + 1); 314 + int ret = bch2_save_backtrace(&stack, task, skipnr + 1, gfp); 315 315 316 316 bch2_prt_backtrace(out, &stack); 317 317 darray_exit(&stack);
+2 -2
fs/bcachefs/util.h
··· 348 348 void bch2_print_string_as_lines(const char *prefix, const char *lines); 349 349 350 350 typedef DARRAY(unsigned long) bch_stacktrace; 351 - int bch2_save_backtrace(bch_stacktrace *stack, struct task_struct *, unsigned); 351 + int bch2_save_backtrace(bch_stacktrace *stack, struct task_struct *, unsigned, gfp_t); 352 352 void bch2_prt_backtrace(struct printbuf *, bch_stacktrace *); 353 - int bch2_prt_task_backtrace(struct printbuf *, struct task_struct *, unsigned); 353 + int bch2_prt_task_backtrace(struct printbuf *, struct task_struct *, unsigned, gfp_t); 354 354 355 355 static inline void prt_bdevname(struct printbuf *out, struct block_device *bdev) 356 356 {
+16 -7
fs/btrfs/compression.c
··· 141 141 } 142 142 143 143 static int compression_decompress(int type, struct list_head *ws, 144 - const u8 *data_in, struct page *dest_page, 145 - unsigned long start_byte, size_t srclen, size_t destlen) 144 + const u8 *data_in, struct page *dest_page, 145 + unsigned long dest_pgoff, size_t srclen, size_t destlen) 146 146 { 147 147 switch (type) { 148 148 case BTRFS_COMPRESS_ZLIB: return zlib_decompress(ws, data_in, dest_page, 149 - start_byte, srclen, destlen); 149 + dest_pgoff, srclen, destlen); 150 150 case BTRFS_COMPRESS_LZO: return lzo_decompress(ws, data_in, dest_page, 151 - start_byte, srclen, destlen); 151 + dest_pgoff, srclen, destlen); 152 152 case BTRFS_COMPRESS_ZSTD: return zstd_decompress(ws, data_in, dest_page, 153 - start_byte, srclen, destlen); 153 + dest_pgoff, srclen, destlen); 154 154 case BTRFS_COMPRESS_NONE: 155 155 default: 156 156 /* ··· 1037 1037 * start_byte tells us the offset into the compressed data we're interested in 1038 1038 */ 1039 1039 int btrfs_decompress(int type, const u8 *data_in, struct page *dest_page, 1040 - unsigned long start_byte, size_t srclen, size_t destlen) 1040 + unsigned long dest_pgoff, size_t srclen, size_t destlen) 1041 1041 { 1042 + struct btrfs_fs_info *fs_info = btrfs_sb(dest_page->mapping->host->i_sb); 1042 1043 struct list_head *workspace; 1044 + const u32 sectorsize = fs_info->sectorsize; 1043 1045 int ret; 1046 + 1047 + /* 1048 + * The full destination page range should not exceed the page size. 1049 + * And the @destlen should not exceed sectorsize, as this is only called for 1050 + * inline file extents, which should not exceed sectorsize. 1051 + */ 1052 + ASSERT(dest_pgoff + destlen <= PAGE_SIZE && destlen <= sectorsize); 1044 1053 1045 1054 workspace = get_workspace(type, 0); 1046 1055 ret = compression_decompress(type, workspace, data_in, dest_page, 1047 - start_byte, srclen, destlen); 1056 + dest_pgoff, srclen, destlen); 1048 1057 put_workspace(type, workspace); 1049 1058 1050 1059 return ret;
+2 -2
fs/btrfs/compression.h
··· 148 148 unsigned long *total_in, unsigned long *total_out); 149 149 int zlib_decompress_bio(struct list_head *ws, struct compressed_bio *cb); 150 150 int zlib_decompress(struct list_head *ws, const u8 *data_in, 151 - struct page *dest_page, unsigned long start_byte, size_t srclen, 151 + struct page *dest_page, unsigned long dest_pgoff, size_t srclen, 152 152 size_t destlen); 153 153 struct list_head *zlib_alloc_workspace(unsigned int level); 154 154 void zlib_free_workspace(struct list_head *ws); ··· 159 159 unsigned long *total_in, unsigned long *total_out); 160 160 int lzo_decompress_bio(struct list_head *ws, struct compressed_bio *cb); 161 161 int lzo_decompress(struct list_head *ws, const u8 *data_in, 162 - struct page *dest_page, unsigned long start_byte, size_t srclen, 162 + struct page *dest_page, unsigned long dest_pgoff, size_t srclen, 163 163 size_t destlen); 164 164 struct list_head *lzo_alloc_workspace(unsigned int level); 165 165 void lzo_free_workspace(struct list_head *ws);
+39 -14
fs/btrfs/extent-tree.c
··· 1260 1260 u64 bytes_left, end; 1261 1261 u64 aligned_start = ALIGN(start, 1 << SECTOR_SHIFT); 1262 1262 1263 - if (WARN_ON(start != aligned_start)) { 1263 + /* Adjust the range to be aligned to 512B sectors if necessary. */ 1264 + if (start != aligned_start) { 1264 1265 len -= aligned_start - start; 1265 1266 len = round_down(len, 1 << SECTOR_SHIFT); 1266 1267 start = aligned_start; ··· 4299 4298 return 0; 4300 4299 } 4301 4300 4301 + static int prepare_allocation_zoned(struct btrfs_fs_info *fs_info, 4302 + struct find_free_extent_ctl *ffe_ctl) 4303 + { 4304 + if (ffe_ctl->for_treelog) { 4305 + spin_lock(&fs_info->treelog_bg_lock); 4306 + if (fs_info->treelog_bg) 4307 + ffe_ctl->hint_byte = fs_info->treelog_bg; 4308 + spin_unlock(&fs_info->treelog_bg_lock); 4309 + } else if (ffe_ctl->for_data_reloc) { 4310 + spin_lock(&fs_info->relocation_bg_lock); 4311 + if (fs_info->data_reloc_bg) 4312 + ffe_ctl->hint_byte = fs_info->data_reloc_bg; 4313 + spin_unlock(&fs_info->relocation_bg_lock); 4314 + } else if (ffe_ctl->flags & BTRFS_BLOCK_GROUP_DATA) { 4315 + struct btrfs_block_group *block_group; 4316 + 4317 + spin_lock(&fs_info->zone_active_bgs_lock); 4318 + list_for_each_entry(block_group, &fs_info->zone_active_bgs, active_bg_list) { 4319 + /* 4320 + * No lock is OK here because avail is monotinically 4321 + * decreasing, and this is just a hint. 4322 + */ 4323 + u64 avail = block_group->zone_capacity - block_group->alloc_offset; 4324 + 4325 + if (block_group_bits(block_group, ffe_ctl->flags) && 4326 + avail >= ffe_ctl->num_bytes) { 4327 + ffe_ctl->hint_byte = block_group->start; 4328 + break; 4329 + } 4330 + } 4331 + spin_unlock(&fs_info->zone_active_bgs_lock); 4332 + } 4333 + 4334 + return 0; 4335 + } 4336 + 4302 4337 static int prepare_allocation(struct btrfs_fs_info *fs_info, 4303 4338 struct find_free_extent_ctl *ffe_ctl, 4304 4339 struct btrfs_space_info *space_info, ··· 4345 4308 return prepare_allocation_clustered(fs_info, ffe_ctl, 4346 4309 space_info, ins); 4347 4310 case BTRFS_EXTENT_ALLOC_ZONED: 4348 - if (ffe_ctl->for_treelog) { 4349 - spin_lock(&fs_info->treelog_bg_lock); 4350 - if (fs_info->treelog_bg) 4351 - ffe_ctl->hint_byte = fs_info->treelog_bg; 4352 - spin_unlock(&fs_info->treelog_bg_lock); 4353 - } 4354 - if (ffe_ctl->for_data_reloc) { 4355 - spin_lock(&fs_info->relocation_bg_lock); 4356 - if (fs_info->data_reloc_bg) 4357 - ffe_ctl->hint_byte = fs_info->data_reloc_bg; 4358 - spin_unlock(&fs_info->relocation_bg_lock); 4359 - } 4360 - return 0; 4311 + return prepare_allocation_zoned(fs_info, ffe_ctl); 4361 4312 default: 4362 4313 BUG(); 4363 4314 }
+13 -9
fs/btrfs/inode.c
··· 4458 4458 u64 root_flags; 4459 4459 int ret; 4460 4460 4461 + down_write(&fs_info->subvol_sem); 4462 + 4461 4463 /* 4462 4464 * Don't allow to delete a subvolume with send in progress. This is 4463 4465 * inside the inode lock so the error handling that has to drop the bit ··· 4471 4469 btrfs_warn(fs_info, 4472 4470 "attempt to delete subvolume %llu during send", 4473 4471 dest->root_key.objectid); 4474 - return -EPERM; 4472 + ret = -EPERM; 4473 + goto out_up_write; 4475 4474 } 4476 4475 if (atomic_read(&dest->nr_swapfiles)) { 4477 4476 spin_unlock(&dest->root_item_lock); 4478 4477 btrfs_warn(fs_info, 4479 4478 "attempt to delete subvolume %llu with active swapfile", 4480 4479 root->root_key.objectid); 4481 - return -EPERM; 4480 + ret = -EPERM; 4481 + goto out_up_write; 4482 4482 } 4483 4483 root_flags = btrfs_root_flags(&dest->root_item); 4484 4484 btrfs_set_root_flags(&dest->root_item, 4485 4485 root_flags | BTRFS_ROOT_SUBVOL_DEAD); 4486 4486 spin_unlock(&dest->root_item_lock); 4487 4487 4488 - down_write(&fs_info->subvol_sem); 4489 - 4490 4488 ret = may_destroy_subvol(dest); 4491 4489 if (ret) 4492 - goto out_up_write; 4490 + goto out_undead; 4493 4491 4494 4492 btrfs_init_block_rsv(&block_rsv, BTRFS_BLOCK_RSV_TEMP); 4495 4493 /* ··· 4499 4497 */ 4500 4498 ret = btrfs_subvolume_reserve_metadata(root, &block_rsv, 5, true); 4501 4499 if (ret) 4502 - goto out_up_write; 4500 + goto out_undead; 4503 4501 4504 4502 trans = btrfs_start_transaction(root, 0); 4505 4503 if (IS_ERR(trans)) { ··· 4565 4563 inode->i_flags |= S_DEAD; 4566 4564 out_release: 4567 4565 btrfs_subvolume_release_metadata(root, &block_rsv); 4568 - out_up_write: 4569 - up_write(&fs_info->subvol_sem); 4566 + out_undead: 4570 4567 if (ret) { 4571 4568 spin_lock(&dest->root_item_lock); 4572 4569 root_flags = btrfs_root_flags(&dest->root_item); 4573 4570 btrfs_set_root_flags(&dest->root_item, 4574 4571 root_flags & ~BTRFS_ROOT_SUBVOL_DEAD); 4575 4572 spin_unlock(&dest->root_item_lock); 4576 - } else { 4573 + } 4574 + out_up_write: 4575 + up_write(&fs_info->subvol_sem); 4576 + if (!ret) { 4577 4577 d_invalidate(dentry); 4578 4578 btrfs_prune_dentries(dest); 4579 4579 ASSERT(dest->send_in_progress == 0);
+7
fs/btrfs/ioctl.c
··· 790 790 return -EOPNOTSUPP; 791 791 } 792 792 793 + if (btrfs_root_refs(&root->root_item) == 0) 794 + return -ENOENT; 795 + 793 796 if (!test_bit(BTRFS_ROOT_SHAREABLE, &root->state)) 794 797 return -EINVAL; 795 798 ··· 2609 2606 if (argp) { 2610 2607 if (copy_from_user(&range, argp, sizeof(range))) { 2611 2608 ret = -EFAULT; 2609 + goto out; 2610 + } 2611 + if (range.flags & ~BTRFS_DEFRAG_RANGE_FLAGS_SUPP) { 2612 + ret = -EOPNOTSUPP; 2612 2613 goto out; 2613 2614 } 2614 2615 /* compression requires us to start the IO */
+9 -25
fs/btrfs/lzo.c
··· 425 425 } 426 426 427 427 int lzo_decompress(struct list_head *ws, const u8 *data_in, 428 - struct page *dest_page, unsigned long start_byte, size_t srclen, 428 + struct page *dest_page, unsigned long dest_pgoff, size_t srclen, 429 429 size_t destlen) 430 430 { 431 431 struct workspace *workspace = list_entry(ws, struct workspace, list); 432 + struct btrfs_fs_info *fs_info = btrfs_sb(dest_page->mapping->host->i_sb); 433 + const u32 sectorsize = fs_info->sectorsize; 432 434 size_t in_len; 433 435 size_t out_len; 434 436 size_t max_segment_len = WORKSPACE_BUF_LENGTH; 435 437 int ret = 0; 436 - char *kaddr; 437 - unsigned long bytes; 438 438 439 439 if (srclen < LZO_LEN || srclen > max_segment_len + LZO_LEN * 2) 440 440 return -EUCLEAN; ··· 451 451 } 452 452 data_in += LZO_LEN; 453 453 454 - out_len = PAGE_SIZE; 454 + out_len = sectorsize; 455 455 ret = lzo1x_decompress_safe(data_in, in_len, workspace->buf, &out_len); 456 456 if (ret != LZO_E_OK) { 457 457 pr_warn("BTRFS: decompress failed!\n"); ··· 459 459 goto out; 460 460 } 461 461 462 - if (out_len < start_byte) { 462 + ASSERT(out_len <= sectorsize); 463 + memcpy_to_page(dest_page, dest_pgoff, workspace->buf, out_len); 464 + /* Early end, considered as an error. */ 465 + if (unlikely(out_len < destlen)) { 463 466 ret = -EIO; 464 - goto out; 467 + memzero_page(dest_page, dest_pgoff + out_len, destlen - out_len); 465 468 } 466 - 467 - /* 468 - * the caller is already checking against PAGE_SIZE, but lets 469 - * move this check closer to the memcpy/memset 470 - */ 471 - destlen = min_t(unsigned long, destlen, PAGE_SIZE); 472 - bytes = min_t(unsigned long, destlen, out_len - start_byte); 473 - 474 - kaddr = kmap_local_page(dest_page); 475 - memcpy(kaddr, workspace->buf + start_byte, bytes); 476 - 477 - /* 478 - * btrfs_getblock is doing a zero on the tail of the page too, 479 - * but this will cover anything missing from the decompressed 480 - * data. 481 - */ 482 - if (bytes < destlen) 483 - memset(kaddr+bytes, 0, destlen-bytes); 484 - kunmap_local(kaddr); 485 469 out: 486 470 return ret; 487 471 }
+4 -2
fs/btrfs/ref-verify.c
··· 889 889 out_unlock: 890 890 spin_unlock(&fs_info->ref_verify_lock); 891 891 out: 892 - if (ret) 892 + if (ret) { 893 + btrfs_free_ref_cache(fs_info); 893 894 btrfs_clear_opt(fs_info->mount_opt, REF_VERIFY); 895 + } 894 896 return ret; 895 897 } 896 898 ··· 1023 1021 } 1024 1022 } 1025 1023 if (ret) { 1026 - btrfs_clear_opt(fs_info->mount_opt, REF_VERIFY); 1027 1024 btrfs_free_ref_cache(fs_info); 1025 + btrfs_clear_opt(fs_info->mount_opt, REF_VERIFY); 1028 1026 } 1029 1027 btrfs_free_path(path); 1030 1028 return ret;
+29 -7
fs/btrfs/scrub.c
··· 1098 1098 static void scrub_read_endio(struct btrfs_bio *bbio) 1099 1099 { 1100 1100 struct scrub_stripe *stripe = bbio->private; 1101 + struct bio_vec *bvec; 1102 + int sector_nr = calc_sector_number(stripe, bio_first_bvec_all(&bbio->bio)); 1103 + int num_sectors; 1104 + u32 bio_size = 0; 1105 + int i; 1106 + 1107 + ASSERT(sector_nr < stripe->nr_sectors); 1108 + bio_for_each_bvec_all(bvec, &bbio->bio, i) 1109 + bio_size += bvec->bv_len; 1110 + num_sectors = bio_size >> stripe->bg->fs_info->sectorsize_bits; 1101 1111 1102 1112 if (bbio->bio.bi_status) { 1103 - bitmap_set(&stripe->io_error_bitmap, 0, stripe->nr_sectors); 1104 - bitmap_set(&stripe->error_bitmap, 0, stripe->nr_sectors); 1113 + bitmap_set(&stripe->io_error_bitmap, sector_nr, num_sectors); 1114 + bitmap_set(&stripe->error_bitmap, sector_nr, num_sectors); 1105 1115 } else { 1106 - bitmap_clear(&stripe->io_error_bitmap, 0, stripe->nr_sectors); 1116 + bitmap_clear(&stripe->io_error_bitmap, sector_nr, num_sectors); 1107 1117 } 1108 1118 bio_put(&bbio->bio); 1109 1119 if (atomic_dec_and_test(&stripe->pending_io)) { ··· 1646 1636 { 1647 1637 struct btrfs_fs_info *fs_info = stripe->bg->fs_info; 1648 1638 struct btrfs_bio *bbio = NULL; 1639 + unsigned int nr_sectors = min(BTRFS_STRIPE_LEN, stripe->bg->start + 1640 + stripe->bg->length - stripe->logical) >> 1641 + fs_info->sectorsize_bits; 1649 1642 u64 stripe_len = BTRFS_STRIPE_LEN; 1650 1643 int mirror = stripe->mirror_num; 1651 1644 int i; ··· 1658 1645 for_each_set_bit(i, &stripe->extent_sector_bitmap, stripe->nr_sectors) { 1659 1646 struct page *page = scrub_stripe_get_page(stripe, i); 1660 1647 unsigned int pgoff = scrub_stripe_get_page_offset(stripe, i); 1648 + 1649 + /* We're beyond the chunk boundary, no need to read anymore. */ 1650 + if (i >= nr_sectors) 1651 + break; 1661 1652 1662 1653 /* The current sector cannot be merged, submit the bio. */ 1663 1654 if (bbio && ··· 1718 1701 { 1719 1702 struct btrfs_fs_info *fs_info = sctx->fs_info; 1720 1703 struct btrfs_bio *bbio; 1704 + unsigned int nr_sectors = min(BTRFS_STRIPE_LEN, stripe->bg->start + 1705 + stripe->bg->length - stripe->logical) >> 1706 + fs_info->sectorsize_bits; 1721 1707 int mirror = stripe->mirror_num; 1722 1708 1723 1709 ASSERT(stripe->bg); ··· 1735 1715 bbio = btrfs_bio_alloc(SCRUB_STRIPE_PAGES, REQ_OP_READ, fs_info, 1736 1716 scrub_read_endio, stripe); 1737 1717 1738 - /* Read the whole stripe. */ 1739 1718 bbio->bio.bi_iter.bi_sector = stripe->logical >> SECTOR_SHIFT; 1740 - for (int i = 0; i < BTRFS_STRIPE_LEN >> PAGE_SHIFT; i++) { 1719 + /* Read the whole range inside the chunk boundary. */ 1720 + for (unsigned int cur = 0; cur < nr_sectors; cur++) { 1721 + struct page *page = scrub_stripe_get_page(stripe, cur); 1722 + unsigned int pgoff = scrub_stripe_get_page_offset(stripe, cur); 1741 1723 int ret; 1742 1724 1743 - ret = bio_add_page(&bbio->bio, stripe->pages[i], PAGE_SIZE, 0); 1725 + ret = bio_add_page(&bbio->bio, page, fs_info->sectorsize, pgoff); 1744 1726 /* We should have allocated enough bio vectors. */ 1745 - ASSERT(ret == PAGE_SIZE); 1727 + ASSERT(ret == fs_info->sectorsize); 1746 1728 } 1747 1729 atomic_inc(&stripe->pending_io); 1748 1730
+2 -2
fs/btrfs/send.c
··· 8205 8205 goto out; 8206 8206 } 8207 8207 8208 - sctx->clone_roots = kvcalloc(sizeof(*sctx->clone_roots), 8209 - arg->clone_sources_count + 1, 8208 + sctx->clone_roots = kvcalloc(arg->clone_sources_count + 1, 8209 + sizeof(*sctx->clone_roots), 8210 8210 GFP_KERNEL); 8211 8211 if (!sctx->clone_roots) { 8212 8212 ret = -ENOMEM;
+2 -1
fs/btrfs/subpage.c
··· 475 475 476 476 spin_lock_irqsave(&subpage->lock, flags); 477 477 bitmap_set(subpage->bitmaps, start_bit, len >> fs_info->sectorsize_bits); 478 - folio_start_writeback(folio); 478 + if (!folio_test_writeback(folio)) 479 + folio_start_writeback(folio); 479 480 spin_unlock_irqrestore(&subpage->lock, flags); 480 481 } 481 482
+8
fs/btrfs/super.c
··· 1457 1457 1458 1458 btrfs_info_to_ctx(fs_info, &old_ctx); 1459 1459 1460 + /* 1461 + * This is our "bind mount" trick, we don't want to allow the user to do 1462 + * anything other than mount a different ro/rw and a different subvol, 1463 + * all of the mount options should be maintained. 1464 + */ 1465 + if (mount_reconfigure) 1466 + ctx->mount_opt = old_ctx.mount_opt; 1467 + 1460 1468 sync_filesystem(sb); 1461 1469 set_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state); 1462 1470
+1 -1
fs/btrfs/tree-checker.c
··· 1436 1436 if (unlikely(ptr + btrfs_extent_inline_ref_size(inline_type) > end)) { 1437 1437 extent_err(leaf, slot, 1438 1438 "inline ref item overflows extent item, ptr %lu iref size %u end %lu", 1439 - ptr, inline_type, end); 1439 + ptr, btrfs_extent_inline_ref_size(inline_type), end); 1440 1440 return -EUCLEAN; 1441 1441 } 1442 1442
-2
fs/btrfs/volumes.c
··· 3087 3087 map = btrfs_find_chunk_map(fs_info, logical, length); 3088 3088 3089 3089 if (unlikely(!map)) { 3090 - read_unlock(&fs_info->mapping_tree_lock); 3091 3090 btrfs_crit(fs_info, 3092 3091 "unable to find chunk map for logical %llu length %llu", 3093 3092 logical, length); ··· 3094 3095 } 3095 3096 3096 3097 if (unlikely(map->start > logical || map->start + map->chunk_len <= logical)) { 3097 - read_unlock(&fs_info->mapping_tree_lock); 3098 3098 btrfs_crit(fs_info, 3099 3099 "found a bad chunk map, wanted %llu-%llu, found %llu-%llu", 3100 3100 logical, logical + length, map->start,
+19 -54
fs/btrfs/zlib.c
··· 354 354 } 355 355 356 356 int zlib_decompress(struct list_head *ws, const u8 *data_in, 357 - struct page *dest_page, unsigned long start_byte, size_t srclen, 357 + struct page *dest_page, unsigned long dest_pgoff, size_t srclen, 358 358 size_t destlen) 359 359 { 360 360 struct workspace *workspace = list_entry(ws, struct workspace, list); 361 361 int ret = 0; 362 362 int wbits = MAX_WBITS; 363 - unsigned long bytes_left; 364 - unsigned long total_out = 0; 365 - unsigned long pg_offset = 0; 366 - 367 - destlen = min_t(unsigned long, destlen, PAGE_SIZE); 368 - bytes_left = destlen; 363 + unsigned long to_copy; 369 364 370 365 workspace->strm.next_in = data_in; 371 366 workspace->strm.avail_in = srclen; ··· 385 390 return -EIO; 386 391 } 387 392 388 - while (bytes_left > 0) { 389 - unsigned long buf_start; 390 - unsigned long buf_offset; 391 - unsigned long bytes; 393 + /* 394 + * Everything (in/out buf) should be at most one sector, there should 395 + * be no need to switch any input/output buffer. 396 + */ 397 + ret = zlib_inflate(&workspace->strm, Z_FINISH); 398 + to_copy = min(workspace->strm.total_out, destlen); 399 + if (ret != Z_STREAM_END) 400 + goto out; 392 401 393 - ret = zlib_inflate(&workspace->strm, Z_NO_FLUSH); 394 - if (ret != Z_OK && ret != Z_STREAM_END) 395 - break; 402 + memcpy_to_page(dest_page, dest_pgoff, workspace->buf, to_copy); 396 403 397 - buf_start = total_out; 398 - total_out = workspace->strm.total_out; 399 - 400 - if (total_out == buf_start) { 401 - ret = -EIO; 402 - break; 403 - } 404 - 405 - if (total_out <= start_byte) 406 - goto next; 407 - 408 - if (total_out > start_byte && buf_start < start_byte) 409 - buf_offset = start_byte - buf_start; 410 - else 411 - buf_offset = 0; 412 - 413 - bytes = min(PAGE_SIZE - pg_offset, 414 - PAGE_SIZE - (buf_offset % PAGE_SIZE)); 415 - bytes = min(bytes, bytes_left); 416 - 417 - memcpy_to_page(dest_page, pg_offset, 418 - workspace->buf + buf_offset, bytes); 419 - 420 - pg_offset += bytes; 421 - bytes_left -= bytes; 422 - next: 423 - workspace->strm.next_out = workspace->buf; 424 - workspace->strm.avail_out = workspace->buf_size; 425 - } 426 - 427 - if (ret != Z_STREAM_END && bytes_left != 0) 404 + out: 405 + if (unlikely(to_copy != destlen)) { 406 + pr_warn_ratelimited("BTRFS: infalte failed, decompressed=%lu expected=%zu\n", 407 + to_copy, destlen); 428 408 ret = -EIO; 429 - else 409 + } else { 430 410 ret = 0; 411 + } 431 412 432 413 zlib_inflateEnd(&workspace->strm); 433 414 434 - /* 435 - * this should only happen if zlib returned fewer bytes than we 436 - * expected. btrfs_get_block is responsible for zeroing from the 437 - * end of the inline extent (destlen) to the end of the page 438 - */ 439 - if (pg_offset < destlen) { 440 - memzero_page(dest_page, pg_offset, destlen - pg_offset); 441 - } 415 + if (unlikely(to_copy < destlen)) 416 + memzero_page(dest_page, dest_pgoff + to_copy, destlen - to_copy); 442 417 return ret; 443 418 } 444 419
+2 -6
fs/btrfs/zoned.c
··· 2055 2055 2056 2056 map = block_group->physical_map; 2057 2057 2058 + spin_lock(&fs_info->zone_active_bgs_lock); 2058 2059 spin_lock(&block_group->lock); 2059 2060 if (test_bit(BLOCK_GROUP_FLAG_ZONE_IS_ACTIVE, &block_group->runtime_flags)) { 2060 2061 ret = true; ··· 2068 2067 goto out_unlock; 2069 2068 } 2070 2069 2071 - spin_lock(&fs_info->zone_active_bgs_lock); 2072 2070 for (i = 0; i < map->num_stripes; i++) { 2073 2071 struct btrfs_zoned_device_info *zinfo; 2074 2072 int reserved = 0; ··· 2087 2087 */ 2088 2088 if (atomic_read(&zinfo->active_zones_left) <= reserved) { 2089 2089 ret = false; 2090 - spin_unlock(&fs_info->zone_active_bgs_lock); 2091 2090 goto out_unlock; 2092 2091 } 2093 2092 2094 2093 if (!btrfs_dev_set_active_zone(device, physical)) { 2095 2094 /* Cannot activate the zone */ 2096 2095 ret = false; 2097 - spin_unlock(&fs_info->zone_active_bgs_lock); 2098 2096 goto out_unlock; 2099 2097 } 2100 2098 if (!is_data) 2101 2099 zinfo->reserved_active_zones--; 2102 2100 } 2103 - spin_unlock(&fs_info->zone_active_bgs_lock); 2104 2101 2105 2102 /* Successfully activated all the zones */ 2106 2103 set_bit(BLOCK_GROUP_FLAG_ZONE_IS_ACTIVE, &block_group->runtime_flags); ··· 2105 2108 2106 2109 /* For the active block group list */ 2107 2110 btrfs_get_block_group(block_group); 2108 - 2109 - spin_lock(&fs_info->zone_active_bgs_lock); 2110 2111 list_add_tail(&block_group->active_bg_list, &fs_info->zone_active_bgs); 2111 2112 spin_unlock(&fs_info->zone_active_bgs_lock); 2112 2113 ··· 2112 2117 2113 2118 out_unlock: 2114 2119 spin_unlock(&block_group->lock); 2120 + spin_unlock(&fs_info->zone_active_bgs_lock); 2115 2121 return ret; 2116 2122 } 2117 2123
+3
fs/cachefiles/ondemand.c
··· 539 539 struct fscache_volume *volume = object->volume->vcookie; 540 540 size_t volume_key_size, cookie_key_size, data_len; 541 541 542 + if (!object->ondemand) 543 + return 0; 544 + 542 545 /* 543 546 * CacheFiles will firstly check the cache file under the root cache 544 547 * directory. If the coherency check failed, it will fallback to
+31 -10
fs/exec.c
··· 128 128 struct filename *tmp = getname(library); 129 129 int error = PTR_ERR(tmp); 130 130 static const struct open_flags uselib_flags = { 131 - .open_flag = O_LARGEFILE | O_RDONLY | __FMODE_EXEC, 131 + .open_flag = O_LARGEFILE | O_RDONLY, 132 132 .acc_mode = MAY_READ | MAY_EXEC, 133 133 .intent = LOOKUP_OPEN, 134 134 .lookup_flags = LOOKUP_FOLLOW, ··· 904 904 905 905 #endif /* CONFIG_MMU */ 906 906 907 + /* 908 + * On success, caller must call do_close_execat() on the returned 909 + * struct file to close it. 910 + */ 907 911 static struct file *do_open_execat(int fd, struct filename *name, int flags) 908 912 { 909 913 struct file *file; ··· 952 948 return ERR_PTR(err); 953 949 } 954 950 951 + /** 952 + * open_exec - Open a path name for execution 953 + * 954 + * @name: path name to open with the intent of executing it. 955 + * 956 + * Returns ERR_PTR on failure or allocated struct file on success. 957 + * 958 + * As this is a wrapper for the internal do_open_execat(), callers 959 + * must call allow_write_access() before fput() on release. Also see 960 + * do_close_execat(). 961 + */ 955 962 struct file *open_exec(const char *name) 956 963 { 957 964 struct filename *filename = getname_kernel(name); ··· 1424 1409 1425 1410 out_unlock: 1426 1411 up_write(&me->signal->exec_update_lock); 1412 + if (!bprm->cred) 1413 + mutex_unlock(&me->signal->cred_guard_mutex); 1414 + 1427 1415 out: 1428 1416 return retval; 1429 1417 } ··· 1502 1484 return -ENOMEM; 1503 1485 } 1504 1486 1487 + /* Matches do_open_execat() */ 1488 + static void do_close_execat(struct file *file) 1489 + { 1490 + if (!file) 1491 + return; 1492 + allow_write_access(file); 1493 + fput(file); 1494 + } 1495 + 1505 1496 static void free_bprm(struct linux_binprm *bprm) 1506 1497 { 1507 1498 if (bprm->mm) { ··· 1522 1495 mutex_unlock(&current->signal->cred_guard_mutex); 1523 1496 abort_creds(bprm->cred); 1524 1497 } 1525 - if (bprm->file) { 1526 - allow_write_access(bprm->file); 1527 - fput(bprm->file); 1528 - } 1498 + do_close_execat(bprm->file); 1529 1499 if (bprm->executable) 1530 1500 fput(bprm->executable); 1531 1501 /* If a binfmt changed the interp, free it. */ ··· 1544 1520 1545 1521 bprm = kzalloc(sizeof(*bprm), GFP_KERNEL); 1546 1522 if (!bprm) { 1547 - allow_write_access(file); 1548 - fput(file); 1523 + do_close_execat(file); 1549 1524 return ERR_PTR(-ENOMEM); 1550 1525 } 1551 1526 ··· 1633 1610 } 1634 1611 rcu_read_unlock(); 1635 1612 1613 + /* "users" and "in_exec" locked for copy_fs() */ 1636 1614 if (p->fs->users > n_fs) 1637 1615 bprm->unsafe |= LSM_UNSAFE_SHARE; 1638 1616 else ··· 1850 1826 return 0; 1851 1827 } 1852 1828 1853 - /* 1854 - * sys_execve() executes a new program. 1855 - */ 1856 1829 static int bprm_execve(struct linux_binprm *bprm) 1857 1830 { 1858 1831 int retval;
+6 -6
fs/netfs/buffered_read.c
··· 101 101 } 102 102 103 103 if (!test_bit(NETFS_RREQ_DONT_UNLOCK_FOLIOS, &rreq->flags)) { 104 - if (folio_index(folio) == rreq->no_unlock_folio && 104 + if (folio->index == rreq->no_unlock_folio && 105 105 test_bit(NETFS_RREQ_NO_UNLOCK_FOLIO, &rreq->flags)) 106 106 _debug("no unlock"); 107 107 else ··· 246 246 */ 247 247 int netfs_read_folio(struct file *file, struct folio *folio) 248 248 { 249 - struct address_space *mapping = folio_file_mapping(folio); 249 + struct address_space *mapping = folio->mapping; 250 250 struct netfs_io_request *rreq; 251 251 struct netfs_inode *ctx = netfs_inode(mapping->host); 252 252 struct folio *sink = NULL; 253 253 int ret; 254 254 255 - _enter("%lx", folio_index(folio)); 255 + _enter("%lx", folio->index); 256 256 257 257 rreq = netfs_alloc_request(mapping, file, 258 258 folio_file_pos(folio), folio_size(folio), ··· 460 460 ret = PTR_ERR(rreq); 461 461 goto error; 462 462 } 463 - rreq->no_unlock_folio = folio_index(folio); 463 + rreq->no_unlock_folio = folio->index; 464 464 __set_bit(NETFS_RREQ_NO_UNLOCK_FOLIO, &rreq->flags); 465 465 466 466 ret = netfs_begin_cache_read(rreq, ctx); ··· 518 518 size_t offset, size_t len) 519 519 { 520 520 struct netfs_io_request *rreq; 521 - struct address_space *mapping = folio_file_mapping(folio); 521 + struct address_space *mapping = folio->mapping; 522 522 struct netfs_inode *ctx = netfs_inode(mapping->host); 523 523 unsigned long long start = folio_pos(folio); 524 524 size_t flen = folio_size(folio); ··· 535 535 goto error; 536 536 } 537 537 538 - rreq->no_unlock_folio = folio_index(folio); 538 + rreq->no_unlock_folio = folio->index; 539 539 __set_bit(NETFS_RREQ_NO_UNLOCK_FOLIO, &rreq->flags); 540 540 ret = netfs_begin_cache_read(rreq, ctx); 541 541 if (ret == -ENOMEM || ret == -EINTR || ret == -ERESTARTSYS)
+8 -7
fs/netfs/buffered_write.c
··· 221 221 if (unlikely(fault_in_iov_iter_readable(iter, part) == part)) 222 222 break; 223 223 224 - ret = -ENOMEM; 225 224 folio = netfs_grab_folio_for_write(mapping, pos, part); 226 - if (!folio) 225 + if (IS_ERR(folio)) { 226 + ret = PTR_ERR(folio); 227 227 break; 228 + } 228 229 229 230 flen = folio_size(folio); 230 231 offset = pos & (flen - 1); ··· 344 343 break; 345 344 default: 346 345 WARN(true, "Unexpected modify type %u ix=%lx\n", 347 - howto, folio_index(folio)); 346 + howto, folio->index); 348 347 ret = -EIO; 349 348 goto error_folio_unlock; 350 349 } ··· 649 648 xas_for_each(&xas, folio, last) { 650 649 WARN(!folio_test_writeback(folio), 651 650 "bad %zx @%llx page %lx %lx\n", 652 - wreq->len, wreq->start, folio_index(folio), last); 651 + wreq->len, wreq->start, folio->index, last); 653 652 654 653 if ((finfo = netfs_folio_info(folio))) { 655 654 /* Streaming writes cannot be redirtied whilst under ··· 796 795 continue; 797 796 if (xa_is_value(folio)) 798 797 break; 799 - if (folio_index(folio) != index) { 798 + if (folio->index != index) { 800 799 xas_reset(xas); 801 800 break; 802 801 } ··· 902 901 long count = wbc->nr_to_write; 903 902 int ret; 904 903 905 - _enter(",%lx,%llx-%llx,%u", folio_index(folio), start, end, caching); 904 + _enter(",%lx,%llx-%llx,%u", folio->index, start, end, caching); 906 905 907 906 wreq = netfs_alloc_request(mapping, NULL, start, folio_size(folio), 908 907 NETFS_WRITEBACK); ··· 1048 1047 1049 1048 start = folio_pos(folio); /* May regress with THPs */ 1050 1049 1051 - _debug("wback %lx", folio_index(folio)); 1050 + _debug("wback %lx", folio->index); 1052 1051 1053 1052 /* At this point we hold neither the i_pages lock nor the page lock: 1054 1053 * the page may be truncated or invalidated (changing page->mapping to
+2 -1
fs/netfs/fscache_cache.c
··· 179 179 void fscache_put_cache(struct fscache_cache *cache, 180 180 enum fscache_cache_trace where) 181 181 { 182 - unsigned int debug_id = cache->debug_id; 182 + unsigned int debug_id; 183 183 bool zero; 184 184 int ref; 185 185 186 186 if (IS_ERR_OR_NULL(cache)) 187 187 return; 188 188 189 + debug_id = cache->debug_id; 189 190 zero = __refcount_dec_and_test(&cache->ref, &ref); 190 191 trace_fscache_cache(debug_id, ref - 1, where); 191 192
+1 -1
fs/netfs/io.c
··· 124 124 /* We might have multiple writes from the same huge 125 125 * folio, but we mustn't unlock a folio more than once. 126 126 */ 127 - if (have_unlocked && folio_index(folio) <= unlocked) 127 + if (have_unlocked && folio->index <= unlocked) 128 128 continue; 129 129 unlocked = folio_next_index(folio) - 1; 130 130 trace_netfs_folio(folio, netfs_folio_trace_end_copy);
+1 -1
fs/netfs/misc.c
··· 180 180 struct netfs_folio *finfo = NULL; 181 181 size_t flen = folio_size(folio); 182 182 183 - _enter("{%lx},%zx,%zx", folio_index(folio), offset, length); 183 + _enter("{%lx},%zx,%zx", folio->index, offset, length); 184 184 185 185 folio_wait_fscache(folio); 186 186
+15 -11
fs/nfsd/nfs4state.c
··· 7911 7911 { 7912 7912 struct file_lock *fl; 7913 7913 int status = false; 7914 - struct nfsd_file *nf = find_any_file(fp); 7914 + struct nfsd_file *nf; 7915 7915 struct inode *inode; 7916 7916 struct file_lock_context *flctx; 7917 7917 7918 + spin_lock(&fp->fi_lock); 7919 + nf = find_any_file_locked(fp); 7918 7920 if (!nf) { 7919 7921 /* Any valid lock stateid should have some sort of access */ 7920 7922 WARN_ON_ONCE(1); 7921 - return status; 7923 + goto out; 7922 7924 } 7923 7925 7924 7926 inode = file_inode(nf->nf_file); ··· 7936 7934 } 7937 7935 spin_unlock(&flctx->flc_lock); 7938 7936 } 7939 - nfsd_file_put(nf); 7937 + out: 7938 + spin_unlock(&fp->fi_lock); 7940 7939 return status; 7941 7940 } 7942 7941 ··· 7947 7944 * @cstate: NFSv4 COMPOUND state 7948 7945 * @u: RELEASE_LOCKOWNER arguments 7949 7946 * 7950 - * The lockowner's so_count is bumped when a lock record is added 7951 - * or when copying a conflicting lock. The latter case is brief, 7952 - * but can lead to fleeting false positives when looking for 7953 - * locks-in-use. 7947 + * Check if theree are any locks still held and if not - free the lockowner 7948 + * and any lock state that is owned. 7954 7949 * 7955 7950 * Return values: 7956 7951 * %nfs_ok: lockowner released or not found ··· 7984 7983 spin_unlock(&clp->cl_lock); 7985 7984 return nfs_ok; 7986 7985 } 7987 - if (atomic_read(&lo->lo_owner.so_count) != 2) { 7988 - spin_unlock(&clp->cl_lock); 7989 - nfs4_put_stateowner(&lo->lo_owner); 7990 - return nfserr_locks_held; 7986 + 7987 + list_for_each_entry(stp, &lo->lo_owner.so_stateids, st_perstateowner) { 7988 + if (check_for_locks(stp->st_stid.sc_file, lo)) { 7989 + spin_unlock(&clp->cl_lock); 7990 + nfs4_put_stateowner(&lo->lo_owner); 7991 + return nfserr_locks_held; 7992 + } 7991 7993 } 7992 7994 unhash_lockowner_locked(lo); 7993 7995 while (!list_empty(&lo->lo_owner.so_stateids)) {
+27 -16
fs/overlayfs/namei.c
··· 18 18 19 19 struct ovl_lookup_data { 20 20 struct super_block *sb; 21 - struct vfsmount *mnt; 21 + const struct ovl_layer *layer; 22 22 struct qstr name; 23 23 bool is_dir; 24 24 bool opaque; 25 + bool xwhiteouts; 25 26 bool stop; 26 27 bool last; 27 28 char *redirect; ··· 202 201 return real; 203 202 } 204 203 205 - static bool ovl_is_opaquedir(struct ovl_fs *ofs, const struct path *path) 206 - { 207 - return ovl_path_check_dir_xattr(ofs, path, OVL_XATTR_OPAQUE); 208 - } 209 - 210 204 static struct dentry *ovl_lookup_positive_unlocked(struct ovl_lookup_data *d, 211 205 const char *name, 212 206 struct dentry *base, int len, 213 207 bool drop_negative) 214 208 { 215 - struct dentry *ret = lookup_one_unlocked(mnt_idmap(d->mnt), name, base, len); 209 + struct dentry *ret = lookup_one_unlocked(mnt_idmap(d->layer->mnt), name, 210 + base, len); 216 211 217 212 if (!IS_ERR(ret) && d_flags_negative(smp_load_acquire(&ret->d_flags))) { 218 213 if (drop_negative && ret->d_lockref.count == 1) { ··· 229 232 size_t prelen, const char *post, 230 233 struct dentry **ret, bool drop_negative) 231 234 { 235 + struct ovl_fs *ofs = OVL_FS(d->sb); 232 236 struct dentry *this; 233 237 struct path path; 234 238 int err; 235 239 bool last_element = !post[0]; 240 + bool is_upper = d->layer->idx == 0; 241 + char val; 236 242 237 243 this = ovl_lookup_positive_unlocked(d, name, base, namelen, drop_negative); 238 244 if (IS_ERR(this)) { ··· 253 253 } 254 254 255 255 path.dentry = this; 256 - path.mnt = d->mnt; 257 - if (ovl_path_is_whiteout(OVL_FS(d->sb), &path)) { 256 + path.mnt = d->layer->mnt; 257 + if (ovl_path_is_whiteout(ofs, &path)) { 258 258 d->stop = d->opaque = true; 259 259 goto put_and_out; 260 260 } ··· 272 272 d->stop = true; 273 273 goto put_and_out; 274 274 } 275 - err = ovl_check_metacopy_xattr(OVL_FS(d->sb), &path, NULL); 275 + err = ovl_check_metacopy_xattr(ofs, &path, NULL); 276 276 if (err < 0) 277 277 goto out_err; 278 278 ··· 292 292 if (d->last) 293 293 goto out; 294 294 295 - if (ovl_is_opaquedir(OVL_FS(d->sb), &path)) { 295 + /* overlay.opaque=x means xwhiteouts directory */ 296 + val = ovl_get_opaquedir_val(ofs, &path); 297 + if (last_element && !is_upper && val == 'x') { 298 + d->xwhiteouts = true; 299 + ovl_layer_set_xwhiteouts(ofs, d->layer); 300 + } else if (val == 'y') { 296 301 d->stop = true; 297 302 if (last_element) 298 303 d->opaque = true; ··· 868 863 * Returns next layer in stack starting from top. 869 864 * Returns -1 if this is the last layer. 870 865 */ 871 - int ovl_path_next(int idx, struct dentry *dentry, struct path *path) 866 + int ovl_path_next(int idx, struct dentry *dentry, struct path *path, 867 + const struct ovl_layer **layer) 872 868 { 873 869 struct ovl_entry *oe = OVL_E(dentry); 874 870 struct ovl_path *lowerstack = ovl_lowerstack(oe); ··· 877 871 BUG_ON(idx < 0); 878 872 if (idx == 0) { 879 873 ovl_path_upper(dentry, path); 880 - if (path->dentry) 874 + if (path->dentry) { 875 + *layer = &OVL_FS(dentry->d_sb)->layers[0]; 881 876 return ovl_numlower(oe) ? 1 : -1; 877 + } 882 878 idx++; 883 879 } 884 880 BUG_ON(idx > ovl_numlower(oe)); 885 881 path->dentry = lowerstack[idx - 1].dentry; 886 - path->mnt = lowerstack[idx - 1].layer->mnt; 882 + *layer = lowerstack[idx - 1].layer; 883 + path->mnt = (*layer)->mnt; 887 884 888 885 return (idx < ovl_numlower(oe)) ? idx + 1 : -1; 889 886 } ··· 1064 1055 old_cred = ovl_override_creds(dentry->d_sb); 1065 1056 upperdir = ovl_dentry_upper(dentry->d_parent); 1066 1057 if (upperdir) { 1067 - d.mnt = ovl_upper_mnt(ofs); 1058 + d.layer = &ofs->layers[0]; 1068 1059 err = ovl_lookup_layer(upperdir, &d, &upperdentry, true); 1069 1060 if (err) 1070 1061 goto out; ··· 1120 1111 else if (d.is_dir || !ofs->numdatalayer) 1121 1112 d.last = lower.layer->idx == ovl_numlower(roe); 1122 1113 1123 - d.mnt = lower.layer->mnt; 1114 + d.layer = lower.layer; 1124 1115 err = ovl_lookup_layer(lower.dentry, &d, &this, false); 1125 1116 if (err) 1126 1117 goto out_put; ··· 1287 1278 1288 1279 if (upperopaque) 1289 1280 ovl_dentry_set_opaque(dentry); 1281 + if (d.xwhiteouts) 1282 + ovl_dentry_set_xwhiteouts(dentry); 1290 1283 1291 1284 if (upperdentry) 1292 1285 ovl_dentry_set_upper_alias(dentry);
+17 -6
fs/overlayfs/overlayfs.h
··· 50 50 OVL_XATTR_METACOPY, 51 51 OVL_XATTR_PROTATTR, 52 52 OVL_XATTR_XWHITEOUT, 53 - OVL_XATTR_XWHITEOUTS, 54 53 }; 55 54 56 55 enum ovl_inode_flag { ··· 69 70 OVL_E_UPPER_ALIAS, 70 71 OVL_E_OPAQUE, 71 72 OVL_E_CONNECTED, 73 + /* Lower stack may contain xwhiteout entries */ 74 + OVL_E_XWHITEOUTS, 72 75 }; 73 76 74 77 enum { ··· 478 477 bool ovl_dentry_is_opaque(struct dentry *dentry); 479 478 bool ovl_dentry_is_whiteout(struct dentry *dentry); 480 479 void ovl_dentry_set_opaque(struct dentry *dentry); 480 + bool ovl_dentry_has_xwhiteouts(struct dentry *dentry); 481 + void ovl_dentry_set_xwhiteouts(struct dentry *dentry); 482 + void ovl_layer_set_xwhiteouts(struct ovl_fs *ofs, 483 + const struct ovl_layer *layer); 481 484 bool ovl_dentry_has_upper_alias(struct dentry *dentry); 482 485 void ovl_dentry_set_upper_alias(struct dentry *dentry); 483 486 bool ovl_dentry_needs_data_copy_up(struct dentry *dentry, int flags); ··· 499 494 int ovl_copy_up_start(struct dentry *dentry, int flags); 500 495 void ovl_copy_up_end(struct dentry *dentry); 501 496 bool ovl_already_copied_up(struct dentry *dentry, int flags); 502 - bool ovl_path_check_dir_xattr(struct ovl_fs *ofs, const struct path *path, 503 - enum ovl_xattr ox); 497 + char ovl_get_dir_xattr_val(struct ovl_fs *ofs, const struct path *path, 498 + enum ovl_xattr ox); 504 499 bool ovl_path_check_origin_xattr(struct ovl_fs *ofs, const struct path *path); 505 500 bool ovl_path_check_xwhiteout_xattr(struct ovl_fs *ofs, const struct path *path); 506 - bool ovl_path_check_xwhiteouts_xattr(struct ovl_fs *ofs, const struct path *path); 507 501 bool ovl_init_uuid_xattr(struct super_block *sb, struct ovl_fs *ofs, 508 502 const struct path *upperpath); 509 503 ··· 577 573 .mnt = ovl_upper_mnt(ofs), 578 574 }; 579 575 580 - return ovl_path_check_dir_xattr(ofs, &upperpath, OVL_XATTR_IMPURE); 576 + return ovl_get_dir_xattr_val(ofs, &upperpath, OVL_XATTR_IMPURE) == 'y'; 577 + } 578 + 579 + static inline char ovl_get_opaquedir_val(struct ovl_fs *ofs, 580 + const struct path *path) 581 + { 582 + return ovl_get_dir_xattr_val(ofs, path, OVL_XATTR_OPAQUE); 581 583 } 582 584 583 585 static inline bool ovl_redirect_follow(struct ovl_fs *ofs) ··· 690 680 struct dentry *ovl_get_index_fh(struct ovl_fs *ofs, struct ovl_fh *fh); 691 681 struct dentry *ovl_lookup_index(struct ovl_fs *ofs, struct dentry *upper, 692 682 struct dentry *origin, bool verify); 693 - int ovl_path_next(int idx, struct dentry *dentry, struct path *path); 683 + int ovl_path_next(int idx, struct dentry *dentry, struct path *path, 684 + const struct ovl_layer **layer); 694 685 int ovl_verify_lowerdata(struct dentry *dentry); 695 686 struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, 696 687 unsigned int flags);
+3 -1
fs/overlayfs/ovl_entry.h
··· 40 40 int idx; 41 41 /* One fsid per unique underlying sb (upper fsid == 0) */ 42 42 int fsid; 43 + /* xwhiteouts were found on this layer */ 44 + bool has_xwhiteouts; 43 45 }; 44 46 45 47 struct ovl_path { ··· 61 59 unsigned int numfs; 62 60 /* Number of data-only lower layers */ 63 61 unsigned int numdatalayer; 64 - const struct ovl_layer *layers; 62 + struct ovl_layer *layers; 65 63 struct ovl_sb *fs; 66 64 /* workbasedir is the path at workdir= mount option */ 67 65 struct dentry *workbasedir;
+4 -3
fs/overlayfs/readdir.c
··· 305 305 if (IS_ERR(realfile)) 306 306 return PTR_ERR(realfile); 307 307 308 - rdd->in_xwhiteouts_dir = rdd->dentry && 309 - ovl_path_check_xwhiteouts_xattr(OVL_FS(rdd->dentry->d_sb), realpath); 310 308 rdd->first_maybe_whiteout = NULL; 311 309 rdd->ctx.pos = 0; 312 310 do { ··· 357 359 .is_lowest = false, 358 360 }; 359 361 int idx, next; 362 + const struct ovl_layer *layer; 360 363 361 364 for (idx = 0; idx != -1; idx = next) { 362 - next = ovl_path_next(idx, dentry, &realpath); 365 + next = ovl_path_next(idx, dentry, &realpath, &layer); 363 366 rdd.is_upper = ovl_dentry_upper(dentry) == realpath.dentry; 367 + rdd.in_xwhiteouts_dir = layer->has_xwhiteouts && 368 + ovl_dentry_has_xwhiteouts(dentry); 364 369 365 370 if (next != -1) { 366 371 err = ovl_dir_read(&realpath, &rdd);
+15
fs/overlayfs/super.c
··· 1249 1249 struct ovl_entry *oe) 1250 1250 { 1251 1251 struct dentry *root; 1252 + struct ovl_fs *ofs = OVL_FS(sb); 1252 1253 struct ovl_path *lowerpath = ovl_lowerstack(oe); 1253 1254 unsigned long ino = d_inode(lowerpath->dentry)->i_ino; 1254 1255 int fsid = lowerpath->layer->fsid; ··· 1269 1268 ovl_dentry_set_upper_alias(root); 1270 1269 if (ovl_is_impuredir(sb, upperdentry)) 1271 1270 ovl_set_flag(OVL_IMPURE, d_inode(root)); 1271 + } 1272 + 1273 + /* Look for xwhiteouts marker except in the lowermost layer */ 1274 + for (int i = 0; i < ovl_numlower(oe) - 1; i++, lowerpath++) { 1275 + struct path path = { 1276 + .mnt = lowerpath->layer->mnt, 1277 + .dentry = lowerpath->dentry, 1278 + }; 1279 + 1280 + /* overlay.opaque=x means xwhiteouts directory */ 1281 + if (ovl_get_opaquedir_val(ofs, &path) == 'x') { 1282 + ovl_layer_set_xwhiteouts(ofs, lowerpath->layer); 1283 + ovl_dentry_set_xwhiteouts(root); 1284 + } 1272 1285 } 1273 1286 1274 1287 /* Root is always merge -> can have whiteouts */
+31 -22
fs/overlayfs/util.c
··· 461 461 ovl_dentry_set_flag(OVL_E_OPAQUE, dentry); 462 462 } 463 463 464 + bool ovl_dentry_has_xwhiteouts(struct dentry *dentry) 465 + { 466 + return ovl_dentry_test_flag(OVL_E_XWHITEOUTS, dentry); 467 + } 468 + 469 + void ovl_dentry_set_xwhiteouts(struct dentry *dentry) 470 + { 471 + ovl_dentry_set_flag(OVL_E_XWHITEOUTS, dentry); 472 + } 473 + 474 + /* 475 + * ovl_layer_set_xwhiteouts() is called before adding the overlay dir 476 + * dentry to dcache, while readdir of that same directory happens after 477 + * the overlay dir dentry is in dcache, so if some cpu observes that 478 + * ovl_dentry_is_xwhiteouts(), it will also observe layer->has_xwhiteouts 479 + * for the layers where xwhiteouts marker was found in that merge dir. 480 + */ 481 + void ovl_layer_set_xwhiteouts(struct ovl_fs *ofs, 482 + const struct ovl_layer *layer) 483 + { 484 + if (layer->has_xwhiteouts) 485 + return; 486 + 487 + /* Write once to read-mostly layer properties */ 488 + ofs->layers[layer->idx].has_xwhiteouts = true; 489 + } 490 + 464 491 /* 465 492 * For hard links and decoded file handles, it's possible for ovl_dentry_upper() 466 493 * to return positive, while there's no actual upper alias for the inode. ··· 766 739 return res >= 0; 767 740 } 768 741 769 - bool ovl_path_check_xwhiteouts_xattr(struct ovl_fs *ofs, const struct path *path) 770 - { 771 - struct dentry *dentry = path->dentry; 772 - int res; 773 - 774 - /* xattr.whiteouts must be a directory */ 775 - if (!d_is_dir(dentry)) 776 - return false; 777 - 778 - res = ovl_path_getxattr(ofs, path, OVL_XATTR_XWHITEOUTS, NULL, 0); 779 - return res >= 0; 780 - } 781 - 782 742 /* 783 743 * Load persistent uuid from xattr into s_uuid if found, or store a new 784 744 * random generated value in s_uuid and in xattr. ··· 825 811 return false; 826 812 } 827 813 828 - bool ovl_path_check_dir_xattr(struct ovl_fs *ofs, const struct path *path, 829 - enum ovl_xattr ox) 814 + char ovl_get_dir_xattr_val(struct ovl_fs *ofs, const struct path *path, 815 + enum ovl_xattr ox) 830 816 { 831 817 int res; 832 818 char val; 833 819 834 820 if (!d_is_dir(path->dentry)) 835 - return false; 821 + return 0; 836 822 837 823 res = ovl_path_getxattr(ofs, path, ox, &val, 1); 838 - if (res == 1 && val == 'y') 839 - return true; 840 - 841 - return false; 824 + return res == 1 ? val : 0; 842 825 } 843 826 844 827 #define OVL_XATTR_OPAQUE_POSTFIX "opaque" ··· 848 837 #define OVL_XATTR_METACOPY_POSTFIX "metacopy" 849 838 #define OVL_XATTR_PROTATTR_POSTFIX "protattr" 850 839 #define OVL_XATTR_XWHITEOUT_POSTFIX "whiteout" 851 - #define OVL_XATTR_XWHITEOUTS_POSTFIX "whiteouts" 852 840 853 841 #define OVL_XATTR_TAB_ENTRY(x) \ 854 842 [x] = { [false] = OVL_XATTR_TRUSTED_PREFIX x ## _POSTFIX, \ ··· 864 854 OVL_XATTR_TAB_ENTRY(OVL_XATTR_METACOPY), 865 855 OVL_XATTR_TAB_ENTRY(OVL_XATTR_PROTATTR), 866 856 OVL_XATTR_TAB_ENTRY(OVL_XATTR_XWHITEOUT), 867 - OVL_XATTR_TAB_ENTRY(OVL_XATTR_XWHITEOUTS), 868 857 }; 869 858 870 859 int ovl_check_setxattr(struct ovl_fs *ofs, struct dentry *upperdentry,
+20 -4
fs/smb/client/cached_dir.c
··· 145 145 struct cached_fid *cfid; 146 146 struct cached_fids *cfids; 147 147 const char *npath; 148 + int retries = 0, cur_sleep = 1; 148 149 149 150 if (tcon == NULL || tcon->cfids == NULL || tcon->nohandlecache || 150 151 is_smb1_server(tcon->ses->server) || (dir_cache_timeout == 0)) 151 152 return -EOPNOTSUPP; 152 153 153 154 ses = tcon->ses; 154 - server = cifs_pick_channel(ses); 155 155 cfids = tcon->cfids; 156 - 157 - if (!server->ops->new_lease_key) 158 - return -EIO; 159 156 160 157 if (cifs_sb->root == NULL) 161 158 return -ENOENT; 159 + 160 + replay_again: 161 + /* reinitialize for possible replay */ 162 + flags = 0; 163 + oplock = SMB2_OPLOCK_LEVEL_II; 164 + server = cifs_pick_channel(ses); 165 + 166 + if (!server->ops->new_lease_key) 167 + return -EIO; 162 168 163 169 utf16_path = cifs_convert_path_to_utf16(path, cifs_sb); 164 170 if (!utf16_path) ··· 274 268 */ 275 269 cfid->has_lease = true; 276 270 271 + if (retries) { 272 + smb2_set_replay(server, &rqst[0]); 273 + smb2_set_replay(server, &rqst[1]); 274 + } 275 + 277 276 rc = compound_send_recv(xid, ses, server, 278 277 flags, 2, rqst, 279 278 resp_buftype, rsp_iov); ··· 378 367 atomic_inc(&tcon->num_remote_opens); 379 368 } 380 369 kfree(utf16_path); 370 + 371 + if (is_replayable_error(rc) && 372 + smb2_should_replay(tcon, &retries, &cur_sleep)) 373 + goto replay_again; 374 + 381 375 return rc; 382 376 } 383 377
+1 -1
fs/smb/client/cifsencrypt.c
··· 572 572 len = cifs_strtoUTF16(user, ses->user_name, len, nls_cp); 573 573 UniStrupr(user); 574 574 } else { 575 - memset(user, '\0', 2); 575 + *(u16 *)user = 0; 576 576 } 577 577 578 578 rc = crypto_shash_update(ses->server->secmech.hmacmd5,
+14 -3
fs/smb/client/cifsfs.c
··· 396 396 spin_lock_init(&cifs_inode->writers_lock); 397 397 cifs_inode->writers = 0; 398 398 cifs_inode->netfs.inode.i_blkbits = 14; /* 2**14 = CIFS_MAX_MSGSIZE */ 399 - cifs_inode->server_eof = 0; 399 + cifs_inode->netfs.remote_i_size = 0; 400 400 cifs_inode->uniqueid = 0; 401 401 cifs_inode->createtime = 0; 402 402 cifs_inode->epoch = 0; ··· 1380 1380 struct inode *src_inode = file_inode(src_file); 1381 1381 struct inode *target_inode = file_inode(dst_file); 1382 1382 struct cifsInodeInfo *src_cifsi = CIFS_I(src_inode); 1383 + struct cifsInodeInfo *target_cifsi = CIFS_I(target_inode); 1383 1384 struct cifsFileInfo *smb_file_src; 1384 1385 struct cifsFileInfo *smb_file_target; 1385 1386 struct cifs_tcon *src_tcon; ··· 1429 1428 * Advance the EOF marker after the flush above to the end of the range 1430 1429 * if it's short of that. 1431 1430 */ 1432 - if (src_cifsi->server_eof < off + len) { 1431 + if (src_cifsi->netfs.remote_i_size < off + len) { 1433 1432 rc = cifs_precopy_set_eof(src_inode, src_cifsi, src_tcon, xid, off + len); 1434 1433 if (rc < 0) 1435 1434 goto unlock; ··· 1453 1452 /* Discard all the folios that overlap the destination region. */ 1454 1453 truncate_inode_pages_range(&target_inode->i_data, fstart, fend); 1455 1454 1455 + fscache_invalidate(cifs_inode_cookie(target_inode), NULL, 1456 + i_size_read(target_inode), 0); 1457 + 1456 1458 rc = file_modified(dst_file); 1457 1459 if (!rc) { 1458 1460 rc = target_tcon->ses->server->ops->copychunk_range(xid, 1459 1461 smb_file_src, smb_file_target, off, len, destoff); 1460 - if (rc > 0 && destoff + rc > i_size_read(target_inode)) 1462 + if (rc > 0 && destoff + rc > i_size_read(target_inode)) { 1461 1463 truncate_setsize(target_inode, destoff + rc); 1464 + netfs_resize_file(&target_cifsi->netfs, 1465 + i_size_read(target_inode), true); 1466 + fscache_resize_cookie(cifs_inode_cookie(target_inode), 1467 + i_size_read(target_inode)); 1468 + } 1469 + if (rc > 0 && destoff + rc > target_cifsi->netfs.zero_point) 1470 + target_cifsi->netfs.zero_point = destoff + rc; 1462 1471 } 1463 1472 1464 1473 file_accessed(src_file);
+13 -1
fs/smb/client/cifsglob.h
··· 50 50 #define CIFS_DEF_ACTIMEO (1 * HZ) 51 51 52 52 /* 53 + * max sleep time before retry to server 54 + */ 55 + #define CIFS_MAX_SLEEP 2000 56 + 57 + /* 53 58 * max attribute cache timeout (jiffies) - 2^30 54 59 */ 55 60 #define CIFS_MAX_ACTIMEO (1 << 30) ··· 1506 1501 struct smbd_mr *mr; 1507 1502 #endif 1508 1503 struct cifs_credits credits; 1504 + bool replay; 1509 1505 }; 1510 1506 1511 1507 /* ··· 1567 1561 spinlock_t writers_lock; 1568 1562 unsigned int writers; /* Number of writers on this inode */ 1569 1563 unsigned long time; /* jiffies of last update of inode */ 1570 - u64 server_eof; /* current file size on server -- protected by i_lock */ 1571 1564 u64 uniqueid; /* server inode number */ 1572 1565 u64 createtime; /* creation time on server */ 1573 1566 __u8 lease_key[SMB2_LEASE_KEY_SIZE]; /* lease key for this inode */ ··· 1832 1827 static inline bool is_retryable_error(int error) 1833 1828 { 1834 1829 if (is_interrupt_error(error) || error == -EAGAIN) 1830 + return true; 1831 + return false; 1832 + } 1833 + 1834 + static inline bool is_replayable_error(int error) 1835 + { 1836 + if (error == -EAGAIN || error == -ECONNABORTED) 1835 1837 return true; 1836 1838 return false; 1837 1839 }
+10 -9
fs/smb/client/file.c
··· 87 87 continue; 88 88 if (!folio_test_writeback(folio)) { 89 89 WARN_ONCE(1, "bad %x @%llx page %lx %lx\n", 90 - len, start, folio_index(folio), end); 90 + len, start, folio->index, end); 91 91 continue; 92 92 } 93 93 ··· 120 120 continue; 121 121 if (!folio_test_writeback(folio)) { 122 122 WARN_ONCE(1, "bad %x @%llx page %lx %lx\n", 123 - len, start, folio_index(folio), end); 123 + len, start, folio->index, end); 124 124 continue; 125 125 } 126 126 ··· 151 151 xas_for_each(&xas, folio, end) { 152 152 if (!folio_test_writeback(folio)) { 153 153 WARN_ONCE(1, "bad %x @%llx page %lx %lx\n", 154 - len, start, folio_index(folio), end); 154 + len, start, folio->index, end); 155 155 continue; 156 156 } 157 157 ··· 2120 2120 { 2121 2121 loff_t end_of_write = offset + bytes_written; 2122 2122 2123 - if (end_of_write > cifsi->server_eof) 2124 - cifsi->server_eof = end_of_write; 2123 + if (end_of_write > cifsi->netfs.remote_i_size) 2124 + netfs_resize_file(&cifsi->netfs, end_of_write, true); 2125 2125 } 2126 2126 2127 2127 static ssize_t ··· 2651 2651 continue; 2652 2652 if (xa_is_value(folio)) 2653 2653 break; 2654 - if (folio_index(folio) != index) 2654 + if (folio->index != index) 2655 2655 break; 2656 2656 if (!folio_try_get_rcu(folio)) { 2657 2657 xas_reset(&xas); ··· 2899 2899 goto skip_write; 2900 2900 } 2901 2901 2902 - if (folio_mapping(folio) != mapping || 2902 + if (folio->mapping != mapping || 2903 2903 !folio_test_dirty(folio)) { 2904 2904 start += folio_size(folio); 2905 2905 folio_unlock(folio); ··· 3247 3247 3248 3248 spin_lock(&inode->i_lock); 3249 3249 cifs_update_eof(cifsi, wdata->offset, wdata->bytes); 3250 - if (cifsi->server_eof > inode->i_size) 3251 - i_size_write(inode, cifsi->server_eof); 3250 + if (cifsi->netfs.remote_i_size > inode->i_size) 3251 + i_size_write(inode, cifsi->netfs.remote_i_size); 3252 3252 spin_unlock(&inode->i_lock); 3253 3253 3254 3254 complete(&wdata->done); ··· 3300 3300 if (wdata->cfile->invalidHandle) 3301 3301 rc = -EAGAIN; 3302 3302 else { 3303 + wdata->replay = true; 3303 3304 #ifdef CONFIG_CIFS_SMB_DIRECT 3304 3305 if (wdata->mr) { 3305 3306 wdata->mr->need_invalidate = true;
+5 -3
fs/smb/client/inode.c
··· 104 104 fattr->cf_mtime = timestamp_truncate(fattr->cf_mtime, inode); 105 105 mtime = inode_get_mtime(inode); 106 106 if (timespec64_equal(&mtime, &fattr->cf_mtime) && 107 - cifs_i->server_eof == fattr->cf_eof) { 107 + cifs_i->netfs.remote_i_size == fattr->cf_eof) { 108 108 cifs_dbg(FYI, "%s: inode %llu is unchanged\n", 109 109 __func__, cifs_i->uniqueid); 110 110 return; ··· 194 194 else 195 195 clear_bit(CIFS_INO_DELETE_PENDING, &cifs_i->flags); 196 196 197 - cifs_i->server_eof = fattr->cf_eof; 197 + cifs_i->netfs.remote_i_size = fattr->cf_eof; 198 198 /* 199 199 * Can't safely change the file size here if the client is writing to 200 200 * it due to potential races. ··· 2858 2858 2859 2859 set_size_out: 2860 2860 if (rc == 0) { 2861 - cifsInode->server_eof = attrs->ia_size; 2861 + netfs_resize_file(&cifsInode->netfs, attrs->ia_size, true); 2862 2862 cifs_setsize(inode, attrs->ia_size); 2863 2863 /* 2864 2864 * i_blocks is not related to (i_size / i_blksize), but instead ··· 3011 3011 if ((attrs->ia_valid & ATTR_SIZE) && 3012 3012 attrs->ia_size != i_size_read(inode)) { 3013 3013 truncate_setsize(inode, attrs->ia_size); 3014 + netfs_resize_file(&cifsInode->netfs, attrs->ia_size, true); 3014 3015 fscache_resize_cookie(cifs_inode_cookie(inode), attrs->ia_size); 3015 3016 } 3016 3017 ··· 3211 3210 if ((attrs->ia_valid & ATTR_SIZE) && 3212 3211 attrs->ia_size != i_size_read(inode)) { 3213 3212 truncate_setsize(inode, attrs->ia_size); 3213 + netfs_resize_file(&cifsInode->netfs, attrs->ia_size, true); 3214 3214 fscache_resize_cookie(cifs_inode_cookie(inode), attrs->ia_size); 3215 3215 } 3216 3216
+1 -1
fs/smb/client/readdir.c
··· 141 141 if (likely(reparse_inode_match(inode, fattr))) { 142 142 fattr->cf_mode = inode->i_mode; 143 143 fattr->cf_rdev = inode->i_rdev; 144 - fattr->cf_eof = CIFS_I(inode)->server_eof; 144 + fattr->cf_eof = CIFS_I(inode)->netfs.remote_i_size; 145 145 fattr->cf_symlink_target = NULL; 146 146 } else { 147 147 CIFS_I(inode)->time = 0;
+27 -6
fs/smb/client/smb2inode.c
··· 120 120 unsigned int size[2]; 121 121 void *data[2]; 122 122 int len; 123 + int retries = 0, cur_sleep = 1; 124 + 125 + replay_again: 126 + /* reinitialize for possible replay */ 127 + flags = 0; 128 + oplock = SMB2_OPLOCK_LEVEL_NONE; 129 + num_rqst = 0; 130 + server = cifs_pick_channel(ses); 123 131 124 132 vars = kzalloc(sizeof(*vars), GFP_ATOMIC); 125 133 if (vars == NULL) 126 134 return -ENOMEM; 127 135 rqst = &vars->rqst[0]; 128 136 rsp_iov = &vars->rsp_iov[0]; 129 - 130 - server = cifs_pick_channel(ses); 131 137 132 138 if (smb3_encryption_required(tcon)) 133 139 flags |= CIFS_TRANSFORM_REQ; ··· 469 463 num_rqst++; 470 464 471 465 if (cfile) { 466 + if (retries) 467 + for (i = 1; i < num_rqst - 2; i++) 468 + smb2_set_replay(server, &rqst[i]); 469 + 472 470 rc = compound_send_recv(xid, ses, server, 473 471 flags, num_rqst - 2, 474 472 &rqst[1], &resp_buftype[1], 475 473 &rsp_iov[1]); 476 - } else 474 + } else { 475 + if (retries) 476 + for (i = 0; i < num_rqst; i++) 477 + smb2_set_replay(server, &rqst[i]); 478 + 477 479 rc = compound_send_recv(xid, ses, server, 478 480 flags, num_rqst, 479 481 rqst, resp_buftype, 480 482 rsp_iov); 483 + } 481 484 482 485 finished: 483 486 num_rqst = 0; ··· 635 620 } 636 621 SMB2_close_free(&rqst[num_rqst]); 637 622 638 - if (cfile) 639 - cifsFileInfo_put(cfile); 640 - 641 623 num_cmds += 2; 642 624 if (out_iov && out_buftype) { 643 625 memcpy(out_iov, rsp_iov, num_cmds * sizeof(*out_iov)); ··· 644 632 for (i = 0; i < num_cmds; i++) 645 633 free_rsp_buf(resp_buftype[i], rsp_iov[i].iov_base); 646 634 } 635 + num_cmds -= 2; /* correct num_cmds as there could be a retry */ 647 636 kfree(vars); 637 + 638 + if (is_replayable_error(rc) && 639 + smb2_should_replay(tcon, &retries, &cur_sleep)) 640 + goto replay_again; 641 + 642 + if (cfile) 643 + cifsFileInfo_put(cfile); 644 + 648 645 return rc; 649 646 } 650 647
+127 -14
fs/smb/client/smb2ops.c
··· 1108 1108 { 1109 1109 struct smb2_compound_vars *vars; 1110 1110 struct cifs_ses *ses = tcon->ses; 1111 - struct TCP_Server_Info *server = cifs_pick_channel(ses); 1111 + struct TCP_Server_Info *server; 1112 1112 struct smb_rqst *rqst; 1113 1113 struct kvec *rsp_iov; 1114 1114 __le16 *utf16_path = NULL; ··· 1124 1124 struct smb2_file_full_ea_info *ea = NULL; 1125 1125 struct smb2_query_info_rsp *rsp; 1126 1126 int rc, used_len = 0; 1127 + int retries = 0, cur_sleep = 1; 1128 + 1129 + replay_again: 1130 + /* reinitialize for possible replay */ 1131 + flags = CIFS_CP_CREATE_CLOSE_OP; 1132 + oplock = SMB2_OPLOCK_LEVEL_NONE; 1133 + server = cifs_pick_channel(ses); 1127 1134 1128 1135 if (smb3_encryption_required(tcon)) 1129 1136 flags |= CIFS_TRANSFORM_REQ; ··· 1251 1244 goto sea_exit; 1252 1245 smb2_set_related(&rqst[2]); 1253 1246 1247 + if (retries) { 1248 + smb2_set_replay(server, &rqst[0]); 1249 + smb2_set_replay(server, &rqst[1]); 1250 + smb2_set_replay(server, &rqst[2]); 1251 + } 1252 + 1254 1253 rc = compound_send_recv(xid, ses, server, 1255 1254 flags, 3, rqst, 1256 1255 resp_buftype, rsp_iov); ··· 1273 1260 kfree(vars); 1274 1261 out_free_path: 1275 1262 kfree(utf16_path); 1263 + 1264 + if (is_replayable_error(rc) && 1265 + smb2_should_replay(tcon, &retries, &cur_sleep)) 1266 + goto replay_again; 1267 + 1276 1268 return rc; 1277 1269 } 1278 1270 #endif ··· 1502 1484 struct smb_rqst *rqst; 1503 1485 struct kvec *rsp_iov; 1504 1486 struct cifs_ses *ses = tcon->ses; 1505 - struct TCP_Server_Info *server = cifs_pick_channel(ses); 1487 + struct TCP_Server_Info *server; 1506 1488 char __user *arg = (char __user *)p; 1507 1489 struct smb_query_info qi; 1508 1490 struct smb_query_info __user *pqi; ··· 1519 1501 void *data[2]; 1520 1502 int create_options = is_dir ? CREATE_NOT_FILE : CREATE_NOT_DIR; 1521 1503 void (*free_req1_func)(struct smb_rqst *r); 1504 + int retries = 0, cur_sleep = 1; 1505 + 1506 + replay_again: 1507 + /* reinitialize for possible replay */ 1508 + flags = CIFS_CP_CREATE_CLOSE_OP; 1509 + oplock = SMB2_OPLOCK_LEVEL_NONE; 1510 + server = cifs_pick_channel(ses); 1522 1511 1523 1512 vars = kzalloc(sizeof(*vars), GFP_ATOMIC); 1524 1513 if (vars == NULL) ··· 1666 1641 goto free_req_1; 1667 1642 smb2_set_related(&rqst[2]); 1668 1643 1644 + if (retries) { 1645 + smb2_set_replay(server, &rqst[0]); 1646 + smb2_set_replay(server, &rqst[1]); 1647 + smb2_set_replay(server, &rqst[2]); 1648 + } 1649 + 1669 1650 rc = compound_send_recv(xid, ses, server, 1670 1651 flags, 3, rqst, 1671 1652 resp_buftype, rsp_iov); ··· 1732 1701 kfree(buffer); 1733 1702 free_vars: 1734 1703 kfree(vars); 1704 + 1705 + if (is_replayable_error(rc) && 1706 + smb2_should_replay(tcon, &retries, &cur_sleep)) 1707 + goto replay_again; 1708 + 1735 1709 return rc; 1736 1710 } 1737 1711 ··· 2263 2227 struct cifs_open_parms oparms; 2264 2228 struct smb2_query_directory_rsp *qd_rsp = NULL; 2265 2229 struct smb2_create_rsp *op_rsp = NULL; 2266 - struct TCP_Server_Info *server = cifs_pick_channel(tcon->ses); 2267 - int retry_count = 0; 2230 + struct TCP_Server_Info *server; 2231 + int retries = 0, cur_sleep = 1; 2232 + 2233 + replay_again: 2234 + /* reinitialize for possible replay */ 2235 + flags = 0; 2236 + oplock = SMB2_OPLOCK_LEVEL_NONE; 2237 + server = cifs_pick_channel(tcon->ses); 2268 2238 2269 2239 utf16_path = cifs_convert_path_to_utf16(path, cifs_sb); 2270 2240 if (!utf16_path) ··· 2320 2278 2321 2279 smb2_set_related(&rqst[1]); 2322 2280 2323 - again: 2281 + if (retries) { 2282 + smb2_set_replay(server, &rqst[0]); 2283 + smb2_set_replay(server, &rqst[1]); 2284 + } 2285 + 2324 2286 rc = compound_send_recv(xid, tcon->ses, server, 2325 2287 flags, 2, rqst, 2326 2288 resp_buftype, rsp_iov); 2327 - 2328 - if (rc == -EAGAIN && retry_count++ < 10) 2329 - goto again; 2330 2289 2331 2290 /* If the open failed there is nothing to do */ 2332 2291 op_rsp = (struct smb2_create_rsp *)rsp_iov[0].iov_base; ··· 2376 2333 SMB2_query_directory_free(&rqst[1]); 2377 2334 free_rsp_buf(resp_buftype[0], rsp_iov[0].iov_base); 2378 2335 free_rsp_buf(resp_buftype[1], rsp_iov[1].iov_base); 2336 + 2337 + if (is_replayable_error(rc) && 2338 + smb2_should_replay(tcon, &retries, &cur_sleep)) 2339 + goto replay_again; 2340 + 2379 2341 return rc; 2380 2342 } 2381 2343 ··· 2506 2458 } 2507 2459 2508 2460 void 2461 + smb2_set_replay(struct TCP_Server_Info *server, struct smb_rqst *rqst) 2462 + { 2463 + struct smb2_hdr *shdr; 2464 + 2465 + if (server->dialect < SMB30_PROT_ID) 2466 + return; 2467 + 2468 + shdr = (struct smb2_hdr *)(rqst->rq_iov[0].iov_base); 2469 + if (shdr == NULL) { 2470 + cifs_dbg(FYI, "shdr NULL in smb2_set_related\n"); 2471 + return; 2472 + } 2473 + shdr->Flags |= SMB2_FLAGS_REPLAY_OPERATION; 2474 + } 2475 + 2476 + void 2509 2477 smb2_set_related(struct smb_rqst *rqst) 2510 2478 { 2511 2479 struct smb2_hdr *shdr; ··· 2594 2530 } 2595 2531 2596 2532 /* 2533 + * helper function for exponential backoff and check if replayable 2534 + */ 2535 + bool smb2_should_replay(struct cifs_tcon *tcon, 2536 + int *pretries, 2537 + int *pcur_sleep) 2538 + { 2539 + if (!pretries || !pcur_sleep) 2540 + return false; 2541 + 2542 + if (tcon->retry || (*pretries)++ < tcon->ses->server->retrans) { 2543 + msleep(*pcur_sleep); 2544 + (*pcur_sleep) = ((*pcur_sleep) << 1); 2545 + if ((*pcur_sleep) > CIFS_MAX_SLEEP) 2546 + (*pcur_sleep) = CIFS_MAX_SLEEP; 2547 + return true; 2548 + } 2549 + 2550 + return false; 2551 + } 2552 + 2553 + /* 2597 2554 * Passes the query info response back to the caller on success. 2598 2555 * Caller need to free this with free_rsp_buf(). 2599 2556 */ ··· 2627 2542 { 2628 2543 struct smb2_compound_vars *vars; 2629 2544 struct cifs_ses *ses = tcon->ses; 2630 - struct TCP_Server_Info *server = cifs_pick_channel(ses); 2545 + struct TCP_Server_Info *server; 2631 2546 int flags = CIFS_CP_CREATE_CLOSE_OP; 2632 2547 struct smb_rqst *rqst; 2633 2548 int resp_buftype[3]; ··· 2638 2553 int rc; 2639 2554 __le16 *utf16_path; 2640 2555 struct cached_fid *cfid = NULL; 2556 + int retries = 0, cur_sleep = 1; 2557 + 2558 + replay_again: 2559 + /* reinitialize for possible replay */ 2560 + flags = CIFS_CP_CREATE_CLOSE_OP; 2561 + oplock = SMB2_OPLOCK_LEVEL_NONE; 2562 + server = cifs_pick_channel(ses); 2641 2563 2642 2564 if (!path) 2643 2565 path = ""; ··· 2725 2633 goto qic_exit; 2726 2634 smb2_set_related(&rqst[2]); 2727 2635 2636 + if (retries) { 2637 + if (!cfid) { 2638 + smb2_set_replay(server, &rqst[0]); 2639 + smb2_set_replay(server, &rqst[2]); 2640 + } 2641 + smb2_set_replay(server, &rqst[1]); 2642 + } 2643 + 2728 2644 if (cfid) { 2729 2645 rc = compound_send_recv(xid, ses, server, 2730 2646 flags, 1, &rqst[1], ··· 2765 2665 kfree(vars); 2766 2666 out_free_path: 2767 2667 kfree(utf16_path); 2668 + 2669 + if (is_replayable_error(rc) && 2670 + smb2_should_replay(tcon, &retries, &cur_sleep)) 2671 + goto replay_again; 2672 + 2768 2673 return rc; 2769 2674 } 2770 2675 ··· 3318 3213 cfile->fid.volatile_fid, cfile->pid, new_size); 3319 3214 if (rc >= 0) { 3320 3215 truncate_setsize(inode, new_size); 3216 + netfs_resize_file(&cifsi->netfs, new_size, true); 3217 + if (offset < cifsi->netfs.zero_point) 3218 + cifsi->netfs.zero_point = offset; 3321 3219 fscache_resize_cookie(cifs_inode_cookie(inode), new_size); 3322 3220 } 3323 3221 } ··· 3544 3436 rc = SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid, 3545 3437 cfile->fid.volatile_fid, cfile->pid, new_eof); 3546 3438 if (rc == 0) { 3547 - cifsi->server_eof = new_eof; 3439 + netfs_resize_file(&cifsi->netfs, new_eof, true); 3548 3440 cifs_setsize(inode, new_eof); 3549 3441 cifs_truncate_page(inode->i_mapping, inode->i_size); 3550 3442 truncate_setsize(inode, new_eof); ··· 3636 3528 int rc; 3637 3529 unsigned int xid; 3638 3530 struct inode *inode = file_inode(file); 3639 - struct cifsFileInfo *cfile = file->private_data; 3640 3531 struct cifsInodeInfo *cifsi = CIFS_I(inode); 3532 + struct cifsFileInfo *cfile = file->private_data; 3533 + struct netfs_inode *ictx = &cifsi->netfs; 3641 3534 loff_t old_eof, new_eof; 3642 3535 3643 3536 xid = get_xid(); ··· 3658 3549 goto out_2; 3659 3550 3660 3551 truncate_pagecache_range(inode, off, old_eof); 3552 + ictx->zero_point = old_eof; 3661 3553 3662 3554 rc = smb2_copychunk_range(xid, cfile, cfile, off + len, 3663 3555 old_eof - off - len, off); ··· 3673 3563 3674 3564 rc = 0; 3675 3565 3676 - cifsi->server_eof = i_size_read(inode) - len; 3677 - truncate_setsize(inode, cifsi->server_eof); 3678 - fscache_resize_cookie(cifs_inode_cookie(inode), cifsi->server_eof); 3566 + truncate_setsize(inode, new_eof); 3567 + netfs_resize_file(&cifsi->netfs, new_eof, true); 3568 + ictx->zero_point = new_eof; 3569 + fscache_resize_cookie(cifs_inode_cookie(inode), new_eof); 3679 3570 out_2: 3680 3571 filemap_invalidate_unlock(inode->i_mapping); 3681 3572 out: ··· 3692 3581 unsigned int xid; 3693 3582 struct cifsFileInfo *cfile = file->private_data; 3694 3583 struct inode *inode = file_inode(file); 3584 + struct cifsInodeInfo *cifsi = CIFS_I(inode); 3695 3585 __u64 count, old_eof, new_eof; 3696 3586 3697 3587 xid = get_xid(); ··· 3720 3608 goto out_2; 3721 3609 3722 3610 truncate_setsize(inode, new_eof); 3611 + netfs_resize_file(&cifsi->netfs, i_size_read(inode), true); 3723 3612 fscache_resize_cookie(cifs_inode_cookie(inode), i_size_read(inode)); 3724 3613 3725 3614 rc = smb2_copychunk_range(xid, cfile, cfile, off, count, off + len);
+239 -30
fs/smb/client/smb2pdu.c
··· 195 195 pserver = server->primary_server; 196 196 cifs_signal_cifsd_for_reconnect(pserver, false); 197 197 skip_terminate: 198 - mutex_unlock(&ses->session_mutex); 199 198 return -EHOSTDOWN; 200 199 } 201 200 ··· 2764 2765 int flags = 0; 2765 2766 unsigned int total_len; 2766 2767 __le16 *utf16_path = NULL; 2767 - struct TCP_Server_Info *server = cifs_pick_channel(ses); 2768 + struct TCP_Server_Info *server; 2769 + int retries = 0, cur_sleep = 1; 2770 + 2771 + replay_again: 2772 + /* reinitialize for possible replay */ 2773 + flags = 0; 2774 + n_iov = 2; 2775 + server = cifs_pick_channel(ses); 2768 2776 2769 2777 cifs_dbg(FYI, "mkdir\n"); 2770 2778 ··· 2875 2869 /* no need to inc num_remote_opens because we close it just below */ 2876 2870 trace_smb3_posix_mkdir_enter(xid, tcon->tid, ses->Suid, full_path, CREATE_NOT_FILE, 2877 2871 FILE_WRITE_ATTRIBUTES); 2872 + 2873 + if (retries) 2874 + smb2_set_replay(server, &rqst); 2875 + 2878 2876 /* resource #4: response buffer */ 2879 2877 rc = cifs_send_recv(xid, ses, server, 2880 2878 &rqst, &resp_buftype, flags, &rsp_iov); ··· 2916 2906 cifs_small_buf_release(req); 2917 2907 err_free_path: 2918 2908 kfree(utf16_path); 2909 + 2910 + if (is_replayable_error(rc) && 2911 + smb2_should_replay(tcon, &retries, &cur_sleep)) 2912 + goto replay_again; 2913 + 2919 2914 return rc; 2920 2915 } 2921 2916 ··· 3116 3101 struct smb2_create_rsp *rsp = NULL; 3117 3102 struct cifs_tcon *tcon = oparms->tcon; 3118 3103 struct cifs_ses *ses = tcon->ses; 3119 - struct TCP_Server_Info *server = cifs_pick_channel(ses); 3104 + struct TCP_Server_Info *server; 3120 3105 struct kvec iov[SMB2_CREATE_IOV_SIZE]; 3121 3106 struct kvec rsp_iov = {NULL, 0}; 3122 3107 int resp_buftype = CIFS_NO_BUFFER; 3123 3108 int rc = 0; 3124 3109 int flags = 0; 3110 + int retries = 0, cur_sleep = 1; 3111 + 3112 + replay_again: 3113 + /* reinitialize for possible replay */ 3114 + flags = 0; 3115 + server = cifs_pick_channel(ses); 3125 3116 3126 3117 cifs_dbg(FYI, "create/open\n"); 3127 3118 if (!ses || !server) ··· 3148 3127 3149 3128 trace_smb3_open_enter(xid, tcon->tid, tcon->ses->Suid, oparms->path, 3150 3129 oparms->create_options, oparms->desired_access); 3130 + 3131 + if (retries) 3132 + smb2_set_replay(server, &rqst); 3151 3133 3152 3134 rc = cifs_send_recv(xid, ses, server, 3153 3135 &rqst, &resp_buftype, flags, ··· 3205 3181 creat_exit: 3206 3182 SMB2_open_free(&rqst); 3207 3183 free_rsp_buf(resp_buftype, rsp); 3184 + 3185 + if (is_replayable_error(rc) && 3186 + smb2_should_replay(tcon, &retries, &cur_sleep)) 3187 + goto replay_again; 3188 + 3208 3189 return rc; 3209 3190 } 3210 3191 ··· 3334 3305 int resp_buftype = CIFS_NO_BUFFER; 3335 3306 int rc = 0; 3336 3307 int flags = 0; 3308 + int retries = 0, cur_sleep = 1; 3309 + 3310 + if (!tcon) 3311 + return -EIO; 3312 + 3313 + ses = tcon->ses; 3314 + if (!ses) 3315 + return -EIO; 3316 + 3317 + replay_again: 3318 + /* reinitialize for possible replay */ 3319 + flags = 0; 3320 + server = cifs_pick_channel(ses); 3321 + 3322 + if (!server) 3323 + return -EIO; 3337 3324 3338 3325 cifs_dbg(FYI, "SMB2 IOCTL\n"); 3339 3326 ··· 3359 3314 /* zero out returned data len, in case of error */ 3360 3315 if (plen) 3361 3316 *plen = 0; 3362 - 3363 - if (!tcon) 3364 - return -EIO; 3365 - 3366 - ses = tcon->ses; 3367 - if (!ses) 3368 - return -EIO; 3369 - 3370 - server = cifs_pick_channel(ses); 3371 - if (!server) 3372 - return -EIO; 3373 3317 3374 3318 if (smb3_encryption_required(tcon)) 3375 3319 flags |= CIFS_TRANSFORM_REQ; ··· 3373 3339 in_data, indatalen, max_out_data_len); 3374 3340 if (rc) 3375 3341 goto ioctl_exit; 3342 + 3343 + if (retries) 3344 + smb2_set_replay(server, &rqst); 3376 3345 3377 3346 rc = cifs_send_recv(xid, ses, server, 3378 3347 &rqst, &resp_buftype, flags, ··· 3446 3409 ioctl_exit: 3447 3410 SMB2_ioctl_free(&rqst); 3448 3411 free_rsp_buf(resp_buftype, rsp); 3412 + 3413 + if (is_replayable_error(rc) && 3414 + smb2_should_replay(tcon, &retries, &cur_sleep)) 3415 + goto replay_again; 3416 + 3449 3417 return rc; 3450 3418 } 3451 3419 ··· 3522 3480 struct smb_rqst rqst; 3523 3481 struct smb2_close_rsp *rsp = NULL; 3524 3482 struct cifs_ses *ses = tcon->ses; 3525 - struct TCP_Server_Info *server = cifs_pick_channel(ses); 3483 + struct TCP_Server_Info *server; 3526 3484 struct kvec iov[1]; 3527 3485 struct kvec rsp_iov; 3528 3486 int resp_buftype = CIFS_NO_BUFFER; 3529 3487 int rc = 0; 3530 3488 int flags = 0; 3531 3489 bool query_attrs = false; 3490 + int retries = 0, cur_sleep = 1; 3491 + 3492 + replay_again: 3493 + /* reinitialize for possible replay */ 3494 + flags = 0; 3495 + query_attrs = false; 3496 + server = cifs_pick_channel(ses); 3532 3497 3533 3498 cifs_dbg(FYI, "Close\n"); 3534 3499 ··· 3560 3511 query_attrs); 3561 3512 if (rc) 3562 3513 goto close_exit; 3514 + 3515 + if (retries) 3516 + smb2_set_replay(server, &rqst); 3563 3517 3564 3518 rc = cifs_send_recv(xid, ses, server, 3565 3519 &rqst, &resp_buftype, flags, &rsp_iov); ··· 3597 3545 cifs_dbg(VFS, "handle cancelled close fid 0x%llx returned error %d\n", 3598 3546 persistent_fid, tmp_rc); 3599 3547 } 3548 + 3549 + if (is_replayable_error(rc) && 3550 + smb2_should_replay(tcon, &retries, &cur_sleep)) 3551 + goto replay_again; 3552 + 3600 3553 return rc; 3601 3554 } 3602 3555 ··· 3732 3675 struct TCP_Server_Info *server; 3733 3676 int flags = 0; 3734 3677 bool allocated = false; 3678 + int retries = 0, cur_sleep = 1; 3735 3679 3736 3680 cifs_dbg(FYI, "Query Info\n"); 3737 3681 3738 3682 if (!ses) 3739 3683 return -EIO; 3684 + 3685 + replay_again: 3686 + /* reinitialize for possible replay */ 3687 + flags = 0; 3688 + allocated = false; 3740 3689 server = cifs_pick_channel(ses); 3690 + 3741 3691 if (!server) 3742 3692 return -EIO; 3743 3693 ··· 3765 3701 3766 3702 trace_smb3_query_info_enter(xid, persistent_fid, tcon->tid, 3767 3703 ses->Suid, info_class, (__u32)info_type); 3704 + 3705 + if (retries) 3706 + smb2_set_replay(server, &rqst); 3768 3707 3769 3708 rc = cifs_send_recv(xid, ses, server, 3770 3709 &rqst, &resp_buftype, flags, &rsp_iov); ··· 3811 3744 qinf_exit: 3812 3745 SMB2_query_info_free(&rqst); 3813 3746 free_rsp_buf(resp_buftype, rsp); 3747 + 3748 + if (is_replayable_error(rc) && 3749 + smb2_should_replay(tcon, &retries, &cur_sleep)) 3750 + goto replay_again; 3751 + 3814 3752 return rc; 3815 3753 } 3816 3754 ··· 3916 3844 u32 *plen /* returned data len */) 3917 3845 { 3918 3846 struct cifs_ses *ses = tcon->ses; 3919 - struct TCP_Server_Info *server = cifs_pick_channel(ses); 3847 + struct TCP_Server_Info *server; 3920 3848 struct smb_rqst rqst; 3921 3849 struct smb2_change_notify_rsp *smb_rsp; 3922 3850 struct kvec iov[1]; ··· 3924 3852 int resp_buftype = CIFS_NO_BUFFER; 3925 3853 int flags = 0; 3926 3854 int rc = 0; 3855 + int retries = 0, cur_sleep = 1; 3856 + 3857 + replay_again: 3858 + /* reinitialize for possible replay */ 3859 + flags = 0; 3860 + server = cifs_pick_channel(ses); 3927 3861 3928 3862 cifs_dbg(FYI, "change notify\n"); 3929 3863 if (!ses || !server) ··· 3954 3876 3955 3877 trace_smb3_notify_enter(xid, persistent_fid, tcon->tid, ses->Suid, 3956 3878 (u8)watch_tree, completion_filter); 3879 + 3880 + if (retries) 3881 + smb2_set_replay(server, &rqst); 3882 + 3957 3883 rc = cifs_send_recv(xid, ses, server, 3958 3884 &rqst, &resp_buftype, flags, &rsp_iov); 3959 3885 ··· 3992 3910 if (rqst.rq_iov) 3993 3911 cifs_small_buf_release(rqst.rq_iov[0].iov_base); /* request */ 3994 3912 free_rsp_buf(resp_buftype, rsp_iov.iov_base); 3913 + 3914 + if (is_replayable_error(rc) && 3915 + smb2_should_replay(tcon, &retries, &cur_sleep)) 3916 + goto replay_again; 3917 + 3995 3918 return rc; 3996 3919 } 3997 3920 ··· 4239 4152 struct smb_rqst rqst; 4240 4153 struct kvec iov[1]; 4241 4154 struct kvec rsp_iov = {NULL, 0}; 4242 - struct TCP_Server_Info *server = cifs_pick_channel(ses); 4155 + struct TCP_Server_Info *server; 4243 4156 int resp_buftype = CIFS_NO_BUFFER; 4244 4157 int flags = 0; 4245 4158 int rc = 0; 4159 + int retries = 0, cur_sleep = 1; 4160 + 4161 + replay_again: 4162 + /* reinitialize for possible replay */ 4163 + flags = 0; 4164 + server = cifs_pick_channel(ses); 4246 4165 4247 4166 cifs_dbg(FYI, "flush\n"); 4248 4167 if (!ses || !(ses->server)) ··· 4268 4175 goto flush_exit; 4269 4176 4270 4177 trace_smb3_flush_enter(xid, persistent_fid, tcon->tid, ses->Suid); 4178 + 4179 + if (retries) 4180 + smb2_set_replay(server, &rqst); 4181 + 4271 4182 rc = cifs_send_recv(xid, ses, server, 4272 4183 &rqst, &resp_buftype, flags, &rsp_iov); 4273 4184 ··· 4286 4189 flush_exit: 4287 4190 SMB2_flush_free(&rqst); 4288 4191 free_rsp_buf(resp_buftype, rsp_iov.iov_base); 4192 + 4193 + if (is_replayable_error(rc) && 4194 + smb2_should_replay(tcon, &retries, &cur_sleep)) 4195 + goto replay_again; 4196 + 4289 4197 return rc; 4290 4198 } 4291 4199 ··· 4770 4668 struct cifs_io_parms *io_parms = NULL; 4771 4669 int credit_request; 4772 4670 4773 - if (!wdata->server) 4671 + if (!wdata->server || wdata->replay) 4774 4672 server = wdata->server = cifs_pick_channel(tcon->ses); 4775 4673 4776 4674 /* ··· 4855 4753 rqst.rq_nvec = 1; 4856 4754 rqst.rq_iter = wdata->iter; 4857 4755 rqst.rq_iter_size = iov_iter_count(&rqst.rq_iter); 4756 + if (wdata->replay) 4757 + smb2_set_replay(server, &rqst); 4858 4758 #ifdef CONFIG_CIFS_SMB_DIRECT 4859 4759 if (wdata->mr) 4860 4760 iov[0].iov_len += sizeof(struct smbd_buffer_descriptor_v1); ··· 4930 4826 int flags = 0; 4931 4827 unsigned int total_len; 4932 4828 struct TCP_Server_Info *server; 4829 + int retries = 0, cur_sleep = 1; 4933 4830 4831 + replay_again: 4832 + /* reinitialize for possible replay */ 4833 + flags = 0; 4934 4834 *nbytes = 0; 4935 - 4936 - if (n_vec < 1) 4937 - return rc; 4938 - 4939 4835 if (!io_parms->server) 4940 4836 io_parms->server = cifs_pick_channel(io_parms->tcon->ses); 4941 4837 server = io_parms->server; 4942 4838 if (server == NULL) 4943 4839 return -ECONNABORTED; 4840 + 4841 + if (n_vec < 1) 4842 + return rc; 4944 4843 4945 4844 rc = smb2_plain_req_init(SMB2_WRITE, io_parms->tcon, server, 4946 4845 (void **) &req, &total_len); ··· 4978 4871 rqst.rq_iov = iov; 4979 4872 rqst.rq_nvec = n_vec + 1; 4980 4873 4874 + if (retries) 4875 + smb2_set_replay(server, &rqst); 4876 + 4981 4877 rc = cifs_send_recv(xid, io_parms->tcon->ses, server, 4982 4878 &rqst, 4983 4879 &resp_buftype, flags, &rsp_iov); ··· 5005 4895 5006 4896 cifs_small_buf_release(req); 5007 4897 free_rsp_buf(resp_buftype, rsp); 4898 + 4899 + if (is_replayable_error(rc) && 4900 + smb2_should_replay(io_parms->tcon, &retries, &cur_sleep)) 4901 + goto replay_again; 4902 + 5008 4903 return rc; 5009 4904 } 5010 4905 ··· 5321 5206 struct kvec rsp_iov; 5322 5207 int rc = 0; 5323 5208 struct cifs_ses *ses = tcon->ses; 5324 - struct TCP_Server_Info *server = cifs_pick_channel(ses); 5209 + struct TCP_Server_Info *server; 5325 5210 int flags = 0; 5211 + int retries = 0, cur_sleep = 1; 5212 + 5213 + replay_again: 5214 + /* reinitialize for possible replay */ 5215 + flags = 0; 5216 + server = cifs_pick_channel(ses); 5326 5217 5327 5218 if (!ses || !(ses->server)) 5328 5219 return -EIO; ··· 5347 5226 srch_inf->info_level); 5348 5227 if (rc) 5349 5228 goto qdir_exit; 5229 + 5230 + if (retries) 5231 + smb2_set_replay(server, &rqst); 5350 5232 5351 5233 rc = cifs_send_recv(xid, ses, server, 5352 5234 &rqst, &resp_buftype, flags, &rsp_iov); ··· 5385 5261 qdir_exit: 5386 5262 SMB2_query_directory_free(&rqst); 5387 5263 free_rsp_buf(resp_buftype, rsp); 5264 + 5265 + if (is_replayable_error(rc) && 5266 + smb2_should_replay(tcon, &retries, &cur_sleep)) 5267 + goto replay_again; 5268 + 5388 5269 return rc; 5389 5270 } 5390 5271 ··· 5456 5327 int rc = 0; 5457 5328 int resp_buftype; 5458 5329 struct cifs_ses *ses = tcon->ses; 5459 - struct TCP_Server_Info *server = cifs_pick_channel(ses); 5330 + struct TCP_Server_Info *server; 5460 5331 int flags = 0; 5332 + int retries = 0, cur_sleep = 1; 5333 + 5334 + replay_again: 5335 + /* reinitialize for possible replay */ 5336 + flags = 0; 5337 + server = cifs_pick_channel(ses); 5461 5338 5462 5339 if (!ses || !server) 5463 5340 return -EIO; ··· 5491 5356 return rc; 5492 5357 } 5493 5358 5359 + if (retries) 5360 + smb2_set_replay(server, &rqst); 5494 5361 5495 5362 rc = cifs_send_recv(xid, ses, server, 5496 5363 &rqst, &resp_buftype, flags, ··· 5508 5371 5509 5372 free_rsp_buf(resp_buftype, rsp); 5510 5373 kfree(iov); 5374 + 5375 + if (is_replayable_error(rc) && 5376 + smb2_should_replay(tcon, &retries, &cur_sleep)) 5377 + goto replay_again; 5378 + 5511 5379 return rc; 5512 5380 } 5513 5381 ··· 5565 5423 int rc; 5566 5424 struct smb2_oplock_break *req = NULL; 5567 5425 struct cifs_ses *ses = tcon->ses; 5568 - struct TCP_Server_Info *server = cifs_pick_channel(ses); 5426 + struct TCP_Server_Info *server; 5569 5427 int flags = CIFS_OBREAK_OP; 5570 5428 unsigned int total_len; 5571 5429 struct kvec iov[1]; 5572 5430 struct kvec rsp_iov; 5573 5431 int resp_buf_type; 5432 + int retries = 0, cur_sleep = 1; 5433 + 5434 + replay_again: 5435 + /* reinitialize for possible replay */ 5436 + flags = CIFS_OBREAK_OP; 5437 + server = cifs_pick_channel(ses); 5574 5438 5575 5439 cifs_dbg(FYI, "SMB2_oplock_break\n"); 5576 5440 rc = smb2_plain_req_init(SMB2_OPLOCK_BREAK, tcon, server, ··· 5601 5453 rqst.rq_iov = iov; 5602 5454 rqst.rq_nvec = 1; 5603 5455 5456 + if (retries) 5457 + smb2_set_replay(server, &rqst); 5458 + 5604 5459 rc = cifs_send_recv(xid, ses, server, 5605 5460 &rqst, &resp_buf_type, flags, &rsp_iov); 5606 5461 cifs_small_buf_release(req); 5607 - 5608 5462 if (rc) { 5609 5463 cifs_stats_fail_inc(tcon, SMB2_OPLOCK_BREAK_HE); 5610 5464 cifs_dbg(FYI, "Send error in Oplock Break = %d\n", rc); 5611 5465 } 5466 + 5467 + if (is_replayable_error(rc) && 5468 + smb2_should_replay(tcon, &retries, &cur_sleep)) 5469 + goto replay_again; 5612 5470 5613 5471 return rc; 5614 5472 } ··· 5701 5547 int rc = 0; 5702 5548 int resp_buftype; 5703 5549 struct cifs_ses *ses = tcon->ses; 5704 - struct TCP_Server_Info *server = cifs_pick_channel(ses); 5550 + struct TCP_Server_Info *server; 5705 5551 FILE_SYSTEM_POSIX_INFO *info = NULL; 5706 5552 int flags = 0; 5553 + int retries = 0, cur_sleep = 1; 5554 + 5555 + replay_again: 5556 + /* reinitialize for possible replay */ 5557 + flags = 0; 5558 + server = cifs_pick_channel(ses); 5707 5559 5708 5560 rc = build_qfs_info_req(&iov, tcon, server, 5709 5561 FS_POSIX_INFORMATION, ··· 5724 5564 memset(&rqst, 0, sizeof(struct smb_rqst)); 5725 5565 rqst.rq_iov = &iov; 5726 5566 rqst.rq_nvec = 1; 5567 + 5568 + if (retries) 5569 + smb2_set_replay(server, &rqst); 5727 5570 5728 5571 rc = cifs_send_recv(xid, ses, server, 5729 5572 &rqst, &resp_buftype, flags, &rsp_iov); ··· 5747 5584 5748 5585 posix_qfsinf_exit: 5749 5586 free_rsp_buf(resp_buftype, rsp_iov.iov_base); 5587 + 5588 + if (is_replayable_error(rc) && 5589 + smb2_should_replay(tcon, &retries, &cur_sleep)) 5590 + goto replay_again; 5591 + 5750 5592 return rc; 5751 5593 } 5752 5594 ··· 5766 5598 int rc = 0; 5767 5599 int resp_buftype; 5768 5600 struct cifs_ses *ses = tcon->ses; 5769 - struct TCP_Server_Info *server = cifs_pick_channel(ses); 5601 + struct TCP_Server_Info *server; 5770 5602 struct smb2_fs_full_size_info *info = NULL; 5771 5603 int flags = 0; 5604 + int retries = 0, cur_sleep = 1; 5605 + 5606 + replay_again: 5607 + /* reinitialize for possible replay */ 5608 + flags = 0; 5609 + server = cifs_pick_channel(ses); 5772 5610 5773 5611 rc = build_qfs_info_req(&iov, tcon, server, 5774 5612 FS_FULL_SIZE_INFORMATION, ··· 5789 5615 memset(&rqst, 0, sizeof(struct smb_rqst)); 5790 5616 rqst.rq_iov = &iov; 5791 5617 rqst.rq_nvec = 1; 5618 + 5619 + if (retries) 5620 + smb2_set_replay(server, &rqst); 5792 5621 5793 5622 rc = cifs_send_recv(xid, ses, server, 5794 5623 &rqst, &resp_buftype, flags, &rsp_iov); ··· 5812 5635 5813 5636 qfsinf_exit: 5814 5637 free_rsp_buf(resp_buftype, rsp_iov.iov_base); 5638 + 5639 + if (is_replayable_error(rc) && 5640 + smb2_should_replay(tcon, &retries, &cur_sleep)) 5641 + goto replay_again; 5642 + 5815 5643 return rc; 5816 5644 } 5817 5645 ··· 5831 5649 int rc = 0; 5832 5650 int resp_buftype, max_len, min_len; 5833 5651 struct cifs_ses *ses = tcon->ses; 5834 - struct TCP_Server_Info *server = cifs_pick_channel(ses); 5652 + struct TCP_Server_Info *server; 5835 5653 unsigned int rsp_len, offset; 5836 5654 int flags = 0; 5655 + int retries = 0, cur_sleep = 1; 5656 + 5657 + replay_again: 5658 + /* reinitialize for possible replay */ 5659 + flags = 0; 5660 + server = cifs_pick_channel(ses); 5837 5661 5838 5662 if (level == FS_DEVICE_INFORMATION) { 5839 5663 max_len = sizeof(FILE_SYSTEM_DEVICE_INFO); ··· 5870 5682 memset(&rqst, 0, sizeof(struct smb_rqst)); 5871 5683 rqst.rq_iov = &iov; 5872 5684 rqst.rq_nvec = 1; 5685 + 5686 + if (retries) 5687 + smb2_set_replay(server, &rqst); 5873 5688 5874 5689 rc = cifs_send_recv(xid, ses, server, 5875 5690 &rqst, &resp_buftype, flags, &rsp_iov); ··· 5911 5720 5912 5721 qfsattr_exit: 5913 5722 free_rsp_buf(resp_buftype, rsp_iov.iov_base); 5723 + 5724 + if (is_replayable_error(rc) && 5725 + smb2_should_replay(tcon, &retries, &cur_sleep)) 5726 + goto replay_again; 5727 + 5914 5728 return rc; 5915 5729 } 5916 5730 ··· 5933 5737 unsigned int count; 5934 5738 int flags = CIFS_NO_RSP_BUF; 5935 5739 unsigned int total_len; 5936 - struct TCP_Server_Info *server = cifs_pick_channel(tcon->ses); 5740 + struct TCP_Server_Info *server; 5741 + int retries = 0, cur_sleep = 1; 5742 + 5743 + replay_again: 5744 + /* reinitialize for possible replay */ 5745 + flags = CIFS_NO_RSP_BUF; 5746 + server = cifs_pick_channel(tcon->ses); 5937 5747 5938 5748 cifs_dbg(FYI, "smb2_lockv num lock %d\n", num_lock); 5939 5749 ··· 5970 5768 rqst.rq_iov = iov; 5971 5769 rqst.rq_nvec = 2; 5972 5770 5771 + if (retries) 5772 + smb2_set_replay(server, &rqst); 5773 + 5973 5774 rc = cifs_send_recv(xid, tcon->ses, server, 5974 5775 &rqst, &resp_buf_type, flags, 5975 5776 &rsp_iov); ··· 5983 5778 trace_smb3_lock_err(xid, persist_fid, tcon->tid, 5984 5779 tcon->ses->Suid, rc); 5985 5780 } 5781 + 5782 + if (is_replayable_error(rc) && 5783 + smb2_should_replay(tcon, &retries, &cur_sleep)) 5784 + goto replay_again; 5986 5785 5987 5786 return rc; 5988 5787 }
+5
fs/smb/client/smb2proto.h
··· 122 122 extern void smb2_set_next_command(struct cifs_tcon *tcon, 123 123 struct smb_rqst *rqst); 124 124 extern void smb2_set_related(struct smb_rqst *rqst); 125 + extern void smb2_set_replay(struct TCP_Server_Info *server, 126 + struct smb_rqst *rqst); 127 + extern bool smb2_should_replay(struct cifs_tcon *tcon, 128 + int *pretries, 129 + int *pcur_sleep); 125 130 126 131 /* 127 132 * SMB2 Worker functions - most of protocol specific implementation details
-7
fs/smb/client/smbencrypt.c
··· 26 26 #include "cifsproto.h" 27 27 #include "../common/md4.h" 28 28 29 - #ifndef false 30 - #define false 0 31 - #endif 32 - #ifndef true 33 - #define true 1 34 - #endif 35 - 36 29 /* following came from the other byteorder.h to avoid include conflicts */ 37 30 #define CVAL(buf,pos) (((unsigned char *)(buf))[pos]) 38 31 #define SSVALX(buf,pos,val) (CVAL(buf,pos)=(val)&0xFF,CVAL(buf,pos+1)=(val)>>8)
+12 -2
fs/smb/client/transport.c
··· 400 400 server->conn_id, server->hostname); 401 401 } 402 402 smbd_done: 403 - if (rc < 0 && rc != -EINTR) 403 + /* 404 + * there's hardly any use for the layers above to know the 405 + * actual error code here. All they should do at this point is 406 + * to retry the connection and hope it goes away. 407 + */ 408 + if (rc < 0 && rc != -EINTR && rc != -EAGAIN) { 404 409 cifs_server_dbg(VFS, "Error %d sending data on socket to server\n", 405 410 rc); 406 - else if (rc > 0) 411 + rc = -ECONNABORTED; 412 + cifs_signal_cifsd_for_reconnect(server, false); 413 + } else if (rc > 0) 407 414 rc = 0; 408 415 out: 409 416 cifs_in_send_dec(server); ··· 1031 1024 for (i = 0; i < ses->chan_count; i++) { 1032 1025 server = ses->chans[i].server; 1033 1026 if (!server || server->terminate) 1027 + continue; 1028 + 1029 + if (CIFS_CHAN_NEEDS_RECONNECT(ses, i)) 1034 1030 continue; 1035 1031 1036 1032 /*
+2 -1
fs/smb/server/ksmbd_netlink.h
··· 304 304 KSMBD_EVENT_SPNEGO_AUTHEN_REQUEST, 305 305 KSMBD_EVENT_SPNEGO_AUTHEN_RESPONSE = 15, 306 306 307 - KSMBD_EVENT_MAX 307 + __KSMBD_EVENT_MAX, 308 + KSMBD_EVENT_MAX = __KSMBD_EVENT_MAX - 1 308 309 }; 309 310 310 311 /*
+2 -2
fs/smb/server/transport_ipc.c
··· 74 74 static int handle_generic_event(struct sk_buff *skb, struct genl_info *info); 75 75 static int ksmbd_ipc_heartbeat_request(void); 76 76 77 - static const struct nla_policy ksmbd_nl_policy[KSMBD_EVENT_MAX] = { 77 + static const struct nla_policy ksmbd_nl_policy[KSMBD_EVENT_MAX + 1] = { 78 78 [KSMBD_EVENT_UNSPEC] = { 79 79 .len = 0, 80 80 }, ··· 403 403 return -EPERM; 404 404 #endif 405 405 406 - if (type >= KSMBD_EVENT_MAX) { 406 + if (type > KSMBD_EVENT_MAX) { 407 407 WARN_ON(1); 408 408 return -EINVAL; 409 409 }
+2
fs/smb/server/transport_tcp.c
··· 365 365 * @t: TCP transport instance 366 366 * @buf: buffer to store read data from socket 367 367 * @to_read: number of bytes to read from socket 368 + * @max_retries: number of retries if reading from socket fails 368 369 * 369 370 * Return: on success return number of bytes read from socket, 370 371 * otherwise return error number ··· 417 416 418 417 /** 419 418 * create_socket - create socket for ksmbd/0 419 + * @iface: interface to bind the created socket to 420 420 * 421 421 * Return: 0 on success, error number otherwise 422 422 */
+11 -3
fs/tracefs/event_inode.c
··· 34 34 35 35 /* Choose something "unique" ;-) */ 36 36 #define EVENTFS_FILE_INODE_INO 0x12c4e37 37 - #define EVENTFS_DIR_INODE_INO 0x134b2f5 37 + 38 + /* Just try to make something consistent and unique */ 39 + static int eventfs_dir_ino(struct eventfs_inode *ei) 40 + { 41 + if (!ei->ino) 42 + ei->ino = get_next_ino(); 43 + 44 + return ei->ino; 45 + } 38 46 39 47 /* 40 48 * The eventfs_inode (ei) itself is protected by SRCU. It is released from ··· 404 396 inode->i_fop = &eventfs_file_operations; 405 397 406 398 /* All directories will have the same inode number */ 407 - inode->i_ino = EVENTFS_DIR_INODE_INO; 399 + inode->i_ino = eventfs_dir_ino(ei); 408 400 409 401 ti = get_tracefs(inode); 410 402 ti->flags |= TRACEFS_EVENT_INODE; ··· 810 802 811 803 name = ei_child->name; 812 804 813 - ino = EVENTFS_DIR_INODE_INO; 805 + ino = eventfs_dir_ino(ei_child); 814 806 815 807 if (!dir_emit(ctx, name, strlen(name), ino, DT_DIR)) 816 808 goto out_dec;
+4 -3
fs/tracefs/internal.h
··· 55 55 struct eventfs_attr *entry_attrs; 56 56 struct eventfs_attr attr; 57 57 void *data; 58 + unsigned int is_freed:1; 59 + unsigned int is_events:1; 60 + unsigned int nr_entries:30; 61 + unsigned int ino; 58 62 /* 59 63 * Union - used for deletion 60 64 * @llist: for calling dput() if needed after RCU ··· 68 64 struct llist_node llist; 69 65 struct rcu_head rcu; 70 66 }; 71 - unsigned int is_freed:1; 72 - unsigned int is_events:1; 73 - unsigned int nr_entries:30; 74 67 }; 75 68 76 69 static inline struct tracefs_inode *get_tracefs(const struct inode *inode)
+17 -10
fs/xfs/xfs_super.c
··· 1496 1496 1497 1497 mp->m_super = sb; 1498 1498 1499 + /* 1500 + * Copy VFS mount flags from the context now that all parameter parsing 1501 + * is guaranteed to have been completed by either the old mount API or 1502 + * the newer fsopen/fsconfig API. 1503 + */ 1504 + if (fc->sb_flags & SB_RDONLY) 1505 + set_bit(XFS_OPSTATE_READONLY, &mp->m_opstate); 1506 + if (fc->sb_flags & SB_DIRSYNC) 1507 + mp->m_features |= XFS_FEAT_DIRSYNC; 1508 + if (fc->sb_flags & SB_SYNCHRONOUS) 1509 + mp->m_features |= XFS_FEAT_WSYNC; 1510 + 1499 1511 error = xfs_fs_validate_params(mp); 1500 1512 if (error) 1501 1513 return error; ··· 1977 1965 .free = xfs_fs_free, 1978 1966 }; 1979 1967 1968 + /* 1969 + * WARNING: do not initialise any parameters in this function that depend on 1970 + * mount option parsing having already been performed as this can be called from 1971 + * fsopen() before any parameters have been set. 1972 + */ 1980 1973 static int xfs_init_fs_context( 1981 1974 struct fs_context *fc) 1982 1975 { ··· 2012 1995 mp->m_logbufs = -1; 2013 1996 mp->m_logbsize = -1; 2014 1997 mp->m_allocsize_log = 16; /* 64k */ 2015 - 2016 - /* 2017 - * Copy binary VFS mount flags we are interested in. 2018 - */ 2019 - if (fc->sb_flags & SB_RDONLY) 2020 - set_bit(XFS_OPSTATE_READONLY, &mp->m_opstate); 2021 - if (fc->sb_flags & SB_DIRSYNC) 2022 - mp->m_features |= XFS_FEAT_DIRSYNC; 2023 - if (fc->sb_flags & SB_SYNCHRONOUS) 2024 - mp->m_features |= XFS_FEAT_WSYNC; 2025 1998 2026 1999 fc->s_fs_info = mp; 2027 2000 fc->ops = &xfs_context_ops;
+1 -1
include/linux/libata.h
··· 471 471 472 472 /* 473 473 * Link power management policy: If you alter this, you also need to 474 - * alter libata-scsi.c (for the ascii descriptions) 474 + * alter libata-sata.c (for the ascii descriptions) 475 475 */ 476 476 enum ata_lpm_policy { 477 477 ATA_LPM_UNKNOWN,
+1
include/linux/mlx5/driver.h
··· 681 681 struct mlx5_sq_bfreg bfreg; 682 682 #define MLX5_MAX_NUM_TC 8 683 683 u32 tisn[MLX5_MAX_PORTS][MLX5_MAX_NUM_TC]; 684 + bool tisn_valid; 684 685 } hw_objs; 685 686 struct net_device *uplink_netdev; 686 687 struct mutex uplink_netdev_lock;
+1
include/linux/mlx5/fs.h
··· 132 132 133 133 enum { 134 134 FLOW_CONTEXT_HAS_TAG = BIT(0), 135 + FLOW_CONTEXT_UPLINK_HAIRPIN_EN = BIT(1), 135 136 }; 136 137 137 138 struct mlx5_flow_context {
+8 -4
include/linux/mlx5/mlx5_ifc.h
··· 3576 3576 u8 action[0x10]; 3577 3577 3578 3578 u8 extended_destination[0x1]; 3579 - u8 reserved_at_81[0x1]; 3579 + u8 uplink_hairpin_en[0x1]; 3580 3580 u8 flow_source[0x2]; 3581 3581 u8 encrypt_decrypt_type[0x4]; 3582 3582 u8 destination_list_size[0x18]; ··· 4036 4036 u8 affiliation_criteria[0x4]; 4037 4037 u8 affiliated_vhca_id[0x10]; 4038 4038 4039 - u8 reserved_at_60[0xd0]; 4039 + u8 reserved_at_60[0xa0]; 4040 4040 4041 + u8 reserved_at_100[0x1]; 4042 + u8 sd_group[0x3]; 4043 + u8 reserved_at_104[0x1c]; 4044 + 4045 + u8 reserved_at_120[0x10]; 4041 4046 u8 mtu[0x10]; 4042 4047 4043 4048 u8 system_image_guid[0x40]; ··· 10127 10122 u8 reserved_at_20[0x20]; 10128 10123 10129 10124 u8 local_port[0x8]; 10130 - u8 reserved_at_28[0x15]; 10131 - u8 sd_group[0x3]; 10125 + u8 reserved_at_28[0x18]; 10132 10126 10133 10127 u8 reserved_at_60[0x20]; 10134 10128 };
+1
include/linux/mlx5/vport.h
··· 72 72 int mlx5_modify_nic_vport_mtu(struct mlx5_core_dev *mdev, u16 mtu); 73 73 int mlx5_query_nic_vport_system_image_guid(struct mlx5_core_dev *mdev, 74 74 u64 *system_image_guid); 75 + int mlx5_query_nic_vport_sd_group(struct mlx5_core_dev *mdev, u8 *sd_group); 75 76 int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid); 76 77 int mlx5_modify_nic_vport_node_guid(struct mlx5_core_dev *mdev, 77 78 u16 vport, u64 node_guid);
+1 -1
include/linux/sched.h
··· 920 920 unsigned sched_rt_mutex:1; 921 921 #endif 922 922 923 - /* Bit to tell LSMs we're in execve(): */ 923 + /* Bit to tell TOMOYO we're in execve(): */ 924 924 unsigned in_execve:1; 925 925 unsigned in_iowait:1; 926 926 #ifndef TIF_RESTORE_SIGMASK
-6
include/linux/skmsg.h
··· 505 505 return !!psock->saved_data_ready; 506 506 } 507 507 508 - static inline bool sk_is_udp(const struct sock *sk) 509 - { 510 - return sk->sk_type == SOCK_DGRAM && 511 - sk->sk_protocol == IPPROTO_UDP; 512 - } 513 - 514 508 #if IS_ENABLED(CONFIG_NET_SOCK_MSG) 515 509 516 510 #define BPF_F_STRPARSER (1UL << 1)
+1 -1
include/linux/spi/spi.h
··· 21 21 #include <uapi/linux/spi/spi.h> 22 22 23 23 /* Max no. of CS supported per spi device */ 24 - #define SPI_CS_CNT_MAX 4 24 + #define SPI_CS_CNT_MAX 16 25 25 26 26 struct dma_chan; 27 27 struct software_node;
+1
include/linux/syscalls.h
··· 128 128 #define __TYPE_IS_LL(t) (__TYPE_AS(t, 0LL) || __TYPE_AS(t, 0ULL)) 129 129 #define __SC_LONG(t, a) __typeof(__builtin_choose_expr(__TYPE_IS_LL(t), 0LL, 0L)) a 130 130 #define __SC_CAST(t, a) (__force t) a 131 + #define __SC_TYPE(t, a) t 131 132 #define __SC_ARGS(t, a) a 132 133 #define __SC_TEST(t, a) (void)BUILD_BUG_ON_ZERO(!__TYPE_IS_LL(t) && sizeof(t) > sizeof(long)) 133 134
+8
include/net/inet_connection_sock.h
··· 357 357 return inet_test_bit(IS_ICSK, sk) && !!inet_csk(sk)->icsk_ulp_ops; 358 358 } 359 359 360 + static inline void inet_init_csk_locks(struct sock *sk) 361 + { 362 + struct inet_connection_sock *icsk = inet_csk(sk); 363 + 364 + spin_lock_init(&icsk->icsk_accept_queue.rskq_lock); 365 + spin_lock_init(&icsk->icsk_accept_queue.fastopenq.lock); 366 + } 367 + 360 368 #endif /* _INET_CONNECTION_SOCK_H */
-5
include/net/inet_sock.h
··· 307 307 #define inet_assign_bit(nr, sk, val) \ 308 308 assign_bit(INET_FLAGS_##nr, &inet_sk(sk)->inet_flags, val) 309 309 310 - static inline bool sk_is_inet(struct sock *sk) 311 - { 312 - return sk->sk_family == AF_INET || sk->sk_family == AF_INET6; 313 - } 314 - 315 310 /** 316 311 * sk_to_full_sk - Access to a full socket 317 312 * @sk: pointer to a socket
+2 -4
include/net/llc_pdu.h
··· 262 262 */ 263 263 static inline void llc_pdu_decode_sa(struct sk_buff *skb, u8 *sa) 264 264 { 265 - if (skb->protocol == htons(ETH_P_802_2)) 266 - memcpy(sa, eth_hdr(skb)->h_source, ETH_ALEN); 265 + memcpy(sa, eth_hdr(skb)->h_source, ETH_ALEN); 267 266 } 268 267 269 268 /** ··· 274 275 */ 275 276 static inline void llc_pdu_decode_da(struct sk_buff *skb, u8 *da) 276 277 { 277 - if (skb->protocol == htons(ETH_P_802_2)) 278 - memcpy(da, eth_hdr(skb)->h_dest, ETH_ALEN); 278 + memcpy(da, eth_hdr(skb)->h_dest, ETH_ALEN); 279 279 } 280 280 281 281 /**
+39 -10
include/net/netfilter/nf_tables.h
··· 205 205 * @nla: netlink attributes 206 206 * @portid: netlink portID of the original message 207 207 * @seq: netlink sequence number 208 + * @flags: modifiers to new request 208 209 * @family: protocol family 209 210 * @level: depth of the chains 210 211 * @report: notify via unicast netlink message ··· 283 282 * 284 283 * @key: element key 285 284 * @key_end: closing element key 285 + * @data: element data 286 286 * @priv: element private data and extensions 287 287 */ 288 288 struct nft_set_elem { ··· 327 325 * @dtype: data type 328 326 * @dlen: data length 329 327 * @objtype: object type 330 - * @flags: flags 331 328 * @size: number of set elements 332 329 * @policy: set policy 333 330 * @gc_int: garbage collector interval 331 + * @timeout: element timeout 334 332 * @field_len: length of each field in concatenation, bytes 335 333 * @field_count: number of concatenated fields in element 336 334 * @expr: set must support for expressions ··· 353 351 /** 354 352 * enum nft_set_class - performance class 355 353 * 356 - * @NFT_LOOKUP_O_1: constant, O(1) 357 - * @NFT_LOOKUP_O_LOG_N: logarithmic, O(log N) 358 - * @NFT_LOOKUP_O_N: linear, O(N) 354 + * @NFT_SET_CLASS_O_1: constant, O(1) 355 + * @NFT_SET_CLASS_O_LOG_N: logarithmic, O(log N) 356 + * @NFT_SET_CLASS_O_N: linear, O(N) 359 357 */ 360 358 enum nft_set_class { 361 359 NFT_SET_CLASS_O_1, ··· 424 422 * @remove: remove element from set 425 423 * @walk: iterate over all set elements 426 424 * @get: get set elements 425 + * @commit: commit set elements 426 + * @abort: abort set elements 427 427 * @privsize: function to return size of set private data 428 + * @estimate: estimate the required memory size and the lookup complexity class 428 429 * @init: initialize private data of new set instance 429 430 * @destroy: destroy private data of set instance 431 + * @gc_init: initialize garbage collection 430 432 * @elemsize: element private size 431 433 * 432 434 * Operations lookup, update and delete have simpler interfaces, are faster ··· 546 540 * @policy: set parameterization (see enum nft_set_policies) 547 541 * @udlen: user data length 548 542 * @udata: user data 549 - * @expr: stateful expression 543 + * @pending_update: list of pending update set element 550 544 * @ops: set ops 551 545 * @flags: set flags 552 546 * @dead: set will be freed, never cleared 553 547 * @genmask: generation mask 554 548 * @klen: key length 555 549 * @dlen: data length 550 + * @num_exprs: numbers of exprs 551 + * @exprs: stateful expression 552 + * @catchall_list: list of catch-all set element 556 553 * @data: private set data 557 554 */ 558 555 struct nft_set { ··· 701 692 * 702 693 * @len: length of extension area 703 694 * @offset: offsets of individual extension types 695 + * @ext_len: length of the expected extension(used to sanity check) 704 696 */ 705 697 struct nft_set_ext_tmpl { 706 698 u16 len; ··· 850 840 * @select_ops: function to select nft_expr_ops 851 841 * @release_ops: release nft_expr_ops 852 842 * @ops: default ops, used when no select_ops functions is present 843 + * @inner_ops: inner ops, used for inner packet operation 853 844 * @list: used internally 854 845 * @name: Identifier 855 846 * @owner: module reference ··· 892 881 * struct nft_expr_ops - nf_tables expression operations 893 882 * 894 883 * @eval: Expression evaluation function 884 + * @clone: Expression clone function 895 885 * @size: full expression size, including private data size 896 886 * @init: initialization function 897 887 * @activate: activate expression in the next generation 898 888 * @deactivate: deactivate expression in next generation 899 889 * @destroy: destruction function, called after synchronize_rcu 890 + * @destroy_clone: destruction clone function 900 891 * @dump: function to dump parameters 901 - * @type: expression type 902 892 * @validate: validate expression, called during loop detection 893 + * @reduce: reduce expression 894 + * @gc: garbage collection expression 895 + * @offload: hardware offload expression 896 + * @offload_action: function to report true/false to allocate one slot or not in the flow 897 + * offload array 898 + * @offload_stats: function to synchronize hardware stats via updating the counter expression 899 + * @type: expression type 903 900 * @data: extra data to attach to this expression operation 904 901 */ 905 902 struct nft_expr_ops { ··· 1060 1041 /** 1061 1042 * struct nft_chain - nf_tables chain 1062 1043 * 1044 + * @blob_gen_0: rule blob pointer to the current generation 1045 + * @blob_gen_1: rule blob pointer to the future generation 1063 1046 * @rules: list of rules in the chain 1064 1047 * @list: used internally 1065 1048 * @rhlhead: used internally 1066 1049 * @table: table that this chain belongs to 1067 1050 * @handle: chain handle 1068 1051 * @use: number of jump references to this chain 1069 - * @flags: bitmask of enum nft_chain_flags 1052 + * @flags: bitmask of enum NFTA_CHAIN_FLAGS 1053 + * @bound: bind or not 1054 + * @genmask: generation mask 1070 1055 * @name: name of the chain 1056 + * @udlen: user data length 1057 + * @udata: user data in the chain 1058 + * @blob_next: rule blob pointer to the next in the chain 1071 1059 */ 1072 1060 struct nft_chain { 1073 1061 struct nft_rule_blob __rcu *blob_gen_0; ··· 1172 1146 * @hook_list: list of netfilter hooks (for NFPROTO_NETDEV family) 1173 1147 * @type: chain type 1174 1148 * @policy: default policy 1149 + * @flags: indicate the base chain disabled or not 1175 1150 * @stats: per-cpu chain stats 1176 1151 * @chain: the chain 1177 1152 * @flow_block: flow block (for hardware offload) ··· 1301 1274 * struct nft_object - nf_tables stateful object 1302 1275 * 1303 1276 * @list: table stateful object list node 1304 - * @key: keys that identify this object 1305 1277 * @rhlhead: nft_objname_ht node 1278 + * @key: keys that identify this object 1306 1279 * @genmask: generation mask 1307 1280 * @use: number of references to this stateful object 1308 1281 * @handle: unique object handle 1282 + * @udlen: length of user data 1283 + * @udata: user data 1309 1284 * @ops: object operations 1310 1285 * @data: object data, layout depends on type 1311 1286 */ ··· 1373 1344 * @destroy: release existing stateful object 1374 1345 * @dump: netlink dump stateful object 1375 1346 * @update: update stateful object 1347 + * @type: pointer to object type 1376 1348 */ 1377 1349 struct nft_object_ops { 1378 1350 void (*eval)(struct nft_object *obj, ··· 1409 1379 * @genmask: generation mask 1410 1380 * @use: number of references to this flow table 1411 1381 * @handle: unique object handle 1412 - * @dev_name: array of device names 1382 + * @hook_list: hook list for hooks per net_device in flowtables 1413 1383 * @data: rhashtable and garbage collector 1414 - * @ops: array of hooks 1415 1384 */ 1416 1385 struct nft_flowtable { 1417 1386 struct list_head list;
+4
include/net/sch_generic.h
··· 375 375 struct nlattr **tca, 376 376 struct netlink_ext_ack *extack); 377 377 void (*tmplt_destroy)(void *tmplt_priv); 378 + void (*tmplt_reoffload)(struct tcf_chain *chain, 379 + bool add, 380 + flow_setup_cb_t *cb, 381 + void *cb_priv); 378 382 struct tcf_exts * (*get_exts)(const struct tcf_proto *tp, 379 383 u32 handle); 380 384
+17 -1
include/net/sock.h
··· 2765 2765 &skb_shinfo(skb)->tskey); 2766 2766 } 2767 2767 2768 + static inline bool sk_is_inet(const struct sock *sk) 2769 + { 2770 + int family = READ_ONCE(sk->sk_family); 2771 + 2772 + return family == AF_INET || family == AF_INET6; 2773 + } 2774 + 2768 2775 static inline bool sk_is_tcp(const struct sock *sk) 2769 2776 { 2770 - return sk->sk_type == SOCK_STREAM && sk->sk_protocol == IPPROTO_TCP; 2777 + return sk_is_inet(sk) && 2778 + sk->sk_type == SOCK_STREAM && 2779 + sk->sk_protocol == IPPROTO_TCP; 2780 + } 2781 + 2782 + static inline bool sk_is_udp(const struct sock *sk) 2783 + { 2784 + return sk_is_inet(sk) && 2785 + sk->sk_type == SOCK_DGRAM && 2786 + sk->sk_protocol == IPPROTO_UDP; 2771 2787 } 2772 2788 2773 2789 static inline bool sk_is_stream_unix(const struct sock *sk)
+27
include/net/xdp_sock_drv.h
··· 159 159 return ret; 160 160 } 161 161 162 + static inline void xsk_buff_del_tail(struct xdp_buff *tail) 163 + { 164 + struct xdp_buff_xsk *xskb = container_of(tail, struct xdp_buff_xsk, xdp); 165 + 166 + list_del(&xskb->xskb_list_node); 167 + } 168 + 169 + static inline struct xdp_buff *xsk_buff_get_tail(struct xdp_buff *first) 170 + { 171 + struct xdp_buff_xsk *xskb = container_of(first, struct xdp_buff_xsk, xdp); 172 + struct xdp_buff_xsk *frag; 173 + 174 + frag = list_last_entry(&xskb->pool->xskb_list, struct xdp_buff_xsk, 175 + xskb_list_node); 176 + return &frag->xdp; 177 + } 178 + 162 179 static inline void xsk_buff_set_size(struct xdp_buff *xdp, u32 size) 163 180 { 164 181 xdp->data = xdp->data_hard_start + XDP_PACKET_HEADROOM; 165 182 xdp->data_meta = xdp->data; 166 183 xdp->data_end = xdp->data + size; 184 + xdp->flags = 0; 167 185 } 168 186 169 187 static inline dma_addr_t xsk_buff_raw_get_dma(struct xsk_buff_pool *pool, ··· 364 346 } 365 347 366 348 static inline struct xdp_buff *xsk_buff_get_frag(struct xdp_buff *first) 349 + { 350 + return NULL; 351 + } 352 + 353 + static inline void xsk_buff_del_tail(struct xdp_buff *tail) 354 + { 355 + } 356 + 357 + static inline struct xdp_buff *xsk_buff_get_tail(struct xdp_buff *first) 367 358 { 368 359 return NULL; 369 360 }
+6 -1
include/sound/cs35l56.h
··· 75 75 #define CS35L56_DSP1_AHBM_WINDOW_DEBUG_0 0x25E2040 76 76 #define CS35L56_DSP1_AHBM_WINDOW_DEBUG_1 0x25E2044 77 77 #define CS35L56_DSP1_XMEM_UNPACKED24_0 0x2800000 78 + #define CS35L56_DSP1_FW_VER 0x2800010 78 79 #define CS35L56_DSP1_HALO_STATE_A1 0x2801E58 79 80 #define CS35L56_DSP1_HALO_STATE 0x28021E0 80 81 #define CS35L56_DSP1_PM_CUR_STATE_A1 0x2804000 ··· 242 241 243 242 #define CS35L56_CONTROL_PORT_READY_US 2200 244 243 #define CS35L56_HALO_STATE_POLL_US 1000 245 - #define CS35L56_HALO_STATE_TIMEOUT_US 50000 244 + #define CS35L56_HALO_STATE_TIMEOUT_US 250000 246 245 #define CS35L56_RESET_PULSE_MIN_US 1100 247 246 #define CS35L56_WAKE_HOLD_TIME_US 1000 248 247 ··· 273 272 extern const unsigned int cs35l56_tx_input_values[CS35L56_NUM_INPUT_SRC]; 274 273 275 274 int cs35l56_set_patch(struct cs35l56_base *cs35l56_base); 275 + int cs35l56_force_sync_asp1_registers_from_cache(struct cs35l56_base *cs35l56_base); 276 276 int cs35l56_mbox_send(struct cs35l56_base *cs35l56_base, unsigned int command); 277 277 int cs35l56_firmware_shutdown(struct cs35l56_base *cs35l56_base); 278 278 int cs35l56_wait_for_firmware_boot(struct cs35l56_base *cs35l56_base); ··· 286 284 int cs35l56_runtime_suspend_common(struct cs35l56_base *cs35l56_base); 287 285 int cs35l56_runtime_resume_common(struct cs35l56_base *cs35l56_base, bool is_soundwire); 288 286 void cs35l56_init_cs_dsp(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_dsp); 287 + int cs35l56_read_prot_status(struct cs35l56_base *cs35l56_base, 288 + bool *fw_missing, unsigned int *fw_version); 289 289 int cs35l56_hw_init(struct cs35l56_base *cs35l56_base); 290 + int cs35l56_get_speaker_id(struct cs35l56_base *cs35l56_base); 290 291 int cs35l56_get_bclk_freq_id(unsigned int freq); 291 292 void cs35l56_fill_supply_names(struct regulator_bulk_data *data); 292 293
+25
include/trace/events/afs.h
··· 1071 1071 __print_symbolic(__entry->where, afs_file_errors)) 1072 1072 ); 1073 1073 1074 + TRACE_EVENT(afs_bulkstat_error, 1075 + TP_PROTO(struct afs_operation *op, struct afs_fid *fid, unsigned int index, s32 abort), 1076 + 1077 + TP_ARGS(op, fid, index, abort), 1078 + 1079 + TP_STRUCT__entry( 1080 + __field_struct(struct afs_fid, fid) 1081 + __field(unsigned int, op) 1082 + __field(unsigned int, index) 1083 + __field(s32, abort) 1084 + ), 1085 + 1086 + TP_fast_assign( 1087 + __entry->op = op->debug_id; 1088 + __entry->fid = *fid; 1089 + __entry->index = index; 1090 + __entry->abort = abort; 1091 + ), 1092 + 1093 + TP_printk("OP=%08x[%02x] %llx:%llx:%x a=%d", 1094 + __entry->op, __entry->index, 1095 + __entry->fid.vid, __entry->fid.vnode, __entry->fid.unique, 1096 + __entry->abort) 1097 + ); 1098 + 1074 1099 TRACE_EVENT(afs_cm_no_server, 1075 1100 TP_PROTO(struct afs_call *call, struct sockaddr_rxrpc *srx), 1076 1101
+20 -5
include/uapi/drm/ivpu_accel.h
··· 53 53 #define DRM_IVPU_PARAM_CORE_CLOCK_RATE 3 54 54 #define DRM_IVPU_PARAM_NUM_CONTEXTS 4 55 55 #define DRM_IVPU_PARAM_CONTEXT_BASE_ADDRESS 5 56 - #define DRM_IVPU_PARAM_CONTEXT_PRIORITY 6 56 + #define DRM_IVPU_PARAM_CONTEXT_PRIORITY 6 /* Deprecated */ 57 57 #define DRM_IVPU_PARAM_CONTEXT_ID 7 58 58 #define DRM_IVPU_PARAM_FW_API_VERSION 8 59 59 #define DRM_IVPU_PARAM_ENGINE_HEARTBEAT 9 ··· 64 64 65 65 #define DRM_IVPU_PLATFORM_TYPE_SILICON 0 66 66 67 + /* Deprecated, use DRM_IVPU_JOB_PRIORITY */ 67 68 #define DRM_IVPU_CONTEXT_PRIORITY_IDLE 0 68 69 #define DRM_IVPU_CONTEXT_PRIORITY_NORMAL 1 69 70 #define DRM_IVPU_CONTEXT_PRIORITY_FOCUS 2 70 71 #define DRM_IVPU_CONTEXT_PRIORITY_REALTIME 3 72 + 73 + #define DRM_IVPU_JOB_PRIORITY_DEFAULT 0 74 + #define DRM_IVPU_JOB_PRIORITY_IDLE 1 75 + #define DRM_IVPU_JOB_PRIORITY_NORMAL 2 76 + #define DRM_IVPU_JOB_PRIORITY_FOCUS 3 77 + #define DRM_IVPU_JOB_PRIORITY_REALTIME 4 71 78 72 79 /** 73 80 * DRM_IVPU_CAP_METRIC_STREAMER ··· 118 111 * 119 112 * %DRM_IVPU_PARAM_CONTEXT_BASE_ADDRESS: 120 113 * Lowest VPU virtual address available in the current context (read-only) 121 - * 122 - * %DRM_IVPU_PARAM_CONTEXT_PRIORITY: 123 - * Value of current context scheduling priority (read-write). 124 - * See DRM_IVPU_CONTEXT_PRIORITY_* for possible values. 125 114 * 126 115 * %DRM_IVPU_PARAM_CONTEXT_ID: 127 116 * Current context ID, always greater than 0 (read-only) ··· 289 286 * to be executed. The offset has to be 8-byte aligned. 290 287 */ 291 288 __u32 commands_offset; 289 + 290 + /** 291 + * @priority: 292 + * 293 + * Priority to be set for related job command queue, can be one of the following: 294 + * %DRM_IVPU_JOB_PRIORITY_DEFAULT 295 + * %DRM_IVPU_JOB_PRIORITY_IDLE 296 + * %DRM_IVPU_JOB_PRIORITY_NORMAL 297 + * %DRM_IVPU_JOB_PRIORITY_FOCUS 298 + * %DRM_IVPU_JOB_PRIORITY_REALTIME 299 + */ 300 + __u32 priority; 292 301 }; 293 302 294 303 /* drm_ivpu_bo_wait job status codes */
+3
include/uapi/linux/btrfs.h
··· 614 614 */ 615 615 #define BTRFS_DEFRAG_RANGE_COMPRESS 1 616 616 #define BTRFS_DEFRAG_RANGE_START_IO 2 617 + #define BTRFS_DEFRAG_RANGE_FLAGS_SUPP (BTRFS_DEFRAG_RANGE_COMPRESS | \ 618 + BTRFS_DEFRAG_RANGE_START_IO) 619 + 617 620 struct btrfs_ioctl_defrag_range_args { 618 621 /* start of the defrag operation */ 619 622 __u64 start;
+12
init/Kconfig
··· 876 876 bool 877 877 default y if CC_IS_GCC && GCC_VERSION >= 110000 && GCC11_NO_ARRAY_BOUNDS 878 878 879 + # Currently, disable -Wstringop-overflow for GCC 11, globally. 880 + config GCC11_NO_STRINGOP_OVERFLOW 881 + def_bool y 882 + 883 + config CC_NO_STRINGOP_OVERFLOW 884 + bool 885 + default y if CC_IS_GCC && GCC_VERSION >= 110000 && GCC_VERSION < 120000 && GCC11_NO_STRINGOP_OVERFLOW 886 + 887 + config CC_STRINGOP_OVERFLOW 888 + bool 889 + default y if CC_IS_GCC && !CC_NO_STRINGOP_OVERFLOW 890 + 879 891 # 880 892 # For architectures that know their GCC __int128 support is sound 881 893 #
-1
io_uring/opdef.c
··· 471 471 }, 472 472 [IORING_OP_FIXED_FD_INSTALL] = { 473 473 .needs_file = 1, 474 - .audit_skip = 1, 475 474 .prep = io_install_fixed_fd_prep, 476 475 .issue = io_install_fixed_fd, 477 476 },
+4
io_uring/openclose.c
··· 277 277 if (flags & ~IORING_FIXED_FD_NO_CLOEXEC) 278 278 return -EINVAL; 279 279 280 + /* ensure the task's creds are used when installing/receiving fds */ 281 + if (req->flags & REQ_F_CREDS) 282 + return -EPERM; 283 + 280 284 /* default to O_CLOEXEC, disable if IORING_FIXED_FD_NO_CLOEXEC is set */ 281 285 ifi = io_kiocb_to_cmd(req, struct io_fixed_install); 282 286 ifi->o_flags = O_CLOEXEC;
+1
kernel/fork.c
··· 1748 1748 if (clone_flags & CLONE_FS) { 1749 1749 /* tsk->fs is already what we want */ 1750 1750 spin_lock(&fs->lock); 1751 + /* "users" and "in_exec" locked for check_unsafe_exec() */ 1751 1752 if (fs->in_exec) { 1752 1753 spin_unlock(&fs->lock); 1753 1754 return -EAGAIN;
+12 -3
kernel/futex/core.c
··· 627 627 } 628 628 629 629 /* 630 - * PI futexes can not be requeued and must remove themselves from the 631 - * hash bucket. The hash bucket lock (i.e. lock_ptr) is held. 630 + * PI futexes can not be requeued and must remove themselves from the hash 631 + * bucket. The hash bucket lock (i.e. lock_ptr) is held. 632 632 */ 633 633 void futex_unqueue_pi(struct futex_q *q) 634 634 { 635 - __futex_unqueue(q); 635 + /* 636 + * If the lock was not acquired (due to timeout or signal) then the 637 + * rt_waiter is removed before futex_q is. If this is observed by 638 + * an unlocker after dropping the rtmutex wait lock and before 639 + * acquiring the hash bucket lock, then the unlocker dequeues the 640 + * futex_q from the hash bucket list to guarantee consistent state 641 + * vs. userspace. Therefore the dequeue here must be conditional. 642 + */ 643 + if (!plist_node_empty(&q->list)) 644 + __futex_unqueue(q); 636 645 637 646 BUG_ON(!q->pi_state); 638 647 put_pi_state(q->pi_state);
+8 -3
kernel/futex/pi.c
··· 1135 1135 1136 1136 hb = futex_hash(&key); 1137 1137 spin_lock(&hb->lock); 1138 + retry_hb: 1138 1139 1139 1140 /* 1140 1141 * Check waiters first. We do not trust user space values at ··· 1178 1177 /* 1179 1178 * Futex vs rt_mutex waiter state -- if there are no rt_mutex 1180 1179 * waiters even though futex thinks there are, then the waiter 1181 - * is leaving and the uncontended path is safe to take. 1180 + * is leaving. The entry needs to be removed from the list so a 1181 + * new futex_lock_pi() is not using this stale PI-state while 1182 + * the futex is available in user space again. 1183 + * There can be more than one task on its way out so it needs 1184 + * to retry. 1182 1185 */ 1183 1186 rt_waiter = rt_mutex_top_waiter(&pi_state->pi_mutex); 1184 1187 if (!rt_waiter) { 1188 + __futex_unqueue(top_waiter); 1185 1189 raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); 1186 - goto do_uncontended; 1190 + goto retry_hb; 1187 1191 } 1188 1192 1189 1193 get_pi_state(pi_state); ··· 1223 1217 return ret; 1224 1218 } 1225 1219 1226 - do_uncontended: 1227 1220 /* 1228 1221 * We have no kernel internal state, i.e. no waiters in the 1229 1222 * kernel. Waiters which are about to queue themselves are stuck
+1 -1
kernel/irq/irqdesc.c
··· 600 600 mutex_init(&desc[i].request_mutex); 601 601 init_waitqueue_head(&desc[i].wait_for_threads); 602 602 desc_set_defaults(i, &desc[i], node, NULL, NULL); 603 - irq_resend_init(desc); 603 + irq_resend_init(&desc[i]); 604 604 } 605 605 return arch_early_irq_init(); 606 606 }
+33 -1
kernel/rcu/tree.c
··· 1013 1013 return needmore; 1014 1014 } 1015 1015 1016 + static void swake_up_one_online_ipi(void *arg) 1017 + { 1018 + struct swait_queue_head *wqh = arg; 1019 + 1020 + swake_up_one(wqh); 1021 + } 1022 + 1023 + static void swake_up_one_online(struct swait_queue_head *wqh) 1024 + { 1025 + int cpu = get_cpu(); 1026 + 1027 + /* 1028 + * If called from rcutree_report_cpu_starting(), wake up 1029 + * is dangerous that late in the CPU-down hotplug process. The 1030 + * scheduler might queue an ignored hrtimer. Defer the wake up 1031 + * to an online CPU instead. 1032 + */ 1033 + if (unlikely(cpu_is_offline(cpu))) { 1034 + int target; 1035 + 1036 + target = cpumask_any_and(housekeeping_cpumask(HK_TYPE_RCU), 1037 + cpu_online_mask); 1038 + 1039 + smp_call_function_single(target, swake_up_one_online_ipi, 1040 + wqh, 0); 1041 + put_cpu(); 1042 + } else { 1043 + put_cpu(); 1044 + swake_up_one(wqh); 1045 + } 1046 + } 1047 + 1016 1048 /* 1017 1049 * Awaken the grace-period kthread. Don't do a self-awaken (unless in an 1018 1050 * interrupt or softirq handler, in which case we just might immediately ··· 1069 1037 return; 1070 1038 WRITE_ONCE(rcu_state.gp_wake_time, jiffies); 1071 1039 WRITE_ONCE(rcu_state.gp_wake_seq, READ_ONCE(rcu_state.gp_seq)); 1072 - swake_up_one(&rcu_state.gp_wq); 1040 + swake_up_one_online(&rcu_state.gp_wq); 1073 1041 } 1074 1042 1075 1043 /*
+1 -2
kernel/rcu/tree_exp.h
··· 173 173 return ret; 174 174 } 175 175 176 - 177 176 /* 178 177 * Report the exit from RCU read-side critical section for the last task 179 178 * that queued itself during or before the current expedited preemptible-RCU ··· 200 201 raw_spin_unlock_irqrestore_rcu_node(rnp, flags); 201 202 if (wake) { 202 203 smp_mb(); /* EGP done before wake_up(). */ 203 - swake_up_one(&rcu_state.expedited_wq); 204 + swake_up_one_online(&rcu_state.expedited_wq); 204 205 } 205 206 break; 206 207 }
+24 -1
kernel/time/clocksource.c
··· 99 99 * Interval: 0.5sec. 100 100 */ 101 101 #define WATCHDOG_INTERVAL (HZ >> 1) 102 + #define WATCHDOG_INTERVAL_MAX_NS ((2 * WATCHDOG_INTERVAL) * (NSEC_PER_SEC / HZ)) 102 103 103 104 /* 104 105 * Threshold: 0.0312s, when doubled: 0.0625s. ··· 135 134 static DEFINE_SPINLOCK(watchdog_lock); 136 135 static int watchdog_running; 137 136 static atomic_t watchdog_reset_pending; 137 + static int64_t watchdog_max_interval; 138 138 139 139 static inline void clocksource_watchdog_lock(unsigned long *flags) 140 140 { ··· 401 399 static void clocksource_watchdog(struct timer_list *unused) 402 400 { 403 401 u64 csnow, wdnow, cslast, wdlast, delta; 402 + int64_t wd_nsec, cs_nsec, interval; 404 403 int next_cpu, reset_pending; 405 - int64_t wd_nsec, cs_nsec; 406 404 struct clocksource *cs; 407 405 enum wd_read_status read_ret; 408 406 unsigned long extra_wait = 0; ··· 471 469 472 470 if (atomic_read(&watchdog_reset_pending)) 473 471 continue; 472 + 473 + /* 474 + * The processing of timer softirqs can get delayed (usually 475 + * on account of ksoftirqd not getting to run in a timely 476 + * manner), which causes the watchdog interval to stretch. 477 + * Skew detection may fail for longer watchdog intervals 478 + * on account of fixed margins being used. 479 + * Some clocksources, e.g. acpi_pm, cannot tolerate 480 + * watchdog intervals longer than a few seconds. 481 + */ 482 + interval = max(cs_nsec, wd_nsec); 483 + if (unlikely(interval > WATCHDOG_INTERVAL_MAX_NS)) { 484 + if (system_state > SYSTEM_SCHEDULING && 485 + interval > 2 * watchdog_max_interval) { 486 + watchdog_max_interval = interval; 487 + pr_warn("Long readout interval, skipping watchdog check: cs_nsec: %lld wd_nsec: %lld\n", 488 + cs_nsec, wd_nsec); 489 + } 490 + watchdog_timer.expires = jiffies; 491 + continue; 492 + } 474 493 475 494 /* Check the deviation from the watchdog clocksource. */ 476 495 md = cs->uncertainty_margin + watchdog->uncertainty_margin;
+5
kernel/time/tick-sched.c
··· 1577 1577 { 1578 1578 struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu); 1579 1579 ktime_t idle_sleeptime, iowait_sleeptime; 1580 + unsigned long idle_calls, idle_sleeps; 1580 1581 1581 1582 # ifdef CONFIG_HIGH_RES_TIMERS 1582 1583 if (ts->sched_timer.base) ··· 1586 1585 1587 1586 idle_sleeptime = ts->idle_sleeptime; 1588 1587 iowait_sleeptime = ts->iowait_sleeptime; 1588 + idle_calls = ts->idle_calls; 1589 + idle_sleeps = ts->idle_sleeps; 1589 1590 memset(ts, 0, sizeof(*ts)); 1590 1591 ts->idle_sleeptime = idle_sleeptime; 1591 1592 ts->iowait_sleeptime = iowait_sleeptime; 1593 + ts->idle_calls = idle_calls; 1594 + ts->idle_sleeps = idle_sleeps; 1592 1595 } 1593 1596 #endif 1594 1597
+6 -1
kernel/trace/tracing_map.c
··· 574 574 } 575 575 576 576 memcpy(elt->key, key, map->key_size); 577 - entry->val = elt; 577 + /* 578 + * Ensure the initialization is visible and 579 + * publish the elt. 580 + */ 581 + smp_wmb(); 582 + WRITE_ONCE(entry->val, elt); 578 583 atomic64_inc(&map->hits); 579 584 580 585 return entry->val;
+3
mm/memblock.c
··· 2176 2176 start = region->base; 2177 2177 end = start + region->size; 2178 2178 2179 + if (nid == NUMA_NO_NODE || nid >= MAX_NUMNODES) 2180 + nid = early_pfn_to_nid(PFN_DOWN(start)); 2181 + 2179 2182 reserve_bootmem_region(start, end, nid); 2180 2183 } 2181 2184 }
+4
net/8021q/vlan_netlink.c
··· 118 118 } 119 119 if (data[IFLA_VLAN_INGRESS_QOS]) { 120 120 nla_for_each_nested(attr, data[IFLA_VLAN_INGRESS_QOS], rem) { 121 + if (nla_type(attr) != IFLA_VLAN_QOS_MAPPING) 122 + continue; 121 123 m = nla_data(attr); 122 124 vlan_dev_set_ingress_priority(dev, m->to, m->from); 123 125 } 124 126 } 125 127 if (data[IFLA_VLAN_EGRESS_QOS]) { 126 128 nla_for_each_nested(attr, data[IFLA_VLAN_EGRESS_QOS], rem) { 129 + if (nla_type(attr) != IFLA_VLAN_QOS_MAPPING) 130 + continue; 127 131 m = nla_data(attr); 128 132 err = vlan_dev_set_egress_priority(dev, m->from, m->to); 129 133 if (err)
+9
net/core/dev.c
··· 11551 11551 11552 11552 static void __net_exit default_device_exit_net(struct net *net) 11553 11553 { 11554 + struct netdev_name_node *name_node, *tmp; 11554 11555 struct net_device *dev, *aux; 11555 11556 /* 11556 11557 * Push all migratable network devices back to the ··· 11574 11573 snprintf(fb_name, IFNAMSIZ, "dev%d", dev->ifindex); 11575 11574 if (netdev_name_in_use(&init_net, fb_name)) 11576 11575 snprintf(fb_name, IFNAMSIZ, "dev%%d"); 11576 + 11577 + netdev_for_each_altname_safe(dev, name_node, tmp) 11578 + if (netdev_name_in_use(&init_net, name_node->name)) { 11579 + netdev_name_node_del(name_node); 11580 + synchronize_rcu(); 11581 + __netdev_name_node_alt_destroy(name_node); 11582 + } 11583 + 11577 11584 err = dev_change_net_namespace(dev, &init_net, fb_name); 11578 11585 if (err) { 11579 11586 pr_emerg("%s: failed to move %s to init_net: %d\n",
+3
net/core/dev.h
··· 63 63 64 64 #define netdev_for_each_altname(dev, namenode) \ 65 65 list_for_each_entry((namenode), &(dev)->name_node->list, list) 66 + #define netdev_for_each_altname_safe(dev, namenode, next) \ 67 + list_for_each_entry_safe((namenode), (next), &(dev)->name_node->list, \ 68 + list) 66 69 67 70 int netdev_name_node_alt_create(struct net_device *dev, const char *name); 68 71 int netdev_name_node_alt_destroy(struct net_device *dev, const char *name);
+38 -6
net/core/filter.c
··· 83 83 #include <net/netfilter/nf_conntrack_bpf.h> 84 84 #include <net/netkit.h> 85 85 #include <linux/un.h> 86 + #include <net/xdp_sock_drv.h> 86 87 87 88 #include "dev.h" 88 89 ··· 4093 4092 memset(skb_frag_address(frag) + skb_frag_size(frag), 0, offset); 4094 4093 skb_frag_size_add(frag, offset); 4095 4094 sinfo->xdp_frags_size += offset; 4095 + if (rxq->mem.type == MEM_TYPE_XSK_BUFF_POOL) 4096 + xsk_buff_get_tail(xdp)->data_end += offset; 4096 4097 4097 4098 return 0; 4099 + } 4100 + 4101 + static void bpf_xdp_shrink_data_zc(struct xdp_buff *xdp, int shrink, 4102 + struct xdp_mem_info *mem_info, bool release) 4103 + { 4104 + struct xdp_buff *zc_frag = xsk_buff_get_tail(xdp); 4105 + 4106 + if (release) { 4107 + xsk_buff_del_tail(zc_frag); 4108 + __xdp_return(NULL, mem_info, false, zc_frag); 4109 + } else { 4110 + zc_frag->data_end -= shrink; 4111 + } 4112 + } 4113 + 4114 + static bool bpf_xdp_shrink_data(struct xdp_buff *xdp, skb_frag_t *frag, 4115 + int shrink) 4116 + { 4117 + struct xdp_mem_info *mem_info = &xdp->rxq->mem; 4118 + bool release = skb_frag_size(frag) == shrink; 4119 + 4120 + if (mem_info->type == MEM_TYPE_XSK_BUFF_POOL) { 4121 + bpf_xdp_shrink_data_zc(xdp, shrink, mem_info, release); 4122 + goto out; 4123 + } 4124 + 4125 + if (release) { 4126 + struct page *page = skb_frag_page(frag); 4127 + 4128 + __xdp_return(page_address(page), mem_info, false, NULL); 4129 + } 4130 + 4131 + out: 4132 + return release; 4098 4133 } 4099 4134 4100 4135 static int bpf_xdp_frags_shrink_tail(struct xdp_buff *xdp, int offset) ··· 4147 4110 4148 4111 len_free += shrink; 4149 4112 offset -= shrink; 4150 - 4151 - if (skb_frag_size(frag) == shrink) { 4152 - struct page *page = skb_frag_page(frag); 4153 - 4154 - __xdp_return(page_address(page), &xdp->rxq->mem, 4155 - false, NULL); 4113 + if (bpf_xdp_shrink_data(xdp, frag, shrink)) { 4156 4114 n_frags_free++; 4157 4115 } else { 4158 4116 skb_frag_size_sub(frag, shrink);
-3
net/core/request_sock.c
··· 33 33 34 34 void reqsk_queue_alloc(struct request_sock_queue *queue) 35 35 { 36 - spin_lock_init(&queue->rskq_lock); 37 - 38 - spin_lock_init(&queue->fastopenq.lock); 39 36 queue->fastopenq.rskq_rst_head = NULL; 40 37 queue->fastopenq.rskq_rst_tail = NULL; 41 38 queue->fastopenq.qlen = 0;
+9 -2
net/core/sock.c
··· 107 107 #include <linux/interrupt.h> 108 108 #include <linux/poll.h> 109 109 #include <linux/tcp.h> 110 + #include <linux/udp.h> 110 111 #include <linux/init.h> 111 112 #include <linux/highmem.h> 112 113 #include <linux/user_namespace.h> ··· 4145 4144 { 4146 4145 struct sock *sk = p; 4147 4146 4148 - return !skb_queue_empty_lockless(&sk->sk_receive_queue) || 4149 - sk_busy_loop_timeout(sk, start_time); 4147 + if (!skb_queue_empty_lockless(&sk->sk_receive_queue)) 4148 + return true; 4149 + 4150 + if (sk_is_udp(sk) && 4151 + !skb_queue_empty_lockless(&udp_sk(sk)->reader_queue)) 4152 + return true; 4153 + 4154 + return sk_busy_loop_timeout(sk, start_time); 4150 4155 } 4151 4156 EXPORT_SYMBOL(sk_busy_loop_end); 4152 4157 #endif /* CONFIG_NET_RX_BUSY_POLL */
+3
net/ipv4/af_inet.c
··· 330 330 if (INET_PROTOSW_REUSE & answer_flags) 331 331 sk->sk_reuse = SK_CAN_REUSE; 332 332 333 + if (INET_PROTOSW_ICSK & answer_flags) 334 + inet_init_csk_locks(sk); 335 + 333 336 inet = inet_sk(sk); 334 337 inet_assign_bit(IS_ICSK, sk, INET_PROTOSW_ICSK & answer_flags); 335 338
+4
net/ipv4/inet_connection_sock.c
··· 727 727 } 728 728 if (req) 729 729 reqsk_put(req); 730 + 731 + if (newsk) 732 + inet_init_csk_locks(newsk); 733 + 730 734 return newsk; 731 735 out_err: 732 736 newsk = NULL;
+1
net/ipv4/tcp.c
··· 722 722 if (!test_bit(TSQ_THROTTLED, &sk->sk_tsq_flags)) { 723 723 NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPAUTOCORKING); 724 724 set_bit(TSQ_THROTTLED, &sk->sk_tsq_flags); 725 + smp_mb__after_atomic(); 725 726 } 726 727 /* It is possible TX completion already happened 727 728 * before we set TSQ_THROTTLED.
+3
net/ipv6/af_inet6.c
··· 199 199 if (INET_PROTOSW_REUSE & answer_flags) 200 200 sk->sk_reuse = SK_CAN_REUSE; 201 201 202 + if (INET_PROTOSW_ICSK & answer_flags) 203 + inet_init_csk_locks(sk); 204 + 202 205 inet = inet_sk(sk); 203 206 inet_assign_bit(IS_ICSK, sk, INET_PROTOSW_ICSK & answer_flags); 204 207
+16 -8
net/llc/af_llc.c
··· 928 928 */ 929 929 static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) 930 930 { 931 + DECLARE_SOCKADDR(struct sockaddr_llc *, addr, msg->msg_name); 931 932 struct sock *sk = sock->sk; 932 933 struct llc_sock *llc = llc_sk(sk); 933 - DECLARE_SOCKADDR(struct sockaddr_llc *, addr, msg->msg_name); 934 934 int flags = msg->msg_flags; 935 935 int noblock = flags & MSG_DONTWAIT; 936 + int rc = -EINVAL, copied = 0, hdrlen, hh_len; 936 937 struct sk_buff *skb = NULL; 938 + struct net_device *dev; 937 939 size_t size = 0; 938 - int rc = -EINVAL, copied = 0, hdrlen; 939 940 940 941 dprintk("%s: sending from %02X to %02X\n", __func__, 941 942 llc->laddr.lsap, llc->daddr.lsap); ··· 956 955 if (rc) 957 956 goto out; 958 957 } 959 - hdrlen = llc->dev->hard_header_len + llc_ui_header_len(sk, addr); 958 + dev = llc->dev; 959 + hh_len = LL_RESERVED_SPACE(dev); 960 + hdrlen = llc_ui_header_len(sk, addr); 960 961 size = hdrlen + len; 961 - if (size > llc->dev->mtu) 962 - size = llc->dev->mtu; 962 + size = min_t(size_t, size, READ_ONCE(dev->mtu)); 963 963 copied = size - hdrlen; 964 964 rc = -EINVAL; 965 965 if (copied < 0) 966 966 goto out; 967 967 release_sock(sk); 968 - skb = sock_alloc_send_skb(sk, size, noblock, &rc); 968 + skb = sock_alloc_send_skb(sk, hh_len + size, noblock, &rc); 969 969 lock_sock(sk); 970 970 if (!skb) 971 971 goto out; 972 - skb->dev = llc->dev; 972 + if (sock_flag(sk, SOCK_ZAPPED) || 973 + llc->dev != dev || 974 + hdrlen != llc_ui_header_len(sk, addr) || 975 + hh_len != LL_RESERVED_SPACE(dev) || 976 + size > READ_ONCE(dev->mtu)) 977 + goto out; 978 + skb->dev = dev; 973 979 skb->protocol = llc_proto_type(addr->sllc_arphrd); 974 - skb_reserve(skb, hdrlen); 980 + skb_reserve(skb, hh_len + hdrlen); 975 981 rc = memcpy_from_msg(skb_put(skb, copied), msg, copied); 976 982 if (rc) 977 983 goto out;
-7
net/llc/llc_core.c
··· 135 135 .func = llc_rcv, 136 136 }; 137 137 138 - static struct packet_type llc_tr_packet_type __read_mostly = { 139 - .type = cpu_to_be16(ETH_P_TR_802_2), 140 - .func = llc_rcv, 141 - }; 142 - 143 138 static int __init llc_init(void) 144 139 { 145 140 dev_add_pack(&llc_packet_type); 146 - dev_add_pack(&llc_tr_packet_type); 147 141 return 0; 148 142 } 149 143 150 144 static void __exit llc_exit(void) 151 145 { 152 146 dev_remove_pack(&llc_packet_type); 153 - dev_remove_pack(&llc_tr_packet_type); 154 147 } 155 148 156 149 module_init(llc_init);
-1
net/mac80211/Kconfig
··· 62 62 depends on KUNIT 63 63 depends on MAC80211 64 64 default KUNIT_ALL_TESTS 65 - depends on !KERNEL_6_2 66 65 help 67 66 Enable this option to test mac80211 internals with kunit. 68 67
+6 -1
net/mac80211/sta_info.c
··· 404 404 int i; 405 405 406 406 for (i = 0; i < ARRAY_SIZE(sta->link); i++) { 407 - if (!(sta->sta.valid_links & BIT(i))) 407 + struct link_sta_info *link_sta; 408 + 409 + link_sta = rcu_access_pointer(sta->link[i]); 410 + if (!link_sta) 408 411 continue; 409 412 410 413 sta_remove_link(sta, i, false); ··· 912 909 913 910 if (ieee80211_vif_is_mesh(&sdata->vif)) 914 911 mesh_accept_plinks_update(sdata); 912 + 913 + ieee80211_check_fast_xmit(sta); 915 914 916 915 return 0; 917 916 out_remove:
+1 -1
net/mac80211/tx.c
··· 3048 3048 sdata->vif.type == NL80211_IFTYPE_STATION) 3049 3049 goto out; 3050 3050 3051 - if (!test_sta_flag(sta, WLAN_STA_AUTHORIZED)) 3051 + if (!test_sta_flag(sta, WLAN_STA_AUTHORIZED) || !sta->uploaded) 3052 3052 goto out; 3053 3053 3054 3054 if (test_sta_flag(sta, WLAN_STA_PS_STA) ||
+10 -10
net/netfilter/nf_tables_api.c
··· 24 24 #include <net/sock.h> 25 25 26 26 #define NFT_MODULE_AUTOLOAD_LIMIT (MODULE_NAME_LEN - sizeof("nft-expr-255-")) 27 + #define NFT_SET_MAX_ANONLEN 16 27 28 28 29 unsigned int nf_tables_net_id __read_mostly; 29 30 ··· 4412 4411 p = strchr(name, '%'); 4413 4412 if (p != NULL) { 4414 4413 if (p[1] != 'd' || strchr(p + 2, '%')) 4414 + return -EINVAL; 4415 + 4416 + if (strnlen(name, NFT_SET_MAX_ANONLEN) >= NFT_SET_MAX_ANONLEN) 4415 4417 return -EINVAL; 4416 4418 4417 4419 inuse = (unsigned long *)get_zeroed_page(GFP_KERNEL); ··· 10992 10988 data->verdict.code = ntohl(nla_get_be32(tb[NFTA_VERDICT_CODE])); 10993 10989 10994 10990 switch (data->verdict.code) { 10995 - default: 10996 - switch (data->verdict.code & NF_VERDICT_MASK) { 10997 - case NF_ACCEPT: 10998 - case NF_DROP: 10999 - case NF_QUEUE: 11000 - break; 11001 - default: 11002 - return -EINVAL; 11003 - } 11004 - fallthrough; 10991 + case NF_ACCEPT: 10992 + case NF_DROP: 10993 + case NF_QUEUE: 10994 + break; 11005 10995 case NFT_CONTINUE: 11006 10996 case NFT_BREAK: 11007 10997 case NFT_RETURN: ··· 11030 11032 11031 11033 data->verdict.chain = chain; 11032 11034 break; 11035 + default: 11036 + return -EINVAL; 11033 11037 } 11034 11038 11035 11039 desc->len = sizeof(data->verdict);
+9 -2
net/netfilter/nft_chain_filter.c
··· 357 357 unsigned long event, void *ptr) 358 358 { 359 359 struct net_device *dev = netdev_notifier_info_to_dev(ptr); 360 + struct nft_base_chain *basechain; 360 361 struct nftables_pernet *nft_net; 361 - struct nft_table *table; 362 362 struct nft_chain *chain, *nr; 363 + struct nft_table *table; 363 364 struct nft_ctx ctx = { 364 365 .net = dev_net(dev), 365 366 }; ··· 372 371 nft_net = nft_pernet(ctx.net); 373 372 mutex_lock(&nft_net->commit_mutex); 374 373 list_for_each_entry(table, &nft_net->tables, list) { 375 - if (table->family != NFPROTO_NETDEV) 374 + if (table->family != NFPROTO_NETDEV && 375 + table->family != NFPROTO_INET) 376 376 continue; 377 377 378 378 ctx.family = table->family; 379 379 ctx.table = table; 380 380 list_for_each_entry_safe(chain, nr, &table->chains, list) { 381 381 if (!nft_is_base_chain(chain)) 382 + continue; 383 + 384 + basechain = nft_base_chain(chain); 385 + if (table->family == NFPROTO_INET && 386 + basechain->ops.hooknum != NF_INET_INGRESS) 382 387 continue; 383 388 384 389 ctx.chain = chain;
+12
net/netfilter/nft_compat.c
··· 350 350 unsigned int hook_mask = 0; 351 351 int ret; 352 352 353 + if (ctx->family != NFPROTO_IPV4 && 354 + ctx->family != NFPROTO_IPV6 && 355 + ctx->family != NFPROTO_BRIDGE && 356 + ctx->family != NFPROTO_ARP) 357 + return -EOPNOTSUPP; 358 + 353 359 if (nft_is_base_chain(ctx->chain)) { 354 360 const struct nft_base_chain *basechain = 355 361 nft_base_chain(ctx->chain); ··· 600 594 struct xt_match *match = expr->ops->data; 601 595 unsigned int hook_mask = 0; 602 596 int ret; 597 + 598 + if (ctx->family != NFPROTO_IPV4 && 599 + ctx->family != NFPROTO_IPV6 && 600 + ctx->family != NFPROTO_BRIDGE && 601 + ctx->family != NFPROTO_ARP) 602 + return -EOPNOTSUPP; 603 603 604 604 if (nft_is_base_chain(ctx->chain)) { 605 605 const struct nft_base_chain *basechain =
+5
net/netfilter/nft_flow_offload.c
··· 384 384 { 385 385 unsigned int hook_mask = (1 << NF_INET_FORWARD); 386 386 387 + if (ctx->family != NFPROTO_IPV4 && 388 + ctx->family != NFPROTO_IPV6 && 389 + ctx->family != NFPROTO_INET) 390 + return -EOPNOTSUPP; 391 + 387 392 return nft_chain_validate_hooks(ctx->chain, hook_mask); 388 393 } 389 394
+16 -7
net/netfilter/nft_limit.c
··· 58 58 static int nft_limit_init(struct nft_limit_priv *priv, 59 59 const struct nlattr * const tb[], bool pkts) 60 60 { 61 + u64 unit, tokens, rate_with_burst; 61 62 bool invert = false; 62 - u64 unit, tokens; 63 63 64 64 if (tb[NFTA_LIMIT_RATE] == NULL || 65 65 tb[NFTA_LIMIT_UNIT] == NULL) 66 66 return -EINVAL; 67 67 68 68 priv->rate = be64_to_cpu(nla_get_be64(tb[NFTA_LIMIT_RATE])); 69 + if (priv->rate == 0) 70 + return -EINVAL; 71 + 69 72 unit = be64_to_cpu(nla_get_be64(tb[NFTA_LIMIT_UNIT])); 70 - priv->nsecs = unit * NSEC_PER_SEC; 71 - if (priv->rate == 0 || priv->nsecs < unit) 73 + if (check_mul_overflow(unit, NSEC_PER_SEC, &priv->nsecs)) 72 74 return -EOVERFLOW; 73 75 74 76 if (tb[NFTA_LIMIT_BURST]) ··· 79 77 if (pkts && priv->burst == 0) 80 78 priv->burst = NFT_LIMIT_PKT_BURST_DEFAULT; 81 79 82 - if (priv->rate + priv->burst < priv->rate) 80 + if (check_add_overflow(priv->rate, priv->burst, &rate_with_burst)) 83 81 return -EOVERFLOW; 84 82 85 83 if (pkts) { 86 - tokens = div64_u64(priv->nsecs, priv->rate) * priv->burst; 84 + u64 tmp = div64_u64(priv->nsecs, priv->rate); 85 + 86 + if (check_mul_overflow(tmp, priv->burst, &tokens)) 87 + return -EOVERFLOW; 87 88 } else { 89 + u64 tmp; 90 + 88 91 /* The token bucket size limits the number of tokens can be 89 92 * accumulated. tokens_max specifies the bucket size. 90 93 * tokens_max = unit * (rate + burst) / rate. 91 94 */ 92 - tokens = div64_u64(priv->nsecs * (priv->rate + priv->burst), 93 - priv->rate); 95 + if (check_mul_overflow(priv->nsecs, rate_with_burst, &tmp)) 96 + return -EOVERFLOW; 97 + 98 + tokens = div64_u64(tmp, priv->rate); 94 99 } 95 100 96 101 if (tb[NFTA_LIMIT_FLAGS]) {
+5
net/netfilter/nft_nat.c
··· 143 143 struct nft_nat *priv = nft_expr_priv(expr); 144 144 int err; 145 145 146 + if (ctx->family != NFPROTO_IPV4 && 147 + ctx->family != NFPROTO_IPV6 && 148 + ctx->family != NFPROTO_INET) 149 + return -EOPNOTSUPP; 150 + 146 151 err = nft_chain_validate_dependency(ctx->chain, NFT_CHAIN_T_NAT); 147 152 if (err < 0) 148 153 return err;
+5
net/netfilter/nft_rt.c
··· 166 166 const struct nft_rt *priv = nft_expr_priv(expr); 167 167 unsigned int hooks; 168 168 169 + if (ctx->family != NFPROTO_IPV4 && 170 + ctx->family != NFPROTO_IPV6 && 171 + ctx->family != NFPROTO_INET) 172 + return -EOPNOTSUPP; 173 + 169 174 switch (priv->key) { 170 175 case NFT_RT_NEXTHOP4: 171 176 case NFT_RT_NEXTHOP6:
+5
net/netfilter/nft_socket.c
··· 242 242 const struct nft_expr *expr, 243 243 const struct nft_data **data) 244 244 { 245 + if (ctx->family != NFPROTO_IPV4 && 246 + ctx->family != NFPROTO_IPV6 && 247 + ctx->family != NFPROTO_INET) 248 + return -EOPNOTSUPP; 249 + 245 250 return nft_chain_validate_hooks(ctx->chain, 246 251 (1 << NF_INET_PRE_ROUTING) | 247 252 (1 << NF_INET_LOCAL_IN) |
+5 -2
net/netfilter/nft_synproxy.c
··· 186 186 break; 187 187 #endif 188 188 case NFPROTO_INET: 189 - case NFPROTO_BRIDGE: 190 189 err = nf_synproxy_ipv4_init(snet, ctx->net); 191 190 if (err) 192 191 goto nf_ct_failure; ··· 218 219 break; 219 220 #endif 220 221 case NFPROTO_INET: 221 - case NFPROTO_BRIDGE: 222 222 nf_synproxy_ipv4_fini(snet, ctx->net); 223 223 nf_synproxy_ipv6_fini(snet, ctx->net); 224 224 break; ··· 251 253 const struct nft_expr *expr, 252 254 const struct nft_data **data) 253 255 { 256 + if (ctx->family != NFPROTO_IPV4 && 257 + ctx->family != NFPROTO_IPV6 && 258 + ctx->family != NFPROTO_INET) 259 + return -EOPNOTSUPP; 260 + 254 261 return nft_chain_validate_hooks(ctx->chain, (1 << NF_INET_LOCAL_IN) | 255 262 (1 << NF_INET_FORWARD)); 256 263 }
+5
net/netfilter/nft_tproxy.c
··· 316 316 const struct nft_expr *expr, 317 317 const struct nft_data **data) 318 318 { 319 + if (ctx->family != NFPROTO_IPV4 && 320 + ctx->family != NFPROTO_IPV6 && 321 + ctx->family != NFPROTO_INET) 322 + return -EOPNOTSUPP; 323 + 319 324 return nft_chain_validate_hooks(ctx->chain, 1 << NF_INET_PRE_ROUTING); 320 325 } 321 326
+5
net/netfilter/nft_xfrm.c
··· 235 235 const struct nft_xfrm *priv = nft_expr_priv(expr); 236 236 unsigned int hooks; 237 237 238 + if (ctx->family != NFPROTO_IPV4 && 239 + ctx->family != NFPROTO_IPV6 && 240 + ctx->family != NFPROTO_INET) 241 + return -EOPNOTSUPP; 242 + 238 243 switch (priv->dir) { 239 244 case XFRM_POLICY_IN: 240 245 hooks = (1 << NF_INET_FORWARD) |
+1 -1
net/netlink/af_netlink.c
··· 374 374 if (is_vmalloc_addr(skb->head)) { 375 375 if (!skb->cloned || 376 376 !atomic_dec_return(&(skb_shinfo(skb)->dataref))) 377 - vfree(skb->head); 377 + vfree_atomic(skb->head); 378 378 379 379 skb->head = NULL; 380 380 }
+1 -1
net/rds/af_rds.c
··· 419 419 420 420 rs->rs_rx_traces = trace.rx_traces; 421 421 for (i = 0; i < rs->rs_rx_traces; i++) { 422 - if (trace.rx_trace_pos[i] > RDS_MSG_RX_DGRAM_TRACE_MAX) { 422 + if (trace.rx_trace_pos[i] >= RDS_MSG_RX_DGRAM_TRACE_MAX) { 423 423 rs->rs_rx_traces = 0; 424 424 return -EFAULT; 425 425 }
+8 -1
net/sched/cls_api.c
··· 1560 1560 chain_prev = chain, 1561 1561 chain = __tcf_get_next_chain(block, chain), 1562 1562 tcf_chain_put(chain_prev)) { 1563 + if (chain->tmplt_ops && add) 1564 + chain->tmplt_ops->tmplt_reoffload(chain, true, cb, 1565 + cb_priv); 1563 1566 for (tp = __tcf_get_next_proto(chain, NULL); tp; 1564 1567 tp_prev = tp, 1565 1568 tp = __tcf_get_next_proto(chain, tp), ··· 1578 1575 goto err_playback_remove; 1579 1576 } 1580 1577 } 1578 + if (chain->tmplt_ops && !add) 1579 + chain->tmplt_ops->tmplt_reoffload(chain, false, cb, 1580 + cb_priv); 1581 1581 } 1582 1582 1583 1583 return 0; ··· 3006 3000 ops = tcf_proto_lookup_ops(name, true, extack); 3007 3001 if (IS_ERR(ops)) 3008 3002 return PTR_ERR(ops); 3009 - if (!ops->tmplt_create || !ops->tmplt_destroy || !ops->tmplt_dump) { 3003 + if (!ops->tmplt_create || !ops->tmplt_destroy || !ops->tmplt_dump || 3004 + !ops->tmplt_reoffload) { 3010 3005 NL_SET_ERR_MSG(extack, "Chain templates are not supported with specified classifier"); 3011 3006 module_put(ops->owner); 3012 3007 return -EOPNOTSUPP;
+23
net/sched/cls_flower.c
··· 2721 2721 kfree(tmplt); 2722 2722 } 2723 2723 2724 + static void fl_tmplt_reoffload(struct tcf_chain *chain, bool add, 2725 + flow_setup_cb_t *cb, void *cb_priv) 2726 + { 2727 + struct fl_flow_tmplt *tmplt = chain->tmplt_priv; 2728 + struct flow_cls_offload cls_flower = {}; 2729 + 2730 + cls_flower.rule = flow_rule_alloc(0); 2731 + if (!cls_flower.rule) 2732 + return; 2733 + 2734 + cls_flower.common.chain_index = chain->index; 2735 + cls_flower.command = add ? FLOW_CLS_TMPLT_CREATE : 2736 + FLOW_CLS_TMPLT_DESTROY; 2737 + cls_flower.cookie = (unsigned long) tmplt; 2738 + cls_flower.rule->match.dissector = &tmplt->dissector; 2739 + cls_flower.rule->match.mask = &tmplt->mask; 2740 + cls_flower.rule->match.key = &tmplt->dummy_key; 2741 + 2742 + cb(TC_SETUP_CLSFLOWER, &cls_flower, cb_priv); 2743 + kfree(cls_flower.rule); 2744 + } 2745 + 2724 2746 static int fl_dump_key_val(struct sk_buff *skb, 2725 2747 void *val, int val_type, 2726 2748 void *mask, int mask_type, int len) ··· 3650 3628 .bind_class = fl_bind_class, 3651 3629 .tmplt_create = fl_tmplt_create, 3652 3630 .tmplt_destroy = fl_tmplt_destroy, 3631 + .tmplt_reoffload = fl_tmplt_reoffload, 3653 3632 .tmplt_dump = fl_tmplt_dump, 3654 3633 .get_exts = fl_get_exts, 3655 3634 .owner = THIS_MODULE,
+1 -1
net/smc/smc_diag.c
··· 164 164 } 165 165 if (smc_conn_lgr_valid(&smc->conn) && smc->conn.lgr->is_smcd && 166 166 (req->diag_ext & (1 << (SMC_DIAG_DMBINFO - 1))) && 167 - !list_empty(&smc->conn.lgr->list)) { 167 + !list_empty(&smc->conn.lgr->list) && smc->conn.rmb_desc) { 168 168 struct smc_connection *conn = &smc->conn; 169 169 struct smcd_diag_dmbinfo dinfo; 170 170 struct smcd_dev *smcd = conn->lgr->smcd;
+2 -2
net/sunrpc/svcsock.c
··· 717 717 ARRAY_SIZE(rqstp->rq_bvec), xdr); 718 718 719 719 iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, rqstp->rq_bvec, 720 - count, 0); 720 + count, rqstp->rq_res.len); 721 721 err = sock_sendmsg(svsk->sk_sock, &msg); 722 722 if (err == -ECONNREFUSED) { 723 723 /* ICMP error on earlier request. */ 724 724 iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, rqstp->rq_bvec, 725 - count, 0); 725 + count, rqstp->rq_res.len); 726 726 err = sock_sendmsg(svsk->sk_sock, &msg); 727 727 } 728 728
-1
net/wireless/Kconfig
··· 206 206 depends on KUNIT 207 207 depends on CFG80211 208 208 default KUNIT_ALL_TESTS 209 - depends on !KERNEL_6_2 210 209 help 211 210 Enable this option to test cfg80211 functions with kunit. 212 211
+1
net/wireless/nl80211.c
··· 4020 4020 } 4021 4021 wiphy_unlock(&rdev->wiphy); 4022 4022 4023 + if_start = 0; 4023 4024 wp_idx++; 4024 4025 } 4025 4026 out:
+8 -4
net/xdp/xsk.c
··· 167 167 contd = XDP_PKT_CONTD; 168 168 169 169 err = __xsk_rcv_zc(xs, xskb, len, contd); 170 - if (err || likely(!frags)) 171 - goto out; 170 + if (err) 171 + goto err; 172 + if (likely(!frags)) 173 + return 0; 172 174 173 175 xskb_list = &xskb->pool->xskb_list; 174 176 list_for_each_entry_safe(pos, tmp, xskb_list, xskb_list_node) { ··· 179 177 len = pos->xdp.data_end - pos->xdp.data; 180 178 err = __xsk_rcv_zc(xs, pos, len, contd); 181 179 if (err) 182 - return err; 180 + goto err; 183 181 list_del(&pos->xskb_list_node); 184 182 } 185 183 186 - out: 184 + return 0; 185 + err: 186 + xsk_buff_free(xdp); 187 187 return err; 188 188 } 189 189
+1
net/xdp/xsk_buff_pool.c
··· 555 555 556 556 xskb->xdp.data = xskb->xdp.data_hard_start + XDP_PACKET_HEADROOM; 557 557 xskb->xdp.data_meta = xskb->xdp.data; 558 + xskb->xdp.flags = 0; 558 559 559 560 if (pool->dma_need_sync) { 560 561 dma_sync_single_range_for_device(pool->dev, xskb->dma, 0,
+3
samples/cgroup/.gitignore
··· 1 + /cgroup_event_listener 2 + /memcg_event_listener 3 +
-2
scripts/Makefile.extrawarn
··· 97 97 KBUILD_CFLAGS += $(call cc-option, -Wpacked-not-aligned) 98 98 KBUILD_CFLAGS += $(call cc-option, -Wformat-overflow) 99 99 KBUILD_CFLAGS += $(call cc-option, -Wformat-truncation) 100 - KBUILD_CFLAGS += $(call cc-option, -Wstringop-overflow) 101 100 KBUILD_CFLAGS += $(call cc-option, -Wstringop-truncation) 102 101 103 102 KBUILD_CPPFLAGS += -Wundef ··· 112 113 KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned) 113 114 KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow) 114 115 KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation) 115 - KBUILD_CFLAGS += $(call cc-disable-warning, stringop-overflow) 116 116 KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation) 117 117 118 118 ifdef CONFIG_CC_IS_CLANG
+3 -1
security/apparmor/lsm.c
··· 469 469 * Cache permissions granted by the previous exec check, with 470 470 * implicit read and executable mmap which are required to 471 471 * actually execute the image. 472 + * 473 + * Illogically, FMODE_EXEC is in f_flags, not f_mode. 472 474 */ 473 - if (current->in_execve) { 475 + if (file->f_flags & __FMODE_EXEC) { 474 476 fctx->allow = MAY_EXEC | MAY_READ | AA_EXEC_MMAP; 475 477 return 0; 476 478 }
-4
security/keys/encrypted-keys/encrypted.c
··· 237 237 break; 238 238 } 239 239 *decrypted_data = strsep(&datablob, " \t"); 240 - if (!*decrypted_data) { 241 - pr_info("encrypted_key: decrypted_data is missing\n"); 242 - break; 243 - } 244 240 ret = 0; 245 241 break; 246 242 case Opt_load:
+2 -1
security/tomoyo/tomoyo.c
··· 328 328 static int tomoyo_file_open(struct file *f) 329 329 { 330 330 /* Don't check read permission here if called from execve(). */ 331 - if (current->in_execve) 331 + /* Illogically, FMODE_EXEC is in f_flags, not f_mode. */ 332 + if (f->f_flags & __FMODE_EXEC) 332 333 return 0; 333 334 return tomoyo_check_open_permission(tomoyo_domain(), &f->f_path, 334 335 f->f_flags);
+78 -60
sound/pci/hda/cs35l56_hda.c
··· 30 30 * ASP1_RX_WL = 24 bits per sample 31 31 * ASP1_TX_WL = 24 bits per sample 32 32 * ASP1_RXn_EN 1..3 and ASP1_TXn_EN 1..4 disabled 33 + * 34 + * Override any Windows-specific mixer settings applied by the firmware. 33 35 */ 34 36 static const struct reg_sequence cs35l56_hda_dai_config[] = { 35 37 { CS35L56_ASP1_CONTROL1, 0x00000021 }, 36 38 { CS35L56_ASP1_CONTROL2, 0x20200200 }, 37 39 { CS35L56_ASP1_CONTROL3, 0x00000003 }, 40 + { CS35L56_ASP1_FRAME_CONTROL1, 0x03020100 }, 41 + { CS35L56_ASP1_FRAME_CONTROL5, 0x00020100 }, 38 42 { CS35L56_ASP1_DATA_CONTROL5, 0x00000018 }, 39 43 { CS35L56_ASP1_DATA_CONTROL1, 0x00000018 }, 40 44 { CS35L56_ASP1_ENABLES1, 0x00000000 }, 45 + { CS35L56_ASP1TX1_INPUT, 0x00000018 }, 46 + { CS35L56_ASP1TX2_INPUT, 0x00000019 }, 47 + { CS35L56_ASP1TX3_INPUT, 0x00000020 }, 48 + { CS35L56_ASP1TX4_INPUT, 0x00000028 }, 49 + 41 50 }; 42 51 43 52 static void cs35l56_hda_play(struct cs35l56_hda *cs35l56) ··· 141 132 goto err; 142 133 } 143 134 } 135 + 136 + ret = cs35l56_force_sync_asp1_registers_from_cache(&cs35l56->base); 137 + if (ret) 138 + goto err; 144 139 145 140 return 0; 146 141 ··· 397 384 398 385 static int cs35l56_hda_request_firmware_file(struct cs35l56_hda *cs35l56, 399 386 const struct firmware **firmware, char **filename, 400 - const char *dir, const char *system_name, 387 + const char *base_name, const char *system_name, 401 388 const char *amp_name, 402 389 const char *filetype) 403 390 { ··· 405 392 int ret = 0; 406 393 407 394 if (system_name && amp_name) 408 - *filename = kasprintf(GFP_KERNEL, "%scs35l56%s-%02x-dsp1-misc-%s-%s.%s", dir, 409 - cs35l56->base.secured ? "s" : "", cs35l56->base.rev, 395 + *filename = kasprintf(GFP_KERNEL, "%s-%s-%s.%s", base_name, 410 396 system_name, amp_name, filetype); 411 397 else if (system_name) 412 - *filename = kasprintf(GFP_KERNEL, "%scs35l56%s-%02x-dsp1-misc-%s.%s", dir, 413 - cs35l56->base.secured ? "s" : "", cs35l56->base.rev, 398 + *filename = kasprintf(GFP_KERNEL, "%s-%s.%s", base_name, 414 399 system_name, filetype); 415 400 else 416 - *filename = kasprintf(GFP_KERNEL, "%scs35l56%s-%02x-dsp1-misc.%s", dir, 417 - cs35l56->base.secured ? "s" : "", cs35l56->base.rev, 418 - filetype); 401 + *filename = kasprintf(GFP_KERNEL, "%s.%s", base_name, filetype); 419 402 420 403 if (!*filename) 421 404 return -ENOMEM; ··· 444 435 return 0; 445 436 } 446 437 447 - static const char cirrus_dir[] = "cirrus/"; 448 438 static void cs35l56_hda_request_firmware_files(struct cs35l56_hda *cs35l56, 439 + unsigned int preloaded_fw_ver, 449 440 const struct firmware **wmfw_firmware, 450 441 char **wmfw_filename, 451 442 const struct firmware **coeff_firmware, ··· 453 444 { 454 445 const char *system_name = cs35l56->system_name; 455 446 const char *amp_name = cs35l56->amp_name; 447 + char base_name[37]; 456 448 int ret; 449 + 450 + if (preloaded_fw_ver) { 451 + snprintf(base_name, sizeof(base_name), 452 + "cirrus/cs35l56-%02x%s-%06x-dsp1-misc", 453 + cs35l56->base.rev, 454 + cs35l56->base.secured ? "-s" : "", 455 + preloaded_fw_ver & 0xffffff); 456 + } else { 457 + snprintf(base_name, sizeof(base_name), 458 + "cirrus/cs35l56-%02x%s-dsp1-misc", 459 + cs35l56->base.rev, 460 + cs35l56->base.secured ? "-s" : ""); 461 + } 457 462 458 463 if (system_name && amp_name) { 459 464 if (!cs35l56_hda_request_firmware_file(cs35l56, wmfw_firmware, wmfw_filename, 460 - cirrus_dir, system_name, amp_name, "wmfw")) { 465 + base_name, system_name, amp_name, "wmfw")) { 461 466 cs35l56_hda_request_firmware_file(cs35l56, coeff_firmware, coeff_filename, 462 - cirrus_dir, system_name, amp_name, "bin"); 467 + base_name, system_name, amp_name, "bin"); 463 468 return; 464 469 } 465 470 } 466 471 467 472 if (system_name) { 468 473 if (!cs35l56_hda_request_firmware_file(cs35l56, wmfw_firmware, wmfw_filename, 469 - cirrus_dir, system_name, NULL, "wmfw")) { 474 + base_name, system_name, NULL, "wmfw")) { 470 475 if (amp_name) 471 476 cs35l56_hda_request_firmware_file(cs35l56, 472 477 coeff_firmware, coeff_filename, 473 - cirrus_dir, system_name, 478 + base_name, system_name, 474 479 amp_name, "bin"); 475 480 if (!*coeff_firmware) 476 481 cs35l56_hda_request_firmware_file(cs35l56, 477 482 coeff_firmware, coeff_filename, 478 - cirrus_dir, system_name, 483 + base_name, system_name, 479 484 NULL, "bin"); 480 485 return; 481 486 } 487 + 488 + /* 489 + * Check for system-specific bin files without wmfw before 490 + * falling back to generic firmware 491 + */ 492 + if (amp_name) 493 + cs35l56_hda_request_firmware_file(cs35l56, coeff_firmware, coeff_filename, 494 + base_name, system_name, amp_name, "bin"); 495 + if (!*coeff_firmware) 496 + cs35l56_hda_request_firmware_file(cs35l56, coeff_firmware, coeff_filename, 497 + base_name, system_name, NULL, "bin"); 498 + 499 + if (*coeff_firmware) 500 + return; 482 501 } 483 502 484 503 ret = cs35l56_hda_request_firmware_file(cs35l56, wmfw_firmware, wmfw_filename, 485 - cirrus_dir, NULL, NULL, "wmfw"); 504 + base_name, NULL, NULL, "wmfw"); 486 505 if (!ret) { 487 506 cs35l56_hda_request_firmware_file(cs35l56, coeff_firmware, coeff_filename, 488 - cirrus_dir, NULL, NULL, "bin"); 507 + base_name, NULL, NULL, "bin"); 489 508 return; 490 - } 491 - 492 - /* When a firmware file is not found must still search for the coeff files */ 493 - if (system_name) { 494 - if (amp_name) 495 - cs35l56_hda_request_firmware_file(cs35l56, coeff_firmware, coeff_filename, 496 - cirrus_dir, system_name, amp_name, "bin"); 497 - if (!*coeff_firmware) 498 - cs35l56_hda_request_firmware_file(cs35l56, coeff_firmware, coeff_filename, 499 - cirrus_dir, system_name, NULL, "bin"); 500 509 } 501 510 502 511 if (!*coeff_firmware) 503 512 cs35l56_hda_request_firmware_file(cs35l56, coeff_firmware, coeff_filename, 504 - cirrus_dir, NULL, NULL, "bin"); 513 + base_name, NULL, NULL, "bin"); 505 514 } 506 515 507 516 static void cs35l56_hda_release_firmware_files(const struct firmware *wmfw_firmware, ··· 553 526 const struct firmware *wmfw_firmware = NULL; 554 527 char *coeff_filename = NULL; 555 528 char *wmfw_filename = NULL; 556 - unsigned int firmware_missing; 529 + unsigned int preloaded_fw_ver; 530 + bool firmware_missing; 557 531 int ret = 0; 558 532 559 533 /* Prepare for a new DSP power-up */ ··· 565 537 566 538 pm_runtime_get_sync(cs35l56->base.dev); 567 539 568 - ret = regmap_read(cs35l56->base.regmap, CS35L56_PROTECTION_STATUS, &firmware_missing); 569 - if (ret) { 570 - dev_err(cs35l56->base.dev, "Failed to read PROTECTION_STATUS: %d\n", ret); 571 - goto err_pm_put; 572 - } 573 - 574 - firmware_missing &= CS35L56_FIRMWARE_MISSING; 575 - 576 540 /* 577 - * Firmware can only be downloaded if the CS35L56 is secured or is 578 - * running from the built-in ROM. If it is secured the BIOS will have 579 - * downloaded firmware, and the wmfw/bin files will only contain 580 - * tunings that are safe to download with the firmware running. 541 + * The firmware can only be upgraded if it is currently running 542 + * from the built-in ROM. If not, the wmfw/bin must be for the 543 + * version of firmware that is running on the chip. 581 544 */ 582 - if (cs35l56->base.secured || firmware_missing) { 583 - cs35l56_hda_request_firmware_files(cs35l56, &wmfw_firmware, &wmfw_filename, 584 - &coeff_firmware, &coeff_filename); 585 - } 545 + ret = cs35l56_read_prot_status(&cs35l56->base, &firmware_missing, &preloaded_fw_ver); 546 + if (ret) 547 + goto err_pm_put; 548 + 549 + if (firmware_missing) 550 + preloaded_fw_ver = 0; 551 + 552 + cs35l56_hda_request_firmware_files(cs35l56, preloaded_fw_ver, 553 + &wmfw_firmware, &wmfw_filename, 554 + &coeff_firmware, &coeff_filename); 586 555 587 556 /* 588 557 * If the BIOS didn't patch the firmware a bin file is mandatory to ··· 594 569 mutex_lock(&cs35l56->base.irq_lock); 595 570 596 571 /* 597 - * When the device is running in secure mode the firmware files can 598 - * only contain insecure tunings and therefore we do not need to 599 - * shutdown the firmware to apply them and can use the lower cost 600 - * reinit sequence instead. 572 + * If the firmware hasn't been patched it must be shutdown before 573 + * doing a full patch and reset afterwards. If it is already 574 + * running a patched version the firmware files only contain 575 + * tunings and we can use the lower cost reinit sequence instead. 601 576 */ 602 - if (!cs35l56->base.secured && (wmfw_firmware || coeff_firmware)) { 577 + if (firmware_missing && (wmfw_firmware || coeff_firmware)) { 603 578 ret = cs35l56_firmware_shutdown(&cs35l56->base); 604 579 if (ret) 605 580 goto err; ··· 618 593 if (coeff_filename) 619 594 dev_dbg(cs35l56->base.dev, "Loaded Coefficients: %s\n", coeff_filename); 620 595 621 - if (cs35l56->base.secured) { 596 + if (!firmware_missing) { 622 597 ret = cs35l56_mbox_send(&cs35l56->base, CS35L56_MBOX_CMD_AUDIO_REINIT); 623 598 if (ret) 624 599 goto err_powered_up; ··· 1001 976 1002 977 regmap_multi_reg_write(cs35l56->base.regmap, cs35l56_hda_dai_config, 1003 978 ARRAY_SIZE(cs35l56_hda_dai_config)); 979 + ret = cs35l56_force_sync_asp1_registers_from_cache(&cs35l56->base); 980 + if (ret) 981 + goto err; 1004 982 1005 983 /* 1006 984 * By default only enable one ASP1TXn, where n=amplifier index, ··· 1062 1034 cs35l56_hda_system_resume_no_irq) 1063 1035 }; 1064 1036 EXPORT_SYMBOL_NS_GPL(cs35l56_hda_pm_ops, SND_HDA_SCODEC_CS35L56); 1065 - 1066 - #if IS_ENABLED(CONFIG_SND_HDA_SCODEC_CS35L56_KUNIT_TEST) 1067 - /* Hooks to export static function to KUnit test */ 1068 - 1069 - int cs35l56_hda_test_hook_get_speaker_id(struct device *dev, int amp_index, int num_amps) 1070 - { 1071 - return cs35l56_hda_get_speaker_id(dev, amp_index, num_amps); 1072 - } 1073 - EXPORT_SYMBOL_NS_GPL(cs35l56_hda_test_hook_get_speaker_id, SND_HDA_SCODEC_CS35L56); 1074 - #endif 1075 1037 1076 1038 MODULE_DESCRIPTION("CS35L56 HDA Driver"); 1077 1039 MODULE_IMPORT_NS(SND_HDA_CIRRUS_SCODEC);
+122 -18
sound/soc/codecs/cs35l56-shared.c
··· 5 5 // Copyright (C) 2023 Cirrus Logic, Inc. and 6 6 // Cirrus Logic International Semiconductor Ltd. 7 7 8 + #include <linux/gpio/consumer.h> 8 9 #include <linux/regmap.h> 9 10 #include <linux/regulator/consumer.h> 10 11 #include <linux/types.h> ··· 13 12 #include "cs35l56.h" 14 13 15 14 static const struct reg_sequence cs35l56_patch[] = { 15 + /* 16 + * Firmware can change these to non-defaults to satisfy SDCA. 17 + * Ensure that they are at known defaults. 18 + */ 19 + { CS35L56_SWIRE_DP3_CH1_INPUT, 0x00000018 }, 20 + { CS35L56_SWIRE_DP3_CH2_INPUT, 0x00000019 }, 21 + { CS35L56_SWIRE_DP3_CH3_INPUT, 0x00000029 }, 22 + { CS35L56_SWIRE_DP3_CH4_INPUT, 0x00000028 }, 23 + 16 24 /* These are not reset by a soft-reset, so patch to defaults. */ 17 25 { CS35L56_MAIN_RENDER_USER_MUTE, 0x00000000 }, 18 26 { CS35L56_MAIN_RENDER_USER_VOLUME, 0x00000000 }, ··· 44 34 { CS35L56_ASP1_FRAME_CONTROL5, 0x00020100 }, 45 35 { CS35L56_ASP1_DATA_CONTROL1, 0x00000018 }, 46 36 { CS35L56_ASP1_DATA_CONTROL5, 0x00000018 }, 47 - { CS35L56_ASP1TX1_INPUT, 0x00000018 }, 48 - { CS35L56_ASP1TX2_INPUT, 0x00000019 }, 49 - { CS35L56_ASP1TX3_INPUT, 0x00000020 }, 50 - { CS35L56_ASP1TX4_INPUT, 0x00000028 }, 37 + 38 + /* no defaults for ASP1TX mixer */ 39 + 51 40 { CS35L56_SWIRE_DP3_CH1_INPUT, 0x00000018 }, 52 41 { CS35L56_SWIRE_DP3_CH2_INPUT, 0x00000019 }, 53 42 { CS35L56_SWIRE_DP3_CH3_INPUT, 0x00000029 }, ··· 203 194 return cs35l56_is_dsp_memory(reg); 204 195 } 205 196 } 197 + 198 + /* 199 + * The firmware boot sequence can overwrite the ASP1 config registers so that 200 + * they don't match regmap's view of their values. Rewrite the values from the 201 + * regmap cache into the hardware registers. 202 + */ 203 + int cs35l56_force_sync_asp1_registers_from_cache(struct cs35l56_base *cs35l56_base) 204 + { 205 + struct reg_sequence asp1_regs[] = { 206 + { .reg = CS35L56_ASP1_ENABLES1 }, 207 + { .reg = CS35L56_ASP1_CONTROL1 }, 208 + { .reg = CS35L56_ASP1_CONTROL2 }, 209 + { .reg = CS35L56_ASP1_CONTROL3 }, 210 + { .reg = CS35L56_ASP1_FRAME_CONTROL1 }, 211 + { .reg = CS35L56_ASP1_FRAME_CONTROL5 }, 212 + { .reg = CS35L56_ASP1_DATA_CONTROL1 }, 213 + { .reg = CS35L56_ASP1_DATA_CONTROL5 }, 214 + }; 215 + int i, ret; 216 + 217 + /* Read values from regmap cache into a write sequence */ 218 + for (i = 0; i < ARRAY_SIZE(asp1_regs); ++i) { 219 + ret = regmap_read(cs35l56_base->regmap, asp1_regs[i].reg, &asp1_regs[i].def); 220 + if (ret) 221 + goto err; 222 + } 223 + 224 + /* Write the values cache-bypassed so that they will be written to silicon */ 225 + ret = regmap_multi_reg_write_bypassed(cs35l56_base->regmap, asp1_regs, 226 + ARRAY_SIZE(asp1_regs)); 227 + if (ret) 228 + goto err; 229 + 230 + return 0; 231 + 232 + err: 233 + dev_err(cs35l56_base->dev, "Failed to sync ASP1 registers: %d\n", ret); 234 + 235 + return ret; 236 + } 237 + EXPORT_SYMBOL_NS_GPL(cs35l56_force_sync_asp1_registers_from_cache, SND_SOC_CS35L56_SHARED); 206 238 207 239 int cs35l56_mbox_send(struct cs35l56_base *cs35l56_base, unsigned int command) 208 240 { ··· 450 400 unsigned int val; 451 401 int ret; 452 402 453 - /* Nothing to re-patch if we haven't done any patching yet. */ 454 - if (!cs35l56_base->fw_patched) 455 - return false; 456 - 457 - /* 458 - * If we have control of RESET we will have asserted it so the firmware 459 - * will need re-patching. 460 - */ 461 - if (cs35l56_base->reset_gpio) 462 - return true; 463 - 464 403 /* 465 404 * In secure mode FIRMWARE_MISSING is cleared by the BIOS loader so 466 405 * can't be used here to test for memory retention. ··· 629 590 } 630 591 EXPORT_SYMBOL_NS_GPL(cs35l56_init_cs_dsp, SND_SOC_CS35L56_SHARED); 631 592 593 + int cs35l56_read_prot_status(struct cs35l56_base *cs35l56_base, 594 + bool *fw_missing, unsigned int *fw_version) 595 + { 596 + unsigned int prot_status; 597 + int ret; 598 + 599 + ret = regmap_read(cs35l56_base->regmap, CS35L56_PROTECTION_STATUS, &prot_status); 600 + if (ret) { 601 + dev_err(cs35l56_base->dev, "Get PROTECTION_STATUS failed: %d\n", ret); 602 + return ret; 603 + } 604 + 605 + *fw_missing = !!(prot_status & CS35L56_FIRMWARE_MISSING); 606 + 607 + ret = regmap_read(cs35l56_base->regmap, CS35L56_DSP1_FW_VER, fw_version); 608 + if (ret) { 609 + dev_err(cs35l56_base->dev, "Get FW VER failed: %d\n", ret); 610 + return ret; 611 + } 612 + 613 + return 0; 614 + } 615 + EXPORT_SYMBOL_NS_GPL(cs35l56_read_prot_status, SND_SOC_CS35L56_SHARED); 616 + 632 617 int cs35l56_hw_init(struct cs35l56_base *cs35l56_base) 633 618 { 634 619 int ret; 635 - unsigned int devid, revid, otpid, secured; 620 + unsigned int devid, revid, otpid, secured, fw_ver; 621 + bool fw_missing; 636 622 637 623 /* 638 624 * When the system is not using a reset_gpio ensure the device is ··· 716 652 return ret; 717 653 } 718 654 719 - dev_info(cs35l56_base->dev, "Cirrus Logic CS35L56%s Rev %02X OTP%d\n", 720 - cs35l56_base->secured ? "s" : "", cs35l56_base->rev, otpid); 655 + ret = cs35l56_read_prot_status(cs35l56_base, &fw_missing, &fw_ver); 656 + if (ret) 657 + return ret; 658 + 659 + dev_info(cs35l56_base->dev, "Cirrus Logic CS35L56%s Rev %02X OTP%d fw:%d.%d.%d (patched=%u)\n", 660 + cs35l56_base->secured ? "s" : "", cs35l56_base->rev, otpid, 661 + fw_ver >> 16, (fw_ver >> 8) & 0xff, fw_ver & 0xff, !fw_missing); 721 662 722 663 /* Wake source and *_BLOCKED interrupts default to unmasked, so mask them */ 723 664 regmap_write(cs35l56_base->regmap, CS35L56_IRQ1_MASK_20, 0xffffffff); ··· 736 667 return 0; 737 668 } 738 669 EXPORT_SYMBOL_NS_GPL(cs35l56_hw_init, SND_SOC_CS35L56_SHARED); 670 + 671 + int cs35l56_get_speaker_id(struct cs35l56_base *cs35l56_base) 672 + { 673 + struct gpio_descs *descs; 674 + int speaker_id; 675 + int i, ret; 676 + 677 + /* Read the speaker type qualifier from the motherboard GPIOs */ 678 + descs = gpiod_get_array_optional(cs35l56_base->dev, "spk-id", GPIOD_IN); 679 + if (!descs) { 680 + return -ENOENT; 681 + } else if (IS_ERR(descs)) { 682 + ret = PTR_ERR(descs); 683 + return dev_err_probe(cs35l56_base->dev, ret, "Failed to get spk-id-gpios\n"); 684 + } 685 + 686 + speaker_id = 0; 687 + for (i = 0; i < descs->ndescs; i++) { 688 + ret = gpiod_get_value_cansleep(descs->desc[i]); 689 + if (ret < 0) { 690 + dev_err_probe(cs35l56_base->dev, ret, "Failed to read spk-id[%d]\n", i); 691 + goto err; 692 + } 693 + 694 + speaker_id |= (ret << i); 695 + } 696 + 697 + dev_dbg(cs35l56_base->dev, "Speaker ID = %d\n", speaker_id); 698 + ret = speaker_id; 699 + err: 700 + gpiod_put_array(descs); 701 + 702 + return ret; 703 + } 704 + EXPORT_SYMBOL_NS_GPL(cs35l56_get_speaker_id, SND_SOC_CS35L56_SHARED); 739 705 740 706 static const u32 cs35l56_bclk_valid_for_pll_freq_table[] = { 741 707 [0x0C] = 128000,
+259 -48
sound/soc/codecs/cs35l56.c
··· 59 59 return snd_soc_put_volsw(kcontrol, ucontrol); 60 60 } 61 61 62 + static const unsigned short cs35l56_asp1_mixer_regs[] = { 63 + CS35L56_ASP1TX1_INPUT, CS35L56_ASP1TX2_INPUT, 64 + CS35L56_ASP1TX3_INPUT, CS35L56_ASP1TX4_INPUT, 65 + }; 66 + 67 + static const char * const cs35l56_asp1_mux_control_names[] = { 68 + "ASP1 TX1 Source", "ASP1 TX2 Source", "ASP1 TX3 Source", "ASP1 TX4 Source" 69 + }; 70 + 71 + static int cs35l56_dspwait_asp1tx_get(struct snd_kcontrol *kcontrol, 72 + struct snd_ctl_elem_value *ucontrol) 73 + { 74 + struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol); 75 + struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component); 76 + struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 77 + int index = e->shift_l; 78 + unsigned int addr, val; 79 + int ret; 80 + 81 + /* Wait for mux to be initialized */ 82 + cs35l56_wait_dsp_ready(cs35l56); 83 + flush_work(&cs35l56->mux_init_work); 84 + 85 + addr = cs35l56_asp1_mixer_regs[index]; 86 + ret = regmap_read(cs35l56->base.regmap, addr, &val); 87 + if (ret) 88 + return ret; 89 + 90 + val &= CS35L56_ASP_TXn_SRC_MASK; 91 + ucontrol->value.enumerated.item[0] = snd_soc_enum_val_to_item(e, val); 92 + 93 + return 0; 94 + } 95 + 96 + static int cs35l56_dspwait_asp1tx_put(struct snd_kcontrol *kcontrol, 97 + struct snd_ctl_elem_value *ucontrol) 98 + { 99 + struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol); 100 + struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol); 101 + struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component); 102 + struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 103 + int item = ucontrol->value.enumerated.item[0]; 104 + int index = e->shift_l; 105 + unsigned int addr, val; 106 + bool changed; 107 + int ret; 108 + 109 + /* Wait for mux to be initialized */ 110 + cs35l56_wait_dsp_ready(cs35l56); 111 + flush_work(&cs35l56->mux_init_work); 112 + 113 + addr = cs35l56_asp1_mixer_regs[index]; 114 + val = snd_soc_enum_item_to_val(e, item); 115 + 116 + ret = regmap_update_bits_check(cs35l56->base.regmap, addr, 117 + CS35L56_ASP_TXn_SRC_MASK, val, &changed); 118 + if (!ret) 119 + return ret; 120 + 121 + if (changed) 122 + snd_soc_dapm_mux_update_power(dapm, kcontrol, item, e, NULL); 123 + 124 + return changed; 125 + } 126 + 127 + static void cs35l56_mark_asp1_mixer_widgets_dirty(struct cs35l56_private *cs35l56) 128 + { 129 + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(cs35l56->component); 130 + const char *prefix = cs35l56->component->name_prefix; 131 + char full_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 132 + const char *name; 133 + struct snd_kcontrol *kcontrol; 134 + struct soc_enum *e; 135 + unsigned int val[4]; 136 + int i, item, ret; 137 + 138 + /* 139 + * Resume so we can read the registers from silicon if the regmap 140 + * cache has not yet been populated. 141 + */ 142 + ret = pm_runtime_resume_and_get(cs35l56->base.dev); 143 + if (ret < 0) 144 + return; 145 + 146 + ret = regmap_bulk_read(cs35l56->base.regmap, CS35L56_ASP1TX1_INPUT, 147 + val, ARRAY_SIZE(val)); 148 + 149 + pm_runtime_mark_last_busy(cs35l56->base.dev); 150 + pm_runtime_put_autosuspend(cs35l56->base.dev); 151 + 152 + if (ret) { 153 + dev_err(cs35l56->base.dev, "Failed to read ASP1 mixer regs: %d\n", ret); 154 + return; 155 + } 156 + 157 + snd_soc_card_mutex_lock(dapm->card); 158 + WARN_ON(!dapm->card->instantiated); 159 + 160 + for (i = 0; i < ARRAY_SIZE(cs35l56_asp1_mux_control_names); ++i) { 161 + name = cs35l56_asp1_mux_control_names[i]; 162 + 163 + if (prefix) { 164 + snprintf(full_name, sizeof(full_name), "%s %s", prefix, name); 165 + name = full_name; 166 + } 167 + 168 + kcontrol = snd_soc_card_get_kcontrol(dapm->card, name); 169 + if (!kcontrol) { 170 + dev_warn(cs35l56->base.dev, "Could not find control %s\n", name); 171 + continue; 172 + } 173 + 174 + e = (struct soc_enum *)kcontrol->private_value; 175 + item = snd_soc_enum_val_to_item(e, val[i] & CS35L56_ASP_TXn_SRC_MASK); 176 + snd_soc_dapm_mux_update_power(dapm, kcontrol, item, e, NULL); 177 + } 178 + 179 + snd_soc_card_mutex_unlock(dapm->card); 180 + } 181 + 182 + static void cs35l56_mux_init_work(struct work_struct *work) 183 + { 184 + struct cs35l56_private *cs35l56 = container_of(work, 185 + struct cs35l56_private, 186 + mux_init_work); 187 + 188 + cs35l56_mark_asp1_mixer_widgets_dirty(cs35l56); 189 + } 190 + 62 191 static DECLARE_TLV_DB_SCALE(vol_tlv, -10000, 25, 0); 63 192 64 193 static const struct snd_kcontrol_new cs35l56_controls[] = { ··· 206 77 }; 207 78 208 79 static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_asp1tx1_enum, 209 - CS35L56_ASP1TX1_INPUT, 210 - 0, CS35L56_ASP_TXn_SRC_MASK, 80 + SND_SOC_NOPM, 81 + 0, 0, 211 82 cs35l56_tx_input_texts, 212 83 cs35l56_tx_input_values); 213 84 214 85 static const struct snd_kcontrol_new asp1_tx1_mux = 215 - SOC_DAPM_ENUM("ASP1TX1 SRC", cs35l56_asp1tx1_enum); 86 + SOC_DAPM_ENUM_EXT("ASP1TX1 SRC", cs35l56_asp1tx1_enum, 87 + cs35l56_dspwait_asp1tx_get, cs35l56_dspwait_asp1tx_put); 216 88 217 89 static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_asp1tx2_enum, 218 - CS35L56_ASP1TX2_INPUT, 219 - 0, CS35L56_ASP_TXn_SRC_MASK, 90 + SND_SOC_NOPM, 91 + 1, 0, 220 92 cs35l56_tx_input_texts, 221 93 cs35l56_tx_input_values); 222 94 223 95 static const struct snd_kcontrol_new asp1_tx2_mux = 224 - SOC_DAPM_ENUM("ASP1TX2 SRC", cs35l56_asp1tx2_enum); 96 + SOC_DAPM_ENUM_EXT("ASP1TX2 SRC", cs35l56_asp1tx2_enum, 97 + cs35l56_dspwait_asp1tx_get, cs35l56_dspwait_asp1tx_put); 225 98 226 99 static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_asp1tx3_enum, 227 - CS35L56_ASP1TX3_INPUT, 228 - 0, CS35L56_ASP_TXn_SRC_MASK, 100 + SND_SOC_NOPM, 101 + 2, 0, 229 102 cs35l56_tx_input_texts, 230 103 cs35l56_tx_input_values); 231 104 232 105 static const struct snd_kcontrol_new asp1_tx3_mux = 233 - SOC_DAPM_ENUM("ASP1TX3 SRC", cs35l56_asp1tx3_enum); 106 + SOC_DAPM_ENUM_EXT("ASP1TX3 SRC", cs35l56_asp1tx3_enum, 107 + cs35l56_dspwait_asp1tx_get, cs35l56_dspwait_asp1tx_put); 234 108 235 109 static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_asp1tx4_enum, 236 - CS35L56_ASP1TX4_INPUT, 237 - 0, CS35L56_ASP_TXn_SRC_MASK, 110 + SND_SOC_NOPM, 111 + 3, 0, 238 112 cs35l56_tx_input_texts, 239 113 cs35l56_tx_input_values); 240 114 241 115 static const struct snd_kcontrol_new asp1_tx4_mux = 242 - SOC_DAPM_ENUM("ASP1TX4 SRC", cs35l56_asp1tx4_enum); 116 + SOC_DAPM_ENUM_EXT("ASP1TX4 SRC", cs35l56_asp1tx4_enum, 117 + cs35l56_dspwait_asp1tx_get, cs35l56_dspwait_asp1tx_put); 243 118 244 119 static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_sdw1tx1_enum, 245 120 CS35L56_SWIRE_DP3_CH1_INPUT, ··· 281 148 static const struct snd_kcontrol_new sdw1_tx4_mux = 282 149 SOC_DAPM_ENUM("SDW1TX4 SRC", cs35l56_sdw1tx4_enum); 283 150 151 + static int cs35l56_asp1_cfg_event(struct snd_soc_dapm_widget *w, 152 + struct snd_kcontrol *kcontrol, int event) 153 + { 154 + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); 155 + struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component); 156 + 157 + switch (event) { 158 + case SND_SOC_DAPM_PRE_PMU: 159 + /* Override register values set by firmware boot */ 160 + return cs35l56_force_sync_asp1_registers_from_cache(&cs35l56->base); 161 + default: 162 + return 0; 163 + } 164 + } 165 + 284 166 static int cs35l56_play_event(struct snd_soc_dapm_widget *w, 285 167 struct snd_kcontrol *kcontrol, int event) 286 168 { ··· 331 183 static const struct snd_soc_dapm_widget cs35l56_dapm_widgets[] = { 332 184 SND_SOC_DAPM_REGULATOR_SUPPLY("VDD_B", 0, 0), 333 185 SND_SOC_DAPM_REGULATOR_SUPPLY("VDD_AMP", 0, 0), 186 + 187 + SND_SOC_DAPM_SUPPLY("ASP1 CFG", SND_SOC_NOPM, 0, 0, cs35l56_asp1_cfg_event, 188 + SND_SOC_DAPM_PRE_PMU), 334 189 335 190 SND_SOC_DAPM_SUPPLY("PLAY", SND_SOC_NOPM, 0, 0, cs35l56_play_event, 336 191 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), ··· 401 250 static const struct snd_soc_dapm_route cs35l56_audio_map[] = { 402 251 { "AMP", NULL, "VDD_B" }, 403 252 { "AMP", NULL, "VDD_AMP" }, 253 + 254 + { "ASP1 Playback", NULL, "ASP1 CFG" }, 255 + { "ASP1 Capture", NULL, "ASP1 CFG" }, 404 256 405 257 { "ASP1 Playback", NULL, "PLAY" }, 406 258 { "SDW1 Playback", NULL, "PLAY" }, ··· 804 650 } 805 651 }; 806 652 807 - static void cs35l56_secure_patch(struct cs35l56_private *cs35l56) 653 + static void cs35l56_reinit_patch(struct cs35l56_private *cs35l56) 808 654 { 809 655 int ret; 810 656 ··· 816 662 cs35l56_mbox_send(&cs35l56->base, CS35L56_MBOX_CMD_AUDIO_REINIT); 817 663 } 818 664 819 - static void cs35l56_patch(struct cs35l56_private *cs35l56) 665 + static void cs35l56_patch(struct cs35l56_private *cs35l56, bool firmware_missing) 820 666 { 821 - unsigned int firmware_missing; 822 667 int ret; 823 - 824 - ret = regmap_read(cs35l56->base.regmap, CS35L56_PROTECTION_STATUS, &firmware_missing); 825 - if (ret) { 826 - dev_err(cs35l56->base.dev, "Failed to read PROTECTION_STATUS: %d\n", ret); 827 - return; 828 - } 829 - 830 - firmware_missing &= CS35L56_FIRMWARE_MISSING; 831 668 832 669 /* 833 670 * Disable SoundWire interrupts to prevent race with IRQ work. ··· 892 747 struct cs35l56_private *cs35l56 = container_of(work, 893 748 struct cs35l56_private, 894 749 dsp_work); 750 + unsigned int firmware_version; 751 + bool firmware_missing; 752 + int ret; 895 753 896 754 if (!cs35l56->base.init_done) 897 755 return; 898 756 899 757 pm_runtime_get_sync(cs35l56->base.dev); 900 758 901 - /* 902 - * When the device is running in secure mode the firmware files can 903 - * only contain insecure tunings and therefore we do not need to 904 - * shutdown the firmware to apply them and can use the lower cost 905 - * reinit sequence instead. 906 - */ 907 - if (cs35l56->base.secured) 908 - cs35l56_secure_patch(cs35l56); 909 - else 910 - cs35l56_patch(cs35l56); 759 + ret = cs35l56_read_prot_status(&cs35l56->base, &firmware_missing, &firmware_version); 760 + if (ret) 761 + goto err; 911 762 763 + /* Populate fw file qualifier with the revision and security state */ 764 + kfree(cs35l56->dsp.fwf_name); 765 + if (firmware_missing) { 766 + cs35l56->dsp.fwf_name = kasprintf(GFP_KERNEL, "%02x-dsp1", cs35l56->base.rev); 767 + } else { 768 + /* Firmware files must match the running firmware version */ 769 + cs35l56->dsp.fwf_name = kasprintf(GFP_KERNEL, 770 + "%02x%s-%06x-dsp1", 771 + cs35l56->base.rev, 772 + cs35l56->base.secured ? "-s" : "", 773 + firmware_version); 774 + } 775 + 776 + if (!cs35l56->dsp.fwf_name) 777 + goto err; 778 + 779 + dev_dbg(cs35l56->base.dev, "DSP fwf name: '%s' system name: '%s'\n", 780 + cs35l56->dsp.fwf_name, cs35l56->dsp.system_name); 781 + 782 + /* 783 + * The firmware cannot be patched if it is already running from 784 + * patch RAM. In this case the firmware files are versioned to 785 + * match the running firmware version and will only contain 786 + * tunings. We do not need to shutdown the firmware to apply 787 + * tunings so can use the lower cost reinit sequence instead. 788 + */ 789 + if (!firmware_missing) 790 + cs35l56_reinit_patch(cs35l56); 791 + else 792 + cs35l56_patch(cs35l56, firmware_missing); 793 + 794 + 795 + /* 796 + * Set starting value of ASP1 mux widgets. Updating a mux takes 797 + * the DAPM mutex. Post this to a separate job so that DAPM 798 + * power-up can wait for dsp_work to complete without deadlocking 799 + * on the DAPM mutex. 800 + */ 801 + queue_work(cs35l56->dsp_wq, &cs35l56->mux_init_work); 802 + err: 912 803 pm_runtime_mark_last_busy(cs35l56->base.dev); 913 804 pm_runtime_put_autosuspend(cs35l56->base.dev); 914 805 } ··· 959 778 960 779 if (!cs35l56->dsp.system_name && 961 780 (snd_soc_card_get_pci_ssid(component->card, &vendor, &device) == 0)) { 962 - cs35l56->dsp.system_name = devm_kasprintf(cs35l56->base.dev, 963 - GFP_KERNEL, 964 - "%04x%04x", 965 - vendor, device); 781 + /* Append a speaker qualifier if there is a speaker ID */ 782 + if (cs35l56->speaker_id >= 0) { 783 + cs35l56->dsp.system_name = devm_kasprintf(cs35l56->base.dev, 784 + GFP_KERNEL, 785 + "%04x%04x-spkid%d", 786 + vendor, device, 787 + cs35l56->speaker_id); 788 + } else { 789 + cs35l56->dsp.system_name = devm_kasprintf(cs35l56->base.dev, 790 + GFP_KERNEL, 791 + "%04x%04x", 792 + vendor, device); 793 + } 966 794 if (!cs35l56->dsp.system_name) 967 795 return -ENOMEM; 968 796 } ··· 999 809 struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component); 1000 810 1001 811 cancel_work_sync(&cs35l56->dsp_work); 812 + cancel_work_sync(&cs35l56->mux_init_work); 813 + 814 + if (cs35l56->dsp.cs_dsp.booted) 815 + wm_adsp_power_down(&cs35l56->dsp); 816 + 817 + wm_adsp2_component_remove(&cs35l56->dsp, component); 818 + 819 + kfree(cs35l56->dsp.fwf_name); 820 + cs35l56->dsp.fwf_name = NULL; 821 + 822 + cs35l56->component = NULL; 1002 823 } 1003 824 1004 825 static int cs35l56_set_bias_level(struct snd_soc_component *component, ··· 1070 869 1071 870 dev_dbg(dev, "system_suspend\n"); 1072 871 1073 - if (cs35l56->component) 872 + if (cs35l56->component) { 1074 873 flush_work(&cs35l56->dsp_work); 874 + cancel_work_sync(&cs35l56->mux_init_work); 875 + } 1075 876 1076 877 /* 1077 878 * The interrupt line is normally shared, but after we start suspending ··· 1224 1021 return -ENOMEM; 1225 1022 1226 1023 INIT_WORK(&cs35l56->dsp_work, cs35l56_dsp_work); 1024 + INIT_WORK(&cs35l56->mux_init_work, cs35l56_mux_init_work); 1227 1025 1228 1026 dsp = &cs35l56->dsp; 1229 1027 cs35l56_init_cs_dsp(&cs35l56->base, &dsp->cs_dsp); ··· 1254 1050 if (ret < 0) 1255 1051 return 0; 1256 1052 1257 - cs35l56->dsp.system_name = devm_kstrdup(dev, prop, GFP_KERNEL); 1053 + /* Append a speaker qualifier if there is a speaker ID */ 1054 + if (cs35l56->speaker_id >= 0) 1055 + cs35l56->dsp.system_name = devm_kasprintf(dev, GFP_KERNEL, "%s-spkid%d", 1056 + prop, cs35l56->speaker_id); 1057 + else 1058 + cs35l56->dsp.system_name = devm_kstrdup(dev, prop, GFP_KERNEL); 1059 + 1258 1060 if (cs35l56->dsp.system_name == NULL) 1259 1061 return -ENOMEM; 1260 1062 ··· 1275 1065 1276 1066 init_completion(&cs35l56->init_completion); 1277 1067 mutex_init(&cs35l56->base.irq_lock); 1068 + cs35l56->speaker_id = -ENOENT; 1278 1069 1279 1070 dev_set_drvdata(cs35l56->base.dev, cs35l56); 1280 1071 ··· 1311 1100 cs35l56_wait_min_reset_pulse(); 1312 1101 gpiod_set_value_cansleep(cs35l56->base.reset_gpio, 1); 1313 1102 } 1103 + 1104 + ret = cs35l56_get_speaker_id(&cs35l56->base); 1105 + if ((ret < 0) && (ret != -ENOENT)) 1106 + goto err; 1107 + 1108 + cs35l56->speaker_id = ret; 1314 1109 1315 1110 ret = cs35l56_get_firmware_uid(cs35l56); 1316 1111 if (ret != 0) ··· 1369 1152 if (ret < 0) 1370 1153 return ret; 1371 1154 1372 - /* Populate the DSP information with the revision and security state */ 1373 - cs35l56->dsp.part = devm_kasprintf(cs35l56->base.dev, GFP_KERNEL, "cs35l56%s-%02x", 1374 - cs35l56->base.secured ? "s" : "", cs35l56->base.rev); 1375 - if (!cs35l56->dsp.part) 1376 - return -ENOMEM; 1155 + ret = cs35l56_set_patch(&cs35l56->base); 1156 + if (ret) 1157 + return ret; 1377 1158 1378 1159 if (!cs35l56->base.reset_gpio) { 1379 1160 dev_dbg(cs35l56->base.dev, "No reset gpio: using soft reset\n"); ··· 1402 1187 1403 1188 /* Disable auto-hibernate so that runtime_pm has control */ 1404 1189 ret = cs35l56_mbox_send(&cs35l56->base, CS35L56_MBOX_CMD_PREVENT_AUTO_HIBERNATE); 1405 - if (ret) 1406 - return ret; 1407 - 1408 - ret = cs35l56_set_patch(&cs35l56->base); 1409 1190 if (ret) 1410 1191 return ret; 1411 1192
+2
sound/soc/codecs/cs35l56.h
··· 34 34 struct wm_adsp dsp; /* must be first member */ 35 35 struct cs35l56_base base; 36 36 struct work_struct dsp_work; 37 + struct work_struct mux_init_work; 37 38 struct workqueue_struct *dsp_wq; 38 39 struct snd_soc_component *component; 39 40 struct regulator_bulk_data supplies[CS35L56_NUM_BULK_SUPPLIES]; ··· 45 44 bool sdw_attached; 46 45 struct completion init_completion; 47 46 47 + int speaker_id; 48 48 u32 rx_mask; 49 49 u32 tx_mask; 50 50 u8 asp_slot_width;
+31 -42
sound/soc/codecs/wm_adsp.c
··· 739 739 const char *filetype) 740 740 { 741 741 struct cs_dsp *cs_dsp = &dsp->cs_dsp; 742 + const char *fwf; 742 743 char *s, c; 743 744 int ret = 0; 744 745 746 + if (dsp->fwf_name) 747 + fwf = dsp->fwf_name; 748 + else 749 + fwf = dsp->cs_dsp.name; 750 + 745 751 if (system_name && asoc_component_prefix) 746 752 *filename = kasprintf(GFP_KERNEL, "%s%s-%s-%s-%s-%s.%s", dir, dsp->part, 747 - dsp->fwf_name, wm_adsp_fw[dsp->fw].file, system_name, 753 + fwf, wm_adsp_fw[dsp->fw].file, system_name, 748 754 asoc_component_prefix, filetype); 749 755 else if (system_name) 750 756 *filename = kasprintf(GFP_KERNEL, "%s%s-%s-%s-%s.%s", dir, dsp->part, 751 - dsp->fwf_name, wm_adsp_fw[dsp->fw].file, system_name, 757 + fwf, wm_adsp_fw[dsp->fw].file, system_name, 752 758 filetype); 753 759 else 754 - *filename = kasprintf(GFP_KERNEL, "%s%s-%s-%s.%s", dir, dsp->part, dsp->fwf_name, 760 + *filename = kasprintf(GFP_KERNEL, "%s%s-%s-%s.%s", dir, dsp->part, fwf, 755 761 wm_adsp_fw[dsp->fw].file, filetype); 756 762 757 763 if (*filename == NULL) ··· 829 823 } 830 824 } 831 825 826 + /* Check system-specific bin without wmfw before falling back to generic */ 827 + if (dsp->wmfw_optional && system_name) { 828 + if (asoc_component_prefix) 829 + wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename, 830 + cirrus_dir, system_name, 831 + asoc_component_prefix, "bin"); 832 + 833 + if (!*coeff_firmware) 834 + wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename, 835 + cirrus_dir, system_name, 836 + NULL, "bin"); 837 + 838 + if (*coeff_firmware) 839 + return 0; 840 + } 841 + 842 + /* Check legacy location */ 832 843 if (!wm_adsp_request_firmware_file(dsp, wmfw_firmware, wmfw_filename, 833 844 "", NULL, NULL, "wmfw")) { 834 845 wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename, ··· 853 830 return 0; 854 831 } 855 832 833 + /* Fall back to generic wmfw and optional matching bin */ 856 834 ret = wm_adsp_request_firmware_file(dsp, wmfw_firmware, wmfw_filename, 857 835 cirrus_dir, NULL, NULL, "wmfw"); 858 - if (!ret) { 836 + if (!ret || dsp->wmfw_optional) { 859 837 wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename, 860 838 cirrus_dir, NULL, NULL, "bin"); 861 839 return 0; 862 840 } 863 841 864 - if (dsp->wmfw_optional) { 865 - if (system_name) { 866 - if (asoc_component_prefix) 867 - wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename, 868 - cirrus_dir, system_name, 869 - asoc_component_prefix, "bin"); 870 - 871 - if (!*coeff_firmware) 872 - wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename, 873 - cirrus_dir, system_name, 874 - NULL, "bin"); 875 - } 876 - 877 - if (!*coeff_firmware) 878 - wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename, 879 - "", NULL, NULL, "bin"); 880 - 881 - if (!*coeff_firmware) 882 - wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename, 883 - cirrus_dir, NULL, NULL, "bin"); 884 - 885 - return 0; 886 - } 887 - 888 842 adsp_err(dsp, "Failed to request firmware <%s>%s-%s-%s<-%s<%s>>.wmfw\n", 889 - cirrus_dir, dsp->part, dsp->fwf_name, wm_adsp_fw[dsp->fw].file, 890 - system_name, asoc_component_prefix); 843 + cirrus_dir, dsp->part, 844 + dsp->fwf_name ? dsp->fwf_name : dsp->cs_dsp.name, 845 + wm_adsp_fw[dsp->fw].file, system_name, asoc_component_prefix); 891 846 892 847 return -ENOENT; 893 848 } 894 849 895 850 static int wm_adsp_common_init(struct wm_adsp *dsp) 896 851 { 897 - char *p; 898 - 899 852 INIT_LIST_HEAD(&dsp->compr_list); 900 853 INIT_LIST_HEAD(&dsp->buffer_list); 901 - 902 - if (!dsp->fwf_name) { 903 - p = devm_kstrdup(dsp->cs_dsp.dev, dsp->cs_dsp.name, GFP_KERNEL); 904 - if (!p) 905 - return -ENOMEM; 906 - 907 - dsp->fwf_name = p; 908 - for (; *p != 0; ++p) 909 - *p = tolower(*p); 910 - } 911 854 912 855 return 0; 913 856 }
+1 -1
tools/power/cpupower/bench/Makefile
··· 15 15 OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o 16 16 endif 17 17 18 - CFLAGS += -D_GNU_SOURCE -I../lib -DDEFAULT_CONFIG_FILE=\"$(confdir)/cpufreq-bench.conf\" 18 + override CFLAGS += -D_GNU_SOURCE -I../lib -DDEFAULT_CONFIG_FILE=\"$(confdir)/cpufreq-bench.conf\" 19 19 20 20 $(OUTPUT)%.o : %.c 21 21 $(ECHO) " CC " $@
+2
tools/testing/cxl/Kbuild
··· 65 65 cxl_core-y += cxl_core_test.o 66 66 cxl_core-y += cxl_core_exports.o 67 67 68 + KBUILD_CFLAGS := $(filter-out -Wmissing-prototypes -Wmissing-declarations, $(KBUILD_CFLAGS)) 69 + 68 70 obj-m += test/
+2
tools/testing/cxl/test/Kbuild
··· 8 8 cxl_test-y := cxl.o 9 9 cxl_mock-y := mock.o 10 10 cxl_mock_mem-y := mem.o 11 + 12 + KBUILD_CFLAGS := $(filter-out -Wmissing-prototypes -Wmissing-declarations, $(KBUILD_CFLAGS))
+2
tools/testing/nvdimm/Kbuild
··· 82 82 libnvdimm-y += libnvdimm_test.o 83 83 libnvdimm-y += config_check.o 84 84 85 + KBUILD_CFLAGS := $(filter-out -Wmissing-prototypes -Wmissing-declarations, $(KBUILD_CFLAGS)) 86 + 85 87 obj-m += test/
+4 -4
tools/testing/selftests/drivers/net/bonding/bond_options.sh
··· 162 162 local mode=$1 163 163 164 164 for primary_reselect in 0 1 2; do 165 - prio_test "mode active-backup arp_interval 100 arp_ip_target ${g_ip4} primary eth1 primary_reselect $primary_reselect" 165 + prio_test "mode $mode arp_interval 100 arp_ip_target ${g_ip4} primary eth1 primary_reselect $primary_reselect" 166 166 log_test "prio" "$mode arp_ip_target primary_reselect $primary_reselect" 167 167 done 168 168 } ··· 178 178 fi 179 179 180 180 for primary_reselect in 0 1 2; do 181 - prio_test "mode active-backup arp_interval 100 ns_ip6_target ${g_ip6} primary eth1 primary_reselect $primary_reselect" 181 + prio_test "mode $mode arp_interval 100 ns_ip6_target ${g_ip6} primary eth1 primary_reselect $primary_reselect" 182 182 log_test "prio" "$mode ns_ip6_target primary_reselect $primary_reselect" 183 183 done 184 184 } ··· 194 194 195 195 for mode in $modes; do 196 196 prio_miimon $mode 197 - prio_arp $mode 198 - prio_ns $mode 199 197 done 198 + prio_arp "active-backup" 199 + prio_ns "active-backup" 200 200 } 201 201 202 202 arp_validate_test()
+1 -1
tools/testing/selftests/drivers/net/bonding/settings
··· 1 - timeout=120 1 + timeout=1200
+9
tools/testing/selftests/drivers/net/netdevsim/udp_tunnel_nic.sh
··· 270 270 echo 1 > $NSIM_DEV_SYS/new_port 271 271 fi 272 272 NSIM_NETDEV=`get_netdev_name old_netdevs` 273 + ifconfig $NSIM_NETDEV up 273 274 274 275 msg="new NIC device created" 275 276 exp0=( 0 0 0 0 ) ··· 432 431 fi 433 432 434 433 echo $port > $NSIM_DEV_SYS/new_port 434 + NSIM_NETDEV=`get_netdev_name old_netdevs` 435 435 ifconfig $NSIM_NETDEV up 436 436 437 437 overflow_table0 "overflow NIC table" ··· 490 488 fi 491 489 492 490 echo $port > $NSIM_DEV_SYS/new_port 491 + NSIM_NETDEV=`get_netdev_name old_netdevs` 493 492 ifconfig $NSIM_NETDEV up 494 493 495 494 overflow_table0 "overflow NIC table" ··· 547 544 fi 548 545 549 546 echo $port > $NSIM_DEV_SYS/new_port 547 + NSIM_NETDEV=`get_netdev_name old_netdevs` 550 548 ifconfig $NSIM_NETDEV up 551 549 552 550 overflow_table0 "destroy NIC" ··· 577 573 fi 578 574 579 575 echo $port > $NSIM_DEV_SYS/new_port 576 + NSIM_NETDEV=`get_netdev_name old_netdevs` 580 577 ifconfig $NSIM_NETDEV up 581 578 582 579 msg="create VxLANs v6" ··· 638 633 fi 639 634 640 635 echo $port > $NSIM_DEV_SYS/new_port 636 + NSIM_NETDEV=`get_netdev_name old_netdevs` 641 637 ifconfig $NSIM_NETDEV up 642 638 643 639 echo 110 > $NSIM_DEV_DFS/ports/$port/udp_ports_inject_error ··· 694 688 fi 695 689 696 690 echo $port > $NSIM_DEV_SYS/new_port 691 + NSIM_NETDEV=`get_netdev_name old_netdevs` 697 692 ifconfig $NSIM_NETDEV up 698 693 699 694 msg="create VxLANs v6" ··· 754 747 fi 755 748 756 749 echo $port > $NSIM_DEV_SYS/new_port 750 + NSIM_NETDEV=`get_netdev_name old_netdevs` 757 751 ifconfig $NSIM_NETDEV up 758 752 759 753 msg="create VxLANs v6" ··· 885 877 886 878 echo 2 > $NSIM_DEV_SYS/del_port 887 879 echo 2 > $NSIM_DEV_SYS/new_port 880 + NSIM_NETDEV=`get_netdev_name old_netdevs` 888 881 check_tables 889 882 890 883 msg="replace VxLAN in overflow table"
+28
tools/testing/selftests/net/config
··· 1 1 CONFIG_USER_NS=y 2 2 CONFIG_NET_NS=y 3 + CONFIG_BONDING=m 3 4 CONFIG_BPF_SYSCALL=y 4 5 CONFIG_TEST_BPF=m 5 6 CONFIG_NUMA=y ··· 15 14 CONFIG_NET_IPVTI=y 16 15 CONFIG_IPV6_VTI=y 17 16 CONFIG_DUMMY=y 17 + CONFIG_BRIDGE_VLAN_FILTERING=y 18 18 CONFIG_BRIDGE=y 19 + CONFIG_CRYPTO_CHACHA20POLY1305=m 19 20 CONFIG_VLAN_8021Q=y 20 21 CONFIG_IFB=y 22 + CONFIG_INET_DIAG=y 23 + CONFIG_IP_GRE=m 21 24 CONFIG_NETFILTER=y 22 25 CONFIG_NETFILTER_ADVANCED=y 23 26 CONFIG_NF_CONNTRACK=m ··· 30 25 CONFIG_IP_NF_IPTABLES=m 31 26 CONFIG_IP6_NF_NAT=m 32 27 CONFIG_IP_NF_NAT=m 28 + CONFIG_IPV6_GRE=m 29 + CONFIG_IPV6_SEG6_LWTUNNEL=y 30 + CONFIG_L2TP_ETH=m 31 + CONFIG_L2TP_IP=m 32 + CONFIG_L2TP=m 33 + CONFIG_L2TP_V3=y 34 + CONFIG_MACSEC=m 35 + CONFIG_MACVLAN=y 36 + CONFIG_MACVTAP=y 37 + CONFIG_MPLS=y 38 + CONFIG_MPTCP=y 33 39 CONFIG_NF_TABLES=m 34 40 CONFIG_NF_TABLES_IPV6=y 35 41 CONFIG_NF_TABLES_IPV4=y 36 42 CONFIG_NFT_NAT=m 43 + CONFIG_NET_ACT_GACT=m 44 + CONFIG_NET_CLS_BASIC=m 45 + CONFIG_NET_CLS_U32=m 46 + CONFIG_NET_IPGRE_DEMUX=m 47 + CONFIG_NET_IPGRE=m 48 + CONFIG_NET_SCH_FQ_CODEL=m 49 + CONFIG_NET_SCH_HTB=m 37 50 CONFIG_NET_SCH_FQ=m 38 51 CONFIG_NET_SCH_ETF=m 39 52 CONFIG_NET_SCH_NETEM=y 53 + CONFIG_PSAMPLE=m 54 + CONFIG_TCP_MD5SIG=y 40 55 CONFIG_TEST_BLACKHOLE_DEV=m 41 56 CONFIG_KALLSYMS=y 57 + CONFIG_TLS=m 42 58 CONFIG_TRACEPOINTS=y 43 59 CONFIG_NET_DROP_MONITOR=m 44 60 CONFIG_NETDEVSIM=m ··· 74 48 CONFIG_IPV6_IOAM6_LWTUNNEL=y 75 49 CONFIG_CRYPTO_SM4_GENERIC=y 76 50 CONFIG_AMT=m 51 + CONFIG_TUN=y 77 52 CONFIG_VXLAN=m 78 53 CONFIG_IP_SCTP=m 79 54 CONFIG_NETFILTER_XT_MATCH_POLICY=m 80 55 CONFIG_CRYPTO_ARIA=y 56 + CONFIG_XFRM_INTERFACE=m
+5 -1
tools/testing/selftests/net/rps_default_mask.sh
··· 1 - #!/bin/sh 1 + #!/bin/bash 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 4 4 readonly ksft_skip=4 ··· 33 33 34 34 rps_mask=$($cmd /sys/class/net/$dev_name/queues/rx-0/rps_cpus) 35 35 printf "%-60s" "$msg" 36 + 37 + # In case there is more than 32 CPUs we need to remove commas from masks 38 + rps_mask=${rps_mask//,} 39 + expected_rps_mask=${expected_rps_mask//,} 36 40 if [ $rps_mask -eq $expected_rps_mask ]; then 37 41 echo "[ ok ]" 38 42 else
+50 -18
tools/testing/selftests/net/so_incoming_cpu.c
··· 3 3 #define _GNU_SOURCE 4 4 #include <sched.h> 5 5 6 + #include <fcntl.h> 7 + 6 8 #include <netinet/in.h> 7 9 #include <sys/socket.h> 8 10 #include <sys/sysinfo.h> 9 11 10 12 #include "../kselftest_harness.h" 11 13 12 - #define CLIENT_PER_SERVER 32 /* More sockets, more reliable */ 13 - #define NR_SERVER self->nproc 14 - #define NR_CLIENT (CLIENT_PER_SERVER * NR_SERVER) 15 - 16 14 FIXTURE(so_incoming_cpu) 17 15 { 18 - int nproc; 19 16 int *servers; 20 17 union { 21 18 struct sockaddr addr; ··· 53 56 .when_to_set = AFTER_ALL_LISTEN, 54 57 }; 55 58 59 + static void write_sysctl(struct __test_metadata *_metadata, 60 + char *filename, char *string) 61 + { 62 + int fd, len, ret; 63 + 64 + fd = open(filename, O_WRONLY); 65 + ASSERT_NE(fd, -1); 66 + 67 + len = strlen(string); 68 + ret = write(fd, string, len); 69 + ASSERT_EQ(ret, len); 70 + } 71 + 72 + static void setup_netns(struct __test_metadata *_metadata) 73 + { 74 + ASSERT_EQ(unshare(CLONE_NEWNET), 0); 75 + ASSERT_EQ(system("ip link set lo up"), 0); 76 + 77 + write_sysctl(_metadata, "/proc/sys/net/ipv4/ip_local_port_range", "10000 60001"); 78 + write_sysctl(_metadata, "/proc/sys/net/ipv4/tcp_tw_reuse", "0"); 79 + } 80 + 81 + #define NR_PORT (60001 - 10000 - 1) 82 + #define NR_CLIENT_PER_SERVER_DEFAULT 32 83 + static int nr_client_per_server, nr_server, nr_client; 84 + 56 85 FIXTURE_SETUP(so_incoming_cpu) 57 86 { 58 - self->nproc = get_nprocs(); 59 - ASSERT_LE(2, self->nproc); 87 + setup_netns(_metadata); 60 88 61 - self->servers = malloc(sizeof(int) * NR_SERVER); 89 + nr_server = get_nprocs(); 90 + ASSERT_LE(2, nr_server); 91 + 92 + if (NR_CLIENT_PER_SERVER_DEFAULT * nr_server < NR_PORT) 93 + nr_client_per_server = NR_CLIENT_PER_SERVER_DEFAULT; 94 + else 95 + nr_client_per_server = NR_PORT / nr_server; 96 + 97 + nr_client = nr_client_per_server * nr_server; 98 + 99 + self->servers = malloc(sizeof(int) * nr_server); 62 100 ASSERT_NE(self->servers, NULL); 63 101 64 102 self->in_addr.sin_family = AF_INET; ··· 106 74 { 107 75 int i; 108 76 109 - for (i = 0; i < NR_SERVER; i++) 77 + for (i = 0; i < nr_server; i++) 110 78 close(self->servers[i]); 111 79 112 80 free(self->servers); ··· 142 110 if (variant->when_to_set == BEFORE_LISTEN) 143 111 set_so_incoming_cpu(_metadata, fd, cpu); 144 112 145 - /* We don't use CLIENT_PER_SERVER here not to block 113 + /* We don't use nr_client_per_server here not to block 146 114 * this test at connect() if SO_INCOMING_CPU is broken. 147 115 */ 148 - ret = listen(fd, NR_CLIENT); 116 + ret = listen(fd, nr_client); 149 117 ASSERT_EQ(ret, 0); 150 118 151 119 if (variant->when_to_set == AFTER_LISTEN) ··· 160 128 { 161 129 int i, ret; 162 130 163 - for (i = 0; i < NR_SERVER; i++) { 131 + for (i = 0; i < nr_server; i++) { 164 132 self->servers[i] = create_server(_metadata, self, variant, i); 165 133 166 134 if (i == 0) { ··· 170 138 } 171 139 172 140 if (variant->when_to_set == AFTER_ALL_LISTEN) { 173 - for (i = 0; i < NR_SERVER; i++) 141 + for (i = 0; i < nr_server; i++) 174 142 set_so_incoming_cpu(_metadata, self->servers[i], i); 175 143 } 176 144 } ··· 181 149 cpu_set_t cpu_set; 182 150 int i, j, fd, ret; 183 151 184 - for (i = 0; i < NR_SERVER; i++) { 152 + for (i = 0; i < nr_server; i++) { 185 153 CPU_ZERO(&cpu_set); 186 154 187 155 CPU_SET(i, &cpu_set); ··· 194 162 ret = sched_setaffinity(0, sizeof(cpu_set), &cpu_set); 195 163 ASSERT_EQ(ret, 0); 196 164 197 - for (j = 0; j < CLIENT_PER_SERVER; j++) { 165 + for (j = 0; j < nr_client_per_server; j++) { 198 166 fd = socket(AF_INET, SOCK_STREAM, 0); 199 167 ASSERT_NE(fd, -1); 200 168 ··· 212 180 int i, j, fd, cpu, ret, total = 0; 213 181 socklen_t len = sizeof(int); 214 182 215 - for (i = 0; i < NR_SERVER; i++) { 216 - for (j = 0; j < CLIENT_PER_SERVER; j++) { 183 + for (i = 0; i < nr_server; i++) { 184 + for (j = 0; j < nr_client_per_server; j++) { 217 185 /* If we see -EAGAIN here, SO_INCOMING_CPU is broken */ 218 186 fd = accept(self->servers[i], &self->addr, &self->addrlen); 219 187 ASSERT_NE(fd, -1); ··· 227 195 } 228 196 } 229 197 230 - ASSERT_EQ(total, NR_CLIENT); 198 + ASSERT_EQ(total, nr_client); 231 199 TH_LOG("SO_INCOMING_CPU is very likely to be " 232 200 "working correctly with %d sockets.", total); 233 201 }