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

Merge remote-tracking branch 'torvalds/master' into perf/core

To pick up the fixes that went upstream via acme/perf/urgent and to get
to v5.19.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+1175 -1002
+4
.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>
+2
Documentation/admin-guide/kernel-parameters.txt
··· 3176 3176 no_entry_flush [PPC] 3177 3177 no_uaccess_flush [PPC] 3178 3178 mmio_stale_data=off [X86] 3179 + retbleed=off [X86] 3179 3180 3180 3181 Exceptions: 3181 3182 This does not have any effect on ··· 3199 3198 mds=full,nosmt [X86] 3200 3199 tsx_async_abort=full,nosmt [X86] 3201 3200 mmio_stale_data=full,nosmt [X86] 3201 + retbleed=auto,nosmt [X86] 3202 3202 3203 3203 mminit_loglevel= 3204 3204 [KNL] When CONFIG_DEBUG_MEMORY_INIT is set, this
+50 -55
Documentation/devicetree/bindings/net/ethernet-controller.yaml
··· 167 167 - in-band-status 168 168 169 169 fixed-link: 170 - allOf: 171 - - if: 172 - type: array 173 - then: 174 - deprecated: true 175 - items: 176 - - minimum: 0 177 - maximum: 31 178 - description: 179 - Emulated PHY ID, choose any but unique to the all 180 - specified fixed-links 170 + oneOf: 171 + - $ref: /schemas/types.yaml#/definitions/uint32-array 172 + deprecated: true 173 + items: 174 + - minimum: 0 175 + maximum: 31 176 + description: 177 + Emulated PHY ID, choose any but unique to the all 178 + specified fixed-links 181 179 182 - - enum: [0, 1] 183 - description: 184 - Duplex configuration. 0 for half duplex or 1 for 185 - full duplex 180 + - enum: [0, 1] 181 + description: 182 + Duplex configuration. 0 for half duplex or 1 for 183 + full duplex 186 184 187 - - enum: [10, 100, 1000, 2500, 10000] 188 - description: 189 - Link speed in Mbits/sec. 185 + - enum: [10, 100, 1000, 2500, 10000] 186 + description: 187 + Link speed in Mbits/sec. 190 188 191 - - enum: [0, 1] 192 - description: 193 - Pause configuration. 0 for no pause, 1 for pause 189 + - enum: [0, 1] 190 + description: 191 + Pause configuration. 0 for no pause, 1 for pause 194 192 195 - - enum: [0, 1] 196 - description: 197 - Asymmetric pause configuration. 0 for no asymmetric 198 - pause, 1 for asymmetric pause 193 + - enum: [0, 1] 194 + description: 195 + Asymmetric pause configuration. 0 for no asymmetric 196 + pause, 1 for asymmetric pause 197 + - type: object 198 + additionalProperties: false 199 + properties: 200 + speed: 201 + description: 202 + Link speed. 203 + $ref: /schemas/types.yaml#/definitions/uint32 204 + enum: [10, 100, 1000, 2500, 10000] 199 205 206 + full-duplex: 207 + $ref: /schemas/types.yaml#/definitions/flag 208 + description: 209 + Indicates that full-duplex is used. When absent, half 210 + duplex is assumed. 200 211 201 - - if: 202 - type: object 203 - then: 204 - properties: 205 - speed: 206 - description: 207 - Link speed. 208 - $ref: /schemas/types.yaml#/definitions/uint32 209 - enum: [10, 100, 1000, 2500, 10000] 212 + pause: 213 + $ref: /schemas/types.yaml#definitions/flag 214 + description: 215 + Indicates that pause should be enabled. 210 216 211 - full-duplex: 212 - $ref: /schemas/types.yaml#/definitions/flag 213 - description: 214 - Indicates that full-duplex is used. When absent, half 215 - duplex is assumed. 217 + asym-pause: 218 + $ref: /schemas/types.yaml#/definitions/flag 219 + description: 220 + Indicates that asym_pause should be enabled. 216 221 217 - pause: 218 - $ref: /schemas/types.yaml#definitions/flag 219 - description: 220 - Indicates that pause should be enabled. 222 + link-gpios: 223 + maxItems: 1 224 + description: 225 + GPIO to determine if the link is up 221 226 222 - asym-pause: 223 - $ref: /schemas/types.yaml#/definitions/flag 224 - description: 225 - Indicates that asym_pause should be enabled. 226 - 227 - link-gpios: 228 - maxItems: 1 229 - description: 230 - GPIO to determine if the link is up 231 - 232 - required: 233 - - speed 227 + required: 228 + - speed 234 229 235 230 additionalProperties: true 236 231
+3
Documentation/devicetree/bindings/net/fsl,fec.yaml
··· 183 183 Should specify the gpio for phy reset. 184 184 185 185 phy-reset-duration: 186 + $ref: /schemas/types.yaml#/definitions/uint32 186 187 deprecated: true 187 188 description: 188 189 Reset duration in milliseconds. Should present only if property ··· 192 191 and 1 millisecond will be used instead. 193 192 194 193 phy-reset-active-high: 194 + type: boolean 195 195 deprecated: true 196 196 description: 197 197 If present then the reset sequence using the GPIO specified in the 198 198 "phy-reset-gpios" property is reversed (H=reset state, L=operation state). 199 199 200 200 phy-reset-post-delay: 201 + $ref: /schemas/types.yaml#/definitions/uint32 201 202 deprecated: true 202 203 description: 203 204 Post reset delay in milliseconds. If present then a delay of phy-reset-post-delay
+8 -1
Documentation/networking/ip-sysctl.rst
··· 2866 2866 Default: 4K 2867 2867 2868 2868 sctp_wmem - vector of 3 INTEGERs: min, default, max 2869 - Currently this tunable has no effect. 2869 + Only the first value ("min") is used, "default" and "max" are 2870 + ignored. 2871 + 2872 + min: Minimum size of send buffer that can be used by SCTP sockets. 2873 + It is guaranteed to each SCTP socket (but not association) even 2874 + under moderate memory pressure. 2875 + 2876 + Default: 4K 2870 2877 2871 2878 addr_scope_policy - INTEGER 2872 2879 Control IPv4 address scoping - draft-stewart-tsvwg-sctp-ipv4-00
+1 -1
Makefile
··· 2 2 VERSION = 5 3 3 PATCHLEVEL = 19 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc8 5 + EXTRAVERSION = 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/include/asm/dma.h
··· 10 10 #else 11 11 #define MAX_DMA_ADDRESS ({ \ 12 12 extern phys_addr_t arm_dma_zone_size; \ 13 - arm_dma_zone_size && arm_dma_zone_size < (0x10000000 - PAGE_OFFSET) ? \ 13 + arm_dma_zone_size && arm_dma_zone_size < (0x100000000ULL - PAGE_OFFSET) ? \ 14 14 (PAGE_OFFSET + arm_dma_zone_size) : 0xffffffffUL; }) 15 15 #endif 16 16
+8 -8
arch/arm/lib/findbit.S
··· 40 40 * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) 41 41 */ 42 42 ENTRY(_find_next_zero_bit_le) 43 - teq r1, #0 44 - beq 3b 43 + cmp r2, r1 44 + bhs 3b 45 45 ands ip, r2, #7 46 46 beq 1b @ If new byte, goto old routine 47 47 ARM( ldrb r3, [r0, r2, lsr #3] ) ··· 81 81 * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset) 82 82 */ 83 83 ENTRY(_find_next_bit_le) 84 - teq r1, #0 85 - beq 3b 84 + cmp r2, r1 85 + bhs 3b 86 86 ands ip, r2, #7 87 87 beq 1b @ If new byte, goto old routine 88 88 ARM( ldrb r3, [r0, r2, lsr #3] ) ··· 115 115 ENDPROC(_find_first_zero_bit_be) 116 116 117 117 ENTRY(_find_next_zero_bit_be) 118 - teq r1, #0 119 - beq 3b 118 + cmp r2, r1 119 + bhs 3b 120 120 ands ip, r2, #7 121 121 beq 1b @ If new byte, goto old routine 122 122 eor r3, r2, #0x18 @ big endian byte ordering ··· 149 149 ENDPROC(_find_first_bit_be) 150 150 151 151 ENTRY(_find_next_bit_be) 152 - teq r1, #0 153 - beq 3b 152 + cmp r2, r1 153 + bhs 3b 154 154 ands ip, r2, #7 155 155 beq 1b @ If new byte, goto old routine 156 156 eor r3, r2, #0x18 @ big endian byte ordering
+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/loongarch/Kconfig
··· 69 69 select GENERIC_TIME_VSYSCALL 70 70 select GPIOLIB 71 71 select HAVE_ARCH_AUDITSYSCALL 72 - select HAVE_ARCH_COMPILER_H 73 72 select HAVE_ARCH_MMAP_RND_BITS if MMU 74 73 select HAVE_ARCH_SECCOMP_FILTER 75 74 select HAVE_ARCH_TRACEHOOK
-12
arch/loongarch/include/asm/asmmacro.h
··· 274 274 nor \dst, \src, zero 275 275 .endm 276 276 277 - .macro bgt r0 r1 label 278 - blt \r1, \r0, \label 279 - .endm 280 - 281 - .macro bltz r0 label 282 - blt \r0, zero, \label 283 - .endm 284 - 285 - .macro bgez r0 label 286 - bge \r0, zero, \label 287 - .endm 288 - 289 277 #endif /* _ASM_ASMMACRO_H */
+16 -21
arch/loongarch/include/asm/atomic.h
··· 10 10 #include <linux/types.h> 11 11 #include <asm/barrier.h> 12 12 #include <asm/cmpxchg.h> 13 - #include <asm/compiler.h> 14 13 15 14 #if __SIZEOF_LONG__ == 4 16 15 #define __LL "ll.w " ··· 156 157 __asm__ __volatile__( 157 158 "1: ll.w %1, %2 # atomic_sub_if_positive\n" 158 159 " addi.w %0, %1, %3 \n" 159 - " or %1, %0, $zero \n" 160 - " blt %0, $zero, 2f \n" 160 + " move %1, %0 \n" 161 + " bltz %0, 2f \n" 161 162 " sc.w %1, %2 \n" 162 - " beq $zero, %1, 1b \n" 163 + " beqz %1, 1b \n" 163 164 "2: \n" 164 165 __WEAK_LLSC_MB 165 - : "=&r" (result), "=&r" (temp), 166 - "+" GCC_OFF_SMALL_ASM() (v->counter) 166 + : "=&r" (result), "=&r" (temp), "+ZC" (v->counter) 167 167 : "I" (-i)); 168 168 } else { 169 169 __asm__ __volatile__( 170 170 "1: ll.w %1, %2 # atomic_sub_if_positive\n" 171 171 " sub.w %0, %1, %3 \n" 172 - " or %1, %0, $zero \n" 173 - " blt %0, $zero, 2f \n" 172 + " move %1, %0 \n" 173 + " bltz %0, 2f \n" 174 174 " sc.w %1, %2 \n" 175 - " beq $zero, %1, 1b \n" 175 + " beqz %1, 1b \n" 176 176 "2: \n" 177 177 __WEAK_LLSC_MB 178 - : "=&r" (result), "=&r" (temp), 179 - "+" GCC_OFF_SMALL_ASM() (v->counter) 178 + : "=&r" (result), "=&r" (temp), "+ZC" (v->counter) 180 179 : "r" (i)); 181 180 } 182 181 ··· 317 320 __asm__ __volatile__( 318 321 "1: ll.d %1, %2 # atomic64_sub_if_positive \n" 319 322 " addi.d %0, %1, %3 \n" 320 - " or %1, %0, $zero \n" 321 - " blt %0, $zero, 2f \n" 323 + " move %1, %0 \n" 324 + " bltz %0, 2f \n" 322 325 " sc.d %1, %2 \n" 323 - " beq %1, $zero, 1b \n" 326 + " beqz %1, 1b \n" 324 327 "2: \n" 325 328 __WEAK_LLSC_MB 326 - : "=&r" (result), "=&r" (temp), 327 - "+" GCC_OFF_SMALL_ASM() (v->counter) 329 + : "=&r" (result), "=&r" (temp), "+ZC" (v->counter) 328 330 : "I" (-i)); 329 331 } else { 330 332 __asm__ __volatile__( 331 333 "1: ll.d %1, %2 # atomic64_sub_if_positive \n" 332 334 " sub.d %0, %1, %3 \n" 333 - " or %1, %0, $zero \n" 334 - " blt %0, $zero, 2f \n" 335 + " move %1, %0 \n" 336 + " bltz %0, 2f \n" 335 337 " sc.d %1, %2 \n" 336 - " beq %1, $zero, 1b \n" 338 + " beqz %1, 1b \n" 337 339 "2: \n" 338 340 __WEAK_LLSC_MB 339 - : "=&r" (result), "=&r" (temp), 340 - "+" GCC_OFF_SMALL_ASM() (v->counter) 341 + : "=&r" (result), "=&r" (temp), "+ZC" (v->counter) 341 342 : "r" (i)); 342 343 } 343 344
+2 -2
arch/loongarch/include/asm/barrier.h
··· 48 48 __asm__ __volatile__( 49 49 "sltu %0, %1, %2\n\t" 50 50 #if (__SIZEOF_LONG__ == 4) 51 - "sub.w %0, $r0, %0\n\t" 51 + "sub.w %0, $zero, %0\n\t" 52 52 #elif (__SIZEOF_LONG__ == 8) 53 - "sub.d %0, $r0, %0\n\t" 53 + "sub.d %0, $zero, %0\n\t" 54 54 #endif 55 55 : "=r" (mask) 56 56 : "r" (index), "r" (size)
+2 -2
arch/loongarch/include/asm/cmpxchg.h
··· 55 55 __asm__ __volatile__( \ 56 56 "1: " ld " %0, %2 # __cmpxchg_asm \n" \ 57 57 " bne %0, %z3, 2f \n" \ 58 - " or $t0, %z4, $zero \n" \ 58 + " move $t0, %z4 \n" \ 59 59 " " st " $t0, %1 \n" \ 60 - " beq $zero, $t0, 1b \n" \ 60 + " beqz $t0, 1b \n" \ 61 61 "2: \n" \ 62 62 __WEAK_LLSC_MB \ 63 63 : "=&r" (__ret), "=ZB"(*m) \
-15
arch/loongarch/include/asm/compiler.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * Copyright (C) 2020-2022 Loongson Technology Corporation Limited 4 - */ 5 - #ifndef _ASM_COMPILER_H 6 - #define _ASM_COMPILER_H 7 - 8 - #define GCC_OFF_SMALL_ASM() "ZC" 9 - 10 - #define LOONGARCH_ISA_LEVEL "loongarch" 11 - #define LOONGARCH_ISA_ARCH_LEVEL "arch=loongarch" 12 - #define LOONGARCH_ISA_LEVEL_RAW loongarch 13 - #define LOONGARCH_ISA_ARCH_LEVEL_RAW LOONGARCH_ISA_LEVEL_RAW 14 - 15 - #endif /* _ASM_COMPILER_H */
-2
arch/loongarch/include/asm/elf.h
··· 288 288 .interp_fp_abi = LOONGARCH_ABI_FP_ANY, \ 289 289 } 290 290 291 - #define elf_read_implies_exec(ex, exec_stk) (exec_stk == EXSTACK_DEFAULT) 292 - 293 291 extern int arch_elf_pt_proc(void *ehdr, void *phdr, struct file *elf, 294 292 bool is_interp, struct arch_elf_state *state); 295 293
+5 -6
arch/loongarch/include/asm/futex.h
··· 8 8 #include <linux/futex.h> 9 9 #include <linux/uaccess.h> 10 10 #include <asm/barrier.h> 11 - #include <asm/compiler.h> 12 11 #include <asm/errno.h> 13 12 14 13 #define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \ ··· 16 17 "1: ll.w %1, %4 # __futex_atomic_op\n" \ 17 18 " " insn " \n" \ 18 19 "2: sc.w $t0, %2 \n" \ 19 - " beq $t0, $zero, 1b \n" \ 20 + " beqz $t0, 1b \n" \ 20 21 "3: \n" \ 21 22 " .section .fixup,\"ax\" \n" \ 22 23 "4: li.w %0, %6 \n" \ ··· 81 82 "# futex_atomic_cmpxchg_inatomic \n" 82 83 "1: ll.w %1, %3 \n" 83 84 " bne %1, %z4, 3f \n" 84 - " or $t0, %z5, $zero \n" 85 + " move $t0, %z5 \n" 85 86 "2: sc.w $t0, %2 \n" 86 - " beq $zero, $t0, 1b \n" 87 + " beqz $t0, 1b \n" 87 88 "3: \n" 88 89 __WEAK_LLSC_MB 89 90 " .section .fixup,\"ax\" \n" ··· 94 95 " "__UA_ADDR "\t1b, 4b \n" 95 96 " "__UA_ADDR "\t2b, 4b \n" 96 97 " .previous \n" 97 - : "+r" (ret), "=&r" (val), "=" GCC_OFF_SMALL_ASM() (*uaddr) 98 - : GCC_OFF_SMALL_ASM() (*uaddr), "Jr" (oldval), "Jr" (newval), 98 + : "+r" (ret), "=&r" (val), "=ZC" (*uaddr) 99 + : "ZC" (*uaddr), "Jr" (oldval), "Jr" (newval), 99 100 "i" (-EFAULT) 100 101 : "memory", "t0"); 101 102
-1
arch/loongarch/include/asm/irqflags.h
··· 9 9 10 10 #include <linux/compiler.h> 11 11 #include <linux/stringify.h> 12 - #include <asm/compiler.h> 13 12 #include <asm/loongarch.h> 14 13 15 14 static inline void arch_local_irq_enable(void)
-1
arch/loongarch/include/asm/local.h
··· 9 9 #include <linux/bitops.h> 10 10 #include <linux/atomic.h> 11 11 #include <asm/cmpxchg.h> 12 - #include <asm/compiler.h> 13 12 14 13 typedef struct { 15 14 atomic_long_t a;
+2 -14
arch/loongarch/include/asm/loongson.h
··· 39 39 40 40 #define MAX_PACKAGES 16 41 41 42 - /* Chip Config register of each physical cpu package */ 43 - extern u64 loongson_chipcfg[MAX_PACKAGES]; 44 - #define LOONGSON_CHIPCFG(id) (*(volatile u32 *)(loongson_chipcfg[id])) 45 - 46 - /* Chip Temperature register of each physical cpu package */ 47 - extern u64 loongson_chiptemp[MAX_PACKAGES]; 48 - #define LOONGSON_CHIPTEMP(id) (*(volatile u32 *)(loongson_chiptemp[id])) 49 - 50 - /* Freq Control register of each physical cpu package */ 51 - extern u64 loongson_freqctrl[MAX_PACKAGES]; 52 - #define LOONGSON_FREQCTRL(id) (*(volatile u32 *)(loongson_freqctrl[id])) 53 - 54 42 #define xconf_readl(addr) readl(addr) 55 43 #define xconf_readq(addr) readq(addr) 56 44 ··· 46 58 { 47 59 asm volatile ( 48 60 " st.w %[v], %[hw], 0 \n" 49 - " ld.b $r0, %[hw], 0 \n" 61 + " ld.b $zero, %[hw], 0 \n" 50 62 : 51 63 : [hw] "r" (addr), [v] "r" (val) 52 64 ); ··· 56 68 { 57 69 asm volatile ( 58 70 " st.d %[v], %[hw], 0 \n" 59 - " ld.b $r0, %[hw], 0 \n" 71 + " ld.b $zero, %[hw], 0 \n" 60 72 : 61 73 : [hw] "r" (addr), [v] "r" (val64) 62 74 );
+6 -6
arch/loongarch/include/asm/stacktrace.h
··· 23 23 static __always_inline void prepare_frametrace(struct pt_regs *regs) 24 24 { 25 25 __asm__ __volatile__( 26 - /* Save $r1 */ 26 + /* Save $ra */ 27 27 STORE_ONE_REG(1) 28 - /* Use $r1 to save PC */ 29 - "pcaddi $r1, 0\n\t" 30 - STR_LONG_S " $r1, %0\n\t" 31 - /* Restore $r1 */ 32 - STR_LONG_L " $r1, %1, "STR_LONGSIZE"\n\t" 28 + /* Use $ra to save PC */ 29 + "pcaddi $ra, 0\n\t" 30 + STR_LONG_S " $ra, %0\n\t" 31 + /* Restore $ra */ 32 + STR_LONG_L " $ra, %1, "STR_LONGSIZE"\n\t" 33 33 STORE_ONE_REG(2) 34 34 STORE_ONE_REG(3) 35 35 STORE_ONE_REG(4)
+2 -2
arch/loongarch/include/asm/thread_info.h
··· 44 44 } 45 45 46 46 /* How to get the thread information struct from C. */ 47 - register struct thread_info *__current_thread_info __asm__("$r2"); 47 + register struct thread_info *__current_thread_info __asm__("$tp"); 48 48 49 49 static inline struct thread_info *current_thread_info(void) 50 50 { 51 51 return __current_thread_info; 52 52 } 53 53 54 - register unsigned long current_stack_pointer __asm__("$r3"); 54 + register unsigned long current_stack_pointer __asm__("$sp"); 55 55 56 56 #endif /* !__ASSEMBLY__ */ 57 57
+1 -1
arch/loongarch/include/asm/uaccess.h
··· 162 162 "2: \n" \ 163 163 " .section .fixup,\"ax\" \n" \ 164 164 "3: li.w %0, %3 \n" \ 165 - " or %1, $r0, $r0 \n" \ 165 + " move %1, $zero \n" \ 166 166 " b 2b \n" \ 167 167 " .previous \n" \ 168 168 " .section __ex_table,\"a\" \n" \
+9 -2
arch/loongarch/kernel/cacheinfo.c
··· 4 4 * 5 5 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited 6 6 */ 7 - #include <asm/cpu-info.h> 8 7 #include <linux/cacheinfo.h> 8 + #include <asm/bootinfo.h> 9 + #include <asm/cpu-info.h> 9 10 10 11 /* Populates leaf and increments to next leaf */ 11 12 #define populate_cache(cache, leaf, c_level, c_type) \ ··· 18 17 leaf->ways_of_associativity = c->cache.ways; \ 19 18 leaf->size = c->cache.linesz * c->cache.sets * \ 20 19 c->cache.ways; \ 20 + if (leaf->level > 2) \ 21 + leaf->size *= nodes_per_package; \ 21 22 leaf++; \ 22 23 } while (0) 23 24 ··· 98 95 99 96 int populate_cache_leaves(unsigned int cpu) 100 97 { 101 - int level = 1; 98 + int level = 1, nodes_per_package = 1; 102 99 struct cpuinfo_loongarch *c = &current_cpu_data; 103 100 struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); 104 101 struct cacheinfo *this_leaf = this_cpu_ci->info_list; 102 + 103 + if (loongson_sysconf.nr_nodes > 1) 104 + nodes_per_package = loongson_sysconf.cores_per_package 105 + / loongson_sysconf.cores_per_node; 105 106 106 107 if (c->icache.waysize) { 107 108 populate_cache(dcache, this_leaf, level, CACHE_TYPE_DATA);
+2 -2
arch/loongarch/kernel/entry.S
··· 27 27 28 28 addi.d sp, sp, -PT_SIZE 29 29 cfi_st t2, PT_R3 30 - cfi_rel_offset sp, PT_R3 30 + cfi_rel_offset sp, PT_R3 31 31 st.d zero, sp, PT_R0 32 32 csrrd t2, LOONGARCH_CSR_PRMD 33 33 st.d t2, sp, PT_PRMD ··· 50 50 cfi_st a7, PT_R11 51 51 csrrd ra, LOONGARCH_CSR_ERA 52 52 st.d ra, sp, PT_ERA 53 - cfi_rel_offset ra, PT_ERA 53 + cfi_rel_offset ra, PT_ERA 54 54 55 55 cfi_st tp, PT_R2 56 56 cfi_st u0, PT_R21
-20
arch/loongarch/kernel/env.c
··· 17 17 struct loongson_system_configuration loongson_sysconf; 18 18 EXPORT_SYMBOL(loongson_sysconf); 19 19 20 - u64 loongson_chipcfg[MAX_PACKAGES]; 21 - u64 loongson_chiptemp[MAX_PACKAGES]; 22 - u64 loongson_freqctrl[MAX_PACKAGES]; 23 - unsigned long long smp_group[MAX_PACKAGES]; 24 - 25 - static void __init register_addrs_set(u64 *registers, const u64 addr, int num) 26 - { 27 - u64 i; 28 - 29 - for (i = 0; i < num; i++) { 30 - *registers = (i << 44) | addr; 31 - registers++; 32 - } 33 - } 34 - 35 20 void __init init_environ(void) 36 21 { 37 22 int efi_boot = fw_arg0; ··· 35 50 efi_memmap_init_early(&data); 36 51 memblock_reserve(data.phys_map & PAGE_MASK, 37 52 PAGE_ALIGN(data.size + (data.phys_map & ~PAGE_MASK))); 38 - 39 - register_addrs_set(smp_group, TO_UNCACHE(0x1fe01000), 16); 40 - register_addrs_set(loongson_chipcfg, TO_UNCACHE(0x1fe00180), 16); 41 - register_addrs_set(loongson_chiptemp, TO_UNCACHE(0x1fe0019c), 16); 42 - register_addrs_set(loongson_freqctrl, TO_UNCACHE(0x1fe001d0), 16); 43 53 } 44 54 45 55 static int __init init_cpu_fullname(void)
+87 -87
arch/loongarch/kernel/fpu.S
··· 27 27 .endm 28 28 29 29 .macro sc_save_fp base 30 - EX fst.d $f0, \base, (0 * FPU_REG_WIDTH) 31 - EX fst.d $f1, \base, (1 * FPU_REG_WIDTH) 32 - EX fst.d $f2, \base, (2 * FPU_REG_WIDTH) 33 - EX fst.d $f3, \base, (3 * FPU_REG_WIDTH) 34 - EX fst.d $f4, \base, (4 * FPU_REG_WIDTH) 35 - EX fst.d $f5, \base, (5 * FPU_REG_WIDTH) 36 - EX fst.d $f6, \base, (6 * FPU_REG_WIDTH) 37 - EX fst.d $f7, \base, (7 * FPU_REG_WIDTH) 38 - EX fst.d $f8, \base, (8 * FPU_REG_WIDTH) 39 - EX fst.d $f9, \base, (9 * FPU_REG_WIDTH) 40 - EX fst.d $f10, \base, (10 * FPU_REG_WIDTH) 41 - EX fst.d $f11, \base, (11 * FPU_REG_WIDTH) 42 - EX fst.d $f12, \base, (12 * FPU_REG_WIDTH) 43 - EX fst.d $f13, \base, (13 * FPU_REG_WIDTH) 44 - EX fst.d $f14, \base, (14 * FPU_REG_WIDTH) 45 - EX fst.d $f15, \base, (15 * FPU_REG_WIDTH) 46 - EX fst.d $f16, \base, (16 * FPU_REG_WIDTH) 47 - EX fst.d $f17, \base, (17 * FPU_REG_WIDTH) 48 - EX fst.d $f18, \base, (18 * FPU_REG_WIDTH) 49 - EX fst.d $f19, \base, (19 * FPU_REG_WIDTH) 50 - EX fst.d $f20, \base, (20 * FPU_REG_WIDTH) 51 - EX fst.d $f21, \base, (21 * FPU_REG_WIDTH) 52 - EX fst.d $f22, \base, (22 * FPU_REG_WIDTH) 53 - EX fst.d $f23, \base, (23 * FPU_REG_WIDTH) 54 - EX fst.d $f24, \base, (24 * FPU_REG_WIDTH) 55 - EX fst.d $f25, \base, (25 * FPU_REG_WIDTH) 56 - EX fst.d $f26, \base, (26 * FPU_REG_WIDTH) 57 - EX fst.d $f27, \base, (27 * FPU_REG_WIDTH) 58 - EX fst.d $f28, \base, (28 * FPU_REG_WIDTH) 59 - EX fst.d $f29, \base, (29 * FPU_REG_WIDTH) 60 - EX fst.d $f30, \base, (30 * FPU_REG_WIDTH) 61 - EX fst.d $f31, \base, (31 * FPU_REG_WIDTH) 30 + EX fst.d $f0, \base, (0 * FPU_REG_WIDTH) 31 + EX fst.d $f1, \base, (1 * FPU_REG_WIDTH) 32 + EX fst.d $f2, \base, (2 * FPU_REG_WIDTH) 33 + EX fst.d $f3, \base, (3 * FPU_REG_WIDTH) 34 + EX fst.d $f4, \base, (4 * FPU_REG_WIDTH) 35 + EX fst.d $f5, \base, (5 * FPU_REG_WIDTH) 36 + EX fst.d $f6, \base, (6 * FPU_REG_WIDTH) 37 + EX fst.d $f7, \base, (7 * FPU_REG_WIDTH) 38 + EX fst.d $f8, \base, (8 * FPU_REG_WIDTH) 39 + EX fst.d $f9, \base, (9 * FPU_REG_WIDTH) 40 + EX fst.d $f10, \base, (10 * FPU_REG_WIDTH) 41 + EX fst.d $f11, \base, (11 * FPU_REG_WIDTH) 42 + EX fst.d $f12, \base, (12 * FPU_REG_WIDTH) 43 + EX fst.d $f13, \base, (13 * FPU_REG_WIDTH) 44 + EX fst.d $f14, \base, (14 * FPU_REG_WIDTH) 45 + EX fst.d $f15, \base, (15 * FPU_REG_WIDTH) 46 + EX fst.d $f16, \base, (16 * FPU_REG_WIDTH) 47 + EX fst.d $f17, \base, (17 * FPU_REG_WIDTH) 48 + EX fst.d $f18, \base, (18 * FPU_REG_WIDTH) 49 + EX fst.d $f19, \base, (19 * FPU_REG_WIDTH) 50 + EX fst.d $f20, \base, (20 * FPU_REG_WIDTH) 51 + EX fst.d $f21, \base, (21 * FPU_REG_WIDTH) 52 + EX fst.d $f22, \base, (22 * FPU_REG_WIDTH) 53 + EX fst.d $f23, \base, (23 * FPU_REG_WIDTH) 54 + EX fst.d $f24, \base, (24 * FPU_REG_WIDTH) 55 + EX fst.d $f25, \base, (25 * FPU_REG_WIDTH) 56 + EX fst.d $f26, \base, (26 * FPU_REG_WIDTH) 57 + EX fst.d $f27, \base, (27 * FPU_REG_WIDTH) 58 + EX fst.d $f28, \base, (28 * FPU_REG_WIDTH) 59 + EX fst.d $f29, \base, (29 * FPU_REG_WIDTH) 60 + EX fst.d $f30, \base, (30 * FPU_REG_WIDTH) 61 + EX fst.d $f31, \base, (31 * FPU_REG_WIDTH) 62 62 .endm 63 63 64 64 .macro sc_restore_fp base 65 - EX fld.d $f0, \base, (0 * FPU_REG_WIDTH) 66 - EX fld.d $f1, \base, (1 * FPU_REG_WIDTH) 67 - EX fld.d $f2, \base, (2 * FPU_REG_WIDTH) 68 - EX fld.d $f3, \base, (3 * FPU_REG_WIDTH) 69 - EX fld.d $f4, \base, (4 * FPU_REG_WIDTH) 70 - EX fld.d $f5, \base, (5 * FPU_REG_WIDTH) 71 - EX fld.d $f6, \base, (6 * FPU_REG_WIDTH) 72 - EX fld.d $f7, \base, (7 * FPU_REG_WIDTH) 73 - EX fld.d $f8, \base, (8 * FPU_REG_WIDTH) 74 - EX fld.d $f9, \base, (9 * FPU_REG_WIDTH) 75 - EX fld.d $f10, \base, (10 * FPU_REG_WIDTH) 76 - EX fld.d $f11, \base, (11 * FPU_REG_WIDTH) 77 - EX fld.d $f12, \base, (12 * FPU_REG_WIDTH) 78 - EX fld.d $f13, \base, (13 * FPU_REG_WIDTH) 79 - EX fld.d $f14, \base, (14 * FPU_REG_WIDTH) 80 - EX fld.d $f15, \base, (15 * FPU_REG_WIDTH) 81 - EX fld.d $f16, \base, (16 * FPU_REG_WIDTH) 82 - EX fld.d $f17, \base, (17 * FPU_REG_WIDTH) 83 - EX fld.d $f18, \base, (18 * FPU_REG_WIDTH) 84 - EX fld.d $f19, \base, (19 * FPU_REG_WIDTH) 85 - EX fld.d $f20, \base, (20 * FPU_REG_WIDTH) 86 - EX fld.d $f21, \base, (21 * FPU_REG_WIDTH) 87 - EX fld.d $f22, \base, (22 * FPU_REG_WIDTH) 88 - EX fld.d $f23, \base, (23 * FPU_REG_WIDTH) 89 - EX fld.d $f24, \base, (24 * FPU_REG_WIDTH) 90 - EX fld.d $f25, \base, (25 * FPU_REG_WIDTH) 91 - EX fld.d $f26, \base, (26 * FPU_REG_WIDTH) 92 - EX fld.d $f27, \base, (27 * FPU_REG_WIDTH) 93 - EX fld.d $f28, \base, (28 * FPU_REG_WIDTH) 94 - EX fld.d $f29, \base, (29 * FPU_REG_WIDTH) 95 - EX fld.d $f30, \base, (30 * FPU_REG_WIDTH) 96 - EX fld.d $f31, \base, (31 * FPU_REG_WIDTH) 65 + EX fld.d $f0, \base, (0 * FPU_REG_WIDTH) 66 + EX fld.d $f1, \base, (1 * FPU_REG_WIDTH) 67 + EX fld.d $f2, \base, (2 * FPU_REG_WIDTH) 68 + EX fld.d $f3, \base, (3 * FPU_REG_WIDTH) 69 + EX fld.d $f4, \base, (4 * FPU_REG_WIDTH) 70 + EX fld.d $f5, \base, (5 * FPU_REG_WIDTH) 71 + EX fld.d $f6, \base, (6 * FPU_REG_WIDTH) 72 + EX fld.d $f7, \base, (7 * FPU_REG_WIDTH) 73 + EX fld.d $f8, \base, (8 * FPU_REG_WIDTH) 74 + EX fld.d $f9, \base, (9 * FPU_REG_WIDTH) 75 + EX fld.d $f10, \base, (10 * FPU_REG_WIDTH) 76 + EX fld.d $f11, \base, (11 * FPU_REG_WIDTH) 77 + EX fld.d $f12, \base, (12 * FPU_REG_WIDTH) 78 + EX fld.d $f13, \base, (13 * FPU_REG_WIDTH) 79 + EX fld.d $f14, \base, (14 * FPU_REG_WIDTH) 80 + EX fld.d $f15, \base, (15 * FPU_REG_WIDTH) 81 + EX fld.d $f16, \base, (16 * FPU_REG_WIDTH) 82 + EX fld.d $f17, \base, (17 * FPU_REG_WIDTH) 83 + EX fld.d $f18, \base, (18 * FPU_REG_WIDTH) 84 + EX fld.d $f19, \base, (19 * FPU_REG_WIDTH) 85 + EX fld.d $f20, \base, (20 * FPU_REG_WIDTH) 86 + EX fld.d $f21, \base, (21 * FPU_REG_WIDTH) 87 + EX fld.d $f22, \base, (22 * FPU_REG_WIDTH) 88 + EX fld.d $f23, \base, (23 * FPU_REG_WIDTH) 89 + EX fld.d $f24, \base, (24 * FPU_REG_WIDTH) 90 + EX fld.d $f25, \base, (25 * FPU_REG_WIDTH) 91 + EX fld.d $f26, \base, (26 * FPU_REG_WIDTH) 92 + EX fld.d $f27, \base, (27 * FPU_REG_WIDTH) 93 + EX fld.d $f28, \base, (28 * FPU_REG_WIDTH) 94 + EX fld.d $f29, \base, (29 * FPU_REG_WIDTH) 95 + EX fld.d $f30, \base, (30 * FPU_REG_WIDTH) 96 + EX fld.d $f31, \base, (31 * FPU_REG_WIDTH) 97 97 .endm 98 98 99 99 .macro sc_save_fcc base, tmp0, tmp1 100 100 movcf2gr \tmp0, $fcc0 101 - move \tmp1, \tmp0 101 + move \tmp1, \tmp0 102 102 movcf2gr \tmp0, $fcc1 103 103 bstrins.d \tmp1, \tmp0, 15, 8 104 104 movcf2gr \tmp0, $fcc2 ··· 113 113 bstrins.d \tmp1, \tmp0, 55, 48 114 114 movcf2gr \tmp0, $fcc7 115 115 bstrins.d \tmp1, \tmp0, 63, 56 116 - EX st.d \tmp1, \base, 0 116 + EX st.d \tmp1, \base, 0 117 117 .endm 118 118 119 119 .macro sc_restore_fcc base, tmp0, tmp1 120 - EX ld.d \tmp0, \base, 0 120 + EX ld.d \tmp0, \base, 0 121 121 bstrpick.d \tmp1, \tmp0, 7, 0 122 122 movgr2cf $fcc0, \tmp1 123 123 bstrpick.d \tmp1, \tmp0, 15, 8 ··· 138 138 139 139 .macro sc_save_fcsr base, tmp0 140 140 movfcsr2gr \tmp0, fcsr0 141 - EX st.w \tmp0, \base, 0 141 + EX st.w \tmp0, \base, 0 142 142 .endm 143 143 144 144 .macro sc_restore_fcsr base, tmp0 145 - EX ld.w \tmp0, \base, 0 145 + EX ld.w \tmp0, \base, 0 146 146 movgr2fcsr fcsr0, \tmp0 147 147 .endm 148 148 ··· 151 151 */ 152 152 SYM_FUNC_START(_save_fp) 153 153 fpu_save_csr a0 t1 154 - fpu_save_double a0 t1 # clobbers t1 154 + fpu_save_double a0 t1 # clobbers t1 155 155 fpu_save_cc a0 t1 t2 # clobbers t1, t2 156 - jirl zero, ra, 0 156 + jr ra 157 157 SYM_FUNC_END(_save_fp) 158 158 EXPORT_SYMBOL(_save_fp) 159 159 ··· 161 161 * Restore a thread's fp context. 162 162 */ 163 163 SYM_FUNC_START(_restore_fp) 164 - fpu_restore_double a0 t1 # clobbers t1 165 - fpu_restore_csr a0 t1 166 - fpu_restore_cc a0 t1 t2 # clobbers t1, t2 167 - jirl zero, ra, 0 164 + fpu_restore_double a0 t1 # clobbers t1 165 + fpu_restore_csr a0 t1 166 + fpu_restore_cc a0 t1 t2 # clobbers t1, t2 167 + jr ra 168 168 SYM_FUNC_END(_restore_fp) 169 169 170 170 /* ··· 216 216 movgr2fr.d $f30, t1 217 217 movgr2fr.d $f31, t1 218 218 219 - jirl zero, ra, 0 219 + jr ra 220 220 SYM_FUNC_END(_init_fpu) 221 221 222 222 /* ··· 225 225 * a2: fcsr 226 226 */ 227 227 SYM_FUNC_START(_save_fp_context) 228 - sc_save_fcc a1 t1 t2 229 - sc_save_fcsr a2 t1 230 - sc_save_fp a0 231 - li.w a0, 0 # success 232 - jirl zero, ra, 0 228 + sc_save_fcc a1 t1 t2 229 + sc_save_fcsr a2 t1 230 + sc_save_fp a0 231 + li.w a0, 0 # success 232 + jr ra 233 233 SYM_FUNC_END(_save_fp_context) 234 234 235 235 /* ··· 238 238 * a2: fcsr 239 239 */ 240 240 SYM_FUNC_START(_restore_fp_context) 241 - sc_restore_fp a0 242 - sc_restore_fcc a1 t1 t2 243 - sc_restore_fcsr a2 t1 244 - li.w a0, 0 # success 245 - jirl zero, ra, 0 241 + sc_restore_fp a0 242 + sc_restore_fcc a1 t1 t2 243 + sc_restore_fcsr a2 t1 244 + li.w a0, 0 # success 245 + jr ra 246 246 SYM_FUNC_END(_restore_fp_context) 247 247 248 248 SYM_FUNC_START(fault) 249 249 li.w a0, -EFAULT # failure 250 - jirl zero, ra, 0 250 + jr ra 251 251 SYM_FUNC_END(fault)
+6 -6
arch/loongarch/kernel/genex.S
··· 28 28 nop 29 29 idle 0 30 30 /* end of rollback region */ 31 - 1: jirl zero, ra, 0 31 + 1: jr ra 32 32 SYM_FUNC_END(__arch_cpu_idle) 33 33 34 34 SYM_FUNC_START(handle_vint) 35 35 BACKUP_T0T1 36 36 SAVE_ALL 37 37 la.abs t1, __arch_cpu_idle 38 - LONG_L t0, sp, PT_ERA 38 + LONG_L t0, sp, PT_ERA 39 39 /* 32 byte rollback region */ 40 40 ori t0, t0, 0x1f 41 41 xori t0, t0, 0x1f 42 42 bne t0, t1, 1f 43 - LONG_S t0, sp, PT_ERA 43 + LONG_S t0, sp, PT_ERA 44 44 1: move a0, sp 45 45 move a1, sp 46 46 la.abs t0, do_vint 47 - jirl ra, t0, 0 47 + jirl ra, t0, 0 48 48 RESTORE_ALL_AND_RET 49 49 SYM_FUNC_END(handle_vint) 50 50 ··· 72 72 build_prep_\prep 73 73 move a0, sp 74 74 la.abs t0, do_\handler 75 - jirl ra, t0, 0 75 + jirl ra, t0, 0 76 76 RESTORE_ALL_AND_RET 77 77 SYM_FUNC_END(handle_\exception) 78 78 .endm ··· 91 91 92 92 SYM_FUNC_START(handle_sys) 93 93 la.abs t0, handle_syscall 94 - jirl zero, t0, 0 94 + jr t0 95 95 SYM_FUNC_END(handle_sys)
+4 -4
arch/loongarch/kernel/head.S
··· 32 32 /* We might not get launched at the address the kernel is linked to, 33 33 so we jump there. */ 34 34 la.abs t0, 0f 35 - jirl zero, t0, 0 35 + jr t0 36 36 0: 37 37 la t0, __bss_start # clear .bss 38 38 st.d zero, t0, 0 ··· 50 50 /* KSave3 used for percpu base, initialized as 0 */ 51 51 csrwr zero, PERCPU_BASE_KS 52 52 /* GPR21 used for percpu base (runtime), initialized as 0 */ 53 - or u0, zero, zero 53 + move u0, zero 54 54 55 55 la tp, init_thread_union 56 56 /* Set the SP after an empty pt_regs. */ ··· 85 85 ld.d sp, t0, CPU_BOOT_STACK 86 86 ld.d tp, t0, CPU_BOOT_TINFO 87 87 88 - la.abs t0, 0f 89 - jirl zero, t0, 0 88 + la.abs t0, 0f 89 + jr t0 90 90 0: 91 91 bl start_secondary 92 92 SYM_CODE_END(smpboot_entry)
+7 -5
arch/loongarch/kernel/ptrace.c
··· 193 193 const void *kbuf, const void __user *ubuf) 194 194 { 195 195 const int fcc_start = NUM_FPU_REGS * sizeof(elf_fpreg_t); 196 - const int fcc_end = fcc_start + sizeof(u64); 196 + const int fcsr_start = fcc_start + sizeof(u64); 197 197 int err; 198 198 199 199 BUG_ON(count % sizeof(elf_fpreg_t)); ··· 209 209 if (err) 210 210 return err; 211 211 212 - if (count > 0) 213 - err |= user_regset_copyin(&pos, &count, &kbuf, &ubuf, 214 - &target->thread.fpu.fcc, 215 - fcc_start, fcc_end); 212 + err |= user_regset_copyin(&pos, &count, &kbuf, &ubuf, 213 + &target->thread.fpu.fcc, fcc_start, 214 + fcc_start + sizeof(u64)); 215 + err |= user_regset_copyin(&pos, &count, &kbuf, &ubuf, 216 + &target->thread.fpu.fcsr, fcsr_start, 217 + fcsr_start + sizeof(u32)); 216 218 217 219 return err; 218 220 }
-1
arch/loongarch/kernel/reset.c
··· 13 13 #include <linux/console.h> 14 14 15 15 #include <acpi/reboot.h> 16 - #include <asm/compiler.h> 17 16 #include <asm/idle.h> 18 17 #include <asm/loongarch.h> 19 18 #include <asm/reboot.h>
+1 -1
arch/loongarch/kernel/setup.c
··· 126 126 char *dmi_data = (char *)dm; 127 127 128 128 bios_extern = *(dmi_data + SMBIOS_BIOSEXTERN_OFFSET); 129 - b_info.bios_size = *(dmi_data + SMBIOS_BIOSSIZE_OFFSET); 129 + b_info.bios_size = (*(dmi_data + SMBIOS_BIOSSIZE_OFFSET) + 1) << 6; 130 130 131 131 if (bios_extern & LOONGSON_EFI_ENABLE) 132 132 set_bit(EFI_BOOT, &efi.flags);
+13 -100
arch/loongarch/kernel/smp.c
··· 278 278 mb(); 279 279 } 280 280 281 - /* 282 - * The target CPU should go to XKPRANGE (uncached area) and flush 283 - * ICache/DCache/VCache before the control CPU can safely disable its clock. 284 - */ 285 - static void loongson3_play_dead(int *state_addr) 281 + void play_dead(void) 286 282 { 287 - register int val; 288 - register void *addr; 283 + register uint64_t addr; 289 284 register void (*init_fn)(void); 290 285 291 - __asm__ __volatile__( 292 - " li.d %[addr], 0x8000000000000000\n" 293 - "1: cacop 0x8, %[addr], 0 \n" /* flush ICache */ 294 - " cacop 0x8, %[addr], 1 \n" 295 - " cacop 0x8, %[addr], 2 \n" 296 - " cacop 0x8, %[addr], 3 \n" 297 - " cacop 0x9, %[addr], 0 \n" /* flush DCache */ 298 - " cacop 0x9, %[addr], 1 \n" 299 - " cacop 0x9, %[addr], 2 \n" 300 - " cacop 0x9, %[addr], 3 \n" 301 - " addi.w %[sets], %[sets], -1 \n" 302 - " addi.d %[addr], %[addr], 0x40 \n" 303 - " bnez %[sets], 1b \n" 304 - " li.d %[addr], 0x8000000000000000\n" 305 - "2: cacop 0xa, %[addr], 0 \n" /* flush VCache */ 306 - " cacop 0xa, %[addr], 1 \n" 307 - " cacop 0xa, %[addr], 2 \n" 308 - " cacop 0xa, %[addr], 3 \n" 309 - " cacop 0xa, %[addr], 4 \n" 310 - " cacop 0xa, %[addr], 5 \n" 311 - " cacop 0xa, %[addr], 6 \n" 312 - " cacop 0xa, %[addr], 7 \n" 313 - " cacop 0xa, %[addr], 8 \n" 314 - " cacop 0xa, %[addr], 9 \n" 315 - " cacop 0xa, %[addr], 10 \n" 316 - " cacop 0xa, %[addr], 11 \n" 317 - " cacop 0xa, %[addr], 12 \n" 318 - " cacop 0xa, %[addr], 13 \n" 319 - " cacop 0xa, %[addr], 14 \n" 320 - " cacop 0xa, %[addr], 15 \n" 321 - " addi.w %[vsets], %[vsets], -1 \n" 322 - " addi.d %[addr], %[addr], 0x40 \n" 323 - " bnez %[vsets], 2b \n" 324 - " li.w %[val], 0x7 \n" /* *state_addr = CPU_DEAD; */ 325 - " st.w %[val], %[state_addr], 0 \n" 326 - " dbar 0 \n" 327 - " cacop 0x11, %[state_addr], 0 \n" /* flush entry of *state_addr */ 328 - : [addr] "=&r" (addr), [val] "=&r" (val) 329 - : [state_addr] "r" (state_addr), 330 - [sets] "r" (cpu_data[smp_processor_id()].dcache.sets), 331 - [vsets] "r" (cpu_data[smp_processor_id()].vcache.sets)); 332 - 286 + idle_task_exit(); 333 287 local_irq_enable(); 334 - change_csr_ecfg(ECFG0_IM, ECFGF_IPI); 288 + set_csr_ecfg(ECFGF_IPI); 289 + __this_cpu_write(cpu_state, CPU_DEAD); 335 290 336 - __asm__ __volatile__( 337 - " idle 0 \n" 338 - " li.w $t0, 0x1020 \n" 339 - " iocsrrd.d %[init_fn], $t0 \n" /* Get init PC */ 340 - : [init_fn] "=&r" (addr) 341 - : /* No Input */ 342 - : "a0"); 343 - init_fn = __va(addr); 291 + __smp_mb(); 292 + do { 293 + __asm__ __volatile__("idle 0\n\t"); 294 + addr = iocsr_read64(LOONGARCH_IOCSR_MBUF0); 295 + } while (addr == 0); 296 + 297 + init_fn = (void *)TO_CACHE(addr); 298 + iocsr_write32(0xffffffff, LOONGARCH_IOCSR_IPI_CLEAR); 344 299 345 300 init_fn(); 346 301 unreachable(); 347 302 } 348 - 349 - void play_dead(void) 350 - { 351 - int *state_addr; 352 - unsigned int cpu = smp_processor_id(); 353 - void (*play_dead_uncached)(int *s); 354 - 355 - idle_task_exit(); 356 - play_dead_uncached = (void *)TO_UNCACHE(__pa((unsigned long)loongson3_play_dead)); 357 - state_addr = &per_cpu(cpu_state, cpu); 358 - mb(); 359 - play_dead_uncached(state_addr); 360 - } 361 - 362 - static int loongson3_enable_clock(unsigned int cpu) 363 - { 364 - uint64_t core_id = cpu_data[cpu].core; 365 - uint64_t package_id = cpu_data[cpu].package; 366 - 367 - LOONGSON_FREQCTRL(package_id) |= 1 << (core_id * 4 + 3); 368 - 369 - return 0; 370 - } 371 - 372 - static int loongson3_disable_clock(unsigned int cpu) 373 - { 374 - uint64_t core_id = cpu_data[cpu].core; 375 - uint64_t package_id = cpu_data[cpu].package; 376 - 377 - LOONGSON_FREQCTRL(package_id) &= ~(1 << (core_id * 4 + 3)); 378 - 379 - return 0; 380 - } 381 - 382 - static int register_loongson3_notifier(void) 383 - { 384 - return cpuhp_setup_state_nocalls(CPUHP_LOONGARCH_SOC_PREPARE, 385 - "loongarch/loongson:prepare", 386 - loongson3_enable_clock, 387 - loongson3_disable_clock); 388 - } 389 - early_initcall(register_loongson3_notifier); 390 303 391 304 #endif 392 305
+2 -2
arch/loongarch/kernel/switch.S
··· 24 24 move tp, a2 25 25 cpu_restore_nonscratch a1 26 26 27 - li.w t0, _THREAD_SIZE - 32 28 - PTR_ADD t0, t0, tp 27 + li.w t0, _THREAD_SIZE - 32 28 + PTR_ADD t0, t0, tp 29 29 set_saved_sp t0, t1, t2 30 30 31 31 ldptr.d t1, a1, THREAD_CSRPRMD
+1 -1
arch/loongarch/lib/clear_user.S
··· 32 32 1: st.b zero, a0, 0 33 33 addi.d a0, a0, 1 34 34 addi.d a1, a1, -1 35 - bgt a1, zero, 1b 35 + bgtz a1, 1b 36 36 37 37 2: move a0, a1 38 38 jr ra
+1 -1
arch/loongarch/lib/copy_user.S
··· 35 35 addi.d a0, a0, 1 36 36 addi.d a1, a1, 1 37 37 addi.d a2, a2, -1 38 - bgt a2, zero, 1b 38 + bgtz a2, 1b 39 39 40 40 3: move a0, a2 41 41 jr ra
-1
arch/loongarch/lib/delay.c
··· 7 7 #include <linux/smp.h> 8 8 #include <linux/timex.h> 9 9 10 - #include <asm/compiler.h> 11 10 #include <asm/processor.h> 12 11 13 12 void __delay(unsigned long cycles)
+59 -59
arch/loongarch/mm/page.S
··· 10 10 11 11 .align 5 12 12 SYM_FUNC_START(clear_page) 13 - lu12i.w t0, 1 << (PAGE_SHIFT - 12) 14 - add.d t0, t0, a0 13 + lu12i.w t0, 1 << (PAGE_SHIFT - 12) 14 + add.d t0, t0, a0 15 15 1: 16 - st.d zero, a0, 0 17 - st.d zero, a0, 8 18 - st.d zero, a0, 16 19 - st.d zero, a0, 24 20 - st.d zero, a0, 32 21 - st.d zero, a0, 40 22 - st.d zero, a0, 48 23 - st.d zero, a0, 56 24 - addi.d a0, a0, 128 25 - st.d zero, a0, -64 26 - st.d zero, a0, -56 27 - st.d zero, a0, -48 28 - st.d zero, a0, -40 29 - st.d zero, a0, -32 30 - st.d zero, a0, -24 31 - st.d zero, a0, -16 32 - st.d zero, a0, -8 33 - bne t0, a0, 1b 16 + st.d zero, a0, 0 17 + st.d zero, a0, 8 18 + st.d zero, a0, 16 19 + st.d zero, a0, 24 20 + st.d zero, a0, 32 21 + st.d zero, a0, 40 22 + st.d zero, a0, 48 23 + st.d zero, a0, 56 24 + addi.d a0, a0, 128 25 + st.d zero, a0, -64 26 + st.d zero, a0, -56 27 + st.d zero, a0, -48 28 + st.d zero, a0, -40 29 + st.d zero, a0, -32 30 + st.d zero, a0, -24 31 + st.d zero, a0, -16 32 + st.d zero, a0, -8 33 + bne t0, a0, 1b 34 34 35 - jirl $r0, ra, 0 35 + jr ra 36 36 SYM_FUNC_END(clear_page) 37 37 EXPORT_SYMBOL(clear_page) 38 38 39 39 .align 5 40 40 SYM_FUNC_START(copy_page) 41 - lu12i.w t8, 1 << (PAGE_SHIFT - 12) 42 - add.d t8, t8, a0 41 + lu12i.w t8, 1 << (PAGE_SHIFT - 12) 42 + add.d t8, t8, a0 43 43 1: 44 - ld.d t0, a1, 0 45 - ld.d t1, a1, 8 46 - ld.d t2, a1, 16 47 - ld.d t3, a1, 24 48 - ld.d t4, a1, 32 49 - ld.d t5, a1, 40 50 - ld.d t6, a1, 48 51 - ld.d t7, a1, 56 44 + ld.d t0, a1, 0 45 + ld.d t1, a1, 8 46 + ld.d t2, a1, 16 47 + ld.d t3, a1, 24 48 + ld.d t4, a1, 32 49 + ld.d t5, a1, 40 50 + ld.d t6, a1, 48 51 + ld.d t7, a1, 56 52 52 53 - st.d t0, a0, 0 54 - st.d t1, a0, 8 55 - ld.d t0, a1, 64 56 - ld.d t1, a1, 72 57 - st.d t2, a0, 16 58 - st.d t3, a0, 24 59 - ld.d t2, a1, 80 60 - ld.d t3, a1, 88 61 - st.d t4, a0, 32 62 - st.d t5, a0, 40 63 - ld.d t4, a1, 96 64 - ld.d t5, a1, 104 65 - st.d t6, a0, 48 66 - st.d t7, a0, 56 67 - ld.d t6, a1, 112 68 - ld.d t7, a1, 120 69 - addi.d a0, a0, 128 70 - addi.d a1, a1, 128 53 + st.d t0, a0, 0 54 + st.d t1, a0, 8 55 + ld.d t0, a1, 64 56 + ld.d t1, a1, 72 57 + st.d t2, a0, 16 58 + st.d t3, a0, 24 59 + ld.d t2, a1, 80 60 + ld.d t3, a1, 88 61 + st.d t4, a0, 32 62 + st.d t5, a0, 40 63 + ld.d t4, a1, 96 64 + ld.d t5, a1, 104 65 + st.d t6, a0, 48 66 + st.d t7, a0, 56 67 + ld.d t6, a1, 112 68 + ld.d t7, a1, 120 69 + addi.d a0, a0, 128 70 + addi.d a1, a1, 128 71 71 72 - st.d t0, a0, -64 73 - st.d t1, a0, -56 74 - st.d t2, a0, -48 75 - st.d t3, a0, -40 76 - st.d t4, a0, -32 77 - st.d t5, a0, -24 78 - st.d t6, a0, -16 79 - st.d t7, a0, -8 72 + st.d t0, a0, -64 73 + st.d t1, a0, -56 74 + st.d t2, a0, -48 75 + st.d t3, a0, -40 76 + st.d t4, a0, -32 77 + st.d t5, a0, -24 78 + st.d t6, a0, -16 79 + st.d t7, a0, -8 80 80 81 - bne t8, a0, 1b 82 - jirl $r0, ra, 0 81 + bne t8, a0, 1b 82 + jr ra 83 83 SYM_FUNC_END(copy_page) 84 84 EXPORT_SYMBOL(copy_page)
+49 -49
arch/loongarch/mm/tlbex.S
··· 18 18 REG_S a2, sp, PT_BVADDR 19 19 li.w a1, \write 20 20 la.abs t0, do_page_fault 21 - jirl ra, t0, 0 21 + jirl ra, t0, 0 22 22 RESTORE_ALL_AND_RET 23 23 SYM_FUNC_END(tlb_do_page_fault_\write) 24 24 .endm ··· 34 34 csrrd a2, LOONGARCH_CSR_BADV 35 35 REG_S a2, sp, PT_BVADDR 36 36 la.abs t0, do_page_fault 37 - jirl ra, t0, 0 37 + jirl ra, t0, 0 38 38 RESTORE_ALL_AND_RET 39 39 SYM_FUNC_END(handle_tlb_protect) 40 40 ··· 47 47 * The vmalloc handling is not in the hotpath. 48 48 */ 49 49 csrrd t0, LOONGARCH_CSR_BADV 50 - blt t0, $r0, vmalloc_load 50 + bltz t0, vmalloc_load 51 51 csrrd t1, LOONGARCH_CSR_PGDL 52 52 53 53 vmalloc_done_load: ··· 80 80 * see if we need to jump to huge tlb processing. 81 81 */ 82 82 andi t0, ra, _PAGE_HUGE 83 - bne t0, $r0, tlb_huge_update_load 83 + bnez t0, tlb_huge_update_load 84 84 85 85 csrrd t0, LOONGARCH_CSR_BADV 86 86 srli.d t0, t0, (PAGE_SHIFT + PTE_ORDER) ··· 100 100 101 101 srli.d ra, t0, _PAGE_PRESENT_SHIFT 102 102 andi ra, ra, 1 103 - beq ra, $r0, nopage_tlb_load 103 + beqz ra, nopage_tlb_load 104 104 105 105 ori t0, t0, _PAGE_VALID 106 106 #ifdef CONFIG_SMP 107 107 sc.d t0, t1, 0 108 - beq t0, $r0, smp_pgtable_change_load 108 + beqz t0, smp_pgtable_change_load 109 109 #else 110 110 st.d t0, t1, 0 111 111 #endif ··· 139 139 #endif 140 140 srli.d ra, t0, _PAGE_PRESENT_SHIFT 141 141 andi ra, ra, 1 142 - beq ra, $r0, nopage_tlb_load 142 + beqz ra, nopage_tlb_load 143 143 tlbsrch 144 144 145 145 ori t0, t0, _PAGE_VALID 146 146 #ifdef CONFIG_SMP 147 147 sc.d t0, t1, 0 148 - beq t0, $r0, tlb_huge_update_load 148 + beqz t0, tlb_huge_update_load 149 149 ld.d t0, t1, 0 150 150 #else 151 151 st.d t0, t1, 0 152 152 #endif 153 - addu16i.d t1, $r0, -(CSR_TLBIDX_EHINV >> 16) 154 - addi.d ra, t1, 0 155 - csrxchg ra, t1, LOONGARCH_CSR_TLBIDX 153 + addu16i.d t1, zero, -(CSR_TLBIDX_EHINV >> 16) 154 + addi.d ra, t1, 0 155 + csrxchg ra, t1, LOONGARCH_CSR_TLBIDX 156 156 tlbwr 157 157 158 - csrxchg $r0, t1, LOONGARCH_CSR_TLBIDX 158 + csrxchg zero, t1, LOONGARCH_CSR_TLBIDX 159 159 160 160 /* 161 161 * A huge PTE describes an area the size of the ··· 178 178 addi.d t0, ra, 0 179 179 180 180 /* Convert to entrylo1 */ 181 - addi.d t1, $r0, 1 181 + addi.d t1, zero, 1 182 182 slli.d t1, t1, (HPAGE_SHIFT - 1) 183 183 add.d t0, t0, t1 184 184 csrwr t0, LOONGARCH_CSR_TLBELO1 185 185 186 186 /* Set huge page tlb entry size */ 187 - addu16i.d t0, $r0, (CSR_TLBIDX_PS >> 16) 188 - addu16i.d t1, $r0, (PS_HUGE_SIZE << (CSR_TLBIDX_PS_SHIFT - 16)) 187 + addu16i.d t0, zero, (CSR_TLBIDX_PS >> 16) 188 + addu16i.d t1, zero, (PS_HUGE_SIZE << (CSR_TLBIDX_PS_SHIFT - 16)) 189 189 csrxchg t1, t0, LOONGARCH_CSR_TLBIDX 190 190 191 191 tlbfill 192 192 193 - addu16i.d t0, $r0, (CSR_TLBIDX_PS >> 16) 194 - addu16i.d t1, $r0, (PS_DEFAULT_SIZE << (CSR_TLBIDX_PS_SHIFT - 16)) 193 + addu16i.d t0, zero, (CSR_TLBIDX_PS >> 16) 194 + addu16i.d t1, zero, (PS_DEFAULT_SIZE << (CSR_TLBIDX_PS_SHIFT - 16)) 195 195 csrxchg t1, t0, LOONGARCH_CSR_TLBIDX 196 196 197 197 nopage_tlb_load: 198 198 dbar 0 199 199 csrrd ra, EXCEPTION_KS2 200 200 la.abs t0, tlb_do_page_fault_0 201 - jirl $r0, t0, 0 201 + jr t0 202 202 SYM_FUNC_END(handle_tlb_load) 203 203 204 204 SYM_FUNC_START(handle_tlb_store) ··· 210 210 * The vmalloc handling is not in the hotpath. 211 211 */ 212 212 csrrd t0, LOONGARCH_CSR_BADV 213 - blt t0, $r0, vmalloc_store 213 + bltz t0, vmalloc_store 214 214 csrrd t1, LOONGARCH_CSR_PGDL 215 215 216 216 vmalloc_done_store: ··· 244 244 * see if we need to jump to huge tlb processing. 245 245 */ 246 246 andi t0, ra, _PAGE_HUGE 247 - bne t0, $r0, tlb_huge_update_store 247 + bnez t0, tlb_huge_update_store 248 248 249 249 csrrd t0, LOONGARCH_CSR_BADV 250 250 srli.d t0, t0, (PAGE_SHIFT + PTE_ORDER) ··· 265 265 srli.d ra, t0, _PAGE_PRESENT_SHIFT 266 266 andi ra, ra, ((_PAGE_PRESENT | _PAGE_WRITE) >> _PAGE_PRESENT_SHIFT) 267 267 xori ra, ra, ((_PAGE_PRESENT | _PAGE_WRITE) >> _PAGE_PRESENT_SHIFT) 268 - bne ra, $r0, nopage_tlb_store 268 + bnez ra, nopage_tlb_store 269 269 270 270 ori t0, t0, (_PAGE_VALID | _PAGE_DIRTY | _PAGE_MODIFIED) 271 271 #ifdef CONFIG_SMP 272 272 sc.d t0, t1, 0 273 - beq t0, $r0, smp_pgtable_change_store 273 + beqz t0, smp_pgtable_change_store 274 274 #else 275 275 st.d t0, t1, 0 276 276 #endif ··· 306 306 srli.d ra, t0, _PAGE_PRESENT_SHIFT 307 307 andi ra, ra, ((_PAGE_PRESENT | _PAGE_WRITE) >> _PAGE_PRESENT_SHIFT) 308 308 xori ra, ra, ((_PAGE_PRESENT | _PAGE_WRITE) >> _PAGE_PRESENT_SHIFT) 309 - bne ra, $r0, nopage_tlb_store 309 + bnez ra, nopage_tlb_store 310 310 311 311 tlbsrch 312 312 ori t0, t0, (_PAGE_VALID | _PAGE_DIRTY | _PAGE_MODIFIED) 313 313 314 314 #ifdef CONFIG_SMP 315 315 sc.d t0, t1, 0 316 - beq t0, $r0, tlb_huge_update_store 316 + beqz t0, tlb_huge_update_store 317 317 ld.d t0, t1, 0 318 318 #else 319 319 st.d t0, t1, 0 320 320 #endif 321 - addu16i.d t1, $r0, -(CSR_TLBIDX_EHINV >> 16) 322 - addi.d ra, t1, 0 323 - csrxchg ra, t1, LOONGARCH_CSR_TLBIDX 321 + addu16i.d t1, zero, -(CSR_TLBIDX_EHINV >> 16) 322 + addi.d ra, t1, 0 323 + csrxchg ra, t1, LOONGARCH_CSR_TLBIDX 324 324 tlbwr 325 325 326 - csrxchg $r0, t1, LOONGARCH_CSR_TLBIDX 326 + csrxchg zero, t1, LOONGARCH_CSR_TLBIDX 327 327 /* 328 328 * A huge PTE describes an area the size of the 329 329 * configured huge page size. This is twice the ··· 345 345 addi.d t0, ra, 0 346 346 347 347 /* Convert to entrylo1 */ 348 - addi.d t1, $r0, 1 348 + addi.d t1, zero, 1 349 349 slli.d t1, t1, (HPAGE_SHIFT - 1) 350 350 add.d t0, t0, t1 351 351 csrwr t0, LOONGARCH_CSR_TLBELO1 352 352 353 353 /* Set huge page tlb entry size */ 354 - addu16i.d t0, $r0, (CSR_TLBIDX_PS >> 16) 355 - addu16i.d t1, $r0, (PS_HUGE_SIZE << (CSR_TLBIDX_PS_SHIFT - 16)) 354 + addu16i.d t0, zero, (CSR_TLBIDX_PS >> 16) 355 + addu16i.d t1, zero, (PS_HUGE_SIZE << (CSR_TLBIDX_PS_SHIFT - 16)) 356 356 csrxchg t1, t0, LOONGARCH_CSR_TLBIDX 357 357 358 358 tlbfill 359 359 360 360 /* Reset default page size */ 361 - addu16i.d t0, $r0, (CSR_TLBIDX_PS >> 16) 362 - addu16i.d t1, $r0, (PS_DEFAULT_SIZE << (CSR_TLBIDX_PS_SHIFT - 16)) 361 + addu16i.d t0, zero, (CSR_TLBIDX_PS >> 16) 362 + addu16i.d t1, zero, (PS_DEFAULT_SIZE << (CSR_TLBIDX_PS_SHIFT - 16)) 363 363 csrxchg t1, t0, LOONGARCH_CSR_TLBIDX 364 364 365 365 nopage_tlb_store: 366 366 dbar 0 367 367 csrrd ra, EXCEPTION_KS2 368 368 la.abs t0, tlb_do_page_fault_1 369 - jirl $r0, t0, 0 369 + jr t0 370 370 SYM_FUNC_END(handle_tlb_store) 371 371 372 372 SYM_FUNC_START(handle_tlb_modify) ··· 378 378 * The vmalloc handling is not in the hotpath. 379 379 */ 380 380 csrrd t0, LOONGARCH_CSR_BADV 381 - blt t0, $r0, vmalloc_modify 381 + bltz t0, vmalloc_modify 382 382 csrrd t1, LOONGARCH_CSR_PGDL 383 383 384 384 vmalloc_done_modify: ··· 411 411 * see if we need to jump to huge tlb processing. 412 412 */ 413 413 andi t0, ra, _PAGE_HUGE 414 - bne t0, $r0, tlb_huge_update_modify 414 + bnez t0, tlb_huge_update_modify 415 415 416 416 csrrd t0, LOONGARCH_CSR_BADV 417 417 srli.d t0, t0, (PAGE_SHIFT + PTE_ORDER) ··· 431 431 432 432 srli.d ra, t0, _PAGE_WRITE_SHIFT 433 433 andi ra, ra, 1 434 - beq ra, $r0, nopage_tlb_modify 434 + beqz ra, nopage_tlb_modify 435 435 436 436 ori t0, t0, (_PAGE_VALID | _PAGE_DIRTY | _PAGE_MODIFIED) 437 437 #ifdef CONFIG_SMP 438 438 sc.d t0, t1, 0 439 - beq t0, $r0, smp_pgtable_change_modify 439 + beqz t0, smp_pgtable_change_modify 440 440 #else 441 441 st.d t0, t1, 0 442 442 #endif ··· 454 454 ertn 455 455 #ifdef CONFIG_64BIT 456 456 vmalloc_modify: 457 - la.abs t1, swapper_pg_dir 457 + la.abs t1, swapper_pg_dir 458 458 b vmalloc_done_modify 459 459 #endif 460 460 ··· 471 471 472 472 srli.d ra, t0, _PAGE_WRITE_SHIFT 473 473 andi ra, ra, 1 474 - beq ra, $r0, nopage_tlb_modify 474 + beqz ra, nopage_tlb_modify 475 475 476 476 tlbsrch 477 477 ori t0, t0, (_PAGE_VALID | _PAGE_DIRTY | _PAGE_MODIFIED) 478 478 479 479 #ifdef CONFIG_SMP 480 480 sc.d t0, t1, 0 481 - beq t0, $r0, tlb_huge_update_modify 481 + beqz t0, tlb_huge_update_modify 482 482 ld.d t0, t1, 0 483 483 #else 484 484 st.d t0, t1, 0 ··· 504 504 addi.d t0, ra, 0 505 505 506 506 /* Convert to entrylo1 */ 507 - addi.d t1, $r0, 1 507 + addi.d t1, zero, 1 508 508 slli.d t1, t1, (HPAGE_SHIFT - 1) 509 509 add.d t0, t0, t1 510 510 csrwr t0, LOONGARCH_CSR_TLBELO1 511 511 512 512 /* Set huge page tlb entry size */ 513 - addu16i.d t0, $r0, (CSR_TLBIDX_PS >> 16) 514 - addu16i.d t1, $r0, (PS_HUGE_SIZE << (CSR_TLBIDX_PS_SHIFT - 16)) 515 - csrxchg t1, t0, LOONGARCH_CSR_TLBIDX 513 + addu16i.d t0, zero, (CSR_TLBIDX_PS >> 16) 514 + addu16i.d t1, zero, (PS_HUGE_SIZE << (CSR_TLBIDX_PS_SHIFT - 16)) 515 + csrxchg t1, t0, LOONGARCH_CSR_TLBIDX 516 516 517 517 tlbwr 518 518 519 519 /* Reset default page size */ 520 - addu16i.d t0, $r0, (CSR_TLBIDX_PS >> 16) 521 - addu16i.d t1, $r0, (PS_DEFAULT_SIZE << (CSR_TLBIDX_PS_SHIFT - 16)) 522 - csrxchg t1, t0, LOONGARCH_CSR_TLBIDX 520 + addu16i.d t0, zero, (CSR_TLBIDX_PS >> 16) 521 + addu16i.d t1, zero, (PS_DEFAULT_SIZE << (CSR_TLBIDX_PS_SHIFT - 16)) 522 + csrxchg t1, t0, LOONGARCH_CSR_TLBIDX 523 523 524 524 nopage_tlb_modify: 525 525 dbar 0 526 526 csrrd ra, EXCEPTION_KS2 527 527 la.abs t0, tlb_do_page_fault_1 528 - jirl $r0, t0, 0 528 + jr t0 529 529 SYM_FUNC_END(handle_tlb_modify) 530 530 531 531 SYM_FUNC_START(handle_tlb_refill)
+4
arch/powerpc/Kconfig
··· 282 282 # Please keep this list sorted alphabetically. 283 283 # 284 284 285 + config PPC_LONG_DOUBLE_128 286 + depends on PPC64 287 + def_bool $(success,test "$(shell,echo __LONG_DOUBLE_128__ | $(CC) -E -P -)" = 1) 288 + 285 289 config PPC_BARRIER_NOSPEC 286 290 bool 287 291 default y
+1
arch/powerpc/kernel/Makefile
··· 20 20 CFLAGS_prom_init.o += -fno-stack-protector 21 21 CFLAGS_prom_init.o += -DDISABLE_BRANCH_PROFILING 22 22 CFLAGS_prom_init.o += -ffreestanding 23 + CFLAGS_prom_init.o += $(call cc-option, -ftrivial-auto-var-init=uninitialized) 23 24 24 25 ifdef CONFIG_FUNCTION_TRACER 25 26 # Do not trace early boot code
+1 -1
arch/riscv/Makefile
··· 111 111 vdso_install: 112 112 $(Q)$(MAKE) $(build)=arch/riscv/kernel/vdso $@ 113 113 $(if $(CONFIG_COMPAT),$(Q)$(MAKE) \ 114 - $(build)=arch/riscv/kernel/compat_vdso $@) 114 + $(build)=arch/riscv/kernel/compat_vdso compat_$@) 115 115 116 116 ifeq ($(KBUILD_EXTMOD),) 117 117 ifeq ($(CONFIG_MMU),y)
+1 -6
arch/x86/include/asm/sev.h
··· 72 72 73 73 struct real_mode_header; 74 74 enum stack_type; 75 - struct ghcb; 76 75 77 76 /* Early IDT entry points for #VC handler */ 78 77 extern void vc_no_ghcb(void); ··· 155 156 __sev_es_nmi_complete(); 156 157 } 157 158 extern int __init sev_es_efi_map_ghcbs(pgd_t *pgd); 158 - extern enum es_result sev_es_ghcb_hv_call(struct ghcb *ghcb, 159 - bool set_ghcb_msr, 160 - struct es_em_ctxt *ctxt, 161 - u64 exit_code, u64 exit_info_1, 162 - u64 exit_info_2); 159 + 163 160 static inline int rmpadjust(unsigned long vaddr, bool rmp_psize, unsigned long attrs) 164 161 { 165 162 int rc;
+1
arch/x86/kernel/cpu/bugs.c
··· 1520 1520 * enable IBRS around firmware calls. 1521 1521 */ 1522 1522 if (boot_cpu_has_bug(X86_BUG_RETBLEED) && 1523 + boot_cpu_has(X86_FEATURE_IBPB) && 1523 1524 (boot_cpu_data.x86_vendor == X86_VENDOR_AMD || 1524 1525 boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)) { 1525 1526
+9 -16
arch/x86/kernel/sev-shared.c
··· 219 219 return ES_VMM_ERROR; 220 220 } 221 221 222 - enum es_result sev_es_ghcb_hv_call(struct ghcb *ghcb, bool set_ghcb_msr, 223 - struct es_em_ctxt *ctxt, u64 exit_code, 224 - u64 exit_info_1, u64 exit_info_2) 222 + static enum es_result sev_es_ghcb_hv_call(struct ghcb *ghcb, 223 + struct es_em_ctxt *ctxt, 224 + u64 exit_code, u64 exit_info_1, 225 + u64 exit_info_2) 225 226 { 226 227 /* Fill in protocol and format specifiers */ 227 228 ghcb->protocol_version = ghcb_version; ··· 232 231 ghcb_set_sw_exit_info_1(ghcb, exit_info_1); 233 232 ghcb_set_sw_exit_info_2(ghcb, exit_info_2); 234 233 235 - /* 236 - * Hyper-V unenlightened guests use a paravisor for communicating and 237 - * GHCB pages are being allocated and set up by that paravisor. Linux 238 - * should not change the GHCB page's physical address. 239 - */ 240 - if (set_ghcb_msr) 241 - sev_es_wr_ghcb_msr(__pa(ghcb)); 242 - 234 + sev_es_wr_ghcb_msr(__pa(ghcb)); 243 235 VMGEXIT(); 244 236 245 237 return verify_exception_info(ghcb, ctxt); ··· 789 795 */ 790 796 sw_scratch = __pa(ghcb) + offsetof(struct ghcb, shared_buffer); 791 797 ghcb_set_sw_scratch(ghcb, sw_scratch); 792 - ret = sev_es_ghcb_hv_call(ghcb, true, ctxt, SVM_EXIT_IOIO, 798 + ret = sev_es_ghcb_hv_call(ghcb, ctxt, SVM_EXIT_IOIO, 793 799 exit_info_1, exit_info_2); 794 800 if (ret != ES_OK) 795 801 return ret; ··· 831 837 832 838 ghcb_set_rax(ghcb, rax); 833 839 834 - ret = sev_es_ghcb_hv_call(ghcb, true, ctxt, 835 - SVM_EXIT_IOIO, exit_info_1, 0); 840 + ret = sev_es_ghcb_hv_call(ghcb, ctxt, SVM_EXIT_IOIO, exit_info_1, 0); 836 841 if (ret != ES_OK) 837 842 return ret; 838 843 ··· 887 894 /* xgetbv will cause #GP - use reset value for xcr0 */ 888 895 ghcb_set_xcr0(ghcb, 1); 889 896 890 - ret = sev_es_ghcb_hv_call(ghcb, true, ctxt, SVM_EXIT_CPUID, 0, 0); 897 + ret = sev_es_ghcb_hv_call(ghcb, ctxt, SVM_EXIT_CPUID, 0, 0); 891 898 if (ret != ES_OK) 892 899 return ret; 893 900 ··· 912 919 bool rdtscp = (exit_code == SVM_EXIT_RDTSCP); 913 920 enum es_result ret; 914 921 915 - ret = sev_es_ghcb_hv_call(ghcb, true, ctxt, exit_code, 0, 0); 922 + ret = sev_es_ghcb_hv_call(ghcb, ctxt, exit_code, 0, 0); 916 923 if (ret != ES_OK) 917 924 return ret; 918 925
+8 -9
arch/x86/kernel/sev.c
··· 786 786 ghcb_set_sw_scratch(ghcb, (u64)__pa(data)); 787 787 788 788 /* This will advance the shared buffer data points to. */ 789 - ret = sev_es_ghcb_hv_call(ghcb, true, &ctxt, SVM_VMGEXIT_PSC, 0, 0); 789 + ret = sev_es_ghcb_hv_call(ghcb, &ctxt, SVM_VMGEXIT_PSC, 0, 0); 790 790 791 791 /* 792 792 * Page State Change VMGEXIT can pass error code through ··· 1212 1212 ghcb_set_rdx(ghcb, regs->dx); 1213 1213 } 1214 1214 1215 - ret = sev_es_ghcb_hv_call(ghcb, true, ctxt, SVM_EXIT_MSR, 1216 - exit_info_1, 0); 1215 + ret = sev_es_ghcb_hv_call(ghcb, ctxt, SVM_EXIT_MSR, exit_info_1, 0); 1217 1216 1218 1217 if ((ret == ES_OK) && (!exit_info_1)) { 1219 1218 regs->ax = ghcb->save.rax; ··· 1451 1452 1452 1453 ghcb_set_sw_scratch(ghcb, ghcb_pa + offsetof(struct ghcb, shared_buffer)); 1453 1454 1454 - return sev_es_ghcb_hv_call(ghcb, true, ctxt, exit_code, exit_info_1, exit_info_2); 1455 + return sev_es_ghcb_hv_call(ghcb, ctxt, exit_code, exit_info_1, exit_info_2); 1455 1456 } 1456 1457 1457 1458 /* ··· 1627 1628 1628 1629 /* Using a value of 0 for ExitInfo1 means RAX holds the value */ 1629 1630 ghcb_set_rax(ghcb, val); 1630 - ret = sev_es_ghcb_hv_call(ghcb, true, ctxt, SVM_EXIT_WRITE_DR7, 0, 0); 1631 + ret = sev_es_ghcb_hv_call(ghcb, ctxt, SVM_EXIT_WRITE_DR7, 0, 0); 1631 1632 if (ret != ES_OK) 1632 1633 return ret; 1633 1634 ··· 1657 1658 static enum es_result vc_handle_wbinvd(struct ghcb *ghcb, 1658 1659 struct es_em_ctxt *ctxt) 1659 1660 { 1660 - return sev_es_ghcb_hv_call(ghcb, true, ctxt, SVM_EXIT_WBINVD, 0, 0); 1661 + return sev_es_ghcb_hv_call(ghcb, ctxt, SVM_EXIT_WBINVD, 0, 0); 1661 1662 } 1662 1663 1663 1664 static enum es_result vc_handle_rdpmc(struct ghcb *ghcb, struct es_em_ctxt *ctxt) ··· 1666 1667 1667 1668 ghcb_set_rcx(ghcb, ctxt->regs->cx); 1668 1669 1669 - ret = sev_es_ghcb_hv_call(ghcb, true, ctxt, SVM_EXIT_RDPMC, 0, 0); 1670 + ret = sev_es_ghcb_hv_call(ghcb, ctxt, SVM_EXIT_RDPMC, 0, 0); 1670 1671 if (ret != ES_OK) 1671 1672 return ret; 1672 1673 ··· 1707 1708 if (x86_platform.hyper.sev_es_hcall_prepare) 1708 1709 x86_platform.hyper.sev_es_hcall_prepare(ghcb, ctxt->regs); 1709 1710 1710 - ret = sev_es_ghcb_hv_call(ghcb, true, ctxt, SVM_EXIT_VMMCALL, 0, 0); 1711 + ret = sev_es_ghcb_hv_call(ghcb, ctxt, SVM_EXIT_VMMCALL, 0, 0); 1711 1712 if (ret != ES_OK) 1712 1713 return ret; 1713 1714 ··· 2196 2197 ghcb_set_rbx(ghcb, input->data_npages); 2197 2198 } 2198 2199 2199 - ret = sev_es_ghcb_hv_call(ghcb, true, &ctxt, exit_code, input->req_gpa, input->resp_gpa); 2200 + ret = sev_es_ghcb_hv_call(ghcb, &ctxt, exit_code, input->req_gpa, input->resp_gpa); 2200 2201 if (ret) 2201 2202 goto e_put; 2202 2203
+1
drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c
··· 138 138 &r_apb2_rsb_clk.common, 139 139 &r_apb1_ir_clk.common, 140 140 &r_apb1_w1_clk.common, 141 + &r_apb1_rtc_clk.common, 141 142 &ir_clk.common, 142 143 &w1_clk.common, 143 144 };
+8 -3
drivers/edac/ghes_edac.c
··· 103 103 104 104 dmi_memdev_name(handle, &bank, &device); 105 105 106 - /* both strings must be non-zero */ 107 - if (bank && *bank && device && *device) 108 - snprintf(dimm->label, sizeof(dimm->label), "%s %s", bank, device); 106 + /* 107 + * Set to a NULL string when both bank and device are zero. In this case, 108 + * the label assigned by default will be preserved. 109 + */ 110 + snprintf(dimm->label, sizeof(dimm->label), "%s%s%s", 111 + (bank && *bank) ? bank : "", 112 + (bank && *bank && device && *device) ? " " : "", 113 + (device && *device) ? device : ""); 109 114 } 110 115 111 116 static void assign_dmi_dimm_info(struct dimm_info *dimm, struct memdev_dmi_entry *entry)
+25 -19
drivers/edac/synopsys_edac.c
··· 514 514 memset(p, 0, sizeof(*p)); 515 515 } 516 516 517 + static void enable_intr(struct synps_edac_priv *priv) 518 + { 519 + /* Enable UE/CE Interrupts */ 520 + if (priv->p_data->quirks & DDR_ECC_INTR_SELF_CLEAR) 521 + writel(DDR_UE_MASK | DDR_CE_MASK, 522 + priv->baseaddr + ECC_CLR_OFST); 523 + else 524 + writel(DDR_QOSUE_MASK | DDR_QOSCE_MASK, 525 + priv->baseaddr + DDR_QOS_IRQ_EN_OFST); 526 + 527 + } 528 + 529 + static void disable_intr(struct synps_edac_priv *priv) 530 + { 531 + /* Disable UE/CE Interrupts */ 532 + if (priv->p_data->quirks & DDR_ECC_INTR_SELF_CLEAR) 533 + writel(0x0, priv->baseaddr + ECC_CLR_OFST); 534 + else 535 + writel(DDR_QOSUE_MASK | DDR_QOSCE_MASK, 536 + priv->baseaddr + DDR_QOS_IRQ_DB_OFST); 537 + } 538 + 517 539 /** 518 540 * intr_handler - Interrupt Handler for ECC interrupts. 519 541 * @irq: IRQ number. ··· 577 555 /* v3.0 of the controller does not have this register */ 578 556 if (!(priv->p_data->quirks & DDR_ECC_INTR_SELF_CLEAR)) 579 557 writel(regval, priv->baseaddr + DDR_QOS_IRQ_STAT_OFST); 558 + else 559 + enable_intr(priv); 560 + 580 561 return IRQ_HANDLED; 581 562 } 582 563 ··· 860 835 mci->ctl_page_to_phys = NULL; 861 836 862 837 init_csrows(mci); 863 - } 864 - 865 - static void enable_intr(struct synps_edac_priv *priv) 866 - { 867 - /* Enable UE/CE Interrupts */ 868 - if (priv->p_data->quirks & DDR_ECC_INTR_SELF_CLEAR) 869 - writel(DDR_UE_MASK | DDR_CE_MASK, 870 - priv->baseaddr + ECC_CLR_OFST); 871 - else 872 - writel(DDR_QOSUE_MASK | DDR_QOSCE_MASK, 873 - priv->baseaddr + DDR_QOS_IRQ_EN_OFST); 874 - 875 - } 876 - 877 - static void disable_intr(struct synps_edac_priv *priv) 878 - { 879 - /* Disable UE/CE Interrupts */ 880 - writel(DDR_QOSUE_MASK | DDR_QOSCE_MASK, 881 - priv->baseaddr + DDR_QOS_IRQ_DB_OFST); 882 838 } 883 839 884 840 static int setup_irq(struct mem_ctl_info *mci,
+1 -1
drivers/gpu/drm/amd/display/Kconfig
··· 6 6 bool "AMD DC - Enable new display engine" 7 7 default y 8 8 select SND_HDA_COMPONENT if SND_HDA_CORE 9 - select DRM_AMD_DC_DCN if X86 && !(KCOV_INSTRUMENT_ALL && KCOV_ENABLE_COMPARISONS) 9 + select DRM_AMD_DC_DCN if (X86 || PPC_LONG_DOUBLE_128) && !(KCOV_INSTRUMENT_ALL && KCOV_ENABLE_COMPARISONS) 10 10 help 11 11 Choose this option if you want to use the new display engine 12 12 support for AMDGPU. This adds required support for Vega and
+2
drivers/gpu/drm/i915/gt/intel_engine.h
··· 201 201 int intel_engine_stop_cs(struct intel_engine_cs *engine); 202 202 void intel_engine_cancel_stop_cs(struct intel_engine_cs *engine); 203 203 204 + void intel_engine_wait_for_pending_mi_fw(struct intel_engine_cs *engine); 205 + 204 206 void intel_engine_set_hwsp_writemask(struct intel_engine_cs *engine, u32 mask); 205 207 206 208 u64 intel_engine_get_active_head(const struct intel_engine_cs *engine);
+86 -2
drivers/gpu/drm/i915/gt/intel_engine_cs.c
··· 1282 1282 intel_uncore_write_fw(uncore, mode, _MASKED_BIT_ENABLE(STOP_RING)); 1283 1283 1284 1284 /* 1285 - * Wa_22011802037 : gen12, Prior to doing a reset, ensure CS is 1285 + * Wa_22011802037 : gen11, gen12, Prior to doing a reset, ensure CS is 1286 1286 * stopped, set ring stop bit and prefetch disable bit to halt CS 1287 1287 */ 1288 - if (GRAPHICS_VER(engine->i915) == 12) 1288 + if (IS_GRAPHICS_VER(engine->i915, 11, 12)) 1289 1289 intel_uncore_write_fw(uncore, RING_MODE_GEN7(engine->mmio_base), 1290 1290 _MASKED_BIT_ENABLE(GEN12_GFX_PREFETCH_DISABLE)); 1291 1291 ··· 1308 1308 return -ENODEV; 1309 1309 1310 1310 ENGINE_TRACE(engine, "\n"); 1311 + /* 1312 + * TODO: Find out why occasionally stopping the CS times out. Seen 1313 + * especially with gem_eio tests. 1314 + * 1315 + * Occasionally trying to stop the cs times out, but does not adversely 1316 + * affect functionality. The timeout is set as a config parameter that 1317 + * defaults to 100ms. In most cases the follow up operation is to wait 1318 + * for pending MI_FORCE_WAKES. The assumption is that this timeout is 1319 + * sufficient for any pending MI_FORCEWAKEs to complete. Once root 1320 + * caused, the caller must check and handle the return from this 1321 + * function. 1322 + */ 1311 1323 if (__intel_engine_stop_cs(engine, 1000, stop_timeout(engine))) { 1312 1324 ENGINE_TRACE(engine, 1313 1325 "timed out on STOP_RING -> IDLE; HEAD:%04x, TAIL:%04x\n", ··· 1344 1332 ENGINE_TRACE(engine, "\n"); 1345 1333 1346 1334 ENGINE_WRITE_FW(engine, RING_MI_MODE, _MASKED_BIT_DISABLE(STOP_RING)); 1335 + } 1336 + 1337 + static u32 __cs_pending_mi_force_wakes(struct intel_engine_cs *engine) 1338 + { 1339 + static const i915_reg_t _reg[I915_NUM_ENGINES] = { 1340 + [RCS0] = MSG_IDLE_CS, 1341 + [BCS0] = MSG_IDLE_BCS, 1342 + [VCS0] = MSG_IDLE_VCS0, 1343 + [VCS1] = MSG_IDLE_VCS1, 1344 + [VCS2] = MSG_IDLE_VCS2, 1345 + [VCS3] = MSG_IDLE_VCS3, 1346 + [VCS4] = MSG_IDLE_VCS4, 1347 + [VCS5] = MSG_IDLE_VCS5, 1348 + [VCS6] = MSG_IDLE_VCS6, 1349 + [VCS7] = MSG_IDLE_VCS7, 1350 + [VECS0] = MSG_IDLE_VECS0, 1351 + [VECS1] = MSG_IDLE_VECS1, 1352 + [VECS2] = MSG_IDLE_VECS2, 1353 + [VECS3] = MSG_IDLE_VECS3, 1354 + [CCS0] = MSG_IDLE_CS, 1355 + [CCS1] = MSG_IDLE_CS, 1356 + [CCS2] = MSG_IDLE_CS, 1357 + [CCS3] = MSG_IDLE_CS, 1358 + }; 1359 + u32 val; 1360 + 1361 + if (!_reg[engine->id].reg) { 1362 + drm_err(&engine->i915->drm, 1363 + "MSG IDLE undefined for engine id %u\n", engine->id); 1364 + return 0; 1365 + } 1366 + 1367 + val = intel_uncore_read(engine->uncore, _reg[engine->id]); 1368 + 1369 + /* bits[29:25] & bits[13:9] >> shift */ 1370 + return (val & (val >> 16) & MSG_IDLE_FW_MASK) >> MSG_IDLE_FW_SHIFT; 1371 + } 1372 + 1373 + static void __gpm_wait_for_fw_complete(struct intel_gt *gt, u32 fw_mask) 1374 + { 1375 + int ret; 1376 + 1377 + /* Ensure GPM receives fw up/down after CS is stopped */ 1378 + udelay(1); 1379 + 1380 + /* Wait for forcewake request to complete in GPM */ 1381 + ret = __intel_wait_for_register_fw(gt->uncore, 1382 + GEN9_PWRGT_DOMAIN_STATUS, 1383 + fw_mask, fw_mask, 5000, 0, NULL); 1384 + 1385 + /* Ensure CS receives fw ack from GPM */ 1386 + udelay(1); 1387 + 1388 + if (ret) 1389 + GT_TRACE(gt, "Failed to complete pending forcewake %d\n", ret); 1390 + } 1391 + 1392 + /* 1393 + * Wa_22011802037:gen12: In addition to stopping the cs, we need to wait for any 1394 + * pending MI_FORCE_WAKEUP requests that the CS has initiated to complete. The 1395 + * pending status is indicated by bits[13:9] (masked by bits[29:25]) in the 1396 + * MSG_IDLE register. There's one MSG_IDLE register per reset domain. Since we 1397 + * are concerned only with the gt reset here, we use a logical OR of pending 1398 + * forcewakeups from all reset domains and then wait for them to complete by 1399 + * querying PWRGT_DOMAIN_STATUS. 1400 + */ 1401 + void intel_engine_wait_for_pending_mi_fw(struct intel_engine_cs *engine) 1402 + { 1403 + u32 fw_pending = __cs_pending_mi_force_wakes(engine); 1404 + 1405 + if (fw_pending) 1406 + __gpm_wait_for_fw_complete(engine->gt, fw_pending); 1347 1407 } 1348 1408 1349 1409 static u32
+7
drivers/gpu/drm/i915/gt/intel_execlists_submission.c
··· 2968 2968 ring_set_paused(engine, 1); 2969 2969 intel_engine_stop_cs(engine); 2970 2970 2971 + /* 2972 + * Wa_22011802037:gen11/gen12: In addition to stopping the cs, we need 2973 + * to wait for any pending mi force wakeups 2974 + */ 2975 + if (IS_GRAPHICS_VER(engine->i915, 11, 12)) 2976 + intel_engine_wait_for_pending_mi_fw(engine); 2977 + 2971 2978 engine->execlists.reset_ccid = active_ccid(engine); 2972 2979 } 2973 2980
+2 -2
drivers/gpu/drm/i915/gt/uc/intel_guc.c
··· 310 310 if (IS_DG2(gt->i915)) 311 311 flags |= GUC_WA_DUAL_QUEUE; 312 312 313 - /* Wa_22011802037: graphics version 12 */ 314 - if (GRAPHICS_VER(gt->i915) == 12) 313 + /* Wa_22011802037: graphics version 11/12 */ 314 + if (IS_GRAPHICS_VER(gt->i915, 11, 12)) 315 315 flags |= GUC_WA_PRE_PARSER; 316 316 317 317 /* Wa_16011777198:dg2 */
+6 -75
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
··· 1578 1578 lrc_update_regs(ce, engine, head); 1579 1579 } 1580 1580 1581 - static u32 __cs_pending_mi_force_wakes(struct intel_engine_cs *engine) 1582 - { 1583 - static const i915_reg_t _reg[I915_NUM_ENGINES] = { 1584 - [RCS0] = MSG_IDLE_CS, 1585 - [BCS0] = MSG_IDLE_BCS, 1586 - [VCS0] = MSG_IDLE_VCS0, 1587 - [VCS1] = MSG_IDLE_VCS1, 1588 - [VCS2] = MSG_IDLE_VCS2, 1589 - [VCS3] = MSG_IDLE_VCS3, 1590 - [VCS4] = MSG_IDLE_VCS4, 1591 - [VCS5] = MSG_IDLE_VCS5, 1592 - [VCS6] = MSG_IDLE_VCS6, 1593 - [VCS7] = MSG_IDLE_VCS7, 1594 - [VECS0] = MSG_IDLE_VECS0, 1595 - [VECS1] = MSG_IDLE_VECS1, 1596 - [VECS2] = MSG_IDLE_VECS2, 1597 - [VECS3] = MSG_IDLE_VECS3, 1598 - [CCS0] = MSG_IDLE_CS, 1599 - [CCS1] = MSG_IDLE_CS, 1600 - [CCS2] = MSG_IDLE_CS, 1601 - [CCS3] = MSG_IDLE_CS, 1602 - }; 1603 - u32 val; 1604 - 1605 - if (!_reg[engine->id].reg) 1606 - return 0; 1607 - 1608 - val = intel_uncore_read(engine->uncore, _reg[engine->id]); 1609 - 1610 - /* bits[29:25] & bits[13:9] >> shift */ 1611 - return (val & (val >> 16) & MSG_IDLE_FW_MASK) >> MSG_IDLE_FW_SHIFT; 1612 - } 1613 - 1614 - static void __gpm_wait_for_fw_complete(struct intel_gt *gt, u32 fw_mask) 1615 - { 1616 - int ret; 1617 - 1618 - /* Ensure GPM receives fw up/down after CS is stopped */ 1619 - udelay(1); 1620 - 1621 - /* Wait for forcewake request to complete in GPM */ 1622 - ret = __intel_wait_for_register_fw(gt->uncore, 1623 - GEN9_PWRGT_DOMAIN_STATUS, 1624 - fw_mask, fw_mask, 5000, 0, NULL); 1625 - 1626 - /* Ensure CS receives fw ack from GPM */ 1627 - udelay(1); 1628 - 1629 - if (ret) 1630 - GT_TRACE(gt, "Failed to complete pending forcewake %d\n", ret); 1631 - } 1632 - 1633 - /* 1634 - * Wa_22011802037:gen12: In addition to stopping the cs, we need to wait for any 1635 - * pending MI_FORCE_WAKEUP requests that the CS has initiated to complete. The 1636 - * pending status is indicated by bits[13:9] (masked by bits[ 29:25]) in the 1637 - * MSG_IDLE register. There's one MSG_IDLE register per reset domain. Since we 1638 - * are concerned only with the gt reset here, we use a logical OR of pending 1639 - * forcewakeups from all reset domains and then wait for them to complete by 1640 - * querying PWRGT_DOMAIN_STATUS. 1641 - */ 1642 1581 static void guc_engine_reset_prepare(struct intel_engine_cs *engine) 1643 1582 { 1644 - u32 fw_pending; 1645 - 1646 - if (GRAPHICS_VER(engine->i915) != 12) 1583 + if (!IS_GRAPHICS_VER(engine->i915, 11, 12)) 1647 1584 return; 1648 1585 1649 - /* 1650 - * Wa_22011802037 1651 - * TODO: Occasionally trying to stop the cs times out, but does not 1652 - * adversely affect functionality. The timeout is set as a config 1653 - * parameter that defaults to 100ms. Assuming that this timeout is 1654 - * sufficient for any pending MI_FORCEWAKEs to complete, ignore the 1655 - * timeout returned here until it is root caused. 1656 - */ 1657 1586 intel_engine_stop_cs(engine); 1658 1587 1659 - fw_pending = __cs_pending_mi_force_wakes(engine); 1660 - if (fw_pending) 1661 - __gpm_wait_for_fw_complete(engine->gt, fw_pending); 1588 + /* 1589 + * Wa_22011802037:gen11/gen12: In addition to stopping the cs, we need 1590 + * to wait for any pending mi force wakeups 1591 + */ 1592 + intel_engine_wait_for_pending_mi_fw(engine); 1662 1593 } 1663 1594 1664 1595 static void guc_reset_nop(struct intel_engine_cs *engine)
+5 -1
drivers/gpu/drm/nouveau/nouveau_dmem.c
··· 680 680 goto out_free_dma; 681 681 682 682 for (i = 0; i < npages; i += max) { 683 - args.end = start + (max << PAGE_SHIFT); 683 + if (args.start + (max << PAGE_SHIFT) > end) 684 + args.end = end; 685 + else 686 + args.end = args.start + (max << PAGE_SHIFT); 687 + 684 688 ret = migrate_vma_setup(&args); 685 689 if (ret) 686 690 goto out_free_pfns;
+1 -1
drivers/gpu/drm/tiny/simpledrm.c
··· 627 627 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, 628 628 }; 629 629 630 - static int 630 + static enum drm_mode_status 631 631 simpledrm_simple_display_pipe_mode_valid(struct drm_simple_display_pipe *pipe, 632 632 const struct drm_display_mode *mode) 633 633 {
+7 -1
drivers/idle/intel_idle.c
··· 162 162 163 163 raw_local_irq_enable(); 164 164 ret = __intel_idle(dev, drv, index); 165 - raw_local_irq_disable(); 165 + 166 + /* 167 + * The lockdep hardirqs state may be changed to 'on' with timer 168 + * tick interrupt followed by __do_softirq(). Use local_irq_disable() 169 + * to keep the hardirqs state correct. 170 + */ 171 + local_irq_disable(); 166 172 167 173 return ret; 168 174 }
+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
··· 466 466 467 467 do { 468 468 fun_xdp_unmap(q, reclaim_idx); 469 - page_frag_free(q->info[reclaim_idx].vaddr); 469 + xdp_return_frame(q->info[reclaim_idx].xdpf); 470 470 471 471 trace_funeth_tx_free(q, reclaim_idx, 1, head); 472 472 ··· 479 479 return npkts; 480 480 } 481 481 482 - bool fun_xdp_tx(struct funeth_txq *q, void *data, unsigned int len) 482 + bool fun_xdp_tx(struct funeth_txq *q, struct xdp_frame *xdpf) 483 483 { 484 484 struct fun_eth_tx_req *req; 485 485 struct fun_dataop_gl *gle; 486 - unsigned int idx; 486 + unsigned int idx, len; 487 487 dma_addr_t dma; 488 488 489 489 if (fun_txq_avail(q) < FUN_XDP_CLEAN_THRES) ··· 494 494 return false; 495 495 } 496 496 497 - dma = dma_map_single(q->dma_dev, data, len, DMA_TO_DEVICE); 497 + len = xdpf->len; 498 + dma = dma_map_single(q->dma_dev, xdpf->data, len, DMA_TO_DEVICE); 498 499 if (unlikely(dma_mapping_error(q->dma_dev, dma))) { 499 500 FUN_QSTAT_INC(q, tx_map_err); 500 501 return false; ··· 515 514 gle = (struct fun_dataop_gl *)req->dataop.imm; 516 515 fun_dataop_gl_init(gle, 0, 0, len, dma); 517 516 518 - q->info[idx].vaddr = data; 517 + q->info[idx].xdpf = xdpf; 519 518 520 519 u64_stats_update_begin(&q->syncp); 521 520 q->stats.tx_bytes += len; ··· 546 545 if (unlikely(q_idx >= fp->num_xdpqs)) 547 546 return -ENXIO; 548 547 549 - for (q = xdpqs[q_idx], i = 0; i < n; i++) { 550 - const struct xdp_frame *xdpf = frames[i]; 551 - 552 - if (!fun_xdp_tx(q, xdpf->data, xdpf->len)) 548 + for (q = xdpqs[q_idx], i = 0; i < n; i++) 549 + if (!fun_xdp_tx(q, frames[i])) 553 550 break; 554 - } 555 551 556 552 if (unlikely(flags & XDP_XMIT_FLUSH)) 557 553 fun_txq_wr_db(q); ··· 575 577 unsigned int idx = q->cons_cnt & q->mask; 576 578 577 579 fun_xdp_unmap(q, idx); 578 - page_frag_free(q->info[idx].vaddr); 580 + xdp_return_frame(q->info[idx].xdpf); 579 581 q->cons_cnt++; 580 582 } 581 583 }
+3 -3
drivers/net/ethernet/fungible/funeth/funeth_txrx.h
··· 95 95 96 96 struct funeth_tx_info { /* per Tx descriptor state */ 97 97 union { 98 - struct sk_buff *skb; /* associated packet */ 99 - void *vaddr; /* start address for XDP */ 98 + struct sk_buff *skb; /* associated packet (sk_buff path) */ 99 + struct xdp_frame *xdpf; /* associated XDP frame (XDP path) */ 100 100 }; 101 101 }; 102 102 ··· 245 245 int fun_rxq_napi_poll(struct napi_struct *napi, int budget); 246 246 int fun_txq_napi_poll(struct napi_struct *napi, int budget); 247 247 netdev_tx_t fun_start_xmit(struct sk_buff *skb, struct net_device *netdev); 248 - bool fun_xdp_tx(struct funeth_txq *q, void *data, unsigned int len); 248 + bool fun_xdp_tx(struct funeth_txq *q, struct xdp_frame *xdpf); 249 249 int fun_xdp_xmit_frames(struct net_device *dev, int n, 250 250 struct xdp_frame **frames, u32 flags); 251 251
+4
drivers/net/ethernet/intel/i40e/i40e_main.c
··· 1925 1925 * non-zero req_queue_pairs says that user requested a new 1926 1926 * queue count via ethtool's set_channels, so use this 1927 1927 * value for queues distribution across traffic classes 1928 + * We need at least one queue pair for the interface 1929 + * to be usable as we see in else statement. 1928 1930 */ 1929 1931 if (vsi->req_queue_pairs > 0) 1930 1932 vsi->num_queue_pairs = vsi->req_queue_pairs; 1931 1933 else if (pf->flags & I40E_FLAG_MSIX_ENABLED) 1932 1934 vsi->num_queue_pairs = pf->num_lan_msix; 1935 + else 1936 + vsi->num_queue_pairs = 1; 1933 1937 } 1934 1938 1935 1939 /* 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); ··· 6013 6011 if (vsi->netdev) { 6014 6012 ice_set_rx_mode(vsi->netdev); 6015 6013 6016 - err = ice_vsi_vlan_setup(vsi); 6014 + if (vsi->type != ICE_VSI_LB) { 6015 + err = ice_vsi_vlan_setup(vsi); 6017 6016 6018 - if (err) 6019 - return err; 6017 + if (err) 6018 + return err; 6019 + } 6020 6020 } 6021 6021 ice_vsi_cfg_dcb_rings(vsi); 6022 6022
-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
··· 2948 2948 struct virtchnl_vlan_filtering_caps *vfc, 2949 2949 struct virtchnl_vlan_filter_list_v2 *vfl) 2950 2950 { 2951 - u16 num_requested_filters = vsi->num_vlan + vfl->num_elements; 2951 + u16 num_requested_filters = ice_vsi_num_non_zero_vlans(vsi) + 2952 + vfl->num_elements; 2952 2953 2953 2954 if (num_requested_filters > vfc->max_filters) 2954 2955 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
··· 896 896 */ 897 897 ret = xpcs_read(xpcs, MDIO_MMD_VEND2, DW_VR_MII_AN_INTR_STS); 898 898 if (ret < 0) 899 - return false; 899 + return ret; 900 900 901 901 if (ret & DW_VR_MII_C37_ANSGM_SP_LNKSTS) { 902 902 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) ||
+2
drivers/nvme/host/pci.c
··· 3515 3515 .driver_data = NVME_QUIRK_BOGUS_NID, }, 3516 3516 { PCI_DEVICE(0x1e49, 0x0041), /* ZHITAI TiPro7000 NVMe SSD */ 3517 3517 .driver_data = NVME_QUIRK_NO_DEEPEST_PS, }, 3518 + { PCI_DEVICE(0xc0a9, 0x540a), /* Crucial P2 */ 3519 + .driver_data = NVME_QUIRK_BOGUS_NID, }, 3518 3520 { PCI_DEVICE(PCI_VENDOR_ID_AMAZON, 0x0061), 3519 3521 .driver_data = NVME_QUIRK_DMA_ADDRESS_BITS_48, }, 3520 3522 { PCI_DEVICE(PCI_VENDOR_ID_AMAZON, 0x0065),
+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
+1
drivers/scsi/mpt3sas/mpt3sas_scsih.c
··· 11386 11386 _scsih_ir_shutdown(ioc); 11387 11387 _scsih_nvme_shutdown(ioc); 11388 11388 mpt3sas_base_mask_interrupts(ioc); 11389 + mpt3sas_base_stop_watchdog(ioc); 11389 11390 ioc->shost_recovery = 1; 11390 11391 mpt3sas_base_make_ioc_ready(ioc, SOFT_RESET); 11391 11392 ioc->shost_recovery = 0;
+1 -1
drivers/scsi/scsi_ioctl.c
··· 450 450 goto out_put_request; 451 451 452 452 ret = 0; 453 - if (hdr->iovec_count) { 453 + if (hdr->iovec_count && hdr->dxfer_len) { 454 454 struct iov_iter i; 455 455 struct iovec *iov = NULL; 456 456
+40 -18
drivers/ufs/core/ufshcd.c
··· 2953 2953 static int ufshcd_wait_for_dev_cmd(struct ufs_hba *hba, 2954 2954 struct ufshcd_lrb *lrbp, int max_timeout) 2955 2955 { 2956 - int err = 0; 2957 - unsigned long time_left; 2956 + unsigned long time_left = msecs_to_jiffies(max_timeout); 2958 2957 unsigned long flags; 2958 + bool pending; 2959 + int err; 2959 2960 2961 + retry: 2960 2962 time_left = wait_for_completion_timeout(hba->dev_cmd.complete, 2961 - msecs_to_jiffies(max_timeout)); 2963 + time_left); 2962 2964 2963 - spin_lock_irqsave(hba->host->host_lock, flags); 2964 - hba->dev_cmd.complete = NULL; 2965 2965 if (likely(time_left)) { 2966 + /* 2967 + * The completion handler called complete() and the caller of 2968 + * this function still owns the @lrbp tag so the code below does 2969 + * not trigger any race conditions. 2970 + */ 2971 + hba->dev_cmd.complete = NULL; 2966 2972 err = ufshcd_get_tr_ocs(lrbp); 2967 2973 if (!err) 2968 2974 err = ufshcd_dev_cmd_completion(hba, lrbp); 2969 - } 2970 - spin_unlock_irqrestore(hba->host->host_lock, flags); 2971 - 2972 - if (!time_left) { 2975 + } else { 2973 2976 err = -ETIMEDOUT; 2974 2977 dev_dbg(hba->dev, "%s: dev_cmd request timedout, tag %d\n", 2975 2978 __func__, lrbp->task_tag); 2976 - if (!ufshcd_clear_cmds(hba, 1U << lrbp->task_tag)) 2979 + if (ufshcd_clear_cmds(hba, 1U << lrbp->task_tag) == 0) { 2977 2980 /* successfully cleared the command, retry if needed */ 2978 2981 err = -EAGAIN; 2979 - /* 2980 - * in case of an error, after clearing the doorbell, 2981 - * we also need to clear the outstanding_request 2982 - * field in hba 2983 - */ 2984 - spin_lock_irqsave(&hba->outstanding_lock, flags); 2985 - __clear_bit(lrbp->task_tag, &hba->outstanding_reqs); 2986 - spin_unlock_irqrestore(&hba->outstanding_lock, flags); 2982 + /* 2983 + * Since clearing the command succeeded we also need to 2984 + * clear the task tag bit from the outstanding_reqs 2985 + * variable. 2986 + */ 2987 + spin_lock_irqsave(&hba->outstanding_lock, flags); 2988 + pending = test_bit(lrbp->task_tag, 2989 + &hba->outstanding_reqs); 2990 + if (pending) { 2991 + hba->dev_cmd.complete = NULL; 2992 + __clear_bit(lrbp->task_tag, 2993 + &hba->outstanding_reqs); 2994 + } 2995 + spin_unlock_irqrestore(&hba->outstanding_lock, flags); 2996 + 2997 + if (!pending) { 2998 + /* 2999 + * The completion handler ran while we tried to 3000 + * clear the command. 3001 + */ 3002 + time_left = 1; 3003 + goto retry; 3004 + } 3005 + } else { 3006 + dev_err(hba->dev, "%s: failed to clear tag %d\n", 3007 + __func__, lrbp->task_tag); 3008 + } 2987 3009 } 2988 3010 2989 3011 return err;
+13 -2
drivers/ufs/host/ufshcd-pltfrm.c
··· 108 108 return ret; 109 109 } 110 110 111 + static bool phandle_exists(const struct device_node *np, 112 + const char *phandle_name, int index) 113 + { 114 + struct device_node *parse_np = of_parse_phandle(np, phandle_name, index); 115 + 116 + if (parse_np) 117 + of_node_put(parse_np); 118 + 119 + return parse_np != NULL; 120 + } 121 + 111 122 #define MAX_PROP_SIZE 32 112 123 static int ufshcd_populate_vreg(struct device *dev, const char *name, 113 - struct ufs_vreg **out_vreg) 124 + struct ufs_vreg **out_vreg) 114 125 { 115 126 char prop_name[MAX_PROP_SIZE]; 116 127 struct ufs_vreg *vreg = NULL; ··· 133 122 } 134 123 135 124 snprintf(prop_name, MAX_PROP_SIZE, "%s-supply", name); 136 - if (!of_parse_phandle(np, prop_name, 0)) { 125 + if (!phandle_exists(np, prop_name, 0)) { 137 126 dev_info(dev, "%s: Unable to find %s regulator, assuming enabled\n", 138 127 __func__, prop_name); 139 128 goto out;
-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
-1
include/linux/cpuhotplug.h
··· 130 130 CPUHP_ZCOMP_PREPARE, 131 131 CPUHP_TIMERS_PREPARE, 132 132 CPUHP_MIPS_SOC_PREPARE, 133 - CPUHP_LOONGARCH_SOC_PREPARE, 134 133 CPUHP_BP_PREPARE_DYN, 135 134 CPUHP_BP_PREPARE_DYN_END = CPUHP_BP_PREPARE_DYN + 20, 136 135 CPUHP_BRINGUP_CPU,
+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
··· 2843 2843 { 2844 2844 /* Does this proto have per netns sysctl_wmem ? */ 2845 2845 if (proto->sysctl_wmem_offset) 2846 - return *(int *)((void *)sock_net(sk) + proto->sysctl_wmem_offset); 2846 + return READ_ONCE(*(int *)((void *)sock_net(sk) + proto->sysctl_wmem_offset)); 2847 2847 2848 - return *proto->sysctl_wmem; 2848 + return READ_ONCE(*proto->sysctl_wmem); 2849 2849 } 2850 2850 2851 2851 static inline int sk_get_rmem0(const struct sock *sk, const struct proto *proto) 2852 2852 { 2853 2853 /* Does this proto have per netns sysctl_rmem ? */ 2854 2854 if (proto->sysctl_rmem_offset) 2855 - return *(int *)((void *)sock_net(sk) + proto->sysctl_rmem_offset); 2855 + return READ_ONCE(*(int *)((void *)sock_net(sk) + proto->sysctl_rmem_offset)); 2856 2856 2857 - return *proto->sysctl_rmem; 2857 + return READ_ONCE(*proto->sysctl_rmem); 2858 2858 } 2859 2859 2860 2860 /* Default TCP Small queue budget is ~1 ms of data (1sec >> 10)
+1 -1
include/net/tcp.h
··· 1419 1419 1420 1420 static inline int tcp_win_from_space(const struct sock *sk, int space) 1421 1421 { 1422 - int tcp_adv_win_scale = sock_net(sk)->ipv4.sysctl_tcp_adv_win_scale; 1422 + int tcp_adv_win_scale = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_adv_win_scale); 1423 1423 1424 1424 return tcp_adv_win_scale <= 0 ? 1425 1425 (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 -2
kernel/configs/x86_debug.config
··· 7 7 CONFIG_DEBUG_KMEMLEAK=y 8 8 CONFIG_DEBUG_PAGEALLOC=y 9 9 CONFIG_SLUB_DEBUG_ON=y 10 - CONFIG_KMEMCHECK=y 11 10 CONFIG_DEBUG_OBJECTS=y 12 11 CONFIG_DEBUG_OBJECTS_ENABLE_DEFAULT=1 13 12 CONFIG_GCOV_KERNEL=y 14 13 CONFIG_LOCKDEP=y 15 14 CONFIG_PROVE_LOCKING=y 16 15 CONFIG_SCHEDSTATS=y 17 - CONFIG_VMLINUX_VALIDATION=y 16 + CONFIG_NOINSTR_VALIDATION=y 18 17 CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
+20 -10
kernel/locking/rwsem.c
··· 335 335 struct task_struct *task; 336 336 enum rwsem_waiter_type type; 337 337 unsigned long timeout; 338 - 339 - /* Writer only, not initialized in reader */ 340 338 bool handoff_set; 341 339 }; 342 340 #define rwsem_first_waiter(sem) \ ··· 457 459 * to give up the lock), request a HANDOFF to 458 460 * force the issue. 459 461 */ 460 - if (!(oldcount & RWSEM_FLAG_HANDOFF) && 461 - time_after(jiffies, waiter->timeout)) { 462 - adjustment -= RWSEM_FLAG_HANDOFF; 463 - lockevent_inc(rwsem_rlock_handoff); 462 + if (time_after(jiffies, waiter->timeout)) { 463 + if (!(oldcount & RWSEM_FLAG_HANDOFF)) { 464 + adjustment -= RWSEM_FLAG_HANDOFF; 465 + lockevent_inc(rwsem_rlock_handoff); 466 + } 467 + waiter->handoff_set = true; 464 468 } 465 469 466 470 atomic_long_add(-adjustment, &sem->count); ··· 599 599 static inline bool rwsem_try_write_lock(struct rw_semaphore *sem, 600 600 struct rwsem_waiter *waiter) 601 601 { 602 - bool first = rwsem_first_waiter(sem) == waiter; 602 + struct rwsem_waiter *first = rwsem_first_waiter(sem); 603 603 long count, new; 604 604 605 605 lockdep_assert_held(&sem->wait_lock); ··· 609 609 bool has_handoff = !!(count & RWSEM_FLAG_HANDOFF); 610 610 611 611 if (has_handoff) { 612 - if (!first) 612 + /* 613 + * Honor handoff bit and yield only when the first 614 + * waiter is the one that set it. Otherwisee, we 615 + * still try to acquire the rwsem. 616 + */ 617 + if (first->handoff_set && (waiter != first)) 613 618 return false; 614 619 615 - /* First waiter inherits a previously set handoff bit */ 616 - waiter->handoff_set = true; 620 + /* 621 + * First waiter can inherit a previously set handoff 622 + * bit and spin on rwsem if lock acquisition fails. 623 + */ 624 + if (waiter == first) 625 + waiter->handoff_set = true; 617 626 } 618 627 619 628 new = count; ··· 1036 1027 waiter.task = current; 1037 1028 waiter.type = RWSEM_WAITING_FOR_READ; 1038 1029 waiter.timeout = jiffies + RWSEM_WAIT_TIMEOUT; 1030 + waiter.handoff_set = false; 1039 1031 1040 1032 raw_spin_lock_irq(&sem->wait_lock); 1041 1033 if (list_empty(&sem->wait_list)) {
+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 -1
kernel/workqueue.c
··· 5001 5001 5002 5002 for_each_pool_worker(worker, pool) { 5003 5003 kthread_set_per_cpu(worker->task, -1); 5004 - WARN_ON_ONCE(set_cpus_allowed_ptr(worker->task, wq_unbound_cpumask) < 0); 5004 + if (cpumask_intersects(wq_unbound_cpumask, cpu_active_mask)) 5005 + WARN_ON_ONCE(set_cpus_allowed_ptr(worker->task, wq_unbound_cpumask) < 0); 5006 + else 5007 + WARN_ON_ONCE(set_cpus_allowed_ptr(worker->task, cpu_possible_mask) < 0); 5005 5008 } 5006 5009 5007 5010 mutex_unlock(&wq_pool_attach_mutex);
+8 -11
mm/hmm.c
··· 212 212 unsigned long end, unsigned long hmm_pfns[], pmd_t pmd); 213 213 #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ 214 214 215 - static inline bool hmm_is_device_private_entry(struct hmm_range *range, 216 - swp_entry_t entry) 217 - { 218 - return is_device_private_entry(entry) && 219 - pfn_swap_entry_to_page(entry)->pgmap->owner == 220 - range->dev_private_owner; 221 - } 222 - 223 215 static inline unsigned long pte_to_hmm_pfn_flags(struct hmm_range *range, 224 216 pte_t pte) 225 217 { ··· 244 252 swp_entry_t entry = pte_to_swp_entry(pte); 245 253 246 254 /* 247 - * Never fault in device private pages, but just report 248 - * the PFN even if not present. 255 + * Don't fault in device private pages owned by the caller, 256 + * just report the PFN. 249 257 */ 250 - if (hmm_is_device_private_entry(range, entry)) { 258 + if (is_device_private_entry(entry) && 259 + pfn_swap_entry_to_page(entry)->pgmap->owner == 260 + range->dev_private_owner) { 251 261 cpu_flags = HMM_PFN_VALID; 252 262 if (is_writable_device_private_entry(entry)) 253 263 cpu_flags |= HMM_PFN_WRITE; ··· 265 271 } 266 272 267 273 if (!non_swap_entry(entry)) 274 + goto fault; 275 + 276 + if (is_device_private_entry(entry)) 268 277 goto fault; 269 278 270 279 if (is_device_exclusive_entry(entry))
+8 -4
mm/page_alloc.c
··· 3968 3968 * need to be calculated. 3969 3969 */ 3970 3970 if (!order) { 3971 - long fast_free; 3971 + long usable_free; 3972 + long reserved; 3972 3973 3973 - fast_free = free_pages; 3974 - fast_free -= __zone_watermark_unusable_free(z, 0, alloc_flags); 3975 - if (fast_free > mark + z->lowmem_reserve[highest_zoneidx]) 3974 + usable_free = free_pages; 3975 + reserved = __zone_watermark_unusable_free(z, 0, alloc_flags); 3976 + 3977 + /* reserved may over estimate high-atomic reserves. */ 3978 + usable_free -= min(usable_free, reserved); 3979 + if (usable_free > mark + z->lowmem_reserve[highest_zoneidx]) 3976 3980 return true; 3977 3981 } 3978 3982
+3 -3
net/bluetooth/hci_sync.c
··· 4973 4973 return err; 4974 4974 } 4975 4975 4976 + /* Update event mask so only the allowed event can wakeup the host */ 4977 + hci_set_event_mask_sync(hdev); 4978 + 4976 4979 /* Only configure accept list if disconnect succeeded and wake 4977 4980 * isn't being prevented. 4978 4981 */ ··· 4986 4983 4987 4984 /* Unpause to take care of updating scanning params */ 4988 4985 hdev->scanning_paused = false; 4989 - 4990 - /* Update event mask so only the allowed event can wakeup the host */ 4991 - hci_set_event_mask_sync(hdev); 4992 4986 4993 4987 /* Enable event filter for paired devices */ 4994 4988 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) ··· 1991 1968 src_match = !bacmp(&c->src, src); 1992 1969 dst_match = !bacmp(&c->dst, dst); 1993 1970 if (src_match && dst_match) { 1994 - l2cap_chan_hold(c); 1971 + c = l2cap_chan_hold_unless_zero(c); 1972 + if (!c) 1973 + continue; 1974 + 1995 1975 read_unlock(&chan_list_lock); 1996 1976 return c; 1997 1977 } ··· 2009 1983 } 2010 1984 2011 1985 if (c1) 2012 - l2cap_chan_hold(c1); 1986 + c1 = l2cap_chan_hold_unless_zero(c1); 2013 1987 2014 1988 read_unlock(&chan_list_lock); 2015 1989 ··· 4489 4463 4490 4464 unlock: 4491 4465 l2cap_chan_unlock(chan); 4466 + l2cap_chan_put(chan); 4492 4467 return err; 4493 4468 } 4494 4469 ··· 4604 4577 4605 4578 done: 4606 4579 l2cap_chan_unlock(chan); 4580 + l2cap_chan_put(chan); 4607 4581 return err; 4608 4582 } 4609 4583 ··· 5332 5304 l2cap_send_move_chan_rsp(chan, result); 5333 5305 5334 5306 l2cap_chan_unlock(chan); 5307 + l2cap_chan_put(chan); 5335 5308 5336 5309 return 0; 5337 5310 } ··· 5425 5396 } 5426 5397 5427 5398 l2cap_chan_unlock(chan); 5399 + l2cap_chan_put(chan); 5428 5400 } 5429 5401 5430 5402 static void l2cap_move_fail(struct l2cap_conn *conn, u8 ident, u16 icid, ··· 5455 5425 l2cap_send_move_chan_cfm(chan, L2CAP_MC_UNCONFIRMED); 5456 5426 5457 5427 l2cap_chan_unlock(chan); 5428 + l2cap_chan_put(chan); 5458 5429 } 5459 5430 5460 5431 static int l2cap_move_channel_rsp(struct l2cap_conn *conn, ··· 5519 5488 l2cap_send_move_chan_cfm_rsp(conn, cmd->ident, icid); 5520 5489 5521 5490 l2cap_chan_unlock(chan); 5491 + l2cap_chan_put(chan); 5522 5492 5523 5493 return 0; 5524 5494 } ··· 5555 5523 } 5556 5524 5557 5525 l2cap_chan_unlock(chan); 5526 + l2cap_chan_put(chan); 5558 5527 5559 5528 return 0; 5560 5529 } ··· 5928 5895 if (credits > max_credits) { 5929 5896 BT_ERR("LE credits overflow"); 5930 5897 l2cap_send_disconn_req(chan, ECONNRESET); 5931 - l2cap_chan_unlock(chan); 5932 5898 5933 5899 /* Return 0 so that we don't trigger an unnecessary 5934 5900 * command reject packet. 5935 5901 */ 5936 - return 0; 5902 + goto unlock; 5937 5903 } 5938 5904 5939 5905 chan->tx_credits += credits; ··· 5943 5911 if (chan->tx_credits) 5944 5912 chan->ops->resume(chan); 5945 5913 5914 + unlock: 5946 5915 l2cap_chan_unlock(chan); 5916 + l2cap_chan_put(chan); 5947 5917 5948 5918 return 0; 5949 5919 } ··· 7631 7597 7632 7598 done: 7633 7599 l2cap_chan_unlock(chan); 7600 + l2cap_chan_put(chan); 7634 7601 } 7635 7602 7636 7603 static void l2cap_conless_channel(struct l2cap_conn *conn, __le16 psm, ··· 8120 8085 if (src_type != c->src_type) 8121 8086 continue; 8122 8087 8123 - l2cap_chan_hold(c); 8088 + c = l2cap_chan_hold_unless_zero(c); 8124 8089 read_unlock(&chan_list_lock); 8125 8090 return c; 8126 8091 }
-1
net/bluetooth/mgmt.c
··· 4723 4723 else 4724 4724 status = MGMT_STATUS_FAILED; 4725 4725 4726 - mgmt_pending_remove(cmd); 4727 4726 goto unlock; 4728 4727 } 4729 4728
+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
··· 480 480 sk->sk_family = PF_DECnet; 481 481 sk->sk_protocol = 0; 482 482 sk->sk_allocation = gfp; 483 - sk->sk_sndbuf = sysctl_decnet_wmem[1]; 484 - sk->sk_rcvbuf = sysctl_decnet_rmem[1]; 483 + sk->sk_sndbuf = READ_ONCE(sysctl_decnet_wmem[1]); 484 + sk->sk_rcvbuf = READ_ONCE(sysctl_decnet_rmem[1]); 485 485 486 486 /* Initialization of DECnet Session Control Port */ 487 487 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
··· 452 452 453 453 icsk->icsk_sync_mss = tcp_sync_mss; 454 454 455 - WRITE_ONCE(sk->sk_sndbuf, sock_net(sk)->ipv4.sysctl_tcp_wmem[1]); 456 - WRITE_ONCE(sk->sk_rcvbuf, sock_net(sk)->ipv4.sysctl_tcp_rmem[1]); 455 + WRITE_ONCE(sk->sk_sndbuf, READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_wmem[1])); 456 + WRITE_ONCE(sk->sk_rcvbuf, READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[1])); 457 457 458 458 sk_sockets_allocated_inc(sk); 459 459 } ··· 686 686 int size_goal) 687 687 { 688 688 return skb->len < size_goal && 689 - sock_net(sk)->ipv4.sysctl_tcp_autocorking && 689 + READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_autocorking) && 690 690 !tcp_rtx_queue_empty(sk) && 691 691 refcount_read(&sk->sk_wmem_alloc) > skb->truesize && 692 692 tcp_skb_can_collapse_to(skb); ··· 1724 1724 if (sk->sk_userlocks & SOCK_RCVBUF_LOCK) 1725 1725 cap = sk->sk_rcvbuf >> 1; 1726 1726 else 1727 - cap = sock_net(sk)->ipv4.sysctl_tcp_rmem[2] >> 1; 1727 + cap = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[2]) >> 1; 1728 1728 val = min(val, cap); 1729 1729 WRITE_ONCE(sk->sk_rcvlowat, val ? : 1); 1730 1730 ··· 4459 4459 return SKB_DROP_REASON_TCP_MD5UNEXPECTED; 4460 4460 } 4461 4461 4462 - /* check the signature */ 4463 - genhash = tp->af_specific->calc_md5_hash(newhash, hash_expected, 4464 - NULL, skb); 4462 + /* Check the signature. 4463 + * To support dual stack listeners, we need to handle 4464 + * IPv4-mapped case. 4465 + */ 4466 + if (family == AF_INET) 4467 + genhash = tcp_v4_md5_hash_skb(newhash, 4468 + hash_expected, 4469 + NULL, skb); 4470 + else 4471 + genhash = tp->af_specific->calc_md5_hash(newhash, 4472 + hash_expected, 4473 + NULL, skb); 4465 4474 4466 4475 if (genhash || memcmp(hash_location, newhash, 16) != 0) { 4467 4476 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 ··· 911 910 * end of slow start and should slow down. 912 911 */ 913 912 if (tcp_snd_cwnd(tp) < tp->snd_ssthresh / 2) 914 - rate *= sock_net(sk)->ipv4.sysctl_tcp_pacing_ss_ratio; 913 + rate *= READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_pacing_ss_ratio); 915 914 else 916 - rate *= sock_net(sk)->ipv4.sysctl_tcp_pacing_ca_ratio; 915 + rate *= READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_pacing_ca_ratio); 917 916 918 917 rate *= max(tcp_snd_cwnd(tp), tp->packets_out); 919 918 ··· 2176 2175 * loss recovery is underway except recurring timeout(s) on 2177 2176 * the same SND.UNA (sec 3.2). Disable F-RTO on path MTU probing 2178 2177 */ 2179 - tp->frto = net->ipv4.sysctl_tcp_frto && 2178 + tp->frto = READ_ONCE(net->ipv4.sysctl_tcp_frto) && 2180 2179 (new_recovery || icsk->icsk_retransmits) && 2181 2180 !inet_csk(sk)->icsk_mtup.probe_size; 2182 2181 } ··· 3059 3058 3060 3059 static void tcp_update_rtt_min(struct sock *sk, u32 rtt_us, const int flag) 3061 3060 { 3062 - u32 wlen = sock_net(sk)->ipv4.sysctl_tcp_min_rtt_wlen * HZ; 3061 + u32 wlen = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_min_rtt_wlen) * HZ; 3063 3062 struct tcp_sock *tp = tcp_sk(sk); 3064 3063 3065 3064 if ((flag & FLAG_ACK_MAYBE_DELAYED) && rtt_us > tcp_min_rtt(tp)) { ··· 3582 3581 if (*last_oow_ack_time) { 3583 3582 s32 elapsed = (s32)(tcp_jiffies32 - *last_oow_ack_time); 3584 3583 3585 - if (0 <= elapsed && elapsed < net->ipv4.sysctl_tcp_invalid_ratelimit) { 3584 + if (0 <= elapsed && 3585 + elapsed < READ_ONCE(net->ipv4.sysctl_tcp_invalid_ratelimit)) { 3586 3586 NET_INC_STATS(net, mib_idx); 3587 3587 return true; /* rate-limited: don't send yet! */ 3588 3588 } ··· 3631 3629 /* Then check host-wide RFC 5961 rate limit. */ 3632 3630 now = jiffies / HZ; 3633 3631 if (now != challenge_timestamp) { 3634 - u32 ack_limit = net->ipv4.sysctl_tcp_challenge_ack_limit; 3632 + u32 ack_limit = READ_ONCE(net->ipv4.sysctl_tcp_challenge_ack_limit); 3635 3633 u32 half = (ack_limit + 1) >> 1; 3636 3634 3637 3635 challenge_timestamp = now; ··· 4428 4426 { 4429 4427 struct tcp_sock *tp = tcp_sk(sk); 4430 4428 4431 - if (tcp_is_sack(tp) && sock_net(sk)->ipv4.sysctl_tcp_dsack) { 4429 + if (tcp_is_sack(tp) && READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_dsack)) { 4432 4430 int mib_idx; 4433 4431 4434 4432 if (before(seq, tp->rcv_nxt)) ··· 4475 4473 NET_INC_STATS(sock_net(sk), LINUX_MIB_DELAYEDACKLOST); 4476 4474 tcp_enter_quickack_mode(sk, TCP_MAX_QUICKACKS); 4477 4475 4478 - if (tcp_is_sack(tp) && sock_net(sk)->ipv4.sysctl_tcp_dsack) { 4476 + if (tcp_is_sack(tp) && READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_dsack)) { 4479 4477 u32 end_seq = TCP_SKB_CB(skb)->end_seq; 4480 4478 4481 4479 tcp_rcv_spurious_retrans(sk, skb); ··· 5521 5519 } 5522 5520 5523 5521 if (!tcp_is_sack(tp) || 5524 - tp->compressed_ack >= sock_net(sk)->ipv4.sysctl_tcp_comp_sack_nr) 5522 + tp->compressed_ack >= READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_comp_sack_nr)) 5525 5523 goto send_now; 5526 5524 5527 5525 if (tp->compressed_ack_rcv_nxt != tp->rcv_nxt) { ··· 5542 5540 if (tp->srtt_us && tp->srtt_us < rtt) 5543 5541 rtt = tp->srtt_us; 5544 5542 5545 - delay = min_t(unsigned long, sock_net(sk)->ipv4.sysctl_tcp_comp_sack_delay_ns, 5543 + delay = min_t(unsigned long, 5544 + READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_comp_sack_delay_ns), 5546 5545 rtt * (NSEC_PER_USEC >> 3)/20); 5547 5546 sock_hold(sk); 5548 5547 hrtimer_start_range_ns(&tp->compressed_ack_timer, ns_to_ktime(delay), 5549 - sock_net(sk)->ipv4.sysctl_tcp_comp_sack_slack_ns, 5548 + READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_comp_sack_slack_ns), 5550 5549 HRTIMER_MODE_REL_PINNED_SOFT); 5551 5550 } 5552 5551
+2 -2
net/ipv4/tcp_ipv4.c
··· 1006 1006 if (skb) { 1007 1007 __tcp_v4_send_check(skb, ireq->ir_loc_addr, ireq->ir_rmt_addr); 1008 1008 1009 - tos = sock_net(sk)->ipv4.sysctl_tcp_reflect_tos ? 1009 + tos = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_reflect_tos) ? 1010 1010 (tcp_rsk(req)->syn_tos & ~INET_ECN_MASK) | 1011 1011 (inet_sk(sk)->tos & INET_ECN_MASK) : 1012 1012 inet_sk(sk)->tos; ··· 1526 1526 /* Set ToS of the new socket based upon the value of incoming SYN. 1527 1527 * ECT bits are set later in tcp_init_transfer(). 1528 1528 */ 1529 - if (sock_net(sk)->ipv4.sysctl_tcp_reflect_tos) 1529 + if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_reflect_tos)) 1530 1530 newinet->tos = tcp_rsk(req)->syn_tos & ~INET_ECN_MASK; 1531 1531 1532 1532 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) ··· 186 181 .owner = THIS_MODULE, 187 182 .init = ping_init_sock, 188 183 .close = ping_close, 184 + .destroy = ping_v6_destroy, 189 185 .connect = ip6_datagram_connect_v6_only, 190 186 .disconnect = __udp_disconnect, 191 187 .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; ··· 1314 1314 /* Set ToS of the new socket based upon the value of incoming SYN. 1315 1315 * ECT bits are set later in tcp_init_transfer(). 1316 1316 */ 1317 - if (sock_net(sk)->ipv4.sysctl_tcp_reflect_tos) 1317 + if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_reflect_tos)) 1318 1318 newnp->tclass = tcp_rsk(req)->syn_tos & ~INET_ECN_MASK; 1319 1319 1320 1320 /* Clone native IPv6 options from listening socket (if any)
+1 -2
net/mac80211/iface.c
··· 377 377 bool cancel_scan; 378 378 struct cfg80211_nan_func *func; 379 379 380 - spin_lock_bh(&local->fq.lock); 381 380 clear_bit(SDATA_STATE_RUNNING, &sdata->state); 382 - spin_unlock_bh(&local->fq.lock); 381 + synchronize_rcu(); /* flush _ieee80211_wake_txqs() */ 383 382 384 383 cancel_scan = rcu_access_pointer(local->scan_sdata) == sdata; 385 384 if (cancel_scan)
+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
··· 1908 1908 if (msk->rcvq_space.copied <= msk->rcvq_space.space) 1909 1909 goto new_measure; 1910 1910 1911 - if (sock_net(sk)->ipv4.sysctl_tcp_moderate_rcvbuf && 1911 + if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_moderate_rcvbuf) && 1912 1912 !(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) { 1913 1913 int rcvmem, rcvbuf; 1914 1914 u64 rcvwin, grow; ··· 1926 1926 1927 1927 do_div(rcvwin, advmss); 1928 1928 rcvbuf = min_t(u64, rcvwin * rcvmem, 1929 - sock_net(sk)->ipv4.sysctl_tcp_rmem[2]); 1929 + READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[2])); 1930 1930 1931 1931 if (rcvbuf > sk->sk_rcvbuf) { 1932 1932 u32 window_clamp; ··· 2669 2669 mptcp_ca_reset(sk); 2670 2670 2671 2671 sk_sockets_allocated_inc(sk); 2672 - sk->sk_rcvbuf = sock_net(sk)->ipv4.sysctl_tcp_rmem[1]; 2673 - sk->sk_sndbuf = sock_net(sk)->ipv4.sysctl_tcp_wmem[1]; 2672 + sk->sk_rcvbuf = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[1]); 2673 + sk->sk_sndbuf = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_wmem[1]); 2674 2674 2675 2675 return 0; 2676 2676 }
+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
··· 1376 1376 * by tls_device_free_ctx. rx_conf and tx_conf stay in TLS_HW. 1377 1377 * Now release the ref taken above. 1378 1378 */ 1379 - if (refcount_dec_and_test(&ctx->refcount)) 1379 + if (refcount_dec_and_test(&ctx->refcount)) { 1380 + /* sk_destruct ran after tls_device_down took a ref, and 1381 + * it returned early. Complete the destruction here. 1382 + */ 1383 + list_del(&ctx->list); 1380 1384 tls_device_free_ctx(ctx); 1385 + } 1381 1386 } 1382 1387 1383 1388 up_write(&device_offload_lock);
+1
tools/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 */
+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 */
+18 -16
tools/perf/scripts/python/arm-cs-trace-disasm.py
··· 61 61 62 62 def get_offset(perf_dict, field): 63 63 if field in perf_dict: 64 - return f"+0x{perf_dict[field]:x}" 64 + return "+%#x" % perf_dict[field] 65 65 return "" 66 66 67 67 def get_dso_file_path(dso_name, dso_build_id): ··· 76 76 else: 77 77 append = "/elf" 78 78 79 - dso_path = f"{os.environ['PERF_BUILDID_DIR']}/{dso_name}/{dso_build_id}{append}" 79 + dso_path = os.environ['PERF_BUILDID_DIR'] + "/" + dso_name + "/" + dso_build_id + append; 80 80 # Replace duplicate slash chars to single slash char 81 81 dso_path = dso_path.replace('//', '/', 1) 82 82 return dso_path ··· 94 94 start_addr = start_addr - dso_start; 95 95 stop_addr = stop_addr - dso_start; 96 96 disasm = [ options.objdump_name, "-d", "-z", 97 - f"--start-address=0x{start_addr:x}", 98 - f"--stop-address=0x{stop_addr:x}" ] 97 + "--start-address="+format(start_addr,"#x"), 98 + "--stop-address="+format(stop_addr,"#x") ] 99 99 disasm += [ dso_fname ] 100 100 disasm_output = check_output(disasm).decode('utf-8').split('\n') 101 101 disasm_cache[addr_range] = disasm_output ··· 109 109 m = disasm_re.search(line) 110 110 if m is None: 111 111 continue 112 - print(f"\t{line}") 112 + print("\t" + line) 113 113 114 114 def print_sample(sample): 115 - print(f"Sample = {{ cpu: {sample['cpu']:04} addr: 0x{sample['addr']:016x} " \ 116 - f"phys_addr: 0x{sample['phys_addr']:016x} ip: 0x{sample['ip']:016x} " \ 117 - f"pid: {sample['pid']} tid: {sample['tid']} period: {sample['period']} time: {sample['time']} }}") 115 + print("Sample = { cpu: %04d addr: 0x%016x phys_addr: 0x%016x ip: 0x%016x " \ 116 + "pid: %d tid: %d period: %d time: %d }" % \ 117 + (sample['cpu'], sample['addr'], sample['phys_addr'], \ 118 + sample['ip'], sample['pid'], sample['tid'], \ 119 + sample['period'], sample['time'])) 118 120 119 121 def trace_begin(): 120 122 print('ARM CoreSight Trace Data Assembler Dump') ··· 133 131 cpu = sample["cpu"] 134 132 pid = sample["pid"] 135 133 tid = sample["tid"] 136 - return f"{comm:>16} {pid:>5}/{tid:<5} [{cpu:04}] {sec:9}.{ns:09} " 134 + return "%16s %5u/%-5u [%04u] %9u.%09u " % (comm, pid, tid, cpu, sec, ns) 137 135 138 136 # This code is copied from intel-pt-events.py for printing source code 139 137 # line and symbols. ··· 173 171 glb_line_number = line_number 174 172 glb_source_file_name = source_file_name 175 173 176 - print(f"{start_str}{src_str}") 174 + print(start_str, src_str) 177 175 178 176 def process_event(param_dict): 179 177 global cache_size ··· 190 188 symbol = get_optional(param_dict, "symbol") 191 189 192 190 if (options.verbose == True): 193 - print(f"Event type: {name}") 191 + print("Event type: %s" % name) 194 192 print_sample(sample) 195 193 196 194 # If cannot find dso so cannot dump assembler, bail out ··· 199 197 200 198 # Validate dso start and end addresses 201 199 if ((dso_start == '[unknown]') or (dso_end == '[unknown]')): 202 - print(f"Failed to find valid dso map for dso {dso}") 200 + print("Failed to find valid dso map for dso %s" % dso) 203 201 return 204 202 205 203 if (name[0:12] == "instructions"): ··· 246 244 247 245 # Handle CS_ETM_TRACE_ON packet if start_addr=0 and stop_addr=4 248 246 if (start_addr == 0 and stop_addr == 4): 249 - print(f"CPU{cpu}: CS_ETM_TRACE_ON packet is inserted") 247 + print("CPU%d: CS_ETM_TRACE_ON packet is inserted" % cpu) 250 248 return 251 249 252 250 if (start_addr < int(dso_start) or start_addr > int(dso_end)): 253 - print(f"Start address 0x{start_addr:x} is out of range [ 0x{dso_start:x} .. 0x{dso_end:x} ] for dso {dso}") 251 + print("Start address 0x%x is out of range [ 0x%x .. 0x%x ] for dso %s" % (start_addr, int(dso_start), int(dso_end), dso)) 254 252 return 255 253 256 254 if (stop_addr < int(dso_start) or stop_addr > int(dso_end)): 257 - print(f"Stop address 0x{stop_addr:x} is out of range [ 0x{dso_start:x} .. 0x{dso_end:x} ] for dso {dso}") 255 + print("Stop address 0x%x is out of range [ 0x%x .. 0x%x ] for dso %s" % (stop_addr, int(dso_start), int(dso_end), dso)) 258 256 return 259 257 260 258 if (options.objdump_name != None): ··· 269 267 if path.exists(dso_fname): 270 268 print_disam(dso_fname, dso_vm_start, start_addr, stop_addr) 271 269 else: 272 - print(f"Failed to find dso {dso} for address range [ 0x{start_addr:x} .. 0x{stop_addr:x} ]") 270 + print("Failed to find dso %s for address range [ 0x%x .. 0x%x ]" % (dso, start_addr, stop_addr)) 273 271 274 272 print_srccode(comm, param_dict, sample, symbol, dso)
+7 -11
tools/perf/util/bpf-loader.c
··· 63 63 static struct bpf_perf_object * 64 64 bpf_perf_object__next(struct bpf_perf_object *prev) 65 65 { 66 - struct bpf_perf_object *next; 66 + if (!prev) { 67 + if (list_empty(&bpf_objects_list)) 68 + return NULL; 67 69 68 - if (!prev) 69 - next = list_first_entry(&bpf_objects_list, 70 - struct bpf_perf_object, 71 - list); 72 - else 73 - next = list_next_entry(prev, list); 74 - 75 - /* Empty list is noticed here so don't need checking on entry. */ 76 - if (&next->list == &bpf_objects_list) 70 + return list_first_entry(&bpf_objects_list, struct bpf_perf_object, list); 71 + } 72 + if (list_is_last(&prev->list, &bpf_objects_list)) 77 73 return NULL; 78 74 79 - return next; 75 + return list_next_entry(prev, list); 80 76 } 81 77 82 78 #define bpf_perf_object__for_each(perf_obj, tmp) \
+52 -4
tools/perf/util/symbol-elf.c
··· 233 233 return NULL; 234 234 } 235 235 236 + static int elf_read_program_header(Elf *elf, u64 vaddr, GElf_Phdr *phdr) 237 + { 238 + size_t i, phdrnum; 239 + u64 sz; 240 + 241 + if (elf_getphdrnum(elf, &phdrnum)) 242 + return -1; 243 + 244 + for (i = 0; i < phdrnum; i++) { 245 + if (gelf_getphdr(elf, i, phdr) == NULL) 246 + return -1; 247 + 248 + if (phdr->p_type != PT_LOAD) 249 + continue; 250 + 251 + sz = max(phdr->p_memsz, phdr->p_filesz); 252 + if (!sz) 253 + continue; 254 + 255 + if (vaddr >= phdr->p_vaddr && (vaddr < phdr->p_vaddr + sz)) 256 + return 0; 257 + } 258 + 259 + /* Not found any valid program header */ 260 + return -1; 261 + } 262 + 236 263 static bool want_demangle(bool is_kernel_sym) 237 264 { 238 265 return is_kernel_sym ? symbol_conf.demangle_kernel : symbol_conf.demangle; ··· 1236 1209 sym.st_value); 1237 1210 used_opd = true; 1238 1211 } 1212 + 1239 1213 /* 1240 1214 * When loading symbols in a data mapping, ABS symbols (which 1241 1215 * has a value of SHN_ABS in its st_shndx) failed at ··· 1254 1226 goto out_elf_end; 1255 1227 1256 1228 gelf_getshdr(sec, &shdr); 1229 + 1230 + /* 1231 + * If the attribute bit SHF_ALLOC is not set, the section 1232 + * doesn't occupy memory during process execution. 1233 + * E.g. ".gnu.warning.*" section is used by linker to generate 1234 + * warnings when calling deprecated functions, the symbols in 1235 + * the section aren't loaded to memory during process execution, 1236 + * so skip them. 1237 + */ 1238 + if (!(shdr.sh_flags & SHF_ALLOC)) 1239 + continue; 1257 1240 1258 1241 secstrs = secstrs_sym; 1259 1242 ··· 1301 1262 goto out_elf_end; 1302 1263 } else if ((used_opd && runtime_ss->adjust_symbols) || 1303 1264 (!used_opd && syms_ss->adjust_symbols)) { 1265 + GElf_Phdr phdr; 1266 + 1267 + if (elf_read_program_header(syms_ss->elf, 1268 + (u64)sym.st_value, &phdr)) { 1269 + pr_warning("%s: failed to find program header for " 1270 + "symbol: %s st_value: %#" PRIx64 "\n", 1271 + __func__, elf_name, (u64)sym.st_value); 1272 + continue; 1273 + } 1304 1274 pr_debug4("%s: adjusting symbol: st_value: %#" PRIx64 " " 1305 - "sh_addr: %#" PRIx64 " sh_offset: %#" PRIx64 "\n", __func__, 1306 - (u64)sym.st_value, (u64)shdr.sh_addr, 1307 - (u64)shdr.sh_offset); 1308 - sym.st_value -= shdr.sh_addr - shdr.sh_offset; 1275 + "p_vaddr: %#" PRIx64 " p_offset: %#" PRIx64 "\n", 1276 + __func__, (u64)sym.st_value, (u64)phdr.p_vaddr, 1277 + (u64)phdr.p_offset); 1278 + sym.st_value -= phdr.p_vaddr - phdr.p_offset; 1309 1279 } 1310 1280 1311 1281 demangled = demangle_sym(dso, kmodule, elf_name);