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

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

No conflicts.

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

+1603 -896
+7
.mailmap
··· 60 60 Atish Patra <atishp@atishpatra.org> <atish.patra@wdc.com> 61 61 Axel Dyks <xl@xlsigned.net> 62 62 Axel Lin <axel.lin@gmail.com> 63 + Baolin Wang <baolin.wang@linux.alibaba.com> <baolin.wang@linaro.org> 64 + Baolin Wang <baolin.wang@linux.alibaba.com> <baolin.wang@spreadtrum.com> 65 + Baolin Wang <baolin.wang@linux.alibaba.com> <baolin.wang@unisoc.com> 66 + Baolin Wang <baolin.wang@linux.alibaba.com> <baolin.wang7@gmail.com> 63 67 Bart Van Assche <bvanassche@acm.org> <bart.vanassche@sandisk.com> 64 68 Bart Van Assche <bvanassche@acm.org> <bart.vanassche@wdc.com> 65 69 Ben Gardner <bgardner@wabtec.com> ··· 139 135 Frank Zago <fzago@systemfabricworks.com> 140 136 Gao Xiang <xiang@kernel.org> <gaoxiang25@huawei.com> 141 137 Gao Xiang <xiang@kernel.org> <hsiangkao@aol.com> 138 + Gao Xiang <xiang@kernel.org> <hsiangkao@linux.alibaba.com> 139 + Gao Xiang <xiang@kernel.org> <hsiangkao@redhat.com> 142 140 Gerald Schaefer <gerald.schaefer@linux.ibm.com> <geraldsc@de.ibm.com> 143 141 Gerald Schaefer <gerald.schaefer@linux.ibm.com> <gerald.schaefer@de.ibm.com> 144 142 Gerald Schaefer <gerald.schaefer@linux.ibm.com> <geraldsc@linux.vnet.ibm.com> ··· 377 371 Sebastian Reichel <sre@kernel.org> <sebastian.reichel@collabora.co.uk> 378 372 Sebastian Reichel <sre@kernel.org> <sre@debian.org> 379 373 Sedat Dilek <sedat.dilek@gmail.com> <sedat.dilek@credativ.de> 374 + Seth Forshee <sforshee@kernel.org> <seth.forshee@canonical.com> 380 375 Shiraz Hashim <shiraz.linux.kernel@gmail.com> <shiraz.hashim@st.com> 381 376 Shuah Khan <shuah@kernel.org> <shuahkhan@gmail.com> 382 377 Shuah Khan <shuah@kernel.org> <shuah.khan@hp.com>
+18
Documentation/admin-guide/kernel-parameters.txt
··· 5796 5796 expediting. Set to zero to disable automatic 5797 5797 expediting. 5798 5798 5799 + srcutree.srcu_max_nodelay [KNL] 5800 + Specifies the number of no-delay instances 5801 + per jiffy for which the SRCU grace period 5802 + worker thread will be rescheduled with zero 5803 + delay. Beyond this limit, worker thread will 5804 + be rescheduled with a sleep delay of one jiffy. 5805 + 5806 + srcutree.srcu_max_nodelay_phase [KNL] 5807 + Specifies the per-grace-period phase, number of 5808 + non-sleeping polls of readers. Beyond this limit, 5809 + grace period worker thread will be rescheduled 5810 + with a sleep delay of one jiffy, between each 5811 + rescan of the readers, for a grace period phase. 5812 + 5813 + srcutree.srcu_retry_check_delay [KNL] 5814 + Specifies number of microseconds of non-sleeping 5815 + delay between each non-sleeping poll of readers. 5816 + 5799 5817 srcutree.small_contention_lim [KNL] 5800 5818 Specifies the number of update-side contention 5801 5819 events per jiffy will be tolerated before
+50 -55
Documentation/devicetree/bindings/net/ethernet-controller.yaml
··· 155 155 - in-band-status 156 156 157 157 fixed-link: 158 - allOf: 159 - - if: 160 - type: array 161 - then: 162 - deprecated: true 163 - items: 164 - - minimum: 0 165 - maximum: 31 166 - description: 167 - Emulated PHY ID, choose any but unique to the all 168 - specified fixed-links 158 + oneOf: 159 + - $ref: /schemas/types.yaml#/definitions/uint32-array 160 + deprecated: true 161 + items: 162 + - minimum: 0 163 + maximum: 31 164 + description: 165 + Emulated PHY ID, choose any but unique to the all 166 + specified fixed-links 169 167 170 - - enum: [0, 1] 171 - description: 172 - Duplex configuration. 0 for half duplex or 1 for 173 - full duplex 168 + - enum: [0, 1] 169 + description: 170 + Duplex configuration. 0 for half duplex or 1 for 171 + full duplex 174 172 175 - - enum: [10, 100, 1000, 2500, 10000] 176 - description: 177 - Link speed in Mbits/sec. 173 + - enum: [10, 100, 1000, 2500, 10000] 174 + description: 175 + Link speed in Mbits/sec. 178 176 179 - - enum: [0, 1] 180 - description: 181 - Pause configuration. 0 for no pause, 1 for pause 177 + - enum: [0, 1] 178 + description: 179 + Pause configuration. 0 for no pause, 1 for pause 182 180 183 - - enum: [0, 1] 184 - description: 185 - Asymmetric pause configuration. 0 for no asymmetric 186 - pause, 1 for asymmetric pause 181 + - enum: [0, 1] 182 + description: 183 + Asymmetric pause configuration. 0 for no asymmetric 184 + pause, 1 for asymmetric pause 185 + - type: object 186 + additionalProperties: false 187 + properties: 188 + speed: 189 + description: 190 + Link speed. 191 + $ref: /schemas/types.yaml#/definitions/uint32 192 + enum: [10, 100, 1000, 2500, 10000] 187 193 194 + full-duplex: 195 + $ref: /schemas/types.yaml#/definitions/flag 196 + description: 197 + Indicates that full-duplex is used. When absent, half 198 + duplex is assumed. 188 199 189 - - if: 190 - type: object 191 - then: 192 - properties: 193 - speed: 194 - description: 195 - Link speed. 196 - $ref: /schemas/types.yaml#/definitions/uint32 197 - enum: [10, 100, 1000, 2500, 10000] 200 + pause: 201 + $ref: /schemas/types.yaml#definitions/flag 202 + description: 203 + Indicates that pause should be enabled. 198 204 199 - full-duplex: 200 - $ref: /schemas/types.yaml#/definitions/flag 201 - description: 202 - Indicates that full-duplex is used. When absent, half 203 - duplex is assumed. 205 + asym-pause: 206 + $ref: /schemas/types.yaml#/definitions/flag 207 + description: 208 + Indicates that asym_pause should be enabled. 204 209 205 - pause: 206 - $ref: /schemas/types.yaml#definitions/flag 207 - description: 208 - Indicates that pause should be enabled. 210 + link-gpios: 211 + maxItems: 1 212 + description: 213 + GPIO to determine if the link is up 209 214 210 - asym-pause: 211 - $ref: /schemas/types.yaml#/definitions/flag 212 - description: 213 - Indicates that asym_pause should be enabled. 214 - 215 - link-gpios: 216 - maxItems: 1 217 - description: 218 - GPIO to determine if the link is up 219 - 220 - required: 221 - - speed 215 + required: 216 + - speed 222 217 223 218 allOf: 224 219 - if:
+3
Documentation/devicetree/bindings/net/fsl,fec.yaml
··· 187 187 Should specify the gpio for phy reset. 188 188 189 189 phy-reset-duration: 190 + $ref: /schemas/types.yaml#/definitions/uint32 190 191 deprecated: true 191 192 description: 192 193 Reset duration in milliseconds. Should present only if property ··· 196 195 and 1 millisecond will be used instead. 197 196 198 197 phy-reset-active-high: 198 + type: boolean 199 199 deprecated: true 200 200 description: 201 201 If present then the reset sequence using the GPIO specified in the 202 202 "phy-reset-gpios" property is reversed (H=reset state, L=operation state). 203 203 204 204 phy-reset-post-delay: 205 + $ref: /schemas/types.yaml#/definitions/uint32 205 206 deprecated: true 206 207 description: 207 208 Post reset delay in milliseconds. If present then a delay of phy-reset-post-delay
+8 -1
Documentation/networking/ip-sysctl.rst
··· 2884 2884 Default: 4K 2885 2885 2886 2886 sctp_wmem - vector of 3 INTEGERs: min, default, max 2887 - Currently this tunable has no effect. 2887 + Only the first value ("min") is used, "default" and "max" are 2888 + ignored. 2889 + 2890 + min: Minimum size of send buffer that can be used by SCTP sockets. 2891 + It is guaranteed to each SCTP socket (but not association) even 2892 + under moderate memory pressure. 2893 + 2894 + Default: 4K 2888 2895 2889 2896 addr_scope_policy - INTEGER 2890 2897 Control IPv4 address scoping - draft-stewart-tsvwg-sctp-ipv4-00
+1 -1
Documentation/virt/kvm/api.rst
··· 5658 5658 #define KVM_STATS_UNIT_SECONDS (0x2 << KVM_STATS_UNIT_SHIFT) 5659 5659 #define KVM_STATS_UNIT_CYCLES (0x3 << KVM_STATS_UNIT_SHIFT) 5660 5660 #define KVM_STATS_UNIT_BOOLEAN (0x4 << KVM_STATS_UNIT_SHIFT) 5661 - #define KVM_STATS_UNIT_MAX KVM_STATS_UNIT_CYCLES 5661 + #define KVM_STATS_UNIT_MAX KVM_STATS_UNIT_BOOLEAN 5662 5662 5663 5663 #define KVM_STATS_BASE_SHIFT 8 5664 5664 #define KVM_STATS_BASE_MASK (0xF << KVM_STATS_BASE_SHIFT)
+1 -1
MAINTAINERS
··· 15862 15862 M: Dong Aisheng <aisheng.dong@nxp.com> 15863 15863 M: Fabio Estevam <festevam@gmail.com> 15864 15864 M: Shawn Guo <shawnguo@kernel.org> 15865 - M: Stefan Agner <stefan@agner.ch> 15865 + M: Jacky Bai <ping.bai@nxp.com> 15866 15866 R: Pengutronix Kernel Team <kernel@pengutronix.de> 15867 15867 L: linux-gpio@vger.kernel.org 15868 15868 S: Maintained
+1 -1
Makefile
··· 2 2 VERSION = 5 3 3 PATCHLEVEL = 19 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc7 5 + EXTRAVERSION = -rc8 6 6 NAME = Superb Owl 7 7 8 8 # *DOCUMENTATION*
+1 -1
arch/arm/boot/dts/lan966x.dtsi
··· 38 38 sys_clk: sys_clk { 39 39 compatible = "fixed-clock"; 40 40 #clock-cells = <0>; 41 - clock-frequency = <162500000>; 41 + clock-frequency = <165625000>; 42 42 }; 43 43 44 44 cpu_clk: cpu_clk {
+1 -1
arch/arm/mach-pxa/corgi.c
··· 549 549 }; 550 550 551 551 static struct gpiod_lookup_table corgi_spi_gpio_table = { 552 - .dev_id = "pxa2xx-spi.1", 552 + .dev_id = "spi1", 553 553 .table = { 554 554 GPIO_LOOKUP_IDX("gpio-pxa", CORGI_GPIO_ADS7846_CS, "cs", 0, GPIO_ACTIVE_LOW), 555 555 GPIO_LOOKUP_IDX("gpio-pxa", CORGI_GPIO_LCDCON_CS, "cs", 1, GPIO_ACTIVE_LOW),
+1 -1
arch/arm/mach-pxa/hx4700.c
··· 635 635 }; 636 636 637 637 static struct gpiod_lookup_table pxa_ssp2_gpio_table = { 638 - .dev_id = "pxa2xx-spi.2", 638 + .dev_id = "spi2", 639 639 .table = { 640 640 GPIO_LOOKUP_IDX("gpio-pxa", GPIO88_HX4700_TSC2046_CS, "cs", 0, GPIO_ACTIVE_LOW), 641 641 { },
+2 -2
arch/arm/mach-pxa/icontrol.c
··· 140 140 }; 141 141 142 142 static struct gpiod_lookup_table pxa_ssp3_gpio_table = { 143 - .dev_id = "pxa2xx-spi.3", 143 + .dev_id = "spi3", 144 144 .table = { 145 145 GPIO_LOOKUP_IDX("gpio-pxa", ICONTROL_MCP251x_nCS1, "cs", 0, GPIO_ACTIVE_LOW), 146 146 GPIO_LOOKUP_IDX("gpio-pxa", ICONTROL_MCP251x_nCS2, "cs", 1, GPIO_ACTIVE_LOW), ··· 149 149 }; 150 150 151 151 static struct gpiod_lookup_table pxa_ssp4_gpio_table = { 152 - .dev_id = "pxa2xx-spi.4", 152 + .dev_id = "spi4", 153 153 .table = { 154 154 GPIO_LOOKUP_IDX("gpio-pxa", ICONTROL_MCP251x_nCS3, "cs", 0, GPIO_ACTIVE_LOW), 155 155 GPIO_LOOKUP_IDX("gpio-pxa", ICONTROL_MCP251x_nCS4, "cs", 1, GPIO_ACTIVE_LOW),
+1 -1
arch/arm/mach-pxa/littleton.c
··· 207 207 }; 208 208 209 209 static struct gpiod_lookup_table littleton_spi_gpio_table = { 210 - .dev_id = "pxa2xx-spi.2", 210 + .dev_id = "spi2", 211 211 .table = { 212 212 GPIO_LOOKUP_IDX("gpio-pxa", LITTLETON_GPIO_LCD_CS, "cs", 0, GPIO_ACTIVE_LOW), 213 213 { },
+1 -1
arch/arm/mach-pxa/magician.c
··· 994 994 }; 995 995 996 996 static struct gpiod_lookup_table magician_spi_gpio_table = { 997 - .dev_id = "pxa2xx-spi.2", 997 + .dev_id = "spi2", 998 998 .table = { 999 999 /* NOTICE must be GPIO, incompatibility with hw PXA SPI framing */ 1000 1000 GPIO_LOOKUP_IDX("gpio-pxa", GPIO14_MAGICIAN_TSC2046_CS, "cs", 0, GPIO_ACTIVE_LOW),
+1 -1
arch/arm/mach-pxa/spitz.c
··· 578 578 }; 579 579 580 580 static struct gpiod_lookup_table spitz_spi_gpio_table = { 581 - .dev_id = "pxa2xx-spi.2", 581 + .dev_id = "spi2", 582 582 .table = { 583 583 GPIO_LOOKUP_IDX("gpio-pxa", SPITZ_GPIO_ADS7846_CS, "cs", 0, GPIO_ACTIVE_LOW), 584 584 GPIO_LOOKUP_IDX("gpio-pxa", SPITZ_GPIO_LCDCON_CS, "cs", 1, GPIO_ACTIVE_LOW),
+2 -2
arch/arm/mach-pxa/z2.c
··· 623 623 }; 624 624 625 625 static struct gpiod_lookup_table pxa_ssp1_gpio_table = { 626 - .dev_id = "pxa2xx-spi.1", 626 + .dev_id = "spi1", 627 627 .table = { 628 628 GPIO_LOOKUP_IDX("gpio-pxa", GPIO24_ZIPITZ2_WIFI_CS, "cs", 0, GPIO_ACTIVE_LOW), 629 629 { }, ··· 631 631 }; 632 632 633 633 static struct gpiod_lookup_table pxa_ssp2_gpio_table = { 634 - .dev_id = "pxa2xx-spi.2", 634 + .dev_id = "spi2", 635 635 .table = { 636 636 GPIO_LOOKUP_IDX("gpio-pxa", GPIO88_ZIPITZ2_LCD_CS, "cs", 0, GPIO_ACTIVE_LOW), 637 637 { },
+1
arch/riscv/Makefile
··· 73 73 endif 74 74 75 75 KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-relax) 76 + KBUILD_AFLAGS_MODULE += $(call as-option,-Wa$(comma)-mno-relax) 76 77 77 78 # GCC versions that support the "-mstrict-align" option default to allowing 78 79 # unaligned accesses. While unaligned accesses are explicitly allowed in the
+1 -1
arch/riscv/boot/dts/canaan/canaan_kd233.dts
··· 35 35 gpio-keys { 36 36 compatible = "gpio-keys"; 37 37 38 - key0 { 38 + key { 39 39 label = "KEY0"; 40 40 linux,code = <BTN_0>; 41 41 gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
+1 -1
arch/riscv/boot/dts/canaan/sipeed_maix_bit.dts
··· 47 47 gpio-keys { 48 48 compatible = "gpio-keys"; 49 49 50 - boot { 50 + key-boot { 51 51 label = "BOOT"; 52 52 linux,code = <BTN_0>; 53 53 gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
+1 -1
arch/riscv/boot/dts/canaan/sipeed_maix_dock.dts
··· 52 52 gpio-keys { 53 53 compatible = "gpio-keys"; 54 54 55 - boot { 55 + key-boot { 56 56 label = "BOOT"; 57 57 linux,code = <BTN_0>; 58 58 gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
+3 -3
arch/riscv/boot/dts/canaan/sipeed_maix_go.dts
··· 46 46 gpio-keys { 47 47 compatible = "gpio-keys"; 48 48 49 - up { 49 + key-up { 50 50 label = "UP"; 51 51 linux,code = <BTN_1>; 52 52 gpios = <&gpio1_0 7 GPIO_ACTIVE_LOW>; 53 53 }; 54 54 55 - press { 55 + key-press { 56 56 label = "PRESS"; 57 57 linux,code = <BTN_0>; 58 58 gpios = <&gpio0 0 GPIO_ACTIVE_LOW>; 59 59 }; 60 60 61 - down { 61 + key-down { 62 62 label = "DOWN"; 63 63 linux,code = <BTN_2>; 64 64 gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
+1 -1
arch/riscv/boot/dts/canaan/sipeed_maixduino.dts
··· 23 23 gpio-keys { 24 24 compatible = "gpio-keys"; 25 25 26 - boot { 26 + key-boot { 27 27 label = "BOOT"; 28 28 linux,code = <BTN_0>; 29 29 gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
+1 -1
arch/riscv/kernel/Makefile
··· 78 78 endif 79 79 obj-$(CONFIG_HOTPLUG_CPU) += cpu-hotplug.o 80 80 obj-$(CONFIG_KGDB) += kgdb.o 81 - obj-$(CONFIG_KEXEC) += kexec_relocate.o crash_save_regs.o machine_kexec.o 81 + obj-$(CONFIG_KEXEC_CORE) += kexec_relocate.o crash_save_regs.o machine_kexec.o 82 82 obj-$(CONFIG_KEXEC_FILE) += elf_kexec.o machine_kexec_file.o 83 83 obj-$(CONFIG_CRASH_DUMP) += crash_dump.o 84 84
+1 -1
arch/riscv/kernel/elf_kexec.c
··· 349 349 { 350 350 const char *strtab, *name, *shstrtab; 351 351 const Elf_Shdr *sechdrs; 352 - Elf_Rela *relas; 352 + Elf64_Rela *relas; 353 353 int i, r_type; 354 354 355 355 /* String & section header string table */
+6 -3
arch/s390/include/asm/archrandom.h
··· 2 2 /* 3 3 * Kernel interface for the s390 arch_random_* functions 4 4 * 5 - * Copyright IBM Corp. 2017, 2020 5 + * Copyright IBM Corp. 2017, 2022 6 6 * 7 7 * Author: Harald Freudenberger <freude@de.ibm.com> 8 8 * ··· 14 14 #ifdef CONFIG_ARCH_RANDOM 15 15 16 16 #include <linux/static_key.h> 17 + #include <linux/preempt.h> 17 18 #include <linux/atomic.h> 18 19 #include <asm/cpacf.h> 19 20 ··· 33 32 34 33 static inline bool __must_check arch_get_random_seed_long(unsigned long *v) 35 34 { 36 - if (static_branch_likely(&s390_arch_random_available)) { 35 + if (static_branch_likely(&s390_arch_random_available) && 36 + in_task()) { 37 37 cpacf_trng(NULL, 0, (u8 *)v, sizeof(*v)); 38 38 atomic64_add(sizeof(*v), &s390_arch_random_counter); 39 39 return true; ··· 44 42 45 43 static inline bool __must_check arch_get_random_seed_int(unsigned int *v) 46 44 { 47 - if (static_branch_likely(&s390_arch_random_available)) { 45 + if (static_branch_likely(&s390_arch_random_available) && 46 + in_task()) { 48 47 cpacf_trng(NULL, 0, (u8 *)v, sizeof(*v)); 49 48 atomic64_add(sizeof(*v), &s390_arch_random_counter); 50 49 return true;
+4 -4
arch/x86/Kconfig
··· 2474 2474 bool "Enable return-thunks" 2475 2475 depends on RETPOLINE && CC_HAS_RETURN_THUNK 2476 2476 select OBJTOOL if HAVE_OBJTOOL 2477 - default y 2477 + default y if X86_64 2478 2478 help 2479 2479 Compile the kernel with the return-thunks compiler option to guard 2480 2480 against kernel-to-user data leaks by avoiding return speculation. ··· 2483 2483 2484 2484 config CPU_UNRET_ENTRY 2485 2485 bool "Enable UNRET on kernel entry" 2486 - depends on CPU_SUP_AMD && RETHUNK 2486 + depends on CPU_SUP_AMD && RETHUNK && X86_64 2487 2487 default y 2488 2488 help 2489 2489 Compile the kernel with support for the retbleed=unret mitigation. 2490 2490 2491 2491 config CPU_IBPB_ENTRY 2492 2492 bool "Enable IBPB on kernel entry" 2493 - depends on CPU_SUP_AMD 2493 + depends on CPU_SUP_AMD && X86_64 2494 2494 default y 2495 2495 help 2496 2496 Compile the kernel with support for the retbleed=ibpb mitigation. 2497 2497 2498 2498 config CPU_IBRS_ENTRY 2499 2499 bool "Enable IBRS on kernel entry" 2500 - depends on CPU_SUP_INTEL 2500 + depends on CPU_SUP_INTEL && X86_64 2501 2501 default y 2502 2502 help 2503 2503 Compile the kernel with support for the spectre_v2=ibrs mitigation.
+1
arch/x86/Makefile
··· 27 27 RETPOLINE_CFLAGS += $(RETHUNK_CFLAGS) 28 28 endif 29 29 30 + export RETHUNK_CFLAGS 30 31 export RETPOLINE_CFLAGS 31 32 export RETPOLINE_VDSO_CFLAGS 32 33
+10 -9
arch/x86/events/intel/lbr.c
··· 278 278 }; 279 279 280 280 /* 281 - * For formats with LBR_TSX flags (e.g. LBR_FORMAT_EIP_FLAGS2), bits 61:62 in 282 - * MSR_LAST_BRANCH_FROM_x are the TSX flags when TSX is supported, but when 283 - * TSX is not supported they have no consistent behavior: 281 + * For format LBR_FORMAT_EIP_FLAGS2, bits 61:62 in MSR_LAST_BRANCH_FROM_x 282 + * are the TSX flags when TSX is supported, but when TSX is not supported 283 + * they have no consistent behavior: 284 284 * 285 285 * - For wrmsr(), bits 61:62 are considered part of the sign extension. 286 286 * - For HW updates (branch captures) bits 61:62 are always OFF and are not ··· 288 288 * 289 289 * Therefore, if: 290 290 * 291 - * 1) LBR has TSX format 291 + * 1) LBR format LBR_FORMAT_EIP_FLAGS2 292 292 * 2) CPU has no TSX support enabled 293 293 * 294 294 * ... then any value passed to wrmsr() must be sign extended to 63 bits and any ··· 300 300 bool tsx_support = boot_cpu_has(X86_FEATURE_HLE) || 301 301 boot_cpu_has(X86_FEATURE_RTM); 302 302 303 - return !tsx_support && x86_pmu.lbr_has_tsx; 303 + return !tsx_support; 304 304 } 305 305 306 306 static DEFINE_STATIC_KEY_FALSE(lbr_from_quirk_key); ··· 1609 1609 x86_pmu.lbr_sel_map = hsw_lbr_sel_map; 1610 1610 1611 1611 x86_get_pmu(smp_processor_id())->task_ctx_cache = create_lbr_kmem_cache(size, 0); 1612 - 1613 - if (lbr_from_signext_quirk_needed()) 1614 - static_branch_enable(&lbr_from_quirk_key); 1615 1612 } 1616 1613 1617 1614 /* skylake */ ··· 1699 1702 switch (x86_pmu.intel_cap.lbr_format) { 1700 1703 case LBR_FORMAT_EIP_FLAGS2: 1701 1704 x86_pmu.lbr_has_tsx = 1; 1702 - fallthrough; 1705 + x86_pmu.lbr_from_flags = 1; 1706 + if (lbr_from_signext_quirk_needed()) 1707 + static_branch_enable(&lbr_from_quirk_key); 1708 + break; 1709 + 1703 1710 case LBR_FORMAT_EIP_FLAGS: 1704 1711 x86_pmu.lbr_from_flags = 1; 1705 1712 break;
+1
arch/x86/include/asm/cpufeatures.h
··· 302 302 #define X86_FEATURE_RETPOLINE_LFENCE (11*32+13) /* "" Use LFENCE for Spectre variant 2 */ 303 303 #define X86_FEATURE_RETHUNK (11*32+14) /* "" Use REturn THUNK */ 304 304 #define X86_FEATURE_UNRET (11*32+15) /* "" AMD BTB untrain return */ 305 + #define X86_FEATURE_USE_IBPB_FW (11*32+16) /* "" Use IBPB during runtime firmware calls */ 305 306 306 307 /* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */ 307 308 #define X86_FEATURE_AVX_VNNI (12*32+ 4) /* AVX VNNI instructions */
+2
arch/x86/include/asm/nospec-branch.h
··· 297 297 alternative_msr_write(MSR_IA32_SPEC_CTRL, \ 298 298 spec_ctrl_current() | SPEC_CTRL_IBRS, \ 299 299 X86_FEATURE_USE_IBRS_FW); \ 300 + alternative_msr_write(MSR_IA32_PRED_CMD, PRED_CMD_IBPB, \ 301 + X86_FEATURE_USE_IBPB_FW); \ 300 302 } while (0) 301 303 302 304 #define firmware_restrict_branch_speculation_end() \
+3 -1
arch/x86/kernel/alternative.c
··· 555 555 dest = addr + insn.length + insn.immediate.value; 556 556 557 557 if (__static_call_fixup(addr, op, dest) || 558 - WARN_ON_ONCE(dest != &__x86_return_thunk)) 558 + WARN_ONCE(dest != &__x86_return_thunk, 559 + "missing return thunk: %pS-%pS: %*ph", 560 + addr, dest, 5, addr)) 559 561 continue; 560 562 561 563 DPRINTK("return thunk at: %pS (%px) len: %d to: %pS",
+13 -1
arch/x86/kernel/cpu/bugs.c
··· 975 975 #define SPECTRE_V2_LFENCE_MSG "WARNING: LFENCE mitigation is not recommended for this CPU, data leaks possible!\n" 976 976 #define SPECTRE_V2_EIBRS_EBPF_MSG "WARNING: Unprivileged eBPF is enabled with eIBRS on, data leaks possible via Spectre v2 BHB attacks!\n" 977 977 #define SPECTRE_V2_EIBRS_LFENCE_EBPF_SMT_MSG "WARNING: Unprivileged eBPF is enabled with eIBRS+LFENCE mitigation and SMT, data leaks possible via Spectre v2 BHB attacks!\n" 978 + #define SPECTRE_V2_IBRS_PERF_MSG "WARNING: IBRS mitigation selected on Enhanced IBRS CPU, this may cause unnecessary performance loss\n" 978 979 979 980 #ifdef CONFIG_BPF_SYSCALL 980 981 void unpriv_ebpf_notify(int new_state) ··· 1416 1415 1417 1416 case SPECTRE_V2_IBRS: 1418 1417 setup_force_cpu_cap(X86_FEATURE_KERNEL_IBRS); 1418 + if (boot_cpu_has(X86_FEATURE_IBRS_ENHANCED)) 1419 + pr_warn(SPECTRE_V2_IBRS_PERF_MSG); 1419 1420 break; 1420 1421 1421 1422 case SPECTRE_V2_LFENCE: ··· 1519 1516 * the CPU supports Enhanced IBRS, kernel might un-intentionally not 1520 1517 * enable IBRS around firmware calls. 1521 1518 */ 1522 - if (boot_cpu_has(X86_FEATURE_IBRS) && !spectre_v2_in_ibrs_mode(mode)) { 1519 + if (boot_cpu_has_bug(X86_BUG_RETBLEED) && 1520 + (boot_cpu_data.x86_vendor == X86_VENDOR_AMD || 1521 + boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)) { 1522 + 1523 + if (retbleed_cmd != RETBLEED_CMD_IBPB) { 1524 + setup_force_cpu_cap(X86_FEATURE_USE_IBPB_FW); 1525 + pr_info("Enabling Speculation Barrier for firmware calls\n"); 1526 + } 1527 + 1528 + } else if (boot_cpu_has(X86_FEATURE_IBRS) && !spectre_v2_in_ibrs_mode(mode)) { 1523 1529 setup_force_cpu_cap(X86_FEATURE_USE_IBRS_FW); 1524 1530 pr_info("Enabling Restricted Speculation for firmware calls\n"); 1525 1531 }
+8
arch/x86/kvm/x86.c
··· 6029 6029 r = 0; 6030 6030 break; 6031 6031 case KVM_CAP_X86_USER_SPACE_MSR: 6032 + r = -EINVAL; 6033 + if (cap->args[0] & ~(KVM_MSR_EXIT_REASON_INVAL | 6034 + KVM_MSR_EXIT_REASON_UNKNOWN | 6035 + KVM_MSR_EXIT_REASON_FILTER)) 6036 + break; 6032 6037 kvm->arch.user_space_msr_mask = cap->args[0]; 6033 6038 r = 0; 6034 6039 break; ··· 6187 6182 6188 6183 if (copy_from_user(&filter, user_msr_filter, sizeof(filter))) 6189 6184 return -EFAULT; 6185 + 6186 + if (filter.flags & ~KVM_MSR_FILTER_DEFAULT_DENY) 6187 + return -EINVAL; 6190 6188 6191 6189 for (i = 0; i < ARRAY_SIZE(filter.ranges); i++) 6192 6190 empty &= !filter.ranges[i].nmsrs;
+1
certs/Kconfig
··· 43 43 bool "Provide system-wide ring of trusted keys" 44 44 depends on KEYS 45 45 depends on ASYMMETRIC_KEY_TYPE 46 + depends on X509_CERTIFICATE_PARSER 46 47 help 47 48 Provide a system keyring to which trusted keys can be added. Keys in 48 49 the keyring are considered to be trusted. Keys may be added at will
+4 -2
drivers/acpi/cppc_acpi.c
··· 782 782 783 783 if (!osc_cpc_flexible_adr_space_confirmed) { 784 784 pr_debug("Flexible address space capability not supported\n"); 785 - goto out_free; 785 + if (!cpc_supported_by_cpu()) 786 + goto out_free; 786 787 } 787 788 788 789 addr = ioremap(gas_t->address, gas_t->bit_width/8); ··· 810 809 } 811 810 if (!osc_cpc_flexible_adr_space_confirmed) { 812 811 pr_debug("Flexible address space capability not supported\n"); 813 - goto out_free; 812 + if (!cpc_supported_by_cpu()) 813 + goto out_free; 814 814 } 815 815 } else { 816 816 if (gas_t->space_id != ACPI_ADR_SPACE_FIXED_HARDWARE || !cpc_ffh_supported()) {
+1 -1
drivers/clk/clk-lan966x.c
··· 213 213 214 214 hw_data->hws[i] = 215 215 devm_clk_hw_register_gate(dev, clk_gate_desc[idx].name, 216 - "lan966x", 0, base, 216 + "lan966x", 0, gate_base, 217 217 clk_gate_desc[idx].bit_idx, 218 218 0, &clk_gate_lock); 219 219
+14 -8
drivers/gpio/gpio-pca953x.c
··· 351 351 .reg_bits = 8, 352 352 .val_bits = 8, 353 353 354 + .use_single_read = true, 355 + .use_single_write = true, 356 + 354 357 .readable_reg = pca953x_readable_register, 355 358 .writeable_reg = pca953x_writeable_register, 356 359 .volatile_reg = pca953x_volatile_register, ··· 909 906 static int device_pca95xx_init(struct pca953x_chip *chip, u32 invert) 910 907 { 911 908 DECLARE_BITMAP(val, MAX_LINE); 909 + u8 regaddr; 912 910 int ret; 913 911 914 - ret = regcache_sync_region(chip->regmap, chip->regs->output, 915 - chip->regs->output + NBANK(chip)); 912 + regaddr = pca953x_recalc_addr(chip, chip->regs->output, 0); 913 + ret = regcache_sync_region(chip->regmap, regaddr, 914 + regaddr + NBANK(chip) - 1); 916 915 if (ret) 917 916 goto out; 918 917 919 - ret = regcache_sync_region(chip->regmap, chip->regs->direction, 920 - chip->regs->direction + NBANK(chip)); 918 + regaddr = pca953x_recalc_addr(chip, chip->regs->direction, 0); 919 + ret = regcache_sync_region(chip->regmap, regaddr, 920 + regaddr + NBANK(chip) - 1); 921 921 if (ret) 922 922 goto out; 923 923 ··· 1133 1127 * sync these registers first and only then sync the rest. 1134 1128 */ 1135 1129 regaddr = pca953x_recalc_addr(chip, chip->regs->direction, 0); 1136 - ret = regcache_sync_region(chip->regmap, regaddr, regaddr + NBANK(chip)); 1130 + ret = regcache_sync_region(chip->regmap, regaddr, regaddr + NBANK(chip) - 1); 1137 1131 if (ret) { 1138 1132 dev_err(dev, "Failed to sync GPIO dir registers: %d\n", ret); 1139 1133 return ret; 1140 1134 } 1141 1135 1142 1136 regaddr = pca953x_recalc_addr(chip, chip->regs->output, 0); 1143 - ret = regcache_sync_region(chip->regmap, regaddr, regaddr + NBANK(chip)); 1137 + ret = regcache_sync_region(chip->regmap, regaddr, regaddr + NBANK(chip) - 1); 1144 1138 if (ret) { 1145 1139 dev_err(dev, "Failed to sync GPIO out registers: %d\n", ret); 1146 1140 return ret; ··· 1150 1144 if (chip->driver_data & PCA_PCAL) { 1151 1145 regaddr = pca953x_recalc_addr(chip, PCAL953X_IN_LATCH, 0); 1152 1146 ret = regcache_sync_region(chip->regmap, regaddr, 1153 - regaddr + NBANK(chip)); 1147 + regaddr + NBANK(chip) - 1); 1154 1148 if (ret) { 1155 1149 dev_err(dev, "Failed to sync INT latch registers: %d\n", 1156 1150 ret); ··· 1159 1153 1160 1154 regaddr = pca953x_recalc_addr(chip, PCAL953X_INT_MASK, 0); 1161 1155 ret = regcache_sync_region(chip->regmap, regaddr, 1162 - regaddr + NBANK(chip)); 1156 + regaddr + NBANK(chip) - 1); 1163 1157 if (ret) { 1164 1158 dev_err(dev, "Failed to sync INT mask registers: %d\n", 1165 1159 ret);
+1 -1
drivers/gpio/gpio-xilinx.c
··· 99 99 const unsigned long offset = (bit % BITS_PER_LONG) & BIT(5); 100 100 101 101 map[index] &= ~(0xFFFFFFFFul << offset); 102 - map[index] |= v << offset; 102 + map[index] |= (unsigned long)v << offset; 103 103 } 104 104 105 105 static inline int xgpio_regoffset(struct xgpio_instance *chip, int ch)
-6
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
··· 1364 1364 struct amdgpu_vm *vm) 1365 1365 { 1366 1366 struct amdkfd_process_info *process_info = vm->process_info; 1367 - struct amdgpu_bo *pd = vm->root.bo; 1368 1367 1369 1368 if (!process_info) 1370 1369 return; 1371 - 1372 - /* Release eviction fence from PD */ 1373 - amdgpu_bo_reserve(pd, false); 1374 - amdgpu_bo_fence(pd, NULL, false); 1375 - amdgpu_bo_unreserve(pd); 1376 1370 1377 1371 /* Update process info */ 1378 1372 mutex_lock(&process_info->lock);
+2 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
··· 40 40 { 41 41 struct amdgpu_bo_list *list = container_of(rcu, struct amdgpu_bo_list, 42 42 rhead); 43 - 43 + mutex_destroy(&list->bo_list_mutex); 44 44 kvfree(list); 45 45 } 46 46 ··· 136 136 137 137 trace_amdgpu_cs_bo_status(list->num_entries, total_size); 138 138 139 + mutex_init(&list->bo_list_mutex); 139 140 *result = list; 140 141 return 0; 141 142
+4
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.h
··· 47 47 struct amdgpu_bo *oa_obj; 48 48 unsigned first_userptr; 49 49 unsigned num_entries; 50 + 51 + /* Protect access during command submission. 52 + */ 53 + struct mutex bo_list_mutex; 50 54 }; 51 55 52 56 int amdgpu_bo_list_get(struct amdgpu_fpriv *fpriv, int id,
+13 -3
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
··· 519 519 return r; 520 520 } 521 521 522 + mutex_lock(&p->bo_list->bo_list_mutex); 523 + 522 524 /* One for TTM and one for the CS job */ 523 525 amdgpu_bo_list_for_each_entry(e, p->bo_list) 524 526 e->tv.num_shared = 2; ··· 653 651 kvfree(e->user_pages); 654 652 e->user_pages = NULL; 655 653 } 654 + mutex_unlock(&p->bo_list->bo_list_mutex); 656 655 } 657 656 return r; 658 657 } ··· 693 690 { 694 691 unsigned i; 695 692 696 - if (error && backoff) 693 + if (error && backoff) { 697 694 ttm_eu_backoff_reservation(&parser->ticket, 698 695 &parser->validated); 696 + mutex_unlock(&parser->bo_list->bo_list_mutex); 697 + } 699 698 700 699 for (i = 0; i < parser->num_post_deps; i++) { 701 700 drm_syncobj_put(parser->post_deps[i].syncobj); ··· 837 832 continue; 838 833 839 834 r = amdgpu_vm_bo_update(adev, bo_va, false); 840 - if (r) 835 + if (r) { 836 + mutex_unlock(&p->bo_list->bo_list_mutex); 841 837 return r; 838 + } 842 839 843 840 r = amdgpu_sync_fence(&p->job->sync, bo_va->last_pt_update); 844 - if (r) 841 + if (r) { 842 + mutex_unlock(&p->bo_list->bo_list_mutex); 845 843 return r; 844 + } 846 845 } 847 846 848 847 r = amdgpu_vm_handle_moved(adev, vm); ··· 1287 1278 1288 1279 ttm_eu_fence_buffer_objects(&p->ticket, &p->validated, p->fence); 1289 1280 mutex_unlock(&p->adev->notifier_lock); 1281 + mutex_unlock(&p->bo_list->bo_list_mutex); 1290 1282 1291 1283 return 0; 1292 1284
+19 -8
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 1653 1653 #if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) 1654 1654 adev->dm.crc_rd_wrk = amdgpu_dm_crtc_secure_display_create_work(); 1655 1655 #endif 1656 - if (dc_enable_dmub_notifications(adev->dm.dc)) { 1656 + if (dc_is_dmub_outbox_supported(adev->dm.dc)) { 1657 1657 init_completion(&adev->dm.dmub_aux_transfer_done); 1658 1658 adev->dm.dmub_notify = kzalloc(sizeof(struct dmub_notification), GFP_KERNEL); 1659 1659 if (!adev->dm.dmub_notify) { ··· 1688 1688 "amdgpu: failed to initialize sw for display support.\n"); 1689 1689 goto error; 1690 1690 } 1691 + 1692 + /* Enable outbox notification only after IRQ handlers are registered and DMUB is alive. 1693 + * It is expected that DMUB will resend any pending notifications at this point, for 1694 + * example HPD from DPIA. 1695 + */ 1696 + if (dc_is_dmub_outbox_supported(adev->dm.dc)) 1697 + dc_enable_dmub_outbox(adev->dm.dc); 1691 1698 1692 1699 /* create fake encoders for MST */ 1693 1700 dm_dp_create_fake_mst_encoders(adev); ··· 2685 2678 */ 2686 2679 link_enc_cfg_copy(adev->dm.dc->current_state, dc_state); 2687 2680 2688 - if (dc_enable_dmub_notifications(adev->dm.dc)) 2689 - amdgpu_dm_outbox_init(adev); 2690 - 2691 2681 r = dm_dmub_hw_init(adev); 2692 2682 if (r) 2693 2683 DRM_ERROR("DMUB interface failed to initialize: status=%d\n", r); ··· 2700 2696 dc_state->stream_status[i].plane_states[j]->update_flags.raw 2701 2697 = 0xffffffff; 2702 2698 } 2699 + } 2700 + 2701 + if (dc_is_dmub_outbox_supported(adev->dm.dc)) { 2702 + amdgpu_dm_outbox_init(adev); 2703 + dc_enable_dmub_outbox(adev->dm.dc); 2703 2704 } 2704 2705 2705 2706 WARN_ON(!dc_commit_state(dm->dc, dc_state)); ··· 2728 2719 /* TODO: Remove dc_state->dccg, use dc->dccg directly. */ 2729 2720 dc_resource_state_construct(dm->dc, dm_state->context); 2730 2721 2731 - /* Re-enable outbox interrupts for DPIA. */ 2732 - if (dc_enable_dmub_notifications(adev->dm.dc)) 2733 - amdgpu_dm_outbox_init(adev); 2734 - 2735 2722 /* Before powering on DC we need to re-initialize DMUB. */ 2736 2723 dm_dmub_hw_resume(adev); 2724 + 2725 + /* Re-enable outbox interrupts for DPIA. */ 2726 + if (dc_is_dmub_outbox_supported(adev->dm.dc)) { 2727 + amdgpu_dm_outbox_init(adev); 2728 + dc_enable_dmub_outbox(adev->dm.dc); 2729 + } 2737 2730 2738 2731 /* power on hardware */ 2739 2732 dc_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D0);
+8 -1
drivers/gpu/drm/drm_gem_ttm_helper.c
··· 64 64 struct iosys_map *map) 65 65 { 66 66 struct ttm_buffer_object *bo = drm_gem_ttm_of_gem(gem); 67 + int ret; 67 68 68 - return ttm_bo_vmap(bo, map); 69 + dma_resv_lock(gem->resv, NULL); 70 + ret = ttm_bo_vmap(bo, map); 71 + dma_resv_unlock(gem->resv); 72 + 73 + return ret; 69 74 } 70 75 EXPORT_SYMBOL(drm_gem_ttm_vmap); 71 76 ··· 87 82 { 88 83 struct ttm_buffer_object *bo = drm_gem_ttm_of_gem(gem); 89 84 85 + dma_resv_lock(gem->resv, NULL); 90 86 ttm_bo_vunmap(bo, map); 87 + dma_resv_unlock(gem->resv); 91 88 } 92 89 EXPORT_SYMBOL(drm_gem_ttm_vunmap); 93 90
+9 -2
drivers/gpu/drm/i915/gt/intel_context_types.h
··· 273 273 u8 child_index; 274 274 /** @guc: GuC specific members for parallel submission */ 275 275 struct { 276 - /** @wqi_head: head pointer in work queue */ 276 + /** @wqi_head: cached head pointer in work queue */ 277 277 u16 wqi_head; 278 - /** @wqi_tail: tail pointer in work queue */ 278 + /** @wqi_tail: cached tail pointer in work queue */ 279 279 u16 wqi_tail; 280 + /** @wq_head: pointer to the actual head in work queue */ 281 + u32 *wq_head; 282 + /** @wq_tail: pointer to the actual head in work queue */ 283 + u32 *wq_tail; 284 + /** @wq_status: pointer to the status in work queue */ 285 + u32 *wq_status; 286 + 280 287 /** 281 288 * @parent_page: page in context state (ce->state) used 282 289 * by parent for work queue, process descriptor
+11 -1
drivers/gpu/drm/i915/gt/intel_execlists_submission.c
··· 661 661 i915_request_put(rq); 662 662 } 663 663 664 + static u32 map_i915_prio_to_lrc_desc_prio(int prio) 665 + { 666 + if (prio > I915_PRIORITY_NORMAL) 667 + return GEN12_CTX_PRIORITY_HIGH; 668 + else if (prio < I915_PRIORITY_NORMAL) 669 + return GEN12_CTX_PRIORITY_LOW; 670 + else 671 + return GEN12_CTX_PRIORITY_NORMAL; 672 + } 673 + 664 674 static u64 execlists_update_context(struct i915_request *rq) 665 675 { 666 676 struct intel_context *ce = rq->context; ··· 679 669 680 670 desc = ce->lrc.desc; 681 671 if (rq->engine->flags & I915_ENGINE_HAS_EU_PRIORITY) 682 - desc |= lrc_desc_priority(rq_prio(rq)); 672 + desc |= map_i915_prio_to_lrc_desc_prio(rq_prio(rq)); 683 673 684 674 /* 685 675 * WaIdleLiteRestore:bdw,skl
-10
drivers/gpu/drm/i915/gt/intel_lrc.h
··· 111 111 #define XEHP_SW_COUNTER_SHIFT 58 112 112 #define XEHP_SW_COUNTER_WIDTH 6 113 113 114 - static inline u32 lrc_desc_priority(int prio) 115 - { 116 - if (prio > I915_PRIORITY_NORMAL) 117 - return GEN12_CTX_PRIORITY_HIGH; 118 - else if (prio < I915_PRIORITY_NORMAL) 119 - return GEN12_CTX_PRIORITY_LOW; 120 - else 121 - return GEN12_CTX_PRIORITY_NORMAL; 122 - } 123 - 124 114 static inline void lrc_runtime_start(struct intel_context *ce) 125 115 { 126 116 struct intel_context_stats *stats = &ce->stats;
+3
drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h
··· 122 122 INTEL_GUC_ACTION_SCHED_CONTEXT_MODE_DONE = 0x1002, 123 123 INTEL_GUC_ACTION_SCHED_ENGINE_MODE_SET = 0x1003, 124 124 INTEL_GUC_ACTION_SCHED_ENGINE_MODE_DONE = 0x1004, 125 + INTEL_GUC_ACTION_V69_SET_CONTEXT_PRIORITY = 0x1005, 126 + INTEL_GUC_ACTION_V69_SET_CONTEXT_EXECUTION_QUANTUM = 0x1006, 127 + INTEL_GUC_ACTION_V69_SET_CONTEXT_PREEMPTION_TIMEOUT = 0x1007, 125 128 INTEL_GUC_ACTION_CONTEXT_RESET_NOTIFICATION = 0x1008, 126 129 INTEL_GUC_ACTION_ENGINE_FAILURE_NOTIFICATION = 0x1009, 127 130 INTEL_GUC_ACTION_HOST2GUC_UPDATE_CONTEXT_POLICIES = 0x100B,
+5
drivers/gpu/drm/i915/gt/uc/intel_guc.h
··· 170 170 /** @ads_engine_usage_size: size of engine usage in the ADS */ 171 171 u32 ads_engine_usage_size; 172 172 173 + /** @lrc_desc_pool_v69: object allocated to hold the GuC LRC descriptor pool */ 174 + struct i915_vma *lrc_desc_pool_v69; 175 + /** @lrc_desc_pool_vaddr_v69: contents of the GuC LRC descriptor pool */ 176 + void *lrc_desc_pool_vaddr_v69; 177 + 173 178 /** 174 179 * @context_lookup: used to resolve intel_context from guc_id, if a 175 180 * context is present in this structure it is registered with the GuC
+45
drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h
··· 203 203 u32 fence_id; 204 204 } __packed; 205 205 206 + struct guc_process_desc_v69 { 207 + u32 stage_id; 208 + u64 db_base_addr; 209 + u32 head; 210 + u32 tail; 211 + u32 error_offset; 212 + u64 wq_base_addr; 213 + u32 wq_size_bytes; 214 + u32 wq_status; 215 + u32 engine_presence; 216 + u32 priority; 217 + u32 reserved[36]; 218 + } __packed; 219 + 206 220 struct guc_sched_wq_desc { 207 221 u32 head; 208 222 u32 tail; ··· 240 226 u32 hwlrca_hi; 241 227 }; 242 228 #define CONTEXT_REGISTRATION_FLAG_KMD BIT(0) 229 + 230 + /* Preempt to idle on quantum expiry */ 231 + #define CONTEXT_POLICY_FLAG_PREEMPT_TO_IDLE_V69 BIT(0) 232 + 233 + /* 234 + * GuC Context registration descriptor. 235 + * FIXME: This is only required to exist during context registration. 236 + * The current 1:1 between guc_lrc_desc and LRCs for the lifetime of the LRC 237 + * is not required. 238 + */ 239 + struct guc_lrc_desc_v69 { 240 + u32 hw_context_desc; 241 + u32 slpm_perf_mode_hint; /* SPLC v1 only */ 242 + u32 slpm_freq_hint; 243 + u32 engine_submit_mask; /* In logical space */ 244 + u8 engine_class; 245 + u8 reserved0[3]; 246 + u32 priority; 247 + u32 process_desc; 248 + u32 wq_addr; 249 + u32 wq_size; 250 + u32 context_flags; /* CONTEXT_REGISTRATION_* */ 251 + /* Time for one workload to execute. (in micro seconds) */ 252 + u32 execution_quantum; 253 + /* Time to wait for a preemption request to complete before issuing a 254 + * reset. (in micro seconds). 255 + */ 256 + u32 preemption_timeout; 257 + u32 policy_flags; /* CONTEXT_POLICY_* */ 258 + u32 reserved1[19]; 259 + } __packed; 243 260 244 261 /* 32-bit KLV structure as used by policy updates and others */ 245 262 struct guc_klv_generic_dw_t {
+319 -57
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
··· 414 414 }; 415 415 416 416 struct parent_scratch { 417 - struct guc_sched_wq_desc wq_desc; 417 + union guc_descs { 418 + struct guc_sched_wq_desc wq_desc; 419 + struct guc_process_desc_v69 pdesc; 420 + } descs; 418 421 419 422 struct sync_semaphore go; 420 423 struct sync_semaphore join[MAX_ENGINE_INSTANCE + 1]; 421 424 422 - u8 unused[WQ_OFFSET - sizeof(struct guc_sched_wq_desc) - 425 + u8 unused[WQ_OFFSET - sizeof(union guc_descs) - 423 426 sizeof(struct sync_semaphore) * (MAX_ENGINE_INSTANCE + 2)]; 424 427 425 428 u32 wq[WQ_SIZE / sizeof(u32)]; ··· 459 456 LRC_STATE_OFFSET) / sizeof(u32))); 460 457 } 461 458 462 - static struct guc_sched_wq_desc * 463 - __get_wq_desc(struct intel_context *ce) 459 + static struct guc_process_desc_v69 * 460 + __get_process_desc_v69(struct intel_context *ce) 464 461 { 465 462 struct parent_scratch *ps = __get_parent_scratch(ce); 466 463 467 - return &ps->wq_desc; 464 + return &ps->descs.pdesc; 468 465 } 469 466 470 - static u32 *get_wq_pointer(struct guc_sched_wq_desc *wq_desc, 471 - struct intel_context *ce, 472 - u32 wqi_size) 467 + static struct guc_sched_wq_desc * 468 + __get_wq_desc_v70(struct intel_context *ce) 469 + { 470 + struct parent_scratch *ps = __get_parent_scratch(ce); 471 + 472 + return &ps->descs.wq_desc; 473 + } 474 + 475 + static u32 *get_wq_pointer(struct intel_context *ce, u32 wqi_size) 473 476 { 474 477 /* 475 478 * Check for space in work queue. Caching a value of head pointer in ··· 485 476 #define AVAILABLE_SPACE \ 486 477 CIRC_SPACE(ce->parallel.guc.wqi_tail, ce->parallel.guc.wqi_head, WQ_SIZE) 487 478 if (wqi_size > AVAILABLE_SPACE) { 488 - ce->parallel.guc.wqi_head = READ_ONCE(wq_desc->head); 479 + ce->parallel.guc.wqi_head = READ_ONCE(*ce->parallel.guc.wq_head); 489 480 490 481 if (wqi_size > AVAILABLE_SPACE) 491 482 return NULL; ··· 504 495 return ce; 505 496 } 506 497 498 + static struct guc_lrc_desc_v69 *__get_lrc_desc_v69(struct intel_guc *guc, u32 index) 499 + { 500 + struct guc_lrc_desc_v69 *base = guc->lrc_desc_pool_vaddr_v69; 501 + 502 + if (!base) 503 + return NULL; 504 + 505 + GEM_BUG_ON(index >= GUC_MAX_CONTEXT_ID); 506 + 507 + return &base[index]; 508 + } 509 + 510 + static int guc_lrc_desc_pool_create_v69(struct intel_guc *guc) 511 + { 512 + u32 size; 513 + int ret; 514 + 515 + size = PAGE_ALIGN(sizeof(struct guc_lrc_desc_v69) * 516 + GUC_MAX_CONTEXT_ID); 517 + ret = intel_guc_allocate_and_map_vma(guc, size, &guc->lrc_desc_pool_v69, 518 + (void **)&guc->lrc_desc_pool_vaddr_v69); 519 + if (ret) 520 + return ret; 521 + 522 + return 0; 523 + } 524 + 525 + static void guc_lrc_desc_pool_destroy_v69(struct intel_guc *guc) 526 + { 527 + if (!guc->lrc_desc_pool_vaddr_v69) 528 + return; 529 + 530 + guc->lrc_desc_pool_vaddr_v69 = NULL; 531 + i915_vma_unpin_and_release(&guc->lrc_desc_pool_v69, I915_VMA_RELEASE_MAP); 532 + } 533 + 507 534 static inline bool guc_submission_initialized(struct intel_guc *guc) 508 535 { 509 536 return guc->submission_initialized; 537 + } 538 + 539 + static inline void _reset_lrc_desc_v69(struct intel_guc *guc, u32 id) 540 + { 541 + struct guc_lrc_desc_v69 *desc = __get_lrc_desc_v69(guc, id); 542 + 543 + if (desc) 544 + memset(desc, 0, sizeof(*desc)); 510 545 } 511 546 512 547 static inline bool ctx_id_mapped(struct intel_guc *guc, u32 id) ··· 578 525 579 526 if (unlikely(!guc_submission_initialized(guc))) 580 527 return; 528 + 529 + _reset_lrc_desc_v69(guc, id); 581 530 582 531 /* 583 532 * xarray API doesn't have xa_erase_irqsave wrapper, so calling ··· 666 611 true, timeout); 667 612 } 668 613 669 - static int guc_context_policy_init(struct intel_context *ce, bool loop); 614 + static int guc_context_policy_init_v70(struct intel_context *ce, bool loop); 670 615 static int try_context_registration(struct intel_context *ce, bool loop); 671 616 672 617 static int __guc_add_request(struct intel_guc *guc, struct i915_request *rq) ··· 694 639 GEM_BUG_ON(context_guc_id_invalid(ce)); 695 640 696 641 if (context_policy_required(ce)) { 697 - err = guc_context_policy_init(ce, false); 642 + err = guc_context_policy_init_v70(ce, false); 698 643 if (err) 699 644 return err; 700 645 } ··· 792 737 return (WQ_SIZE - ce->parallel.guc.wqi_tail); 793 738 } 794 739 795 - static void write_wqi(struct guc_sched_wq_desc *wq_desc, 796 - struct intel_context *ce, 797 - u32 wqi_size) 740 + static void write_wqi(struct intel_context *ce, u32 wqi_size) 798 741 { 799 742 BUILD_BUG_ON(!is_power_of_2(WQ_SIZE)); 800 743 ··· 803 750 804 751 ce->parallel.guc.wqi_tail = (ce->parallel.guc.wqi_tail + wqi_size) & 805 752 (WQ_SIZE - 1); 806 - WRITE_ONCE(wq_desc->tail, ce->parallel.guc.wqi_tail); 753 + WRITE_ONCE(*ce->parallel.guc.wq_tail, ce->parallel.guc.wqi_tail); 807 754 } 808 755 809 756 static int guc_wq_noop_append(struct intel_context *ce) 810 757 { 811 - struct guc_sched_wq_desc *wq_desc = __get_wq_desc(ce); 812 - u32 *wqi = get_wq_pointer(wq_desc, ce, wq_space_until_wrap(ce)); 758 + u32 *wqi = get_wq_pointer(ce, wq_space_until_wrap(ce)); 813 759 u32 len_dw = wq_space_until_wrap(ce) / sizeof(u32) - 1; 814 760 815 761 if (!wqi) ··· 827 775 { 828 776 struct intel_context *ce = request_to_scheduling_context(rq); 829 777 struct intel_context *child; 830 - struct guc_sched_wq_desc *wq_desc = __get_wq_desc(ce); 831 778 unsigned int wqi_size = (ce->parallel.number_children + 4) * 832 779 sizeof(u32); 833 780 u32 *wqi; ··· 846 795 return ret; 847 796 } 848 797 849 - wqi = get_wq_pointer(wq_desc, ce, wqi_size); 798 + wqi = get_wq_pointer(ce, wqi_size); 850 799 if (!wqi) 851 800 return -EBUSY; 852 801 ··· 861 810 for_each_child(ce, child) 862 811 *wqi++ = child->ring->tail / sizeof(u64); 863 812 864 - write_wqi(wq_desc, ce, wqi_size); 813 + write_wqi(ce, wqi_size); 865 814 866 815 return 0; 867 816 } ··· 1919 1868 int intel_guc_submission_init(struct intel_guc *guc) 1920 1869 { 1921 1870 struct intel_gt *gt = guc_to_gt(guc); 1871 + int ret; 1922 1872 1923 1873 if (guc->submission_initialized) 1924 1874 return 0; 1925 1875 1876 + if (guc->fw.major_ver_found < 70) { 1877 + ret = guc_lrc_desc_pool_create_v69(guc); 1878 + if (ret) 1879 + return ret; 1880 + } 1881 + 1926 1882 guc->submission_state.guc_ids_bitmap = 1927 1883 bitmap_zalloc(NUMBER_MULTI_LRC_GUC_ID(guc), GFP_KERNEL); 1928 - if (!guc->submission_state.guc_ids_bitmap) 1929 - return -ENOMEM; 1884 + if (!guc->submission_state.guc_ids_bitmap) { 1885 + ret = -ENOMEM; 1886 + goto destroy_pool; 1887 + } 1930 1888 1931 1889 guc->timestamp.ping_delay = (POLL_TIME_CLKS / gt->clock_frequency + 1) * HZ; 1932 1890 guc->timestamp.shift = gpm_timestamp_shift(gt); 1933 1891 guc->submission_initialized = true; 1934 1892 1935 1893 return 0; 1894 + 1895 + destroy_pool: 1896 + guc_lrc_desc_pool_destroy_v69(guc); 1897 + 1898 + return ret; 1936 1899 } 1937 1900 1938 1901 void intel_guc_submission_fini(struct intel_guc *guc) ··· 1955 1890 return; 1956 1891 1957 1892 guc_flush_destroyed_contexts(guc); 1893 + guc_lrc_desc_pool_destroy_v69(guc); 1958 1894 i915_sched_engine_put(guc->sched_engine); 1959 1895 bitmap_free(guc->submission_state.guc_ids_bitmap); 1960 1896 guc->submission_initialized = false; ··· 2213 2147 spin_unlock_irqrestore(&guc->submission_state.lock, flags); 2214 2148 } 2215 2149 2216 - static int __guc_action_register_multi_lrc(struct intel_guc *guc, 2217 - struct intel_context *ce, 2218 - struct guc_ctxt_registration_info *info, 2219 - bool loop) 2150 + static int __guc_action_register_multi_lrc_v69(struct intel_guc *guc, 2151 + struct intel_context *ce, 2152 + u32 guc_id, 2153 + u32 offset, 2154 + bool loop) 2155 + { 2156 + struct intel_context *child; 2157 + u32 action[4 + MAX_ENGINE_INSTANCE]; 2158 + int len = 0; 2159 + 2160 + GEM_BUG_ON(ce->parallel.number_children > MAX_ENGINE_INSTANCE); 2161 + 2162 + action[len++] = INTEL_GUC_ACTION_REGISTER_CONTEXT_MULTI_LRC; 2163 + action[len++] = guc_id; 2164 + action[len++] = ce->parallel.number_children + 1; 2165 + action[len++] = offset; 2166 + for_each_child(ce, child) { 2167 + offset += sizeof(struct guc_lrc_desc_v69); 2168 + action[len++] = offset; 2169 + } 2170 + 2171 + return guc_submission_send_busy_loop(guc, action, len, 0, loop); 2172 + } 2173 + 2174 + static int __guc_action_register_multi_lrc_v70(struct intel_guc *guc, 2175 + struct intel_context *ce, 2176 + struct guc_ctxt_registration_info *info, 2177 + bool loop) 2220 2178 { 2221 2179 struct intel_context *child; 2222 2180 u32 action[13 + (MAX_ENGINE_INSTANCE * 2)]; ··· 2280 2190 return guc_submission_send_busy_loop(guc, action, len, 0, loop); 2281 2191 } 2282 2192 2283 - static int __guc_action_register_context(struct intel_guc *guc, 2284 - struct guc_ctxt_registration_info *info, 2285 - bool loop) 2193 + static int __guc_action_register_context_v69(struct intel_guc *guc, 2194 + u32 guc_id, 2195 + u32 offset, 2196 + bool loop) 2197 + { 2198 + u32 action[] = { 2199 + INTEL_GUC_ACTION_REGISTER_CONTEXT, 2200 + guc_id, 2201 + offset, 2202 + }; 2203 + 2204 + return guc_submission_send_busy_loop(guc, action, ARRAY_SIZE(action), 2205 + 0, loop); 2206 + } 2207 + 2208 + static int __guc_action_register_context_v70(struct intel_guc *guc, 2209 + struct guc_ctxt_registration_info *info, 2210 + bool loop) 2286 2211 { 2287 2212 u32 action[] = { 2288 2213 INTEL_GUC_ACTION_REGISTER_CONTEXT, ··· 2318 2213 0, loop); 2319 2214 } 2320 2215 2321 - static void prepare_context_registration_info(struct intel_context *ce, 2322 - struct guc_ctxt_registration_info *info); 2216 + static void prepare_context_registration_info_v69(struct intel_context *ce); 2217 + static void prepare_context_registration_info_v70(struct intel_context *ce, 2218 + struct guc_ctxt_registration_info *info); 2219 + 2220 + static int 2221 + register_context_v69(struct intel_guc *guc, struct intel_context *ce, bool loop) 2222 + { 2223 + u32 offset = intel_guc_ggtt_offset(guc, guc->lrc_desc_pool_v69) + 2224 + ce->guc_id.id * sizeof(struct guc_lrc_desc_v69); 2225 + 2226 + prepare_context_registration_info_v69(ce); 2227 + 2228 + if (intel_context_is_parent(ce)) 2229 + return __guc_action_register_multi_lrc_v69(guc, ce, ce->guc_id.id, 2230 + offset, loop); 2231 + else 2232 + return __guc_action_register_context_v69(guc, ce->guc_id.id, 2233 + offset, loop); 2234 + } 2235 + 2236 + static int 2237 + register_context_v70(struct intel_guc *guc, struct intel_context *ce, bool loop) 2238 + { 2239 + struct guc_ctxt_registration_info info; 2240 + 2241 + prepare_context_registration_info_v70(ce, &info); 2242 + 2243 + if (intel_context_is_parent(ce)) 2244 + return __guc_action_register_multi_lrc_v70(guc, ce, &info, loop); 2245 + else 2246 + return __guc_action_register_context_v70(guc, &info, loop); 2247 + } 2323 2248 2324 2249 static int register_context(struct intel_context *ce, bool loop) 2325 2250 { 2326 - struct guc_ctxt_registration_info info; 2327 2251 struct intel_guc *guc = ce_to_guc(ce); 2328 2252 int ret; 2329 2253 2330 2254 GEM_BUG_ON(intel_context_is_child(ce)); 2331 2255 trace_intel_context_register(ce); 2332 2256 2333 - prepare_context_registration_info(ce, &info); 2334 - 2335 - if (intel_context_is_parent(ce)) 2336 - ret = __guc_action_register_multi_lrc(guc, ce, &info, loop); 2257 + if (guc->fw.major_ver_found >= 70) 2258 + ret = register_context_v70(guc, ce, loop); 2337 2259 else 2338 - ret = __guc_action_register_context(guc, &info, loop); 2260 + ret = register_context_v69(guc, ce, loop); 2261 + 2339 2262 if (likely(!ret)) { 2340 2263 unsigned long flags; 2341 2264 ··· 2371 2238 set_context_registered(ce); 2372 2239 spin_unlock_irqrestore(&ce->guc_state.lock, flags); 2373 2240 2374 - guc_context_policy_init(ce, loop); 2241 + if (guc->fw.major_ver_found >= 70) 2242 + guc_context_policy_init_v70(ce, loop); 2375 2243 } 2376 2244 2377 2245 return ret; ··· 2469 2335 0, loop); 2470 2336 } 2471 2337 2472 - static int guc_context_policy_init(struct intel_context *ce, bool loop) 2338 + static int guc_context_policy_init_v70(struct intel_context *ce, bool loop) 2473 2339 { 2474 2340 struct intel_engine_cs *engine = ce->engine; 2475 2341 struct intel_guc *guc = &engine->gt->uc.guc; ··· 2528 2394 return ret; 2529 2395 } 2530 2396 2531 - static void prepare_context_registration_info(struct intel_context *ce, 2532 - struct guc_ctxt_registration_info *info) 2397 + static void guc_context_policy_init_v69(struct intel_engine_cs *engine, 2398 + struct guc_lrc_desc_v69 *desc) 2399 + { 2400 + desc->policy_flags = 0; 2401 + 2402 + if (engine->flags & I915_ENGINE_WANT_FORCED_PREEMPTION) 2403 + desc->policy_flags |= CONTEXT_POLICY_FLAG_PREEMPT_TO_IDLE_V69; 2404 + 2405 + /* NB: For both of these, zero means disabled. */ 2406 + desc->execution_quantum = engine->props.timeslice_duration_ms * 1000; 2407 + desc->preemption_timeout = engine->props.preempt_timeout_ms * 1000; 2408 + } 2409 + 2410 + static u32 map_guc_prio_to_lrc_desc_prio(u8 prio) 2411 + { 2412 + /* 2413 + * this matches the mapping we do in map_i915_prio_to_guc_prio() 2414 + * (e.g. prio < I915_PRIORITY_NORMAL maps to GUC_CLIENT_PRIORITY_NORMAL) 2415 + */ 2416 + switch (prio) { 2417 + default: 2418 + MISSING_CASE(prio); 2419 + fallthrough; 2420 + case GUC_CLIENT_PRIORITY_KMD_NORMAL: 2421 + return GEN12_CTX_PRIORITY_NORMAL; 2422 + case GUC_CLIENT_PRIORITY_NORMAL: 2423 + return GEN12_CTX_PRIORITY_LOW; 2424 + case GUC_CLIENT_PRIORITY_HIGH: 2425 + case GUC_CLIENT_PRIORITY_KMD_HIGH: 2426 + return GEN12_CTX_PRIORITY_HIGH; 2427 + } 2428 + } 2429 + 2430 + static void prepare_context_registration_info_v69(struct intel_context *ce) 2431 + { 2432 + struct intel_engine_cs *engine = ce->engine; 2433 + struct intel_guc *guc = &engine->gt->uc.guc; 2434 + u32 ctx_id = ce->guc_id.id; 2435 + struct guc_lrc_desc_v69 *desc; 2436 + struct intel_context *child; 2437 + 2438 + GEM_BUG_ON(!engine->mask); 2439 + 2440 + /* 2441 + * Ensure LRC + CT vmas are is same region as write barrier is done 2442 + * based on CT vma region. 2443 + */ 2444 + GEM_BUG_ON(i915_gem_object_is_lmem(guc->ct.vma->obj) != 2445 + i915_gem_object_is_lmem(ce->ring->vma->obj)); 2446 + 2447 + desc = __get_lrc_desc_v69(guc, ctx_id); 2448 + desc->engine_class = engine_class_to_guc_class(engine->class); 2449 + desc->engine_submit_mask = engine->logical_mask; 2450 + desc->hw_context_desc = ce->lrc.lrca; 2451 + desc->priority = ce->guc_state.prio; 2452 + desc->context_flags = CONTEXT_REGISTRATION_FLAG_KMD; 2453 + guc_context_policy_init_v69(engine, desc); 2454 + 2455 + /* 2456 + * If context is a parent, we need to register a process descriptor 2457 + * describing a work queue and register all child contexts. 2458 + */ 2459 + if (intel_context_is_parent(ce)) { 2460 + struct guc_process_desc_v69 *pdesc; 2461 + 2462 + ce->parallel.guc.wqi_tail = 0; 2463 + ce->parallel.guc.wqi_head = 0; 2464 + 2465 + desc->process_desc = i915_ggtt_offset(ce->state) + 2466 + __get_parent_scratch_offset(ce); 2467 + desc->wq_addr = i915_ggtt_offset(ce->state) + 2468 + __get_wq_offset(ce); 2469 + desc->wq_size = WQ_SIZE; 2470 + 2471 + pdesc = __get_process_desc_v69(ce); 2472 + memset(pdesc, 0, sizeof(*(pdesc))); 2473 + pdesc->stage_id = ce->guc_id.id; 2474 + pdesc->wq_base_addr = desc->wq_addr; 2475 + pdesc->wq_size_bytes = desc->wq_size; 2476 + pdesc->wq_status = WQ_STATUS_ACTIVE; 2477 + 2478 + ce->parallel.guc.wq_head = &pdesc->head; 2479 + ce->parallel.guc.wq_tail = &pdesc->tail; 2480 + ce->parallel.guc.wq_status = &pdesc->wq_status; 2481 + 2482 + for_each_child(ce, child) { 2483 + desc = __get_lrc_desc_v69(guc, child->guc_id.id); 2484 + 2485 + desc->engine_class = 2486 + engine_class_to_guc_class(engine->class); 2487 + desc->hw_context_desc = child->lrc.lrca; 2488 + desc->priority = ce->guc_state.prio; 2489 + desc->context_flags = CONTEXT_REGISTRATION_FLAG_KMD; 2490 + guc_context_policy_init_v69(engine, desc); 2491 + } 2492 + 2493 + clear_children_join_go_memory(ce); 2494 + } 2495 + } 2496 + 2497 + static void prepare_context_registration_info_v70(struct intel_context *ce, 2498 + struct guc_ctxt_registration_info *info) 2533 2499 { 2534 2500 struct intel_engine_cs *engine = ce->engine; 2535 2501 struct intel_guc *guc = &engine->gt->uc.guc; ··· 2654 2420 */ 2655 2421 info->hwlrca_lo = lower_32_bits(ce->lrc.lrca); 2656 2422 info->hwlrca_hi = upper_32_bits(ce->lrc.lrca); 2423 + if (engine->flags & I915_ENGINE_HAS_EU_PRIORITY) 2424 + info->hwlrca_lo |= map_guc_prio_to_lrc_desc_prio(ce->guc_state.prio); 2657 2425 info->flags = CONTEXT_REGISTRATION_FLAG_KMD; 2658 2426 2659 2427 /* ··· 2679 2443 info->wq_base_hi = upper_32_bits(wq_base_offset); 2680 2444 info->wq_size = WQ_SIZE; 2681 2445 2682 - wq_desc = __get_wq_desc(ce); 2446 + wq_desc = __get_wq_desc_v70(ce); 2683 2447 memset(wq_desc, 0, sizeof(*wq_desc)); 2684 2448 wq_desc->wq_status = WQ_STATUS_ACTIVE; 2449 + 2450 + ce->parallel.guc.wq_head = &wq_desc->head; 2451 + ce->parallel.guc.wq_tail = &wq_desc->tail; 2452 + ce->parallel.guc.wq_status = &wq_desc->wq_status; 2685 2453 2686 2454 clear_children_join_go_memory(ce); 2687 2455 } ··· 3001 2761 u16 guc_id, 3002 2762 u32 preemption_timeout) 3003 2763 { 3004 - struct context_policy policy; 2764 + if (guc->fw.major_ver_found >= 70) { 2765 + struct context_policy policy; 3005 2766 3006 - __guc_context_policy_start_klv(&policy, guc_id); 3007 - __guc_context_policy_add_preemption_timeout(&policy, preemption_timeout); 3008 - __guc_context_set_context_policies(guc, &policy, true); 2767 + __guc_context_policy_start_klv(&policy, guc_id); 2768 + __guc_context_policy_add_preemption_timeout(&policy, preemption_timeout); 2769 + __guc_context_set_context_policies(guc, &policy, true); 2770 + } else { 2771 + u32 action[] = { 2772 + INTEL_GUC_ACTION_V69_SET_CONTEXT_PREEMPTION_TIMEOUT, 2773 + guc_id, 2774 + preemption_timeout 2775 + }; 2776 + 2777 + intel_guc_send_busy_loop(guc, action, ARRAY_SIZE(action), 0, true); 2778 + } 3009 2779 } 3010 2780 3011 2781 static void guc_context_ban(struct intel_context *ce, struct i915_request *rq) ··· 3263 3013 static void __guc_context_set_prio(struct intel_guc *guc, 3264 3014 struct intel_context *ce) 3265 3015 { 3266 - struct context_policy policy; 3016 + if (guc->fw.major_ver_found >= 70) { 3017 + struct context_policy policy; 3267 3018 3268 - __guc_context_policy_start_klv(&policy, ce->guc_id.id); 3269 - __guc_context_policy_add_priority(&policy, ce->guc_state.prio); 3270 - __guc_context_set_context_policies(guc, &policy, true); 3019 + __guc_context_policy_start_klv(&policy, ce->guc_id.id); 3020 + __guc_context_policy_add_priority(&policy, ce->guc_state.prio); 3021 + __guc_context_set_context_policies(guc, &policy, true); 3022 + } else { 3023 + u32 action[] = { 3024 + INTEL_GUC_ACTION_V69_SET_CONTEXT_PRIORITY, 3025 + ce->guc_id.id, 3026 + ce->guc_state.prio, 3027 + }; 3028 + 3029 + guc_submission_send_busy_loop(guc, action, ARRAY_SIZE(action), 0, true); 3030 + } 3271 3031 } 3272 3032 3273 3033 static void guc_context_set_prio(struct intel_guc *guc, ··· 4787 4527 guc_log_context_priority(p, ce); 4788 4528 4789 4529 if (intel_context_is_parent(ce)) { 4790 - struct guc_sched_wq_desc *wq_desc = __get_wq_desc(ce); 4791 4530 struct intel_context *child; 4792 4531 4793 4532 drm_printf(p, "\t\tNumber children: %u\n", 4794 4533 ce->parallel.number_children); 4795 - drm_printf(p, "\t\tWQI Head: %u\n", 4796 - READ_ONCE(wq_desc->head)); 4797 - drm_printf(p, "\t\tWQI Tail: %u\n", 4798 - READ_ONCE(wq_desc->tail)); 4799 - drm_printf(p, "\t\tWQI Status: %u\n\n", 4800 - READ_ONCE(wq_desc->wq_status)); 4534 + 4535 + if (ce->parallel.guc.wq_status) { 4536 + drm_printf(p, "\t\tWQI Head: %u\n", 4537 + READ_ONCE(*ce->parallel.guc.wq_head)); 4538 + drm_printf(p, "\t\tWQI Tail: %u\n", 4539 + READ_ONCE(*ce->parallel.guc.wq_tail)); 4540 + drm_printf(p, "\t\tWQI Status: %u\n\n", 4541 + READ_ONCE(*ce->parallel.guc.wq_status)); 4542 + } 4801 4543 4802 4544 if (ce->engine->emit_bb_start == 4803 4545 emit_bb_start_parent_no_preempt_mid_batch) {
+52 -4
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
··· 70 70 fw_def(BROXTON, 0, guc_def(bxt, 70, 1, 1)) \ 71 71 fw_def(SKYLAKE, 0, guc_def(skl, 70, 1, 1)) 72 72 73 + #define INTEL_GUC_FIRMWARE_DEFS_FALLBACK(fw_def, guc_def) \ 74 + fw_def(ALDERLAKE_P, 0, guc_def(adlp, 69, 0, 3)) \ 75 + fw_def(ALDERLAKE_S, 0, guc_def(tgl, 69, 0, 3)) 76 + 73 77 #define INTEL_HUC_FIRMWARE_DEFS(fw_def, huc_def) \ 74 78 fw_def(ALDERLAKE_P, 0, huc_def(tgl, 7, 9, 3)) \ 75 79 fw_def(ALDERLAKE_S, 0, huc_def(tgl, 7, 9, 3)) \ ··· 109 105 MODULE_FIRMWARE(uc_); 110 106 111 107 INTEL_GUC_FIRMWARE_DEFS(INTEL_UC_MODULE_FW, MAKE_GUC_FW_PATH) 108 + INTEL_GUC_FIRMWARE_DEFS_FALLBACK(INTEL_UC_MODULE_FW, MAKE_GUC_FW_PATH) 112 109 INTEL_HUC_FIRMWARE_DEFS(INTEL_UC_MODULE_FW, MAKE_HUC_FW_PATH) 113 110 114 111 /* The below structs and macros are used to iterate across the list of blobs */ ··· 154 149 static const struct uc_fw_platform_requirement blobs_guc[] = { 155 150 INTEL_GUC_FIRMWARE_DEFS(MAKE_FW_LIST, GUC_FW_BLOB) 156 151 }; 152 + static const struct uc_fw_platform_requirement blobs_guc_fallback[] = { 153 + INTEL_GUC_FIRMWARE_DEFS_FALLBACK(MAKE_FW_LIST, GUC_FW_BLOB) 154 + }; 157 155 static const struct uc_fw_platform_requirement blobs_huc[] = { 158 156 INTEL_HUC_FIRMWARE_DEFS(MAKE_FW_LIST, HUC_FW_BLOB) 159 157 }; ··· 187 179 if (p == fw_blobs[i].p && rev >= fw_blobs[i].rev) { 188 180 const struct uc_fw_blob *blob = &fw_blobs[i].blob; 189 181 uc_fw->path = blob->path; 182 + uc_fw->wanted_path = blob->path; 190 183 uc_fw->major_ver_wanted = blob->major; 191 184 uc_fw->minor_ver_wanted = blob->minor; 192 185 break; 186 + } 187 + } 188 + 189 + if (uc_fw->type == INTEL_UC_FW_TYPE_GUC) { 190 + const struct uc_fw_platform_requirement *blobs = blobs_guc_fallback; 191 + u32 count = ARRAY_SIZE(blobs_guc_fallback); 192 + 193 + for (i = 0; i < count && p <= blobs[i].p; i++) { 194 + if (p == blobs[i].p && rev >= blobs[i].rev) { 195 + const struct uc_fw_blob *blob = &blobs[i].blob; 196 + 197 + uc_fw->fallback.path = blob->path; 198 + uc_fw->fallback.major_ver = blob->major; 199 + uc_fw->fallback.minor_ver = blob->minor; 200 + break; 201 + } 193 202 } 194 203 } 195 204 ··· 363 338 __force_fw_fetch_failures(uc_fw, -EINVAL); 364 339 __force_fw_fetch_failures(uc_fw, -ESTALE); 365 340 366 - err = request_firmware(&fw, uc_fw->path, dev); 341 + err = firmware_request_nowarn(&fw, uc_fw->path, dev); 342 + if (err && !intel_uc_fw_is_overridden(uc_fw) && uc_fw->fallback.path) { 343 + err = firmware_request_nowarn(&fw, uc_fw->fallback.path, dev); 344 + if (!err) { 345 + drm_notice(&i915->drm, 346 + "%s firmware %s is recommended, but only %s was found\n", 347 + intel_uc_fw_type_repr(uc_fw->type), 348 + uc_fw->wanted_path, 349 + uc_fw->fallback.path); 350 + drm_info(&i915->drm, 351 + "Consider updating your linux-firmware pkg or downloading from %s\n", 352 + INTEL_UC_FIRMWARE_URL); 353 + 354 + uc_fw->path = uc_fw->fallback.path; 355 + uc_fw->major_ver_wanted = uc_fw->fallback.major_ver; 356 + uc_fw->minor_ver_wanted = uc_fw->fallback.minor_ver; 357 + } 358 + } 367 359 if (err) 368 360 goto fail; 369 361 ··· 479 437 INTEL_UC_FIRMWARE_MISSING : 480 438 INTEL_UC_FIRMWARE_ERROR); 481 439 482 - drm_notice(&i915->drm, "%s firmware %s: fetch failed with error %d\n", 483 - intel_uc_fw_type_repr(uc_fw->type), uc_fw->path, err); 440 + i915_probe_error(i915, "%s firmware %s: fetch failed with error %d\n", 441 + intel_uc_fw_type_repr(uc_fw->type), uc_fw->path, err); 484 442 drm_info(&i915->drm, "%s firmware(s) can be downloaded from %s\n", 485 443 intel_uc_fw_type_repr(uc_fw->type), INTEL_UC_FIRMWARE_URL); 486 444 ··· 838 796 void intel_uc_fw_dump(const struct intel_uc_fw *uc_fw, struct drm_printer *p) 839 797 { 840 798 drm_printf(p, "%s firmware: %s\n", 841 - intel_uc_fw_type_repr(uc_fw->type), uc_fw->path); 799 + intel_uc_fw_type_repr(uc_fw->type), uc_fw->wanted_path); 800 + if (uc_fw->fallback.path) { 801 + drm_printf(p, "%s firmware fallback: %s\n", 802 + intel_uc_fw_type_repr(uc_fw->type), uc_fw->fallback.path); 803 + drm_printf(p, "fallback selected: %s\n", 804 + str_yes_no(uc_fw->path == uc_fw->fallback.path)); 805 + } 842 806 drm_printf(p, "\tstatus: %s\n", 843 807 intel_uc_fw_status_repr(uc_fw->status)); 844 808 drm_printf(p, "\tversion: wanted %u.%u, found %u.%u\n",
+7
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h
··· 74 74 const enum intel_uc_fw_status status; 75 75 enum intel_uc_fw_status __status; /* no accidental overwrites */ 76 76 }; 77 + const char *wanted_path; 77 78 const char *path; 78 79 bool user_overridden; 79 80 size_t size; ··· 98 97 u16 minor_ver_wanted; 99 98 u16 major_ver_found; 100 99 u16 minor_ver_found; 100 + 101 + struct { 102 + const char *path; 103 + u16 major_ver; 104 + u16 minor_ver; 105 + } fallback; 101 106 102 107 u32 rsa_size; 103 108 u32 ucode_size;
+3
drivers/gpu/drm/imx/dcss/dcss-dev.c
··· 207 207 208 208 ret = dcss_submodules_init(dcss); 209 209 if (ret) { 210 + of_node_put(dcss->of_port); 210 211 dev_err(dev, "submodules initialization failed\n"); 211 212 goto clks_err; 212 213 } ··· 237 236 dcss_ctxld_suspend(dcss->ctxld); 238 237 dcss_clocks_disable(dcss); 239 238 } 239 + 240 + of_node_put(dcss->of_port); 240 241 241 242 pm_runtime_disable(dcss->dev); 242 243
+1 -1
drivers/gpu/drm/panel/panel-edp.c
··· 713 713 of_property_read_u32(dev->of_node, "hpd-reliable-delay-ms", &reliable_ms); 714 714 desc->delay.hpd_reliable = reliable_ms; 715 715 of_property_read_u32(dev->of_node, "hpd-absent-delay-ms", &absent_ms); 716 - desc->delay.hpd_reliable = absent_ms; 716 + desc->delay.hpd_absent = absent_ms; 717 717 718 718 /* Power the panel on so we can read the EDID */ 719 719 ret = pm_runtime_get_sync(dev);
+3 -3
drivers/gpu/drm/scheduler/sched_entity.c
··· 190 190 } 191 191 EXPORT_SYMBOL(drm_sched_entity_flush); 192 192 193 - static void drm_sched_entity_kill_jobs_irq_work(struct irq_work *wrk) 193 + static void drm_sched_entity_kill_jobs_work(struct work_struct *wrk) 194 194 { 195 195 struct drm_sched_job *job = container_of(wrk, typeof(*job), work); 196 196 ··· 207 207 struct drm_sched_job *job = container_of(cb, struct drm_sched_job, 208 208 finish_cb); 209 209 210 - init_irq_work(&job->work, drm_sched_entity_kill_jobs_irq_work); 211 - irq_work_queue(&job->work); 210 + INIT_WORK(&job->work, drm_sched_entity_kill_jobs_work); 211 + schedule_work(&job->work); 212 212 } 213 213 214 214 static struct dma_fence *
+5 -25
drivers/i2c/busses/i2c-cadence.c
··· 388 388 */ 389 389 static irqreturn_t cdns_i2c_master_isr(void *ptr) 390 390 { 391 - unsigned int isr_status, avail_bytes, updatetx; 391 + unsigned int isr_status, avail_bytes; 392 392 unsigned int bytes_to_send; 393 - bool hold_quirk; 393 + bool updatetx; 394 394 struct cdns_i2c *id = ptr; 395 395 /* Signal completion only after everything is updated */ 396 396 int done_flag = 0; ··· 410 410 * Check if transfer size register needs to be updated again for a 411 411 * large data receive operation. 412 412 */ 413 - updatetx = 0; 414 - if (id->recv_count > id->curr_recv_count) 415 - updatetx = 1; 416 - 417 - hold_quirk = (id->quirks & CDNS_I2C_BROKEN_HOLD_BIT) && updatetx; 413 + updatetx = id->recv_count > id->curr_recv_count; 418 414 419 415 /* When receiving, handle data interrupt and completion interrupt */ 420 416 if (id->p_recv_buf && ··· 441 445 break; 442 446 } 443 447 444 - if (cdns_is_holdquirk(id, hold_quirk)) 448 + if (cdns_is_holdquirk(id, updatetx)) 445 449 break; 446 450 } 447 451 ··· 452 456 * maintain transfer size non-zero while performing a large 453 457 * receive operation. 454 458 */ 455 - if (cdns_is_holdquirk(id, hold_quirk)) { 459 + if (cdns_is_holdquirk(id, updatetx)) { 456 460 /* wait while fifo is full */ 457 461 while (cdns_i2c_readreg(CDNS_I2C_XFER_SIZE_OFFSET) != 458 462 (id->curr_recv_count - CDNS_I2C_FIFO_DEPTH)) ··· 472 476 cdns_i2c_writereg(id->recv_count - 473 477 CDNS_I2C_FIFO_DEPTH, 474 478 CDNS_I2C_XFER_SIZE_OFFSET); 475 - id->curr_recv_count = id->recv_count; 476 - } 477 - } else if (id->recv_count && !hold_quirk && 478 - !id->curr_recv_count) { 479 - 480 - /* Set the slave address in address register*/ 481 - cdns_i2c_writereg(id->p_msg->addr & CDNS_I2C_ADDR_MASK, 482 - CDNS_I2C_ADDR_OFFSET); 483 - 484 - if (id->recv_count > CDNS_I2C_TRANSFER_SIZE) { 485 - cdns_i2c_writereg(CDNS_I2C_TRANSFER_SIZE, 486 - CDNS_I2C_XFER_SIZE_OFFSET); 487 - id->curr_recv_count = CDNS_I2C_TRANSFER_SIZE; 488 - } else { 489 - cdns_i2c_writereg(id->recv_count, 490 - CDNS_I2C_XFER_SIZE_OFFSET); 491 479 id->curr_recv_count = id->recv_count; 492 480 } 493 481 }
+1 -1
drivers/i2c/busses/i2c-imx.c
··· 66 66 67 67 /* IMX I2C registers: 68 68 * the I2C register offset is different between SoCs, 69 - * to provid support for all these chips, split the 69 + * to provide support for all these chips, split the 70 70 * register offset into a fixed base address and a 71 71 * variable shift value, then the full register offset 72 72 * will be calculated by
+1 -1
drivers/i2c/busses/i2c-mlxcpld.c
··· 49 49 #define MLXCPLD_LPCI2C_NACK_IND 2 50 50 51 51 #define MLXCPLD_I2C_FREQ_1000KHZ_SET 0x04 52 - #define MLXCPLD_I2C_FREQ_400KHZ_SET 0x0c 52 + #define MLXCPLD_I2C_FREQ_400KHZ_SET 0x0e 53 53 #define MLXCPLD_I2C_FREQ_100KHZ_SET 0x42 54 54 55 55 enum mlxcpld_i2c_frequency {
+3 -1
drivers/md/raid5.c
··· 7304 7304 goto abort; 7305 7305 conf->mddev = mddev; 7306 7306 7307 - if ((conf->stripe_hashtbl = kzalloc(PAGE_SIZE, GFP_KERNEL)) == NULL) 7307 + ret = -ENOMEM; 7308 + conf->stripe_hashtbl = kzalloc(PAGE_SIZE, GFP_KERNEL); 7309 + if (!conf->stripe_hashtbl) 7308 7310 goto abort; 7309 7311 7310 7312 /* We init hash_locks[0] separately to that it can be used
+6 -3
drivers/misc/lkdtm/Makefile
··· 13 13 lkdtm-$(CONFIG_LKDTM) += fortify.o 14 14 lkdtm-$(CONFIG_PPC_64S_HASH_MMU) += powerpc.o 15 15 16 - KASAN_SANITIZE_rodata.o := n 17 16 KASAN_SANITIZE_stackleak.o := n 18 - KCOV_INSTRUMENT_rodata.o := n 19 - CFLAGS_REMOVE_rodata.o += $(CC_FLAGS_LTO) 17 + 18 + KASAN_SANITIZE_rodata.o := n 19 + KCSAN_SANITIZE_rodata.o := n 20 + KCOV_INSTRUMENT_rodata.o := n 21 + OBJECT_FILES_NON_STANDARD_rodata.o := y 22 + CFLAGS_REMOVE_rodata.o += $(CC_FLAGS_LTO) $(RETHUNK_CFLAGS) 20 23 21 24 OBJCOPYFLAGS := 22 25 OBJCOPYFLAGS_rodata_objcopy.o := \
+8 -6
drivers/mmc/host/sdhci-omap.c
··· 1298 1298 /* 1299 1299 * omap_device_pm_domain has callbacks to enable the main 1300 1300 * functional clock, interface clock and also configure the 1301 - * SYSCONFIG register of omap devices. The callback will be invoked 1302 - * as part of pm_runtime_get_sync. 1301 + * SYSCONFIG register to clear any boot loader set voltage 1302 + * capabilities before calling sdhci_setup_host(). The 1303 + * callback will be invoked as part of pm_runtime_get_sync. 1303 1304 */ 1304 1305 pm_runtime_use_autosuspend(dev); 1305 1306 pm_runtime_set_autosuspend_delay(dev, 50); ··· 1442 1441 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 1443 1442 struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host); 1444 1443 1445 - sdhci_runtime_suspend_host(host); 1444 + if (omap_host->con != -EINVAL) 1445 + sdhci_runtime_suspend_host(host); 1446 1446 1447 1447 sdhci_omap_context_save(omap_host); 1448 1448 ··· 1460 1458 1461 1459 pinctrl_pm_select_default_state(dev); 1462 1460 1463 - if (omap_host->con != -EINVAL) 1461 + if (omap_host->con != -EINVAL) { 1464 1462 sdhci_omap_context_restore(omap_host); 1465 - 1466 - sdhci_runtime_resume_host(host, 0); 1463 + sdhci_runtime_resume_host(host, 0); 1464 + } 1467 1465 1468 1466 return 0; 1469 1467 }
+4 -2
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
··· 850 850 unsigned int tRP_ps; 851 851 bool use_half_period; 852 852 int sample_delay_ps, sample_delay_factor; 853 - u16 busy_timeout_cycles; 853 + unsigned int busy_timeout_cycles; 854 854 u8 wrn_dly_sel; 855 855 unsigned long clk_rate, min_rate; 856 + u64 busy_timeout_ps; 856 857 857 858 if (sdr->tRC_min >= 30000) { 858 859 /* ONFI non-EDO modes [0-3] */ ··· 886 885 addr_setup_cycles = TO_CYCLES(sdr->tALS_min, period_ps); 887 886 data_setup_cycles = TO_CYCLES(sdr->tDS_min, period_ps); 888 887 data_hold_cycles = TO_CYCLES(sdr->tDH_min, period_ps); 889 - busy_timeout_cycles = TO_CYCLES(sdr->tWB_max + sdr->tR_max, period_ps); 888 + busy_timeout_ps = max(sdr->tBERS_max, sdr->tPROG_max); 889 + busy_timeout_cycles = TO_CYCLES(busy_timeout_ps, period_ps); 890 890 891 891 hw->timing0 = BF_GPMI_TIMING0_ADDRESS_SETUP(addr_setup_cycles) | 892 892 BF_GPMI_TIMING0_DATA_HOLD(data_hold_cycles) |
+4 -1
drivers/net/ethernet/fungible/funeth/funeth_rx.c
··· 142 142 int ref_ok, struct funeth_txq *xdp_q) 143 143 { 144 144 struct bpf_prog *xdp_prog; 145 + struct xdp_frame *xdpf; 145 146 struct xdp_buff xdp; 146 147 u32 act; 147 148 ··· 164 163 case XDP_TX: 165 164 if (unlikely(!ref_ok)) 166 165 goto pass; 167 - if (!fun_xdp_tx(xdp_q, xdp.data, xdp.data_end - xdp.data)) 166 + 167 + xdpf = xdp_convert_buff_to_frame(&xdp); 168 + if (!xdpf || !fun_xdp_tx(xdp_q, xdpf)) 168 169 goto xdp_error; 169 170 FUN_QSTAT_INC(q, xdp_tx); 170 171 q->xdp_flush |= FUN_XDP_FLUSH_TX;
+9 -11
drivers/net/ethernet/fungible/funeth/funeth_tx.c
··· 487 487 488 488 do { 489 489 fun_xdp_unmap(q, reclaim_idx); 490 - page_frag_free(q->info[reclaim_idx].vaddr); 490 + xdp_return_frame(q->info[reclaim_idx].xdpf); 491 491 492 492 trace_funeth_tx_free(q, reclaim_idx, 1, head); 493 493 ··· 500 500 return npkts; 501 501 } 502 502 503 - bool fun_xdp_tx(struct funeth_txq *q, void *data, unsigned int len) 503 + bool fun_xdp_tx(struct funeth_txq *q, struct xdp_frame *xdpf) 504 504 { 505 505 struct fun_eth_tx_req *req; 506 506 struct fun_dataop_gl *gle; 507 - unsigned int idx; 507 + unsigned int idx, len; 508 508 dma_addr_t dma; 509 509 510 510 if (fun_txq_avail(q) < FUN_XDP_CLEAN_THRES) ··· 515 515 return false; 516 516 } 517 517 518 - dma = dma_map_single(q->dma_dev, data, len, DMA_TO_DEVICE); 518 + len = xdpf->len; 519 + dma = dma_map_single(q->dma_dev, xdpf->data, len, DMA_TO_DEVICE); 519 520 if (unlikely(dma_mapping_error(q->dma_dev, dma))) { 520 521 FUN_QSTAT_INC(q, tx_map_err); 521 522 return false; ··· 536 535 gle = (struct fun_dataop_gl *)req->dataop.imm; 537 536 fun_dataop_gl_init(gle, 0, 0, len, dma); 538 537 539 - q->info[idx].vaddr = data; 538 + q->info[idx].xdpf = xdpf; 540 539 541 540 u64_stats_update_begin(&q->syncp); 542 541 q->stats.tx_bytes += len; ··· 567 566 if (unlikely(q_idx >= fp->num_xdpqs)) 568 567 return -ENXIO; 569 568 570 - for (q = xdpqs[q_idx], i = 0; i < n; i++) { 571 - const struct xdp_frame *xdpf = frames[i]; 572 - 573 - if (!fun_xdp_tx(q, xdpf->data, xdpf->len)) 569 + for (q = xdpqs[q_idx], i = 0; i < n; i++) 570 + if (!fun_xdp_tx(q, frames[i])) 574 571 break; 575 - } 576 572 577 573 if (unlikely(flags & XDP_XMIT_FLUSH)) 578 574 fun_txq_wr_db(q); ··· 596 598 unsigned int idx = q->cons_cnt & q->mask; 597 599 598 600 fun_xdp_unmap(q, idx); 599 - page_frag_free(q->info[idx].vaddr); 601 + xdp_return_frame(q->info[idx].xdpf); 600 602 q->cons_cnt++; 601 603 } 602 604 }
+3 -3
drivers/net/ethernet/fungible/funeth/funeth_txrx.h
··· 96 96 97 97 struct funeth_tx_info { /* per Tx descriptor state */ 98 98 union { 99 - struct sk_buff *skb; /* associated packet */ 100 - void *vaddr; /* start address for XDP */ 99 + struct sk_buff *skb; /* associated packet (sk_buff path) */ 100 + struct xdp_frame *xdpf; /* associated XDP frame (XDP path) */ 101 101 }; 102 102 }; 103 103 ··· 246 246 int fun_rxq_napi_poll(struct napi_struct *napi, int budget); 247 247 int fun_txq_napi_poll(struct napi_struct *napi, int budget); 248 248 netdev_tx_t fun_start_xmit(struct sk_buff *skb, struct net_device *netdev); 249 - bool fun_xdp_tx(struct funeth_txq *q, void *data, unsigned int len); 249 + bool fun_xdp_tx(struct funeth_txq *q, struct xdp_frame *xdpf); 250 250 int fun_xdp_xmit_frames(struct net_device *dev, int n, 251 251 struct xdp_frame **frames, u32 flags); 252 252
+4
drivers/net/ethernet/intel/i40e/i40e_main.c
··· 2033 2033 * non-zero req_queue_pairs says that user requested a new 2034 2034 * queue count via ethtool's set_channels, so use this 2035 2035 * value for queues distribution across traffic classes 2036 + * We need at least one queue pair for the interface 2037 + * to be usable as we see in else statement. 2036 2038 */ 2037 2039 if (vsi->req_queue_pairs > 0) 2038 2040 vsi->num_queue_pairs = vsi->req_queue_pairs; 2039 2041 else if (pf->flags & I40E_FLAG_MSIX_ENABLED) 2040 2042 vsi->num_queue_pairs = pf->num_lan_msix; 2043 + else 2044 + vsi->num_queue_pairs = 1; 2041 2045 } 2042 2046 2043 2047 /* Number of queues per enabled TC */
+2 -1
drivers/net/ethernet/intel/ice/ice_ethtool.c
··· 658 658 rx_desc = ICE_RX_DESC(rx_ring, i); 659 659 660 660 if (!(rx_desc->wb.status_error0 & 661 - cpu_to_le16(ICE_TX_DESC_CMD_EOP | ICE_TX_DESC_CMD_RS))) 661 + (cpu_to_le16(BIT(ICE_RX_FLEX_DESC_STATUS0_DD_S)) | 662 + cpu_to_le16(BIT(ICE_RX_FLEX_DESC_STATUS0_EOF_S))))) 662 663 continue; 663 664 664 665 rx_buf = &rx_ring->rx_buf[i];
+7 -3
drivers/net/ethernet/intel/ice/ice_main.c
··· 4656 4656 ice_set_safe_mode_caps(hw); 4657 4657 } 4658 4658 4659 + hw->ucast_shared = true; 4660 + 4659 4661 err = ice_init_pf(pf); 4660 4662 if (err) { 4661 4663 dev_err(dev, "ice_init_pf failed: %d\n", err); ··· 6007 6005 if (vsi->netdev) { 6008 6006 ice_set_rx_mode(vsi->netdev); 6009 6007 6010 - err = ice_vsi_vlan_setup(vsi); 6008 + if (vsi->type != ICE_VSI_LB) { 6009 + err = ice_vsi_vlan_setup(vsi); 6011 6010 6012 - if (err) 6013 - return err; 6011 + if (err) 6012 + return err; 6013 + } 6014 6014 } 6015 6015 ice_vsi_cfg_dcb_rings(vsi); 6016 6016
-40
drivers/net/ethernet/intel/ice/ice_sriov.c
··· 1310 1310 } 1311 1311 1312 1312 /** 1313 - * ice_unicast_mac_exists - check if the unicast MAC exists on the PF's switch 1314 - * @pf: PF used to reference the switch's rules 1315 - * @umac: unicast MAC to compare against existing switch rules 1316 - * 1317 - * Return true on the first/any match, else return false 1318 - */ 1319 - static bool ice_unicast_mac_exists(struct ice_pf *pf, u8 *umac) 1320 - { 1321 - struct ice_sw_recipe *mac_recipe_list = 1322 - &pf->hw.switch_info->recp_list[ICE_SW_LKUP_MAC]; 1323 - struct ice_fltr_mgmt_list_entry *list_itr; 1324 - struct list_head *rule_head; 1325 - struct mutex *rule_lock; /* protect MAC filter list access */ 1326 - 1327 - rule_head = &mac_recipe_list->filt_rules; 1328 - rule_lock = &mac_recipe_list->filt_rule_lock; 1329 - 1330 - mutex_lock(rule_lock); 1331 - list_for_each_entry(list_itr, rule_head, list_entry) { 1332 - u8 *existing_mac = &list_itr->fltr_info.l_data.mac.mac_addr[0]; 1333 - 1334 - if (ether_addr_equal(existing_mac, umac)) { 1335 - mutex_unlock(rule_lock); 1336 - return true; 1337 - } 1338 - } 1339 - 1340 - mutex_unlock(rule_lock); 1341 - 1342 - return false; 1343 - } 1344 - 1345 - /** 1346 1313 * ice_set_vf_mac 1347 1314 * @netdev: network interface device structure 1348 1315 * @vf_id: VF identifier ··· 1342 1375 ret = ice_check_vf_ready_for_cfg(vf); 1343 1376 if (ret) 1344 1377 goto out_put_vf; 1345 - 1346 - if (ice_unicast_mac_exists(pf, mac)) { 1347 - netdev_err(netdev, "Unicast MAC %pM already exists on this PF. Preventing setting VF %u unicast MAC address to %pM\n", 1348 - mac, vf_id, mac); 1349 - ret = -EINVAL; 1350 - goto out_put_vf; 1351 - } 1352 1378 1353 1379 mutex_lock(&vf->cfg_lock); 1354 1380
+5 -3
drivers/net/ethernet/intel/ice/ice_txrx.c
··· 1751 1751 1752 1752 protocol = vlan_get_protocol(skb); 1753 1753 1754 - if (eth_p_mpls(protocol)) 1754 + if (eth_p_mpls(protocol)) { 1755 1755 ip.hdr = skb_inner_network_header(skb); 1756 - else 1756 + l4.hdr = skb_checksum_start(skb); 1757 + } else { 1757 1758 ip.hdr = skb_network_header(skb); 1758 - l4.hdr = skb_checksum_start(skb); 1759 + l4.hdr = skb_transport_header(skb); 1760 + } 1759 1761 1760 1762 /* compute outer L2 header size */ 1761 1763 l2_len = ip.hdr - skb->data;
+2 -1
drivers/net/ethernet/intel/ice/ice_virtchnl.c
··· 2971 2971 struct virtchnl_vlan_filtering_caps *vfc, 2972 2972 struct virtchnl_vlan_filter_list_v2 *vfl) 2973 2973 { 2974 - u16 num_requested_filters = vsi->num_vlan + vfl->num_elements; 2974 + u16 num_requested_filters = ice_vsi_num_non_zero_vlans(vsi) + 2975 + vfl->num_elements; 2975 2976 2976 2977 if (num_requested_filters > vfc->max_filters) 2977 2978 return false;
+73 -33
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c
··· 28 28 #define MAX_RATE_EXPONENT 0x0FULL 29 29 #define MAX_RATE_MANTISSA 0xFFULL 30 30 31 + #define CN10K_MAX_BURST_MANTISSA 0x7FFFULL 32 + #define CN10K_MAX_BURST_SIZE 8453888ULL 33 + 31 34 /* Bitfields in NIX_TLX_PIR register */ 32 35 #define TLX_RATE_MANTISSA GENMASK_ULL(8, 1) 33 36 #define TLX_RATE_EXPONENT GENMASK_ULL(12, 9) 34 37 #define TLX_RATE_DIVIDER_EXPONENT GENMASK_ULL(16, 13) 35 38 #define TLX_BURST_MANTISSA GENMASK_ULL(36, 29) 36 39 #define TLX_BURST_EXPONENT GENMASK_ULL(40, 37) 40 + 41 + #define CN10K_TLX_BURST_MANTISSA GENMASK_ULL(43, 29) 42 + #define CN10K_TLX_BURST_EXPONENT GENMASK_ULL(47, 44) 37 43 38 44 struct otx2_tc_flow_stats { 39 45 u64 bytes; ··· 83 77 } 84 78 EXPORT_SYMBOL(otx2_tc_alloc_ent_bitmap); 85 79 86 - static void otx2_get_egress_burst_cfg(u32 burst, u32 *burst_exp, 87 - u32 *burst_mantissa) 80 + static void otx2_get_egress_burst_cfg(struct otx2_nic *nic, u32 burst, 81 + u32 *burst_exp, u32 *burst_mantissa) 88 82 { 83 + int max_burst, max_mantissa; 89 84 unsigned int tmp; 85 + 86 + if (is_dev_otx2(nic->pdev)) { 87 + max_burst = MAX_BURST_SIZE; 88 + max_mantissa = MAX_BURST_MANTISSA; 89 + } else { 90 + max_burst = CN10K_MAX_BURST_SIZE; 91 + max_mantissa = CN10K_MAX_BURST_MANTISSA; 92 + } 90 93 91 94 /* Burst is calculated as 92 95 * ((256 + BURST_MANTISSA) << (1 + BURST_EXPONENT)) / 256 93 96 * Max supported burst size is 130,816 bytes. 94 97 */ 95 - burst = min_t(u32, burst, MAX_BURST_SIZE); 98 + burst = min_t(u32, burst, max_burst); 96 99 if (burst) { 97 100 *burst_exp = ilog2(burst) ? ilog2(burst) - 1 : 0; 98 101 tmp = burst - rounddown_pow_of_two(burst); 99 - if (burst < MAX_BURST_MANTISSA) 102 + if (burst < max_mantissa) 100 103 *burst_mantissa = tmp * 2; 101 104 else 102 105 *burst_mantissa = tmp / (1ULL << (*burst_exp - 7)); 103 106 } else { 104 107 *burst_exp = MAX_BURST_EXPONENT; 105 - *burst_mantissa = MAX_BURST_MANTISSA; 108 + *burst_mantissa = max_mantissa; 106 109 } 107 110 } 108 111 109 - static void otx2_get_egress_rate_cfg(u32 maxrate, u32 *exp, 112 + static void otx2_get_egress_rate_cfg(u64 maxrate, u32 *exp, 110 113 u32 *mantissa, u32 *div_exp) 111 114 { 112 - unsigned int tmp; 115 + u64 tmp; 113 116 114 117 /* Rate calculation by hardware 115 118 * ··· 147 132 } 148 133 } 149 134 150 - static int otx2_set_matchall_egress_rate(struct otx2_nic *nic, u32 burst, u32 maxrate) 135 + static u64 otx2_get_txschq_rate_regval(struct otx2_nic *nic, 136 + u64 maxrate, u32 burst) 137 + { 138 + u32 burst_exp, burst_mantissa; 139 + u32 exp, mantissa, div_exp; 140 + u64 regval = 0; 141 + 142 + /* Get exponent and mantissa values from the desired rate */ 143 + otx2_get_egress_burst_cfg(nic, burst, &burst_exp, &burst_mantissa); 144 + otx2_get_egress_rate_cfg(maxrate, &exp, &mantissa, &div_exp); 145 + 146 + if (is_dev_otx2(nic->pdev)) { 147 + regval = FIELD_PREP(TLX_BURST_EXPONENT, (u64)burst_exp) | 148 + FIELD_PREP(TLX_BURST_MANTISSA, (u64)burst_mantissa) | 149 + FIELD_PREP(TLX_RATE_DIVIDER_EXPONENT, div_exp) | 150 + FIELD_PREP(TLX_RATE_EXPONENT, exp) | 151 + FIELD_PREP(TLX_RATE_MANTISSA, mantissa) | BIT_ULL(0); 152 + } else { 153 + regval = FIELD_PREP(CN10K_TLX_BURST_EXPONENT, (u64)burst_exp) | 154 + FIELD_PREP(CN10K_TLX_BURST_MANTISSA, (u64)burst_mantissa) | 155 + FIELD_PREP(TLX_RATE_DIVIDER_EXPONENT, div_exp) | 156 + FIELD_PREP(TLX_RATE_EXPONENT, exp) | 157 + FIELD_PREP(TLX_RATE_MANTISSA, mantissa) | BIT_ULL(0); 158 + } 159 + 160 + return regval; 161 + } 162 + 163 + static int otx2_set_matchall_egress_rate(struct otx2_nic *nic, 164 + u32 burst, u64 maxrate) 151 165 { 152 166 struct otx2_hw *hw = &nic->hw; 153 167 struct nix_txschq_config *req; 154 - u32 burst_exp, burst_mantissa; 155 - u32 exp, mantissa, div_exp; 156 168 int txschq, err; 157 169 158 170 /* All SQs share the same TL4, so pick the first scheduler */ 159 171 txschq = hw->txschq_list[NIX_TXSCH_LVL_TL4][0]; 160 - 161 - /* Get exponent and mantissa values from the desired rate */ 162 - otx2_get_egress_burst_cfg(burst, &burst_exp, &burst_mantissa); 163 - otx2_get_egress_rate_cfg(maxrate, &exp, &mantissa, &div_exp); 164 172 165 173 mutex_lock(&nic->mbox.lock); 166 174 req = otx2_mbox_alloc_msg_nix_txschq_cfg(&nic->mbox); ··· 195 157 req->lvl = NIX_TXSCH_LVL_TL4; 196 158 req->num_regs = 1; 197 159 req->reg[0] = NIX_AF_TL4X_PIR(txschq); 198 - req->regval[0] = FIELD_PREP(TLX_BURST_EXPONENT, burst_exp) | 199 - FIELD_PREP(TLX_BURST_MANTISSA, burst_mantissa) | 200 - FIELD_PREP(TLX_RATE_DIVIDER_EXPONENT, div_exp) | 201 - FIELD_PREP(TLX_RATE_EXPONENT, exp) | 202 - FIELD_PREP(TLX_RATE_MANTISSA, mantissa) | BIT_ULL(0); 160 + req->regval[0] = otx2_get_txschq_rate_regval(nic, maxrate, burst); 203 161 204 162 err = otx2_sync_mbox_msg(&nic->mbox); 205 163 mutex_unlock(&nic->mbox.lock); ··· 264 230 struct netlink_ext_ack *extack = cls->common.extack; 265 231 struct flow_action *actions = &cls->rule->action; 266 232 struct flow_action_entry *entry; 267 - u32 rate; 233 + u64 rate; 268 234 int err; 269 235 270 236 err = otx2_tc_validate_flow(nic, actions, extack); ··· 290 256 } 291 257 /* Convert bytes per second to Mbps */ 292 258 rate = entry->police.rate_bytes_ps * 8; 293 - rate = max_t(u32, rate / 1000000, 1); 259 + rate = max_t(u64, rate / 1000000, 1); 294 260 err = otx2_set_matchall_egress_rate(nic, entry->police.burst, rate); 295 261 if (err) 296 262 return err; ··· 648 614 649 615 flow_spec->dport = match.key->dst; 650 616 flow_mask->dport = match.mask->dst; 651 - if (ip_proto == IPPROTO_UDP) 652 - req->features |= BIT_ULL(NPC_DPORT_UDP); 653 - else if (ip_proto == IPPROTO_TCP) 654 - req->features |= BIT_ULL(NPC_DPORT_TCP); 655 - else if (ip_proto == IPPROTO_SCTP) 656 - req->features |= BIT_ULL(NPC_DPORT_SCTP); 617 + 618 + if (flow_mask->dport) { 619 + if (ip_proto == IPPROTO_UDP) 620 + req->features |= BIT_ULL(NPC_DPORT_UDP); 621 + else if (ip_proto == IPPROTO_TCP) 622 + req->features |= BIT_ULL(NPC_DPORT_TCP); 623 + else if (ip_proto == IPPROTO_SCTP) 624 + req->features |= BIT_ULL(NPC_DPORT_SCTP); 625 + } 657 626 658 627 flow_spec->sport = match.key->src; 659 628 flow_mask->sport = match.mask->src; 660 - if (ip_proto == IPPROTO_UDP) 661 - req->features |= BIT_ULL(NPC_SPORT_UDP); 662 - else if (ip_proto == IPPROTO_TCP) 663 - req->features |= BIT_ULL(NPC_SPORT_TCP); 664 - else if (ip_proto == IPPROTO_SCTP) 665 - req->features |= BIT_ULL(NPC_SPORT_SCTP); 629 + 630 + if (flow_mask->sport) { 631 + if (ip_proto == IPPROTO_UDP) 632 + req->features |= BIT_ULL(NPC_SPORT_UDP); 633 + else if (ip_proto == IPPROTO_TCP) 634 + req->features |= BIT_ULL(NPC_SPORT_TCP); 635 + else if (ip_proto == IPPROTO_SCTP) 636 + req->features |= BIT_ULL(NPC_SPORT_SCTP); 637 + } 666 638 } 667 639 668 640 return otx2_tc_parse_actions(nic, &rule->action, req, f, node);
+1 -1
drivers/net/ethernet/netronome/nfp/bpf/jit.c
··· 4233 4233 } 4234 4234 4235 4235 /* If the chain is ended by an load/store pair then this 4236 - * could serve as the new head of the the next chain. 4236 + * could serve as the new head of the next chain. 4237 4237 */ 4238 4238 if (curr_pair_is_memcpy(meta1, meta2)) { 4239 4239 head_ld_meta = meta1;
+22
drivers/net/ethernet/sfc/ptp.c
··· 1100 1100 1101 1101 tx_queue = efx_channel_get_tx_queue(ptp_data->channel, type); 1102 1102 if (tx_queue && tx_queue->timestamping) { 1103 + /* This code invokes normal driver TX code which is always 1104 + * protected from softirqs when called from generic TX code, 1105 + * which in turn disables preemption. Look at __dev_queue_xmit 1106 + * which uses rcu_read_lock_bh disabling preemption for RCU 1107 + * plus disabling softirqs. We do not need RCU reader 1108 + * protection here. 1109 + * 1110 + * Although it is theoretically safe for current PTP TX/RX code 1111 + * running without disabling softirqs, there are three good 1112 + * reasond for doing so: 1113 + * 1114 + * 1) The code invoked is mainly implemented for non-PTP 1115 + * packets and it is always executed with softirqs 1116 + * disabled. 1117 + * 2) This being a single PTP packet, better to not 1118 + * interrupt its processing by softirqs which can lead 1119 + * to high latencies. 1120 + * 3) netdev_xmit_more checks preemption is disabled and 1121 + * triggers a BUG_ON if not. 1122 + */ 1123 + local_bh_disable(); 1103 1124 efx_enqueue_skb(tx_queue, skb); 1125 + local_bh_enable(); 1104 1126 } else { 1105 1127 WARN_ONCE(1, "PTP channel has no timestamped tx queue\n"); 1106 1128 dev_kfree_skb_any(skb);
+5 -4
drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
··· 688 688 689 689 ret = mediatek_dwmac_clks_config(priv_plat, true); 690 690 if (ret) 691 - return ret; 691 + goto err_remove_config_dt; 692 692 693 693 ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); 694 - if (ret) { 695 - stmmac_remove_config_dt(pdev, plat_dat); 694 + if (ret) 696 695 goto err_drv_probe; 697 - } 698 696 699 697 return 0; 700 698 701 699 err_drv_probe: 702 700 mediatek_dwmac_clks_config(priv_plat, false); 701 + err_remove_config_dt: 702 + stmmac_remove_config_dt(pdev, plat_dat); 703 + 703 704 return ret; 704 705 } 705 706
+1 -1
drivers/net/ipa/ipa_qmi_msg.h
··· 214 214 215 215 /* The response to a IPA_QMI_INIT_DRIVER request begins with a standard 216 216 * QMI response, but contains other information as well. Currently we 217 - * simply wait for the the INIT_DRIVER transaction to complete and 217 + * simply wait for the INIT_DRIVER transaction to complete and 218 218 * ignore any other data that might be returned. 219 219 */ 220 220 struct ipa_init_modem_driver_rsp {
+21 -12
drivers/net/macsec.c
··· 243 243 #define DEFAULT_SEND_SCI true 244 244 #define DEFAULT_ENCRYPT false 245 245 #define DEFAULT_ENCODING_SA 0 246 + #define MACSEC_XPN_MAX_REPLAY_WINDOW (((1 << 30) - 1)) 246 247 247 248 static bool send_sci(const struct macsec_secy *secy) 248 249 { ··· 1698 1697 return false; 1699 1698 1700 1699 if (attrs[MACSEC_SA_ATTR_PN] && 1701 - *(u64 *)nla_data(attrs[MACSEC_SA_ATTR_PN]) == 0) 1700 + nla_get_u64(attrs[MACSEC_SA_ATTR_PN]) == 0) 1702 1701 return false; 1703 1702 1704 1703 if (attrs[MACSEC_SA_ATTR_ACTIVE]) { ··· 1754 1753 } 1755 1754 1756 1755 pn_len = secy->xpn ? MACSEC_XPN_PN_LEN : MACSEC_DEFAULT_PN_LEN; 1757 - if (nla_len(tb_sa[MACSEC_SA_ATTR_PN]) != pn_len) { 1756 + if (tb_sa[MACSEC_SA_ATTR_PN] && 1757 + nla_len(tb_sa[MACSEC_SA_ATTR_PN]) != pn_len) { 1758 1758 pr_notice("macsec: nl: add_rxsa: bad pn length: %d != %d\n", 1759 1759 nla_len(tb_sa[MACSEC_SA_ATTR_PN]), pn_len); 1760 1760 rtnl_unlock(); ··· 1771 1769 if (nla_len(tb_sa[MACSEC_SA_ATTR_SALT]) != MACSEC_SALT_LEN) { 1772 1770 pr_notice("macsec: nl: add_rxsa: bad salt length: %d != %d\n", 1773 1771 nla_len(tb_sa[MACSEC_SA_ATTR_SALT]), 1774 - MACSEC_SA_ATTR_SALT); 1772 + MACSEC_SALT_LEN); 1775 1773 rtnl_unlock(); 1776 1774 return -EINVAL; 1777 1775 } ··· 1844 1842 return 0; 1845 1843 1846 1844 cleanup: 1847 - kfree(rx_sa); 1845 + macsec_rxsa_put(rx_sa); 1848 1846 rtnl_unlock(); 1849 1847 return err; 1850 1848 } ··· 1941 1939 if (nla_get_u8(attrs[MACSEC_SA_ATTR_AN]) >= MACSEC_NUM_AN) 1942 1940 return false; 1943 1941 1944 - if (nla_get_u32(attrs[MACSEC_SA_ATTR_PN]) == 0) 1942 + if (nla_get_u64(attrs[MACSEC_SA_ATTR_PN]) == 0) 1945 1943 return false; 1946 1944 1947 1945 if (attrs[MACSEC_SA_ATTR_ACTIVE]) { ··· 2013 2011 if (nla_len(tb_sa[MACSEC_SA_ATTR_SALT]) != MACSEC_SALT_LEN) { 2014 2012 pr_notice("macsec: nl: add_txsa: bad salt length: %d != %d\n", 2015 2013 nla_len(tb_sa[MACSEC_SA_ATTR_SALT]), 2016 - MACSEC_SA_ATTR_SALT); 2014 + MACSEC_SALT_LEN); 2017 2015 rtnl_unlock(); 2018 2016 return -EINVAL; 2019 2017 } ··· 2087 2085 2088 2086 cleanup: 2089 2087 secy->operational = was_operational; 2090 - kfree(tx_sa); 2088 + macsec_txsa_put(tx_sa); 2091 2089 rtnl_unlock(); 2092 2090 return err; 2093 2091 } ··· 2295 2293 if (nla_get_u8(attrs[MACSEC_SA_ATTR_AN]) >= MACSEC_NUM_AN) 2296 2294 return false; 2297 2295 2298 - if (attrs[MACSEC_SA_ATTR_PN] && nla_get_u32(attrs[MACSEC_SA_ATTR_PN]) == 0) 2296 + if (attrs[MACSEC_SA_ATTR_PN] && nla_get_u64(attrs[MACSEC_SA_ATTR_PN]) == 0) 2299 2297 return false; 2300 2298 2301 2299 if (attrs[MACSEC_SA_ATTR_ACTIVE]) { ··· 3747 3745 secy->operational = tx_sa && tx_sa->active; 3748 3746 } 3749 3747 3750 - if (data[IFLA_MACSEC_WINDOW]) 3751 - secy->replay_window = nla_get_u32(data[IFLA_MACSEC_WINDOW]); 3752 - 3753 3748 if (data[IFLA_MACSEC_ENCRYPT]) 3754 3749 tx_sc->encrypt = !!nla_get_u8(data[IFLA_MACSEC_ENCRYPT]); 3755 3750 ··· 3792 3793 } 3793 3794 } 3794 3795 3796 + if (data[IFLA_MACSEC_WINDOW]) { 3797 + secy->replay_window = nla_get_u32(data[IFLA_MACSEC_WINDOW]); 3798 + 3799 + /* IEEE 802.1AEbw-2013 10.7.8 - maximum replay window 3800 + * for XPN cipher suites */ 3801 + if (secy->xpn && 3802 + secy->replay_window > MACSEC_XPN_MAX_REPLAY_WINDOW) 3803 + return -EINVAL; 3804 + } 3805 + 3795 3806 return 0; 3796 3807 } 3797 3808 ··· 3831 3822 3832 3823 ret = macsec_changelink_common(dev, data); 3833 3824 if (ret) 3834 - return ret; 3825 + goto cleanup; 3835 3826 3836 3827 /* If h/w offloading is available, propagate to the device */ 3837 3828 if (macsec_is_offloaded(macsec)) {
+1 -1
drivers/net/pcs/pcs-xpcs.c
··· 986 986 */ 987 987 ret = xpcs_read(xpcs, MDIO_MMD_VEND2, DW_VR_MII_AN_INTR_STS); 988 988 if (ret < 0) 989 - return false; 989 + return ret; 990 990 991 991 if (ret & DW_VR_MII_C37_ANSGM_SP_LNKSTS) { 992 992 int speed_value;
+1
drivers/net/sungem_phy.c
··· 450 450 int can_low_power = 1; 451 451 if (np == NULL || of_get_property(np, "no-autolowpower", NULL)) 452 452 can_low_power = 0; 453 + of_node_put(np); 453 454 if (can_low_power) { 454 455 /* Enable automatic low-power */ 455 456 sungem_phy_write(phy, 0x1c, 0x9002);
+34 -3
drivers/net/virtio_net.c
··· 242 242 /* Packet virtio header size */ 243 243 u8 hdr_len; 244 244 245 - /* Work struct for refilling if we run low on memory. */ 245 + /* Work struct for delayed refilling if we run low on memory. */ 246 246 struct delayed_work refill; 247 + 248 + /* Is delayed refill enabled? */ 249 + bool refill_enabled; 250 + 251 + /* The lock to synchronize the access to refill_enabled */ 252 + spinlock_t refill_lock; 247 253 248 254 /* Work struct for config space updates */ 249 255 struct work_struct config_work; ··· 352 346 } else 353 347 p = alloc_page(gfp_mask); 354 348 return p; 349 + } 350 + 351 + static void enable_delayed_refill(struct virtnet_info *vi) 352 + { 353 + spin_lock_bh(&vi->refill_lock); 354 + vi->refill_enabled = true; 355 + spin_unlock_bh(&vi->refill_lock); 356 + } 357 + 358 + static void disable_delayed_refill(struct virtnet_info *vi) 359 + { 360 + spin_lock_bh(&vi->refill_lock); 361 + vi->refill_enabled = false; 362 + spin_unlock_bh(&vi->refill_lock); 355 363 } 356 364 357 365 static void virtqueue_napi_schedule(struct napi_struct *napi, ··· 1547 1527 } 1548 1528 1549 1529 if (rq->vq->num_free > min((unsigned int)budget, virtqueue_get_vring_size(rq->vq)) / 2) { 1550 - if (!try_fill_recv(vi, rq, GFP_ATOMIC)) 1551 - schedule_delayed_work(&vi->refill, 0); 1530 + if (!try_fill_recv(vi, rq, GFP_ATOMIC)) { 1531 + spin_lock(&vi->refill_lock); 1532 + if (vi->refill_enabled) 1533 + schedule_delayed_work(&vi->refill, 0); 1534 + spin_unlock(&vi->refill_lock); 1535 + } 1552 1536 } 1553 1537 1554 1538 u64_stats_update_begin(&rq->stats.syncp); ··· 1674 1650 { 1675 1651 struct virtnet_info *vi = netdev_priv(dev); 1676 1652 int i, err; 1653 + 1654 + enable_delayed_refill(vi); 1677 1655 1678 1656 for (i = 0; i < vi->max_queue_pairs; i++) { 1679 1657 if (i < vi->curr_queue_pairs) ··· 2059 2033 struct virtnet_info *vi = netdev_priv(dev); 2060 2034 int i; 2061 2035 2036 + /* Make sure NAPI doesn't schedule refill work */ 2037 + disable_delayed_refill(vi); 2062 2038 /* Make sure refill_work doesn't re-enable napi! */ 2063 2039 cancel_delayed_work_sync(&vi->refill); 2064 2040 ··· 2820 2792 2821 2793 virtio_device_ready(vdev); 2822 2794 2795 + enable_delayed_refill(vi); 2796 + 2823 2797 if (netif_running(vi->dev)) { 2824 2798 err = virtnet_open(vi->dev); 2825 2799 if (err) ··· 3565 3535 vdev->priv = vi; 3566 3536 3567 3537 INIT_WORK(&vi->config_work, virtnet_config_changed_work); 3538 + spin_lock_init(&vi->refill_lock); 3568 3539 3569 3540 /* If we can receive ANY GSO packets, we must allocate large ones. */ 3570 3541 if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) ||
+1 -1
drivers/pinctrl/Kconfig
··· 32 32 Say Y here to add some extra checks and diagnostics to PINCTRL calls. 33 33 34 34 config PINCTRL_AMD 35 - tristate "AMD GPIO pin control" 35 + bool "AMD GPIO pin control" 36 36 depends on HAS_IOMEM 37 37 depends on ACPI || COMPILE_TEST 38 38 select GPIOLIB
+40 -25
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
··· 102 102 struct device *dev; 103 103 struct gpio_chip gpio_chip; 104 104 struct irq_chip irq_chip; 105 - spinlock_t irq_lock; 105 + raw_spinlock_t irq_lock; 106 106 struct pinctrl_desc pctl; 107 107 struct pinctrl_dev *pctl_dev; 108 108 struct armada_37xx_pin_group *groups; ··· 523 523 unsigned long flags; 524 524 525 525 armada_37xx_irq_update_reg(&reg, d); 526 - spin_lock_irqsave(&info->irq_lock, flags); 526 + raw_spin_lock_irqsave(&info->irq_lock, flags); 527 527 writel(d->mask, info->base + reg); 528 - spin_unlock_irqrestore(&info->irq_lock, flags); 528 + raw_spin_unlock_irqrestore(&info->irq_lock, flags); 529 529 } 530 530 531 531 static void armada_37xx_irq_mask(struct irq_data *d) ··· 536 536 unsigned long flags; 537 537 538 538 armada_37xx_irq_update_reg(&reg, d); 539 - spin_lock_irqsave(&info->irq_lock, flags); 539 + raw_spin_lock_irqsave(&info->irq_lock, flags); 540 540 val = readl(info->base + reg); 541 541 writel(val & ~d->mask, info->base + reg); 542 - spin_unlock_irqrestore(&info->irq_lock, flags); 542 + raw_spin_unlock_irqrestore(&info->irq_lock, flags); 543 543 } 544 544 545 545 static void armada_37xx_irq_unmask(struct irq_data *d) ··· 550 550 unsigned long flags; 551 551 552 552 armada_37xx_irq_update_reg(&reg, d); 553 - spin_lock_irqsave(&info->irq_lock, flags); 553 + raw_spin_lock_irqsave(&info->irq_lock, flags); 554 554 val = readl(info->base + reg); 555 555 writel(val | d->mask, info->base + reg); 556 - spin_unlock_irqrestore(&info->irq_lock, flags); 556 + raw_spin_unlock_irqrestore(&info->irq_lock, flags); 557 557 } 558 558 559 559 static int armada_37xx_irq_set_wake(struct irq_data *d, unsigned int on) ··· 564 564 unsigned long flags; 565 565 566 566 armada_37xx_irq_update_reg(&reg, d); 567 - spin_lock_irqsave(&info->irq_lock, flags); 567 + raw_spin_lock_irqsave(&info->irq_lock, flags); 568 568 val = readl(info->base + reg); 569 569 if (on) 570 570 val |= (BIT(d->hwirq % GPIO_PER_REG)); 571 571 else 572 572 val &= ~(BIT(d->hwirq % GPIO_PER_REG)); 573 573 writel(val, info->base + reg); 574 - spin_unlock_irqrestore(&info->irq_lock, flags); 574 + raw_spin_unlock_irqrestore(&info->irq_lock, flags); 575 575 576 576 return 0; 577 577 } ··· 583 583 u32 val, reg = IRQ_POL; 584 584 unsigned long flags; 585 585 586 - spin_lock_irqsave(&info->irq_lock, flags); 586 + raw_spin_lock_irqsave(&info->irq_lock, flags); 587 587 armada_37xx_irq_update_reg(&reg, d); 588 588 val = readl(info->base + reg); 589 589 switch (type) { ··· 607 607 break; 608 608 } 609 609 default: 610 - spin_unlock_irqrestore(&info->irq_lock, flags); 610 + raw_spin_unlock_irqrestore(&info->irq_lock, flags); 611 611 return -EINVAL; 612 612 } 613 613 writel(val, info->base + reg); 614 - spin_unlock_irqrestore(&info->irq_lock, flags); 614 + raw_spin_unlock_irqrestore(&info->irq_lock, flags); 615 615 616 616 return 0; 617 617 } ··· 626 626 627 627 regmap_read(info->regmap, INPUT_VAL + 4*reg_idx, &l); 628 628 629 - spin_lock_irqsave(&info->irq_lock, flags); 629 + raw_spin_lock_irqsave(&info->irq_lock, flags); 630 630 p = readl(info->base + IRQ_POL + 4 * reg_idx); 631 631 if ((p ^ l) & (1 << bit_num)) { 632 632 /* ··· 647 647 ret = -1; 648 648 } 649 649 650 - spin_unlock_irqrestore(&info->irq_lock, flags); 650 + raw_spin_unlock_irqrestore(&info->irq_lock, flags); 651 651 return ret; 652 652 } 653 653 ··· 664 664 u32 status; 665 665 unsigned long flags; 666 666 667 - spin_lock_irqsave(&info->irq_lock, flags); 667 + raw_spin_lock_irqsave(&info->irq_lock, flags); 668 668 status = readl_relaxed(info->base + IRQ_STATUS + 4 * i); 669 669 /* Manage only the interrupt that was enabled */ 670 670 status &= readl_relaxed(info->base + IRQ_EN + 4 * i); 671 - spin_unlock_irqrestore(&info->irq_lock, flags); 671 + raw_spin_unlock_irqrestore(&info->irq_lock, flags); 672 672 while (status) { 673 673 u32 hwirq = ffs(status) - 1; 674 674 u32 virq = irq_find_mapping(d, hwirq + ··· 695 695 696 696 update_status: 697 697 /* Update status in case a new IRQ appears */ 698 - spin_lock_irqsave(&info->irq_lock, flags); 698 + raw_spin_lock_irqsave(&info->irq_lock, flags); 699 699 status = readl_relaxed(info->base + 700 700 IRQ_STATUS + 4 * i); 701 701 /* Manage only the interrupt that was enabled */ 702 702 status &= readl_relaxed(info->base + IRQ_EN + 4 * i); 703 - spin_unlock_irqrestore(&info->irq_lock, flags); 703 + raw_spin_unlock_irqrestore(&info->irq_lock, flags); 704 704 } 705 705 } 706 706 chained_irq_exit(chip, desc); ··· 731 731 struct device *dev = &pdev->dev; 732 732 unsigned int i, nr_irq_parent; 733 733 734 - spin_lock_init(&info->irq_lock); 734 + raw_spin_lock_init(&info->irq_lock); 735 735 736 736 nr_irq_parent = of_irq_count(np); 737 737 if (!nr_irq_parent) { ··· 1107 1107 { }, 1108 1108 }; 1109 1109 1110 + static const struct regmap_config armada_37xx_pinctrl_regmap_config = { 1111 + .reg_bits = 32, 1112 + .val_bits = 32, 1113 + .reg_stride = 4, 1114 + .use_raw_spinlock = true, 1115 + }; 1116 + 1110 1117 static int __init armada_37xx_pinctrl_probe(struct platform_device *pdev) 1111 1118 { 1112 1119 struct armada_37xx_pinctrl *info; 1113 1120 struct device *dev = &pdev->dev; 1114 - struct device_node *np = dev->of_node; 1115 1121 struct regmap *regmap; 1122 + void __iomem *base; 1116 1123 int ret; 1124 + 1125 + base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); 1126 + if (IS_ERR(base)) { 1127 + dev_err(dev, "failed to ioremap base address: %pe\n", base); 1128 + return PTR_ERR(base); 1129 + } 1130 + 1131 + regmap = devm_regmap_init_mmio(dev, base, 1132 + &armada_37xx_pinctrl_regmap_config); 1133 + if (IS_ERR(regmap)) { 1134 + dev_err(dev, "failed to create regmap: %pe\n", regmap); 1135 + return PTR_ERR(regmap); 1136 + } 1117 1137 1118 1138 info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); 1119 1139 if (!info) 1120 1140 return -ENOMEM; 1121 1141 1122 1142 info->dev = dev; 1123 - 1124 - regmap = syscon_node_to_regmap(np); 1125 - if (IS_ERR(regmap)) 1126 - return dev_err_probe(dev, PTR_ERR(regmap), "cannot get regmap\n"); 1127 1143 info->regmap = regmap; 1128 - 1129 1144 info->data = of_device_get_match_data(dev); 1130 1145 1131 1146 ret = armada_37xx_pinctrl_register(pdev, info);
+137 -77
drivers/pinctrl/pinctrl-ocelot.c
··· 29 29 #define ocelot_clrsetbits(addr, clear, set) \ 30 30 writel((readl(addr) & ~(clear)) | (set), (addr)) 31 31 32 - /* PINCONFIG bits (sparx5 only) */ 33 32 enum { 34 33 PINCONF_BIAS, 35 34 PINCONF_SCHMITT, 36 35 PINCONF_DRIVE_STRENGTH, 37 36 }; 38 - 39 - #define BIAS_PD_BIT BIT(4) 40 - #define BIAS_PU_BIT BIT(3) 41 - #define BIAS_BITS (BIAS_PD_BIT|BIAS_PU_BIT) 42 - #define SCHMITT_BIT BIT(2) 43 - #define DRIVE_BITS GENMASK(1, 0) 44 37 45 38 /* GPIO standard registers */ 46 39 #define OCELOT_GPIO_OUT_SET 0x0 ··· 314 321 unsigned char a_functions[OCELOT_FUNC_PER_PIN]; /* Additional functions */ 315 322 }; 316 323 324 + struct ocelot_pincfg_data { 325 + u8 pd_bit; 326 + u8 pu_bit; 327 + u8 drive_bits; 328 + u8 schmitt_bit; 329 + }; 330 + 317 331 struct ocelot_pinctrl { 318 332 struct device *dev; 319 333 struct pinctrl_dev *pctl; ··· 328 328 struct regmap *map; 329 329 struct regmap *pincfg; 330 330 struct pinctrl_desc *desc; 331 + const struct ocelot_pincfg_data *pincfg_data; 331 332 struct ocelot_pmx_func func[FUNC_MAX]; 332 333 u8 stride; 334 + }; 335 + 336 + struct ocelot_match_data { 337 + struct pinctrl_desc desc; 338 + struct ocelot_pincfg_data pincfg_data; 333 339 }; 334 340 335 341 #define LUTON_P(p, f0, f1) \ ··· 1331 1325 int ret = -EOPNOTSUPP; 1332 1326 1333 1327 if (info->pincfg) { 1328 + const struct ocelot_pincfg_data *opd = info->pincfg_data; 1334 1329 u32 regcfg; 1335 1330 1336 - ret = regmap_read(info->pincfg, pin, &regcfg); 1331 + ret = regmap_read(info->pincfg, 1332 + pin * regmap_get_reg_stride(info->pincfg), 1333 + &regcfg); 1337 1334 if (ret) 1338 1335 return ret; 1339 1336 1340 1337 ret = 0; 1341 1338 switch (reg) { 1342 1339 case PINCONF_BIAS: 1343 - *val = regcfg & BIAS_BITS; 1340 + *val = regcfg & (opd->pd_bit | opd->pu_bit); 1344 1341 break; 1345 1342 1346 1343 case PINCONF_SCHMITT: 1347 - *val = regcfg & SCHMITT_BIT; 1344 + *val = regcfg & opd->schmitt_bit; 1348 1345 break; 1349 1346 1350 1347 case PINCONF_DRIVE_STRENGTH: 1351 - *val = regcfg & DRIVE_BITS; 1348 + *val = regcfg & opd->drive_bits; 1352 1349 break; 1353 1350 1354 1351 default: ··· 1368 1359 u32 val; 1369 1360 int ret; 1370 1361 1371 - ret = regmap_read(info->pincfg, regaddr, &val); 1362 + ret = regmap_read(info->pincfg, 1363 + regaddr * regmap_get_reg_stride(info->pincfg), 1364 + &val); 1372 1365 if (ret) 1373 1366 return ret; 1374 1367 1375 1368 val &= ~clrbits; 1376 1369 val |= setbits; 1377 1370 1378 - ret = regmap_write(info->pincfg, regaddr, val); 1371 + ret = regmap_write(info->pincfg, 1372 + regaddr * regmap_get_reg_stride(info->pincfg), 1373 + val); 1379 1374 1380 1375 return ret; 1381 1376 } ··· 1392 1379 int ret = -EOPNOTSUPP; 1393 1380 1394 1381 if (info->pincfg) { 1382 + const struct ocelot_pincfg_data *opd = info->pincfg_data; 1395 1383 1396 1384 ret = 0; 1397 1385 switch (reg) { 1398 1386 case PINCONF_BIAS: 1399 - ret = ocelot_pincfg_clrsetbits(info, pin, BIAS_BITS, 1387 + ret = ocelot_pincfg_clrsetbits(info, pin, 1388 + opd->pd_bit | opd->pu_bit, 1400 1389 val); 1401 1390 break; 1402 1391 1403 1392 case PINCONF_SCHMITT: 1404 - ret = ocelot_pincfg_clrsetbits(info, pin, SCHMITT_BIT, 1393 + ret = ocelot_pincfg_clrsetbits(info, pin, 1394 + opd->schmitt_bit, 1405 1395 val); 1406 1396 break; 1407 1397 1408 1398 case PINCONF_DRIVE_STRENGTH: 1409 1399 if (val <= 3) 1410 1400 ret = ocelot_pincfg_clrsetbits(info, pin, 1411 - DRIVE_BITS, val); 1401 + opd->drive_bits, 1402 + val); 1412 1403 else 1413 1404 ret = -EINVAL; 1414 1405 break; ··· 1442 1425 if (param == PIN_CONFIG_BIAS_DISABLE) 1443 1426 val = (val == 0); 1444 1427 else if (param == PIN_CONFIG_BIAS_PULL_DOWN) 1445 - val = (val & BIAS_PD_BIT ? true : false); 1428 + val = !!(val & info->pincfg_data->pd_bit); 1446 1429 else /* PIN_CONFIG_BIAS_PULL_UP */ 1447 - val = (val & BIAS_PU_BIT ? true : false); 1430 + val = !!(val & info->pincfg_data->pu_bit); 1448 1431 break; 1449 1432 1450 1433 case PIN_CONFIG_INPUT_SCHMITT_ENABLE: 1434 + if (!info->pincfg_data->schmitt_bit) 1435 + return -EOPNOTSUPP; 1436 + 1451 1437 err = ocelot_hw_get_value(info, pin, PINCONF_SCHMITT, &val); 1452 1438 if (err) 1453 1439 return err; 1454 1440 1455 - val = (val & SCHMITT_BIT ? true : false); 1441 + val = !!(val & info->pincfg_data->schmitt_bit); 1456 1442 break; 1457 1443 1458 1444 case PIN_CONFIG_DRIVE_STRENGTH: ··· 1499 1479 unsigned long *configs, unsigned int num_configs) 1500 1480 { 1501 1481 struct ocelot_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); 1482 + const struct ocelot_pincfg_data *opd = info->pincfg_data; 1502 1483 u32 param, arg, p; 1503 1484 int cfg, err = 0; 1504 1485 ··· 1512 1491 case PIN_CONFIG_BIAS_PULL_UP: 1513 1492 case PIN_CONFIG_BIAS_PULL_DOWN: 1514 1493 arg = (param == PIN_CONFIG_BIAS_DISABLE) ? 0 : 1515 - (param == PIN_CONFIG_BIAS_PULL_UP) ? BIAS_PU_BIT : 1516 - BIAS_PD_BIT; 1494 + (param == PIN_CONFIG_BIAS_PULL_UP) ? 1495 + opd->pu_bit : opd->pd_bit; 1517 1496 1518 1497 err = ocelot_hw_set_value(info, pin, PINCONF_BIAS, arg); 1519 1498 if (err) ··· 1522 1501 break; 1523 1502 1524 1503 case PIN_CONFIG_INPUT_SCHMITT_ENABLE: 1525 - arg = arg ? SCHMITT_BIT : 0; 1504 + if (!opd->schmitt_bit) 1505 + return -EOPNOTSUPP; 1506 + 1507 + arg = arg ? opd->schmitt_bit : 0; 1526 1508 err = ocelot_hw_set_value(info, pin, PINCONF_SCHMITT, 1527 1509 arg); 1528 1510 if (err) ··· 1586 1562 .dt_free_map = pinconf_generic_dt_free_map, 1587 1563 }; 1588 1564 1589 - static struct pinctrl_desc luton_desc = { 1590 - .name = "luton-pinctrl", 1591 - .pins = luton_pins, 1592 - .npins = ARRAY_SIZE(luton_pins), 1593 - .pctlops = &ocelot_pctl_ops, 1594 - .pmxops = &ocelot_pmx_ops, 1595 - .owner = THIS_MODULE, 1565 + static struct ocelot_match_data luton_desc = { 1566 + .desc = { 1567 + .name = "luton-pinctrl", 1568 + .pins = luton_pins, 1569 + .npins = ARRAY_SIZE(luton_pins), 1570 + .pctlops = &ocelot_pctl_ops, 1571 + .pmxops = &ocelot_pmx_ops, 1572 + .owner = THIS_MODULE, 1573 + }, 1596 1574 }; 1597 1575 1598 - static struct pinctrl_desc serval_desc = { 1599 - .name = "serval-pinctrl", 1600 - .pins = serval_pins, 1601 - .npins = ARRAY_SIZE(serval_pins), 1602 - .pctlops = &ocelot_pctl_ops, 1603 - .pmxops = &ocelot_pmx_ops, 1604 - .owner = THIS_MODULE, 1576 + static struct ocelot_match_data serval_desc = { 1577 + .desc = { 1578 + .name = "serval-pinctrl", 1579 + .pins = serval_pins, 1580 + .npins = ARRAY_SIZE(serval_pins), 1581 + .pctlops = &ocelot_pctl_ops, 1582 + .pmxops = &ocelot_pmx_ops, 1583 + .owner = THIS_MODULE, 1584 + }, 1605 1585 }; 1606 1586 1607 - static struct pinctrl_desc ocelot_desc = { 1608 - .name = "ocelot-pinctrl", 1609 - .pins = ocelot_pins, 1610 - .npins = ARRAY_SIZE(ocelot_pins), 1611 - .pctlops = &ocelot_pctl_ops, 1612 - .pmxops = &ocelot_pmx_ops, 1613 - .owner = THIS_MODULE, 1587 + static struct ocelot_match_data ocelot_desc = { 1588 + .desc = { 1589 + .name = "ocelot-pinctrl", 1590 + .pins = ocelot_pins, 1591 + .npins = ARRAY_SIZE(ocelot_pins), 1592 + .pctlops = &ocelot_pctl_ops, 1593 + .pmxops = &ocelot_pmx_ops, 1594 + .owner = THIS_MODULE, 1595 + }, 1614 1596 }; 1615 1597 1616 - static struct pinctrl_desc jaguar2_desc = { 1617 - .name = "jaguar2-pinctrl", 1618 - .pins = jaguar2_pins, 1619 - .npins = ARRAY_SIZE(jaguar2_pins), 1620 - .pctlops = &ocelot_pctl_ops, 1621 - .pmxops = &ocelot_pmx_ops, 1622 - .owner = THIS_MODULE, 1598 + static struct ocelot_match_data jaguar2_desc = { 1599 + .desc = { 1600 + .name = "jaguar2-pinctrl", 1601 + .pins = jaguar2_pins, 1602 + .npins = ARRAY_SIZE(jaguar2_pins), 1603 + .pctlops = &ocelot_pctl_ops, 1604 + .pmxops = &ocelot_pmx_ops, 1605 + .owner = THIS_MODULE, 1606 + }, 1623 1607 }; 1624 1608 1625 - static struct pinctrl_desc servalt_desc = { 1626 - .name = "servalt-pinctrl", 1627 - .pins = servalt_pins, 1628 - .npins = ARRAY_SIZE(servalt_pins), 1629 - .pctlops = &ocelot_pctl_ops, 1630 - .pmxops = &ocelot_pmx_ops, 1631 - .owner = THIS_MODULE, 1609 + static struct ocelot_match_data servalt_desc = { 1610 + .desc = { 1611 + .name = "servalt-pinctrl", 1612 + .pins = servalt_pins, 1613 + .npins = ARRAY_SIZE(servalt_pins), 1614 + .pctlops = &ocelot_pctl_ops, 1615 + .pmxops = &ocelot_pmx_ops, 1616 + .owner = THIS_MODULE, 1617 + }, 1632 1618 }; 1633 1619 1634 - static struct pinctrl_desc sparx5_desc = { 1635 - .name = "sparx5-pinctrl", 1636 - .pins = sparx5_pins, 1637 - .npins = ARRAY_SIZE(sparx5_pins), 1638 - .pctlops = &ocelot_pctl_ops, 1639 - .pmxops = &ocelot_pmx_ops, 1640 - .confops = &ocelot_confops, 1641 - .owner = THIS_MODULE, 1620 + static struct ocelot_match_data sparx5_desc = { 1621 + .desc = { 1622 + .name = "sparx5-pinctrl", 1623 + .pins = sparx5_pins, 1624 + .npins = ARRAY_SIZE(sparx5_pins), 1625 + .pctlops = &ocelot_pctl_ops, 1626 + .pmxops = &ocelot_pmx_ops, 1627 + .confops = &ocelot_confops, 1628 + .owner = THIS_MODULE, 1629 + }, 1630 + .pincfg_data = { 1631 + .pd_bit = BIT(4), 1632 + .pu_bit = BIT(3), 1633 + .drive_bits = GENMASK(1, 0), 1634 + .schmitt_bit = BIT(2), 1635 + }, 1642 1636 }; 1643 1637 1644 - static struct pinctrl_desc lan966x_desc = { 1645 - .name = "lan966x-pinctrl", 1646 - .pins = lan966x_pins, 1647 - .npins = ARRAY_SIZE(lan966x_pins), 1648 - .pctlops = &ocelot_pctl_ops, 1649 - .pmxops = &lan966x_pmx_ops, 1650 - .confops = &ocelot_confops, 1651 - .owner = THIS_MODULE, 1638 + static struct ocelot_match_data lan966x_desc = { 1639 + .desc = { 1640 + .name = "lan966x-pinctrl", 1641 + .pins = lan966x_pins, 1642 + .npins = ARRAY_SIZE(lan966x_pins), 1643 + .pctlops = &ocelot_pctl_ops, 1644 + .pmxops = &lan966x_pmx_ops, 1645 + .confops = &ocelot_confops, 1646 + .owner = THIS_MODULE, 1647 + }, 1648 + .pincfg_data = { 1649 + .pd_bit = BIT(3), 1650 + .pu_bit = BIT(2), 1651 + .drive_bits = GENMASK(1, 0), 1652 + }, 1652 1653 }; 1653 1654 1654 1655 static int ocelot_create_group_func_map(struct device *dev, ··· 1939 1890 {}, 1940 1891 }; 1941 1892 1942 - static struct regmap *ocelot_pinctrl_create_pincfg(struct platform_device *pdev) 1893 + static struct regmap *ocelot_pinctrl_create_pincfg(struct platform_device *pdev, 1894 + const struct ocelot_pinctrl *info) 1943 1895 { 1944 1896 void __iomem *base; 1945 1897 ··· 1948 1898 .reg_bits = 32, 1949 1899 .val_bits = 32, 1950 1900 .reg_stride = 4, 1951 - .max_register = 32, 1901 + .max_register = info->desc->npins * 4, 1952 1902 .name = "pincfg", 1953 1903 }; 1954 1904 ··· 1963 1913 1964 1914 static int ocelot_pinctrl_probe(struct platform_device *pdev) 1965 1915 { 1916 + const struct ocelot_match_data *data; 1966 1917 struct device *dev = &pdev->dev; 1967 1918 struct ocelot_pinctrl *info; 1968 1919 struct reset_control *reset; ··· 1980 1929 if (!info) 1981 1930 return -ENOMEM; 1982 1931 1983 - info->desc = (struct pinctrl_desc *)device_get_match_data(dev); 1932 + data = device_get_match_data(dev); 1933 + if (!data) 1934 + return -EINVAL; 1935 + 1936 + info->desc = devm_kmemdup(dev, &data->desc, sizeof(*info->desc), 1937 + GFP_KERNEL); 1938 + if (!info->desc) 1939 + return -ENOMEM; 1940 + 1941 + info->pincfg_data = &data->pincfg_data; 1984 1942 1985 1943 reset = devm_reset_control_get_optional_shared(dev, "switch"); 1986 1944 if (IS_ERR(reset)) ··· 2016 1956 2017 1957 /* Pinconf registers */ 2018 1958 if (info->desc->confops) { 2019 - pincfg = ocelot_pinctrl_create_pincfg(pdev); 1959 + pincfg = ocelot_pinctrl_create_pincfg(pdev, info); 2020 1960 if (IS_ERR(pincfg)) 2021 1961 dev_dbg(dev, "Failed to create pincfg regmap\n"); 2022 1962 else
+2
drivers/pinctrl/ralink/pinctrl-ralink.c
··· 266 266 p->func[i]->pin_count, 267 267 sizeof(int), 268 268 GFP_KERNEL); 269 + if (!p->func[i]->pins) 270 + return -ENOMEM; 269 271 for (j = 0; j < p->func[i]->pin_count; j++) 270 272 p->func[i]->pins[j] = p->func[i]->pin_first + j; 271 273
+3
drivers/pinctrl/sunplus/sppctl.c
··· 871 871 } 872 872 873 873 *map = kcalloc(*num_maps + nmG, sizeof(**map), GFP_KERNEL); 874 + if (*map == NULL) 875 + return -ENOMEM; 876 + 874 877 for (i = 0; i < (*num_maps); i++) { 875 878 dt_pin = be32_to_cpu(list[i]); 876 879 pin_num = FIELD_GET(GENMASK(31, 24), dt_pin);
+1
drivers/ptp/Kconfig
··· 176 176 depends on !S390 177 177 depends on COMMON_CLK 178 178 select NET_DEVLINK 179 + select CRC16 179 180 help 180 181 This driver adds support for an OpenCompute time card. 181 182
+1 -1
drivers/s390/net/qeth_core_main.c
··· 3565 3565 if (!atomic_read(&queue->set_pci_flags_count)) { 3566 3566 /* 3567 3567 * there's no outstanding PCI any more, so we 3568 - * have to request a PCI to be sure the the PCI 3568 + * have to request a PCI to be sure the PCI 3569 3569 * will wake at some time in the future then we 3570 3570 * can flush packed buffers that might still be 3571 3571 * hanging around, which can happen if no
+8 -4
drivers/spi/spi-bcm2835.c
··· 1138 1138 struct bcm2835_spi *bs = spi_controller_get_devdata(ctlr); 1139 1139 1140 1140 /* if an error occurred and we have an active dma, then terminate */ 1141 - dmaengine_terminate_sync(ctlr->dma_tx); 1142 - bs->tx_dma_active = false; 1143 - dmaengine_terminate_sync(ctlr->dma_rx); 1144 - bs->rx_dma_active = false; 1141 + if (ctlr->dma_tx) { 1142 + dmaengine_terminate_sync(ctlr->dma_tx); 1143 + bs->tx_dma_active = false; 1144 + } 1145 + if (ctlr->dma_rx) { 1146 + dmaengine_terminate_sync(ctlr->dma_rx); 1147 + bs->rx_dma_active = false; 1148 + } 1145 1149 bcm2835_spi_undo_prologue(bs); 1146 1150 1147 1151 /* and reset */
+1 -1
drivers/spi/spi-cadence.c
··· 69 69 #define CDNS_SPI_BAUD_DIV_SHIFT 3 /* Baud rate divisor shift in CR */ 70 70 #define CDNS_SPI_SS_SHIFT 10 /* Slave Select field shift in CR */ 71 71 #define CDNS_SPI_SS0 0x1 /* Slave Select zero */ 72 - #define CDNS_SPI_NOSS 0x3C /* No Slave select */ 72 + #define CDNS_SPI_NOSS 0xF /* No Slave select */ 73 73 74 74 /* 75 75 * SPI Interrupt Registers bit Masks
+4
drivers/spi/spi-rspi.c
··· 613 613 rspi->dma_callbacked, HZ); 614 614 if (ret > 0 && rspi->dma_callbacked) { 615 615 ret = 0; 616 + if (tx) 617 + dmaengine_synchronize(rspi->ctlr->dma_tx); 618 + if (rx) 619 + dmaengine_synchronize(rspi->ctlr->dma_rx); 616 620 } else { 617 621 if (!ret) { 618 622 dev_err(&rspi->ctlr->dev, "DMA timeout\n");
+6 -3
drivers/virt/coco/sev-guest/sev-guest.c
··· 632 632 struct device *dev = &pdev->dev; 633 633 struct snp_guest_dev *snp_dev; 634 634 struct miscdevice *misc; 635 + void __iomem *mapping; 635 636 int ret; 636 637 637 638 if (!dev->platform_data) 638 639 return -ENODEV; 639 640 640 641 data = (struct sev_guest_platform_data *)dev->platform_data; 641 - layout = (__force void *)ioremap_encrypted(data->secrets_gpa, PAGE_SIZE); 642 - if (!layout) 642 + mapping = ioremap_encrypted(data->secrets_gpa, PAGE_SIZE); 643 + if (!mapping) 643 644 return -ENODEV; 645 + 646 + layout = (__force void *)mapping; 644 647 645 648 ret = -ENOMEM; 646 649 snp_dev = devm_kzalloc(&pdev->dev, sizeof(struct snp_guest_dev), GFP_KERNEL); ··· 709 706 e_free_request: 710 707 free_shared_pages(snp_dev->request, sizeof(struct snp_guest_msg)); 711 708 e_unmap: 712 - iounmap(layout); 709 + iounmap(mapping); 713 710 return ret; 714 711 } 715 712
+11 -3
fs/io_uring.c
··· 1738 1738 return; 1739 1739 1740 1740 /* 1741 + * READV uses fields in `struct io_rw` (len/addr) to stash the selected 1742 + * buffer data. However if that buffer is recycled the original request 1743 + * data stored in addr is lost. Therefore forbid recycling for now. 1744 + */ 1745 + if (req->opcode == IORING_OP_READV) 1746 + return; 1747 + 1748 + /* 1741 1749 * We don't need to recycle for REQ_F_BUFFER_RING, we can just clear 1742 1750 * the flag and hence ensure that bl->head doesn't get incremented. 1743 1751 * If the tail has already been incremented, hang on to it. ··· 12939 12931 { 12940 12932 struct io_uring_buf_ring *br; 12941 12933 struct io_uring_buf_reg reg; 12942 - struct io_buffer_list *bl; 12934 + struct io_buffer_list *bl, *free_bl = NULL; 12943 12935 struct page **pages; 12944 12936 int nr_pages; 12945 12937 ··· 12971 12963 if (bl->buf_nr_pages || !list_empty(&bl->buf_list)) 12972 12964 return -EEXIST; 12973 12965 } else { 12974 - bl = kzalloc(sizeof(*bl), GFP_KERNEL); 12966 + free_bl = bl = kzalloc(sizeof(*bl), GFP_KERNEL); 12975 12967 if (!bl) 12976 12968 return -ENOMEM; 12977 12969 } ··· 12980 12972 struct_size(br, bufs, reg.ring_entries), 12981 12973 &nr_pages); 12982 12974 if (IS_ERR(pages)) { 12983 - kfree(bl); 12975 + kfree(free_bl); 12984 12976 return PTR_ERR(pages); 12985 12977 } 12986 12978
+6 -2
fs/ntfs/attrib.c
··· 592 592 a = (ATTR_RECORD*)((u8*)ctx->attr + 593 593 le32_to_cpu(ctx->attr->length)); 594 594 for (;; a = (ATTR_RECORD*)((u8*)a + le32_to_cpu(a->length))) { 595 - if ((u8*)a < (u8*)ctx->mrec || (u8*)a > (u8*)ctx->mrec + 596 - le32_to_cpu(ctx->mrec->bytes_allocated)) 595 + u8 *mrec_end = (u8 *)ctx->mrec + 596 + le32_to_cpu(ctx->mrec->bytes_allocated); 597 + u8 *name_end = (u8 *)a + le16_to_cpu(a->name_offset) + 598 + a->name_length * sizeof(ntfschar); 599 + if ((u8*)a < (u8*)ctx->mrec || (u8*)a > mrec_end || 600 + name_end > mrec_end) 597 601 break; 598 602 ctx->attr = a; 599 603 if (unlikely(le32_to_cpu(a->type) > le32_to_cpu(type) ||
+1 -3
fs/ocfs2/ocfs2.h
··· 277 277 OCFS2_MOUNT_JOURNAL_ASYNC_COMMIT = 1 << 15, /* Journal Async Commit */ 278 278 OCFS2_MOUNT_ERRORS_CONT = 1 << 16, /* Return EIO to the calling process on error */ 279 279 OCFS2_MOUNT_ERRORS_ROFS = 1 << 17, /* Change filesystem to read-only on error */ 280 - OCFS2_MOUNT_NOCLUSTER = 1 << 18, /* No cluster aware filesystem mount */ 281 280 }; 282 281 283 282 #define OCFS2_OSB_SOFT_RO 0x0001 ··· 672 673 673 674 static inline int ocfs2_mount_local(struct ocfs2_super *osb) 674 675 { 675 - return ((osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT) 676 - || (osb->s_mount_opt & OCFS2_MOUNT_NOCLUSTER)); 676 + return (osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT); 677 677 } 678 678 679 679 static inline int ocfs2_uses_extended_slot_map(struct ocfs2_super *osb)
+19 -27
fs/ocfs2/slot_map.c
··· 252 252 int i, ret = -ENOSPC; 253 253 254 254 if ((preferred >= 0) && (preferred < si->si_num_slots)) { 255 - if (!si->si_slots[preferred].sl_valid || 256 - !si->si_slots[preferred].sl_node_num) { 255 + if (!si->si_slots[preferred].sl_valid) { 257 256 ret = preferred; 258 257 goto out; 259 258 } 260 259 } 261 260 262 261 for(i = 0; i < si->si_num_slots; i++) { 263 - if (!si->si_slots[i].sl_valid || 264 - !si->si_slots[i].sl_node_num) { 262 + if (!si->si_slots[i].sl_valid) { 265 263 ret = i; 266 264 break; 267 265 } ··· 454 456 spin_lock(&osb->osb_lock); 455 457 ocfs2_update_slot_info(si); 456 458 457 - if (ocfs2_mount_local(osb)) 458 - /* use slot 0 directly in local mode */ 459 - slot = 0; 460 - else { 461 - /* search for ourselves first and take the slot if it already 462 - * exists. Perhaps we need to mark this in a variable for our 463 - * own journal recovery? Possibly not, though we certainly 464 - * need to warn to the user */ 465 - slot = __ocfs2_node_num_to_slot(si, osb->node_num); 459 + /* search for ourselves first and take the slot if it already 460 + * exists. Perhaps we need to mark this in a variable for our 461 + * own journal recovery? Possibly not, though we certainly 462 + * need to warn to the user */ 463 + slot = __ocfs2_node_num_to_slot(si, osb->node_num); 464 + if (slot < 0) { 465 + /* if no slot yet, then just take 1st available 466 + * one. */ 467 + slot = __ocfs2_find_empty_slot(si, osb->preferred_slot); 466 468 if (slot < 0) { 467 - /* if no slot yet, then just take 1st available 468 - * one. */ 469 - slot = __ocfs2_find_empty_slot(si, osb->preferred_slot); 470 - if (slot < 0) { 471 - spin_unlock(&osb->osb_lock); 472 - mlog(ML_ERROR, "no free slots available!\n"); 473 - status = -EINVAL; 474 - goto bail; 475 - } 476 - } else 477 - printk(KERN_INFO "ocfs2: Slot %d on device (%s) was " 478 - "already allocated to this node!\n", 479 - slot, osb->dev_str); 480 - } 469 + spin_unlock(&osb->osb_lock); 470 + mlog(ML_ERROR, "no free slots available!\n"); 471 + status = -EINVAL; 472 + goto bail; 473 + } 474 + } else 475 + printk(KERN_INFO "ocfs2: Slot %d on device (%s) was already " 476 + "allocated to this node!\n", slot, osb->dev_str); 481 477 482 478 ocfs2_set_slot(si, slot, osb->node_num); 483 479 osb->slot_num = slot;
-21
fs/ocfs2/super.c
··· 172 172 Opt_dir_resv_level, 173 173 Opt_journal_async_commit, 174 174 Opt_err_cont, 175 - Opt_nocluster, 176 175 Opt_err, 177 176 }; 178 177 ··· 205 206 {Opt_dir_resv_level, "dir_resv_level=%u"}, 206 207 {Opt_journal_async_commit, "journal_async_commit"}, 207 208 {Opt_err_cont, "errors=continue"}, 208 - {Opt_nocluster, "nocluster"}, 209 209 {Opt_err, NULL} 210 210 }; 211 211 ··· 616 618 goto out; 617 619 } 618 620 619 - tmp = OCFS2_MOUNT_NOCLUSTER; 620 - if ((osb->s_mount_opt & tmp) != (parsed_options.mount_opt & tmp)) { 621 - ret = -EINVAL; 622 - mlog(ML_ERROR, "Cannot change nocluster option on remount\n"); 623 - goto out; 624 - } 625 - 626 621 tmp = OCFS2_MOUNT_HB_LOCAL | OCFS2_MOUNT_HB_GLOBAL | 627 622 OCFS2_MOUNT_HB_NONE; 628 623 if ((osb->s_mount_opt & tmp) != (parsed_options.mount_opt & tmp)) { ··· 856 865 } 857 866 858 867 if (ocfs2_userspace_stack(osb) && 859 - !(osb->s_mount_opt & OCFS2_MOUNT_NOCLUSTER) && 860 868 strncmp(osb->osb_cluster_stack, mopt->cluster_stack, 861 869 OCFS2_STACK_LABEL_LEN)) { 862 870 mlog(ML_ERROR, ··· 1126 1136 osb->dev_str, nodestr, osb->slot_num, 1127 1137 osb->s_mount_opt & OCFS2_MOUNT_DATA_WRITEBACK ? "writeback" : 1128 1138 "ordered"); 1129 - 1130 - if ((osb->s_mount_opt & OCFS2_MOUNT_NOCLUSTER) && 1131 - !(osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT)) 1132 - printk(KERN_NOTICE "ocfs2: The shared device (%s) is mounted " 1133 - "without cluster aware mode.\n", osb->dev_str); 1134 1139 1135 1140 atomic_set(&osb->vol_state, VOLUME_MOUNTED); 1136 1141 wake_up(&osb->osb_mount_event); ··· 1437 1452 case Opt_journal_async_commit: 1438 1453 mopt->mount_opt |= OCFS2_MOUNT_JOURNAL_ASYNC_COMMIT; 1439 1454 break; 1440 - case Opt_nocluster: 1441 - mopt->mount_opt |= OCFS2_MOUNT_NOCLUSTER; 1442 - break; 1443 1455 default: 1444 1456 mlog(ML_ERROR, 1445 1457 "Unrecognized mount option \"%s\" " ··· 1547 1565 1548 1566 if (opts & OCFS2_MOUNT_JOURNAL_ASYNC_COMMIT) 1549 1567 seq_printf(s, ",journal_async_commit"); 1550 - 1551 - if (opts & OCFS2_MOUNT_NOCLUSTER) 1552 - seq_printf(s, ",nocluster"); 1553 1568 1554 1569 return 0; 1555 1570 }
+3
fs/read_write.c
··· 1263 1263 count, fl); 1264 1264 file_end_write(out.file); 1265 1265 } else { 1266 + if (out.file->f_flags & O_NONBLOCK) 1267 + fl |= SPLICE_F_NONBLOCK; 1268 + 1266 1269 retval = splice_file_to_pipe(in.file, opipe, &pos, count, fl); 1267 1270 } 1268 1271
+7 -5
fs/userfaultfd.c
··· 192 192 } 193 193 194 194 static inline struct uffd_msg userfault_msg(unsigned long address, 195 + unsigned long real_address, 195 196 unsigned int flags, 196 197 unsigned long reason, 197 198 unsigned int features) 198 199 { 199 200 struct uffd_msg msg; 201 + 200 202 msg_init(&msg); 201 203 msg.event = UFFD_EVENT_PAGEFAULT; 202 204 203 - if (!(features & UFFD_FEATURE_EXACT_ADDRESS)) 204 - address &= PAGE_MASK; 205 - msg.arg.pagefault.address = address; 205 + msg.arg.pagefault.address = (features & UFFD_FEATURE_EXACT_ADDRESS) ? 206 + real_address : address; 207 + 206 208 /* 207 209 * These flags indicate why the userfault occurred: 208 210 * - UFFD_PAGEFAULT_FLAG_WP indicates a write protect fault. ··· 490 488 491 489 init_waitqueue_func_entry(&uwq.wq, userfaultfd_wake_function); 492 490 uwq.wq.private = current; 493 - uwq.msg = userfault_msg(vmf->real_address, vmf->flags, reason, 494 - ctx->features); 491 + uwq.msg = userfault_msg(vmf->address, vmf->real_address, vmf->flags, 492 + reason, ctx->features); 495 493 uwq.ctx = ctx; 496 494 uwq.waken = false; 497 495
-2
include/asm-generic/io.h
··· 1125 1125 } 1126 1126 #endif 1127 1127 1128 - #ifndef CONFIG_GENERIC_DEVMEM_IS_ALLOWED 1129 1128 extern int devmem_is_allowed(unsigned long pfn); 1130 - #endif 1131 1129 1132 1130 #endif /* __KERNEL__ */ 1133 1131
-3
include/asm-generic/tlb.h
··· 368 368 flush_tlb_mm(tlb->mm); 369 369 } 370 370 371 - static inline void 372 - tlb_update_vma_flags(struct mmu_gather *tlb, struct vm_area_struct *vma) { } 373 - 374 371 #else /* CONFIG_MMU_GATHER_NO_RANGE */ 375 372 376 373 #ifndef tlb_flush
+2 -2
include/drm/gpu_scheduler.h
··· 28 28 #include <linux/dma-fence.h> 29 29 #include <linux/completion.h> 30 30 #include <linux/xarray.h> 31 - #include <linux/irq_work.h> 31 + #include <linux/workqueue.h> 32 32 33 33 #define MAX_WAIT_SCHED_ENTITY_Q_EMPTY msecs_to_jiffies(1000) 34 34 ··· 295 295 */ 296 296 union { 297 297 struct dma_fence_cb finish_cb; 298 - struct irq_work work; 298 + struct work_struct work; 299 299 }; 300 300 301 301 uint64_t id;
+9 -5
include/linux/mm.h
··· 1130 1130 #if defined(CONFIG_ZONE_DEVICE) && defined(CONFIG_FS_DAX) 1131 1131 DECLARE_STATIC_KEY_FALSE(devmap_managed_key); 1132 1132 1133 - bool __put_devmap_managed_page(struct page *page); 1134 - static inline bool put_devmap_managed_page(struct page *page) 1133 + bool __put_devmap_managed_page_refs(struct page *page, int refs); 1134 + static inline bool put_devmap_managed_page_refs(struct page *page, int refs) 1135 1135 { 1136 1136 if (!static_branch_unlikely(&devmap_managed_key)) 1137 1137 return false; 1138 1138 if (!is_zone_device_page(page)) 1139 1139 return false; 1140 - return __put_devmap_managed_page(page); 1140 + return __put_devmap_managed_page_refs(page, refs); 1141 1141 } 1142 - 1143 1142 #else /* CONFIG_ZONE_DEVICE && CONFIG_FS_DAX */ 1144 - static inline bool put_devmap_managed_page(struct page *page) 1143 + static inline bool put_devmap_managed_page_refs(struct page *page, int refs) 1145 1144 { 1146 1145 return false; 1147 1146 } 1148 1147 #endif /* CONFIG_ZONE_DEVICE && CONFIG_FS_DAX */ 1148 + 1149 + static inline bool put_devmap_managed_page(struct page *page) 1150 + { 1151 + return put_devmap_managed_page_refs(page, 1); 1152 + } 1149 1153 1150 1154 /* 127: arbitrary random number, small enough to assemble well */ 1151 1155 #define folio_ref_zero_or_close_to_overflow(folio) \
+3
include/net/addrconf.h
··· 405 405 { 406 406 const struct inet6_dev *idev = __in6_dev_get(dev); 407 407 408 + if (unlikely(!idev)) 409 + return true; 410 + 408 411 return !!idev->cnf.ignore_routes_with_linkdown; 409 412 } 410 413
+1
include/net/bluetooth/l2cap.h
··· 847 847 }; 848 848 849 849 void l2cap_chan_hold(struct l2cap_chan *c); 850 + struct l2cap_chan *l2cap_chan_hold_unless_zero(struct l2cap_chan *c); 850 851 void l2cap_chan_put(struct l2cap_chan *c); 851 852 852 853 static inline void l2cap_chan_lock(struct l2cap_chan *chan)
+1 -9
include/net/inet_connection_sock.h
··· 321 321 322 322 struct dst_entry *inet_csk_update_pmtu(struct sock *sk, u32 mtu); 323 323 324 - #define TCP_PINGPONG_THRESH 3 324 + #define TCP_PINGPONG_THRESH 1 325 325 326 326 static inline void inet_csk_enter_pingpong_mode(struct sock *sk) 327 327 { ··· 336 336 static inline bool inet_csk_in_pingpong_mode(struct sock *sk) 337 337 { 338 338 return inet_csk(sk)->icsk_ack.pingpong >= TCP_PINGPONG_THRESH; 339 - } 340 - 341 - static inline void inet_csk_inc_pingpong_cnt(struct sock *sk) 342 - { 343 - struct inet_connection_sock *icsk = inet_csk(sk); 344 - 345 - if (icsk->icsk_ack.pingpong < U8_MAX) 346 - icsk->icsk_ack.pingpong++; 347 339 } 348 340 349 341 static inline bool inet_csk_has_ulp(struct sock *sk)
+4 -4
include/net/sock.h
··· 2823 2823 { 2824 2824 /* Does this proto have per netns sysctl_wmem ? */ 2825 2825 if (proto->sysctl_wmem_offset) 2826 - return *(int *)((void *)sock_net(sk) + proto->sysctl_wmem_offset); 2826 + return READ_ONCE(*(int *)((void *)sock_net(sk) + proto->sysctl_wmem_offset)); 2827 2827 2828 - return *proto->sysctl_wmem; 2828 + return READ_ONCE(*proto->sysctl_wmem); 2829 2829 } 2830 2830 2831 2831 static inline int sk_get_rmem0(const struct sock *sk, const struct proto *proto) 2832 2832 { 2833 2833 /* Does this proto have per netns sysctl_rmem ? */ 2834 2834 if (proto->sysctl_rmem_offset) 2835 - return *(int *)((void *)sock_net(sk) + proto->sysctl_rmem_offset); 2835 + return READ_ONCE(*(int *)((void *)sock_net(sk) + proto->sysctl_rmem_offset)); 2836 2836 2837 - return *proto->sysctl_rmem; 2837 + return READ_ONCE(*proto->sysctl_rmem); 2838 2838 } 2839 2839 2840 2840 /* Default TCP Small queue budget is ~1 ms of data (1sec >> 10)
+1 -1
include/net/tcp.h
··· 1425 1425 1426 1426 static inline int tcp_win_from_space(const struct sock *sk, int space) 1427 1427 { 1428 - int tcp_adv_win_scale = sock_net(sk)->ipv4.sysctl_tcp_adv_win_scale; 1428 + int tcp_adv_win_scale = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_adv_win_scale); 1429 1429 1430 1430 return tcp_adv_win_scale <= 0 ? 1431 1431 (space>>(-tcp_adv_win_scale)) :
+2
include/uapi/asm-generic/fcntl.h
··· 192 192 193 193 #define F_LINUX_SPECIFIC_BASE 1024 194 194 195 + #ifndef HAVE_ARCH_STRUCT_FLOCK 195 196 struct flock { 196 197 short l_type; 197 198 short l_whence; ··· 217 216 __ARCH_FLOCK64_PAD 218 217 #endif 219 218 }; 219 + #endif /* HAVE_ARCH_STRUCT_FLOCK */ 220 220 221 221 #endif /* _ASM_GENERIC_FCNTL_H */
+1 -1
include/uapi/linux/kvm.h
··· 2084 2084 #define KVM_STATS_UNIT_SECONDS (0x2 << KVM_STATS_UNIT_SHIFT) 2085 2085 #define KVM_STATS_UNIT_CYCLES (0x3 << KVM_STATS_UNIT_SHIFT) 2086 2086 #define KVM_STATS_UNIT_BOOLEAN (0x4 << KVM_STATS_UNIT_SHIFT) 2087 - #define KVM_STATS_UNIT_MAX KVM_STATS_UNIT_CYCLES 2087 + #define KVM_STATS_UNIT_MAX KVM_STATS_UNIT_BOOLEAN 2088 2088 2089 2089 #define KVM_STATS_BASE_SHIFT 8 2090 2090 #define KVM_STATS_BASE_MASK (0xF << KVM_STATS_BASE_SHIFT)
+74 -24
kernel/rcu/srcutree.c
··· 511 511 return sum; 512 512 } 513 513 514 - #define SRCU_INTERVAL 1 // Base delay if no expedited GPs pending. 515 - #define SRCU_MAX_INTERVAL 10 // Maximum incremental delay from slow readers. 516 - #define SRCU_MAX_NODELAY_PHASE 1 // Maximum per-GP-phase consecutive no-delay instances. 517 - #define SRCU_MAX_NODELAY 100 // Maximum consecutive no-delay instances. 514 + /* 515 + * We use an adaptive strategy for synchronize_srcu() and especially for 516 + * synchronize_srcu_expedited(). We spin for a fixed time period 517 + * (defined below, boot time configurable) to allow SRCU readers to exit 518 + * their read-side critical sections. If there are still some readers 519 + * after one jiffy, we repeatedly block for one jiffy time periods. 520 + * The blocking time is increased as the grace-period age increases, 521 + * with max blocking time capped at 10 jiffies. 522 + */ 523 + #define SRCU_DEFAULT_RETRY_CHECK_DELAY 5 524 + 525 + static ulong srcu_retry_check_delay = SRCU_DEFAULT_RETRY_CHECK_DELAY; 526 + module_param(srcu_retry_check_delay, ulong, 0444); 527 + 528 + #define SRCU_INTERVAL 1 // Base delay if no expedited GPs pending. 529 + #define SRCU_MAX_INTERVAL 10 // Maximum incremental delay from slow readers. 530 + 531 + #define SRCU_DEFAULT_MAX_NODELAY_PHASE_LO 3UL // Lowmark on default per-GP-phase 532 + // no-delay instances. 533 + #define SRCU_DEFAULT_MAX_NODELAY_PHASE_HI 1000UL // Highmark on default per-GP-phase 534 + // no-delay instances. 535 + 536 + #define SRCU_UL_CLAMP_LO(val, low) ((val) > (low) ? (val) : (low)) 537 + #define SRCU_UL_CLAMP_HI(val, high) ((val) < (high) ? (val) : (high)) 538 + #define SRCU_UL_CLAMP(val, low, high) SRCU_UL_CLAMP_HI(SRCU_UL_CLAMP_LO((val), (low)), (high)) 539 + // per-GP-phase no-delay instances adjusted to allow non-sleeping poll upto 540 + // one jiffies time duration. Mult by 2 is done to factor in the srcu_get_delay() 541 + // called from process_srcu(). 542 + #define SRCU_DEFAULT_MAX_NODELAY_PHASE_ADJUSTED \ 543 + (2UL * USEC_PER_SEC / HZ / SRCU_DEFAULT_RETRY_CHECK_DELAY) 544 + 545 + // Maximum per-GP-phase consecutive no-delay instances. 546 + #define SRCU_DEFAULT_MAX_NODELAY_PHASE \ 547 + SRCU_UL_CLAMP(SRCU_DEFAULT_MAX_NODELAY_PHASE_ADJUSTED, \ 548 + SRCU_DEFAULT_MAX_NODELAY_PHASE_LO, \ 549 + SRCU_DEFAULT_MAX_NODELAY_PHASE_HI) 550 + 551 + static ulong srcu_max_nodelay_phase = SRCU_DEFAULT_MAX_NODELAY_PHASE; 552 + module_param(srcu_max_nodelay_phase, ulong, 0444); 553 + 554 + // Maximum consecutive no-delay instances. 555 + #define SRCU_DEFAULT_MAX_NODELAY (SRCU_DEFAULT_MAX_NODELAY_PHASE > 100 ? \ 556 + SRCU_DEFAULT_MAX_NODELAY_PHASE : 100) 557 + 558 + static ulong srcu_max_nodelay = SRCU_DEFAULT_MAX_NODELAY; 559 + module_param(srcu_max_nodelay, ulong, 0444); 518 560 519 561 /* 520 562 * Return grace-period delay, zero if there are expedited grace ··· 564 522 */ 565 523 static unsigned long srcu_get_delay(struct srcu_struct *ssp) 566 524 { 525 + unsigned long gpstart; 526 + unsigned long j; 567 527 unsigned long jbase = SRCU_INTERVAL; 568 528 569 529 if (ULONG_CMP_LT(READ_ONCE(ssp->srcu_gp_seq), READ_ONCE(ssp->srcu_gp_seq_needed_exp))) 570 530 jbase = 0; 571 - if (rcu_seq_state(READ_ONCE(ssp->srcu_gp_seq))) 572 - jbase += jiffies - READ_ONCE(ssp->srcu_gp_start); 573 - if (!jbase) { 574 - WRITE_ONCE(ssp->srcu_n_exp_nodelay, READ_ONCE(ssp->srcu_n_exp_nodelay) + 1); 575 - if (READ_ONCE(ssp->srcu_n_exp_nodelay) > SRCU_MAX_NODELAY_PHASE) 576 - jbase = 1; 531 + if (rcu_seq_state(READ_ONCE(ssp->srcu_gp_seq))) { 532 + j = jiffies - 1; 533 + gpstart = READ_ONCE(ssp->srcu_gp_start); 534 + if (time_after(j, gpstart)) 535 + jbase += j - gpstart; 536 + if (!jbase) { 537 + WRITE_ONCE(ssp->srcu_n_exp_nodelay, READ_ONCE(ssp->srcu_n_exp_nodelay) + 1); 538 + if (READ_ONCE(ssp->srcu_n_exp_nodelay) > srcu_max_nodelay_phase) 539 + jbase = 1; 540 + } 577 541 } 578 542 return jbase > SRCU_MAX_INTERVAL ? SRCU_MAX_INTERVAL : jbase; 579 543 } ··· 653 605 this_cpu_inc(ssp->sda->srcu_unlock_count[idx]); 654 606 } 655 607 EXPORT_SYMBOL_GPL(__srcu_read_unlock); 656 - 657 - /* 658 - * We use an adaptive strategy for synchronize_srcu() and especially for 659 - * synchronize_srcu_expedited(). We spin for a fixed time period 660 - * (defined below) to allow SRCU readers to exit their read-side critical 661 - * sections. If there are still some readers after a few microseconds, 662 - * we repeatedly block for 1-millisecond time periods. 663 - */ 664 - #define SRCU_RETRY_CHECK_DELAY 5 665 608 666 609 /* 667 610 * Start an SRCU grace period. ··· 739 700 */ 740 701 static void srcu_gp_end(struct srcu_struct *ssp) 741 702 { 742 - unsigned long cbdelay; 703 + unsigned long cbdelay = 1; 743 704 bool cbs; 744 705 bool last_lvl; 745 706 int cpu; ··· 759 720 spin_lock_irq_rcu_node(ssp); 760 721 idx = rcu_seq_state(ssp->srcu_gp_seq); 761 722 WARN_ON_ONCE(idx != SRCU_STATE_SCAN2); 762 - cbdelay = !!srcu_get_delay(ssp); 723 + if (ULONG_CMP_LT(READ_ONCE(ssp->srcu_gp_seq), READ_ONCE(ssp->srcu_gp_seq_needed_exp))) 724 + cbdelay = 0; 725 + 763 726 WRITE_ONCE(ssp->srcu_last_gp_end, ktime_get_mono_fast_ns()); 764 727 rcu_seq_end(&ssp->srcu_gp_seq); 765 728 gpseq = rcu_seq_current(&ssp->srcu_gp_seq); ··· 962 921 */ 963 922 static bool try_check_zero(struct srcu_struct *ssp, int idx, int trycount) 964 923 { 924 + unsigned long curdelay; 925 + 926 + curdelay = !srcu_get_delay(ssp); 927 + 965 928 for (;;) { 966 929 if (srcu_readers_active_idx_check(ssp, idx)) 967 930 return true; 968 - if (--trycount + !srcu_get_delay(ssp) <= 0) 931 + if ((--trycount + curdelay) <= 0) 969 932 return false; 970 - udelay(SRCU_RETRY_CHECK_DELAY); 933 + udelay(srcu_retry_check_delay); 971 934 } 972 935 } 973 936 ··· 1627 1582 j = jiffies; 1628 1583 if (READ_ONCE(ssp->reschedule_jiffies) == j) { 1629 1584 WRITE_ONCE(ssp->reschedule_count, READ_ONCE(ssp->reschedule_count) + 1); 1630 - if (READ_ONCE(ssp->reschedule_count) > SRCU_MAX_NODELAY) 1585 + if (READ_ONCE(ssp->reschedule_count) > srcu_max_nodelay) 1631 1586 curdelay = 1; 1632 1587 } else { 1633 1588 WRITE_ONCE(ssp->reschedule_count, 1); ··· 1719 1674 pr_info("Hierarchical SRCU implementation.\n"); 1720 1675 if (exp_holdoff != DEFAULT_SRCU_EXP_HOLDOFF) 1721 1676 pr_info("\tNon-default auto-expedite holdoff of %lu ns.\n", exp_holdoff); 1677 + if (srcu_retry_check_delay != SRCU_DEFAULT_RETRY_CHECK_DELAY) 1678 + pr_info("\tNon-default retry check delay of %lu us.\n", srcu_retry_check_delay); 1679 + if (srcu_max_nodelay != SRCU_DEFAULT_MAX_NODELAY) 1680 + pr_info("\tNon-default max no-delay of %lu.\n", srcu_max_nodelay); 1681 + pr_info("\tMax phase no-delay instances is %lu.\n", srcu_max_nodelay_phase); 1722 1682 return 0; 1723 1683 } 1724 1684 early_initcall(srcu_bootup_announce);
+4 -1
kernel/sched/deadline.c
··· 1701 1701 * the throttle. 1702 1702 */ 1703 1703 p->dl.dl_throttled = 0; 1704 - BUG_ON(!is_dl_boosted(&p->dl) || flags != ENQUEUE_REPLENISH); 1704 + if (!(flags & ENQUEUE_REPLENISH)) 1705 + printk_deferred_once("sched: DL de-boosted task PID %d: REPLENISH flag missing\n", 1706 + task_pid_nr(p)); 1707 + 1705 1708 return; 1706 1709 } 1707 1710
+36 -22
kernel/watch_queue.c
··· 454 454 rcu_assign_pointer(watch->queue, wqueue); 455 455 } 456 456 457 + static int add_one_watch(struct watch *watch, struct watch_list *wlist, struct watch_queue *wqueue) 458 + { 459 + const struct cred *cred; 460 + struct watch *w; 461 + 462 + hlist_for_each_entry(w, &wlist->watchers, list_node) { 463 + struct watch_queue *wq = rcu_access_pointer(w->queue); 464 + if (wqueue == wq && watch->id == w->id) 465 + return -EBUSY; 466 + } 467 + 468 + cred = current_cred(); 469 + if (atomic_inc_return(&cred->user->nr_watches) > task_rlimit(current, RLIMIT_NOFILE)) { 470 + atomic_dec(&cred->user->nr_watches); 471 + return -EAGAIN; 472 + } 473 + 474 + watch->cred = get_cred(cred); 475 + rcu_assign_pointer(watch->watch_list, wlist); 476 + 477 + kref_get(&wqueue->usage); 478 + kref_get(&watch->usage); 479 + hlist_add_head(&watch->queue_node, &wqueue->watches); 480 + hlist_add_head_rcu(&watch->list_node, &wlist->watchers); 481 + return 0; 482 + } 483 + 457 484 /** 458 485 * add_watch_to_object - Add a watch on an object to a watch list 459 486 * @watch: The watch to add ··· 495 468 */ 496 469 int add_watch_to_object(struct watch *watch, struct watch_list *wlist) 497 470 { 498 - struct watch_queue *wqueue = rcu_access_pointer(watch->queue); 499 - struct watch *w; 471 + struct watch_queue *wqueue; 472 + int ret = -ENOENT; 500 473 501 - hlist_for_each_entry(w, &wlist->watchers, list_node) { 502 - struct watch_queue *wq = rcu_access_pointer(w->queue); 503 - if (wqueue == wq && watch->id == w->id) 504 - return -EBUSY; 505 - } 474 + rcu_read_lock(); 506 475 507 - watch->cred = get_current_cred(); 508 - rcu_assign_pointer(watch->watch_list, wlist); 509 - 510 - if (atomic_inc_return(&watch->cred->user->nr_watches) > 511 - task_rlimit(current, RLIMIT_NOFILE)) { 512 - atomic_dec(&watch->cred->user->nr_watches); 513 - put_cred(watch->cred); 514 - return -EAGAIN; 515 - } 516 - 476 + wqueue = rcu_access_pointer(watch->queue); 517 477 if (lock_wqueue(wqueue)) { 518 - kref_get(&wqueue->usage); 519 - kref_get(&watch->usage); 520 - hlist_add_head(&watch->queue_node, &wqueue->watches); 478 + spin_lock(&wlist->lock); 479 + ret = add_one_watch(watch, wlist, wqueue); 480 + spin_unlock(&wlist->lock); 521 481 unlock_wqueue(wqueue); 522 482 } 523 483 524 - hlist_add_head(&watch->list_node, &wlist->watchers); 525 - return 0; 484 + rcu_read_unlock(); 485 + return ret; 526 486 } 527 487 EXPORT_SYMBOL(add_watch_to_object); 528 488
+4 -2
mm/gup.c
··· 87 87 * belongs to this folio. 88 88 */ 89 89 if (unlikely(page_folio(page) != folio)) { 90 - folio_put_refs(folio, refs); 90 + if (!put_devmap_managed_page_refs(&folio->page, refs)) 91 + folio_put_refs(folio, refs); 91 92 goto retry; 92 93 } 93 94 ··· 177 176 refs *= GUP_PIN_COUNTING_BIAS; 178 177 } 179 178 180 - folio_put_refs(folio, refs); 179 + if (!put_devmap_managed_page_refs(&folio->page, refs)) 180 + folio_put_refs(folio, refs); 181 181 } 182 182 183 183 /**
+8 -2
mm/hugetlb.c
··· 4788 4788 * sharing with another vma. 4789 4789 */ 4790 4790 ; 4791 - } else if (unlikely(is_hugetlb_entry_migration(entry) || 4792 - is_hugetlb_entry_hwpoisoned(entry))) { 4791 + } else if (unlikely(is_hugetlb_entry_hwpoisoned(entry))) { 4792 + bool uffd_wp = huge_pte_uffd_wp(entry); 4793 + 4794 + if (!userfaultfd_wp(dst_vma) && uffd_wp) 4795 + entry = huge_pte_clear_uffd_wp(entry); 4796 + set_huge_pte_at(dst, addr, dst_pte, entry); 4797 + } else if (unlikely(is_hugetlb_entry_migration(entry))) { 4793 4798 swp_entry_t swp_entry = pte_to_swp_entry(entry); 4794 4799 bool uffd_wp = huge_pte_uffd_wp(entry); 4795 4800 ··· 5952 5947 5953 5948 page = alloc_huge_page(dst_vma, dst_addr, 0); 5954 5949 if (IS_ERR(page)) { 5950 + put_page(*pagep); 5955 5951 ret = -ENOMEM; 5956 5952 *pagep = NULL; 5957 5953 goto out;
+9 -9
mm/kfence/core.c
··· 603 603 addr += 2 * PAGE_SIZE; 604 604 } 605 605 606 - /* 607 - * The pool is live and will never be deallocated from this point on. 608 - * Remove the pool object from the kmemleak object tree, as it would 609 - * otherwise overlap with allocations returned by kfence_alloc(), which 610 - * are registered with kmemleak through the slab post-alloc hook. 611 - */ 612 - kmemleak_free(__kfence_pool); 613 - 614 606 return 0; 615 607 } 616 608 ··· 615 623 616 624 addr = kfence_init_pool(); 617 625 618 - if (!addr) 626 + if (!addr) { 627 + /* 628 + * The pool is live and will never be deallocated from this point on. 629 + * Ignore the pool object from the kmemleak phys object tree, as it would 630 + * otherwise overlap with allocations returned by kfence_alloc(), which 631 + * are registered with kmemleak through the slab post-alloc hook. 632 + */ 633 + kmemleak_ignore_phys(__pa(__kfence_pool)); 619 634 return true; 635 + } 620 636 621 637 /* 622 638 * Only release unprotected pages, and do not try to go back and change
+6 -3
mm/memory.c
··· 3043 3043 pte_t entry; 3044 3044 3045 3045 VM_BUG_ON(!(vmf->flags & FAULT_FLAG_WRITE)); 3046 - VM_BUG_ON(PageAnon(page) && !PageAnonExclusive(page)); 3046 + VM_BUG_ON(page && PageAnon(page) && !PageAnonExclusive(page)); 3047 3047 3048 3048 /* 3049 3049 * Clear the pages cpupid information as the existing ··· 4369 4369 return VM_FAULT_OOM; 4370 4370 } 4371 4371 4372 - /* See comment in handle_pte_fault() */ 4372 + /* 4373 + * See comment in handle_pte_fault() for how this scenario happens, we 4374 + * need to return NOPAGE so that we drop this page. 4375 + */ 4373 4376 if (pmd_devmap_trans_unstable(vmf->pmd)) 4374 - return 0; 4377 + return VM_FAULT_NOPAGE; 4375 4378 4376 4379 vmf->pte = pte_offset_map_lock(vma->vm_mm, vmf->pmd, 4377 4380 vmf->address, &vmf->ptl);
+3 -3
mm/memremap.c
··· 499 499 } 500 500 501 501 #ifdef CONFIG_FS_DAX 502 - bool __put_devmap_managed_page(struct page *page) 502 + bool __put_devmap_managed_page_refs(struct page *page, int refs) 503 503 { 504 504 if (page->pgmap->type != MEMORY_DEVICE_FS_DAX) 505 505 return false; ··· 509 509 * refcount is 1, then the page is free and the refcount is 510 510 * stable because nobody holds a reference on the page. 511 511 */ 512 - if (page_ref_dec_return(page) == 1) 512 + if (page_ref_sub_return(page, refs) == 1) 513 513 wake_up_var(&page->_refcount); 514 514 return true; 515 515 } 516 - EXPORT_SYMBOL(__put_devmap_managed_page); 516 + EXPORT_SYMBOL(__put_devmap_managed_page_refs); 517 517 #endif /* CONFIG_FS_DAX */
+26 -7
mm/secretmem.c
··· 55 55 gfp_t gfp = vmf->gfp_mask; 56 56 unsigned long addr; 57 57 struct page *page; 58 + vm_fault_t ret; 58 59 int err; 59 60 60 61 if (((loff_t)vmf->pgoff << PAGE_SHIFT) >= i_size_read(inode)) 61 62 return vmf_error(-EINVAL); 62 63 64 + filemap_invalidate_lock_shared(mapping); 65 + 63 66 retry: 64 67 page = find_lock_page(mapping, offset); 65 68 if (!page) { 66 69 page = alloc_page(gfp | __GFP_ZERO); 67 - if (!page) 68 - return VM_FAULT_OOM; 70 + if (!page) { 71 + ret = VM_FAULT_OOM; 72 + goto out; 73 + } 69 74 70 75 err = set_direct_map_invalid_noflush(page); 71 76 if (err) { 72 77 put_page(page); 73 - return vmf_error(err); 78 + ret = vmf_error(err); 79 + goto out; 74 80 } 75 81 76 82 __SetPageUptodate(page); ··· 92 86 if (err == -EEXIST) 93 87 goto retry; 94 88 95 - return vmf_error(err); 89 + ret = vmf_error(err); 90 + goto out; 96 91 } 97 92 98 93 addr = (unsigned long)page_address(page); ··· 101 94 } 102 95 103 96 vmf->page = page; 104 - return VM_FAULT_LOCKED; 97 + ret = VM_FAULT_LOCKED; 98 + 99 + out: 100 + filemap_invalidate_unlock_shared(mapping); 101 + return ret; 105 102 } 106 103 107 104 static const struct vm_operations_struct secretmem_vm_ops = { ··· 173 162 struct dentry *dentry, struct iattr *iattr) 174 163 { 175 164 struct inode *inode = d_inode(dentry); 165 + struct address_space *mapping = inode->i_mapping; 176 166 unsigned int ia_valid = iattr->ia_valid; 167 + int ret; 168 + 169 + filemap_invalidate_lock(mapping); 177 170 178 171 if ((ia_valid & ATTR_SIZE) && inode->i_size) 179 - return -EINVAL; 172 + ret = -EINVAL; 173 + else 174 + ret = simple_setattr(mnt_userns, dentry, iattr); 180 175 181 - return simple_setattr(mnt_userns, dentry, iattr); 176 + filemap_invalidate_unlock(mapping); 177 + 178 + return ret; 182 179 } 183 180 184 181 static const struct inode_operations secretmem_iops = {
+2 -5
mm/shmem.c
··· 3392 3392 break; 3393 3393 case Opt_nr_blocks: 3394 3394 ctx->blocks = memparse(param->string, &rest); 3395 - if (*rest) 3395 + if (*rest || ctx->blocks > S64_MAX) 3396 3396 goto bad_value; 3397 3397 ctx->seen |= SHMEM_SEEN_BLOCKS; 3398 3398 break; ··· 3514 3514 3515 3515 raw_spin_lock(&sbinfo->stat_lock); 3516 3516 inodes = sbinfo->max_inodes - sbinfo->free_inodes; 3517 - if (ctx->blocks > S64_MAX) { 3518 - err = "Number of blocks too large"; 3519 - goto out; 3520 - } 3517 + 3521 3518 if ((ctx->seen & SHMEM_SEEN_BLOCKS) && ctx->blocks) { 3522 3519 if (!sbinfo->max_blocks) { 3523 3520 err = "Cannot retroactively limit size";
+3 -3
net/bluetooth/hci_sync.c
··· 5297 5297 return err; 5298 5298 } 5299 5299 5300 + /* Update event mask so only the allowed event can wakeup the host */ 5301 + hci_set_event_mask_sync(hdev); 5302 + 5300 5303 /* Only configure accept list if disconnect succeeded and wake 5301 5304 * isn't being prevented. 5302 5305 */ ··· 5310 5307 5311 5308 /* Unpause to take care of updating scanning params */ 5312 5309 hdev->scanning_paused = false; 5313 - 5314 - /* Update event mask so only the allowed event can wakeup the host */ 5315 - hci_set_event_mask_sync(hdev); 5316 5310 5317 5311 /* Enable event filter for paired devices */ 5318 5312 hci_update_event_filter_sync(hdev);
+48 -13
net/bluetooth/l2cap_core.c
··· 111 111 } 112 112 113 113 /* Find channel with given SCID. 114 - * Returns locked channel. */ 114 + * Returns a reference locked channel. 115 + */ 115 116 static struct l2cap_chan *l2cap_get_chan_by_scid(struct l2cap_conn *conn, 116 117 u16 cid) 117 118 { ··· 120 119 121 120 mutex_lock(&conn->chan_lock); 122 121 c = __l2cap_get_chan_by_scid(conn, cid); 123 - if (c) 124 - l2cap_chan_lock(c); 122 + if (c) { 123 + /* Only lock if chan reference is not 0 */ 124 + c = l2cap_chan_hold_unless_zero(c); 125 + if (c) 126 + l2cap_chan_lock(c); 127 + } 125 128 mutex_unlock(&conn->chan_lock); 126 129 127 130 return c; 128 131 } 129 132 130 133 /* Find channel with given DCID. 131 - * Returns locked channel. 134 + * Returns a reference locked channel. 132 135 */ 133 136 static struct l2cap_chan *l2cap_get_chan_by_dcid(struct l2cap_conn *conn, 134 137 u16 cid) ··· 141 136 142 137 mutex_lock(&conn->chan_lock); 143 138 c = __l2cap_get_chan_by_dcid(conn, cid); 144 - if (c) 145 - l2cap_chan_lock(c); 139 + if (c) { 140 + /* Only lock if chan reference is not 0 */ 141 + c = l2cap_chan_hold_unless_zero(c); 142 + if (c) 143 + l2cap_chan_lock(c); 144 + } 146 145 mutex_unlock(&conn->chan_lock); 147 146 148 147 return c; ··· 171 162 172 163 mutex_lock(&conn->chan_lock); 173 164 c = __l2cap_get_chan_by_ident(conn, ident); 174 - if (c) 175 - l2cap_chan_lock(c); 165 + if (c) { 166 + /* Only lock if chan reference is not 0 */ 167 + c = l2cap_chan_hold_unless_zero(c); 168 + if (c) 169 + l2cap_chan_lock(c); 170 + } 176 171 mutex_unlock(&conn->chan_lock); 177 172 178 173 return c; ··· 508 495 BT_DBG("chan %p orig refcnt %u", c, kref_read(&c->kref)); 509 496 510 497 kref_get(&c->kref); 498 + } 499 + 500 + struct l2cap_chan *l2cap_chan_hold_unless_zero(struct l2cap_chan *c) 501 + { 502 + BT_DBG("chan %p orig refcnt %u", c, kref_read(&c->kref)); 503 + 504 + if (!kref_get_unless_zero(&c->kref)) 505 + return NULL; 506 + 507 + return c; 511 508 } 512 509 513 510 void l2cap_chan_put(struct l2cap_chan *c) ··· 1992 1969 src_match = !bacmp(&c->src, src); 1993 1970 dst_match = !bacmp(&c->dst, dst); 1994 1971 if (src_match && dst_match) { 1995 - l2cap_chan_hold(c); 1972 + c = l2cap_chan_hold_unless_zero(c); 1973 + if (!c) 1974 + continue; 1975 + 1996 1976 read_unlock(&chan_list_lock); 1997 1977 return c; 1998 1978 } ··· 2010 1984 } 2011 1985 2012 1986 if (c1) 2013 - l2cap_chan_hold(c1); 1987 + c1 = l2cap_chan_hold_unless_zero(c1); 2014 1988 2015 1989 read_unlock(&chan_list_lock); 2016 1990 ··· 4490 4464 4491 4465 unlock: 4492 4466 l2cap_chan_unlock(chan); 4467 + l2cap_chan_put(chan); 4493 4468 return err; 4494 4469 } 4495 4470 ··· 4605 4578 4606 4579 done: 4607 4580 l2cap_chan_unlock(chan); 4581 + l2cap_chan_put(chan); 4608 4582 return err; 4609 4583 } 4610 4584 ··· 5333 5305 l2cap_send_move_chan_rsp(chan, result); 5334 5306 5335 5307 l2cap_chan_unlock(chan); 5308 + l2cap_chan_put(chan); 5336 5309 5337 5310 return 0; 5338 5311 } ··· 5426 5397 } 5427 5398 5428 5399 l2cap_chan_unlock(chan); 5400 + l2cap_chan_put(chan); 5429 5401 } 5430 5402 5431 5403 static void l2cap_move_fail(struct l2cap_conn *conn, u8 ident, u16 icid, ··· 5456 5426 l2cap_send_move_chan_cfm(chan, L2CAP_MC_UNCONFIRMED); 5457 5427 5458 5428 l2cap_chan_unlock(chan); 5429 + l2cap_chan_put(chan); 5459 5430 } 5460 5431 5461 5432 static int l2cap_move_channel_rsp(struct l2cap_conn *conn, ··· 5520 5489 l2cap_send_move_chan_cfm_rsp(conn, cmd->ident, icid); 5521 5490 5522 5491 l2cap_chan_unlock(chan); 5492 + l2cap_chan_put(chan); 5523 5493 5524 5494 return 0; 5525 5495 } ··· 5556 5524 } 5557 5525 5558 5526 l2cap_chan_unlock(chan); 5527 + l2cap_chan_put(chan); 5559 5528 5560 5529 return 0; 5561 5530 } ··· 5929 5896 if (credits > max_credits) { 5930 5897 BT_ERR("LE credits overflow"); 5931 5898 l2cap_send_disconn_req(chan, ECONNRESET); 5932 - l2cap_chan_unlock(chan); 5933 5899 5934 5900 /* Return 0 so that we don't trigger an unnecessary 5935 5901 * command reject packet. 5936 5902 */ 5937 - return 0; 5903 + goto unlock; 5938 5904 } 5939 5905 5940 5906 chan->tx_credits += credits; ··· 5944 5912 if (chan->tx_credits) 5945 5913 chan->ops->resume(chan); 5946 5914 5915 + unlock: 5947 5916 l2cap_chan_unlock(chan); 5917 + l2cap_chan_put(chan); 5948 5918 5949 5919 return 0; 5950 5920 } ··· 7632 7598 7633 7599 done: 7634 7600 l2cap_chan_unlock(chan); 7601 + l2cap_chan_put(chan); 7635 7602 } 7636 7603 7637 7604 static void l2cap_conless_channel(struct l2cap_conn *conn, __le16 psm, ··· 8121 8086 if (src_type != c->src_type) 8122 8087 continue; 8123 8088 8124 - l2cap_chan_hold(c); 8089 + c = l2cap_chan_hold_unless_zero(c); 8125 8090 read_unlock(&chan_list_lock); 8126 8091 return c; 8127 8092 }
-1
net/bluetooth/mgmt.c
··· 4844 4844 else 4845 4845 status = MGMT_STATUS_FAILED; 4846 4846 4847 - mgmt_pending_remove(cmd); 4848 4847 goto unlock; 4849 4848 } 4850 4849
+6 -2
net/bridge/br_netlink.c
··· 589 589 } 590 590 591 591 done: 592 + if (af) { 593 + if (nlmsg_get_pos(skb) - (void *)af > nla_attr_size(0)) 594 + nla_nest_end(skb, af); 595 + else 596 + nla_nest_cancel(skb, af); 597 + } 592 598 593 - if (af) 594 - nla_nest_end(skb, af); 595 599 nlmsg_end(skb, nlh); 596 600 return 0; 597 601
+7 -13
net/caif/caif_socket.c
··· 47 47 struct caifsock { 48 48 struct sock sk; /* must be first member */ 49 49 struct cflayer layer; 50 - u32 flow_state; 50 + unsigned long flow_state; 51 51 struct caif_connect_request conn_req; 52 52 struct mutex readlock; 53 53 struct dentry *debugfs_socket_dir; ··· 56 56 57 57 static int rx_flow_is_on(struct caifsock *cf_sk) 58 58 { 59 - return test_bit(RX_FLOW_ON_BIT, 60 - (void *) &cf_sk->flow_state); 59 + return test_bit(RX_FLOW_ON_BIT, &cf_sk->flow_state); 61 60 } 62 61 63 62 static int tx_flow_is_on(struct caifsock *cf_sk) 64 63 { 65 - return test_bit(TX_FLOW_ON_BIT, 66 - (void *) &cf_sk->flow_state); 64 + return test_bit(TX_FLOW_ON_BIT, &cf_sk->flow_state); 67 65 } 68 66 69 67 static void set_rx_flow_off(struct caifsock *cf_sk) 70 68 { 71 - clear_bit(RX_FLOW_ON_BIT, 72 - (void *) &cf_sk->flow_state); 69 + clear_bit(RX_FLOW_ON_BIT, &cf_sk->flow_state); 73 70 } 74 71 75 72 static void set_rx_flow_on(struct caifsock *cf_sk) 76 73 { 77 - set_bit(RX_FLOW_ON_BIT, 78 - (void *) &cf_sk->flow_state); 74 + set_bit(RX_FLOW_ON_BIT, &cf_sk->flow_state); 79 75 } 80 76 81 77 static void set_tx_flow_off(struct caifsock *cf_sk) 82 78 { 83 - clear_bit(TX_FLOW_ON_BIT, 84 - (void *) &cf_sk->flow_state); 79 + clear_bit(TX_FLOW_ON_BIT, &cf_sk->flow_state); 85 80 } 86 81 87 82 static void set_tx_flow_on(struct caifsock *cf_sk) 88 83 { 89 - set_bit(TX_FLOW_ON_BIT, 90 - (void *) &cf_sk->flow_state); 84 + set_bit(TX_FLOW_ON_BIT, &cf_sk->flow_state); 91 85 } 92 86 93 87 static void caif_read_lock(struct sock *sk)
+2 -2
net/decnet/af_decnet.c
··· 484 484 sk->sk_family = PF_DECnet; 485 485 sk->sk_protocol = 0; 486 486 sk->sk_allocation = gfp; 487 - sk->sk_sndbuf = sysctl_decnet_wmem[1]; 488 - sk->sk_rcvbuf = sysctl_decnet_rmem[1]; 487 + sk->sk_sndbuf = READ_ONCE(sysctl_decnet_wmem[1]); 488 + sk->sk_rcvbuf = READ_ONCE(sysctl_decnet_rmem[1]); 489 489 490 490 /* Initialization of DECnet Session Control Port */ 491 491 scp = DN_SK(sk);
+1
net/dsa/switch.c
··· 344 344 345 345 ether_addr_copy(a->addr, addr); 346 346 a->vid = vid; 347 + a->db = db; 347 348 refcount_set(&a->refcount, 1); 348 349 list_add_tail(&a->list, &lag->fdbs); 349 350
+5 -2
net/ipv4/fib_trie.c
··· 1042 1042 1043 1043 void fib_alias_hw_flags_set(struct net *net, const struct fib_rt_info *fri) 1044 1044 { 1045 + u8 fib_notify_on_flag_change; 1045 1046 struct fib_alias *fa_match; 1046 1047 struct sk_buff *skb; 1047 1048 int err; ··· 1064 1063 WRITE_ONCE(fa_match->offload, fri->offload); 1065 1064 WRITE_ONCE(fa_match->trap, fri->trap); 1066 1065 1066 + fib_notify_on_flag_change = READ_ONCE(net->ipv4.sysctl_fib_notify_on_flag_change); 1067 + 1067 1068 /* 2 means send notifications only if offload_failed was changed. */ 1068 - if (net->ipv4.sysctl_fib_notify_on_flag_change == 2 && 1069 + if (fib_notify_on_flag_change == 2 && 1069 1070 READ_ONCE(fa_match->offload_failed) == fri->offload_failed) 1070 1071 goto out; 1071 1072 1072 1073 WRITE_ONCE(fa_match->offload_failed, fri->offload_failed); 1073 1074 1074 - if (!net->ipv4.sysctl_fib_notify_on_flag_change) 1075 + if (!fib_notify_on_flag_change) 1075 1076 goto out; 1076 1077 1077 1078 skb = nlmsg_new(fib_nlmsg_size(fa_match->fa_info), GFP_ATOMIC);
+16 -7
net/ipv4/tcp.c
··· 454 454 455 455 icsk->icsk_sync_mss = tcp_sync_mss; 456 456 457 - WRITE_ONCE(sk->sk_sndbuf, sock_net(sk)->ipv4.sysctl_tcp_wmem[1]); 458 - WRITE_ONCE(sk->sk_rcvbuf, sock_net(sk)->ipv4.sysctl_tcp_rmem[1]); 457 + WRITE_ONCE(sk->sk_sndbuf, READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_wmem[1])); 458 + WRITE_ONCE(sk->sk_rcvbuf, READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[1])); 459 459 460 460 sk_sockets_allocated_inc(sk); 461 461 } ··· 688 688 int size_goal) 689 689 { 690 690 return skb->len < size_goal && 691 - sock_net(sk)->ipv4.sysctl_tcp_autocorking && 691 + READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_autocorking) && 692 692 !tcp_rtx_queue_empty(sk) && 693 693 refcount_read(&sk->sk_wmem_alloc) > skb->truesize && 694 694 tcp_skb_can_collapse_to(skb); ··· 1842 1842 if (sk->sk_userlocks & SOCK_RCVBUF_LOCK) 1843 1843 cap = sk->sk_rcvbuf >> 1; 1844 1844 else 1845 - cap = sock_net(sk)->ipv4.sysctl_tcp_rmem[2] >> 1; 1845 + cap = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[2]) >> 1; 1846 1846 val = min(val, cap); 1847 1847 WRITE_ONCE(sk->sk_rcvlowat, val ? : 1); 1848 1848 ··· 4573 4573 return SKB_DROP_REASON_TCP_MD5UNEXPECTED; 4574 4574 } 4575 4575 4576 - /* check the signature */ 4577 - genhash = tp->af_specific->calc_md5_hash(newhash, hash_expected, 4578 - NULL, skb); 4576 + /* Check the signature. 4577 + * To support dual stack listeners, we need to handle 4578 + * IPv4-mapped case. 4579 + */ 4580 + if (family == AF_INET) 4581 + genhash = tcp_v4_md5_hash_skb(newhash, 4582 + hash_expected, 4583 + NULL, skb); 4584 + else 4585 + genhash = tp->af_specific->calc_md5_hash(newhash, 4586 + hash_expected, 4587 + NULL, skb); 4579 4588 4580 4589 if (genhash || memcmp(hash_location, newhash, 16) != 0) { 4581 4590 NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMD5FAILURE);
+22 -19
net/ipv4/tcp_input.c
··· 426 426 427 427 if (sk->sk_sndbuf < sndmem) 428 428 WRITE_ONCE(sk->sk_sndbuf, 429 - min(sndmem, sock_net(sk)->ipv4.sysctl_tcp_wmem[2])); 429 + min(sndmem, READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_wmem[2]))); 430 430 } 431 431 432 432 /* 2. Tuning advertised window (window_clamp, rcv_ssthresh) ··· 461 461 struct tcp_sock *tp = tcp_sk(sk); 462 462 /* Optimize this! */ 463 463 int truesize = tcp_win_from_space(sk, skbtruesize) >> 1; 464 - int window = tcp_win_from_space(sk, sock_net(sk)->ipv4.sysctl_tcp_rmem[2]) >> 1; 464 + int window = tcp_win_from_space(sk, READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[2])) >> 1; 465 465 466 466 while (tp->rcv_ssthresh <= window) { 467 467 if (truesize <= skb->len) ··· 534 534 */ 535 535 static void tcp_init_buffer_space(struct sock *sk) 536 536 { 537 - int tcp_app_win = sock_net(sk)->ipv4.sysctl_tcp_app_win; 537 + int tcp_app_win = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_app_win); 538 538 struct tcp_sock *tp = tcp_sk(sk); 539 539 int maxwin; 540 540 ··· 574 574 struct tcp_sock *tp = tcp_sk(sk); 575 575 struct inet_connection_sock *icsk = inet_csk(sk); 576 576 struct net *net = sock_net(sk); 577 + int rmem2; 577 578 578 579 icsk->icsk_ack.quick = 0; 580 + rmem2 = READ_ONCE(net->ipv4.sysctl_tcp_rmem[2]); 579 581 580 - if (sk->sk_rcvbuf < net->ipv4.sysctl_tcp_rmem[2] && 582 + if (sk->sk_rcvbuf < rmem2 && 581 583 !(sk->sk_userlocks & SOCK_RCVBUF_LOCK) && 582 584 !tcp_under_memory_pressure(sk) && 583 585 sk_memory_allocated(sk) < sk_prot_mem_limits(sk, 0)) { 584 586 WRITE_ONCE(sk->sk_rcvbuf, 585 - min(atomic_read(&sk->sk_rmem_alloc), 586 - net->ipv4.sysctl_tcp_rmem[2])); 587 + min(atomic_read(&sk->sk_rmem_alloc), rmem2)); 587 588 } 588 589 if (atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf) 589 590 tp->rcv_ssthresh = min(tp->window_clamp, 2U * tp->advmss); ··· 725 724 * <prev RTT . ><current RTT .. ><next RTT .... > 726 725 */ 727 726 728 - if (sock_net(sk)->ipv4.sysctl_tcp_moderate_rcvbuf && 727 + if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_moderate_rcvbuf) && 729 728 !(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) { 730 729 int rcvmem, rcvbuf; 731 730 u64 rcvwin, grow; ··· 746 745 747 746 do_div(rcvwin, tp->advmss); 748 747 rcvbuf = min_t(u64, rcvwin * rcvmem, 749 - sock_net(sk)->ipv4.sysctl_tcp_rmem[2]); 748 + READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[2])); 750 749 if (rcvbuf > sk->sk_rcvbuf) { 751 750 WRITE_ONCE(sk->sk_rcvbuf, rcvbuf); 752 751 ··· 910 909 * end of slow start and should slow down. 911 910 */ 912 911 if (tcp_snd_cwnd(tp) < tp->snd_ssthresh / 2) 913 - rate *= sock_net(sk)->ipv4.sysctl_tcp_pacing_ss_ratio; 912 + rate *= READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_pacing_ss_ratio); 914 913 else 915 - rate *= sock_net(sk)->ipv4.sysctl_tcp_pacing_ca_ratio; 914 + rate *= READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_pacing_ca_ratio); 916 915 917 916 rate *= max(tcp_snd_cwnd(tp), tp->packets_out); 918 917 ··· 2175 2174 * loss recovery is underway except recurring timeout(s) on 2176 2175 * the same SND.UNA (sec 3.2). Disable F-RTO on path MTU probing 2177 2176 */ 2178 - tp->frto = net->ipv4.sysctl_tcp_frto && 2177 + tp->frto = READ_ONCE(net->ipv4.sysctl_tcp_frto) && 2179 2178 (new_recovery || icsk->icsk_retransmits) && 2180 2179 !inet_csk(sk)->icsk_mtup.probe_size; 2181 2180 } ··· 3058 3057 3059 3058 static void tcp_update_rtt_min(struct sock *sk, u32 rtt_us, const int flag) 3060 3059 { 3061 - u32 wlen = sock_net(sk)->ipv4.sysctl_tcp_min_rtt_wlen * HZ; 3060 + u32 wlen = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_min_rtt_wlen) * HZ; 3062 3061 struct tcp_sock *tp = tcp_sk(sk); 3063 3062 3064 3063 if ((flag & FLAG_ACK_MAYBE_DELAYED) && rtt_us > tcp_min_rtt(tp)) { ··· 3581 3580 if (*last_oow_ack_time) { 3582 3581 s32 elapsed = (s32)(tcp_jiffies32 - *last_oow_ack_time); 3583 3582 3584 - if (0 <= elapsed && elapsed < net->ipv4.sysctl_tcp_invalid_ratelimit) { 3583 + if (0 <= elapsed && 3584 + elapsed < READ_ONCE(net->ipv4.sysctl_tcp_invalid_ratelimit)) { 3585 3585 NET_INC_STATS(net, mib_idx); 3586 3586 return true; /* rate-limited: don't send yet! */ 3587 3587 } ··· 3630 3628 /* Then check host-wide RFC 5961 rate limit. */ 3631 3629 now = jiffies / HZ; 3632 3630 if (now != challenge_timestamp) { 3633 - u32 ack_limit = net->ipv4.sysctl_tcp_challenge_ack_limit; 3631 + u32 ack_limit = READ_ONCE(net->ipv4.sysctl_tcp_challenge_ack_limit); 3634 3632 u32 half = (ack_limit + 1) >> 1; 3635 3633 3636 3634 challenge_timestamp = now; ··· 4427 4425 { 4428 4426 struct tcp_sock *tp = tcp_sk(sk); 4429 4427 4430 - if (tcp_is_sack(tp) && sock_net(sk)->ipv4.sysctl_tcp_dsack) { 4428 + if (tcp_is_sack(tp) && READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_dsack)) { 4431 4429 int mib_idx; 4432 4430 4433 4431 if (before(seq, tp->rcv_nxt)) ··· 4474 4472 NET_INC_STATS(sock_net(sk), LINUX_MIB_DELAYEDACKLOST); 4475 4473 tcp_enter_quickack_mode(sk, TCP_MAX_QUICKACKS); 4476 4474 4477 - if (tcp_is_sack(tp) && sock_net(sk)->ipv4.sysctl_tcp_dsack) { 4475 + if (tcp_is_sack(tp) && READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_dsack)) { 4478 4476 u32 end_seq = TCP_SKB_CB(skb)->end_seq; 4479 4477 4480 4478 tcp_rcv_spurious_retrans(sk, skb); ··· 5518 5516 } 5519 5517 5520 5518 if (!tcp_is_sack(tp) || 5521 - tp->compressed_ack >= sock_net(sk)->ipv4.sysctl_tcp_comp_sack_nr) 5519 + tp->compressed_ack >= READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_comp_sack_nr)) 5522 5520 goto send_now; 5523 5521 5524 5522 if (tp->compressed_ack_rcv_nxt != tp->rcv_nxt) { ··· 5539 5537 if (tp->srtt_us && tp->srtt_us < rtt) 5540 5538 rtt = tp->srtt_us; 5541 5539 5542 - delay = min_t(unsigned long, sock_net(sk)->ipv4.sysctl_tcp_comp_sack_delay_ns, 5540 + delay = min_t(unsigned long, 5541 + READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_comp_sack_delay_ns), 5543 5542 rtt * (NSEC_PER_USEC >> 3)/20); 5544 5543 sock_hold(sk); 5545 5544 hrtimer_start_range_ns(&tp->compressed_ack_timer, ns_to_ktime(delay), 5546 - sock_net(sk)->ipv4.sysctl_tcp_comp_sack_slack_ns, 5545 + READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_comp_sack_slack_ns), 5547 5546 HRTIMER_MODE_REL_PINNED_SOFT); 5548 5547 } 5549 5548
+2 -2
net/ipv4/tcp_ipv4.c
··· 1008 1008 if (skb) { 1009 1009 __tcp_v4_send_check(skb, ireq->ir_loc_addr, ireq->ir_rmt_addr); 1010 1010 1011 - tos = sock_net(sk)->ipv4.sysctl_tcp_reflect_tos ? 1011 + tos = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_reflect_tos) ? 1012 1012 (tcp_rsk(req)->syn_tos & ~INET_ECN_MASK) | 1013 1013 (inet_sk(sk)->tos & INET_ECN_MASK) : 1014 1014 inet_sk(sk)->tos; ··· 1528 1528 /* Set ToS of the new socket based upon the value of incoming SYN. 1529 1529 * ECT bits are set later in tcp_init_transfer(). 1530 1530 */ 1531 - if (sock_net(sk)->ipv4.sysctl_tcp_reflect_tos) 1531 + if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_reflect_tos)) 1532 1532 newinet->tos = tcp_rsk(req)->syn_tos & ~INET_ECN_MASK; 1533 1533 1534 1534 if (!dst) {
+5 -5
net/ipv4/tcp_metrics.c
··· 329 329 int m; 330 330 331 331 sk_dst_confirm(sk); 332 - if (net->ipv4.sysctl_tcp_nometrics_save || !dst) 332 + if (READ_ONCE(net->ipv4.sysctl_tcp_nometrics_save) || !dst) 333 333 return; 334 334 335 335 rcu_read_lock(); ··· 385 385 386 386 if (tcp_in_initial_slowstart(tp)) { 387 387 /* Slow start still did not finish. */ 388 - if (!net->ipv4.sysctl_tcp_no_ssthresh_metrics_save && 388 + if (!READ_ONCE(net->ipv4.sysctl_tcp_no_ssthresh_metrics_save) && 389 389 !tcp_metric_locked(tm, TCP_METRIC_SSTHRESH)) { 390 390 val = tcp_metric_get(tm, TCP_METRIC_SSTHRESH); 391 391 if (val && (tcp_snd_cwnd(tp) >> 1) > val) ··· 401 401 } else if (!tcp_in_slow_start(tp) && 402 402 icsk->icsk_ca_state == TCP_CA_Open) { 403 403 /* Cong. avoidance phase, cwnd is reliable. */ 404 - if (!net->ipv4.sysctl_tcp_no_ssthresh_metrics_save && 404 + if (!READ_ONCE(net->ipv4.sysctl_tcp_no_ssthresh_metrics_save) && 405 405 !tcp_metric_locked(tm, TCP_METRIC_SSTHRESH)) 406 406 tcp_metric_set(tm, TCP_METRIC_SSTHRESH, 407 407 max(tcp_snd_cwnd(tp) >> 1, tp->snd_ssthresh)); ··· 418 418 tcp_metric_set(tm, TCP_METRIC_CWND, 419 419 (val + tp->snd_ssthresh) >> 1); 420 420 } 421 - if (!net->ipv4.sysctl_tcp_no_ssthresh_metrics_save && 421 + if (!READ_ONCE(net->ipv4.sysctl_tcp_no_ssthresh_metrics_save) && 422 422 !tcp_metric_locked(tm, TCP_METRIC_SSTHRESH)) { 423 423 val = tcp_metric_get(tm, TCP_METRIC_SSTHRESH); 424 424 if (val && tp->snd_ssthresh > val) ··· 463 463 if (tcp_metric_locked(tm, TCP_METRIC_CWND)) 464 464 tp->snd_cwnd_clamp = tcp_metric_get(tm, TCP_METRIC_CWND); 465 465 466 - val = net->ipv4.sysctl_tcp_no_ssthresh_metrics_save ? 466 + val = READ_ONCE(net->ipv4.sysctl_tcp_no_ssthresh_metrics_save) ? 467 467 0 : tcp_metric_get(tm, TCP_METRIC_SSTHRESH); 468 468 if (val) { 469 469 tp->snd_ssthresh = val;
+12 -15
net/ipv4/tcp_output.c
··· 167 167 if (tcp_packets_in_flight(tp) == 0) 168 168 tcp_ca_event(sk, CA_EVENT_TX_START); 169 169 170 - /* If this is the first data packet sent in response to the 171 - * previous received data, 172 - * and it is a reply for ato after last received packet, 173 - * increase pingpong count. 174 - */ 175 - if (before(tp->lsndtime, icsk->icsk_ack.lrcvtime) && 176 - (u32)(now - icsk->icsk_ack.lrcvtime) < icsk->icsk_ack.ato) 177 - inet_csk_inc_pingpong_cnt(sk); 178 - 179 170 tp->lsndtime = now; 171 + 172 + /* If it is a reply for ato after last received 173 + * packet, enter pingpong mode. 174 + */ 175 + if ((u32)(now - icsk->icsk_ack.lrcvtime) < icsk->icsk_ack.ato) 176 + inet_csk_enter_pingpong_mode(sk); 180 177 } 181 178 182 179 /* Account for an ACK we sent. */ ··· 227 230 * which we interpret as a sign the remote TCP is not 228 231 * misinterpreting the window field as a signed quantity. 229 232 */ 230 - if (sock_net(sk)->ipv4.sysctl_tcp_workaround_signed_windows) 233 + if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_workaround_signed_windows)) 231 234 (*rcv_wnd) = min(space, MAX_TCP_WINDOW); 232 235 else 233 236 (*rcv_wnd) = min_t(u32, space, U16_MAX); ··· 238 241 *rcv_wscale = 0; 239 242 if (wscale_ok) { 240 243 /* Set window scaling on max possible window */ 241 - space = max_t(u32, space, sock_net(sk)->ipv4.sysctl_tcp_rmem[2]); 244 + space = max_t(u32, space, READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[2])); 242 245 space = max_t(u32, space, sysctl_rmem_max); 243 246 space = min_t(u32, space, *window_clamp); 244 247 *rcv_wscale = clamp_t(int, ilog2(space) - 15, ··· 282 285 * scaled window. 283 286 */ 284 287 if (!tp->rx_opt.rcv_wscale && 285 - sock_net(sk)->ipv4.sysctl_tcp_workaround_signed_windows) 288 + READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_workaround_signed_windows)) 286 289 new_win = min(new_win, MAX_TCP_WINDOW); 287 290 else 288 291 new_win = min(new_win, (65535U << tp->rx_opt.rcv_wscale)); ··· 1973 1976 1974 1977 bytes = sk->sk_pacing_rate >> READ_ONCE(sk->sk_pacing_shift); 1975 1978 1976 - r = tcp_min_rtt(tcp_sk(sk)) >> sock_net(sk)->ipv4.sysctl_tcp_tso_rtt_log; 1979 + r = tcp_min_rtt(tcp_sk(sk)) >> READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_tso_rtt_log); 1977 1980 if (r < BITS_PER_TYPE(sk->sk_gso_max_size)) 1978 1981 bytes += sk->sk_gso_max_size >> r; 1979 1982 ··· 1992 1995 1993 1996 min_tso = ca_ops->min_tso_segs ? 1994 1997 ca_ops->min_tso_segs(sk) : 1995 - sock_net(sk)->ipv4.sysctl_tcp_min_tso_segs; 1998 + READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_min_tso_segs); 1996 1999 1997 2000 tso_segs = tcp_tso_autosize(sk, mss_now, min_tso); 1998 2001 return min_t(u32, tso_segs, sk->sk_gso_max_segs); ··· 2504 2507 sk->sk_pacing_rate >> READ_ONCE(sk->sk_pacing_shift)); 2505 2508 if (sk->sk_pacing_status == SK_PACING_NONE) 2506 2509 limit = min_t(unsigned long, limit, 2507 - sock_net(sk)->ipv4.sysctl_tcp_limit_output_bytes); 2510 + READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_limit_output_bytes)); 2508 2511 limit <<= factor; 2509 2512 2510 2513 if (static_branch_unlikely(&tcp_tx_delay_enabled) &&
+8 -6
net/ipv6/mcast.c
··· 1522 1522 1523 1523 if (++cnt >= MLD_MAX_QUEUE) { 1524 1524 rework = true; 1525 - schedule_delayed_work(&idev->mc_query_work, 0); 1526 1525 break; 1527 1526 } 1528 1527 } ··· 1532 1533 __mld_query_work(skb); 1533 1534 mutex_unlock(&idev->mc_lock); 1534 1535 1535 - if (!rework) 1536 - in6_dev_put(idev); 1536 + if (rework && queue_delayed_work(mld_wq, &idev->mc_query_work, 0)) 1537 + return; 1538 + 1539 + in6_dev_put(idev); 1537 1540 } 1538 1541 1539 1542 /* called with rcu_read_lock() */ ··· 1625 1624 1626 1625 if (++cnt >= MLD_MAX_QUEUE) { 1627 1626 rework = true; 1628 - schedule_delayed_work(&idev->mc_report_work, 0); 1629 1627 break; 1630 1628 } 1631 1629 } ··· 1635 1635 __mld_report_work(skb); 1636 1636 mutex_unlock(&idev->mc_lock); 1637 1637 1638 - if (!rework) 1639 - in6_dev_put(idev); 1638 + if (rework && queue_delayed_work(mld_wq, &idev->mc_report_work, 0)) 1639 + return; 1640 + 1641 + in6_dev_put(idev); 1640 1642 } 1641 1643 1642 1644 static bool is_in(struct ifmcaddr6 *pmc, struct ip6_sf_list *psf, int type,
+6
net/ipv6/ping.c
··· 22 22 #include <linux/proc_fs.h> 23 23 #include <net/ping.h> 24 24 25 + static void ping_v6_destroy(struct sock *sk) 26 + { 27 + inet6_destroy_sock(sk); 28 + } 29 + 25 30 /* Compatibility glue so we can support IPv6 when it's compiled as a module */ 26 31 static int dummy_ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len, 27 32 int *addr_len) ··· 190 185 .owner = THIS_MODULE, 191 186 .init = ping_init_sock, 192 187 .close = ping_close, 188 + .destroy = ping_v6_destroy, 193 189 .connect = ip6_datagram_connect_v6_only, 194 190 .disconnect = __udp_disconnect, 195 191 .setsockopt = ipv6_setsockopt,
+2 -2
net/ipv6/tcp_ipv6.c
··· 546 546 if (np->repflow && ireq->pktopts) 547 547 fl6->flowlabel = ip6_flowlabel(ipv6_hdr(ireq->pktopts)); 548 548 549 - tclass = sock_net(sk)->ipv4.sysctl_tcp_reflect_tos ? 549 + tclass = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_reflect_tos) ? 550 550 (tcp_rsk(req)->syn_tos & ~INET_ECN_MASK) | 551 551 (np->tclass & INET_ECN_MASK) : 552 552 np->tclass; ··· 1317 1317 /* Set ToS of the new socket based upon the value of incoming SYN. 1318 1318 * ECT bits are set later in tcp_init_transfer(). 1319 1319 */ 1320 - if (sock_net(sk)->ipv4.sysctl_tcp_reflect_tos) 1320 + if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_reflect_tos)) 1321 1321 newnp->tclass = tcp_rsk(req)->syn_tos & ~INET_ECN_MASK; 1322 1322 1323 1323 /* Clone native IPv6 options from listening socket (if any)
+1 -1
net/mptcp/options.c
··· 1271 1271 if (unlikely(th->syn)) 1272 1272 new_win = min(new_win, 65535U) << tp->rx_opt.rcv_wscale; 1273 1273 if (!tp->rx_opt.rcv_wscale && 1274 - sock_net(ssk)->ipv4.sysctl_tcp_workaround_signed_windows) 1274 + READ_ONCE(sock_net(ssk)->ipv4.sysctl_tcp_workaround_signed_windows)) 1275 1275 new_win = min(new_win, MAX_TCP_WINDOW); 1276 1276 else 1277 1277 new_win = min(new_win, (65535U << tp->rx_opt.rcv_wscale));
+4 -4
net/mptcp/protocol.c
··· 1873 1873 if (msk->rcvq_space.copied <= msk->rcvq_space.space) 1874 1874 goto new_measure; 1875 1875 1876 - if (sock_net(sk)->ipv4.sysctl_tcp_moderate_rcvbuf && 1876 + if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_moderate_rcvbuf) && 1877 1877 !(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) { 1878 1878 int rcvmem, rcvbuf; 1879 1879 u64 rcvwin, grow; ··· 1891 1891 1892 1892 do_div(rcvwin, advmss); 1893 1893 rcvbuf = min_t(u64, rcvwin * rcvmem, 1894 - sock_net(sk)->ipv4.sysctl_tcp_rmem[2]); 1894 + READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[2])); 1895 1895 1896 1896 if (rcvbuf > sk->sk_rcvbuf) { 1897 1897 u32 window_clamp; ··· 2634 2634 mptcp_ca_reset(sk); 2635 2635 2636 2636 sk_sockets_allocated_inc(sk); 2637 - sk->sk_rcvbuf = sock_net(sk)->ipv4.sysctl_tcp_rmem[1]; 2638 - sk->sk_sndbuf = sock_net(sk)->ipv4.sysctl_tcp_wmem[1]; 2637 + sk->sk_rcvbuf = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[1]); 2638 + sk->sk_sndbuf = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_wmem[1]); 2639 2639 2640 2640 return 0; 2641 2641 }
+1 -1
net/mptcp/subflow.c
··· 1533 1533 mptcp_sock_graft(ssk, sk->sk_socket); 1534 1534 iput(SOCK_INODE(sf)); 1535 1535 WRITE_ONCE(msk->allow_infinite_fallback, false); 1536 - return err; 1536 + return 0; 1537 1537 1538 1538 failed_unlink: 1539 1539 list_del(&subflow->node);
+6
net/netfilter/nf_tables_api.c
··· 3340 3340 if (err < 0) 3341 3341 return err; 3342 3342 } 3343 + 3344 + cond_resched(); 3343 3345 } 3344 3346 3345 3347 return 0; ··· 9369 9367 break; 9370 9368 } 9371 9369 } 9370 + 9371 + cond_resched(); 9372 9372 } 9373 9373 9374 9374 list_for_each_entry(set, &ctx->table->sets, list) { 9375 + cond_resched(); 9376 + 9375 9377 if (!nft_is_active_next(ctx->net, set)) 9376 9378 continue; 9377 9379 if (!(set->flags & NFT_SET_MAP) ||
+27
net/netfilter/nft_queue.c
··· 68 68 regs->verdict.code = ret; 69 69 } 70 70 71 + static int nft_queue_validate(const struct nft_ctx *ctx, 72 + const struct nft_expr *expr, 73 + const struct nft_data **data) 74 + { 75 + static const unsigned int supported_hooks = ((1 << NF_INET_PRE_ROUTING) | 76 + (1 << NF_INET_LOCAL_IN) | 77 + (1 << NF_INET_FORWARD) | 78 + (1 << NF_INET_LOCAL_OUT) | 79 + (1 << NF_INET_POST_ROUTING)); 80 + 81 + switch (ctx->family) { 82 + case NFPROTO_IPV4: 83 + case NFPROTO_IPV6: 84 + case NFPROTO_INET: 85 + case NFPROTO_BRIDGE: 86 + break; 87 + case NFPROTO_NETDEV: /* lacks okfn */ 88 + fallthrough; 89 + default: 90 + return -EOPNOTSUPP; 91 + } 92 + 93 + return nft_chain_validate_hooks(ctx->chain, supported_hooks); 94 + } 95 + 71 96 static const struct nla_policy nft_queue_policy[NFTA_QUEUE_MAX + 1] = { 72 97 [NFTA_QUEUE_NUM] = { .type = NLA_U16 }, 73 98 [NFTA_QUEUE_TOTAL] = { .type = NLA_U16 }, ··· 189 164 .eval = nft_queue_eval, 190 165 .init = nft_queue_init, 191 166 .dump = nft_queue_dump, 167 + .validate = nft_queue_validate, 192 168 .reduce = NFT_REDUCE_READONLY, 193 169 }; 194 170 ··· 199 173 .eval = nft_queue_sreg_eval, 200 174 .init = nft_queue_sreg_init, 201 175 .dump = nft_queue_sreg_dump, 176 + .validate = nft_queue_validate, 202 177 .reduce = NFT_REDUCE_READONLY, 203 178 }; 204 179
+2 -3
net/sctp/associola.c
··· 229 229 if (!sctp_ulpq_init(&asoc->ulpq, asoc)) 230 230 goto fail_init; 231 231 232 - if (sctp_stream_init(&asoc->stream, asoc->c.sinit_num_ostreams, 233 - 0, gfp)) 234 - goto fail_init; 232 + if (sctp_stream_init(&asoc->stream, asoc->c.sinit_num_ostreams, 0, gfp)) 233 + goto stream_free; 235 234 236 235 /* Initialize default path MTU. */ 237 236 asoc->pathmtu = sp->pathmtu;
+3 -16
net/sctp/stream.c
··· 137 137 138 138 ret = sctp_stream_alloc_out(stream, outcnt, gfp); 139 139 if (ret) 140 - goto out_err; 140 + return ret; 141 141 142 142 for (i = 0; i < stream->outcnt; i++) 143 143 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; ··· 145 145 handle_in: 146 146 sctp_stream_interleave_init(stream); 147 147 if (!incnt) 148 - goto out; 148 + return 0; 149 149 150 - ret = sctp_stream_alloc_in(stream, incnt, gfp); 151 - if (ret) 152 - goto in_err; 153 - 154 - goto out; 155 - 156 - in_err: 157 - sched->free(stream); 158 - genradix_free(&stream->in); 159 - out_err: 160 - genradix_free(&stream->out); 161 - stream->outcnt = 0; 162 - out: 163 - return ret; 150 + return sctp_stream_alloc_in(stream, incnt, gfp); 164 151 } 165 152 166 153 int sctp_stream_init_ext(struct sctp_stream *stream, __u16 sid)
+1 -1
net/sctp/stream_sched.c
··· 160 160 if (!SCTP_SO(&asoc->stream, i)->ext) 161 161 continue; 162 162 163 - ret = n->init_sid(&asoc->stream, i, GFP_KERNEL); 163 + ret = n->init_sid(&asoc->stream, i, GFP_ATOMIC); 164 164 if (ret) 165 165 goto err; 166 166 }
+1 -1
net/tipc/socket.c
··· 517 517 timer_setup(&sk->sk_timer, tipc_sk_timeout, 0); 518 518 sk->sk_shutdown = 0; 519 519 sk->sk_backlog_rcv = tipc_sk_backlog_rcv; 520 - sk->sk_rcvbuf = sysctl_tipc_rmem[1]; 520 + sk->sk_rcvbuf = READ_ONCE(sysctl_tipc_rmem[1]); 521 521 sk->sk_data_ready = tipc_data_ready; 522 522 sk->sk_write_space = tipc_write_space; 523 523 sk->sk_destruct = tipc_sock_destruct;
+6 -1
net/tls/tls_device.c
··· 1383 1383 * by tls_device_free_ctx. rx_conf and tx_conf stay in TLS_HW. 1384 1384 * Now release the ref taken above. 1385 1385 */ 1386 - if (refcount_dec_and_test(&ctx->refcount)) 1386 + if (refcount_dec_and_test(&ctx->refcount)) { 1387 + /* sk_destruct ran after tls_device_down took a ref, and 1388 + * it returned early. Complete the destruction here. 1389 + */ 1390 + list_del(&ctx->list); 1387 1391 tls_device_free_ctx(ctx); 1392 + } 1388 1393 } 1389 1394 1390 1395 up_write(&device_offload_lock);
+31 -129
sound/soc/rockchip/rockchip_i2s.c
··· 13 13 #include <linux/of_gpio.h> 14 14 #include <linux/of_device.h> 15 15 #include <linux/clk.h> 16 - #include <linux/pinctrl/consumer.h> 17 16 #include <linux/pm_runtime.h> 18 17 #include <linux/regmap.h> 19 18 #include <linux/spinlock.h> ··· 54 55 const struct rk_i2s_pins *pins; 55 56 unsigned int bclk_ratio; 56 57 spinlock_t lock; /* tx/rx lock */ 57 - struct pinctrl *pinctrl; 58 - struct pinctrl_state *bclk_on; 59 - struct pinctrl_state *bclk_off; 60 58 }; 61 - 62 - static int i2s_pinctrl_select_bclk_on(struct rk_i2s_dev *i2s) 63 - { 64 - int ret = 0; 65 - 66 - if (!IS_ERR(i2s->pinctrl) && !IS_ERR_OR_NULL(i2s->bclk_on)) 67 - ret = pinctrl_select_state(i2s->pinctrl, 68 - i2s->bclk_on); 69 - 70 - if (ret) 71 - dev_err(i2s->dev, "bclk enable failed %d\n", ret); 72 - 73 - return ret; 74 - } 75 - 76 - static int i2s_pinctrl_select_bclk_off(struct rk_i2s_dev *i2s) 77 - { 78 - 79 - int ret = 0; 80 - 81 - if (!IS_ERR(i2s->pinctrl) && !IS_ERR_OR_NULL(i2s->bclk_off)) 82 - ret = pinctrl_select_state(i2s->pinctrl, 83 - i2s->bclk_off); 84 - 85 - if (ret) 86 - dev_err(i2s->dev, "bclk disable failed %d\n", ret); 87 - 88 - return ret; 89 - } 90 59 91 60 static int i2s_runtime_suspend(struct device *dev) 92 61 { ··· 92 125 return snd_soc_dai_get_drvdata(dai); 93 126 } 94 127 95 - static int rockchip_snd_txctrl(struct rk_i2s_dev *i2s, int on) 128 + static void rockchip_snd_txctrl(struct rk_i2s_dev *i2s, int on) 96 129 { 97 130 unsigned int val = 0; 98 131 int retry = 10; 99 - int ret = 0; 100 132 101 133 spin_lock(&i2s->lock); 102 134 if (on) { 103 - ret = regmap_update_bits(i2s->regmap, I2S_DMACR, 104 - I2S_DMACR_TDE_ENABLE, I2S_DMACR_TDE_ENABLE); 105 - if (ret < 0) 106 - goto end; 135 + regmap_update_bits(i2s->regmap, I2S_DMACR, 136 + I2S_DMACR_TDE_ENABLE, I2S_DMACR_TDE_ENABLE); 107 137 108 - ret = regmap_update_bits(i2s->regmap, I2S_XFER, 109 - I2S_XFER_TXS_START | I2S_XFER_RXS_START, 110 - I2S_XFER_TXS_START | I2S_XFER_RXS_START); 111 - if (ret < 0) 112 - goto end; 138 + regmap_update_bits(i2s->regmap, I2S_XFER, 139 + I2S_XFER_TXS_START | I2S_XFER_RXS_START, 140 + I2S_XFER_TXS_START | I2S_XFER_RXS_START); 113 141 114 142 i2s->tx_start = true; 115 143 } else { 116 144 i2s->tx_start = false; 117 145 118 - ret = regmap_update_bits(i2s->regmap, I2S_DMACR, 119 - I2S_DMACR_TDE_ENABLE, I2S_DMACR_TDE_DISABLE); 120 - if (ret < 0) 121 - goto end; 146 + regmap_update_bits(i2s->regmap, I2S_DMACR, 147 + I2S_DMACR_TDE_ENABLE, I2S_DMACR_TDE_DISABLE); 122 148 123 149 if (!i2s->rx_start) { 124 - ret = regmap_update_bits(i2s->regmap, I2S_XFER, 125 - I2S_XFER_TXS_START | 126 - I2S_XFER_RXS_START, 127 - I2S_XFER_TXS_STOP | 128 - I2S_XFER_RXS_STOP); 129 - if (ret < 0) 130 - goto end; 150 + regmap_update_bits(i2s->regmap, I2S_XFER, 151 + I2S_XFER_TXS_START | 152 + I2S_XFER_RXS_START, 153 + I2S_XFER_TXS_STOP | 154 + I2S_XFER_RXS_STOP); 131 155 132 156 udelay(150); 133 - ret = regmap_update_bits(i2s->regmap, I2S_CLR, 134 - I2S_CLR_TXC | I2S_CLR_RXC, 135 - I2S_CLR_TXC | I2S_CLR_RXC); 136 - if (ret < 0) 137 - goto end; 157 + regmap_update_bits(i2s->regmap, I2S_CLR, 158 + I2S_CLR_TXC | I2S_CLR_RXC, 159 + I2S_CLR_TXC | I2S_CLR_RXC); 138 160 139 161 regmap_read(i2s->regmap, I2S_CLR, &val); 140 162 ··· 138 182 } 139 183 } 140 184 } 141 - end: 142 185 spin_unlock(&i2s->lock); 143 - if (ret < 0) 144 - dev_err(i2s->dev, "lrclk update failed\n"); 145 - 146 - return ret; 147 186 } 148 187 149 - static int rockchip_snd_rxctrl(struct rk_i2s_dev *i2s, int on) 188 + static void rockchip_snd_rxctrl(struct rk_i2s_dev *i2s, int on) 150 189 { 151 190 unsigned int val = 0; 152 191 int retry = 10; 153 - int ret = 0; 154 192 155 193 spin_lock(&i2s->lock); 156 194 if (on) { 157 - ret = regmap_update_bits(i2s->regmap, I2S_DMACR, 195 + regmap_update_bits(i2s->regmap, I2S_DMACR, 158 196 I2S_DMACR_RDE_ENABLE, I2S_DMACR_RDE_ENABLE); 159 - if (ret < 0) 160 - goto end; 161 197 162 - ret = regmap_update_bits(i2s->regmap, I2S_XFER, 198 + regmap_update_bits(i2s->regmap, I2S_XFER, 163 199 I2S_XFER_TXS_START | I2S_XFER_RXS_START, 164 200 I2S_XFER_TXS_START | I2S_XFER_RXS_START); 165 - if (ret < 0) 166 - goto end; 167 201 168 202 i2s->rx_start = true; 169 203 } else { 170 204 i2s->rx_start = false; 171 205 172 - ret = regmap_update_bits(i2s->regmap, I2S_DMACR, 206 + regmap_update_bits(i2s->regmap, I2S_DMACR, 173 207 I2S_DMACR_RDE_ENABLE, I2S_DMACR_RDE_DISABLE); 174 - if (ret < 0) 175 - goto end; 176 208 177 209 if (!i2s->tx_start) { 178 - ret = regmap_update_bits(i2s->regmap, I2S_XFER, 210 + regmap_update_bits(i2s->regmap, I2S_XFER, 179 211 I2S_XFER_TXS_START | 180 212 I2S_XFER_RXS_START, 181 213 I2S_XFER_TXS_STOP | 182 214 I2S_XFER_RXS_STOP); 183 - if (ret < 0) 184 - goto end; 215 + 185 216 udelay(150); 186 - ret = regmap_update_bits(i2s->regmap, I2S_CLR, 217 + regmap_update_bits(i2s->regmap, I2S_CLR, 187 218 I2S_CLR_TXC | I2S_CLR_RXC, 188 219 I2S_CLR_TXC | I2S_CLR_RXC); 189 - if (ret < 0) 190 - goto end; 220 + 191 221 regmap_read(i2s->regmap, I2S_CLR, &val); 222 + 192 223 /* Should wait for clear operation to finish */ 193 224 while (val) { 194 225 regmap_read(i2s->regmap, I2S_CLR, &val); ··· 187 244 } 188 245 } 189 246 } 190 - end: 191 247 spin_unlock(&i2s->lock); 192 - if (ret < 0) 193 - dev_err(i2s->dev, "lrclk update failed\n"); 194 - 195 - return ret; 196 248 } 197 249 198 250 static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai, ··· 425 487 case SNDRV_PCM_TRIGGER_RESUME: 426 488 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 427 489 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) 428 - ret = rockchip_snd_rxctrl(i2s, 1); 490 + rockchip_snd_rxctrl(i2s, 1); 429 491 else 430 - ret = rockchip_snd_txctrl(i2s, 1); 431 - /* Do not turn on bclk if lrclk open fails. */ 432 - if (ret < 0) 433 - return ret; 434 - i2s_pinctrl_select_bclk_on(i2s); 492 + rockchip_snd_txctrl(i2s, 1); 435 493 break; 436 494 case SNDRV_PCM_TRIGGER_SUSPEND: 437 495 case SNDRV_PCM_TRIGGER_STOP: 438 496 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 439 - if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { 440 - if (!i2s->tx_start) 441 - i2s_pinctrl_select_bclk_off(i2s); 442 - ret = rockchip_snd_rxctrl(i2s, 0); 443 - } else { 444 - if (!i2s->rx_start) 445 - i2s_pinctrl_select_bclk_off(i2s); 446 - ret = rockchip_snd_txctrl(i2s, 0); 447 - } 497 + if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) 498 + rockchip_snd_rxctrl(i2s, 0); 499 + else 500 + rockchip_snd_txctrl(i2s, 0); 448 501 break; 449 502 default: 450 503 ret = -EINVAL; ··· 736 807 } 737 808 738 809 i2s->bclk_ratio = 64; 739 - i2s->pinctrl = devm_pinctrl_get(&pdev->dev); 740 - if (IS_ERR(i2s->pinctrl)) 741 - dev_err(&pdev->dev, "failed to find i2s pinctrl\n"); 742 - 743 - i2s->bclk_on = pinctrl_lookup_state(i2s->pinctrl, 744 - "bclk_on"); 745 - if (IS_ERR_OR_NULL(i2s->bclk_on)) 746 - dev_err(&pdev->dev, "failed to find i2s default state\n"); 747 - else 748 - dev_dbg(&pdev->dev, "find i2s bclk state\n"); 749 - 750 - i2s->bclk_off = pinctrl_lookup_state(i2s->pinctrl, 751 - "bclk_off"); 752 - if (IS_ERR_OR_NULL(i2s->bclk_off)) 753 - dev_err(&pdev->dev, "failed to find i2s gpio state\n"); 754 - else 755 - dev_dbg(&pdev->dev, "find i2s bclk_off state\n"); 756 - 757 - i2s_pinctrl_select_bclk_off(i2s); 758 - 759 - i2s->playback_dma_data.addr = res->start + I2S_TXDR; 760 - i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; 761 - i2s->playback_dma_data.maxburst = 4; 762 - 763 - i2s->capture_dma_data.addr = res->start + I2S_RXDR; 764 - i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; 765 - i2s->capture_dma_data.maxburst = 4; 766 810 767 811 dev_set_drvdata(&pdev->dev, i2s); 768 812
+10 -1
tools/include/uapi/asm-generic/fcntl.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 1 2 #ifndef _ASM_GENERIC_FCNTL_H 2 3 #define _ASM_GENERIC_FCNTL_H 3 4 ··· 91 90 92 91 /* a horrid kludge trying to make sure that this will fail on old kernels */ 93 92 #define O_TMPFILE (__O_TMPFILE | O_DIRECTORY) 94 - #define O_TMPFILE_MASK (__O_TMPFILE | O_DIRECTORY | O_CREAT) 93 + #define O_TMPFILE_MASK (__O_TMPFILE | O_DIRECTORY | O_CREAT) 95 94 96 95 #ifndef O_NDELAY 97 96 #define O_NDELAY O_NONBLOCK ··· 116 115 #define F_GETSIG 11 /* for sockets. */ 117 116 #endif 118 117 118 + #if __BITS_PER_LONG == 32 || defined(__KERNEL__) 119 119 #ifndef F_GETLK64 120 120 #define F_GETLK64 12 /* using 'struct flock64' */ 121 121 #define F_SETLK64 13 122 122 #define F_SETLKW64 14 123 123 #endif 124 + #endif /* __BITS_PER_LONG == 32 || defined(__KERNEL__) */ 124 125 125 126 #ifndef F_SETOWN_EX 126 127 #define F_SETOWN_EX 15 ··· 181 178 blocking */ 182 179 #define LOCK_UN 8 /* remove lock */ 183 180 181 + /* 182 + * LOCK_MAND support has been removed from the kernel. We leave the symbols 183 + * here to not break legacy builds, but these should not be used in new code. 184 + */ 184 185 #define LOCK_MAND 32 /* This is a mandatory flock ... */ 185 186 #define LOCK_READ 64 /* which allows concurrent read operations */ 186 187 #define LOCK_WRITE 128 /* which allows concurrent write operations */ ··· 192 185 193 186 #define F_LINUX_SPECIFIC_BASE 1024 194 187 188 + #ifndef HAVE_ARCH_STRUCT_FLOCK 195 189 struct flock { 196 190 short l_type; 197 191 short l_whence; ··· 217 209 __ARCH_FLOCK64_PAD 218 210 #endif 219 211 }; 212 + #endif /* HAVE_ARCH_STRUCT_FLOCK */ 220 213 221 214 #endif /* _ASM_GENERIC_FCNTL_H */
+1 -1
tools/include/uapi/linux/kvm.h
··· 2084 2084 #define KVM_STATS_UNIT_SECONDS (0x2 << KVM_STATS_UNIT_SHIFT) 2085 2085 #define KVM_STATS_UNIT_CYCLES (0x3 << KVM_STATS_UNIT_SHIFT) 2086 2086 #define KVM_STATS_UNIT_BOOLEAN (0x4 << KVM_STATS_UNIT_SHIFT) 2087 - #define KVM_STATS_UNIT_MAX KVM_STATS_UNIT_CYCLES 2087 + #define KVM_STATS_UNIT_MAX KVM_STATS_UNIT_BOOLEAN 2088 2088 2089 2089 #define KVM_STATS_BASE_SHIFT 8 2090 2090 #define KVM_STATS_BASE_MASK (0xF << KVM_STATS_BASE_SHIFT)
+1 -1
tools/testing/selftests/gpio/Makefile
··· 3 3 TEST_PROGS := gpio-mockup.sh gpio-sim.sh 4 4 TEST_FILES := gpio-mockup-sysfs.sh 5 5 TEST_GEN_PROGS_EXTENDED := gpio-mockup-cdev gpio-chip-info gpio-line-name 6 - CFLAGS += -O2 -g -Wall -I../../../../usr/include/ 6 + CFLAGS += -O2 -g -Wall -I../../../../usr/include/ $(KHDR_INCLUDES) 7 7 8 8 include ../lib.mk
+5 -3
tools/testing/selftests/kvm/rseq_test.c
··· 82 82 return cpu; 83 83 } 84 84 85 - static void *migration_worker(void *ign) 85 + static void *migration_worker(void *__rseq_tid) 86 86 { 87 + pid_t rseq_tid = (pid_t)(unsigned long)__rseq_tid; 87 88 cpu_set_t allowed_mask; 88 89 int r, i, cpu; 89 90 ··· 107 106 * stable, i.e. while changing affinity is in-progress. 108 107 */ 109 108 smp_wmb(); 110 - r = sched_setaffinity(0, sizeof(allowed_mask), &allowed_mask); 109 + r = sched_setaffinity(rseq_tid, sizeof(allowed_mask), &allowed_mask); 111 110 TEST_ASSERT(!r, "sched_setaffinity failed, errno = %d (%s)", 112 111 errno, strerror(errno)); 113 112 smp_wmb(); ··· 232 231 vm = vm_create_default(VCPU_ID, 0, guest_code); 233 232 ucall_init(vm, NULL); 234 233 235 - pthread_create(&migration_thread, NULL, migration_worker, 0); 234 + pthread_create(&migration_thread, NULL, migration_worker, 235 + (void *)(unsigned long)gettid()); 236 236 237 237 for (i = 0; !done; i++) { 238 238 vcpu_run(vm, VCPU_ID);