History

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.

Arnaldo Carvalho de Melo committed 4 years ago

Commit 18808562 parents 9a0b362 3d7cb6b137 files · +1184 −1011Browse files

Unified · Split

137 files
  1. .mailmap +4 −0
  2. Documentation/admin-guide/kernel-parameters.txt +2 −0
  3. Documentation/devicetree/bindings/net/ethernet-controller.yaml +59 −64
  4. Documentation/devicetree/bindings/net/fsl,fec.yaml +3 −0
  5. Documentation/networking/ip-sysctl.rst +8 −1
  6. Makefile +1 −1
  7. arch/arm/boot/dts/lan966x.dtsi +1 −1
  8. arch/arm/include/asm/dma.h +1 −1
  9. arch/arm/lib/findbit.S +8 −8
  10. arch/arm/mach-pxa/corgi.c +1 −1
  11. arch/arm/mach-pxa/hx4700.c +1 −1
  12. arch/arm/mach-pxa/icontrol.c +2 −2
  13. arch/arm/mach-pxa/littleton.c +1 −1
  14. arch/arm/mach-pxa/magician.c +1 −1
  15. arch/arm/mach-pxa/spitz.c +1 −1
  16. arch/arm/mach-pxa/z2.c +2 −2
  17. arch/loongarch/Kconfig +0 −1
  18. arch/loongarch/include/asm/asmmacro.h +0 −12
  19. arch/loongarch/include/asm/atomic.h +16 −21
  20. arch/loongarch/include/asm/barrier.h +2 −2
  21. arch/loongarch/include/asm/cmpxchg.h +2 −2
  22. arch/loongarch/include/asm/compiler.h +0 −15
  23. arch/loongarch/include/asm/elf.h +0 −2
  24. arch/loongarch/include/asm/futex.h +5 −6
  25. arch/loongarch/include/asm/irqflags.h +0 −1
  26. arch/loongarch/include/asm/local.h +0 −1
  27. arch/loongarch/include/asm/loongson.h +2 −14
  28. arch/loongarch/include/asm/stacktrace.h +6 −6
  29. arch/loongarch/include/asm/thread_info.h +2 −2
  30. arch/loongarch/include/asm/uaccess.h +1 −1
  31. arch/loongarch/kernel/cacheinfo.c +9 −2
  32. arch/loongarch/kernel/entry.S +2 −2
  33. arch/loongarch/kernel/env.c +0 −20
  34. arch/loongarch/kernel/fpu.S +87 −87
  35. arch/loongarch/kernel/genex.S +6 −6
  36. arch/loongarch/kernel/head.S +4 −4
  37. arch/loongarch/kernel/ptrace.c +7 −5
  38. arch/loongarch/kernel/reset.c +0 −1
  39. arch/loongarch/kernel/setup.c +1 −1
  40. arch/loongarch/kernel/smp.c +13 −100
  41. arch/loongarch/kernel/switch.S +2 −2
  42. arch/loongarch/lib/clear_user.S +1 −1
  43. arch/loongarch/lib/copy_user.S +1 −1
  44. arch/loongarch/lib/delay.c +0 −1
  45. arch/loongarch/mm/page.S +59 −59
  46. arch/loongarch/mm/tlbex.S +49 −49
  47. arch/powerpc/Kconfig +4 −0
  48. arch/powerpc/kernel/Makefile +1 −0
  49. arch/riscv/Makefile +1 −1
  50. arch/x86/include/asm/sev.h +1 −6
  51. arch/x86/kernel/cpu/bugs.c +1 −0
  52. arch/x86/kernel/sev-shared.c +9 −16
  53. arch/x86/kernel/sev.c +8 −9
  54. drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c +1 −0
  55. drivers/edac/ghes_edac.c +8 −3
  56. drivers/edac/synopsys_edac.c +25 −19
  57. drivers/gpu/drm/amd/display/Kconfig +1 −1
  58. drivers/gpu/drm/i915/gt/intel_engine.h +2 −0
  59. drivers/gpu/drm/i915/gt/intel_engine_cs.c +86 −2
  60. drivers/gpu/drm/i915/gt/intel_execlists_submission.c +7 −0
  61. drivers/gpu/drm/i915/gt/uc/intel_guc.c +2 −2
  62. drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +6 −75
  63. drivers/gpu/drm/nouveau/nouveau_dmem.c +5 −1
  64. drivers/gpu/drm/tiny/simpledrm.c +1 −1
  65. drivers/idle/intel_idle.c +7 −1
  66. drivers/net/ethernet/fungible/funeth/funeth_rx.c +4 −1
  67. drivers/net/ethernet/fungible/funeth/funeth_tx.c +9 −11
  68. drivers/net/ethernet/fungible/funeth/funeth_txrx.h +3 −3
  69. drivers/net/ethernet/intel/i40e/i40e_main.c +4 −0
  70. drivers/net/ethernet/intel/ice/ice_ethtool.c +2 −1
  71. drivers/net/ethernet/intel/ice/ice_main.c +7 −3
  72. drivers/net/ethernet/intel/ice/ice_sriov.c +0 −40
  73. drivers/net/ethernet/intel/ice/ice_txrx.c +5 −3
  74. drivers/net/ethernet/intel/ice/ice_virtchnl.c +2 −1
  75. drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c +73 −33
  76. drivers/net/ethernet/netronome/nfp/bpf/jit.c +1 −1
  77. drivers/net/ethernet/sfc/ptp.c +22 −0
  78. drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c +5 −4
  79. drivers/net/ipa/ipa_qmi_msg.h +1 −1
  80. drivers/net/macsec.c +21 −12
  81. drivers/net/pcs/pcs-xpcs.c +1 −1
  82. drivers/net/sungem_phy.c +1 −0
  83. drivers/net/virtio_net.c +34 −3
  84. drivers/nvme/host/pci.c +2 −0
  85. drivers/ptp/Kconfig +1 −0
  86. drivers/s390/net/qeth_core_main.c +1 −1
  87. drivers/scsi/mpt3sas/mpt3sas_scsih.c +1 −0
  88. drivers/scsi/scsi_ioctl.c +1 −1
  89. drivers/ufs/core/ufshcd.c +40 −18
  90. drivers/ufs/host/ufshcd-pltfrm.c +13 −2
  91. include/asm-generic/io.h +0 −2
  92. include/linux/cpuhotplug.h +0 −1
  93. include/net/addrconf.h +3 −0
  94. include/net/bluetooth/l2cap.h +1 −0
  95. include/net/inet_connection_sock.h +1 −9
  96. include/net/sock.h +4 −4
  97. include/net/tcp.h +1 −1
  98. include/uapi/asm-generic/fcntl.h +2 −0
  99. kernel/configs/x86_debug.config +1 −2
  100. kernel/locking/rwsem.c +20 −10
  101. kernel/watch_queue.c +36 −22
  102. kernel/workqueue.c +4 −1
  103. mm/hmm.c +8 −11
  104. mm/page_alloc.c +8 −4
  105. net/bluetooth/hci_sync.c +3 −3
  106. net/bluetooth/l2cap_core.c +48 −13
  107. net/bluetooth/mgmt.c +0 −1
  108. net/bridge/br_netlink.c +6 −2
  109. net/caif/caif_socket.c +7 −13
  110. net/decnet/af_decnet.c +2 −2
  111. net/dsa/switch.c +1 −0
  112. net/ipv4/fib_trie.c +5 −2
  113. net/ipv4/tcp.c +16 −7
  114. net/ipv4/tcp_input.c +22 −19
  115. net/ipv4/tcp_ipv4.c +2 −2
  116. net/ipv4/tcp_metrics.c +5 −5
  117. net/ipv4/tcp_output.c +12 −15
  118. net/ipv6/mcast.c +8 −6
  119. net/ipv6/ping.c +6 −0
  120. net/ipv6/tcp_ipv6.c +2 −2
  121. net/mac80211/iface.c +1 −2
  122. net/mptcp/options.c +1 −1
  123. net/mptcp/protocol.c +4 −4
  124. net/mptcp/subflow.c +1 −1
  125. net/netfilter/nf_tables_api.c +6 −0
  126. net/netfilter/nfnetlink_queue.c +6 −1
  127. net/netfilter/nft_queue.c +27 −0
  128. net/sctp/associola.c +2 −3
  129. net/sctp/stream.c +3 −16
  130. net/sctp/stream_sched.c +1 −1
  131. net/tipc/socket.c +1 −1
  132. net/tls/tls_device.c +6 −1
  133. tools/arch/x86/include/asm/cpufeatures.h +1 −0
  134. tools/include/uapi/asm-generic/fcntl.h +10 −1
  135. tools/perf/scripts/python/arm-cs-trace-disasm.py +18 −16
  136. tools/perf/util/bpf-loader.c +7 −11
  137. tools/perf/util/symbol-elf.c +52 −4
.mailmap+4−0
@@ -60,6 +60,10 @@ Arnd Bergmann <arnd@arndb.de> · 59 unmodified lines
6060 Atish Patra <atishp@atishpatra.org> <atish.patra@wdc.com>
6161 Axel Dyks <xl@xlsigned.net>
6262 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>
6367 Bart Van Assche <bvanassche@acm.org> <bart.vanassche@sandisk.com>
6468 Bart Van Assche <bvanassche@acm.org> <bart.vanassche@wdc.com>
6569 Ben Gardner <bgardner@wabtec.com>
Documentation/admin-guide/kernel-parameters.txt+2−0
@@ -3176,6 +3176,7 @@ · 3175 unmodified lines
31763176 no_entry_flush [PPC]
31773177 no_uaccess_flush [PPC]
31783178 mmio_stale_data=off [X86]
3179+ retbleed=off [X86]
31793180
31803181 Exceptions:
31813182 This does not have any effect on
@@ -3198,6 +3199,7 @@ · 16 unmodified lines
31983199 mds=full,nosmt [X86]
31993200 tsx_async_abort=full,nosmt [X86]
32003201 mmio_stale_data=full,nosmt [X86]
3202+ retbleed=auto,nosmt [X86]
32013203
32023204 mminit_loglevel=
32033205 [KNL] When CONFIG_DEBUG_MEMORY_INIT is set, this
Documentation/devicetree/bindings/net/ethernet-controller.yaml+59−64
@@ -167,70 +167,65 @@ properties: · 166 unmodified lines
167167 - in-band-status
168168
169169 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
181−
182− - enum: [0, 1]
183− description:
184− Duplex configuration. 0 for half duplex or 1 for
185− full duplex
186−
187− - enum: [10, 100, 1000, 2500, 10000]
188− description:
189− Link speed in Mbits/sec.
190−
191− - enum: [0, 1]
192− description:
193− Pause configuration. 0 for no pause, 1 for pause
194−
195− - enum: [0, 1]
196− description:
197− Asymmetric pause configuration. 0 for no asymmetric
198− pause, 1 for asymmetric pause
199−
200−
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]
210−
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.
216−
217− pause:
218− $ref: /schemas/types.yaml#definitions/flag
219− description:
220− Indicates that pause should be enabled.
221−
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
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
179+
180+ - enum: [0, 1]
181+ description:
182+ Duplex configuration. 0 for half duplex or 1 for
183+ full duplex
184+
185+ - enum: [10, 100, 1000, 2500, 10000]
186+ description:
187+ Link speed in Mbits/sec.
188+
189+ - enum: [0, 1]
190+ description:
191+ Pause configuration. 0 for no pause, 1 for pause
192+
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]
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.
211+
212+ pause:
213+ $ref: /schemas/types.yaml#definitions/flag
214+ description:
215+ Indicates that pause should be enabled.
216+
217+ asym-pause:
218+ $ref: /schemas/types.yaml#/definitions/flag
219+ description:
220+ Indicates that asym_pause should be enabled.
221+
222+ link-gpios:
223+ maxItems: 1
224+ description:
225+ GPIO to determine if the link is up
226+
227+ required:
228+ - speed
234229
235230 additionalProperties: true
236231
Documentation/devicetree/bindings/net/fsl,fec.yaml+3−0
@@ -183,6 +183,7 @@ properties: · 182 unmodified lines
183183 Should specify the gpio for phy reset.
184184
185185 phy-reset-duration:
186+ $ref: /schemas/types.yaml#/definitions/uint32
186187 deprecated: true
187188 description:
188189 Reset duration in milliseconds. Should present only if property
@@ -191,12 +192,14 @@ properties: · 2 unmodified lines
191192 and 1 millisecond will be used instead.
192193
193194 phy-reset-active-high:
195+ type: boolean
194196 deprecated: true
195197 description:
196198 If present then the reset sequence using the GPIO specified in the
197199 "phy-reset-gpios" property is reversed (H=reset state, L=operation state).
198200
199201 phy-reset-post-delay:
202+ $ref: /schemas/types.yaml#/definitions/uint32
200203 deprecated: true
201204 description:
202205 Post reset delay in milliseconds. If present then a delay of phy-reset-post-delay
Documentation/networking/ip-sysctl.rst+8−1
@@ -2866,7 +2866,14 @@ sctp_rmem - vector of 3 INTEGERs: min, default, max · 2865 unmodified lines
28662866 Default: 4K
28672867
28682868 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
28702877
28712878 addr_scope_policy - INTEGER
28722879 Control IPv4 address scoping - draft-stewart-tsvwg-sctp-ipv4-00
Makefile+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 5
33 PATCHLEVEL = 19
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc8
5+EXTRAVERSION =
66 NAME = Superb Owl
77
88 # *DOCUMENTATION*
arch/arm/boot/dts/lan966x.dtsi+1−1
@@ -38,7 +38,7 @@ · 37 unmodified lines
3838 sys_clk: sys_clk {
3939 compatible = "fixed-clock";
4040 #clock-cells = <0>;
41− clock-frequency = <162500000>;
41+ clock-frequency = <165625000>;
4242 };
4343
4444 cpu_clk: cpu_clk {
arch/arm/include/asm/dma.h+1−1
@@ -10,7 +10,7 @@ · 9 unmodified lines
1010 #else
1111 #define MAX_DMA_ADDRESS ({ \
1212 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) ? \
1414 (PAGE_OFFSET + arm_dma_zone_size) : 0xffffffffUL; })
1515 #endif
1616
arch/arm/lib/findbit.S+8−8
@@ -40,8 +40,8 @@ ENDPROC(_find_first_zero_bit_le) · 39 unmodified lines
4040 * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset)
4141 */
4242 ENTRY(_find_next_zero_bit_le)
43− teq r1, #0
44− beq 3b
43+ cmp r2, r1
44+ bhs 3b
4545 ands ip, r2, #7
4646 beq 1b @ If new byte, goto old routine
4747 ARM( ldrb r3, [r0, r2, lsr #3] )
@@ -81,8 +81,8 @@ ENDPROC(_find_first_bit_le) · 33 unmodified lines
8181 * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset)
8282 */
8383 ENTRY(_find_next_bit_le)
84− teq r1, #0
85− beq 3b
84+ cmp r2, r1
85+ bhs 3b
8686 ands ip, r2, #7
8787 beq 1b @ If new byte, goto old routine
8888 ARM( ldrb r3, [r0, r2, lsr #3] )
@@ -115,8 +115,8 @@ ENTRY(_find_first_zero_bit_be) · 26 unmodified lines
115115 ENDPROC(_find_first_zero_bit_be)
116116
117117 ENTRY(_find_next_zero_bit_be)
118− teq r1, #0
119− beq 3b
118+ cmp r2, r1
119+ bhs 3b
120120 ands ip, r2, #7
121121 beq 1b @ If new byte, goto old routine
122122 eor r3, r2, #0x18 @ big endian byte ordering
@@ -149,8 +149,8 @@ ENTRY(_find_first_bit_be) · 26 unmodified lines
149149 ENDPROC(_find_first_bit_be)
150150
151151 ENTRY(_find_next_bit_be)
152− teq r1, #0
153− beq 3b
152+ cmp r2, r1
153+ bhs 3b
154154 ands ip, r2, #7
155155 beq 1b @ If new byte, goto old routine
156156 eor r3, r2, #0x18 @ big endian byte ordering
arch/arm/mach-pxa/corgi.c+1−1
@@ -549,7 +549,7 @@ static struct pxa2xx_spi_controller corgi_spi_info = { · 548 unmodified lines
549549 };
550550
551551 static struct gpiod_lookup_table corgi_spi_gpio_table = {
552− .dev_id = "pxa2xx-spi.1",
552+ .dev_id = "spi1",
553553 .table = {
554554 GPIO_LOOKUP_IDX("gpio-pxa", CORGI_GPIO_ADS7846_CS, "cs", 0, GPIO_ACTIVE_LOW),
555555 GPIO_LOOKUP_IDX("gpio-pxa", CORGI_GPIO_LCDCON_CS, "cs", 1, GPIO_ACTIVE_LOW),
arch/arm/mach-pxa/hx4700.c+1−1
@@ -635,7 +635,7 @@ static struct pxa2xx_spi_controller pxa_ssp2_master_info = { · 634 unmodified lines
635635 };
636636
637637 static struct gpiod_lookup_table pxa_ssp2_gpio_table = {
638− .dev_id = "pxa2xx-spi.2",
638+ .dev_id = "spi2",
639639 .table = {
640640 GPIO_LOOKUP_IDX("gpio-pxa", GPIO88_HX4700_TSC2046_CS, "cs", 0, GPIO_ACTIVE_LOW),
641641 { },
arch/arm/mach-pxa/icontrol.c+2−2
@@ -140,7 +140,7 @@ struct platform_device pxa_spi_ssp4 = { · 139 unmodified lines
140140 };
141141
142142 static struct gpiod_lookup_table pxa_ssp3_gpio_table = {
143− .dev_id = "pxa2xx-spi.3",
143+ .dev_id = "spi3",
144144 .table = {
145145 GPIO_LOOKUP_IDX("gpio-pxa", ICONTROL_MCP251x_nCS1, "cs", 0, GPIO_ACTIVE_LOW),
146146 GPIO_LOOKUP_IDX("gpio-pxa", ICONTROL_MCP251x_nCS2, "cs", 1, GPIO_ACTIVE_LOW),
@@ -149,7 +149,7 @@ static struct gpiod_lookup_table pxa_ssp3_gpio_table = { · 2 unmodified lines
149149 };
150150
151151 static struct gpiod_lookup_table pxa_ssp4_gpio_table = {
152− .dev_id = "pxa2xx-spi.4",
152+ .dev_id = "spi4",
153153 .table = {
154154 GPIO_LOOKUP_IDX("gpio-pxa", ICONTROL_MCP251x_nCS3, "cs", 0, GPIO_ACTIVE_LOW),
155155 GPIO_LOOKUP_IDX("gpio-pxa", ICONTROL_MCP251x_nCS4, "cs", 1, GPIO_ACTIVE_LOW),
arch/arm/mach-pxa/littleton.c+1−1
@@ -207,7 +207,7 @@ static struct spi_board_info littleton_spi_devices[] __initdata = { · 206 unmodified lines
207207 };
208208
209209 static struct gpiod_lookup_table littleton_spi_gpio_table = {
210− .dev_id = "pxa2xx-spi.2",
210+ .dev_id = "spi2",
211211 .table = {
212212 GPIO_LOOKUP_IDX("gpio-pxa", LITTLETON_GPIO_LCD_CS, "cs", 0, GPIO_ACTIVE_LOW),
213213 { },
arch/arm/mach-pxa/magician.c+1−1
@@ -994,7 +994,7 @@ static struct pxa2xx_spi_controller magician_spi_info = { · 993 unmodified lines
994994 };
995995
996996 static struct gpiod_lookup_table magician_spi_gpio_table = {
997− .dev_id = "pxa2xx-spi.2",
997+ .dev_id = "spi2",
998998 .table = {
999999 /* NOTICE must be GPIO, incompatibility with hw PXA SPI framing */
10001000 GPIO_LOOKUP_IDX("gpio-pxa", GPIO14_MAGICIAN_TSC2046_CS, "cs", 0, GPIO_ACTIVE_LOW),
arch/arm/mach-pxa/spitz.c+1−1
@@ -578,7 +578,7 @@ static struct pxa2xx_spi_controller spitz_spi_info = { · 577 unmodified lines
578578 };
579579
580580 static struct gpiod_lookup_table spitz_spi_gpio_table = {
581− .dev_id = "pxa2xx-spi.2",
581+ .dev_id = "spi2",
582582 .table = {
583583 GPIO_LOOKUP_IDX("gpio-pxa", SPITZ_GPIO_ADS7846_CS, "cs", 0, GPIO_ACTIVE_LOW),
584584 GPIO_LOOKUP_IDX("gpio-pxa", SPITZ_GPIO_LCDCON_CS, "cs", 1, GPIO_ACTIVE_LOW),
arch/arm/mach-pxa/z2.c+2−2
@@ -623,7 +623,7 @@ static struct pxa2xx_spi_controller pxa_ssp2_master_info = { · 622 unmodified lines
623623 };
624624
625625 static struct gpiod_lookup_table pxa_ssp1_gpio_table = {
626− .dev_id = "pxa2xx-spi.1",
626+ .dev_id = "spi1",
627627 .table = {
628628 GPIO_LOOKUP_IDX("gpio-pxa", GPIO24_ZIPITZ2_WIFI_CS, "cs", 0, GPIO_ACTIVE_LOW),
629629 { },
@@ -631,7 +631,7 @@ static struct gpiod_lookup_table pxa_ssp1_gpio_table = { · 1 unmodified line
631631 };
632632
633633 static struct gpiod_lookup_table pxa_ssp2_gpio_table = {
634− .dev_id = "pxa2xx-spi.2",
634+ .dev_id = "spi2",
635635 .table = {
636636 GPIO_LOOKUP_IDX("gpio-pxa", GPIO88_ZIPITZ2_LCD_CS, "cs", 0, GPIO_ACTIVE_LOW),
637637 { },
arch/loongarch/Kconfig+0−1
@@ -69,7 +69,6 @@ config LOONGARCH · 68 unmodified lines
6969 select GENERIC_TIME_VSYSCALL
7070 select GPIOLIB
7171 select HAVE_ARCH_AUDITSYSCALL
72− select HAVE_ARCH_COMPILER_H
7372 select HAVE_ARCH_MMAP_RND_BITS if MMU
7473 select HAVE_ARCH_SECCOMP_FILTER
7574 select HAVE_ARCH_TRACEHOOK
arch/loongarch/include/asm/asmmacro.h+0−12
@@ -274,16 +274,4 @@ · 273 unmodified lines
274274 nor \dst, \src, zero
275275 .endm
276276
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−
289277 #endif /* _ASM_ASMMACRO_H */
arch/loongarch/include/asm/atomic.h+16−21
@@ -10,7 +10,6 @@ · 9 unmodified lines
1010 #include <linux/types.h>
1111 #include <asm/barrier.h>
1212 #include <asm/cmpxchg.h>
13−#include <asm/compiler.h>
1413
1514 #if __SIZEOF_LONG__ == 4
1615 #define __LL "ll.w "
@@ -157,27 +156,25 @@ static inline int arch_atomic_sub_if_positive(int i, atomic_t *v) · 140 unmodified lines
157156 __asm__ __volatile__(
158157 "1: ll.w %1, %2 # atomic_sub_if_positive\n"
159158 " addi.w %0, %1, %3 \n"
160− " or %1, %0, $zero \n"
161− " blt %0, $zero, 2f \n"
159+ " move %1, %0 \n"
160+ " bltz %0, 2f \n"
162161 " sc.w %1, %2 \n"
163− " beq $zero, %1, 1b \n"
162+ " beqz %1, 1b \n"
164163 "2: \n"
165164 __WEAK_LLSC_MB
166− : "=&r" (result), "=&r" (temp),
167− "+" GCC_OFF_SMALL_ASM() (v->counter)
165+ : "=&r" (result), "=&r" (temp), "+ZC" (v->counter)
168166 : "I" (-i));
169167 } else {
170168 __asm__ __volatile__(
171169 "1: ll.w %1, %2 # atomic_sub_if_positive\n"
172170 " sub.w %0, %1, %3 \n"
173− " or %1, %0, $zero \n"
174− " blt %0, $zero, 2f \n"
171+ " move %1, %0 \n"
172+ " bltz %0, 2f \n"
175173 " sc.w %1, %2 \n"
176− " beq $zero, %1, 1b \n"
174+ " beqz %1, 1b \n"
177175 "2: \n"
178176 __WEAK_LLSC_MB
179− : "=&r" (result), "=&r" (temp),
180− "+" GCC_OFF_SMALL_ASM() (v->counter)
177+ : "=&r" (result), "=&r" (temp), "+ZC" (v->counter)
181178 : "r" (i));
182179 }
183180
@@ -320,27 +317,25 @@ static inline long arch_atomic64_sub_if_positive(long i, atomic64_t *v) · 136 unmodified lines
320317 __asm__ __volatile__(
321318 "1: ll.d %1, %2 # atomic64_sub_if_positive \n"
322319 " addi.d %0, %1, %3 \n"
323− " or %1, %0, $zero \n"
324− " blt %0, $zero, 2f \n"
320+ " move %1, %0 \n"
321+ " bltz %0, 2f \n"
325322 " sc.d %1, %2 \n"
326− " beq %1, $zero, 1b \n"
323+ " beqz %1, 1b \n"
327324 "2: \n"
328325 __WEAK_LLSC_MB
329− : "=&r" (result), "=&r" (temp),
330− "+" GCC_OFF_SMALL_ASM() (v->counter)
326+ : "=&r" (result), "=&r" (temp), "+ZC" (v->counter)
331327 : "I" (-i));
332328 } else {
333329 __asm__ __volatile__(
334330 "1: ll.d %1, %2 # atomic64_sub_if_positive \n"
335331 " sub.d %0, %1, %3 \n"
336− " or %1, %0, $zero \n"
337− " blt %0, $zero, 2f \n"
332+ " move %1, %0 \n"
333+ " bltz %0, 2f \n"
338334 " sc.d %1, %2 \n"
339− " beq %1, $zero, 1b \n"
335+ " beqz %1, 1b \n"
340336 "2: \n"
341337 __WEAK_LLSC_MB
342− : "=&r" (result), "=&r" (temp),
343− "+" GCC_OFF_SMALL_ASM() (v->counter)
338+ : "=&r" (result), "=&r" (temp), "+ZC" (v->counter)
344339 : "r" (i));
345340 }
346341
arch/loongarch/include/asm/barrier.h+2−2
@@ -48,9 +48,9 @@ static inline unsigned long array_index_mask_nospec(unsigned long index, · 47 unmodified lines
4848 __asm__ __volatile__(
4949 "sltu %0, %1, %2\n\t"
5050 #if (__SIZEOF_LONG__ == 4)
51− "sub.w %0, $r0, %0\n\t"
51+ "sub.w %0, $zero, %0\n\t"
5252 #elif (__SIZEOF_LONG__ == 8)
53− "sub.d %0, $r0, %0\n\t"
53+ "sub.d %0, $zero, %0\n\t"
5454 #endif
5555 : "=r" (mask)
5656 : "r" (index), "r" (size)
arch/loongarch/include/asm/cmpxchg.h+2−2
@@ -55,9 +55,9 @@ static inline unsigned long __xchg(volatile void *ptr, unsigned long x, · 54 unmodified lines
5555 __asm__ __volatile__( \
5656 "1: " ld " %0, %2 # __cmpxchg_asm \n" \
5757 " bne %0, %z3, 2f \n" \
58− " or $t0, %z4, $zero \n" \
58+ " move $t0, %z4 \n" \
5959 " " st " $t0, %1 \n" \
60− " beq $zero, $t0, 1b \n" \
60+ " beqz $t0, 1b \n" \
6161 "2: \n" \
6262 __WEAK_LLSC_MB \
6363 : "=&r" (__ret), "=ZB"(*m) \
arch/loongarch/include/asm/compiler.h+0−15
@@ -1,15 +0,0 @@
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 */
arch/loongarch/include/asm/elf.h+0−2
@@ -288,8 +288,6 @@ struct arch_elf_state { · 287 unmodified lines
288288 .interp_fp_abi = LOONGARCH_ABI_FP_ANY, \
289289 }
290290
291−#define elf_read_implies_exec(ex, exec_stk) (exec_stk == EXSTACK_DEFAULT)
292−
293291 extern int arch_elf_pt_proc(void *ehdr, void *phdr, struct file *elf,
294292 bool is_interp, struct arch_elf_state *state);
295293
arch/loongarch/include/asm/futex.h+5−6
@@ -8,7 +8,6 @@ · 7 unmodified lines
88 #include <linux/futex.h>
99 #include <linux/uaccess.h>
1010 #include <asm/barrier.h>
11−#include <asm/compiler.h>
1211 #include <asm/errno.h>
1312
1413 #define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \
@@ -17,7 +16,7 @@ · 2 unmodified lines
1716 "1: ll.w %1, %4 # __futex_atomic_op\n" \
1817 " " insn " \n" \
1918 "2: sc.w $t0, %2 \n" \
20− " beq $t0, $zero, 1b \n" \
19+ " beqz $t0, 1b \n" \
2120 "3: \n" \
2221 " .section .fixup,\"ax\" \n" \
2322 "4: li.w %0, %6 \n" \
@@ -82,9 +81,9 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, u32 oldval, u32 newv · 58 unmodified lines
8281 "# futex_atomic_cmpxchg_inatomic \n"
8382 "1: ll.w %1, %3 \n"
8483 " bne %1, %z4, 3f \n"
85− " or $t0, %z5, $zero \n"
84+ " move $t0, %z5 \n"
8685 "2: sc.w $t0, %2 \n"
87− " beq $zero, $t0, 1b \n"
86+ " beqz $t0, 1b \n"
8887 "3: \n"
8988 __WEAK_LLSC_MB
9089 " .section .fixup,\"ax\" \n"
@@ -95,8 +94,8 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, u32 oldval, u32 newv · 4 unmodified lines
9594 " "__UA_ADDR "\t1b, 4b \n"
9695 " "__UA_ADDR "\t2b, 4b \n"
9796 " .previous \n"
98− : "+r" (ret), "=&r" (val), "=" GCC_OFF_SMALL_ASM() (*uaddr)
99− : GCC_OFF_SMALL_ASM() (*uaddr), "Jr" (oldval), "Jr" (newval),
97+ : "+r" (ret), "=&r" (val), "=ZC" (*uaddr)
98+ : "ZC" (*uaddr), "Jr" (oldval), "Jr" (newval),
10099 "i" (-EFAULT)
101100 : "memory", "t0");
102101
arch/loongarch/include/asm/irqflags.h+0−1
@@ -9,7 +9,6 @@ · 8 unmodified lines
99
1010 #include <linux/compiler.h>
1111 #include <linux/stringify.h>
12−#include <asm/compiler.h>
1312 #include <asm/loongarch.h>
1413
1514 static inline void arch_local_irq_enable(void)
arch/loongarch/include/asm/local.h+0−1
@@ -9,7 +9,6 @@ · 8 unmodified lines
99 #include <linux/bitops.h>
1010 #include <linux/atomic.h>
1111 #include <asm/cmpxchg.h>
12−#include <asm/compiler.h>
1312
1413 typedef struct {
1514 atomic_long_t a;
arch/loongarch/include/asm/loongson.h+2−14
@@ -39,18 +39,6 @@ extern const struct plat_smp_ops loongson3_smp_ops; · 38 unmodified lines
3939
4040 #define MAX_PACKAGES 16
4141
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−
5442 #define xconf_readl(addr) readl(addr)
5543 #define xconf_readq(addr) readq(addr)
5644
@@ -58,7 +46,7 @@ static inline void xconf_writel(u32 val, volatile void __iomem *addr) · 1 unmodified line
5846 {
5947 asm volatile (
6048 " st.w %[v], %[hw], 0 \n"
61− " ld.b $r0, %[hw], 0 \n"
49+ " ld.b $zero, %[hw], 0 \n"
6250 :
6351 : [hw] "r" (addr), [v] "r" (val)
6452 );
@@ -68,7 +56,7 @@ static inline void xconf_writeq(u64 val64, volatile void __iomem *addr) · 3 unmodified lines
6856 {
6957 asm volatile (
7058 " st.d %[v], %[hw], 0 \n"
71− " ld.b $r0, %[hw], 0 \n"
59+ " ld.b $zero, %[hw], 0 \n"
7260 :
7361 : [hw] "r" (addr), [v] "r" (val64)
7462 );
arch/loongarch/include/asm/stacktrace.h+6−6
@@ -23,13 +23,13 @@ · 22 unmodified lines
2323 static __always_inline void prepare_frametrace(struct pt_regs *regs)
2424 {
2525 __asm__ __volatile__(
26− /* Save $r1 */
26+ /* Save $ra */
2727 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"
3333 STORE_ONE_REG(2)
3434 STORE_ONE_REG(3)
3535 STORE_ONE_REG(4)
arch/loongarch/include/asm/thread_info.h+2−2
@@ -44,14 +44,14 @@ struct thread_info { · 43 unmodified lines
4444 }
4545
4646 /* 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");
4848
4949 static inline struct thread_info *current_thread_info(void)
5050 {
5151 return __current_thread_info;
5252 }
5353
54−register unsigned long current_stack_pointer __asm__("$r3");
54+register unsigned long current_stack_pointer __asm__("$sp");
5555
5656 #endif /* !__ASSEMBLY__ */
5757
arch/loongarch/include/asm/uaccess.h+1−1
@@ -162,7 +162,7 @@ do { \ · 161 unmodified lines
162162 "2: \n" \
163163 " .section .fixup,\"ax\" \n" \
164164 "3: li.w %0, %3 \n" \
165− " or %1, $r0, $r0 \n" \
165+ " move %1, $zero \n" \
166166 " b 2b \n" \
167167 " .previous \n" \
168168 " .section __ex_table,\"a\" \n" \
arch/loongarch/kernel/cacheinfo.c+9−2
@@ -4,8 +4,9 @@ · 3 unmodified lines
44 *
55 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
66 */
7−#include <asm/cpu-info.h>
87 #include <linux/cacheinfo.h>
8+#include <asm/bootinfo.h>
9+#include <asm/cpu-info.h>
910
1011 /* Populates leaf and increments to next leaf */
1112 #define populate_cache(cache, leaf, c_level, c_type) \
@@ -17,6 +18,8 @@ do { \ · 5 unmodified lines
1718 leaf->ways_of_associativity = c->cache.ways; \
1819 leaf->size = c->cache.linesz * c->cache.sets * \
1920 c->cache.ways; \
21+ if (leaf->level > 2) \
22+ leaf->size *= nodes_per_package; \
2023 leaf++; \
2124 } while (0)
2225
@@ -95,11 +98,15 @@ static void cache_cpumap_setup(unsigned int cpu) · 72 unmodified lines
9598
9699 int populate_cache_leaves(unsigned int cpu)
97100 {
98− int level = 1;
101+ int level = 1, nodes_per_package = 1;
99102 struct cpuinfo_loongarch *c = &current_cpu_data;
100103 struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
101104 struct cacheinfo *this_leaf = this_cpu_ci->info_list;
102105
106+ if (loongson_sysconf.nr_nodes > 1)
107+ nodes_per_package = loongson_sysconf.cores_per_package
108+ / loongson_sysconf.cores_per_node;
109+
103110 if (c->icache.waysize) {
104111 populate_cache(dcache, this_leaf, level, CACHE_TYPE_DATA);
105112 populate_cache(icache, this_leaf, level++, CACHE_TYPE_INST);
arch/loongarch/kernel/entry.S+2−2
@@ -27,7 +27,7 @@ SYM_FUNC_START(handle_syscall) · 26 unmodified lines
2727
2828 addi.d sp, sp, -PT_SIZE
2929 cfi_st t2, PT_R3
30− cfi_rel_offset sp, PT_R3
30+ cfi_rel_offset sp, PT_R3
3131 st.d zero, sp, PT_R0
3232 csrrd t2, LOONGARCH_CSR_PRMD
3333 st.d t2, sp, PT_PRMD
@@ -50,7 +50,7 @@ SYM_FUNC_START(handle_syscall) · 16 unmodified lines
5050 cfi_st a7, PT_R11
5151 csrrd ra, LOONGARCH_CSR_ERA
5252 st.d ra, sp, PT_ERA
53− cfi_rel_offset ra, PT_ERA
53+ cfi_rel_offset ra, PT_ERA
5454
5555 cfi_st tp, PT_R2
5656 cfi_st u0, PT_R21
arch/loongarch/kernel/env.c+0−20
@@ -17,21 +17,6 @@ u64 efi_system_table; · 16 unmodified lines
1717 struct loongson_system_configuration loongson_sysconf;
1818 EXPORT_SYMBOL(loongson_sysconf);
1919
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−
3520 void __init init_environ(void)
3621 {
3722 int efi_boot = fw_arg0;
@@ -50,11 +35,6 @@ void __init init_environ(void) · 12 unmodified lines
5035 efi_memmap_init_early(&data);
5136 memblock_reserve(data.phys_map & PAGE_MASK,
5237 PAGE_ALIGN(data.size + (data.phys_map & ~PAGE_MASK)));
53−
54− register_addrs_set(smp_group, TO_UNCACHE(0x1fe01000), 16);
55− register_addrs_set(loongson_chipcfg, TO_UNCACHE(0x1fe00180), 16);
56− register_addrs_set(loongson_chiptemp, TO_UNCACHE(0x1fe0019c), 16);
57− register_addrs_set(loongson_freqctrl, TO_UNCACHE(0x1fe001d0), 16);
5838 }
5939
6040 static int __init init_cpu_fullname(void)
arch/loongarch/kernel/fpu.S+87−87
@@ -27,78 +27,78 @@ · 26 unmodified lines
2727 .endm
2828
2929 .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)
6262 .endm
6363
6464 .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)
9797 .endm
9898
9999 .macro sc_save_fcc base, tmp0, tmp1
100100 movcf2gr \tmp0, $fcc0
101− move \tmp1, \tmp0
101+ move \tmp1, \tmp0
102102 movcf2gr \tmp0, $fcc1
103103 bstrins.d \tmp1, \tmp0, 15, 8
104104 movcf2gr \tmp0, $fcc2
@@ -113,11 +113,11 @@ · 8 unmodified lines
113113 bstrins.d \tmp1, \tmp0, 55, 48
114114 movcf2gr \tmp0, $fcc7
115115 bstrins.d \tmp1, \tmp0, 63, 56
116− EX st.d \tmp1, \base, 0
116+ EX st.d \tmp1, \base, 0
117117 .endm
118118
119119 .macro sc_restore_fcc base, tmp0, tmp1
120− EX ld.d \tmp0, \base, 0
120+ EX ld.d \tmp0, \base, 0
121121 bstrpick.d \tmp1, \tmp0, 7, 0
122122 movgr2cf $fcc0, \tmp1
123123 bstrpick.d \tmp1, \tmp0, 15, 8
@@ -138,11 +138,11 @@ · 14 unmodified lines
138138
139139 .macro sc_save_fcsr base, tmp0
140140 movfcsr2gr \tmp0, fcsr0
141− EX st.w \tmp0, \base, 0
141+ EX st.w \tmp0, \base, 0
142142 .endm
143143
144144 .macro sc_restore_fcsr base, tmp0
145− EX ld.w \tmp0, \base, 0
145+ EX ld.w \tmp0, \base, 0
146146 movgr2fcsr fcsr0, \tmp0
147147 .endm
148148
@@ -151,9 +151,9 @@ · 2 unmodified lines
151151 */
152152 SYM_FUNC_START(_save_fp)
153153 fpu_save_csr a0 t1
154− fpu_save_double a0 t1 # clobbers t1
154+ fpu_save_double a0 t1 # clobbers t1
155155 fpu_save_cc a0 t1 t2 # clobbers t1, t2
156− jirl zero, ra, 0
156+ jr ra
157157 SYM_FUNC_END(_save_fp)
158158 EXPORT_SYMBOL(_save_fp)
159159
@@ -161,10 +161,10 @@ EXPORT_SYMBOL(_save_fp) · 1 unmodified line
161161 * Restore a thread's fp context.
162162 */
163163 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
168168 SYM_FUNC_END(_restore_fp)
169169
170170 /*
@@ -216,7 +216,7 @@ SYM_FUNC_START(_init_fpu) · 45 unmodified lines
216216 movgr2fr.d $f30, t1
217217 movgr2fr.d $f31, t1
218218
219− jirl zero, ra, 0
219+ jr ra
220220 SYM_FUNC_END(_init_fpu)
221221
222222 /*
@@ -225,11 +225,11 @@ SYM_FUNC_END(_init_fpu) · 2 unmodified lines
225225 * a2: fcsr
226226 */
227227 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
233233 SYM_FUNC_END(_save_fp_context)
234234
235235 /*
@@ -238,14 +238,14 @@ SYM_FUNC_END(_save_fp_context) · 2 unmodified lines
238238 * a2: fcsr
239239 */
240240 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
246246 SYM_FUNC_END(_restore_fp_context)
247247
248248 SYM_FUNC_START(fault)
249249 li.w a0, -EFAULT # failure
250− jirl zero, ra, 0
250+ jr ra
251251 SYM_FUNC_END(fault)
arch/loongarch/kernel/genex.S+6−6
@@ -28,23 +28,23 @@ SYM_FUNC_START(__arch_cpu_idle) · 27 unmodified lines
2828 nop
2929 idle 0
3030 /* end of rollback region */
31−1: jirl zero, ra, 0
31+1: jr ra
3232 SYM_FUNC_END(__arch_cpu_idle)
3333
3434 SYM_FUNC_START(handle_vint)
3535 BACKUP_T0T1
3636 SAVE_ALL
3737 la.abs t1, __arch_cpu_idle
38− LONG_L t0, sp, PT_ERA
38+ LONG_L t0, sp, PT_ERA
3939 /* 32 byte rollback region */
4040 ori t0, t0, 0x1f
4141 xori t0, t0, 0x1f
4242 bne t0, t1, 1f
43− LONG_S t0, sp, PT_ERA
43+ LONG_S t0, sp, PT_ERA
4444 1: move a0, sp
4545 move a1, sp
4646 la.abs t0, do_vint
47− jirl ra, t0, 0
47+ jirl ra, t0, 0
4848 RESTORE_ALL_AND_RET
4949 SYM_FUNC_END(handle_vint)
5050
@@ -72,7 +72,7 @@ SYM_FUNC_END(except_vec_cex) · 21 unmodified lines
7272 build_prep_\prep
7373 move a0, sp
7474 la.abs t0, do_\handler
75− jirl ra, t0, 0
75+ jirl ra, t0, 0
7676 RESTORE_ALL_AND_RET
7777 SYM_FUNC_END(handle_\exception)
7878 .endm
@@ -91,5 +91,5 @@ SYM_FUNC_END(except_vec_cex) · 12 unmodified lines
9191
9292 SYM_FUNC_START(handle_sys)
9393 la.abs t0, handle_syscall
94− jirl zero, t0, 0
94+ jr t0
9595 SYM_FUNC_END(handle_sys)
arch/loongarch/kernel/head.S+4−4
@@ -32,7 +32,7 @@ SYM_CODE_START(kernel_entry) # kernel entry point · 31 unmodified lines
3232 /* We might not get launched at the address the kernel is linked to,
3333 so we jump there. */
3434 la.abs t0, 0f
35− jirl zero, t0, 0
35+ jr t0
3636 0:
3737 la t0, __bss_start # clear .bss
3838 st.d zero, t0, 0
@@ -50,7 +50,7 @@ SYM_CODE_START(kernel_entry) # kernel entry point · 11 unmodified lines
5050 /* KSave3 used for percpu base, initialized as 0 */
5151 csrwr zero, PERCPU_BASE_KS
5252 /* GPR21 used for percpu base (runtime), initialized as 0 */
53− or u0, zero, zero
53+ move u0, zero
5454
5555 la tp, init_thread_union
5656 /* Set the SP after an empty pt_regs. */
@@ -85,8 +85,8 @@ SYM_CODE_START(smpboot_entry) · 28 unmodified lines
8585 ld.d sp, t0, CPU_BOOT_STACK
8686 ld.d tp, t0, CPU_BOOT_TINFO
8787
88− la.abs t0, 0f
89− jirl zero, t0, 0
88+ la.abs t0, 0f
89+ jr t0
9090 0:
9191 bl start_secondary
9292 SYM_CODE_END(smpboot_entry)
arch/loongarch/kernel/ptrace.c+7−5
@@ -193,7 +193,7 @@ static int fpr_set(struct task_struct *target, · 192 unmodified lines
193193 const void *kbuf, const void __user *ubuf)
194194 {
195195 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);
197197 int err;
198198
199199 BUG_ON(count % sizeof(elf_fpreg_t));
@@ -209,10 +209,12 @@ static int fpr_set(struct task_struct *target, · 9 unmodified lines
209209 if (err)
210210 return err;
211211
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));
216218
217219 return err;
218220 }
arch/loongarch/kernel/reset.c+0−1
@@ -13,7 +13,6 @@ · 12 unmodified lines
1313 #include <linux/console.h>
1414
1515 #include <acpi/reboot.h>
16−#include <asm/compiler.h>
1716 #include <asm/idle.h>
1817 #include <asm/loongarch.h>
1918 #include <asm/reboot.h>
arch/loongarch/kernel/setup.c+1−1
@@ -126,7 +126,7 @@ static void __init parse_bios_table(const struct dmi_header *dm) · 125 unmodified lines
126126 char *dmi_data = (char *)dm;
127127
128128 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;
130130
131131 if (bios_extern & LOONGSON_EFI_ENABLE)
132132 set_bit(EFI_BOOT, &efi.flags);
arch/loongarch/kernel/smp.c+13−100
@@ -278,116 +278,29 @@ void loongson3_cpu_die(unsigned int cpu) · 277 unmodified lines
278278 mb();
279279 }
280280
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)
286282 {
287− register int val;
288− register void *addr;
283+ register uint64_t addr;
289284 register void (*init_fn)(void);
290285
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();
333287 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);
290+
291+ __smp_mb();
292+ do {
293+ __asm__ __volatile__("idle 0\n\t");
294+ addr = iocsr_read64(LOONGARCH_IOCSR_MBUF0);
295+ } while (addr == 0);
335296
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);
297+ init_fn = (void *)TO_CACHE(addr);
298+ iocsr_write32(0xffffffff, LOONGARCH_IOCSR_IPI_CLEAR);
344299
345300 init_fn();
346301 unreachable();
347302 }
348303
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−
391304 #endif
392305
393306 /*
arch/loongarch/kernel/switch.S+2−2
@@ -24,8 +24,8 @@ SYM_FUNC_START(__switch_to) · 23 unmodified lines
2424 move tp, a2
2525 cpu_restore_nonscratch a1
2626
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
2929 set_saved_sp t0, t1, t2
3030
3131 ldptr.d t1, a1, THREAD_CSRPRMD
arch/loongarch/lib/clear_user.S+1−1
@@ -32,7 +32,7 @@ SYM_FUNC_START(__clear_user) · 31 unmodified lines
3232 1: st.b zero, a0, 0
3333 addi.d a0, a0, 1
3434 addi.d a1, a1, -1
35− bgt a1, zero, 1b
35+ bgtz a1, 1b
3636
3737 2: move a0, a1
3838 jr ra
arch/loongarch/lib/copy_user.S+1−1
@@ -35,7 +35,7 @@ SYM_FUNC_START(__copy_user) · 34 unmodified lines
3535 addi.d a0, a0, 1
3636 addi.d a1, a1, 1
3737 addi.d a2, a2, -1
38− bgt a2, zero, 1b
38+ bgtz a2, 1b
3939
4040 3: move a0, a2
4141 jr ra
arch/loongarch/lib/delay.c+0−1
@@ -7,7 +7,6 @@ · 6 unmodified lines
77 #include <linux/smp.h>
88 #include <linux/timex.h>
99
10−#include <asm/compiler.h>
1110 #include <asm/processor.h>
1211
1312 void __delay(unsigned long cycles)
arch/loongarch/mm/page.S+59−59
@@ -10,75 +10,75 @@ · 9 unmodified lines
1010
1111 .align 5
1212 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
1515 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
3434
35− jirl $r0, ra, 0
35+ jr ra
3636 SYM_FUNC_END(clear_page)
3737 EXPORT_SYMBOL(clear_page)
3838
3939 .align 5
4040 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
4343 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
5252
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
7171
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
8080
81− bne t8, a0, 1b
82− jirl $r0, ra, 0
81+ bne t8, a0, 1b
82+ jr ra
8383 SYM_FUNC_END(copy_page)
8484 EXPORT_SYMBOL(copy_page)
arch/loongarch/mm/tlbex.S+49−49
@@ -18,7 +18,7 @@ · 17 unmodified lines
1818 REG_S a2, sp, PT_BVADDR
1919 li.w a1, \write
2020 la.abs t0, do_page_fault
21− jirl ra, t0, 0
21+ jirl ra, t0, 0
2222 RESTORE_ALL_AND_RET
2323 SYM_FUNC_END(tlb_do_page_fault_\write)
2424 .endm
@@ -34,7 +34,7 @@ SYM_FUNC_START(handle_tlb_protect) · 9 unmodified lines
3434 csrrd a2, LOONGARCH_CSR_BADV
3535 REG_S a2, sp, PT_BVADDR
3636 la.abs t0, do_page_fault
37− jirl ra, t0, 0
37+ jirl ra, t0, 0
3838 RESTORE_ALL_AND_RET
3939 SYM_FUNC_END(handle_tlb_protect)
4040
@@ -47,7 +47,7 @@ SYM_FUNC_START(handle_tlb_load) · 6 unmodified lines
4747 * The vmalloc handling is not in the hotpath.
4848 */
4949 csrrd t0, LOONGARCH_CSR_BADV
50− blt t0, $r0, vmalloc_load
50+ bltz t0, vmalloc_load
5151 csrrd t1, LOONGARCH_CSR_PGDL
5252
5353 vmalloc_done_load:
@@ -80,7 +80,7 @@ vmalloc_done_load: · 26 unmodified lines
8080 * see if we need to jump to huge tlb processing.
8181 */
8282 andi t0, ra, _PAGE_HUGE
83− bne t0, $r0, tlb_huge_update_load
83+ bnez t0, tlb_huge_update_load
8484
8585 csrrd t0, LOONGARCH_CSR_BADV
8686 srli.d t0, t0, (PAGE_SHIFT + PTE_ORDER)
@@ -100,12 +100,12 @@ smp_pgtable_change_load: · 13 unmodified lines
100100
101101 srli.d ra, t0, _PAGE_PRESENT_SHIFT
102102 andi ra, ra, 1
103− beq ra, $r0, nopage_tlb_load
103+ beqz ra, nopage_tlb_load
104104
105105 ori t0, t0, _PAGE_VALID
106106 #ifdef CONFIG_SMP
107107 sc.d t0, t1, 0
108− beq t0, $r0, smp_pgtable_change_load
108+ beqz t0, smp_pgtable_change_load
109109 #else
110110 st.d t0, t1, 0
111111 #endif
@@ -139,23 +139,23 @@ tlb_huge_update_load: · 27 unmodified lines
139139 #endif
140140 srli.d ra, t0, _PAGE_PRESENT_SHIFT
141141 andi ra, ra, 1
142− beq ra, $r0, nopage_tlb_load
142+ beqz ra, nopage_tlb_load
143143 tlbsrch
144144
145145 ori t0, t0, _PAGE_VALID
146146 #ifdef CONFIG_SMP
147147 sc.d t0, t1, 0
148− beq t0, $r0, tlb_huge_update_load
148+ beqz t0, tlb_huge_update_load
149149 ld.d t0, t1, 0
150150 #else
151151 st.d t0, t1, 0
152152 #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
156156 tlbwr
157157
158− csrxchg $r0, t1, LOONGARCH_CSR_TLBIDX
158+ csrxchg zero, t1, LOONGARCH_CSR_TLBIDX
159159
160160 /*
161161 * A huge PTE describes an area the size of the
@@ -178,27 +178,27 @@ tlb_huge_update_load: · 16 unmodified lines
178178 addi.d t0, ra, 0
179179
180180 /* Convert to entrylo1 */
181− addi.d t1, $r0, 1
181+ addi.d t1, zero, 1
182182 slli.d t1, t1, (HPAGE_SHIFT - 1)
183183 add.d t0, t0, t1
184184 csrwr t0, LOONGARCH_CSR_TLBELO1
185185
186186 /* 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))
189189 csrxchg t1, t0, LOONGARCH_CSR_TLBIDX
190190
191191 tlbfill
192192
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))
195195 csrxchg t1, t0, LOONGARCH_CSR_TLBIDX
196196
197197 nopage_tlb_load:
198198 dbar 0
199199 csrrd ra, EXCEPTION_KS2
200200 la.abs t0, tlb_do_page_fault_0
201− jirl $r0, t0, 0
201+ jr t0
202202 SYM_FUNC_END(handle_tlb_load)
203203
204204 SYM_FUNC_START(handle_tlb_store)
@@ -210,7 +210,7 @@ SYM_FUNC_START(handle_tlb_store) · 5 unmodified lines
210210 * The vmalloc handling is not in the hotpath.
211211 */
212212 csrrd t0, LOONGARCH_CSR_BADV
213− blt t0, $r0, vmalloc_store
213+ bltz t0, vmalloc_store
214214 csrrd t1, LOONGARCH_CSR_PGDL
215215
216216 vmalloc_done_store:
@@ -244,7 +244,7 @@ vmalloc_done_store: · 27 unmodified lines
244244 * see if we need to jump to huge tlb processing.
245245 */
246246 andi t0, ra, _PAGE_HUGE
247− bne t0, $r0, tlb_huge_update_store
247+ bnez t0, tlb_huge_update_store
248248
249249 csrrd t0, LOONGARCH_CSR_BADV
250250 srli.d t0, t0, (PAGE_SHIFT + PTE_ORDER)
@@ -265,12 +265,12 @@ smp_pgtable_change_store: · 14 unmodified lines
265265 srli.d ra, t0, _PAGE_PRESENT_SHIFT
266266 andi ra, ra, ((_PAGE_PRESENT | _PAGE_WRITE) >> _PAGE_PRESENT_SHIFT)
267267 xori ra, ra, ((_PAGE_PRESENT | _PAGE_WRITE) >> _PAGE_PRESENT_SHIFT)
268− bne ra, $r0, nopage_tlb_store
268+ bnez ra, nopage_tlb_store
269269
270270 ori t0, t0, (_PAGE_VALID | _PAGE_DIRTY | _PAGE_MODIFIED)
271271 #ifdef CONFIG_SMP
272272 sc.d t0, t1, 0
273− beq t0, $r0, smp_pgtable_change_store
273+ beqz t0, smp_pgtable_change_store
274274 #else
275275 st.d t0, t1, 0
276276 #endif
@@ -306,24 +306,24 @@ tlb_huge_update_store: · 29 unmodified lines
306306 srli.d ra, t0, _PAGE_PRESENT_SHIFT
307307 andi ra, ra, ((_PAGE_PRESENT | _PAGE_WRITE) >> _PAGE_PRESENT_SHIFT)
308308 xori ra, ra, ((_PAGE_PRESENT | _PAGE_WRITE) >> _PAGE_PRESENT_SHIFT)
309− bne ra, $r0, nopage_tlb_store
309+ bnez ra, nopage_tlb_store
310310
311311 tlbsrch
312312 ori t0, t0, (_PAGE_VALID | _PAGE_DIRTY | _PAGE_MODIFIED)
313313
314314 #ifdef CONFIG_SMP
315315 sc.d t0, t1, 0
316− beq t0, $r0, tlb_huge_update_store
316+ beqz t0, tlb_huge_update_store
317317 ld.d t0, t1, 0
318318 #else
319319 st.d t0, t1, 0
320320 #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
324324 tlbwr
325325
326− csrxchg $r0, t1, LOONGARCH_CSR_TLBIDX
326+ csrxchg zero, t1, LOONGARCH_CSR_TLBIDX
327327 /*
328328 * A huge PTE describes an area the size of the
329329 * configured huge page size. This is twice the
@@ -345,28 +345,28 @@ tlb_huge_update_store: · 15 unmodified lines
345345 addi.d t0, ra, 0
346346
347347 /* Convert to entrylo1 */
348− addi.d t1, $r0, 1
348+ addi.d t1, zero, 1
349349 slli.d t1, t1, (HPAGE_SHIFT - 1)
350350 add.d t0, t0, t1
351351 csrwr t0, LOONGARCH_CSR_TLBELO1
352352
353353 /* 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))
356356 csrxchg t1, t0, LOONGARCH_CSR_TLBIDX
357357
358358 tlbfill
359359
360360 /* 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))
363363 csrxchg t1, t0, LOONGARCH_CSR_TLBIDX
364364
365365 nopage_tlb_store:
366366 dbar 0
367367 csrrd ra, EXCEPTION_KS2
368368 la.abs t0, tlb_do_page_fault_1
369− jirl $r0, t0, 0
369+ jr t0
370370 SYM_FUNC_END(handle_tlb_store)
371371
372372 SYM_FUNC_START(handle_tlb_modify)
@@ -378,7 +378,7 @@ SYM_FUNC_START(handle_tlb_modify) · 5 unmodified lines
378378 * The vmalloc handling is not in the hotpath.
379379 */
380380 csrrd t0, LOONGARCH_CSR_BADV
381− blt t0, $r0, vmalloc_modify
381+ bltz t0, vmalloc_modify
382382 csrrd t1, LOONGARCH_CSR_PGDL
383383
384384 vmalloc_done_modify:
@@ -411,7 +411,7 @@ vmalloc_done_modify: · 26 unmodified lines
411411 * see if we need to jump to huge tlb processing.
412412 */
413413 andi t0, ra, _PAGE_HUGE
414− bne t0, $r0, tlb_huge_update_modify
414+ bnez t0, tlb_huge_update_modify
415415
416416 csrrd t0, LOONGARCH_CSR_BADV
417417 srli.d t0, t0, (PAGE_SHIFT + PTE_ORDER)
@@ -431,12 +431,12 @@ smp_pgtable_change_modify: · 13 unmodified lines
431431
432432 srli.d ra, t0, _PAGE_WRITE_SHIFT
433433 andi ra, ra, 1
434− beq ra, $r0, nopage_tlb_modify
434+ beqz ra, nopage_tlb_modify
435435
436436 ori t0, t0, (_PAGE_VALID | _PAGE_DIRTY | _PAGE_MODIFIED)
437437 #ifdef CONFIG_SMP
438438 sc.d t0, t1, 0
439− beq t0, $r0, smp_pgtable_change_modify
439+ beqz t0, smp_pgtable_change_modify
440440 #else
441441 st.d t0, t1, 0
442442 #endif
@@ -454,7 +454,7 @@ leave_modify: · 11 unmodified lines
454454 ertn
455455 #ifdef CONFIG_64BIT
456456 vmalloc_modify:
457− la.abs t1, swapper_pg_dir
457+ la.abs t1, swapper_pg_dir
458458 b vmalloc_done_modify
459459 #endif
460460
@@ -471,14 +471,14 @@ tlb_huge_update_modify: · 10 unmodified lines
471471
472472 srli.d ra, t0, _PAGE_WRITE_SHIFT
473473 andi ra, ra, 1
474− beq ra, $r0, nopage_tlb_modify
474+ beqz ra, nopage_tlb_modify
475475
476476 tlbsrch
477477 ori t0, t0, (_PAGE_VALID | _PAGE_DIRTY | _PAGE_MODIFIED)
478478
479479 #ifdef CONFIG_SMP
480480 sc.d t0, t1, 0
481− beq t0, $r0, tlb_huge_update_modify
481+ beqz t0, tlb_huge_update_modify
482482 ld.d t0, t1, 0
483483 #else
484484 st.d t0, t1, 0
@@ -504,28 +504,28 @@ tlb_huge_update_modify: · 19 unmodified lines
504504 addi.d t0, ra, 0
505505
506506 /* Convert to entrylo1 */
507− addi.d t1, $r0, 1
507+ addi.d t1, zero, 1
508508 slli.d t1, t1, (HPAGE_SHIFT - 1)
509509 add.d t0, t0, t1
510510 csrwr t0, LOONGARCH_CSR_TLBELO1
511511
512512 /* 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
516516
517517 tlbwr
518518
519519 /* 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
523523
524524 nopage_tlb_modify:
525525 dbar 0
526526 csrrd ra, EXCEPTION_KS2
527527 la.abs t0, tlb_do_page_fault_1
528− jirl $r0, t0, 0
528+ jr t0
529529 SYM_FUNC_END(handle_tlb_modify)
530530
531531 SYM_FUNC_START(handle_tlb_refill)
arch/powerpc/Kconfig+4−0
@@ -282,6 +282,10 @@ config PPC · 281 unmodified lines
282282 # Please keep this list sorted alphabetically.
283283 #
284284
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+
285289 config PPC_BARRIER_NOSPEC
286290 bool
287291 default y
arch/powerpc/kernel/Makefile+1−0
@@ -20,6 +20,7 @@ CFLAGS_prom.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) · 19 unmodified lines
2020 CFLAGS_prom_init.o += -fno-stack-protector
2121 CFLAGS_prom_init.o += -DDISABLE_BRANCH_PROFILING
2222 CFLAGS_prom_init.o += -ffreestanding
23+CFLAGS_prom_init.o += $(call cc-option, -ftrivial-auto-var-init=uninitialized)
2324
2425 ifdef CONFIG_FUNCTION_TRACER
2526 # Do not trace early boot code
arch/riscv/Makefile+1−1
@@ -111,7 +111,7 @@ PHONY += vdso_install · 110 unmodified lines
111111 vdso_install:
112112 $(Q)$(MAKE) $(build)=arch/riscv/kernel/vdso $@
113113 $(if $(CONFIG_COMPAT),$(Q)$(MAKE) \
114− $(build)=arch/riscv/kernel/compat_vdso $@)
114+ $(build)=arch/riscv/kernel/compat_vdso compat_$@)
115115
116116 ifeq ($(KBUILD_EXTMOD),)
117117 ifeq ($(CONFIG_MMU),y)
arch/x86/include/asm/sev.h+1−6
@@ -72,7 +72,6 @@ static inline u64 lower_bits(u64 val, unsigned int bits) · 71 unmodified lines
7272
7373 struct real_mode_header;
7474 enum stack_type;
75−struct ghcb;
7675
7776 /* Early IDT entry points for #VC handler */
7877 extern void vc_no_ghcb(void);
@@ -156,11 +155,7 @@ static __always_inline void sev_es_nmi_complete(void) · 77 unmodified lines
156155 __sev_es_nmi_complete();
157156 }
158157 extern int __init sev_es_efi_map_ghcbs(pgd_t *pgd);
159−extern enum es_result sev_es_ghcb_hv_call(struct ghcb *ghcb,
160− bool set_ghcb_msr,
161− struct es_em_ctxt *ctxt,
162− u64 exit_code, u64 exit_info_1,
163− u64 exit_info_2);
158+
164159 static inline int rmpadjust(unsigned long vaddr, bool rmp_psize, unsigned long attrs)
165160 {
166161 int rc;
arch/x86/kernel/cpu/bugs.c+1−0
@@ -1520,6 +1520,7 @@ static void __init spectre_v2_select_mitigation(void) · 1519 unmodified lines
15201520 * enable IBRS around firmware calls.
15211521 */
15221522 if (boot_cpu_has_bug(X86_BUG_RETBLEED) &&
1523+ boot_cpu_has(X86_FEATURE_IBPB) &&
15231524 (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
15241525 boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)) {
15251526
arch/x86/kernel/sev-shared.c+9−16
@@ -219,9 +219,10 @@ static enum es_result verify_exception_info(struct ghcb *ghcb, struct es_em_ctxt · 218 unmodified lines
219219 return ES_VMM_ERROR;
220220 }
221221
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)
225226 {
226227 /* Fill in protocol and format specifiers */
227228 ghcb->protocol_version = ghcb_version;
@@ -231,14 +232,7 @@ enum es_result sev_es_ghcb_hv_call(struct ghcb *ghcb, bool set_ghcb_msr, · 3 unmodified lines
231232 ghcb_set_sw_exit_info_1(ghcb, exit_info_1);
232233 ghcb_set_sw_exit_info_2(ghcb, exit_info_2);
233234
234− /*
235− * Hyper-V unenlightened guests use a paravisor for communicating and
236− * GHCB pages are being allocated and set up by that paravisor. Linux
237− * should not change the GHCB page's physical address.
238− */
239− if (set_ghcb_msr)
240− sev_es_wr_ghcb_msr(__pa(ghcb));
241−
235+ sev_es_wr_ghcb_msr(__pa(ghcb));
242236 VMGEXIT();
243237
244238 return verify_exception_info(ghcb, ctxt);
@@ -795,7 +789,7 @@ static enum es_result vc_handle_ioio(struct ghcb *ghcb, struct es_em_ctxt *ctxt) · 550 unmodified lines
795789 */
796790 sw_scratch = __pa(ghcb) + offsetof(struct ghcb, shared_buffer);
797791 ghcb_set_sw_scratch(ghcb, sw_scratch);
798− ret = sev_es_ghcb_hv_call(ghcb, true, ctxt, SVM_EXIT_IOIO,
792+ ret = sev_es_ghcb_hv_call(ghcb, ctxt, SVM_EXIT_IOIO,
799793 exit_info_1, exit_info_2);
800794 if (ret != ES_OK)
801795 return ret;
@@ -837,8 +831,7 @@ static enum es_result vc_handle_ioio(struct ghcb *ghcb, struct es_em_ctxt *ctxt) · 35 unmodified lines
837831
838832 ghcb_set_rax(ghcb, rax);
839833
840− ret = sev_es_ghcb_hv_call(ghcb, true, ctxt,
841− SVM_EXIT_IOIO, exit_info_1, 0);
834+ ret = sev_es_ghcb_hv_call(ghcb, ctxt, SVM_EXIT_IOIO, exit_info_1, 0);
842835 if (ret != ES_OK)
843836 return ret;
844837
@@ -894,7 +887,7 @@ static enum es_result vc_handle_cpuid(struct ghcb *ghcb, · 49 unmodified lines
894887 /* xgetbv will cause #GP - use reset value for xcr0 */
895888 ghcb_set_xcr0(ghcb, 1);
896889
897− ret = sev_es_ghcb_hv_call(ghcb, true, ctxt, SVM_EXIT_CPUID, 0, 0);
890+ ret = sev_es_ghcb_hv_call(ghcb, ctxt, SVM_EXIT_CPUID, 0, 0);
898891 if (ret != ES_OK)
899892 return ret;
900893
@@ -919,7 +912,7 @@ static enum es_result vc_handle_rdtsc(struct ghcb *ghcb, · 18 unmodified lines
919912 bool rdtscp = (exit_code == SVM_EXIT_RDTSCP);
920913 enum es_result ret;
921914
922− ret = sev_es_ghcb_hv_call(ghcb, true, ctxt, exit_code, 0, 0);
915+ ret = sev_es_ghcb_hv_call(ghcb, ctxt, exit_code, 0, 0);
923916 if (ret != ES_OK)
924917 return ret;
925918
arch/x86/kernel/sev.c+8−9
@@ -786,7 +786,7 @@ static int vmgexit_psc(struct snp_psc_desc *desc) · 785 unmodified lines
786786 ghcb_set_sw_scratch(ghcb, (u64)__pa(data));
787787
788788 /* 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);
790790
791791 /*
792792 * Page State Change VMGEXIT can pass error code through
@@ -1212,8 +1212,7 @@ static enum es_result vc_handle_msr(struct ghcb *ghcb, struct es_em_ctxt *ctxt) · 419 unmodified lines
12121212 ghcb_set_rdx(ghcb, regs->dx);
12131213 }
12141214
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);
12171216
12181217 if ((ret == ES_OK) && (!exit_info_1)) {
12191218 regs->ax = ghcb->save.rax;
@@ -1452,7 +1451,7 @@ static enum es_result vc_do_mmio(struct ghcb *ghcb, struct es_em_ctxt *ctxt, · 232 unmodified lines
14521451
14531452 ghcb_set_sw_scratch(ghcb, ghcb_pa + offsetof(struct ghcb, shared_buffer));
14541453
1455− return sev_es_ghcb_hv_call(ghcb, true, ctxt, exit_code, exit_info_1, exit_info_2);
1454+ return sev_es_ghcb_hv_call(ghcb, ctxt, exit_code, exit_info_1, exit_info_2);
14561455 }
14571456
14581457 /*
@@ -1628,7 +1627,7 @@ static enum es_result vc_handle_dr7_write(struct ghcb *ghcb, · 169 unmodified lines
16281627
16291628 /* Using a value of 0 for ExitInfo1 means RAX holds the value */
16301629 ghcb_set_rax(ghcb, val);
1631− ret = sev_es_ghcb_hv_call(ghcb, true, ctxt, SVM_EXIT_WRITE_DR7, 0, 0);
1630+ ret = sev_es_ghcb_hv_call(ghcb, ctxt, SVM_EXIT_WRITE_DR7, 0, 0);
16321631 if (ret != ES_OK)
16331632 return ret;
16341633
@@ -1658,7 +1657,7 @@ static enum es_result vc_handle_dr7_read(struct ghcb *ghcb, · 23 unmodified lines
16581657 static enum es_result vc_handle_wbinvd(struct ghcb *ghcb,
16591658 struct es_em_ctxt *ctxt)
16601659 {
1661− return sev_es_ghcb_hv_call(ghcb, true, ctxt, SVM_EXIT_WBINVD, 0, 0);
1660+ return sev_es_ghcb_hv_call(ghcb, ctxt, SVM_EXIT_WBINVD, 0, 0);
16621661 }
16631662
16641663 static enum es_result vc_handle_rdpmc(struct ghcb *ghcb, struct es_em_ctxt *ctxt)
@@ -1667,7 +1666,7 @@ static enum es_result vc_handle_rdpmc(struct ghcb *ghcb, struct es_em_ctxt *ctxt · 2 unmodified lines
16671666
16681667 ghcb_set_rcx(ghcb, ctxt->regs->cx);
16691668
1670− ret = sev_es_ghcb_hv_call(ghcb, true, ctxt, SVM_EXIT_RDPMC, 0, 0);
1669+ ret = sev_es_ghcb_hv_call(ghcb, ctxt, SVM_EXIT_RDPMC, 0, 0);
16711670 if (ret != ES_OK)
16721671 return ret;
16731672
@@ -1708,7 +1707,7 @@ static enum es_result vc_handle_vmmcall(struct ghcb *ghcb, · 34 unmodified lines
17081707 if (x86_platform.hyper.sev_es_hcall_prepare)
17091708 x86_platform.hyper.sev_es_hcall_prepare(ghcb, ctxt->regs);
17101709
1711− ret = sev_es_ghcb_hv_call(ghcb, true, ctxt, SVM_EXIT_VMMCALL, 0, 0);
1710+ ret = sev_es_ghcb_hv_call(ghcb, ctxt, SVM_EXIT_VMMCALL, 0, 0);
17121711 if (ret != ES_OK)
17131712 return ret;
17141713
@@ -2197,7 +2196,7 @@ int snp_issue_guest_request(u64 exit_code, struct snp_req_data *input, unsigned · 482 unmodified lines
21972196 ghcb_set_rbx(ghcb, input->data_npages);
21982197 }
21992198
2200− ret = sev_es_ghcb_hv_call(ghcb, true, &ctxt, exit_code, input->req_gpa, input->resp_gpa);
2199+ ret = sev_es_ghcb_hv_call(ghcb, &ctxt, exit_code, input->req_gpa, input->resp_gpa);
22012200 if (ret)
22022201 goto e_put;
22032202
drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c+1−0
@@ -138,6 +138,7 @@ static struct ccu_common *sun50i_h6_r_ccu_clks[] = { · 137 unmodified lines
138138 &r_apb2_rsb_clk.common,
139139 &r_apb1_ir_clk.common,
140140 &r_apb1_w1_clk.common,
141+ &r_apb1_rtc_clk.common,
141142 &ir_clk.common,
142143 &w1_clk.common,
143144 };
drivers/edac/ghes_edac.c+8−3
@@ -103,9 +103,14 @@ static void dimm_setup_label(struct dimm_info *dimm, u16 handle) · 102 unmodified lines
103103
104104 dmi_memdev_name(handle, &bank, &device);
105105
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 : "");
109114 }
110115
111116 static void assign_dmi_dimm_info(struct dimm_info *dimm, struct memdev_dmi_entry *entry)
drivers/edac/synopsys_edac.c+25−19
@@ -514,6 +514,28 @@ static void handle_error(struct mem_ctl_info *mci, struct synps_ecc_status *p) · 513 unmodified lines
514514 memset(p, 0, sizeof(*p));
515515 }
516516
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+
517539 /**
518540 * intr_handler - Interrupt Handler for ECC interrupts.
519541 * @irq: IRQ number.
@@ -555,6 +577,9 @@ static irqreturn_t intr_handler(int irq, void *dev_id) · 35 unmodified lines
555577 /* v3.0 of the controller does not have this register */
556578 if (!(priv->p_data->quirks & DDR_ECC_INTR_SELF_CLEAR))
557579 writel(regval, priv->baseaddr + DDR_QOS_IRQ_STAT_OFST);
580+ else
581+ enable_intr(priv);
582+
558583 return IRQ_HANDLED;
559584 }
560585
@@ -837,25 +862,6 @@ static void mc_init(struct mem_ctl_info *mci, struct platform_device *pdev) · 276 unmodified lines
837862 init_csrows(mci);
838863 }
839864
840−static void enable_intr(struct synps_edac_priv *priv)
841−{
842− /* Enable UE/CE Interrupts */
843− if (priv->p_data->quirks & DDR_ECC_INTR_SELF_CLEAR)
844− writel(DDR_UE_MASK | DDR_CE_MASK,
845− priv->baseaddr + ECC_CLR_OFST);
846− else
847− writel(DDR_QOSUE_MASK | DDR_QOSCE_MASK,
848− priv->baseaddr + DDR_QOS_IRQ_EN_OFST);
849−
850−}
851−
852−static void disable_intr(struct synps_edac_priv *priv)
853−{
854− /* Disable UE/CE Interrupts */
855− writel(DDR_QOSUE_MASK | DDR_QOSCE_MASK,
856− priv->baseaddr + DDR_QOS_IRQ_DB_OFST);
857−}
858−
859865 static int setup_irq(struct mem_ctl_info *mci,
860866 struct platform_device *pdev)
861867 {
drivers/gpu/drm/amd/display/Kconfig+1−1
@@ -6,7 +6,7 @@ config DRM_AMD_DC · 5 unmodified lines
66 bool "AMD DC - Enable new display engine"
77 default y
88 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)
1010 help
1111 Choose this option if you want to use the new display engine
1212 support for AMDGPU. This adds required support for Vega and
drivers/gpu/drm/i915/gt/intel_engine.h+2−0
@@ -201,6 +201,8 @@ int intel_ring_submission_setup(struct intel_engine_cs *engine); · 200 unmodified lines
201201 int intel_engine_stop_cs(struct intel_engine_cs *engine);
202202 void intel_engine_cancel_stop_cs(struct intel_engine_cs *engine);
203203
204+void intel_engine_wait_for_pending_mi_fw(struct intel_engine_cs *engine);
205+
204206 void intel_engine_set_hwsp_writemask(struct intel_engine_cs *engine, u32 mask);
205207
206208 u64 intel_engine_get_active_head(const struct intel_engine_cs *engine);
drivers/gpu/drm/i915/gt/intel_engine_cs.c+86−2
@@ -1282,10 +1282,10 @@ static int __intel_engine_stop_cs(struct intel_engine_cs *engine, · 1281 unmodified lines
12821282 intel_uncore_write_fw(uncore, mode, _MASKED_BIT_ENABLE(STOP_RING));
12831283
12841284 /*
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
12861286 * stopped, set ring stop bit and prefetch disable bit to halt CS
12871287 */
1288− if (GRAPHICS_VER(engine->i915) == 12)
1288+ if (IS_GRAPHICS_VER(engine->i915, 11, 12))
12891289 intel_uncore_write_fw(uncore, RING_MODE_GEN7(engine->mmio_base),
12901290 _MASKED_BIT_ENABLE(GEN12_GFX_PREFETCH_DISABLE));
12911291
@@ -1308,6 +1308,18 @@ int intel_engine_stop_cs(struct intel_engine_cs *engine) · 16 unmodified lines
13081308 return -ENODEV;
13091309
13101310 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+ */
13111323 if (__intel_engine_stop_cs(engine, 1000, stop_timeout(engine))) {
13121324 ENGINE_TRACE(engine,
13131325 "timed out on STOP_RING -> IDLE; HEAD:%04x, TAIL:%04x\n",
@@ -1334,6 +1346,78 @@ void intel_engine_cancel_stop_cs(struct intel_engine_cs *engine) · 20 unmodified lines
13341346 ENGINE_WRITE_FW(engine, RING_MI_MODE, _MASKED_BIT_DISABLE(STOP_RING));
13351347 }
13361348
1349+static u32 __cs_pending_mi_force_wakes(struct intel_engine_cs *engine)
1350+{
1351+ static const i915_reg_t _reg[I915_NUM_ENGINES] = {
1352+ [RCS0] = MSG_IDLE_CS,
1353+ [BCS0] = MSG_IDLE_BCS,
1354+ [VCS0] = MSG_IDLE_VCS0,
1355+ [VCS1] = MSG_IDLE_VCS1,
1356+ [VCS2] = MSG_IDLE_VCS2,
1357+ [VCS3] = MSG_IDLE_VCS3,
1358+ [VCS4] = MSG_IDLE_VCS4,
1359+ [VCS5] = MSG_IDLE_VCS5,
1360+ [VCS6] = MSG_IDLE_VCS6,
1361+ [VCS7] = MSG_IDLE_VCS7,
1362+ [VECS0] = MSG_IDLE_VECS0,
1363+ [VECS1] = MSG_IDLE_VECS1,
1364+ [VECS2] = MSG_IDLE_VECS2,
1365+ [VECS3] = MSG_IDLE_VECS3,
1366+ [CCS0] = MSG_IDLE_CS,
1367+ [CCS1] = MSG_IDLE_CS,
1368+ [CCS2] = MSG_IDLE_CS,
1369+ [CCS3] = MSG_IDLE_CS,
1370+ };
1371+ u32 val;
1372+
1373+ if (!_reg[engine->id].reg) {
1374+ drm_err(&engine->i915->drm,
1375+ "MSG IDLE undefined for engine id %u\n", engine->id);
1376+ return 0;
1377+ }
1378+
1379+ val = intel_uncore_read(engine->uncore, _reg[engine->id]);
1380+
1381+ /* bits[29:25] & bits[13:9] >> shift */
1382+ return (val & (val >> 16) & MSG_IDLE_FW_MASK) >> MSG_IDLE_FW_SHIFT;
1383+}
1384+
1385+static void __gpm_wait_for_fw_complete(struct intel_gt *gt, u32 fw_mask)
1386+{
1387+ int ret;
1388+
1389+ /* Ensure GPM receives fw up/down after CS is stopped */
1390+ udelay(1);
1391+
1392+ /* Wait for forcewake request to complete in GPM */
1393+ ret = __intel_wait_for_register_fw(gt->uncore,
1394+ GEN9_PWRGT_DOMAIN_STATUS,
1395+ fw_mask, fw_mask, 5000, 0, NULL);
1396+
1397+ /* Ensure CS receives fw ack from GPM */
1398+ udelay(1);
1399+
1400+ if (ret)
1401+ GT_TRACE(gt, "Failed to complete pending forcewake %d\n", ret);
1402+}
1403+
1404+/*
1405+ * Wa_22011802037:gen12: In addition to stopping the cs, we need to wait for any
1406+ * pending MI_FORCE_WAKEUP requests that the CS has initiated to complete. The
1407+ * pending status is indicated by bits[13:9] (masked by bits[29:25]) in the
1408+ * MSG_IDLE register. There's one MSG_IDLE register per reset domain. Since we
1409+ * are concerned only with the gt reset here, we use a logical OR of pending
1410+ * forcewakeups from all reset domains and then wait for them to complete by
1411+ * querying PWRGT_DOMAIN_STATUS.
1412+ */
1413+void intel_engine_wait_for_pending_mi_fw(struct intel_engine_cs *engine)
1414+{
1415+ u32 fw_pending = __cs_pending_mi_force_wakes(engine);
1416+
1417+ if (fw_pending)
1418+ __gpm_wait_for_fw_complete(engine->gt, fw_pending);
1419+}
1420+
13371421 static u32
13381422 read_subslice_reg(const struct intel_engine_cs *engine,
13391423 int slice, int subslice, i915_reg_t reg)
drivers/gpu/drm/i915/gt/intel_execlists_submission.c+7−0
@@ -2968,6 +2968,13 @@ static void execlists_reset_prepare(struct intel_engine_cs *engine) · 2967 unmodified lines
29682968 ring_set_paused(engine, 1);
29692969 intel_engine_stop_cs(engine);
29702970
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+
29712978 engine->execlists.reset_ccid = active_ccid(engine);
29722979 }
29732980
drivers/gpu/drm/i915/gt/uc/intel_guc.c+2−2
@@ -310,8 +310,8 @@ static u32 guc_ctl_wa_flags(struct intel_guc *guc) · 309 unmodified lines
310310 if (IS_DG2(gt->i915))
311311 flags |= GUC_WA_DUAL_QUEUE;
312312
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))
315315 flags |= GUC_WA_PRE_PARSER;
316316
317317 /* Wa_16011777198:dg2 */
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c+6−75
@@ -1578,87 +1578,18 @@ static void guc_reset_state(struct intel_context *ce, u32 head, bool scrub) · 1577 unmodified lines
15781578 lrc_update_regs(ce, engine, head);
15791579 }
15801580
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− */
16421581 static void guc_engine_reset_prepare(struct intel_engine_cs *engine)
16431582 {
1644− u32 fw_pending;
1645−
1646− if (GRAPHICS_VER(engine->i915) != 12)
1583+ if (!IS_GRAPHICS_VER(engine->i915, 11, 12))
16471584 return;
16481585
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− */
16571586 intel_engine_stop_cs(engine);
16581587
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);
16621593 }
16631594
16641595 static void guc_reset_nop(struct intel_engine_cs *engine)
drivers/gpu/drm/nouveau/nouveau_dmem.c+5−1
@@ -680,7 +680,11 @@ nouveau_dmem_migrate_vma(struct nouveau_drm *drm, · 679 unmodified lines
680680 goto out_free_dma;
681681
682682 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+
684688 ret = migrate_vma_setup(&args);
685689 if (ret)
686690 goto out_free_pfns;
drivers/gpu/drm/tiny/simpledrm.c+1−1
@@ -627,7 +627,7 @@ static const struct drm_connector_funcs simpledrm_connector_funcs = { · 626 unmodified lines
627627 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
628628 };
629629
630−static int
630+static enum drm_mode_status
631631 simpledrm_simple_display_pipe_mode_valid(struct drm_simple_display_pipe *pipe,
632632 const struct drm_display_mode *mode)
633633 {
drivers/idle/intel_idle.c+7−1
@@ -162,7 +162,13 @@ static __cpuidle int intel_idle_irq(struct cpuidle_device *dev, · 161 unmodified lines
162162
163163 raw_local_irq_enable();
164164 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();
166172
167173 return ret;
168174 }
drivers/net/ethernet/fungible/funeth/funeth_rx.c+4−1
@@ -142,6 +142,7 @@ static void *fun_run_xdp(struct funeth_rxq *q, skb_frag_t *frags, void *buf_va, · 141 unmodified lines
142142 int ref_ok, struct funeth_txq *xdp_q)
143143 {
144144 struct bpf_prog *xdp_prog;
145+ struct xdp_frame *xdpf;
145146 struct xdp_buff xdp;
146147 u32 act;
147148
@@ -163,7 +164,9 @@ static void *fun_run_xdp(struct funeth_rxq *q, skb_frag_t *frags, void *buf_va, · 15 unmodified lines
163164 case XDP_TX:
164165 if (unlikely(!ref_ok))
165166 goto pass;
166− if (!fun_xdp_tx(xdp_q, xdp.data, xdp.data_end - xdp.data))
167+
168+ xdpf = xdp_convert_buff_to_frame(&xdp);
169+ if (!xdpf || !fun_xdp_tx(xdp_q, xdpf))
167170 goto xdp_error;
168171 FUN_QSTAT_INC(q, xdp_tx);
169172 q->xdp_flush |= FUN_XDP_FLUSH_TX;
drivers/net/ethernet/fungible/funeth/funeth_tx.c+9−11
@@ -466,7 +466,7 @@ static unsigned int fun_xdpq_clean(struct funeth_txq *q, unsigned int budget) · 465 unmodified lines
466466
467467 do {
468468 fun_xdp_unmap(q, reclaim_idx);
469− page_frag_free(q->info[reclaim_idx].vaddr);
469+ xdp_return_frame(q->info[reclaim_idx].xdpf);
470470
471471 trace_funeth_tx_free(q, reclaim_idx, 1, head);
472472
@@ -479,11 +479,11 @@ static unsigned int fun_xdpq_clean(struct funeth_txq *q, unsigned int budget) · 6 unmodified lines
479479 return npkts;
480480 }
481481
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)
483483 {
484484 struct fun_eth_tx_req *req;
485485 struct fun_dataop_gl *gle;
486− unsigned int idx;
486+ unsigned int idx, len;
487487 dma_addr_t dma;
488488
489489 if (fun_txq_avail(q) < FUN_XDP_CLEAN_THRES)
@@ -494,7 +494,8 @@ bool fun_xdp_tx(struct funeth_txq *q, void *data, unsigned int len) · 4 unmodified lines
494494 return false;
495495 }
496496
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);
498499 if (unlikely(dma_mapping_error(q->dma_dev, dma))) {
499500 FUN_QSTAT_INC(q, tx_map_err);
500501 return false;
@@ -514,7 +515,7 @@ bool fun_xdp_tx(struct funeth_txq *q, void *data, unsigned int len) · 13 unmodified lines
514515 gle = (struct fun_dataop_gl *)req->dataop.imm;
515516 fun_dataop_gl_init(gle, 0, 0, len, dma);
516517
517− q->info[idx].vaddr = data;
518+ q->info[idx].xdpf = xdpf;
518519
519520 u64_stats_update_begin(&q->syncp);
520521 q->stats.tx_bytes += len;
@@ -545,12 +546,9 @@ int fun_xdp_xmit_frames(struct net_device *dev, int n, · 24 unmodified lines
545546 if (unlikely(q_idx >= fp->num_xdpqs))
546547 return -ENXIO;
547548
548− for (q = xdpqs[q_idx], i = 0; i < n; i++) {
549− const struct xdp_frame *xdpf = frames[i];
550−
551− if (!fun_xdp_tx(q, xdpf->data, xdpf->len))
549+ for (q = xdpqs[q_idx], i = 0; i < n; i++)
550+ if (!fun_xdp_tx(q, frames[i]))
552551 break;
553− }
554552
555553 if (unlikely(flags & XDP_XMIT_FLUSH))
556554 fun_txq_wr_db(q);
@@ -577,7 +575,7 @@ static void fun_xdpq_purge(struct funeth_txq *q) · 20 unmodified lines
577575 unsigned int idx = q->cons_cnt & q->mask;
578576
579577 fun_xdp_unmap(q, idx);
580− page_frag_free(q->info[idx].vaddr);
578+ xdp_return_frame(q->info[idx].xdpf);
581579 q->cons_cnt++;
582580 }
583581 }
drivers/net/ethernet/fungible/funeth/funeth_txrx.h+3−3
@@ -95,8 +95,8 @@ struct funeth_txq_stats { /* per Tx queue SW counters */ · 94 unmodified lines
9595
9696 struct funeth_tx_info { /* per Tx descriptor state */
9797 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) */
100100 };
101101 };
102102
@@ -245,7 +245,7 @@ static inline int fun_irq_node(const struct fun_irq *p) · 142 unmodified lines
245245 int fun_rxq_napi_poll(struct napi_struct *napi, int budget);
246246 int fun_txq_napi_poll(struct napi_struct *napi, int budget);
247247 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);
249249 int fun_xdp_xmit_frames(struct net_device *dev, int n,
250250 struct xdp_frame **frames, u32 flags);
251251
drivers/net/ethernet/intel/i40e/i40e_main.c+4−0
@@ -1925,11 +1925,15 @@ static void i40e_vsi_setup_queue_map(struct i40e_vsi *vsi, · 1924 unmodified lines
19251925 * non-zero req_queue_pairs says that user requested a new
19261926 * queue count via ethtool's set_channels, so use this
19271927 * 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.
19281930 */
19291931 if (vsi->req_queue_pairs > 0)
19301932 vsi->num_queue_pairs = vsi->req_queue_pairs;
19311933 else if (pf->flags & I40E_FLAG_MSIX_ENABLED)
19321934 vsi->num_queue_pairs = pf->num_lan_msix;
1935+ else
1936+ vsi->num_queue_pairs = 1;
19331937 }
19341938
19351939 /* Number of queues per enabled TC */
drivers/net/ethernet/intel/ice/ice_ethtool.c+2−1
@@ -658,7 +658,8 @@ static int ice_lbtest_receive_frames(struct ice_rx_ring *rx_ring) · 657 unmodified lines
658658 rx_desc = ICE_RX_DESC(rx_ring, i);
659659
660660 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)))))
662663 continue;
663664
664665 rx_buf = &rx_ring->rx_buf[i];
drivers/net/ethernet/intel/ice/ice_main.c+7−3
@@ -4656,6 +4656,8 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent) · 4655 unmodified lines
46564656 ice_set_safe_mode_caps(hw);
46574657 }
46584658
4659+ hw->ucast_shared = true;
4660+
46594661 err = ice_init_pf(pf);
46604662 if (err) {
46614663 dev_err(dev, "ice_init_pf failed: %d\n", err);
@@ -6011,10 +6013,12 @@ int ice_vsi_cfg(struct ice_vsi *vsi) · 1349 unmodified lines
60116013 if (vsi->netdev) {
60126014 ice_set_rx_mode(vsi->netdev);
60136015
6014− err = ice_vsi_vlan_setup(vsi);
6016+ if (vsi->type != ICE_VSI_LB) {
6017+ err = ice_vsi_vlan_setup(vsi);
60156018
6016− if (err)
6017− return err;
6019+ if (err)
6020+ return err;
6021+ }
60186022 }
60196023 ice_vsi_cfg_dcb_rings(vsi);
60206024
drivers/net/ethernet/intel/ice/ice_sriov.c+0−40
@@ -1309,39 +1309,6 @@ out_put_vf: · 1308 unmodified lines
13091309 return ret;
13101310 }
13111311
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−
13451312 /**
13461313 * ice_set_vf_mac
13471314 * @netdev: network interface device structure
@@ -1376,13 +1343,6 @@ int ice_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac) · 28 unmodified lines
13761343 if (ret)
13771344 goto out_put_vf;
13781345
1379− if (ice_unicast_mac_exists(pf, mac)) {
1380− netdev_err(netdev, "Unicast MAC %pM already exists on this PF. Preventing setting VF %u unicast MAC address to %pM\n",
1381− mac, vf_id, mac);
1382− ret = -EINVAL;
1383− goto out_put_vf;
1384− }
1385−
13861346 mutex_lock(&vf->cfg_lock);
13871347
13881348 /* VF is notified of its new MAC via the PF's response to the
drivers/net/ethernet/intel/ice/ice_txrx.c+5−3
@@ -1751,11 +1751,13 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off) · 1750 unmodified lines
17511751
17521752 protocol = vlan_get_protocol(skb);
17531753
1754− if (eth_p_mpls(protocol))
1754+ if (eth_p_mpls(protocol)) {
17551755 ip.hdr = skb_inner_network_header(skb);
1756− else
1756+ l4.hdr = skb_checksum_start(skb);
1757+ } else {
17571758 ip.hdr = skb_network_header(skb);
1758− l4.hdr = skb_checksum_start(skb);
1759+ l4.hdr = skb_transport_header(skb);
1760+ }
17591761
17601762 /* compute outer L2 header size */
17611763 l2_len = ip.hdr - skb->data;
drivers/net/ethernet/intel/ice/ice_virtchnl.c+2−1
@@ -2948,7 +2948,8 @@ ice_vc_validate_add_vlan_filter_list(struct ice_vsi *vsi, · 2947 unmodified lines
29482948 struct virtchnl_vlan_filtering_caps *vfc,
29492949 struct virtchnl_vlan_filter_list_v2 *vfl)
29502950 {
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;
29522953
29532954 if (num_requested_filters > vfc->max_filters)
29542955 return false;
drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c+73−33
@@ -28,6 +28,9 @@ · 27 unmodified lines
2828 #define MAX_RATE_EXPONENT 0x0FULL
2929 #define MAX_RATE_MANTISSA 0xFFULL
3030
31+#define CN10K_MAX_BURST_MANTISSA 0x7FFFULL
32+#define CN10K_MAX_BURST_SIZE 8453888ULL
33+
3134 /* Bitfields in NIX_TLX_PIR register */
3235 #define TLX_RATE_MANTISSA GENMASK_ULL(8, 1)
3336 #define TLX_RATE_EXPONENT GENMASK_ULL(12, 9)
@@ -35,6 +38,9 @@ · 1 unmodified line
3538 #define TLX_BURST_MANTISSA GENMASK_ULL(36, 29)
3639 #define TLX_BURST_EXPONENT GENMASK_ULL(40, 37)
3740
41+#define CN10K_TLX_BURST_MANTISSA GENMASK_ULL(43, 29)
42+#define CN10K_TLX_BURST_EXPONENT GENMASK_ULL(47, 44)
43+
3844 struct otx2_tc_flow_stats {
3945 u64 bytes;
4046 u64 pkts;
@@ -77,33 +83,42 @@ int otx2_tc_alloc_ent_bitmap(struct otx2_nic *nic) · 36 unmodified lines
7783 }
7884 EXPORT_SYMBOL(otx2_tc_alloc_ent_bitmap);
7985
80−static void otx2_get_egress_burst_cfg(u32 burst, u32 *burst_exp,
81− u32 *burst_mantissa)
86+static void otx2_get_egress_burst_cfg(struct otx2_nic *nic, u32 burst,
87+ u32 *burst_exp, u32 *burst_mantissa)
8288 {
89+ int max_burst, max_mantissa;
8390 unsigned int tmp;
8491
92+ if (is_dev_otx2(nic->pdev)) {
93+ max_burst = MAX_BURST_SIZE;
94+ max_mantissa = MAX_BURST_MANTISSA;
95+ } else {
96+ max_burst = CN10K_MAX_BURST_SIZE;
97+ max_mantissa = CN10K_MAX_BURST_MANTISSA;
98+ }
99+
85100 /* Burst is calculated as
86101 * ((256 + BURST_MANTISSA) << (1 + BURST_EXPONENT)) / 256
87102 * Max supported burst size is 130,816 bytes.
88103 */
89− burst = min_t(u32, burst, MAX_BURST_SIZE);
104+ burst = min_t(u32, burst, max_burst);
90105 if (burst) {
91106 *burst_exp = ilog2(burst) ? ilog2(burst) - 1 : 0;
92107 tmp = burst - rounddown_pow_of_two(burst);
93− if (burst < MAX_BURST_MANTISSA)
108+ if (burst < max_mantissa)
94109 *burst_mantissa = tmp * 2;
95110 else
96111 *burst_mantissa = tmp / (1ULL << (*burst_exp - 7));
97112 } else {
98113 *burst_exp = MAX_BURST_EXPONENT;
99− *burst_mantissa = MAX_BURST_MANTISSA;
114+ *burst_mantissa = max_mantissa;
100115 }
101116 }
102117
103−static void otx2_get_egress_rate_cfg(u32 maxrate, u32 *exp,
118+static void otx2_get_egress_rate_cfg(u64 maxrate, u32 *exp,
104119 u32 *mantissa, u32 *div_exp)
105120 {
106− unsigned int tmp;
121+ u64 tmp;
107122
108123 /* Rate calculation by hardware
109124 *
@@ -132,21 +147,44 @@ static void otx2_get_egress_rate_cfg(u32 maxrate, u32 *exp, · 22 unmodified lines
132147 }
133148 }
134149
135−static int otx2_set_matchall_egress_rate(struct otx2_nic *nic, u32 burst, u32 maxrate)
150+static u64 otx2_get_txschq_rate_regval(struct otx2_nic *nic,
151+ u64 maxrate, u32 burst)
136152 {
137− struct otx2_hw *hw = &nic->hw;
138− struct nix_txschq_config *req;
139153 u32 burst_exp, burst_mantissa;
140154 u32 exp, mantissa, div_exp;
155+ u64 regval = 0;
156+
157+ /* Get exponent and mantissa values from the desired rate */
158+ otx2_get_egress_burst_cfg(nic, burst, &burst_exp, &burst_mantissa);
159+ otx2_get_egress_rate_cfg(maxrate, &exp, &mantissa, &div_exp);
160+
161+ if (is_dev_otx2(nic->pdev)) {
162+ regval = FIELD_PREP(TLX_BURST_EXPONENT, (u64)burst_exp) |
163+ FIELD_PREP(TLX_BURST_MANTISSA, (u64)burst_mantissa) |
164+ FIELD_PREP(TLX_RATE_DIVIDER_EXPONENT, div_exp) |
165+ FIELD_PREP(TLX_RATE_EXPONENT, exp) |
166+ FIELD_PREP(TLX_RATE_MANTISSA, mantissa) | BIT_ULL(0);
167+ } else {
168+ regval = FIELD_PREP(CN10K_TLX_BURST_EXPONENT, (u64)burst_exp) |
169+ FIELD_PREP(CN10K_TLX_BURST_MANTISSA, (u64)burst_mantissa) |
170+ FIELD_PREP(TLX_RATE_DIVIDER_EXPONENT, div_exp) |
171+ FIELD_PREP(TLX_RATE_EXPONENT, exp) |
172+ FIELD_PREP(TLX_RATE_MANTISSA, mantissa) | BIT_ULL(0);
173+ }
174+
175+ return regval;
176+}
177+
178+static int otx2_set_matchall_egress_rate(struct otx2_nic *nic,
179+ u32 burst, u64 maxrate)
180+{
181+ struct otx2_hw *hw = &nic->hw;
182+ struct nix_txschq_config *req;
141183 int txschq, err;
142184
143185 /* All SQs share the same TL4, so pick the first scheduler */
144186 txschq = hw->txschq_list[NIX_TXSCH_LVL_TL4][0];
145187
146− /* Get exponent and mantissa values from the desired rate */
147− otx2_get_egress_burst_cfg(burst, &burst_exp, &burst_mantissa);
148− otx2_get_egress_rate_cfg(maxrate, &exp, &mantissa, &div_exp);
149−
150188 mutex_lock(&nic->mbox.lock);
151189 req = otx2_mbox_alloc_msg_nix_txschq_cfg(&nic->mbox);
152190 if (!req) {
@@ -157,11 +195,7 @@ static int otx2_set_matchall_egress_rate(struct otx2_nic *nic, u32 burst, u32 ma · 4 unmodified lines
157195 req->lvl = NIX_TXSCH_LVL_TL4;
158196 req->num_regs = 1;
159197 req->reg[0] = NIX_AF_TL4X_PIR(txschq);
160− req->regval[0] = FIELD_PREP(TLX_BURST_EXPONENT, burst_exp) |
161− FIELD_PREP(TLX_BURST_MANTISSA, burst_mantissa) |
162− FIELD_PREP(TLX_RATE_DIVIDER_EXPONENT, div_exp) |
163− FIELD_PREP(TLX_RATE_EXPONENT, exp) |
164− FIELD_PREP(TLX_RATE_MANTISSA, mantissa) | BIT_ULL(0);
198+ req->regval[0] = otx2_get_txschq_rate_regval(nic, maxrate, burst);
165199
166200 err = otx2_sync_mbox_msg(&nic->mbox);
167201 mutex_unlock(&nic->mbox.lock);
@@ -230,7 +264,7 @@ static int otx2_tc_egress_matchall_install(struct otx2_nic *nic, · 62 unmodified lines
230264 struct netlink_ext_ack *extack = cls->common.extack;
231265 struct flow_action *actions = &cls->rule->action;
232266 struct flow_action_entry *entry;
233− u32 rate;
267+ u64 rate;
234268 int err;
235269
236270 err = otx2_tc_validate_flow(nic, actions, extack);
@@ -256,7 +290,7 @@ static int otx2_tc_egress_matchall_install(struct otx2_nic *nic, · 19 unmodified lines
256290 }
257291 /* Convert bytes per second to Mbps */
258292 rate = entry->police.rate_bytes_ps * 8;
259− rate = max_t(u32, rate / 1000000, 1);
293+ rate = max_t(u64, rate / 1000000, 1);
260294 err = otx2_set_matchall_egress_rate(nic, entry->police.burst, rate);
261295 if (err)
262296 return err;
@@ -614,21 +648,27 @@ static int otx2_tc_prepare_flow(struct otx2_nic *nic, struct otx2_tc_flow *node, · 351 unmodified lines
614648
615649 flow_spec->dport = match.key->dst;
616650 flow_mask->dport = match.mask->dst;
617− if (ip_proto == IPPROTO_UDP)
618− req->features |= BIT_ULL(NPC_DPORT_UDP);
619− else if (ip_proto == IPPROTO_TCP)
620− req->features |= BIT_ULL(NPC_DPORT_TCP);
621− else if (ip_proto == IPPROTO_SCTP)
622− req->features |= BIT_ULL(NPC_DPORT_SCTP);
651+
652+ if (flow_mask->dport) {
653+ if (ip_proto == IPPROTO_UDP)
654+ req->features |= BIT_ULL(NPC_DPORT_UDP);
655+ else if (ip_proto == IPPROTO_TCP)
656+ req->features |= BIT_ULL(NPC_DPORT_TCP);
657+ else if (ip_proto == IPPROTO_SCTP)
658+ req->features |= BIT_ULL(NPC_DPORT_SCTP);
659+ }
623660
624661 flow_spec->sport = match.key->src;
625662 flow_mask->sport = match.mask->src;
626− if (ip_proto == IPPROTO_UDP)
627− req->features |= BIT_ULL(NPC_SPORT_UDP);
628− else if (ip_proto == IPPROTO_TCP)
629− req->features |= BIT_ULL(NPC_SPORT_TCP);
630− else if (ip_proto == IPPROTO_SCTP)
631− req->features |= BIT_ULL(NPC_SPORT_SCTP);
663+
664+ if (flow_mask->sport) {
665+ if (ip_proto == IPPROTO_UDP)
666+ req->features |= BIT_ULL(NPC_SPORT_UDP);
667+ else if (ip_proto == IPPROTO_TCP)
668+ req->features |= BIT_ULL(NPC_SPORT_TCP);
669+ else if (ip_proto == IPPROTO_SCTP)
670+ req->features |= BIT_ULL(NPC_SPORT_SCTP);
671+ }
632672 }
633673
634674 return otx2_tc_parse_actions(nic, &rule->action, req, f, node);
drivers/net/ethernet/netronome/nfp/bpf/jit.c+1−1
@@ -4233,7 +4233,7 @@ static void nfp_bpf_opt_ldst_gather(struct nfp_prog *nfp_prog) · 4232 unmodified lines
42334233 }
42344234
42354235 /* 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.
42374237 */
42384238 if (curr_pair_is_memcpy(meta1, meta2)) {
42394239 head_ld_meta = meta1;
drivers/net/ethernet/sfc/ptp.c+22−0
@@ -1100,7 +1100,29 @@ static void efx_ptp_xmit_skb_queue(struct efx_nic *efx, struct sk_buff *skb) · 1099 unmodified lines
11001100
11011101 tx_queue = efx_channel_get_tx_queue(ptp_data->channel, type);
11021102 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();
11031124 efx_enqueue_skb(tx_queue, skb);
1125+ local_bh_enable();
11041126 } else {
11051127 WARN_ONCE(1, "PTP channel has no timestamped tx queue\n");
11061128 dev_kfree_skb_any(skb);
drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c+5−4
@@ -688,18 +688,19 @@ static int mediatek_dwmac_probe(struct platform_device *pdev) · 687 unmodified lines
688688
689689 ret = mediatek_dwmac_clks_config(priv_plat, true);
690690 if (ret)
691− return ret;
691+ goto err_remove_config_dt;
692692
693693 ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
694− if (ret) {
695− stmmac_remove_config_dt(pdev, plat_dat);
694+ if (ret)
696695 goto err_drv_probe;
697− }
698696
699697 return 0;
700698
701699 err_drv_probe:
702700 mediatek_dwmac_clks_config(priv_plat, false);
701+err_remove_config_dt:
702+ stmmac_remove_config_dt(pdev, plat_dat);
703+
703704 return ret;
704705 }
705706
drivers/net/ipa/ipa_qmi_msg.h+1−1
@@ -214,7 +214,7 @@ struct ipa_init_modem_driver_req { · 213 unmodified lines
214214
215215 /* The response to a IPA_QMI_INIT_DRIVER request begins with a standard
216216 * 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
218218 * ignore any other data that might be returned.
219219 */
220220 struct ipa_init_modem_driver_rsp {
drivers/net/macsec.c+21−12
@@ -243,6 +243,7 @@ static struct macsec_cb *macsec_skb_cb(struct sk_buff *skb) · 242 unmodified lines
243243 #define DEFAULT_SEND_SCI true
244244 #define DEFAULT_ENCRYPT false
245245 #define DEFAULT_ENCODING_SA 0
246+#define MACSEC_XPN_MAX_REPLAY_WINDOW (((1 << 30) - 1))
246247
247248 static bool send_sci(const struct macsec_secy *secy)
248249 {
@@ -1697,7 +1698,7 @@ static bool validate_add_rxsa(struct nlattr **attrs) · 1448 unmodified lines
16971698 return false;
16981699
16991700 if (attrs[MACSEC_SA_ATTR_PN] &&
1700− *(u64 *)nla_data(attrs[MACSEC_SA_ATTR_PN]) == 0)
1701+ nla_get_u64(attrs[MACSEC_SA_ATTR_PN]) == 0)
17011702 return false;
17021703
17031704 if (attrs[MACSEC_SA_ATTR_ACTIVE]) {
@@ -1753,7 +1754,8 @@ static int macsec_add_rxsa(struct sk_buff *skb, struct genl_info *info) · 49 unmodified lines
17531754 }
17541755
17551756 pn_len = secy->xpn ? MACSEC_XPN_PN_LEN : MACSEC_DEFAULT_PN_LEN;
1756− if (nla_len(tb_sa[MACSEC_SA_ATTR_PN]) != pn_len) {
1757+ if (tb_sa[MACSEC_SA_ATTR_PN] &&
1758+ nla_len(tb_sa[MACSEC_SA_ATTR_PN]) != pn_len) {
17571759 pr_notice("macsec: nl: add_rxsa: bad pn length: %d != %d\n",
17581760 nla_len(tb_sa[MACSEC_SA_ATTR_PN]), pn_len);
17591761 rtnl_unlock();
@@ -1769,7 +1771,7 @@ static int macsec_add_rxsa(struct sk_buff *skb, struct genl_info *info) · 9 unmodified lines
17691771 if (nla_len(tb_sa[MACSEC_SA_ATTR_SALT]) != MACSEC_SALT_LEN) {
17701772 pr_notice("macsec: nl: add_rxsa: bad salt length: %d != %d\n",
17711773 nla_len(tb_sa[MACSEC_SA_ATTR_SALT]),
1772− MACSEC_SA_ATTR_SALT);
1774+ MACSEC_SALT_LEN);
17731775 rtnl_unlock();
17741776 return -EINVAL;
17751777 }
@@ -1842,7 +1844,7 @@ static int macsec_add_rxsa(struct sk_buff *skb, struct genl_info *info) · 66 unmodified lines
18421844 return 0;
18431845
18441846 cleanup:
1845− kfree(rx_sa);
1847+ macsec_rxsa_put(rx_sa);
18461848 rtnl_unlock();
18471849 return err;
18481850 }
@@ -1939,7 +1941,7 @@ static bool validate_add_txsa(struct nlattr **attrs) · 90 unmodified lines
19391941 if (nla_get_u8(attrs[MACSEC_SA_ATTR_AN]) >= MACSEC_NUM_AN)
19401942 return false;
19411943
1942− if (nla_get_u32(attrs[MACSEC_SA_ATTR_PN]) == 0)
1944+ if (nla_get_u64(attrs[MACSEC_SA_ATTR_PN]) == 0)
19431945 return false;
19441946
19451947 if (attrs[MACSEC_SA_ATTR_ACTIVE]) {
@@ -2011,7 +2013,7 @@ static int macsec_add_txsa(struct sk_buff *skb, struct genl_info *info) · 65 unmodified lines
20112013 if (nla_len(tb_sa[MACSEC_SA_ATTR_SALT]) != MACSEC_SALT_LEN) {
20122014 pr_notice("macsec: nl: add_txsa: bad salt length: %d != %d\n",
20132015 nla_len(tb_sa[MACSEC_SA_ATTR_SALT]),
2014− MACSEC_SA_ATTR_SALT);
2016+ MACSEC_SALT_LEN);
20152017 rtnl_unlock();
20162018 return -EINVAL;
20172019 }
@@ -2085,7 +2087,7 @@ static int macsec_add_txsa(struct sk_buff *skb, struct genl_info *info) · 67 unmodified lines
20852087
20862088 cleanup:
20872089 secy->operational = was_operational;
2088− kfree(tx_sa);
2090+ macsec_txsa_put(tx_sa);
20892091 rtnl_unlock();
20902092 return err;
20912093 }
@@ -2293,7 +2295,7 @@ static bool validate_upd_sa(struct nlattr **attrs) · 201 unmodified lines
22932295 if (nla_get_u8(attrs[MACSEC_SA_ATTR_AN]) >= MACSEC_NUM_AN)
22942296 return false;
22952297
2296− if (attrs[MACSEC_SA_ATTR_PN] && nla_get_u32(attrs[MACSEC_SA_ATTR_PN]) == 0)
2298+ if (attrs[MACSEC_SA_ATTR_PN] && nla_get_u64(attrs[MACSEC_SA_ATTR_PN]) == 0)
22972299 return false;
22982300
22992301 if (attrs[MACSEC_SA_ATTR_ACTIVE]) {
@@ -3745,9 +3747,6 @@ static int macsec_changelink_common(struct net_device *dev, · 1445 unmodified lines
37453747 secy->operational = tx_sa && tx_sa->active;
37463748 }
37473749
3748− if (data[IFLA_MACSEC_WINDOW])
3749− secy->replay_window = nla_get_u32(data[IFLA_MACSEC_WINDOW]);
3750−
37513750 if (data[IFLA_MACSEC_ENCRYPT])
37523751 tx_sc->encrypt = !!nla_get_u8(data[IFLA_MACSEC_ENCRYPT]);
37533752
@@ -3793,6 +3792,16 @@ static int macsec_changelink_common(struct net_device *dev, · 39 unmodified lines
37933792 }
37943793 }
37953794
3795+ if (data[IFLA_MACSEC_WINDOW]) {
3796+ secy->replay_window = nla_get_u32(data[IFLA_MACSEC_WINDOW]);
3797+
3798+ /* IEEE 802.1AEbw-2013 10.7.8 - maximum replay window
3799+ * for XPN cipher suites */
3800+ if (secy->xpn &&
3801+ secy->replay_window > MACSEC_XPN_MAX_REPLAY_WINDOW)
3802+ return -EINVAL;
3803+ }
3804+
37963805 return 0;
37973806 }
37983807
@@ -3822,7 +3831,7 @@ static int macsec_changelink(struct net_device *dev, struct nlattr *tb[], · 23 unmodified lines
38223831
38233832 ret = macsec_changelink_common(dev, data);
38243833 if (ret)
3825− return ret;
3834+ goto cleanup;
38263835
38273836 /* If h/w offloading is available, propagate to the device */
38283837 if (macsec_is_offloaded(macsec)) {
drivers/net/pcs/pcs-xpcs.c+1−1
@@ -896,7 +896,7 @@ static int xpcs_get_state_c37_sgmii(struct dw_xpcs *xpcs, · 895 unmodified lines
896896 */
897897 ret = xpcs_read(xpcs, MDIO_MMD_VEND2, DW_VR_MII_AN_INTR_STS);
898898 if (ret < 0)
899− return false;
899+ return ret;
900900
901901 if (ret & DW_VR_MII_C37_ANSGM_SP_LNKSTS) {
902902 int speed_value;
drivers/net/sungem_phy.c+1−0
@@ -450,6 +450,7 @@ static int bcm5421_init(struct mii_phy* phy) · 449 unmodified lines
450450 int can_low_power = 1;
451451 if (np == NULL || of_get_property(np, "no-autolowpower", NULL))
452452 can_low_power = 0;
453+ of_node_put(np);
453454 if (can_low_power) {
454455 /* Enable automatic low-power */
455456 sungem_phy_write(phy, 0x1c, 0x9002);
drivers/net/virtio_net.c+34−3
@@ -242,9 +242,15 @@ struct virtnet_info { · 241 unmodified lines
242242 /* Packet virtio header size */
243243 u8 hdr_len;
244244
245− /* Work struct for refilling if we run low on memory. */
245+ /* Work struct for delayed refilling if we run low on memory. */
246246 struct delayed_work refill;
247247
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;
253+
248254 /* Work struct for config space updates */
249255 struct work_struct config_work;
250256
@@ -348,6 +354,20 @@ static struct page *get_a_page(struct receive_queue *rq, gfp_t gfp_mask) · 97 unmodified lines
348354 return p;
349355 }
350356
357+static void enable_delayed_refill(struct virtnet_info *vi)
358+{
359+ spin_lock_bh(&vi->refill_lock);
360+ vi->refill_enabled = true;
361+ spin_unlock_bh(&vi->refill_lock);
362+}
363+
364+static void disable_delayed_refill(struct virtnet_info *vi)
365+{
366+ spin_lock_bh(&vi->refill_lock);
367+ vi->refill_enabled = false;
368+ spin_unlock_bh(&vi->refill_lock);
369+}
370+
351371 static void virtqueue_napi_schedule(struct napi_struct *napi,
352372 struct virtqueue *vq)
353373 {
@@ -1527,8 +1547,12 @@ static int virtnet_receive(struct receive_queue *rq, int budget, · 1173 unmodified lines
15271547 }
15281548
15291549 if (rq->vq->num_free > min((unsigned int)budget, virtqueue_get_vring_size(rq->vq)) / 2) {
1530− if (!try_fill_recv(vi, rq, GFP_ATOMIC))
1531− schedule_delayed_work(&vi->refill, 0);
1550+ if (!try_fill_recv(vi, rq, GFP_ATOMIC)) {
1551+ spin_lock(&vi->refill_lock);
1552+ if (vi->refill_enabled)
1553+ schedule_delayed_work(&vi->refill, 0);
1554+ spin_unlock(&vi->refill_lock);
1555+ }
15321556 }
15331557
15341558 u64_stats_update_begin(&rq->stats.syncp);
@@ -1651,6 +1675,8 @@ static int virtnet_open(struct net_device *dev) · 116 unmodified lines
16511675 struct virtnet_info *vi = netdev_priv(dev);
16521676 int i, err;
16531677
1678+ enable_delayed_refill(vi);
1679+
16541680 for (i = 0; i < vi->max_queue_pairs; i++) {
16551681 if (i < vi->curr_queue_pairs)
16561682 /* Make sure we have some buffers: if oom use wq. */
@@ -2033,6 +2059,8 @@ static int virtnet_close(struct net_device *dev) · 376 unmodified lines
20332059 struct virtnet_info *vi = netdev_priv(dev);
20342060 int i;
20352061
2062+ /* Make sure NAPI doesn't schedule refill work */
2063+ disable_delayed_refill(vi);
20362064 /* Make sure refill_work doesn't re-enable napi! */
20372065 cancel_delayed_work_sync(&vi->refill);
20382066
@@ -2792,6 +2820,8 @@ static int virtnet_restore_up(struct virtio_device *vdev) · 753 unmodified lines
27922820
27932821 virtio_device_ready(vdev);
27942822
2823+ enable_delayed_refill(vi);
2824+
27952825 if (netif_running(vi->dev)) {
27962826 err = virtnet_open(vi->dev);
27972827 if (err)
@@ -3535,6 +3565,7 @@ static int virtnet_probe(struct virtio_device *vdev) · 737 unmodified lines
35353565 vdev->priv = vi;
35363566
35373567 INIT_WORK(&vi->config_work, virtnet_config_changed_work);
3568+ spin_lock_init(&vi->refill_lock);
35383569
35393570 /* If we can receive ANY GSO packets, we must allocate large ones. */
35403571 if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) ||
drivers/nvme/host/pci.c+2−0
@@ -3515,6 +3515,8 @@ static const struct pci_device_id nvme_id_table[] = { · 3514 unmodified lines
35153515 .driver_data = NVME_QUIRK_BOGUS_NID, },
35163516 { PCI_DEVICE(0x1e49, 0x0041), /* ZHITAI TiPro7000 NVMe SSD */
35173517 .driver_data = NVME_QUIRK_NO_DEEPEST_PS, },
3518+ { PCI_DEVICE(0xc0a9, 0x540a), /* Crucial P2 */
3519+ .driver_data = NVME_QUIRK_BOGUS_NID, },
35183520 { PCI_DEVICE(PCI_VENDOR_ID_AMAZON, 0x0061),
35193521 .driver_data = NVME_QUIRK_DMA_ADDRESS_BITS_48, },
35203522 { PCI_DEVICE(PCI_VENDOR_ID_AMAZON, 0x0065),
drivers/ptp/Kconfig+1−0
@@ -176,6 +176,7 @@ config PTP_1588_CLOCK_OCP · 175 unmodified lines
176176 depends on !S390
177177 depends on COMMON_CLK
178178 select NET_DEVLINK
179+ select CRC16
179180 help
180181 This driver adds support for an OpenCompute time card.
181182
drivers/s390/net/qeth_core_main.c+1−1
@@ -3565,7 +3565,7 @@ static void qeth_flush_buffers(struct qeth_qdio_out_q *queue, int index, · 3564 unmodified lines
35653565 if (!atomic_read(&queue->set_pci_flags_count)) {
35663566 /*
35673567 * 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
35693569 * will wake at some time in the future then we
35703570 * can flush packed buffers that might still be
35713571 * hanging around, which can happen if no
drivers/scsi/mpt3sas/mpt3sas_scsih.c+1−0
@@ -11386,6 +11386,7 @@ scsih_shutdown(struct pci_dev *pdev) · 11385 unmodified lines
1138611386 _scsih_ir_shutdown(ioc);
1138711387 _scsih_nvme_shutdown(ioc);
1138811388 mpt3sas_base_mask_interrupts(ioc);
11389+ mpt3sas_base_stop_watchdog(ioc);
1138911390 ioc->shost_recovery = 1;
1139011391 mpt3sas_base_make_ioc_ready(ioc, SOFT_RESET);
1139111392 ioc->shost_recovery = 0;
drivers/scsi/scsi_ioctl.c+1−1
@@ -450,7 +450,7 @@ static int sg_io(struct scsi_device *sdev, struct sg_io_hdr *hdr, fmode_t mode) · 449 unmodified lines
450450 goto out_put_request;
451451
452452 ret = 0;
453− if (hdr->iovec_count) {
453+ if (hdr->iovec_count && hdr->dxfer_len) {
454454 struct iov_iter i;
455455 struct iovec *iov = NULL;
456456
drivers/ufs/core/ufshcd.c+40−18
@@ -2953,37 +2953,59 @@ ufshcd_dev_cmd_completion(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) · 2952 unmodified lines
29532953 static int ufshcd_wait_for_dev_cmd(struct ufs_hba *hba,
29542954 struct ufshcd_lrb *lrbp, int max_timeout)
29552955 {
2956− int err = 0;
2957− unsigned long time_left;
2956+ unsigned long time_left = msecs_to_jiffies(max_timeout);
29582957 unsigned long flags;
2958+ bool pending;
2959+ int err;
29592960
2961+retry:
29602962 time_left = wait_for_completion_timeout(hba->dev_cmd.complete,
2961− msecs_to_jiffies(max_timeout));
2963+ time_left);
29622964
2963− spin_lock_irqsave(hba->host->host_lock, flags);
2964− hba->dev_cmd.complete = NULL;
29652965 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;
29662972 err = ufshcd_get_tr_ocs(lrbp);
29672973 if (!err)
29682974 err = ufshcd_dev_cmd_completion(hba, lrbp);
2969− }
2970− spin_unlock_irqrestore(hba->host->host_lock, flags);
2971−
2972− if (!time_left) {
2975+ } else {
29732976 err = -ETIMEDOUT;
29742977 dev_dbg(hba->dev, "%s: dev_cmd request timedout, tag %d\n",
29752978 __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) {
29772980 /* successfully cleared the command, retry if needed */
29782981 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+ }
29873009 }
29883010
29893011 return err;
drivers/ufs/host/ufshcd-pltfrm.c+13−2
@@ -108,9 +108,20 @@ out: · 107 unmodified lines
108108 return ret;
109109 }
110110
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+
111122 #define MAX_PROP_SIZE 32
112123 static int ufshcd_populate_vreg(struct device *dev, const char *name,
113− struct ufs_vreg **out_vreg)
124+ struct ufs_vreg **out_vreg)
114125 {
115126 char prop_name[MAX_PROP_SIZE];
116127 struct ufs_vreg *vreg = NULL;
@@ -122,7 +133,7 @@ static int ufshcd_populate_vreg(struct device *dev, const char *name, · 5 unmodified lines
122133 }
123134
124135 snprintf(prop_name, MAX_PROP_SIZE, "%s-supply", name);
125− if (!of_parse_phandle(np, prop_name, 0)) {
136+ if (!phandle_exists(np, prop_name, 0)) {
126137 dev_info(dev, "%s: Unable to find %s regulator, assuming enabled\n",
127138 __func__, prop_name);
128139 goto out;
include/asm-generic/io.h+0−2
@@ -1125,9 +1125,7 @@ static inline void memcpy_toio(volatile void __iomem *addr, const void *buffer, · 1124 unmodified lines
11251125 }
11261126 #endif
11271127
1128−#ifndef CONFIG_GENERIC_DEVMEM_IS_ALLOWED
11291128 extern int devmem_is_allowed(unsigned long pfn);
1130−#endif
11311129
11321130 #endif /* __KERNEL__ */
11331131
include/linux/cpuhotplug.h+0−1
@@ -130,7 +130,6 @@ enum cpuhp_state { · 129 unmodified lines
130130 CPUHP_ZCOMP_PREPARE,
131131 CPUHP_TIMERS_PREPARE,
132132 CPUHP_MIPS_SOC_PREPARE,
133− CPUHP_LOONGARCH_SOC_PREPARE,
134133 CPUHP_BP_PREPARE_DYN,
135134 CPUHP_BP_PREPARE_DYN_END = CPUHP_BP_PREPARE_DYN + 20,
136135 CPUHP_BRINGUP_CPU,
include/net/addrconf.h+3−0
@@ -405,6 +405,9 @@ static inline bool ip6_ignore_linkdown(const struct net_device *dev) · 404 unmodified lines
405405 {
406406 const struct inet6_dev *idev = __in6_dev_get(dev);
407407
408+ if (unlikely(!idev))
409+ return true;
410+
408411 return !!idev->cnf.ignore_routes_with_linkdown;
409412 }
410413
include/net/bluetooth/l2cap.h+1−0
@@ -847,6 +847,7 @@ enum { · 846 unmodified lines
847847 };
848848
849849 void l2cap_chan_hold(struct l2cap_chan *c);
850+struct l2cap_chan *l2cap_chan_hold_unless_zero(struct l2cap_chan *c);
850851 void l2cap_chan_put(struct l2cap_chan *c);
851852
852853 static inline void l2cap_chan_lock(struct l2cap_chan *chan)
include/net/inet_connection_sock.h+1−9
@@ -321,7 +321,7 @@ void inet_csk_update_fastreuse(struct inet_bind_bucket *tb, · 320 unmodified lines
321321
322322 struct dst_entry *inet_csk_update_pmtu(struct sock *sk, u32 mtu);
323323
324−#define TCP_PINGPONG_THRESH 3
324+#define TCP_PINGPONG_THRESH 1
325325
326326 static inline void inet_csk_enter_pingpong_mode(struct sock *sk)
327327 {
@@ -338,14 +338,6 @@ static inline bool inet_csk_in_pingpong_mode(struct sock *sk) · 10 unmodified lines
338338 return inet_csk(sk)->icsk_ack.pingpong >= TCP_PINGPONG_THRESH;
339339 }
340340
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−}
348−
349341 static inline bool inet_csk_has_ulp(struct sock *sk)
350342 {
351343 return inet_sk(sk)->is_icsk && !!inet_csk(sk)->icsk_ulp_ops;
include/net/sock.h+4−4
@@ -2843,18 +2843,18 @@ static inline int sk_get_wmem0(const struct sock *sk, const struct proto *proto) · 2842 unmodified lines
28432843 {
28442844 /* Does this proto have per netns sysctl_wmem ? */
28452845 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));
28472847
2848− return *proto->sysctl_wmem;
2848+ return READ_ONCE(*proto->sysctl_wmem);
28492849 }
28502850
28512851 static inline int sk_get_rmem0(const struct sock *sk, const struct proto *proto)
28522852 {
28532853 /* Does this proto have per netns sysctl_rmem ? */
28542854 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));
28562856
2857− return *proto->sysctl_rmem;
2857+ return READ_ONCE(*proto->sysctl_rmem);
28582858 }
28592859
28602860 /* Default TCP Small queue budget is ~1 ms of data (1sec >> 10)
include/net/tcp.h+1−1
@@ -1419,7 +1419,7 @@ void tcp_select_initial_window(const struct sock *sk, int __space, · 1418 unmodified lines
14191419
14201420 static inline int tcp_win_from_space(const struct sock *sk, int space)
14211421 {
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);
14231423
14241424 return tcp_adv_win_scale <= 0 ?
14251425 (space>>(-tcp_adv_win_scale)) :
include/uapi/asm-generic/fcntl.h+2−0
@@ -192,6 +192,7 @@ struct f_owner_ex { · 191 unmodified lines
192192
193193 #define F_LINUX_SPECIFIC_BASE 1024
194194
195+#ifndef HAVE_ARCH_STRUCT_FLOCK
195196 struct flock {
196197 short l_type;
197198 short l_whence;
@@ -216,5 +217,6 @@ struct flock64 { · 18 unmodified lines
216217 __ARCH_FLOCK64_PAD
217218 #endif
218219 };
220+#endif /* HAVE_ARCH_STRUCT_FLOCK */
219221
220222 #endif /* _ASM_GENERIC_FCNTL_H */
kernel/configs/x86_debug.config+1−2
@@ -7,12 +7,11 @@ CONFIG_DEBUG_SLAB=y · 6 unmodified lines
77 CONFIG_DEBUG_KMEMLEAK=y
88 CONFIG_DEBUG_PAGEALLOC=y
99 CONFIG_SLUB_DEBUG_ON=y
10−CONFIG_KMEMCHECK=y
1110 CONFIG_DEBUG_OBJECTS=y
1211 CONFIG_DEBUG_OBJECTS_ENABLE_DEFAULT=1
1312 CONFIG_GCOV_KERNEL=y
1413 CONFIG_LOCKDEP=y
1514 CONFIG_PROVE_LOCKING=y
1615 CONFIG_SCHEDSTATS=y
17−CONFIG_VMLINUX_VALIDATION=y
16+CONFIG_NOINSTR_VALIDATION=y
1817 CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
kernel/locking/rwsem.c+20−10
@@ -335,8 +335,6 @@ struct rwsem_waiter { · 334 unmodified lines
335335 struct task_struct *task;
336336 enum rwsem_waiter_type type;
337337 unsigned long timeout;
338−
339− /* Writer only, not initialized in reader */
340338 bool handoff_set;
341339 };
342340 #define rwsem_first_waiter(sem) \
@@ -459,10 +457,12 @@ static void rwsem_mark_wake(struct rw_semaphore *sem, · 116 unmodified lines
459457 * to give up the lock), request a HANDOFF to
460458 * force the issue.
461459 */
462− if (!(oldcount & RWSEM_FLAG_HANDOFF) &&
463− time_after(jiffies, waiter->timeout)) {
464− adjustment -= RWSEM_FLAG_HANDOFF;
465− lockevent_inc(rwsem_rlock_handoff);
460+ if (time_after(jiffies, waiter->timeout)) {
461+ if (!(oldcount & RWSEM_FLAG_HANDOFF)) {
462+ adjustment -= RWSEM_FLAG_HANDOFF;
463+ lockevent_inc(rwsem_rlock_handoff);
464+ }
465+ waiter->handoff_set = true;
466466 }
467467
468468 atomic_long_add(-adjustment, &sem->count);
@@ -599,7 +599,7 @@ rwsem_del_wake_waiter(struct rw_semaphore *sem, struct rwsem_waiter *waiter, · 130 unmodified lines
599599 static inline bool rwsem_try_write_lock(struct rw_semaphore *sem,
600600 struct rwsem_waiter *waiter)
601601 {
602− bool first = rwsem_first_waiter(sem) == waiter;
602+ struct rwsem_waiter *first = rwsem_first_waiter(sem);
603603 long count, new;
604604
605605 lockdep_assert_held(&sem->wait_lock);
@@ -609,11 +609,20 @@ static inline bool rwsem_try_write_lock(struct rw_semaphore *sem, · 3 unmodified lines
609609 bool has_handoff = !!(count & RWSEM_FLAG_HANDOFF);
610610
611611 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))
613618 return false;
614619
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;
617626 }
618627
619628 new = count;
@@ -1027,6 +1036,7 @@ queue: · 407 unmodified lines
10271036 waiter.task = current;
10281037 waiter.type = RWSEM_WAITING_FOR_READ;
10291038 waiter.timeout = jiffies + RWSEM_WAIT_TIMEOUT;
1039+ waiter.handoff_set = false;
10301040
10311041 raw_spin_lock_irq(&sem->wait_lock);
10321042 if (list_empty(&sem->wait_list)) {
kernel/watch_queue.c+36−22
@@ -454,6 +454,33 @@ void init_watch(struct watch *watch, struct watch_queue *wqueue) · 453 unmodified lines
454454 rcu_assign_pointer(watch->queue, wqueue);
455455 }
456456
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+
457484 /**
458485 * add_watch_to_object - Add a watch on an object to a watch list
459486 * @watch: The watch to add
@@ -468,34 +495,21 @@ void init_watch(struct watch *watch, struct watch_queue *wqueue) · 8 unmodified lines
468495 */
469496 int add_watch_to_object(struct watch *watch, struct watch_list *wlist)
470497 {
471− struct watch_queue *wqueue = rcu_access_pointer(watch->queue);
472− struct watch *w;
473−
474− hlist_for_each_entry(w, &wlist->watchers, list_node) {
475− struct watch_queue *wq = rcu_access_pointer(w->queue);
476− if (wqueue == wq && watch->id == w->id)
477− return -EBUSY;
478− }
479−
480− watch->cred = get_current_cred();
481− rcu_assign_pointer(watch->watch_list, wlist);
498+ struct watch_queue *wqueue;
499+ int ret = -ENOENT;
482500
483− if (atomic_inc_return(&watch->cred->user->nr_watches) >
484− task_rlimit(current, RLIMIT_NOFILE)) {
485− atomic_dec(&watch->cred->user->nr_watches);
486− put_cred(watch->cred);
487− return -EAGAIN;
488− }
501+ rcu_read_lock();
489502
503+ wqueue = rcu_access_pointer(watch->queue);
490504 if (lock_wqueue(wqueue)) {
491− kref_get(&wqueue->usage);
492− kref_get(&watch->usage);
493− hlist_add_head(&watch->queue_node, &wqueue->watches);
505+ spin_lock(&wlist->lock);
506+ ret = add_one_watch(watch, wlist, wqueue);
507+ spin_unlock(&wlist->lock);
494508 unlock_wqueue(wqueue);
495509 }
496510
497− hlist_add_head(&watch->list_node, &wlist->watchers);
498− return 0;
511+ rcu_read_unlock();
512+ return ret;
499513 }
500514 EXPORT_SYMBOL(add_watch_to_object);
501515
kernel/workqueue.c+4−1
@@ -5001,7 +5001,10 @@ static void unbind_workers(int cpu) · 5000 unmodified lines
50015001
50025002 for_each_pool_worker(worker, pool) {
50035003 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);
50055008 }
50065009
50075010 mutex_unlock(&wq_pool_attach_mutex);
mm/hmm.c+8−11
@@ -212,14 +212,6 @@ int hmm_vma_handle_pmd(struct mm_walk *walk, unsigned long addr, · 211 unmodified lines
212212 unsigned long end, unsigned long hmm_pfns[], pmd_t pmd);
213213 #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
214214
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−
223215 static inline unsigned long pte_to_hmm_pfn_flags(struct hmm_range *range,
224216 pte_t pte)
225217 {
@@ -252,10 +244,12 @@ static int hmm_vma_handle_pte(struct mm_walk *walk, unsigned long addr, · 26 unmodified lines
252244 swp_entry_t entry = pte_to_swp_entry(pte);
253245
254246 /*
255− * Never fault in device private pages, but just report
256− * the PFN even if not present.
247+ * Don't fault in device private pages owned by the caller,
248+ * just report the PFN.
257249 */
258− if (hmm_is_device_private_entry(range, entry)) {
250+ if (is_device_private_entry(entry) &&
251+ pfn_swap_entry_to_page(entry)->pgmap->owner ==
252+ range->dev_private_owner) {
259253 cpu_flags = HMM_PFN_VALID;
260254 if (is_writable_device_private_entry(entry))
261255 cpu_flags |= HMM_PFN_WRITE;
@@ -273,6 +267,9 @@ static int hmm_vma_handle_pte(struct mm_walk *walk, unsigned long addr, · 11 unmodified lines
273267 if (!non_swap_entry(entry))
274268 goto fault;
275269
270+ if (is_device_private_entry(entry))
271+ goto fault;
272+
276273 if (is_device_exclusive_entry(entry))
277274 goto fault;
278275
mm/page_alloc.c+8−4
@@ -3968,11 +3968,15 @@ static inline bool zone_watermark_fast(struct zone *z, unsigned int order, · 3967 unmodified lines
39683968 * need to be calculated.
39693969 */
39703970 if (!order) {
3971− long fast_free;
3971+ long usable_free;
3972+ long reserved;
39723973
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])
39763980 return true;
39773981 }
39783982
net/bluetooth/hci_sync.c+3−3
@@ -4973,6 +4973,9 @@ int hci_suspend_sync(struct hci_dev *hdev) · 4972 unmodified lines
49734973 return err;
49744974 }
49754975
4976+ /* Update event mask so only the allowed event can wakeup the host */
4977+ hci_set_event_mask_sync(hdev);
4978+
49764979 /* Only configure accept list if disconnect succeeded and wake
49774980 * isn't being prevented.
49784981 */
@@ -4984,9 +4987,6 @@ int hci_suspend_sync(struct hci_dev *hdev) · 5 unmodified lines
49844987 /* Unpause to take care of updating scanning params */
49854988 hdev->scanning_paused = false;
49864989
4987− /* Update event mask so only the allowed event can wakeup the host */
4988− hci_set_event_mask_sync(hdev);
4989−
49904990 /* Enable event filter for paired devices */
49914991 hci_update_event_filter_sync(hdev);
49924992
net/bluetooth/l2cap_core.c+48−13
@@ -111,7 +111,8 @@ static struct l2cap_chan *__l2cap_get_chan_by_scid(struct l2cap_conn *conn, · 110 unmodified lines
111111 }
112112
113113 /* Find channel with given SCID.
114− * Returns locked channel. */
114+ * Returns a reference locked channel.
115+ */
115116 static struct l2cap_chan *l2cap_get_chan_by_scid(struct l2cap_conn *conn,
116117 u16 cid)
117118 {
@@ -119,15 +120,19 @@ static struct l2cap_chan *l2cap_get_chan_by_scid(struct l2cap_conn *conn, · 1 unmodified line
119120
120121 mutex_lock(&conn->chan_lock);
121122 c = __l2cap_get_chan_by_scid(conn, cid);
122− if (c)
123− l2cap_chan_lock(c);
123+ if (c) {
124+ /* Only lock if chan reference is not 0 */
125+ c = l2cap_chan_hold_unless_zero(c);
126+ if (c)
127+ l2cap_chan_lock(c);
128+ }
124129 mutex_unlock(&conn->chan_lock);
125130
126131 return c;
127132 }
128133
129134 /* Find channel with given DCID.
130− * Returns locked channel.
135+ * Returns a reference locked channel.
131136 */
132137 static struct l2cap_chan *l2cap_get_chan_by_dcid(struct l2cap_conn *conn,
133138 u16 cid)
@@ -136,8 +141,12 @@ static struct l2cap_chan *l2cap_get_chan_by_dcid(struct l2cap_conn *conn, · 2 unmodified lines
136141
137142 mutex_lock(&conn->chan_lock);
138143 c = __l2cap_get_chan_by_dcid(conn, cid);
139− if (c)
140− l2cap_chan_lock(c);
144+ if (c) {
145+ /* Only lock if chan reference is not 0 */
146+ c = l2cap_chan_hold_unless_zero(c);
147+ if (c)
148+ l2cap_chan_lock(c);
149+ }
141150 mutex_unlock(&conn->chan_lock);
142151
143152 return c;
@@ -162,8 +171,12 @@ static struct l2cap_chan *l2cap_get_chan_by_ident(struct l2cap_conn *conn, · 18 unmodified lines
162171
163172 mutex_lock(&conn->chan_lock);
164173 c = __l2cap_get_chan_by_ident(conn, ident);
165− if (c)
166− l2cap_chan_lock(c);
174+ if (c) {
175+ /* Only lock if chan reference is not 0 */
176+ c = l2cap_chan_hold_unless_zero(c);
177+ if (c)
178+ l2cap_chan_lock(c);
179+ }
167180 mutex_unlock(&conn->chan_lock);
168181
169182 return c;
@@ -497,6 +510,16 @@ void l2cap_chan_hold(struct l2cap_chan *c) · 327 unmodified lines
497510 kref_get(&c->kref);
498511 }
499512
513+struct l2cap_chan *l2cap_chan_hold_unless_zero(struct l2cap_chan *c)
514+{
515+ BT_DBG("chan %p orig refcnt %u", c, kref_read(&c->kref));
516+
517+ if (!kref_get_unless_zero(&c->kref))
518+ return NULL;
519+
520+ return c;
521+}
522+
500523 void l2cap_chan_put(struct l2cap_chan *c)
501524 {
502525 BT_DBG("chan %p orig refcnt %u", c, kref_read(&c->kref));
@@ -1968,7 +1991,10 @@ static struct l2cap_chan *l2cap_global_chan_by_psm(int state, __le16 psm, · 1465 unmodified lines
19681991 src_match = !bacmp(&c->src, src);
19691992 dst_match = !bacmp(&c->dst, dst);
19701993 if (src_match && dst_match) {
1971− l2cap_chan_hold(c);
1994+ c = l2cap_chan_hold_unless_zero(c);
1995+ if (!c)
1996+ continue;
1997+
19721998 read_unlock(&chan_list_lock);
19731999 return c;
19742000 }
@@ -1983,7 +2009,7 @@ static struct l2cap_chan *l2cap_global_chan_by_psm(int state, __le16 psm, · 8 unmodified lines
19832009 }
19842010
19852011 if (c1)
1986− l2cap_chan_hold(c1);
2012+ c1 = l2cap_chan_hold_unless_zero(c1);
19872013
19882014 read_unlock(&chan_list_lock);
19892015
@@ -4463,6 +4489,7 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, · 2473 unmodified lines
44634489
44644490 unlock:
44654491 l2cap_chan_unlock(chan);
4492+ l2cap_chan_put(chan);
44664493 return err;
44674494 }
44684495
@@ -4577,6 +4604,7 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, · 108 unmodified lines
45774604
45784605 done:
45794606 l2cap_chan_unlock(chan);
4607+ l2cap_chan_put(chan);
45804608 return err;
45814609 }
45824610
@@ -5304,6 +5332,7 @@ send_move_response: · 721 unmodified lines
53045332 l2cap_send_move_chan_rsp(chan, result);
53055333
53065334 l2cap_chan_unlock(chan);
5335+ l2cap_chan_put(chan);
53075336
53085337 return 0;
53095338 }
@@ -5396,6 +5425,7 @@ static void l2cap_move_continue(struct l2cap_conn *conn, u16 icid, u16 result) · 86 unmodified lines
53965425 }
53975426
53985427 l2cap_chan_unlock(chan);
5428+ l2cap_chan_put(chan);
53995429 }
54005430
54015431 static void l2cap_move_fail(struct l2cap_conn *conn, u8 ident, u16 icid,
@@ -5425,6 +5455,7 @@ static void l2cap_move_fail(struct l2cap_conn *conn, u8 ident, u16 icid, · 23 unmodified lines
54255455 l2cap_send_move_chan_cfm(chan, L2CAP_MC_UNCONFIRMED);
54265456
54275457 l2cap_chan_unlock(chan);
5458+ l2cap_chan_put(chan);
54285459 }
54295460
54305461 static int l2cap_move_channel_rsp(struct l2cap_conn *conn,
@@ -5488,6 +5519,7 @@ static int l2cap_move_channel_confirm(struct l2cap_conn *conn, · 57 unmodified lines
54885519 l2cap_send_move_chan_cfm_rsp(conn, cmd->ident, icid);
54895520
54905521 l2cap_chan_unlock(chan);
5522+ l2cap_chan_put(chan);
54915523
54925524 return 0;
54935525 }
@@ -5523,6 +5555,7 @@ static inline int l2cap_move_channel_confirm_rsp(struct l2cap_conn *conn, · 29 unmodified lines
55235555 }
55245556
55255557 l2cap_chan_unlock(chan);
5558+ l2cap_chan_put(chan);
55265559
55275560 return 0;
55285561 }
@@ -5895,12 +5928,11 @@ static inline int l2cap_le_credits(struct l2cap_conn *conn, · 366 unmodified lines
58955928 if (credits > max_credits) {
58965929 BT_ERR("LE credits overflow");
58975930 l2cap_send_disconn_req(chan, ECONNRESET);
5898− l2cap_chan_unlock(chan);
58995931
59005932 /* Return 0 so that we don't trigger an unnecessary
59015933 * command reject packet.
59025934 */
5903− return 0;
5935+ goto unlock;
59045936 }
59055937
59065938 chan->tx_credits += credits;
@@ -5911,7 +5943,9 @@ static inline int l2cap_le_credits(struct l2cap_conn *conn, · 4 unmodified lines
59115943 if (chan->tx_credits)
59125944 chan->ops->resume(chan);
59135945
5946+unlock:
59145947 l2cap_chan_unlock(chan);
5948+ l2cap_chan_put(chan);
59155949
59165950 return 0;
59175951 }
@@ -7597,6 +7631,7 @@ drop: · 1679 unmodified lines
75977631
75987632 done:
75997633 l2cap_chan_unlock(chan);
7634+ l2cap_chan_put(chan);
76007635 }
76017636
76027637 static void l2cap_conless_channel(struct l2cap_conn *conn, __le16 psm,
@@ -8085,7 +8120,7 @@ static struct l2cap_chan *l2cap_global_fixed_chan(struct l2cap_chan *c, · 482 unmodified lines
80858120 if (src_type != c->src_type)
80868121 continue;
80878122
8088− l2cap_chan_hold(c);
8123+ c = l2cap_chan_hold_unless_zero(c);
80898124 read_unlock(&chan_list_lock);
80908125 return c;
80918126 }
net/bluetooth/mgmt.c+0−1
@@ -4723,7 +4723,6 @@ static int __add_adv_patterns_monitor(struct sock *sk, struct hci_dev *hdev, · 4722 unmodified lines
47234723 else
47244724 status = MGMT_STATUS_FAILED;
47254725
4726− mgmt_pending_remove(cmd);
47274726 goto unlock;
47284727 }
47294728
net/bridge/br_netlink.c+6−2
@@ -589,9 +589,13 @@ static int br_fill_ifinfo(struct sk_buff *skb, · 588 unmodified lines
589589 }
590590
591591 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+ }
592598
593− if (af)
594− nla_nest_end(skb, af);
595599 nlmsg_end(skb, nlh);
596600 return 0;
597601
net/caif/caif_socket.c+7−13
@@ -47,7 +47,7 @@ enum caif_states { · 46 unmodified lines
4747 struct caifsock {
4848 struct sock sk; /* must be first member */
4949 struct cflayer layer;
50− u32 flow_state;
50+ unsigned long flow_state;
5151 struct caif_connect_request conn_req;
5252 struct mutex readlock;
5353 struct dentry *debugfs_socket_dir;
@@ -56,38 +56,32 @@ struct caifsock { · 2 unmodified lines
5656
5757 static int rx_flow_is_on(struct caifsock *cf_sk)
5858 {
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);
6160 }
6261
6362 static int tx_flow_is_on(struct caifsock *cf_sk)
6463 {
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);
6765 }
6866
6967 static void set_rx_flow_off(struct caifsock *cf_sk)
7068 {
71− clear_bit(RX_FLOW_ON_BIT,
72− (void *) &cf_sk->flow_state);
69+ clear_bit(RX_FLOW_ON_BIT, &cf_sk->flow_state);
7370 }
7471
7572 static void set_rx_flow_on(struct caifsock *cf_sk)
7673 {
77− set_bit(RX_FLOW_ON_BIT,
78− (void *) &cf_sk->flow_state);
74+ set_bit(RX_FLOW_ON_BIT, &cf_sk->flow_state);
7975 }
8076
8177 static void set_tx_flow_off(struct caifsock *cf_sk)
8278 {
83− clear_bit(TX_FLOW_ON_BIT,
84− (void *) &cf_sk->flow_state);
79+ clear_bit(TX_FLOW_ON_BIT, &cf_sk->flow_state);
8580 }
8681
8782 static void set_tx_flow_on(struct caifsock *cf_sk)
8883 {
89− set_bit(TX_FLOW_ON_BIT,
90− (void *) &cf_sk->flow_state);
84+ set_bit(TX_FLOW_ON_BIT, &cf_sk->flow_state);
9185 }
9286
9387 static void caif_read_lock(struct sock *sk)
net/decnet/af_decnet.c+2−2
@@ -480,8 +480,8 @@ static struct sock *dn_alloc_sock(struct net *net, struct socket *sock, gfp_t gf · 479 unmodified lines
480480 sk->sk_family = PF_DECnet;
481481 sk->sk_protocol = 0;
482482 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]);
485485
486486 /* Initialization of DECnet Session Control Port */
487487 scp = DN_SK(sk);
net/dsa/switch.c+1−0
@@ -344,6 +344,7 @@ static int dsa_switch_do_lag_fdb_add(struct dsa_switch *ds, struct dsa_lag *lag, · 343 unmodified lines
344344
345345 ether_addr_copy(a->addr, addr);
346346 a->vid = vid;
347+ a->db = db;
347348 refcount_set(&a->refcount, 1);
348349 list_add_tail(&a->list, &lag->fdbs);
349350
net/ipv4/fib_trie.c+5−2
@@ -1042,6 +1042,7 @@ fib_find_matching_alias(struct net *net, const struct fib_rt_info *fri) · 1041 unmodified lines
10421042
10431043 void fib_alias_hw_flags_set(struct net *net, const struct fib_rt_info *fri)
10441044 {
1045+ u8 fib_notify_on_flag_change;
10451046 struct fib_alias *fa_match;
10461047 struct sk_buff *skb;
10471048 int err;
@@ -1063,14 +1064,16 @@ void fib_alias_hw_flags_set(struct net *net, const struct fib_rt_info *fri) · 15 unmodified lines
10631064 WRITE_ONCE(fa_match->offload, fri->offload);
10641065 WRITE_ONCE(fa_match->trap, fri->trap);
10651066
1067+ fib_notify_on_flag_change = READ_ONCE(net->ipv4.sysctl_fib_notify_on_flag_change);
1068+
10661069 /* 2 means send notifications only if offload_failed was changed. */
1067− if (net->ipv4.sysctl_fib_notify_on_flag_change == 2 &&
1070+ if (fib_notify_on_flag_change == 2 &&
10681071 READ_ONCE(fa_match->offload_failed) == fri->offload_failed)
10691072 goto out;
10701073
10711074 WRITE_ONCE(fa_match->offload_failed, fri->offload_failed);
10721075
1073− if (!net->ipv4.sysctl_fib_notify_on_flag_change)
1076+ if (!fib_notify_on_flag_change)
10741077 goto out;
10751078
10761079 skb = nlmsg_new(fib_nlmsg_size(fa_match->fa_info), GFP_ATOMIC);
net/ipv4/tcp.c+16−7
@@ -452,8 +452,8 @@ void tcp_init_sock(struct sock *sk) · 451 unmodified lines
452452
453453 icsk->icsk_sync_mss = tcp_sync_mss;
454454
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]));
457457
458458 sk_sockets_allocated_inc(sk);
459459 }
@@ -686,7 +686,7 @@ static bool tcp_should_autocork(struct sock *sk, struct sk_buff *skb, · 226 unmodified lines
686686 int size_goal)
687687 {
688688 return skb->len < size_goal &&
689− sock_net(sk)->ipv4.sysctl_tcp_autocorking &&
689+ READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_autocorking) &&
690690 !tcp_rtx_queue_empty(sk) &&
691691 refcount_read(&sk->sk_wmem_alloc) > skb->truesize &&
692692 tcp_skb_can_collapse_to(skb);
@@ -1724,7 +1724,7 @@ int tcp_set_rcvlowat(struct sock *sk, int val) · 1031 unmodified lines
17241724 if (sk->sk_userlocks & SOCK_RCVBUF_LOCK)
17251725 cap = sk->sk_rcvbuf >> 1;
17261726 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;
17281728 val = min(val, cap);
17291729 WRITE_ONCE(sk->sk_rcvlowat, val ? : 1);
17301730
@@ -4459,9 +4459,18 @@ tcp_inbound_md5_hash(const struct sock *sk, const struct sk_buff *skb, · 2728 unmodified lines
44594459 return SKB_DROP_REASON_TCP_MD5UNEXPECTED;
44604460 }
44614461
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);
44654474
44664475 if (genhash || memcmp(hash_location, newhash, 16) != 0) {
44674476 NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMD5FAILURE);
net/ipv4/tcp_input.c+22−19
@@ -426,7 +426,7 @@ static void tcp_sndbuf_expand(struct sock *sk) · 425 unmodified lines
426426
427427 if (sk->sk_sndbuf < sndmem)
428428 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])));
430430 }
431431
432432 /* 2. Tuning advertised window (window_clamp, rcv_ssthresh)
@@ -461,7 +461,7 @@ static int __tcp_grow_window(const struct sock *sk, const struct sk_buff *skb, · 28 unmodified lines
461461 struct tcp_sock *tp = tcp_sk(sk);
462462 /* Optimize this! */
463463 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;
465465
466466 while (tp->rcv_ssthresh <= window) {
467467 if (truesize <= skb->len)
@@ -534,7 +534,7 @@ static void tcp_grow_window(struct sock *sk, const struct sk_buff *skb, · 66 unmodified lines
534534 */
535535 static void tcp_init_buffer_space(struct sock *sk)
536536 {
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);
538538 struct tcp_sock *tp = tcp_sk(sk);
539539 int maxwin;
540540
@@ -574,16 +574,17 @@ static void tcp_clamp_window(struct sock *sk) · 33 unmodified lines
574574 struct tcp_sock *tp = tcp_sk(sk);
575575 struct inet_connection_sock *icsk = inet_csk(sk);
576576 struct net *net = sock_net(sk);
577+ int rmem2;
577578
578579 icsk->icsk_ack.quick = 0;
580+ rmem2 = READ_ONCE(net->ipv4.sysctl_tcp_rmem[2]);
579581
580− if (sk->sk_rcvbuf < net->ipv4.sysctl_tcp_rmem[2] &&
582+ if (sk->sk_rcvbuf < rmem2 &&
581583 !(sk->sk_userlocks & SOCK_RCVBUF_LOCK) &&
582584 !tcp_under_memory_pressure(sk) &&
583585 sk_memory_allocated(sk) < sk_prot_mem_limits(sk, 0)) {
584586 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));
587588 }
588589 if (atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf)
589590 tp->rcv_ssthresh = min(tp->window_clamp, 2U * tp->advmss);
@@ -724,7 +725,7 @@ void tcp_rcv_space_adjust(struct sock *sk) · 134 unmodified lines
724725 * <prev RTT . ><current RTT .. ><next RTT .... >
725726 */
726727
727− if (sock_net(sk)->ipv4.sysctl_tcp_moderate_rcvbuf &&
728+ if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_moderate_rcvbuf) &&
728729 !(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) {
729730 int rcvmem, rcvbuf;
730731 u64 rcvwin, grow;
@@ -745,7 +746,7 @@ void tcp_rcv_space_adjust(struct sock *sk) · 14 unmodified lines
745746
746747 do_div(rcvwin, tp->advmss);
747748 rcvbuf = min_t(u64, rcvwin * rcvmem,
748− sock_net(sk)->ipv4.sysctl_tcp_rmem[2]);
749+ READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[2]));
749750 if (rcvbuf > sk->sk_rcvbuf) {
750751 WRITE_ONCE(sk->sk_rcvbuf, rcvbuf);
751752
@@ -910,9 +911,9 @@ static void tcp_update_pacing_rate(struct sock *sk) · 158 unmodified lines
910911 * end of slow start and should slow down.
911912 */
912913 if (tcp_snd_cwnd(tp) < tp->snd_ssthresh / 2)
913− rate *= sock_net(sk)->ipv4.sysctl_tcp_pacing_ss_ratio;
914+ rate *= READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_pacing_ss_ratio);
914915 else
915− rate *= sock_net(sk)->ipv4.sysctl_tcp_pacing_ca_ratio;
916+ rate *= READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_pacing_ca_ratio);
916917
917918 rate *= max(tcp_snd_cwnd(tp), tp->packets_out);
918919
@@ -2175,7 +2176,7 @@ void tcp_enter_loss(struct sock *sk) · 1256 unmodified lines
21752176 * loss recovery is underway except recurring timeout(s) on
21762177 * the same SND.UNA (sec 3.2). Disable F-RTO on path MTU probing
21772178 */
2178− tp->frto = net->ipv4.sysctl_tcp_frto &&
2179+ tp->frto = READ_ONCE(net->ipv4.sysctl_tcp_frto) &&
21792180 (new_recovery || icsk->icsk_retransmits) &&
21802181 !inet_csk(sk)->icsk_mtup.probe_size;
21812182 }
@@ -3058,7 +3059,7 @@ static void tcp_fastretrans_alert(struct sock *sk, const u32 prior_snd_una, · 876 unmodified lines
30583059
30593060 static void tcp_update_rtt_min(struct sock *sk, u32 rtt_us, const int flag)
30603061 {
3061− u32 wlen = sock_net(sk)->ipv4.sysctl_tcp_min_rtt_wlen * HZ;
3062+ u32 wlen = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_min_rtt_wlen) * HZ;
30623063 struct tcp_sock *tp = tcp_sk(sk);
30633064
30643065 if ((flag & FLAG_ACK_MAYBE_DELAYED) && rtt_us > tcp_min_rtt(tp)) {
@@ -3581,7 +3582,8 @@ static bool __tcp_oow_rate_limited(struct net *net, int mib_idx, · 516 unmodified lines
35813582 if (*last_oow_ack_time) {
35823583 s32 elapsed = (s32)(tcp_jiffies32 - *last_oow_ack_time);
35833584
3584− if (0 <= elapsed && elapsed < net->ipv4.sysctl_tcp_invalid_ratelimit) {
3585+ if (0 <= elapsed &&
3586+ elapsed < READ_ONCE(net->ipv4.sysctl_tcp_invalid_ratelimit)) {
35853587 NET_INC_STATS(net, mib_idx);
35863588 return true; /* rate-limited: don't send yet! */
35873589 }
@@ -3629,7 +3631,7 @@ static void tcp_send_challenge_ack(struct sock *sk) · 41 unmodified lines
36293631 /* Then check host-wide RFC 5961 rate limit. */
36303632 now = jiffies / HZ;
36313633 if (now != challenge_timestamp) {
3632− u32 ack_limit = net->ipv4.sysctl_tcp_challenge_ack_limit;
3634+ u32 ack_limit = READ_ONCE(net->ipv4.sysctl_tcp_challenge_ack_limit);
36333635 u32 half = (ack_limit + 1) >> 1;
36343636
36353637 challenge_timestamp = now;
@@ -4426,7 +4428,7 @@ static void tcp_dsack_set(struct sock *sk, u32 seq, u32 end_seq) · 790 unmodified lines
44264428 {
44274429 struct tcp_sock *tp = tcp_sk(sk);
44284430
4429− if (tcp_is_sack(tp) && sock_net(sk)->ipv4.sysctl_tcp_dsack) {
4431+ if (tcp_is_sack(tp) && READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_dsack)) {
44304432 int mib_idx;
44314433
44324434 if (before(seq, tp->rcv_nxt))
@@ -4473,7 +4475,7 @@ static void tcp_send_dupack(struct sock *sk, const struct sk_buff *skb) · 40 unmodified lines
44734475 NET_INC_STATS(sock_net(sk), LINUX_MIB_DELAYEDACKLOST);
44744476 tcp_enter_quickack_mode(sk, TCP_MAX_QUICKACKS);
44754477
4476− if (tcp_is_sack(tp) && sock_net(sk)->ipv4.sysctl_tcp_dsack) {
4478+ if (tcp_is_sack(tp) && READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_dsack)) {
44774479 u32 end_seq = TCP_SKB_CB(skb)->end_seq;
44784480
44794481 tcp_rcv_spurious_retrans(sk, skb);
@@ -5519,7 +5521,7 @@ send_now: · 1039 unmodified lines
55195521 }
55205522
55215523 if (!tcp_is_sack(tp) ||
5522− tp->compressed_ack >= sock_net(sk)->ipv4.sysctl_tcp_comp_sack_nr)
5524+ tp->compressed_ack >= READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_comp_sack_nr))
55235525 goto send_now;
55245526
55255527 if (tp->compressed_ack_rcv_nxt != tp->rcv_nxt) {
@@ -5540,11 +5542,12 @@ send_now: · 14 unmodified lines
55405542 if (tp->srtt_us && tp->srtt_us < rtt)
55415543 rtt = tp->srtt_us;
55425544
5543− delay = min_t(unsigned long, sock_net(sk)->ipv4.sysctl_tcp_comp_sack_delay_ns,
5545+ delay = min_t(unsigned long,
5546+ READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_comp_sack_delay_ns),
55445547 rtt * (NSEC_PER_USEC >> 3)/20);
55455548 sock_hold(sk);
55465549 hrtimer_start_range_ns(&tp->compressed_ack_timer, ns_to_ktime(delay),
5547− sock_net(sk)->ipv4.sysctl_tcp_comp_sack_slack_ns,
5550+ READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_comp_sack_slack_ns),
55485551 HRTIMER_MODE_REL_PINNED_SOFT);
55495552 }
55505553
net/ipv4/tcp_ipv4.c+2−2
@@ -1006,7 +1006,7 @@ static int tcp_v4_send_synack(const struct sock *sk, struct dst_entry *dst, · 1005 unmodified lines
10061006 if (skb) {
10071007 __tcp_v4_send_check(skb, ireq->ir_loc_addr, ireq->ir_rmt_addr);
10081008
1009− tos = sock_net(sk)->ipv4.sysctl_tcp_reflect_tos ?
1009+ tos = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_reflect_tos) ?
10101010 (tcp_rsk(req)->syn_tos & ~INET_ECN_MASK) |
10111011 (inet_sk(sk)->tos & INET_ECN_MASK) :
10121012 inet_sk(sk)->tos;
@@ -1526,7 +1526,7 @@ struct sock *tcp_v4_syn_recv_sock(const struct sock *sk, struct sk_buff *skb, · 513 unmodified lines
15261526 /* Set ToS of the new socket based upon the value of incoming SYN.
15271527 * ECT bits are set later in tcp_init_transfer().
15281528 */
1529− if (sock_net(sk)->ipv4.sysctl_tcp_reflect_tos)
1529+ if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_reflect_tos))
15301530 newinet->tos = tcp_rsk(req)->syn_tos & ~INET_ECN_MASK;
15311531
15321532 if (!dst) {
net/ipv4/tcp_metrics.c+5−5
@@ -329,7 +329,7 @@ void tcp_update_metrics(struct sock *sk) · 328 unmodified lines
329329 int m;
330330
331331 sk_dst_confirm(sk);
332− if (net->ipv4.sysctl_tcp_nometrics_save || !dst)
332+ if (READ_ONCE(net->ipv4.sysctl_tcp_nometrics_save) || !dst)
333333 return;
334334
335335 rcu_read_lock();
@@ -385,7 +385,7 @@ void tcp_update_metrics(struct sock *sk) · 49 unmodified lines
385385
386386 if (tcp_in_initial_slowstart(tp)) {
387387 /* 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) &&
389389 !tcp_metric_locked(tm, TCP_METRIC_SSTHRESH)) {
390390 val = tcp_metric_get(tm, TCP_METRIC_SSTHRESH);
391391 if (val && (tcp_snd_cwnd(tp) >> 1) > val)
@@ -401,7 +401,7 @@ void tcp_update_metrics(struct sock *sk) · 9 unmodified lines
401401 } else if (!tcp_in_slow_start(tp) &&
402402 icsk->icsk_ca_state == TCP_CA_Open) {
403403 /* 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) &&
405405 !tcp_metric_locked(tm, TCP_METRIC_SSTHRESH))
406406 tcp_metric_set(tm, TCP_METRIC_SSTHRESH,
407407 max(tcp_snd_cwnd(tp) >> 1, tp->snd_ssthresh));
@@ -418,7 +418,7 @@ void tcp_update_metrics(struct sock *sk) · 10 unmodified lines
418418 tcp_metric_set(tm, TCP_METRIC_CWND,
419419 (val + tp->snd_ssthresh) >> 1);
420420 }
421− if (!net->ipv4.sysctl_tcp_no_ssthresh_metrics_save &&
421+ if (!READ_ONCE(net->ipv4.sysctl_tcp_no_ssthresh_metrics_save) &&
422422 !tcp_metric_locked(tm, TCP_METRIC_SSTHRESH)) {
423423 val = tcp_metric_get(tm, TCP_METRIC_SSTHRESH);
424424 if (val && tp->snd_ssthresh > val)
@@ -463,7 +463,7 @@ void tcp_init_metrics(struct sock *sk) · 38 unmodified lines
463463 if (tcp_metric_locked(tm, TCP_METRIC_CWND))
464464 tp->snd_cwnd_clamp = tcp_metric_get(tm, TCP_METRIC_CWND);
465465
466− val = net->ipv4.sysctl_tcp_no_ssthresh_metrics_save ?
466+ val = READ_ONCE(net->ipv4.sysctl_tcp_no_ssthresh_metrics_save) ?
467467 0 : tcp_metric_get(tm, TCP_METRIC_SSTHRESH);
468468 if (val) {
469469 tp->snd_ssthresh = val;
net/ipv4/tcp_output.c+12−15
@@ -167,16 +167,13 @@ static void tcp_event_data_sent(struct tcp_sock *tp, · 166 unmodified lines
167167 if (tcp_packets_in_flight(tp) == 0)
168168 tcp_ca_event(sk, CA_EVENT_TX_START);
169169
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−
179170 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);
180177 }
181178
182179 /* Account for an ACK we sent. */
@@ -230,7 +227,7 @@ void tcp_select_initial_window(const struct sock *sk, int __space, __u32 mss, · 47 unmodified lines
230227 * which we interpret as a sign the remote TCP is not
231228 * misinterpreting the window field as a signed quantity.
232229 */
233− if (sock_net(sk)->ipv4.sysctl_tcp_workaround_signed_windows)
230+ if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_workaround_signed_windows))
234231 (*rcv_wnd) = min(space, MAX_TCP_WINDOW);
235232 else
236233 (*rcv_wnd) = min_t(u32, space, U16_MAX);
@@ -241,7 +238,7 @@ void tcp_select_initial_window(const struct sock *sk, int __space, __u32 mss, · 4 unmodified lines
241238 *rcv_wscale = 0;
242239 if (wscale_ok) {
243240 /* Set window scaling on max possible window */
244− space = max_t(u32, space, sock_net(sk)->ipv4.sysctl_tcp_rmem[2]);
241+ space = max_t(u32, space, READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[2]));
245242 space = max_t(u32, space, sysctl_rmem_max);
246243 space = min_t(u32, space, *window_clamp);
247244 *rcv_wscale = clamp_t(int, ilog2(space) - 15,
@@ -285,7 +282,7 @@ static u16 tcp_select_window(struct sock *sk) · 37 unmodified lines
285282 * scaled window.
286283 */
287284 if (!tp->rx_opt.rcv_wscale &&
288− sock_net(sk)->ipv4.sysctl_tcp_workaround_signed_windows)
285+ READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_workaround_signed_windows))
289286 new_win = min(new_win, MAX_TCP_WINDOW);
290287 else
291288 new_win = min(new_win, (65535U << tp->rx_opt.rcv_wscale));
@@ -1976,7 +1973,7 @@ static u32 tcp_tso_autosize(const struct sock *sk, unsigned int mss_now, · 1684 unmodified lines
19761973
19771974 bytes = sk->sk_pacing_rate >> READ_ONCE(sk->sk_pacing_shift);
19781975
1979− r = tcp_min_rtt(tcp_sk(sk)) >> sock_net(sk)->ipv4.sysctl_tcp_tso_rtt_log;
1976+ r = tcp_min_rtt(tcp_sk(sk)) >> READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_tso_rtt_log);
19801977 if (r < BITS_PER_TYPE(sk->sk_gso_max_size))
19811978 bytes += sk->sk_gso_max_size >> r;
19821979
@@ -1995,7 +1992,7 @@ static u32 tcp_tso_segs(struct sock *sk, unsigned int mss_now) · 12 unmodified lines
19951992
19961993 min_tso = ca_ops->min_tso_segs ?
19971994 ca_ops->min_tso_segs(sk) :
1998− sock_net(sk)->ipv4.sysctl_tcp_min_tso_segs;
1995+ READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_min_tso_segs);
19991996
20001997 tso_segs = tcp_tso_autosize(sk, mss_now, min_tso);
20011998 return min_t(u32, tso_segs, sk->sk_gso_max_segs);
@@ -2507,7 +2504,7 @@ static bool tcp_small_queue_check(struct sock *sk, const struct sk_buff *skb, · 505 unmodified lines
25072504 sk->sk_pacing_rate >> READ_ONCE(sk->sk_pacing_shift));
25082505 if (sk->sk_pacing_status == SK_PACING_NONE)
25092506 limit = min_t(unsigned long, limit,
2510− sock_net(sk)->ipv4.sysctl_tcp_limit_output_bytes);
2507+ READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_limit_output_bytes));
25112508 limit <<= factor;
25122509
25132510 if (static_branch_unlikely(&tcp_tx_delay_enabled) &&
net/ipv6/mcast.c+8−6
@@ -1522,7 +1522,6 @@ static void mld_query_work(struct work_struct *work) · 1521 unmodified lines
15221522
15231523 if (++cnt >= MLD_MAX_QUEUE) {
15241524 rework = true;
1525− schedule_delayed_work(&idev->mc_query_work, 0);
15261525 break;
15271526 }
15281527 }
@@ -1533,8 +1532,10 @@ static void mld_query_work(struct work_struct *work) · 4 unmodified lines
15331532 __mld_query_work(skb);
15341533 mutex_unlock(&idev->mc_lock);
15351534
1536− if (!rework)
1537− in6_dev_put(idev);
1535+ if (rework && queue_delayed_work(mld_wq, &idev->mc_query_work, 0))
1536+ return;
1537+
1538+ in6_dev_put(idev);
15381539 }
15391540
15401541 /* called with rcu_read_lock() */
@@ -1624,7 +1625,6 @@ static void mld_report_work(struct work_struct *work) · 83 unmodified lines
16241625
16251626 if (++cnt >= MLD_MAX_QUEUE) {
16261627 rework = true;
1627− schedule_delayed_work(&idev->mc_report_work, 0);
16281628 break;
16291629 }
16301630 }
@@ -1635,8 +1635,10 @@ static void mld_report_work(struct work_struct *work) · 4 unmodified lines
16351635 __mld_report_work(skb);
16361636 mutex_unlock(&idev->mc_lock);
16371637
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);
16401642 }
16411643
16421644 static bool is_in(struct ifmcaddr6 *pmc, struct ip6_sf_list *psf, int type,
net/ipv6/ping.c+6−0
@@ -22,6 +22,11 @@ · 21 unmodified lines
2222 #include <linux/proc_fs.h>
2323 #include <net/ping.h>
2424
25+static void ping_v6_destroy(struct sock *sk)
26+{
27+ inet6_destroy_sock(sk);
28+}
29+
2530 /* Compatibility glue so we can support IPv6 when it's compiled as a module */
2631 static int dummy_ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len,
2732 int *addr_len)
@@ -181,6 +186,7 @@ struct proto pingv6_prot = { · 153 unmodified lines
181186 .owner = THIS_MODULE,
182187 .init = ping_init_sock,
183188 .close = ping_close,
189+ .destroy = ping_v6_destroy,
184190 .connect = ip6_datagram_connect_v6_only,
185191 .disconnect = __udp_disconnect,
186192 .setsockopt = ipv6_setsockopt,
net/ipv6/tcp_ipv6.c+2−2
@@ -546,7 +546,7 @@ static int tcp_v6_send_synack(const struct sock *sk, struct dst_entry *dst, · 545 unmodified lines
546546 if (np->repflow && ireq->pktopts)
547547 fl6->flowlabel = ip6_flowlabel(ipv6_hdr(ireq->pktopts));
548548
549− tclass = sock_net(sk)->ipv4.sysctl_tcp_reflect_tos ?
549+ tclass = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_reflect_tos) ?
550550 (tcp_rsk(req)->syn_tos & ~INET_ECN_MASK) |
551551 (np->tclass & INET_ECN_MASK) :
552552 np->tclass;
@@ -1314,7 +1314,7 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff * · 761 unmodified lines
13141314 /* Set ToS of the new socket based upon the value of incoming SYN.
13151315 * ECT bits are set later in tcp_init_transfer().
13161316 */
1317− if (sock_net(sk)->ipv4.sysctl_tcp_reflect_tos)
1317+ if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_reflect_tos))
13181318 newnp->tclass = tcp_rsk(req)->syn_tos & ~INET_ECN_MASK;
13191319
13201320 /* Clone native IPv6 options from listening socket (if any)
net/mac80211/iface.c+1−2
@@ -377,9 +377,8 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do · 376 unmodified lines
377377 bool cancel_scan;
378378 struct cfg80211_nan_func *func;
379379
380− spin_lock_bh(&local->fq.lock);
381380 clear_bit(SDATA_STATE_RUNNING, &sdata->state);
382− spin_unlock_bh(&local->fq.lock);
381+ synchronize_rcu(); /* flush _ieee80211_wake_txqs() */
383382
384383 cancel_scan = rcu_access_pointer(local->scan_sdata) == sdata;
385384 if (cancel_scan)
net/mptcp/options.c+1−1
@@ -1271,7 +1271,7 @@ raise_win: · 1270 unmodified lines
12711271 if (unlikely(th->syn))
12721272 new_win = min(new_win, 65535U) << tp->rx_opt.rcv_wscale;
12731273 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))
12751275 new_win = min(new_win, MAX_TCP_WINDOW);
12761276 else
12771277 new_win = min(new_win, (65535U << tp->rx_opt.rcv_wscale));
net/mptcp/protocol.c+4−4
@@ -1908,7 +1908,7 @@ static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied) · 1907 unmodified lines
19081908 if (msk->rcvq_space.copied <= msk->rcvq_space.space)
19091909 goto new_measure;
19101910
1911− if (sock_net(sk)->ipv4.sysctl_tcp_moderate_rcvbuf &&
1911+ if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_moderate_rcvbuf) &&
19121912 !(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) {
19131913 int rcvmem, rcvbuf;
19141914 u64 rcvwin, grow;
@@ -1926,7 +1926,7 @@ static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied) · 11 unmodified lines
19261926
19271927 do_div(rcvwin, advmss);
19281928 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]));
19301930
19311931 if (rcvbuf > sk->sk_rcvbuf) {
19321932 u32 window_clamp;
@@ -2669,8 +2669,8 @@ static int mptcp_init_sock(struct sock *sk) · 736 unmodified lines
26692669 mptcp_ca_reset(sk);
26702670
26712671 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]);
26742674
26752675 return 0;
26762676 }
net/mptcp/subflow.c+1−1
@@ -1533,7 +1533,7 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, · 1532 unmodified lines
15331533 mptcp_sock_graft(ssk, sk->sk_socket);
15341534 iput(SOCK_INODE(sf));
15351535 WRITE_ONCE(msk->allow_infinite_fallback, false);
1536− return err;
1536+ return 0;
15371537
15381538 failed_unlink:
15391539 list_del(&subflow->node);
net/netfilter/nf_tables_api.c+6−0
@@ -3340,6 +3340,8 @@ int nft_chain_validate(const struct nft_ctx *ctx, const struct nft_chain *chain) · 3339 unmodified lines
33403340 if (err < 0)
33413341 return err;
33423342 }
3343+
3344+ cond_resched();
33433345 }
33443346
33453347 return 0;
@@ -9367,9 +9369,13 @@ static int nf_tables_check_loops(const struct nft_ctx *ctx, · 6021 unmodified lines
93679369 break;
93689370 }
93699371 }
9372+
9373+ cond_resched();
93709374 }
93719375
93729376 list_for_each_entry(set, &ctx->table->sets, list) {
9377+ cond_resched();
9378+
93739379 if (!nft_is_active_next(ctx->net, set))
93749380 continue;
93759381 if (!(set->flags & NFT_SET_MAP) ||
net/netfilter/nfnetlink_queue.c+6−1
@@ -843,11 +843,16 @@ nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum) · 842 unmodified lines
843843 }
844844
845845 static int
846−nfqnl_mangle(void *data, int data_len, struct nf_queue_entry *e, int diff)
846+nfqnl_mangle(void *data, unsigned int data_len, struct nf_queue_entry *e, int diff)
847847 {
848848 struct sk_buff *nskb;
849849
850850 if (diff < 0) {
851+ unsigned int min_len = skb_transport_offset(e->skb);
852+
853+ if (data_len < min_len)
854+ return -EINVAL;
855+
851856 if (pskb_trim(e->skb, data_len))
852857 return -ENOMEM;
853858 } else if (diff > 0) {
net/netfilter/nft_queue.c+27−0
@@ -68,6 +68,31 @@ static void nft_queue_sreg_eval(const struct nft_expr *expr, · 67 unmodified lines
6868 regs->verdict.code = ret;
6969 }
7070
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+
7196 static const struct nla_policy nft_queue_policy[NFTA_QUEUE_MAX + 1] = {
7297 [NFTA_QUEUE_NUM] = { .type = NLA_U16 },
7398 [NFTA_QUEUE_TOTAL] = { .type = NLA_U16 },
@@ -164,6 +189,7 @@ static const struct nft_expr_ops nft_queue_ops = { · 90 unmodified lines
164189 .eval = nft_queue_eval,
165190 .init = nft_queue_init,
166191 .dump = nft_queue_dump,
192+ .validate = nft_queue_validate,
167193 .reduce = NFT_REDUCE_READONLY,
168194 };
169195
@@ -173,6 +199,7 @@ static const struct nft_expr_ops nft_queue_sreg_ops = { · 3 unmodified lines
173199 .eval = nft_queue_sreg_eval,
174200 .init = nft_queue_sreg_init,
175201 .dump = nft_queue_sreg_dump,
202+ .validate = nft_queue_validate,
176203 .reduce = NFT_REDUCE_READONLY,
177204 };
178205
net/sctp/associola.c+2−3
@@ -229,9 +229,8 @@ static struct sctp_association *sctp_association_init( · 228 unmodified lines
229229 if (!sctp_ulpq_init(&asoc->ulpq, asoc))
230230 goto fail_init;
231231
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;
235234
236235 /* Initialize default path MTU. */
237236 asoc->pathmtu = sp->pathmtu;
net/sctp/stream.c+3−16
@@ -137,7 +137,7 @@ int sctp_stream_init(struct sctp_stream *stream, __u16 outcnt, __u16 incnt, · 136 unmodified lines
137137
138138 ret = sctp_stream_alloc_out(stream, outcnt, gfp);
139139 if (ret)
140− goto out_err;
140+ return ret;
141141
142142 for (i = 0; i < stream->outcnt; i++)
143143 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN;
@@ -145,22 +145,9 @@ int sctp_stream_init(struct sctp_stream *stream, __u16 outcnt, __u16 incnt, · 1 unmodified line
145145 handle_in:
146146 sctp_stream_interleave_init(stream);
147147 if (!incnt)
148− goto out;
149−
150− ret = sctp_stream_alloc_in(stream, incnt, gfp);
151− if (ret)
152− goto in_err;
153−
154− goto out;
148+ return 0;
155149
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);
164151 }
165152
166153 int sctp_stream_init_ext(struct sctp_stream *stream, __u16 sid)
net/sctp/stream_sched.c+1−1
@@ -160,7 +160,7 @@ int sctp_sched_set_sched(struct sctp_association *asoc, · 159 unmodified lines
160160 if (!SCTP_SO(&asoc->stream, i)->ext)
161161 continue;
162162
163− ret = n->init_sid(&asoc->stream, i, GFP_KERNEL);
163+ ret = n->init_sid(&asoc->stream, i, GFP_ATOMIC);
164164 if (ret)
165165 goto err;
166166 }
net/tipc/socket.c+1−1
@@ -517,7 +517,7 @@ static int tipc_sk_create(struct net *net, struct socket *sock, · 516 unmodified lines
517517 timer_setup(&sk->sk_timer, tipc_sk_timeout, 0);
518518 sk->sk_shutdown = 0;
519519 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]);
521521 sk->sk_data_ready = tipc_data_ready;
522522 sk->sk_write_space = tipc_write_space;
523523 sk->sk_destruct = tipc_sock_destruct;
net/tls/tls_device.c+6−1
@@ -1376,8 +1376,13 @@ static int tls_device_down(struct net_device *netdev) · 1375 unmodified lines
13761376 * by tls_device_free_ctx. rx_conf and tx_conf stay in TLS_HW.
13771377 * Now release the ref taken above.
13781378 */
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);
13801384 tls_device_free_ctx(ctx);
1385+ }
13811386 }
13821387
13831388 up_write(&device_offload_lock);
tools/arch/x86/include/asm/cpufeatures.h+1−0
@@ -302,6 +302,7 @@ · 301 unmodified lines
302302 #define X86_FEATURE_RETPOLINE_LFENCE (11*32+13) /* "" Use LFENCE for Spectre variant 2 */
303303 #define X86_FEATURE_RETHUNK (11*32+14) /* "" Use REturn THUNK */
304304 #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 */
305306
306307 /* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */
307308 #define X86_FEATURE_AVX_VNNI (12*32+ 4) /* AVX VNNI instructions */
tools/include/uapi/asm-generic/fcntl.h+10−1
@@ -1,3 +1,4 @@
1+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
12 #ifndef _ASM_GENERIC_FCNTL_H
23 #define _ASM_GENERIC_FCNTL_H
34
@@ -90,7 +91,7 @@ · 86 unmodified lines
9091
9192 /* a horrid kludge trying to make sure that this will fail on old kernels */
9293 #define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
93−#define O_TMPFILE_MASK (__O_TMPFILE | O_DIRECTORY | O_CREAT)
94+#define O_TMPFILE_MASK (__O_TMPFILE | O_DIRECTORY | O_CREAT)
9495
9596 #ifndef O_NDELAY
9697 #define O_NDELAY O_NONBLOCK
@@ -115,11 +116,13 @@ · 18 unmodified lines
115116 #define F_GETSIG 11 /* for sockets. */
116117 #endif
117118
119+#if __BITS_PER_LONG == 32 || defined(__KERNEL__)
118120 #ifndef F_GETLK64
119121 #define F_GETLK64 12 /* using 'struct flock64' */
120122 #define F_SETLK64 13
121123 #define F_SETLKW64 14
122124 #endif
125+#endif /* __BITS_PER_LONG == 32 || defined(__KERNEL__) */
123126
124127 #ifndef F_SETOWN_EX
125128 #define F_SETOWN_EX 15
@@ -178,6 +181,10 @@ struct f_owner_ex { · 52 unmodified lines
178181 blocking */
179182 #define LOCK_UN 8 /* remove lock */
180183
184+/*
185+ * LOCK_MAND support has been removed from the kernel. We leave the symbols
186+ * here to not break legacy builds, but these should not be used in new code.
187+ */
181188 #define LOCK_MAND 32 /* This is a mandatory flock ... */
182189 #define LOCK_READ 64 /* which allows concurrent read operations */
183190 #define LOCK_WRITE 128 /* which allows concurrent write operations */
@@ -185,6 +192,7 @@ struct f_owner_ex { · 1 unmodified line
185192
186193 #define F_LINUX_SPECIFIC_BASE 1024
187194
195+#ifndef HAVE_ARCH_STRUCT_FLOCK
188196 struct flock {
189197 short l_type;
190198 short l_whence;
@@ -209,5 +217,6 @@ struct flock64 { · 18 unmodified lines
209217 __ARCH_FLOCK64_PAD
210218 #endif
211219 };
220+#endif /* HAVE_ARCH_STRUCT_FLOCK */
212221
213222 #endif /* _ASM_GENERIC_FCNTL_H */
tools/perf/scripts/python/arm-cs-trace-disasm.py+18−16
@@ -61,7 +61,7 @@ def get_optional(perf_dict, field): · 60 unmodified lines
6161
6262 def get_offset(perf_dict, field):
6363 if field in perf_dict:
64− return f"+0x{perf_dict[field]:x}"
64+ return "+%#x" % perf_dict[field]
6565 return ""
6666
6767 def get_dso_file_path(dso_name, dso_build_id):
@@ -76,7 +76,7 @@ def get_dso_file_path(dso_name, dso_build_id): · 8 unmodified lines
7676 else:
7777 append = "/elf"
7878
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;
8080 # Replace duplicate slash chars to single slash char
8181 dso_path = dso_path.replace('//', '/', 1)
8282 return dso_path
@@ -94,8 +94,8 @@ def read_disam(dso_fname, dso_start, start_addr, stop_addr): · 11 unmodified lines
9494 start_addr = start_addr - dso_start;
9595 stop_addr = stop_addr - dso_start;
9696 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") ]
9999 disasm += [ dso_fname ]
100100 disasm_output = check_output(disasm).decode('utf-8').split('\n')
101101 disasm_cache[addr_range] = disasm_output
@@ -109,12 +109,14 @@ def print_disam(dso_fname, dso_start, start_addr, stop_addr): · 7 unmodified lines
109109 m = disasm_re.search(line)
110110 if m is None:
111111 continue
112− print(f"\t{line}")
112+ print("\t" + line)
113113
114114 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']))
118120
119121 def trace_begin():
120122 print('ARM CoreSight Trace Data Assembler Dump')
@@ -131,7 +133,7 @@ def common_start_str(comm, sample): · 10 unmodified lines
131133 cpu = sample["cpu"]
132134 pid = sample["pid"]
133135 tid = sample["tid"]
134− return f"{comm:>16} {pid:>5}/{tid:<5} [{cpu:04}] {sec:9}.{ns:09} "
136+ return "%16s %5u/%-5u [%04u] %9u.%09u " % (comm, pid, tid, cpu, sec, ns)
135137
136138 # This code is copied from intel-pt-events.py for printing source code
137139 # line and symbols.
@@ -171,7 +173,7 @@ def print_srccode(comm, param_dict, sample, symbol, dso): · 33 unmodified lines
171173 glb_line_number = line_number
172174 glb_source_file_name = source_file_name
173175
174− print(f"{start_str}{src_str}")
176+ print(start_str, src_str)
175177
176178 def process_event(param_dict):
177179 global cache_size
@@ -188,7 +190,7 @@ def process_event(param_dict): · 10 unmodified lines
188190 symbol = get_optional(param_dict, "symbol")
189191
190192 if (options.verbose == True):
191− print(f"Event type: {name}")
193+ print("Event type: %s" % name)
192194 print_sample(sample)
193195
194196 # If cannot find dso so cannot dump assembler, bail out
@@ -197,7 +199,7 @@ def process_event(param_dict): · 2 unmodified lines
197199
198200 # Validate dso start and end addresses
199201 if ((dso_start == '[unknown]') or (dso_end == '[unknown]')):
200− print(f"Failed to find valid dso map for dso {dso}")
202+ print("Failed to find valid dso map for dso %s" % dso)
201203 return
202204
203205 if (name[0:12] == "instructions"):
@@ -244,15 +246,15 @@ def process_event(param_dict): · 40 unmodified lines
244246
245247 # Handle CS_ETM_TRACE_ON packet if start_addr=0 and stop_addr=4
246248 if (start_addr == 0 and stop_addr == 4):
247− print(f"CPU{cpu}: CS_ETM_TRACE_ON packet is inserted")
249+ print("CPU%d: CS_ETM_TRACE_ON packet is inserted" % cpu)
248250 return
249251
250252 if (start_addr < int(dso_start) or start_addr > int(dso_end)):
251− print(f"Start address 0x{start_addr:x} is out of range [ 0x{dso_start:x} .. 0x{dso_end:x} ] for dso {dso}")
253+ 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))
252254 return
253255
254256 if (stop_addr < int(dso_start) or stop_addr > int(dso_end)):
255− print(f"Stop address 0x{stop_addr:x} is out of range [ 0x{dso_start:x} .. 0x{dso_end:x} ] for dso {dso}")
257+ 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))
256258 return
257259
258260 if (options.objdump_name != None):
@@ -267,6 +269,6 @@ def process_event(param_dict): · 8 unmodified lines
267269 if path.exists(dso_fname):
268270 print_disam(dso_fname, dso_vm_start, start_addr, stop_addr)
269271 else:
270− print(f"Failed to find dso {dso} for address range [ 0x{start_addr:x} .. 0x{stop_addr:x} ]")
272+ print("Failed to find dso %s for address range [ 0x%x .. 0x%x ]" % (dso, start_addr, stop_addr))
271273
272274 print_srccode(comm, param_dict, sample, symbol, dso)
tools/perf/util/bpf-loader.c+7−11
@@ -63,20 +63,16 @@ static struct hashmap *bpf_map_hash; · 62 unmodified lines
6363 static struct bpf_perf_object *
6464 bpf_perf_object__next(struct bpf_perf_object *prev)
6565 {
66− struct bpf_perf_object *next;
67−
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);
66+ if (!prev) {
67+ if (list_empty(&bpf_objects_list))
68+ return NULL;
7469
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))
7773 return NULL;
7874
79− return next;
75+ return list_next_entry(prev, list);
8076 }
8177
8278 #define bpf_perf_object__for_each(perf_obj, tmp) \
tools/perf/util/symbol-elf.c+52−4
@@ -233,6 +233,33 @@ Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep, · 232 unmodified lines
233233 return NULL;
234234 }
235235
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+
236263 static bool want_demangle(bool is_kernel_sym)
237264 {
238265 return is_kernel_sym ? symbol_conf.demangle_kernel : symbol_conf.demangle;
@@ -1209,6 +1236,7 @@ dso__load_sym_internal(struct dso *dso, struct map *map, struct symsrc *syms_ss, · 970 unmodified lines
12091236 sym.st_value);
12101237 used_opd = true;
12111238 }
1239+
12121240 /*
12131241 * When loading symbols in a data mapping, ABS symbols (which
12141242 * has a value of SHN_ABS in its st_shndx) failed at
@@ -1227,6 +1255,17 @@ dso__load_sym_internal(struct dso *dso, struct map *map, struct symsrc *syms_ss, · 12 unmodified lines
12271255
12281256 gelf_getshdr(sec, &shdr);
12291257
1258+ /*
1259+ * If the attribute bit SHF_ALLOC is not set, the section
1260+ * doesn't occupy memory during process execution.
1261+ * E.g. ".gnu.warning.*" section is used by linker to generate
1262+ * warnings when calling deprecated functions, the symbols in
1263+ * the section aren't loaded to memory during process execution,
1264+ * so skip them.
1265+ */
1266+ if (!(shdr.sh_flags & SHF_ALLOC))
1267+ continue;
1268+
12301269 secstrs = secstrs_sym;
12311270
12321271 /*
@@ -1262,11 +1301,20 @@ dso__load_sym_internal(struct dso *dso, struct map *map, struct symsrc *syms_ss, · 29 unmodified lines
12621301 goto out_elf_end;
12631302 } else if ((used_opd && runtime_ss->adjust_symbols) ||
12641303 (!used_opd && syms_ss->adjust_symbols)) {
1304+ GElf_Phdr phdr;
1305+
1306+ if (elf_read_program_header(syms_ss->elf,
1307+ (u64)sym.st_value, &phdr)) {
1308+ pr_warning("%s: failed to find program header for "
1309+ "symbol: %s st_value: %#" PRIx64 "\n",
1310+ __func__, elf_name, (u64)sym.st_value);
1311+ continue;
1312+ }
12651313 pr_debug4("%s: adjusting symbol: st_value: %#" PRIx64 " "
1266− "sh_addr: %#" PRIx64 " sh_offset: %#" PRIx64 "\n", __func__,
1267− (u64)sym.st_value, (u64)shdr.sh_addr,
1268− (u64)shdr.sh_offset);
1269− sym.st_value -= shdr.sh_addr - shdr.sh_offset;
1314+ "p_vaddr: %#" PRIx64 " p_offset: %#" PRIx64 "\n",
1315+ __func__, (u64)sym.st_value, (u64)phdr.p_vaddr,
1316+ (u64)phdr.p_offset);
1317+ sym.st_value -= phdr.p_vaddr - phdr.p_offset;
12701318 }
12711319
12721320 demangled = demangle_sym(dso, kmodule, elf_name);