History

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

Conflicts: net/ipv4/ip_gre.c Minor conflicts between tunnel bug fixes in net and ipv6 tunnel cleanups in net-next.

David S. Miller committed 10 years ago

Commit cba65322 parents 26879da 7391daf263 files · +2446 −1230Browse files

Unified · Split

263 files
  1. .mailmap +4 −0
  2. Documentation/devicetree/bindings/arc/archs-pct.txt +1 −1
  3. Documentation/devicetree/bindings/arc/pct.txt +1 −1
  4. Documentation/devicetree/bindings/i2c/i2c-rk3x.txt +2 −2
  5. Documentation/devicetree/bindings/net/cpsw.txt +3 −3
  6. Documentation/networking/altera_tse.txt +3 −3
  7. Documentation/networking/ipvlan.txt +3 −3
  8. Documentation/networking/pktgen.txt +3 −3
  9. Documentation/networking/vrf.txt +1 −1
  10. Documentation/networking/xfrm_sync.txt +3 −3
  11. Documentation/sysctl/vm.txt +10 −9
  12. MAINTAINERS +7 −6
  13. Makefile +2 −2
  14. arch/arc/Kconfig +2 −0
  15. arch/arc/include/asm/irqflags-arcv2.h +35 −1
  16. arch/arc/kernel/entry-arcv2.S +9 −1
  17. arch/arc/kernel/entry-compact.S +3 −0
  18. arch/arc/mm/init.c +4 −0
  19. arch/nios2/lib/memset.c +1 −1
  20. arch/powerpc/include/asm/systbl.h +2 −0
  21. arch/powerpc/include/asm/unistd.h +1 −1
  22. arch/powerpc/include/uapi/asm/unistd.h +2 −0
  23. arch/s390/include/asm/mmu.h +1 −1
  24. arch/s390/include/asm/mmu_context.h +22 −6
  25. arch/s390/include/asm/pgalloc.h +2 −2
  26. arch/s390/include/asm/processor.h +1 −1
  27. arch/s390/include/asm/tlbflush.h +3 −6
  28. arch/s390/mm/init.c +2 −1
  29. arch/s390/mm/mmap.c +3 −3
  30. arch/s390/mm/pgalloc.c +28 −57
  31. arch/s390/pci/pci_dma.c +10 −6
  32. arch/sparc/configs/sparc32_defconfig +0 −1
  33. arch/sparc/configs/sparc64_defconfig +0 −1
  34. arch/sparc/include/asm/spitfire.h +1 −0
  35. arch/sparc/include/uapi/asm/unistd.h +3 −1
  36. arch/sparc/kernel/cherrs.S +5 −9
  37. arch/sparc/kernel/cpu.c +6 −0
  38. arch/sparc/kernel/cpumap.c +1 −0
  39. arch/sparc/kernel/fpu_traps.S +5 −6
  40. arch/sparc/kernel/head_64.S +16 −16
  41. arch/sparc/kernel/misctrap.S +4 −8
  42. arch/sparc/kernel/pci.c +36 −6
  43. arch/sparc/kernel/setup_64.c +6 −1
  44. arch/sparc/kernel/spiterrs.S +6 −12
  45. arch/sparc/kernel/systbls_32.S +1 −1
  46. arch/sparc/kernel/systbls_64.S +2 −2
  47. arch/sparc/kernel/utrap.S +1 −2
  48. arch/sparc/kernel/vio.c +18 −0
  49. arch/sparc/kernel/vmlinux.lds.S +4 −0
  50. arch/sparc/kernel/winfixup.S +1 −2
  51. arch/sparc/mm/init_64.c +3 −0
  52. arch/x86/events/amd/core.c +1 −1
  53. arch/x86/events/intel/core.c +1 −0
  54. arch/x86/events/intel/lbr.c +4 −2
  55. arch/x86/events/intel/pt.c +64 −11
  56. arch/x86/events/intel/pt.h +3 −0
  57. arch/x86/events/intel/rapl.c +1 −0
  58. arch/x86/include/asm/perf_event.h +4 −0
  59. arch/x86/kernel/apic/vector.c +2 −1
  60. arch/x86/kernel/head_32.S +0 −6
  61. arch/x86/kvm/vmx.c +4 −0
  62. arch/x86/mm/setup_nx.c +3 −2
  63. arch/x86/xen/spinlock.c +6 −0
  64. drivers/block/rbd.c +25 −27
  65. drivers/clk/imx/clk-imx6q.c +1 −1
  66. drivers/cpufreq/cpufreq_governor.c +2 −6
  67. drivers/cpufreq/intel_pstate.c +5 −0
  68. drivers/edac/i7core_edac.c +1 −1
  69. drivers/edac/sb_edac.c +1 −1
  70. drivers/firmware/efi/vars.c +26 −11
  71. drivers/gpio/gpio-rcar.c +6 −59
  72. drivers/gpio/gpiolib-acpi.c +1 −1
  73. drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +7 −4
  74. drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 −7
  75. drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +4 −1
  76. drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +4 −1
  77. drivers/gpu/drm/drm_dp_mst_topology.c +20 −0
  78. drivers/gpu/drm/etnaviv/etnaviv_gpu.c +18 −13
  79. drivers/gpu/drm/radeon/evergreen.c +153 −1
  80. drivers/gpu/drm/radeon/evergreen_reg.h +46 −0
  81. drivers/gpu/drm/ttm/ttm_bo.c +4 −13
  82. drivers/gpu/drm/virtio/virtgpu_display.c +12 −0
  83. drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +5 −5
  84. drivers/gpu/drm/vmwgfx/vmwgfx_fb.c +3 −3
  85. drivers/hid/hid-ids.h +1 −0
  86. drivers/hid/usbhid/hid-quirks.c +1 −0
  87. drivers/hid/wacom_wac.c +6 −0
  88. drivers/i2c/busses/Kconfig +2 −2
  89. drivers/i2c/busses/i2c-cpm.c +2 −2
  90. drivers/i2c/busses/i2c-exynos5.c +19 −5
  91. drivers/i2c/busses/i2c-ismt.c +2 −0
  92. drivers/i2c/busses/i2c-rk3x.c +1 −0
  93. drivers/infiniband/core/cache.c +2 −1
  94. drivers/infiniband/core/ucm.c +4 −0
  95. drivers/infiniband/core/ucma.c +3 −0
  96. drivers/infiniband/core/uverbs_main.c +5 −0
  97. drivers/infiniband/core/verbs.c +2 −1
  98. drivers/infiniband/hw/cxgb3/iwch_provider.c +2 −0
  99. drivers/infiniband/hw/cxgb4/cq.c +1 −1
  100. drivers/infiniband/hw/cxgb4/provider.c +2 −0
  101. drivers/infiniband/hw/cxgb4/qp.c +21 −3
  102. drivers/infiniband/hw/mlx5/main.c +1 −1
  103. drivers/infiniband/hw/nes/nes_nic.c +0 −3
  104. drivers/infiniband/hw/qib/qib_file_ops.c +5 −0
  105. drivers/infiniband/sw/rdmavt/qp.c +2 −2
  106. drivers/md/md.c +2 −0
  107. drivers/md/raid0.c +1 −1
  108. drivers/md/raid5.c +0 −2
  109. drivers/media/usb/usbvision/usbvision-video.c +0 −7
  110. drivers/media/v4l2-core/videobuf2-core.c +15 −5
  111. drivers/media/v4l2-core/videobuf2-memops.c +1 −1
  112. drivers/media/v4l2-core/videobuf2-v4l2.c +12 −8
  113. drivers/misc/cxl/context.c +7 −0
  114. drivers/misc/cxl/cxl.h +2 −0
  115. drivers/misc/cxl/irq.c +0 −1
  116. drivers/misc/cxl/native.c +31 −0
  117. drivers/mmc/host/Kconfig +1 −0
  118. drivers/mmc/host/sdhci-acpi.c +81 −0
  119. drivers/mmc/host/sunxi-mmc.c +5 −0
  120. drivers/net/dsa/mv88e6xxx.c +1 −1
  121. drivers/net/ethernet/broadcom/bnxt/bnxt.c +39 −14
  122. drivers/net/ethernet/broadcom/bnxt/bnxt.h +13 −0
  123. drivers/net/ethernet/cadence/macb.c +21 −13
  124. drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c +2 −1
  125. drivers/net/ethernet/marvell/mvneta.c +2 −4
  126. drivers/net/ethernet/marvell/pxa168_eth.c +2 −0
  127. drivers/net/ethernet/mellanox/mlx5/core/Kconfig +1 −0
  128. drivers/net/ethernet/mellanox/mlx5/core/en.h +1 −0
  129. drivers/net/ethernet/mellanox/mlx5/core/en_main.c +21 −13
  130. drivers/net/ethernet/mellanox/mlx5/core/uar.c +4 −2
  131. drivers/net/ethernet/mellanox/mlx5/core/vxlan.c +38 −12
  132. drivers/net/ethernet/mellanox/mlx5/core/vxlan.h +9 −2
  133. drivers/net/ethernet/myricom/myri10ge/myri10ge.c +2 −2
  134. drivers/net/ethernet/sfc/ef10.c +13 −2
  135. drivers/net/ethernet/ti/cpsw.c +36 −31
  136. drivers/net/ethernet/ti/cpsw.h +1 −0
  137. drivers/net/ethernet/ti/davinci_emac.c +4 −1
  138. drivers/net/ethernet/toshiba/ps3_gelic_wireless.c +1 −1
  139. drivers/net/phy/at803x.c +18 −22
  140. drivers/net/usb/lan78xx.c +38 −6
  141. drivers/net/usb/pegasus.c +5 −5
  142. drivers/net/usb/smsc75xx.c +11 −1
  143. drivers/net/usb/smsc95xx.c +11 −1
  144. drivers/net/wireless/ath/ath9k/ar5008_phy.c +3 −5
  145. drivers/net/wireless/ath/ath9k/ar9002_phy.c +0 −5
  146. drivers/net/wireless/intel/iwlwifi/iwl-8000.c +1 −1
  147. drivers/net/wireless/intel/iwlwifi/iwl-drv.c +0 −13
  148. drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c +4 −2
  149. drivers/net/wireless/intel/iwlwifi/mvm/fw.c +2 −0
  150. drivers/net/wireless/intel/iwlwifi/pcie/drv.c +10 −0
  151. drivers/platform/x86/toshiba_acpi.c +1 −1
  152. drivers/rapidio/devices/rio_mport_cdev.c +2 −2
  153. drivers/s390/char/sclp_ctl.c +7 −5
  154. drivers/staging/media/davinci_vpfe/vpfe_video.c +34 −20
  155. drivers/staging/rdma/hfi1/TODO +1 −1
  156. drivers/staging/rdma/hfi1/file_ops.c +35 −56
  157. drivers/staging/rdma/hfi1/mmu_rb.c +25 −15
  158. drivers/staging/rdma/hfi1/mmu_rb.h +2 −1
  159. drivers/staging/rdma/hfi1/qp.c +2 −0
  160. drivers/staging/rdma/hfi1/user_exp_rcv.c +7 −4
  161. drivers/staging/rdma/hfi1/user_sdma.c +22 −11
  162. drivers/thermal/hisi_thermal.c +2 −2
  163. drivers/thermal/thermal_core.c +1 −1
  164. fs/ceph/mds_client.c +2 −4
  165. fs/fuse/file.c +1 −1
  166. fs/ocfs2/dlm/dlmmaster.c +2 −0
  167. fs/proc/task_mmu.c +30 −3
  168. fs/udf/super.c +2 −2
  169. fs/udf/udfdecl.h +1 −1
  170. fs/udf/unicode.c +14 −2
  171. include/linux/bpf.h +2 −1
  172. include/linux/ceph/auth.h +5 −5
  173. include/linux/ceph/osd_client.h +0 −1
  174. include/linux/cgroup-defs.h +1 −0
  175. include/linux/cpuset.h +0 −6
  176. include/linux/hash.h +18 −2
  177. include/linux/huge_mm.h +5 −0
  178. include/linux/if_ether.h +5 −0
  179. include/linux/lockdep.h +5 −3
  180. include/linux/mlx5/device.h +11 −0
  181. include/linux/mm.h +4 −0
  182. include/linux/net.h +9 −1
  183. include/linux/netdevice.h +1 −1
  184. include/media/videobuf2-core.h +8 −0
  185. include/net/vxlan.h +3 −1
  186. include/rdma/ib.h +16 −0
  187. include/sound/hda_i915.h +2 −3
  188. include/uapi/linux/v4l2-dv-timings.h +20 −10
  189. kernel/bpf/inode.c +4 −3
  190. kernel/bpf/syscall.c +20 −4
  191. kernel/bpf/verifier.c +47 −29
  192. kernel/cgroup.c +5 −2
  193. kernel/cpuset.c +2 −2
  194. kernel/events/core.c +38 −17
  195. kernel/kcov.c +2 −1
  196. kernel/kexec_core.c +5 −2
  197. kernel/locking/lockdep.c +34 −3
  198. kernel/locking/lockdep_proc.c +2 −0
  199. kernel/workqueue.c +29 −0
  200. lib/stackdepot.c +0 −4
  201. mm/huge_memory.c +5 −7
  202. mm/memcontrol.c +19 −18
  203. mm/memory-failure.c +9 −1
  204. mm/memory.c +40 −0
  205. mm/migrate.c +7 −1
  206. mm/page_io.c +5 −1
  207. mm/swap.c +5 −0
  208. mm/vmscan.c +15 −15
  209. net/batman-adv/bat_v.c +12 −0
  210. net/batman-adv/distributed-arp-table.c +10 −7
  211. net/batman-adv/hard-interface.c +4 −2
  212. net/batman-adv/originator.c +6 −11
  213. net/batman-adv/routing.c +9 −0
  214. net/batman-adv/send.c +6 −0
  215. net/batman-adv/soft-interface.c +6 −2
  216. net/batman-adv/translation-table.c +4 −38
  217. net/batman-adv/types.h +7 −0
  218. net/ceph/auth.c +2 −6
  219. net/ceph/auth_none.c +39 −32
  220. net/ceph/auth_none.h +1 −2
  221. net/ceph/auth_x.c +10 −11
  222. net/ceph/auth_x.h +1 −0
  223. net/ceph/osd_client.c +2 −4
  224. net/core/dev.c +1 −1
  225. net/ipv4/inet_hashtables.c +2 −0
  226. net/ipv4/ip_gre.c +13 −6
  227. net/ipv4/ip_tunnel.c +2 −2
  228. net/ipv6/ila/ila_lwt.c +1 −2
  229. net/l2tp/l2tp_core.c +2 −2
  230. net/mac80211/iface.c +2 −2
  231. net/rds/tcp.c +2 −1
  232. net/rds/tcp.h +4 −0
  233. net/rds/tcp_connect.c +8 −0
  234. net/rds/tcp_listen.c +36 −18
  235. net/sched/sch_netem.c +59 −2
  236. net/tipc/node.c +5 −0
  237. samples/bpf/trace_output_kern.c +0 −1
  238. sound/hda/ext/hdac_ext_stream.c +2 −3
  239. sound/hda/hdac_i915.c +51 −11
  240. sound/pci/hda/hda_intel.c +4 −52
  241. sound/pci/hda/patch_hdmi.c +1 −0
  242. sound/pci/hda/patch_realtek.c +1 −0
  243. sound/soc/codecs/Kconfig +1 −0
  244. sound/soc/codecs/arizona.c +12 −0
  245. sound/soc/codecs/arizona.h +2 −0
  246. sound/soc/codecs/cs35l32.c +13 −4
  247. sound/soc/codecs/cs47l24.c +3 −0
  248. sound/soc/codecs/hdac_hdmi.c +42 −52
  249. sound/soc/codecs/nau8825.c +71 −55
  250. sound/soc/codecs/rt5640.c +1 −1
  251. sound/soc/codecs/rt5640.h +18 −18
  252. sound/soc/codecs/wm5102.c +5 −0
  253. sound/soc/codecs/wm5110.c +2 −0
  254. sound/soc/codecs/wm8962.c +1 −1
  255. sound/soc/codecs/wm8997.c +2 −0
  256. sound/soc/codecs/wm8998.c +2 −0
  257. sound/soc/intel/Kconfig +0 −1
  258. sound/soc/intel/haswell/sst-haswell-ipc.c +1 −1
  259. sound/soc/intel/skylake/skl-sst-dsp.c +5 −0
  260. sound/soc/intel/skylake/skl-topology.c +28 −14
  261. sound/soc/intel/skylake/skl-topology.h +4 −4
  262. sound/soc/intel/skylake/skl.c +23 −9
  263. sound/soc/soc-dapm.c +7 −0
.mailmap+4−0
@@ -48,6 +48,9 @@ Felix Kuhling <fxkuehl@gmx.de> · 47 unmodified lines
4848 Felix Moeller <felix@derklecks.de>
4949 Filipe Lautert <filipe@icewall.org>
5050 Franck Bui-Huu <vagabon.xyz@gmail.com>
51+Frank Rowand <frowand.list@gmail.com> <frowand@mvista.com>
52+Frank Rowand <frowand.list@gmail.com> <frank.rowand@am.sony.com>
53+Frank Rowand <frowand.list@gmail.com> <frank.rowand@sonymobile.com>
5154 Frank Zago <fzago@systemfabricworks.com>
5255 Greg Kroah-Hartman <greg@echidna.(none)>
5356 Greg Kroah-Hartman <gregkh@suse.de>
@@ -79,6 +82,7 @@ Kay Sievers <kay.sievers@vrfy.org> · 25 unmodified lines
7982 Kenneth W Chen <kenneth.w.chen@intel.com>
8083 Konstantin Khlebnikov <koct9i@gmail.com> <k.khlebnikov@samsung.com>
8184 Koushik <raghavendra.koushik@neterion.com>
85+Krzysztof Kozlowski <krzk@kernel.org> <k.kozlowski.k@gmail.com>
8286 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
8387 Leonid I Ananiev <leonid.i.ananiev@intel.com>
8488 Linas Vepstas <linas@austin.ibm.com>
Documentation/devicetree/bindings/arc/archs-pct.txt+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22
33 The ARC HS can be configured with a pipeline performance monitor for counting
44 CPU and cache events like cache misses and hits. Like conventional PCT there
5−are 100+ hardware conditions dynamically mapped to upto 32 counters.
5+are 100+ hardware conditions dynamically mapped to up to 32 counters.
66 It also supports overflow interrupts.
77
88 Required properties:
Documentation/devicetree/bindings/arc/pct.txt+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22
33 The ARC700 can be configured with a pipeline performance monitor for counting
44 CPU and cache events like cache misses and hits. Like conventional PCT there
5−are 100+ hardware conditions dynamically mapped to upto 32 counters
5+are 100+ hardware conditions dynamically mapped to up to 32 counters
66
77 Note that:
88 * The ARC 700 PCT does not support interrupts; although HW events may be
Documentation/devicetree/bindings/i2c/i2c-rk3x.txt+2−2
@@ -6,8 +6,8 @@ RK3xxx SoCs. · 5 unmodified lines
66 Required properties :
77
88 - reg : Offset and length of the register set for the device
9− - compatible : should be "rockchip,rk3066-i2c", "rockchip,rk3188-i2c" or
10− "rockchip,rk3288-i2c".
9+ - compatible : should be "rockchip,rk3066-i2c", "rockchip,rk3188-i2c",
10+ "rockchip,rk3228-i2c" or "rockchip,rk3288-i2c".
1111 - interrupts : interrupt number
1212 - clocks : parent clock
1313
Documentation/devicetree/bindings/net/cpsw.txt+3−3
@@ -45,13 +45,13 @@ Required properties: · 44 unmodified lines
4545 Optional properties:
4646 - dual_emac_res_vlan : Specifies VID to be used to segregate the ports
4747 - mac-address : See ethernet.txt file in the same directory
48−- phy_id : Specifies slave phy id
48+- phy_id : Specifies slave phy id (deprecated, use phy-handle)
4949 - phy-handle : See ethernet.txt file in the same directory
5050
5151 Slave sub-nodes:
5252 - fixed-link : See fixed-link.txt file in the same directory
53− Either the property phy_id, or the sub-node
54− fixed-link can be specified
53+
54+Note: Exactly one of phy_id, phy-handle, or fixed-link must be specified.
5555
5656 Note: "ti,hwmods" field is used to fetch the base address and irq
5757 resources from TI, omap hwmod data base during device registration.
Documentation/networking/altera_tse.txt+3−3
@@ -6,7 +6,7 @@ This is the driver for the Altera Triple-Speed Ethernet (TSE) controllers · 5 unmodified lines
66 using the SGDMA and MSGDMA soft DMA IP components. The driver uses the
77 platform bus to obtain component resources. The designs used to test this
88 driver were built for a Cyclone(R) V SOC FPGA board, a Cyclone(R) V FPGA board,
9−and tested with ARM and NIOS processor hosts seperately. The anticipated use
9+and tested with ARM and NIOS processor hosts separately. The anticipated use
1010 cases are simple communications between an embedded system and an external peer
1111 for status and simple configuration of the embedded system.
1212
@@ -65,14 +65,14 @@ Driver parameters can be also passed in command line by using: · 52 unmodified lines
6565 4.1) Transmit process
6666 When the driver's transmit routine is called by the kernel, it sets up a
6767 transmit descriptor by calling the underlying DMA transmit routine (SGDMA or
68−MSGDMA), and initites a transmit operation. Once the transmit is complete, an
68+MSGDMA), and initiates a transmit operation. Once the transmit is complete, an
6969 interrupt is driven by the transmit DMA logic. The driver handles the transmit
7070 completion in the context of the interrupt handling chain by recycling
7171 resource required to send and track the requested transmit operation.
7272
7373 4.2) Receive process
7474 The driver will post receive buffers to the receive DMA logic during driver
75−intialization. Receive buffers may or may not be queued depending upon the
75+initialization. Receive buffers may or may not be queued depending upon the
7676 underlying DMA logic (MSGDMA is able queue receive buffers, SGDMA is not able
7777 to queue receive buffers to the SGDMA receive logic). When a packet is
7878 received, the DMA logic generates an interrupt. The driver handles a receive
Documentation/networking/ipvlan.txt+3−3
@@ -8,7 +8,7 @@ Initial Release: · 7 unmodified lines
88 This is conceptually very similar to the macvlan driver with one major
99 exception of using L3 for mux-ing /demux-ing among slaves. This property makes
1010 the master device share the L2 with it's slave devices. I have developed this
11−driver in conjuntion with network namespaces and not sure if there is use case
11+driver in conjunction with network namespaces and not sure if there is use case
1212 outside of it.
1313
1414
@@ -42,7 +42,7 @@ out. In this mode the slaves will RX/TX multicast and broadcast (if applicable) · 27 unmodified lines
4242 as well.
4343
4444 4.2 L3 mode:
45− In this mode TX processing upto L3 happens on the stack instance attached
45+ In this mode TX processing up to L3 happens on the stack instance attached
4646 to the slave device and packets are switched to the stack instance of the
4747 master device for the L2 processing and routing from that instance will be
4848 used before packets are queued on the outbound device. In this mode the slaves
@@ -56,7 +56,7 @@ situations defines your use case then you can choose to use ipvlan - · 7 unmodified lines
5656 (a) The Linux host that is connected to the external switch / router has
5757 policy configured that allows only one mac per port.
5858 (b) No of virtual devices created on a master exceed the mac capacity and
59−puts the NIC in promiscous mode and degraded performance is a concern.
59+puts the NIC in promiscuous mode and degraded performance is a concern.
6060 (c) If the slave device is to be put into the hostile / untrusted network
6161 namespace where L2 on the slave could be changed / misused.
6262
Documentation/networking/pktgen.txt+3−3
@@ -67,12 +67,12 @@ The two basic thread commands are: · 66 unmodified lines
6767 * add_device DEVICE@NAME -- adds a single device
6868 * rem_device_all -- remove all associated devices
6969
70−When adding a device to a thread, a corrosponding procfile is created
70+When adding a device to a thread, a corresponding procfile is created
7171 which is used for configuring this device. Thus, device names need to
7272 be unique.
7373
7474 To support adding the same device to multiple threads, which is useful
75−with multi queue NICs, a the device naming scheme is extended with "@":
75+with multi queue NICs, the device naming scheme is extended with "@":
7676 device@something
7777
7878 The part after "@" can be anything, but it is custom to use the thread
@@ -221,7 +221,7 @@ Sample scripts · 142 unmodified lines
221221
222222 A collection of tutorial scripts and helpers for pktgen is in the
223223 samples/pktgen directory. The helper parameters.sh file support easy
224−and consistant parameter parsing across the sample scripts.
224+and consistent parameter parsing across the sample scripts.
225225
226226 Usage example and help:
227227 ./pktgen_sample01_simple.sh -i eth4 -m 00:1B:21:3C:9D:F8 -d 192.168.8.2
Documentation/networking/vrf.txt+1−1
@@ -41,7 +41,7 @@ using an rx_handler which gives the impression that packets flow through · 40 unmodified lines
4141 the VRF device. Similarly on egress routing rules are used to send packets
4242 to the VRF device driver before getting sent out the actual interface. This
4343 allows tcpdump on a VRF device to capture all packets into and out of the
44−VRF as a whole.[1] Similiarly, netfilter [2] and tc rules can be applied
44+VRF as a whole.[1] Similarly, netfilter [2] and tc rules can be applied
4545 using the VRF device to specify rules that apply to the VRF domain as a whole.
4646
4747 [1] Packets in the forwarded state do not flow through the device, so those
Documentation/networking/xfrm_sync.txt+3−3
@@ -4,7 +4,7 @@ Krisztian <hidden@balabit.hu> and others and additional patches · 3 unmodified lines
44 from Jamal <hadi@cyberus.ca>.
55
66 The end goal for syncing is to be able to insert attributes + generate
7−events so that the an SA can be safely moved from one machine to another
7+events so that the SA can be safely moved from one machine to another
88 for HA purposes.
99 The idea is to synchronize the SA so that the takeover machine can do
1010 the processing of the SA as accurate as possible if it has access to it.
@@ -13,7 +13,7 @@ We already have the ability to generate SA add/del/upd events. · 2 unmodified lines
1313 These patches add ability to sync and have accurate lifetime byte (to
1414 ensure proper decay of SAs) and replay counters to avoid replay attacks
1515 with as minimal loss at failover time.
16−This way a backup stays as closely uptodate as an active member.
16+This way a backup stays as closely up-to-date as an active member.
1717
1818 Because the above items change for every packet the SA receives,
1919 it is possible for a lot of the events to be generated.
@@ -163,7 +163,7 @@ If you have an SA that is getting hit by traffic in bursts such that · 143 unmodified lines
163163 there is a period where the timer threshold expires with no packets
164164 seen, then an odd behavior is seen as follows:
165165 The first packet arrival after a timer expiry will trigger a timeout
166−aevent; i.e we dont wait for a timeout period or a packet threshold
166+event; i.e we don't wait for a timeout period or a packet threshold
167167 to be reached. This is done for simplicity and efficiency reasons.
168168
169169 -JHS
Documentation/sysctl/vm.txt+10−9
@@ -581,15 +581,16 @@ Specify "[Nn]ode" for node order · 580 unmodified lines
581581 "Zone Order" orders the zonelists by zone type, then by node within each
582582 zone. Specify "[Zz]one" for zone order.
583583
584−Specify "[Dd]efault" to request automatic configuration. Autoconfiguration
585−will select "node" order in following case.
586−(1) if the DMA zone does not exist or
587−(2) if the DMA zone comprises greater than 50% of the available memory or
588−(3) if any node's DMA zone comprises greater than 70% of its local memory and
589− the amount of local memory is big enough.
590−
591−Otherwise, "zone" order will be selected. Default order is recommended unless
592−this is causing problems for your system/application.
584+Specify "[Dd]efault" to request automatic configuration.
585+
586+On 32-bit, the Normal zone needs to be preserved for allocations accessible
587+by the kernel, so "zone" order will be selected.
588+
589+On 64-bit, devices that require DMA32/DMA are relatively rare, so "node"
590+order will be selected.
591+
592+Default order is recommended unless this is causing problems for your
593+system/application.
593594
594595 ==============================================================
595596
MAINTAINERS+7−6
@@ -4745,7 +4745,7 @@ F: drivers/platform/x86/fujitsu-tablet.c · 4744 unmodified lines
47454745
47464746 FUSE: FILESYSTEM IN USERSPACE
47474747 M: Miklos Szeredi <miklos@szeredi.hu>
4748−L: fuse-devel@lists.sourceforge.net
4748+L: linux-fsdevel@vger.kernel.org
47494749 W: http://fuse.sourceforge.net/
47504750 T: git git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git
47514751 S: Maintained
@@ -4904,7 +4904,7 @@ F: net/ipv4/gre_offload.c · 152 unmodified lines
49044904 F: include/net/gre.h
49054905
49064906 GRETH 10/100/1G Ethernet MAC device driver
4907−M: Kristoffer Glembo <kristoffer@gaisler.com>
4907+M: Andreas Larsson <andreas@gaisler.com>
49084908 L: netdev@vger.kernel.org
49094909 S: Maintained
49104910 F: drivers/net/ethernet/aeroflex/
@@ -6028,7 +6028,7 @@ F: include/scsi/*iscsi* · 1117 unmodified lines
60286028
60296029 ISCSI EXTENSIONS FOR RDMA (ISER) INITIATOR
60306030 M: Or Gerlitz <ogerlitz@mellanox.com>
6031−M: Sagi Grimberg <sagig@mellanox.com>
6031+M: Sagi Grimberg <sagi@grimberg.me>
60326032 M: Roi Dayan <roid@mellanox.com>
60336033 L: linux-rdma@vger.kernel.org
60346034 S: Supported
@@ -6038,7 +6038,7 @@ Q: http://patchwork.kernel.org/project/linux-rdma/list/ · 3 unmodified lines
60386038 F: drivers/infiniband/ulp/iser/
60396039
60406040 ISCSI EXTENSIONS FOR RDMA (ISER) TARGET
6041−M: Sagi Grimberg <sagig@mellanox.com>
6041+M: Sagi Grimberg <sagi@grimberg.me>
60426042 T: git git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git master
60436043 L: linux-rdma@vger.kernel.org
60446044 L: target-devel@vger.kernel.org
@@ -6401,7 +6401,7 @@ F: mm/kmemleak.c · 356 unmodified lines
64016401 F: mm/kmemleak-test.c
64026402
64036403 KPROBES
6404−M: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
6404+M: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
64056405 M: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
64066406 M: "David S. Miller" <davem@davemloft.net>
64076407 M: Masami Hiramatsu <mhiramat@kernel.org>
@@ -10015,7 +10015,8 @@ F: drivers/infiniband/hw/ocrdma/ · 3607 unmodified lines
1001510015
1001610016 SFC NETWORK DRIVER
1001710017 M: Solarflare linux maintainers <linux-net-drivers@solarflare.com>
10018−M: Shradha Shah <sshah@solarflare.com>
10018+M: Edward Cree <ecree@solarflare.com>
10019+M: Bert Kenward <bkenward@solarflare.com>
1001910020 L: netdev@vger.kernel.org
1002010021 S: Supported
1002110022 F: drivers/net/ethernet/sfc/
Makefile+2−2
@@ -1,8 +1,8 @@
11 VERSION = 4
22 PATCHLEVEL = 6
33 SUBLEVEL = 0
4−EXTRAVERSION = -rc5
5−NAME = Blurry Fish Butt
4+EXTRAVERSION = -rc6
5+NAME = Charred Weasel
66
77 # *DOCUMENTATION*
88 # To see a list of typical targets execute "make help"
arch/arc/Kconfig+2−0
@@ -35,8 +35,10 @@ config ARC · 34 unmodified lines
3535 select NO_BOOTMEM
3636 select OF
3737 select OF_EARLY_FLATTREE
38+ select OF_RESERVED_MEM
3839 select PERF_USE_VMALLOC
3940 select HAVE_DEBUG_STACKOVERFLOW
41+ select HAVE_GENERIC_DMA_COHERENT
4042
4143 config MIGHT_HAVE_PCI
4244 bool
arch/arc/include/asm/irqflags-arcv2.h+35−1
@@ -18,6 +18,12 @@ · 17 unmodified lines
1818 #define STATUS_AD_MASK (1<<STATUS_AD_BIT)
1919 #define STATUS_IE_MASK (1<<STATUS_IE_BIT)
2020
21+/* status32 Bits as encoded/expected by CLRI/SETI */
22+#define CLRI_STATUS_IE_BIT 4
23+
24+#define CLRI_STATUS_E_MASK 0xF
25+#define CLRI_STATUS_IE_MASK (1 << CLRI_STATUS_IE_BIT)
26+
2127 #define AUX_USER_SP 0x00D
2228 #define AUX_IRQ_CTRL 0x00E
2329 #define AUX_IRQ_ACT 0x043 /* Active Intr across all levels */
@@ -100,6 +106,13 @@ static inline long arch_local_save_flags(void) · 76 unmodified lines
100106 :
101107 : "memory");
102108
109+ /* To be compatible with irq_save()/irq_restore()
110+ * encode the irq bits as expected by CLRI/SETI
111+ * (this was needed to make CONFIG_TRACE_IRQFLAGS work)
112+ */
113+ temp = (1 << 5) |
114+ ((!!(temp & STATUS_IE_MASK)) << CLRI_STATUS_IE_BIT) |
115+ (temp & CLRI_STATUS_E_MASK);
103116 return temp;
104117 }
105118
@@ -108,7 +121,7 @@ static inline long arch_local_save_flags(void) · 2 unmodified lines
108121 */
109122 static inline int arch_irqs_disabled_flags(unsigned long flags)
110123 {
111− return !(flags & (STATUS_IE_MASK));
124+ return !(flags & CLRI_STATUS_IE_MASK);
112125 }
113126
114127 static inline int arch_irqs_disabled(void)
@@ -128,11 +141,32 @@ static inline void arc_softirq_clear(int irq) · 13 unmodified lines
128141
129142 #else
130143
144+#ifdef CONFIG_TRACE_IRQFLAGS
145+
146+.macro TRACE_ASM_IRQ_DISABLE
147+ bl trace_hardirqs_off
148+.endm
149+
150+.macro TRACE_ASM_IRQ_ENABLE
151+ bl trace_hardirqs_on
152+.endm
153+
154+#else
155+
156+.macro TRACE_ASM_IRQ_DISABLE
157+.endm
158+
159+.macro TRACE_ASM_IRQ_ENABLE
160+.endm
161+
162+#endif
131163 .macro IRQ_DISABLE scratch
132164 clri
165+ TRACE_ASM_IRQ_DISABLE
133166 .endm
134167
135168 .macro IRQ_ENABLE scratch
169+ TRACE_ASM_IRQ_ENABLE
136170 seti
137171 .endm
138172
arch/arc/kernel/entry-arcv2.S+9−1
@@ -69,8 +69,11 @@ ENTRY(handle_interrupt) · 68 unmodified lines
6969
7070 clri ; To make status32.IE agree with CPU internal state
7171
72− lr r0, [ICAUSE]
72+#ifdef CONFIG_TRACE_IRQFLAGS
73+ TRACE_ASM_IRQ_DISABLE
74+#endif
7375
76+ lr r0, [ICAUSE]
7477 mov blink, ret_from_exception
7578
7679 b.d arch_do_IRQ
@@ -169,6 +172,11 @@ END(EV_TLBProtV) · 92 unmodified lines
169172
170173 .Lrestore_regs:
171174
175+ # Interrpts are actually disabled from this point on, but will get
176+ # reenabled after we return from interrupt/exception.
177+ # But irq tracer needs to be told now...
178+ TRACE_ASM_IRQ_ENABLE
179+
172180 ld r0, [sp, PT_status32] ; U/K mode at time of entry
173181 lr r10, [AUX_IRQ_ACT]
174182
arch/arc/kernel/entry-compact.S+3−0
@@ -341,6 +341,9 @@ END(call_do_page_fault) · 340 unmodified lines
341341
342342 .Lrestore_regs:
343343
344+ # Interrpts are actually disabled from this point on, but will get
345+ # reenabled after we return from interrupt/exception.
346+ # But irq tracer needs to be told now...
344347 TRACE_ASM_IRQ_ENABLE
345348
346349 lr r10, [status32]
arch/arc/mm/init.c+4−0
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #ifdef CONFIG_BLK_DEV_INITRD
1414 #include <linux/initrd.h>
1515 #endif
16+#include <linux/of_fdt.h>
1617 #include <linux/swap.h>
1718 #include <linux/module.h>
1819 #include <linux/highmem.h>
@@ -136,6 +137,9 @@ void __init setup_arch_memory(void) · 117 unmodified lines
136137 memblock_reserve(__pa(initrd_start), initrd_end - initrd_start);
137138 #endif
138139
140+ early_init_fdt_reserve_self();
141+ early_init_fdt_scan_reserved_mem();
142+
139143 memblock_dump_all();
140144
141145 /*----------------- node/zones setup --------------------------*/
arch/nios2/lib/memset.c+1−1
@@ -68,7 +68,7 @@ void *memset(void *s, int c, size_t count) · 67 unmodified lines
6868 "=r" (charcnt), /* %1 Output */
6969 "=r" (dwordcnt), /* %2 Output */
7070 "=r" (fill8reg), /* %3 Output */
71− "=r" (wrkrega) /* %4 Output */
71+ "=&r" (wrkrega) /* %4 Output only */
7272 : "r" (c), /* %5 Input */
7373 "0" (s), /* %0 Input/Output */
7474 "1" (count) /* %1 Input/Output */
arch/powerpc/include/asm/systbl.h+2−0
@@ -384,3 +384,5 @@ SYSCALL(ni_syscall) · 383 unmodified lines
384384 SYSCALL(ni_syscall)
385385 SYSCALL(mlock2)
386386 SYSCALL(copy_file_range)
387+COMPAT_SYS_SPU(preadv2)
388+COMPAT_SYS_SPU(pwritev2)
arch/powerpc/include/asm/unistd.h+1−1
@@ -12,7 +12,7 @@ · 11 unmodified lines
1212 #include <uapi/asm/unistd.h>
1313
1414
15−#define NR_syscalls 380
15+#define NR_syscalls 382
1616
1717 #define __NR__exit __NR_exit
1818
arch/powerpc/include/uapi/asm/unistd.h+2−0
@@ -390,5 +390,7 @@ · 389 unmodified lines
390390 #define __NR_membarrier 365
391391 #define __NR_mlock2 378
392392 #define __NR_copy_file_range 379
393+#define __NR_preadv2 380
394+#define __NR_pwritev2 381
393395
394396 #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */
arch/s390/include/asm/mmu.h+1−1
@@ -11,7 +11,7 @@ typedef struct { · 10 unmodified lines
1111 spinlock_t list_lock;
1212 struct list_head pgtable_list;
1313 struct list_head gmap_list;
14− unsigned long asce_bits;
14+ unsigned long asce;
1515 unsigned long asce_limit;
1616 unsigned long vdso_base;
1717 /* The mmu context allocates 4K page tables. */
arch/s390/include/asm/mmu_context.h+22−6
@@ -26,12 +26,28 @@ static inline int init_new_context(struct task_struct *tsk, · 25 unmodified lines
2626 mm->context.has_pgste = 0;
2727 mm->context.use_skey = 0;
2828 #endif
29− if (mm->context.asce_limit == 0) {
29+ switch (mm->context.asce_limit) {
30+ case 1UL << 42:
31+ /*
32+ * forked 3-level task, fall through to set new asce with new
33+ * mm->pgd
34+ */
35+ case 0:
3036 /* context created by exec, set asce limit to 4TB */
31− mm->context.asce_bits = _ASCE_TABLE_LENGTH |
32− _ASCE_USER_BITS | _ASCE_TYPE_REGION3;
3337 mm->context.asce_limit = STACK_TOP_MAX;
34− } else if (mm->context.asce_limit == (1UL << 31)) {
38+ mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH |
39+ _ASCE_USER_BITS | _ASCE_TYPE_REGION3;
40+ break;
41+ case 1UL << 53:
42+ /* forked 4-level task, set new asce with new mm->pgd */
43+ mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH |
44+ _ASCE_USER_BITS | _ASCE_TYPE_REGION2;
45+ break;
46+ case 1UL << 31:
47+ /* forked 2-level compat task, set new asce with new mm->pgd */
48+ mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH |
49+ _ASCE_USER_BITS | _ASCE_TYPE_SEGMENT;
50+ /* pgd_alloc() did not increase mm->nr_pmds */
3551 mm_inc_nr_pmds(mm);
3652 }
3753 crst_table_init((unsigned long *) mm->pgd, pgd_entry_type(mm));
@@ -42,7 +58,7 @@ static inline int init_new_context(struct task_struct *tsk, · 4 unmodified lines
4258
4359 static inline void set_user_asce(struct mm_struct *mm)
4460 {
45− S390_lowcore.user_asce = mm->context.asce_bits | __pa(mm->pgd);
61+ S390_lowcore.user_asce = mm->context.asce;
4662 if (current->thread.mm_segment.ar4)
4763 __ctl_load(S390_lowcore.user_asce, 7, 7);
4864 set_cpu_flag(CIF_ASCE);
@@ -71,7 +87,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, · 22 unmodified lines
7187 {
7288 int cpu = smp_processor_id();
7389
74− S390_lowcore.user_asce = next->context.asce_bits | __pa(next->pgd);
90+ S390_lowcore.user_asce = next->context.asce;
7591 if (prev == next)
7692 return;
7793 if (MACHINE_HAS_TLB_LC)
arch/s390/include/asm/pgalloc.h+2−2
@@ -52,8 +52,8 @@ static inline unsigned long pgd_entry_type(struct mm_struct *mm) · 51 unmodified lines
5252 return _REGION2_ENTRY_EMPTY;
5353 }
5454
55−int crst_table_upgrade(struct mm_struct *, unsigned long limit);
56−void crst_table_downgrade(struct mm_struct *, unsigned long limit);
55+int crst_table_upgrade(struct mm_struct *);
56+void crst_table_downgrade(struct mm_struct *);
5757
5858 static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long address)
5959 {
arch/s390/include/asm/processor.h+1−1
@@ -175,7 +175,7 @@ extern __vector128 init_task_fpu_regs[__NUM_VXRS]; · 174 unmodified lines
175175 regs->psw.mask = PSW_USER_BITS | PSW_MASK_BA; \
176176 regs->psw.addr = new_psw; \
177177 regs->gprs[15] = new_stackp; \
178− crst_table_downgrade(current->mm, 1UL << 31); \
178+ crst_table_downgrade(current->mm); \
179179 execve_tail(); \
180180 } while (0)
181181
arch/s390/include/asm/tlbflush.h+3−6
@@ -110,8 +110,7 @@ static inline void __tlb_flush_asce(struct mm_struct *mm, unsigned long asce) · 109 unmodified lines
110110 static inline void __tlb_flush_kernel(void)
111111 {
112112 if (MACHINE_HAS_IDTE)
113− __tlb_flush_idte((unsigned long) init_mm.pgd |
114− init_mm.context.asce_bits);
113+ __tlb_flush_idte(init_mm.context.asce);
115114 else
116115 __tlb_flush_global();
117116 }
@@ -133,8 +132,7 @@ static inline void __tlb_flush_asce(struct mm_struct *mm, unsigned long asce) · 15 unmodified lines
133132 static inline void __tlb_flush_kernel(void)
134133 {
135134 if (MACHINE_HAS_TLB_LC)
136− __tlb_flush_idte_local((unsigned long) init_mm.pgd |
137− init_mm.context.asce_bits);
135+ __tlb_flush_idte_local(init_mm.context.asce);
138136 else
139137 __tlb_flush_local();
140138 }
@@ -148,8 +146,7 @@ static inline void __tlb_flush_mm(struct mm_struct * mm) · 7 unmodified lines
148146 * only ran on the local cpu.
149147 */
150148 if (MACHINE_HAS_IDTE && list_empty(&mm->context.gmap_list))
151− __tlb_flush_asce(mm, (unsigned long) mm->pgd |
152− mm->context.asce_bits);
149+ __tlb_flush_asce(mm, mm->context.asce);
153150 else
154151 __tlb_flush_full(mm);
155152 }
arch/s390/mm/init.c+2−1
@@ -89,7 +89,8 @@ void __init paging_init(void) · 88 unmodified lines
8989 asce_bits = _ASCE_TYPE_REGION3 | _ASCE_TABLE_LENGTH;
9090 pgd_type = _REGION3_ENTRY_EMPTY;
9191 }
92− S390_lowcore.kernel_asce = (__pa(init_mm.pgd) & PAGE_MASK) | asce_bits;
92+ init_mm.context.asce = (__pa(init_mm.pgd) & PAGE_MASK) | asce_bits;
93+ S390_lowcore.kernel_asce = init_mm.context.asce;
9394 clear_table((unsigned long *) init_mm.pgd, pgd_type,
9495 sizeof(unsigned long)*2048);
9596 vmem_map_init();
arch/s390/mm/mmap.c+3−3
@@ -174,7 +174,7 @@ int s390_mmap_check(unsigned long addr, unsigned long len, unsigned long flags) · 173 unmodified lines
174174 if (!(flags & MAP_FIXED))
175175 addr = 0;
176176 if ((addr + len) >= TASK_SIZE)
177− return crst_table_upgrade(current->mm, TASK_MAX_SIZE);
177+ return crst_table_upgrade(current->mm);
178178 return 0;
179179 }
180180
@@ -191,7 +191,7 @@ s390_get_unmapped_area(struct file *filp, unsigned long addr, · 10 unmodified lines
191191 return area;
192192 if (area == -ENOMEM && !is_compat_task() && TASK_SIZE < TASK_MAX_SIZE) {
193193 /* Upgrade the page table to 4 levels and retry. */
194− rc = crst_table_upgrade(mm, TASK_MAX_SIZE);
194+ rc = crst_table_upgrade(mm);
195195 if (rc)
196196 return (unsigned long) rc;
197197 area = arch_get_unmapped_area(filp, addr, len, pgoff, flags);
@@ -213,7 +213,7 @@ s390_get_unmapped_area_topdown(struct file *filp, const unsigned long addr, · 15 unmodified lines
213213 return area;
214214 if (area == -ENOMEM && !is_compat_task() && TASK_SIZE < TASK_MAX_SIZE) {
215215 /* Upgrade the page table to 4 levels and retry. */
216− rc = crst_table_upgrade(mm, TASK_MAX_SIZE);
216+ rc = crst_table_upgrade(mm);
217217 if (rc)
218218 return (unsigned long) rc;
219219 area = arch_get_unmapped_area_topdown(filp, addr, len,
arch/s390/mm/pgalloc.c+28−57
@@ -76,81 +76,52 @@ static void __crst_table_upgrade(void *arg) · 75 unmodified lines
7676 __tlb_flush_local();
7777 }
7878
79−int crst_table_upgrade(struct mm_struct *mm, unsigned long limit)
79+int crst_table_upgrade(struct mm_struct *mm)
8080 {
8181 unsigned long *table, *pgd;
82− unsigned long entry;
83− int flush;
8482
85− BUG_ON(limit > TASK_MAX_SIZE);
86− flush = 0;
87−repeat:
83+ /* upgrade should only happen from 3 to 4 levels */
84+ BUG_ON(mm->context.asce_limit != (1UL << 42));
85+
8886 table = crst_table_alloc(mm);
8987 if (!table)
9088 return -ENOMEM;
89+
9190 spin_lock_bh(&mm->page_table_lock);
92− if (mm->context.asce_limit < limit) {
93− pgd = (unsigned long *) mm->pgd;
94− if (mm->context.asce_limit <= (1UL << 31)) {
95− entry = _REGION3_ENTRY_EMPTY;
96− mm->context.asce_limit = 1UL << 42;
97− mm->context.asce_bits = _ASCE_TABLE_LENGTH |
98− _ASCE_USER_BITS |
99− _ASCE_TYPE_REGION3;
100− } else {
101− entry = _REGION2_ENTRY_EMPTY;
102− mm->context.asce_limit = 1UL << 53;
103− mm->context.asce_bits = _ASCE_TABLE_LENGTH |
104− _ASCE_USER_BITS |
105− _ASCE_TYPE_REGION2;
106− }
107− crst_table_init(table, entry);
108− pgd_populate(mm, (pgd_t *) table, (pud_t *) pgd);
109− mm->pgd = (pgd_t *) table;
110− mm->task_size = mm->context.asce_limit;
111− table = NULL;
112− flush = 1;
113− }
91+ pgd = (unsigned long *) mm->pgd;
92+ crst_table_init(table, _REGION2_ENTRY_EMPTY);
93+ pgd_populate(mm, (pgd_t *) table, (pud_t *) pgd);
94+ mm->pgd = (pgd_t *) table;
95+ mm->context.asce_limit = 1UL << 53;
96+ mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH |
97+ _ASCE_USER_BITS | _ASCE_TYPE_REGION2;
98+ mm->task_size = mm->context.asce_limit;
11499 spin_unlock_bh(&mm->page_table_lock);
115− if (table)
116− crst_table_free(mm, table);
117− if (mm->context.asce_limit < limit)
118− goto repeat;
119− if (flush)
120− on_each_cpu(__crst_table_upgrade, mm, 0);
100+
101+ on_each_cpu(__crst_table_upgrade, mm, 0);
121102 return 0;
122103 }
123104
124−void crst_table_downgrade(struct mm_struct *mm, unsigned long limit)
105+void crst_table_downgrade(struct mm_struct *mm)
125106 {
126107 pgd_t *pgd;
127108
109+ /* downgrade should only happen from 3 to 2 levels (compat only) */
110+ BUG_ON(mm->context.asce_limit != (1UL << 42));
111+
128112 if (current->active_mm == mm) {
129113 clear_user_asce();
130114 __tlb_flush_mm(mm);
131115 }
132− while (mm->context.asce_limit > limit) {
133− pgd = mm->pgd;
134− switch (pgd_val(*pgd) & _REGION_ENTRY_TYPE_MASK) {
135− case _REGION_ENTRY_TYPE_R2:
136− mm->context.asce_limit = 1UL << 42;
137− mm->context.asce_bits = _ASCE_TABLE_LENGTH |
138− _ASCE_USER_BITS |
139− _ASCE_TYPE_REGION3;
140− break;
141− case _REGION_ENTRY_TYPE_R3:
142− mm->context.asce_limit = 1UL << 31;
143− mm->context.asce_bits = _ASCE_TABLE_LENGTH |
144− _ASCE_USER_BITS |
145− _ASCE_TYPE_SEGMENT;
146− break;
147− default:
148− BUG();
149− }
150− mm->pgd = (pgd_t *) (pgd_val(*pgd) & _REGION_ENTRY_ORIGIN);
151− mm->task_size = mm->context.asce_limit;
152− crst_table_free(mm, (unsigned long *) pgd);
153− }
116+
117+ pgd = mm->pgd;
118+ mm->pgd = (pgd_t *) (pgd_val(*pgd) & _REGION_ENTRY_ORIGIN);
119+ mm->context.asce_limit = 1UL << 31;
120+ mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH |
121+ _ASCE_USER_BITS | _ASCE_TYPE_SEGMENT;
122+ mm->task_size = mm->context.asce_limit;
123+ crst_table_free(mm, (unsigned long *) pgd);
124+
154125 if (current->active_mm == mm)
155126 set_user_asce(mm);
156127 }
arch/s390/pci/pci_dma.c+10−6
@@ -457,7 +457,7 @@ int zpci_dma_init_device(struct zpci_dev *zdev) · 456 unmodified lines
457457 zdev->dma_table = dma_alloc_cpu_table();
458458 if (!zdev->dma_table) {
459459 rc = -ENOMEM;
460− goto out_clean;
460+ goto out;
461461 }
462462
463463 /*
@@ -477,18 +477,22 @@ int zpci_dma_init_device(struct zpci_dev *zdev) · 13 unmodified lines
477477 zdev->iommu_bitmap = vzalloc(zdev->iommu_pages / 8);
478478 if (!zdev->iommu_bitmap) {
479479 rc = -ENOMEM;
480− goto out_reg;
480+ goto free_dma_table;
481481 }
482482
483483 rc = zpci_register_ioat(zdev, 0, zdev->start_dma, zdev->end_dma,
484484 (u64) zdev->dma_table);
485485 if (rc)
486− goto out_reg;
487− return 0;
486+ goto free_bitmap;
488487
489−out_reg:
488+ return 0;
489+free_bitmap:
490+ vfree(zdev->iommu_bitmap);
491+ zdev->iommu_bitmap = NULL;
492+free_dma_table:
490493 dma_free_cpu_table(zdev->dma_table);
491−out_clean:
494+ zdev->dma_table = NULL;
495+out:
492496 return rc;
493497 }
494498
arch/sparc/configs/sparc32_defconfig+0−1
@@ -24,7 +24,6 @@ CONFIG_INET_AH=y · 23 unmodified lines
2424 CONFIG_INET_ESP=y
2525 CONFIG_INET_IPCOMP=y
2626 # CONFIG_INET_LRO is not set
27−CONFIG_IPV6_PRIVACY=y
2827 CONFIG_INET6_AH=m
2928 CONFIG_INET6_ESP=m
3029 CONFIG_INET6_IPCOMP=m
arch/sparc/configs/sparc64_defconfig+0−1
@@ -48,7 +48,6 @@ CONFIG_SYN_COOKIES=y · 47 unmodified lines
4848 CONFIG_INET_AH=y
4949 CONFIG_INET_ESP=y
5050 CONFIG_INET_IPCOMP=y
51−CONFIG_IPV6_PRIVACY=y
5251 CONFIG_IPV6_ROUTER_PREF=y
5352 CONFIG_IPV6_ROUTE_INFO=y
5453 CONFIG_IPV6_OPTIMISTIC_DAD=y
arch/sparc/include/asm/spitfire.h+1−0
@@ -48,6 +48,7 @@ · 47 unmodified lines
4848 #define SUN4V_CHIP_SPARC_M6 0x06
4949 #define SUN4V_CHIP_SPARC_M7 0x07
5050 #define SUN4V_CHIP_SPARC64X 0x8a
51+#define SUN4V_CHIP_SPARC_SN 0x8b
5152 #define SUN4V_CHIP_UNKNOWN 0xff
5253
5354 #ifndef __ASSEMBLY__
arch/sparc/include/uapi/asm/unistd.h+3−1
@@ -423,8 +423,10 @@ · 422 unmodified lines
423423 #define __NR_setsockopt 355
424424 #define __NR_mlock2 356
425425 #define __NR_copy_file_range 357
426+#define __NR_preadv2 358
427+#define __NR_pwritev2 359
426428
427−#define NR_syscalls 358
429+#define NR_syscalls 360
428430
429431 /* Bitmask values returned from kern_features system call. */
430432 #define KERN_FEATURE_MIXED_MODE_STACK 0x00000001
arch/sparc/kernel/cherrs.S+5−9
@@ -214,8 +214,7 @@ do_dcpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */ · 213 unmodified lines
214214 subcc %g1, %g2, %g1 ! Next cacheline
215215 bge,pt %icc, 1b
216216 nop
217− ba,pt %xcc, dcpe_icpe_tl1_common
218− nop
217+ ba,a,pt %xcc, dcpe_icpe_tl1_common
219218
220219 do_dcpe_tl1_fatal:
221220 sethi %hi(1f), %g7
@@ -224,8 +223,7 @@ do_dcpe_tl1_fatal: · 2 unmodified lines
224223 mov 0x2, %o0
225224 call cheetah_plus_parity_error
226225 add %sp, PTREGS_OFF, %o1
227− ba,pt %xcc, rtrap
228− nop
226+ ba,a,pt %xcc, rtrap
229227 .size do_dcpe_tl1,.-do_dcpe_tl1
230228
231229 .globl do_icpe_tl1
@@ -259,8 +257,7 @@ do_icpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */ · 27 unmodified lines
259257 subcc %g1, %g2, %g1
260258 bge,pt %icc, 1b
261259 nop
262− ba,pt %xcc, dcpe_icpe_tl1_common
263− nop
260+ ba,a,pt %xcc, dcpe_icpe_tl1_common
264261
265262 do_icpe_tl1_fatal:
266263 sethi %hi(1f), %g7
@@ -269,8 +266,7 @@ do_icpe_tl1_fatal: · 2 unmodified lines
269266 mov 0x3, %o0
270267 call cheetah_plus_parity_error
271268 add %sp, PTREGS_OFF, %o1
272− ba,pt %xcc, rtrap
273− nop
269+ ba,a,pt %xcc, rtrap
274270 .size do_icpe_tl1,.-do_icpe_tl1
275271
276272 .type dcpe_icpe_tl1_common,#function
@@ -456,7 +452,7 @@ __cheetah_log_error: · 179 unmodified lines
456452 cmp %g2, 0x63
457453 be c_cee
458454 nop
459− ba,pt %xcc, c_deferred
455+ ba,a,pt %xcc, c_deferred
460456 .size __cheetah_log_error,.-__cheetah_log_error
461457
462458 /* Cheetah FECC trap handling, we get here from tl{0,1}_fecc
arch/sparc/kernel/cpu.c+6−0
@@ -506,6 +506,12 @@ static void __init sun4v_cpu_probe(void) · 505 unmodified lines
506506 sparc_pmu_type = "sparc-m7";
507507 break;
508508
509+ case SUN4V_CHIP_SPARC_SN:
510+ sparc_cpu_type = "SPARC-SN";
511+ sparc_fpu_type = "SPARC-SN integrated FPU";
512+ sparc_pmu_type = "sparc-sn";
513+ break;
514+
509515 case SUN4V_CHIP_SPARC64X:
510516 sparc_cpu_type = "SPARC64-X";
511517 sparc_fpu_type = "SPARC64-X integrated FPU";
arch/sparc/kernel/cpumap.c+1−0
@@ -328,6 +328,7 @@ static int iterate_cpu(struct cpuinfo_tree *t, unsigned int root_index) · 327 unmodified lines
328328 case SUN4V_CHIP_NIAGARA5:
329329 case SUN4V_CHIP_SPARC_M6:
330330 case SUN4V_CHIP_SPARC_M7:
331+ case SUN4V_CHIP_SPARC_SN:
331332 case SUN4V_CHIP_SPARC64X:
332333 rover_inc_table = niagara_iterate_method;
333334 break;
arch/sparc/kernel/fpu_traps.S+5−6
@@ -100,8 +100,8 @@ do_fpdis: · 99 unmodified lines
100100 fmuld %f0, %f2, %f26
101101 faddd %f0, %f2, %f28
102102 fmuld %f0, %f2, %f30
103− b,pt %xcc, fpdis_exit
104− nop
103+ ba,a,pt %xcc, fpdis_exit
104+
105105 2: andcc %g5, FPRS_DU, %g0
106106 bne,pt %icc, 3f
107107 fzero %f32
@@ -144,8 +144,8 @@ do_fpdis: · 36 unmodified lines
144144 fmuld %f32, %f34, %f58
145145 faddd %f32, %f34, %f60
146146 fmuld %f32, %f34, %f62
147− ba,pt %xcc, fpdis_exit
148− nop
147+ ba,a,pt %xcc, fpdis_exit
148+
149149 3: mov SECONDARY_CONTEXT, %g3
150150 add %g6, TI_FPREGS, %g1
151151
@@ -197,8 +197,7 @@ fpdis_exit2: · 45 unmodified lines
197197 fp_other_bounce:
198198 call do_fpother
199199 add %sp, PTREGS_OFF, %o0
200− ba,pt %xcc, rtrap
201− nop
200+ ba,a,pt %xcc, rtrap
202201 .size fp_other_bounce,.-fp_other_bounce
203202
204203 .align 32
arch/sparc/kernel/head_64.S+16−16
@@ -414,6 +414,8 @@ sun4v_chip_type: · 413 unmodified lines
414414 cmp %g2, 'T'
415415 be,pt %xcc, 70f
416416 cmp %g2, 'M'
417+ be,pt %xcc, 70f
418+ cmp %g2, 'S'
417419 bne,pn %xcc, 49f
418420 nop
419421
@@ -433,6 +435,9 @@ sun4v_chip_type: · 13 unmodified lines
433435 cmp %g2, '7'
434436 be,pt %xcc, 5f
435437 mov SUN4V_CHIP_SPARC_M7, %g4
438+ cmp %g2, 'N'
439+ be,pt %xcc, 5f
440+ mov SUN4V_CHIP_SPARC_SN, %g4
436441 ba,pt %xcc, 49f
437442 nop
438443
@@ -461,9 +466,8 @@ sun4v_chip_type: · 22 unmodified lines
461466 subcc %g3, 1, %g3
462467 bne,pt %xcc, 41b
463468 add %g1, 1, %g1
464− mov SUN4V_CHIP_SPARC64X, %g4
465469 ba,pt %xcc, 5f
466− nop
470+ mov SUN4V_CHIP_SPARC64X, %g4
467471
468472 49:
469473 mov SUN4V_CHIP_UNKNOWN, %g4
@@ -548,8 +552,7 @@ sun4u_init: · 78 unmodified lines
548552 stxa %g0, [%g7] ASI_DMMU
549553 membar #Sync
550554
551− ba,pt %xcc, sun4u_continue
552− nop
555+ ba,a,pt %xcc, sun4u_continue
553556
554557 sun4v_init:
555558 /* Set ctx 0 */
@@ -560,14 +563,12 @@ sun4v_init: · 4 unmodified lines
560563 mov SECONDARY_CONTEXT, %g7
561564 stxa %g0, [%g7] ASI_MMU
562565 membar #Sync
563− ba,pt %xcc, niagara_tlb_fixup
564− nop
566+ ba,a,pt %xcc, niagara_tlb_fixup
565567
566568 sun4u_continue:
567569 BRANCH_IF_ANY_CHEETAH(g1, g7, cheetah_tlb_fixup)
568570
569− ba,pt %xcc, spitfire_tlb_fixup
570− nop
571+ ba,a,pt %xcc, spitfire_tlb_fixup
571572
572573 niagara_tlb_fixup:
573574 mov 3, %g2 /* Set TLB type to hypervisor. */
@@ -595,6 +596,9 @@ niagara_tlb_fixup: · 21 unmodified lines
595596 be,pt %xcc, niagara4_patch
596597 nop
597598 cmp %g1, SUN4V_CHIP_SPARC_M7
599+ be,pt %xcc, niagara4_patch
600+ nop
601+ cmp %g1, SUN4V_CHIP_SPARC_SN
598602 be,pt %xcc, niagara4_patch
599603 nop
600604
@@ -639,8 +643,7 @@ niagara_patch: · 38 unmodified lines
639643 call hypervisor_patch_cachetlbops
640644 nop
641645
642− ba,pt %xcc, tlb_fixup_done
643− nop
646+ ba,a,pt %xcc, tlb_fixup_done
644647
645648 cheetah_tlb_fixup:
646649 mov 2, %g2 /* Set TLB type to cheetah+. */
@@ -659,8 +662,7 @@ cheetah_tlb_fixup: · 12 unmodified lines
659662 call cheetah_patch_cachetlbops
660663 nop
661664
662− ba,pt %xcc, tlb_fixup_done
663− nop
665+ ba,a,pt %xcc, tlb_fixup_done
664666
665667 spitfire_tlb_fixup:
666668 /* Set TLB type to spitfire. */
@@ -774,8 +776,7 @@ setup_trap_table: · 107 unmodified lines
774776 call %o1
775777 add %sp, (2047 + 128), %o0
776778
777− ba,pt %xcc, 2f
778− nop
779+ ba,a,pt %xcc, 2f
779780
780781 1: sethi %hi(sparc64_ttable_tl0), %o0
781782 set prom_set_trap_table_name, %g2
@@ -814,8 +815,7 @@ setup_trap_table: · 32 unmodified lines
814815
815816 BRANCH_IF_ANY_CHEETAH(o2, o3, 1f)
816817
817− ba,pt %xcc, 2f
818− nop
818+ ba,a,pt %xcc, 2f
819819
820820 /* Disable STICK_INT interrupts. */
821821 1:
arch/sparc/kernel/misctrap.S+4−8
@@ -18,8 +18,7 @@ __do_privact: · 17 unmodified lines
1818 109: or %g7, %lo(109b), %g7
1919 call do_privact
2020 add %sp, PTREGS_OFF, %o0
21− ba,pt %xcc, rtrap
22− nop
21+ ba,a,pt %xcc, rtrap
2322 .size __do_privact,.-__do_privact
2423
2524 .type do_mna,#function
@@ -46,8 +45,7 @@ do_mna: · 20 unmodified lines
4645 mov %l5, %o2
4746 call mem_address_unaligned
4847 add %sp, PTREGS_OFF, %o0
49− ba,pt %xcc, rtrap
50− nop
48+ ba,a,pt %xcc, rtrap
5149 .size do_mna,.-do_mna
5250
5351 .type do_lddfmna,#function
@@ -65,8 +63,7 @@ do_lddfmna: · 11 unmodified lines
6563 mov %l5, %o2
6664 call handle_lddfmna
6765 add %sp, PTREGS_OFF, %o0
68− ba,pt %xcc, rtrap
69− nop
66+ ba,a,pt %xcc, rtrap
7067 .size do_lddfmna,.-do_lddfmna
7168
7269 .type do_stdfmna,#function
@@ -84,8 +81,7 @@ do_stdfmna: · 11 unmodified lines
8481 mov %l5, %o2
8582 call handle_stdfmna
8683 add %sp, PTREGS_OFF, %o0
87− ba,pt %xcc, rtrap
88− nop
84+ ba,a,pt %xcc, rtrap
8985 .size do_stdfmna,.-do_stdfmna
9086
9187 .type breakpoint_trap,#function
arch/sparc/kernel/pci.c+36−6
@@ -245,6 +245,18 @@ static void pci_parse_of_addrs(struct platform_device *op, · 244 unmodified lines
245245 }
246246 }
247247
248+static void pci_init_dev_archdata(struct dev_archdata *sd, void *iommu,
249+ void *stc, void *host_controller,
250+ struct platform_device *op,
251+ int numa_node)
252+{
253+ sd->iommu = iommu;
254+ sd->stc = stc;
255+ sd->host_controller = host_controller;
256+ sd->op = op;
257+ sd->numa_node = numa_node;
258+}
259+
248260 static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
249261 struct device_node *node,
250262 struct pci_bus *bus, int devfn)
@@ -259,13 +271,10 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm, · 8 unmodified lines
259271 if (!dev)
260272 return NULL;
261273
274+ op = of_find_device_by_node(node);
262275 sd = &dev->dev.archdata;
263− sd->iommu = pbm->iommu;
264− sd->stc = &pbm->stc;
265− sd->host_controller = pbm;
266− sd->op = op = of_find_device_by_node(node);
267− sd->numa_node = pbm->numa_node;
268−
276+ pci_init_dev_archdata(sd, pbm->iommu, &pbm->stc, pbm, op,
277+ pbm->numa_node);
269278 sd = &op->dev.archdata;
270279 sd->iommu = pbm->iommu;
271280 sd->stc = &pbm->stc;
@@ -994,6 +1003,27 @@ void pcibios_set_master(struct pci_dev *dev) · 722 unmodified lines
9941003 /* No special bus mastering setup handling */
9951004 }
9961005
1006+#ifdef CONFIG_PCI_IOV
1007+int pcibios_add_device(struct pci_dev *dev)
1008+{
1009+ struct pci_dev *pdev;
1010+
1011+ /* Add sriov arch specific initialization here.
1012+ * Copy dev_archdata from PF to VF
1013+ */
1014+ if (dev->is_virtfn) {
1015+ struct dev_archdata *psd;
1016+
1017+ pdev = dev->physfn;
1018+ psd = &pdev->dev.archdata;
1019+ pci_init_dev_archdata(&dev->dev.archdata, psd->iommu,
1020+ psd->stc, psd->host_controller, NULL,
1021+ psd->numa_node);
1022+ }
1023+ return 0;
1024+}
1025+#endif /* CONFIG_PCI_IOV */
1026+
9971027 static int __init pcibios_init(void)
9981028 {
9991029 pci_dfl_cache_line_size = 64 >> 2;
arch/sparc/kernel/setup_64.c+6−1
@@ -285,7 +285,8 @@ static void __init sun4v_patch(void) · 284 unmodified lines
285285
286286 sun4v_patch_2insn_range(&__sun4v_2insn_patch,
287287 &__sun4v_2insn_patch_end);
288− if (sun4v_chip_type == SUN4V_CHIP_SPARC_M7)
288+ if (sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
289+ sun4v_chip_type == SUN4V_CHIP_SPARC_SN)
289290 sun_m7_patch_2insn_range(&__sun_m7_2insn_patch,
290291 &__sun_m7_2insn_patch_end);
291292
@@ -524,6 +525,7 @@ static void __init init_sparc64_elf_hwcap(void) · 232 unmodified lines
524525 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 ||
525526 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 ||
526527 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
528+ sun4v_chip_type == SUN4V_CHIP_SPARC_SN ||
527529 sun4v_chip_type == SUN4V_CHIP_SPARC64X)
528530 cap |= HWCAP_SPARC_BLKINIT;
529531 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2 ||
@@ -532,6 +534,7 @@ static void __init init_sparc64_elf_hwcap(void) · 2 unmodified lines
532534 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 ||
533535 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 ||
534536 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
537+ sun4v_chip_type == SUN4V_CHIP_SPARC_SN ||
535538 sun4v_chip_type == SUN4V_CHIP_SPARC64X)
536539 cap |= HWCAP_SPARC_N2;
537540 }
@@ -561,6 +564,7 @@ static void __init init_sparc64_elf_hwcap(void) · 23 unmodified lines
561564 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 ||
562565 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 ||
563566 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
567+ sun4v_chip_type == SUN4V_CHIP_SPARC_SN ||
564568 sun4v_chip_type == SUN4V_CHIP_SPARC64X)
565569 cap |= (AV_SPARC_VIS | AV_SPARC_VIS2 |
566570 AV_SPARC_ASI_BLK_INIT |
@@ -570,6 +574,7 @@ static void __init init_sparc64_elf_hwcap(void) · 3 unmodified lines
570574 sun4v_chip_type == SUN4V_CHIP_NIAGARA5 ||
571575 sun4v_chip_type == SUN4V_CHIP_SPARC_M6 ||
572576 sun4v_chip_type == SUN4V_CHIP_SPARC_M7 ||
577+ sun4v_chip_type == SUN4V_CHIP_SPARC_SN ||
573578 sun4v_chip_type == SUN4V_CHIP_SPARC64X)
574579 cap |= (AV_SPARC_VIS3 | AV_SPARC_HPC |
575580 AV_SPARC_FMAF);
arch/sparc/kernel/spiterrs.S+6−12
@@ -85,8 +85,7 @@ __spitfire_cee_trap_continue: · 84 unmodified lines
8585 ba,pt %xcc, etraptl1
8686 rd %pc, %g7
8787
88− ba,pt %xcc, 2f
89− nop
88+ ba,a,pt %xcc, 2f
9089
9190 1: ba,pt %xcc, etrap_irq
9291 rd %pc, %g7
@@ -100,8 +99,7 @@ __spitfire_cee_trap_continue: · 7 unmodified lines
10099 mov %l5, %o2
101100 call spitfire_access_error
102101 add %sp, PTREGS_OFF, %o0
103− ba,pt %xcc, rtrap
104− nop
102+ ba,a,pt %xcc, rtrap
105103 .size __spitfire_access_error,.-__spitfire_access_error
106104
107105 /* This is the trap handler entry point for ECC correctable
@@ -179,8 +177,7 @@ __spitfire_data_access_exception_tl1: · 71 unmodified lines
179177 mov %l5, %o2
180178 call spitfire_data_access_exception_tl1
181179 add %sp, PTREGS_OFF, %o0
182− ba,pt %xcc, rtrap
183− nop
180+ ba,a,pt %xcc, rtrap
184181 .size __spitfire_data_access_exception_tl1,.-__spitfire_data_access_exception_tl1
185182
186183 .type __spitfire_data_access_exception,#function
@@ -200,8 +197,7 @@ __spitfire_data_access_exception: · 13 unmodified lines
200197 mov %l5, %o2
201198 call spitfire_data_access_exception
202199 add %sp, PTREGS_OFF, %o0
203− ba,pt %xcc, rtrap
204− nop
200+ ba,a,pt %xcc, rtrap
205201 .size __spitfire_data_access_exception,.-__spitfire_data_access_exception
206202
207203 .type __spitfire_insn_access_exception_tl1,#function
@@ -220,8 +216,7 @@ __spitfire_insn_access_exception_tl1: · 12 unmodified lines
220216 mov %l5, %o2
221217 call spitfire_insn_access_exception_tl1
222218 add %sp, PTREGS_OFF, %o0
223− ba,pt %xcc, rtrap
224− nop
219+ ba,a,pt %xcc, rtrap
225220 .size __spitfire_insn_access_exception_tl1,.-__spitfire_insn_access_exception_tl1
226221
227222 .type __spitfire_insn_access_exception,#function
@@ -240,6 +235,5 @@ __spitfire_insn_access_exception: · 12 unmodified lines
240235 mov %l5, %o2
241236 call spitfire_insn_access_exception
242237 add %sp, PTREGS_OFF, %o0
243− ba,pt %xcc, rtrap
244− nop
238+ ba,a,pt %xcc, rtrap
245239 .size __spitfire_insn_access_exception,.-__spitfire_insn_access_exception
arch/sparc/kernel/systbls_32.S+1−1
@@ -88,4 +88,4 @@ sys_call_table: · 87 unmodified lines
8888 /*340*/ .long sys_ni_syscall, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr
8989 /*345*/ .long sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf
9090 /*350*/ .long sys_execveat, sys_membarrier, sys_userfaultfd, sys_bind, sys_listen
91−/*355*/ .long sys_setsockopt, sys_mlock2, sys_copy_file_range
91+/*355*/ .long sys_setsockopt, sys_mlock2, sys_copy_file_range, sys_preadv2, sys_pwritev2
arch/sparc/kernel/systbls_64.S+2−2
@@ -89,7 +89,7 @@ sys_call_table32: · 88 unmodified lines
8989 /*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr
9090 .word sys32_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf
9191 /*350*/ .word sys32_execveat, sys_membarrier, sys_userfaultfd, sys_bind, sys_listen
92− .word compat_sys_setsockopt, sys_mlock2, sys_copy_file_range
92+ .word compat_sys_setsockopt, sys_mlock2, sys_copy_file_range, compat_sys_preadv2, compat_sys_pwritev2
9393
9494 #endif /* CONFIG_COMPAT */
9595
@@ -170,4 +170,4 @@ sys_call_table: · 74 unmodified lines
170170 /*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr
171171 .word sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf
172172 /*350*/ .word sys64_execveat, sys_membarrier, sys_userfaultfd, sys_bind, sys_listen
173− .word sys_setsockopt, sys_mlock2, sys_copy_file_range
173+ .word sys_setsockopt, sys_mlock2, sys_copy_file_range, sys_preadv2, sys_pwritev2
arch/sparc/kernel/utrap.S+1−2
@@ -11,8 +11,7 @@ utrap_trap: /* %g3=handler,%g4=level */ · 10 unmodified lines
1111 mov %l4, %o1
1212 call bad_trap
1313 add %sp, PTREGS_OFF, %o0
14− ba,pt %xcc, rtrap
15− nop
14+ ba,a,pt %xcc, rtrap
1615
1716 invoke_utrap:
1817 sllx %g3, 3, %g3
arch/sparc/kernel/vio.c+18−0
@@ -45,6 +45,14 @@ static const struct vio_device_id *vio_match_device( · 44 unmodified lines
4545 return NULL;
4646 }
4747
48+static int vio_hotplug(struct device *dev, struct kobj_uevent_env *env)
49+{
50+ const struct vio_dev *vio_dev = to_vio_dev(dev);
51+
52+ add_uevent_var(env, "MODALIAS=vio:T%sS%s", vio_dev->type, vio_dev->compat);
53+ return 0;
54+}
55+
4856 static int vio_bus_match(struct device *dev, struct device_driver *drv)
4957 {
5058 struct vio_dev *vio_dev = to_vio_dev(dev);
@@ -105,15 +113,25 @@ static ssize_t type_show(struct device *dev, · 54 unmodified lines
105113 return sprintf(buf, "%s\n", vdev->type);
106114 }
107115
116+static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
117+ char *buf)
118+{
119+ const struct vio_dev *vdev = to_vio_dev(dev);
120+
121+ return sprintf(buf, "vio:T%sS%s\n", vdev->type, vdev->compat);
122+}
123+
108124 static struct device_attribute vio_dev_attrs[] = {
109125 __ATTR_RO(devspec),
110126 __ATTR_RO(type),
127+ __ATTR_RO(modalias),
111128 __ATTR_NULL
112129 };
113130
114131 static struct bus_type vio_bus_type = {
115132 .name = "vio",
116133 .dev_attrs = vio_dev_attrs,
134+ .uevent = vio_hotplug,
117135 .match = vio_bus_match,
118136 .probe = vio_device_probe,
119137 .remove = vio_device_remove,
arch/sparc/kernel/vmlinux.lds.S+4−0
@@ -33,6 +33,10 @@ ENTRY(_start) · 32 unmodified lines
3333 jiffies = jiffies_64;
3434 #endif
3535
36+#ifdef CONFIG_SPARC64
37+ASSERT((swapper_tsb == 0x0000000000408000), "Error: sparc64 early assembler too large")
38+#endif
39+
3640 SECTIONS
3741 {
3842 #ifdef CONFIG_SPARC64
arch/sparc/kernel/winfixup.S+1−2
@@ -32,8 +32,7 @@ fill_fixup: · 31 unmodified lines
3232 rd %pc, %g7
3333 call do_sparc64_fault
3434 add %sp, PTREGS_OFF, %o0
35− ba,pt %xcc, rtrap
36− nop
35+ ba,a,pt %xcc, rtrap
3736
3837 /* Be very careful about usage of the trap globals here.
3938 * You cannot touch %g5 as that has the fault information.
arch/sparc/mm/init_64.c+3−0
@@ -1769,6 +1769,7 @@ static void __init setup_page_offset(void) · 1768 unmodified lines
17691769 max_phys_bits = 47;
17701770 break;
17711771 case SUN4V_CHIP_SPARC_M7:
1772+ case SUN4V_CHIP_SPARC_SN:
17721773 default:
17731774 /* M7 and later support 52-bit virtual addresses. */
17741775 sparc64_va_hole_top = 0xfff8000000000000UL;
@@ -1986,6 +1987,7 @@ static void __init sun4v_linear_pte_xor_finalize(void) · 211 unmodified lines
19861987 */
19871988 switch (sun4v_chip_type) {
19881989 case SUN4V_CHIP_SPARC_M7:
1990+ case SUN4V_CHIP_SPARC_SN:
19891991 pagecv_flag = 0x00;
19901992 break;
19911993 default:
@@ -2138,6 +2140,7 @@ void __init paging_init(void) · 146 unmodified lines
21382140 */
21392141 switch (sun4v_chip_type) {
21402142 case SUN4V_CHIP_SPARC_M7:
2143+ case SUN4V_CHIP_SPARC_SN:
21412144 page_cache4v_flag = _PAGE_CP_4V;
21422145 break;
21432146 default:
arch/x86/events/amd/core.c+1−1
@@ -115,7 +115,7 @@ static __initconst const u64 amd_hw_cache_event_ids · 114 unmodified lines
115115 /*
116116 * AMD Performance Monitor K7 and later.
117117 */
118−static const u64 amd_perfmon_event_map[] =
118+static const u64 amd_perfmon_event_map[PERF_COUNT_HW_MAX] =
119119 {
120120 [PERF_COUNT_HW_CPU_CYCLES] = 0x0076,
121121 [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0,
arch/x86/events/intel/core.c+1−0
@@ -3639,6 +3639,7 @@ __init int intel_pmu_init(void) · 3638 unmodified lines
36393639
36403640 case 78: /* 14nm Skylake Mobile */
36413641 case 94: /* 14nm Skylake Desktop */
3642+ case 85: /* 14nm Skylake Server */
36423643 x86_pmu.late_ack = true;
36433644 memcpy(hw_cache_event_ids, skl_hw_cache_event_ids, sizeof(hw_cache_event_ids));
36443645 memcpy(hw_cache_extra_regs, skl_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
arch/x86/events/intel/lbr.c+4−2
@@ -63,7 +63,7 @@ static enum { · 62 unmodified lines
6363
6464 #define LBR_PLM (LBR_KERNEL | LBR_USER)
6565
66−#define LBR_SEL_MASK 0x1ff /* valid bits in LBR_SELECT */
66+#define LBR_SEL_MASK 0x3ff /* valid bits in LBR_SELECT */
6767 #define LBR_NOT_SUPP -1 /* LBR filter not supported */
6868 #define LBR_IGN 0 /* ignored */
6969
@@ -610,8 +610,10 @@ static int intel_pmu_setup_hw_lbr_filter(struct perf_event *event) · 540 unmodified lines
610610 * The first 9 bits (LBR_SEL_MASK) in LBR_SELECT operate
611611 * in suppress mode. So LBR_SELECT should be set to
612612 * (~mask & LBR_SEL_MASK) | (mask & ~LBR_SEL_MASK)
613+ * But the 10th bit LBR_CALL_STACK does not operate
614+ * in suppress mode.
613615 */
614− reg->config = mask ^ x86_pmu.lbr_sel_mask;
616+ reg->config = mask ^ (x86_pmu.lbr_sel_mask & ~LBR_CALL_STACK);
615617
616618 if ((br_type & PERF_SAMPLE_BRANCH_NO_CYCLES) &&
617619 (br_type & PERF_SAMPLE_BRANCH_NO_FLAGS) &&
arch/x86/events/intel/pt.c+64−11
@@ -136,9 +136,21 @@ static int __init pt_pmu_hw_init(void) · 135 unmodified lines
136136 struct dev_ext_attribute *de_attrs;
137137 struct attribute **attrs;
138138 size_t size;
139+ u64 reg;
139140 int ret;
140141 long i;
141142
143+ if (boot_cpu_has(X86_FEATURE_VMX)) {
144+ /*
145+ * Intel SDM, 36.5 "Tracing post-VMXON" says that
146+ * "IA32_VMX_MISC[bit 14]" being 1 means PT can trace
147+ * post-VMXON.
148+ */
149+ rdmsrl(MSR_IA32_VMX_MISC, reg);
150+ if (reg & BIT(14))
151+ pt_pmu.vmx = true;
152+ }
153+
142154 attrs = NULL;
143155
144156 for (i = 0; i < PT_CPUID_LEAVES; i++) {
@@ -269,20 +281,23 @@ static void pt_config(struct perf_event *event) · 124 unmodified lines
269281
270282 reg |= (event->attr.config & PT_CONFIG_MASK);
271283
284+ event->hw.config = reg;
272285 wrmsrl(MSR_IA32_RTIT_CTL, reg);
273286 }
274287
275−static void pt_config_start(bool start)
288+static void pt_config_stop(struct perf_event *event)
276289 {
277− u64 ctl;
290+ u64 ctl = READ_ONCE(event->hw.config);
291+
292+ /* may be already stopped by a PMI */
293+ if (!(ctl & RTIT_CTL_TRACEEN))
294+ return;
278295
279− rdmsrl(MSR_IA32_RTIT_CTL, ctl);
280− if (start)
281− ctl |= RTIT_CTL_TRACEEN;
282− else
283− ctl &= ~RTIT_CTL_TRACEEN;
296+ ctl &= ~RTIT_CTL_TRACEEN;
284297 wrmsrl(MSR_IA32_RTIT_CTL, ctl);
285298
299+ WRITE_ONCE(event->hw.config, ctl);
300+
286301 /*
287302 * A wrmsr that disables trace generation serializes other PT
288303 * registers and causes all data packets to be written to memory,
@@ -291,8 +306,7 @@ static void pt_config_start(bool start) · 2 unmodified lines
291306 * The below WMB, separating data store and aux_head store matches
292307 * the consumer's RMB that separates aux_head load and data load.
293308 */
294− if (!start)
295− wmb();
309+ wmb();
296310 }
297311
298312 static void pt_config_buffer(void *buf, unsigned int topa_idx,
@@ -942,11 +956,17 @@ void intel_pt_interrupt(void) · 643 unmodified lines
942956 if (!ACCESS_ONCE(pt->handle_nmi))
943957 return;
944958
945− pt_config_start(false);
959+ /*
960+ * If VMX is on and PT does not support it, don't touch anything.
961+ */
962+ if (READ_ONCE(pt->vmx_on))
963+ return;
946964
947965 if (!event)
948966 return;
949967
968+ pt_config_stop(event);
969+
950970 buf = perf_get_aux(&pt->handle);
951971 if (!buf)
952972 return;
@@ -983,6 +1003,35 @@ void intel_pt_interrupt(void) · 30 unmodified lines
9831003 }
9841004 }
9851005
1006+void intel_pt_handle_vmx(int on)
1007+{
1008+ struct pt *pt = this_cpu_ptr(&pt_ctx);
1009+ struct perf_event *event;
1010+ unsigned long flags;
1011+
1012+ /* PT plays nice with VMX, do nothing */
1013+ if (pt_pmu.vmx)
1014+ return;
1015+
1016+ /*
1017+ * VMXON will clear RTIT_CTL.TraceEn; we need to make
1018+ * sure to not try to set it while VMX is on. Disable
1019+ * interrupts to avoid racing with pmu callbacks;
1020+ * concurrent PMI should be handled fine.
1021+ */
1022+ local_irq_save(flags);
1023+ WRITE_ONCE(pt->vmx_on, on);
1024+
1025+ if (on) {
1026+ /* prevent pt_config_stop() from writing RTIT_CTL */
1027+ event = pt->handle.event;
1028+ if (event)
1029+ event->hw.config = 0;
1030+ }
1031+ local_irq_restore(flags);
1032+}
1033+EXPORT_SYMBOL_GPL(intel_pt_handle_vmx);
1034+
9861035 /*
9871036 * PMU callbacks
9881037 */
@@ -992,6 +1041,9 @@ static void pt_event_start(struct perf_event *event, int mode) · 3 unmodified lines
9921041 struct pt *pt = this_cpu_ptr(&pt_ctx);
9931042 struct pt_buffer *buf = perf_get_aux(&pt->handle);
9941043
1044+ if (READ_ONCE(pt->vmx_on))
1045+ return;
1046+
9951047 if (!buf || pt_buffer_is_full(buf, pt)) {
9961048 event->hw.state = PERF_HES_STOPPED;
9971049 return;
@@ -1014,7 +1066,8 @@ static void pt_event_stop(struct perf_event *event, int mode) · 16 unmodified lines
10141066 * see comment in intel_pt_interrupt().
10151067 */
10161068 ACCESS_ONCE(pt->handle_nmi) = 0;
1017− pt_config_start(false);
1069+
1070+ pt_config_stop(event);
10181071
10191072 if (event->hw.state == PERF_HES_STOPPED)
10201073 return;
arch/x86/events/intel/pt.h+3−0
@@ -65,6 +65,7 @@ enum pt_capabilities { · 64 unmodified lines
6565 struct pt_pmu {
6666 struct pmu pmu;
6767 u32 caps[PT_CPUID_REGS_NUM * PT_CPUID_LEAVES];
68+ bool vmx;
6869 };
6970
7071 /**
@@ -107,10 +108,12 @@ struct pt_buffer { · 36 unmodified lines
107108 * struct pt - per-cpu pt context
108109 * @handle: perf output handle
109110 * @handle_nmi: do handle PT PMI on this cpu, there's an active event
111+ * @vmx_on: 1 if VMX is ON on this cpu
110112 */
111113 struct pt {
112114 struct perf_output_handle handle;
113115 int handle_nmi;
116+ int vmx_on;
114117 };
115118
116119 #endif /* __INTEL_PT_H__ */
arch/x86/events/intel/rapl.c+1−0
@@ -718,6 +718,7 @@ static int __init rapl_pmu_init(void) · 717 unmodified lines
718718 break;
719719 case 60: /* Haswell */
720720 case 69: /* Haswell-Celeron */
721+ case 70: /* Haswell GT3e */
721722 case 61: /* Broadwell */
722723 case 71: /* Broadwell-H */
723724 rapl_cntr_mask = RAPL_IDX_HSW;
arch/x86/include/asm/perf_event.h+4−0
@@ -285,6 +285,10 @@ static inline void perf_events_lapic_init(void) { } · 284 unmodified lines
285285 static inline void perf_check_microcode(void) { }
286286 #endif
287287
288+#ifdef CONFIG_CPU_SUP_INTEL
289+ extern void intel_pt_handle_vmx(int on);
290+#endif
291+
288292 #if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_AMD)
289293 extern void amd_pmu_enable_virt(void);
290294 extern void amd_pmu_disable_virt(void);
arch/x86/kernel/apic/vector.c+2−1
@@ -256,7 +256,8 @@ static void clear_irq_vector(int irq, struct apic_chip_data *data) · 255 unmodified lines
256256 struct irq_desc *desc;
257257 int cpu, vector;
258258
259− BUG_ON(!data->cfg.vector);
259+ if (!data->cfg.vector)
260+ return;
260261
261262 vector = data->cfg.vector;
262263 for_each_cpu_and(cpu, data->domain, cpu_online_mask)
arch/x86/kernel/head_32.S+0−6
@@ -389,12 +389,6 @@ default_entry: · 388 unmodified lines
389389 /* Make changes effective */
390390 wrmsr
391391
392− /*
393− * And make sure that all the mappings we set up have NX set from
394− * the beginning.
395− */
396− orl $(1 << (_PAGE_BIT_NX - 32)), pa(__supported_pte_mask + 4)
397−
398392 enable_paging:
399393
400394 /*
arch/x86/kvm/vmx.c+4−0
@@ -3103,6 +3103,8 @@ static __init int vmx_disabled_by_bios(void) · 3102 unmodified lines
31033103
31043104 static void kvm_cpu_vmxon(u64 addr)
31053105 {
3106+ intel_pt_handle_vmx(1);
3107+
31063108 asm volatile (ASM_VMX_VMXON_RAX
31073109 : : "a"(&addr), "m"(addr)
31083110 : "memory", "cc");
@@ -3172,6 +3174,8 @@ static void vmclear_local_loaded_vmcss(void) · 63 unmodified lines
31723174 static void kvm_cpu_vmxoff(void)
31733175 {
31743176 asm volatile (__ex(ASM_VMX_VMXOFF) : : : "cc");
3177+
3178+ intel_pt_handle_vmx(0);
31753179 }
31763180
31773181 static void hardware_disable(void)
arch/x86/mm/setup_nx.c+3−2
@@ -32,8 +32,9 @@ early_param("noexec", noexec_setup); · 31 unmodified lines
3232
3333 void x86_configure_nx(void)
3434 {
35− /* If disable_nx is set, clear NX on all new mappings going forward. */
36− if (disable_nx)
35+ if (boot_cpu_has(X86_FEATURE_NX) && !disable_nx)
36+ __supported_pte_mask |= _PAGE_NX;
37+ else
3738 __supported_pte_mask &= ~_PAGE_NX;
3839 }
3940
arch/x86/xen/spinlock.c+6−0
@@ -27,6 +27,12 @@ static bool xen_pvspin = true; · 26 unmodified lines
2727
2828 static void xen_qlock_kick(int cpu)
2929 {
30+ int irq = per_cpu(lock_kicker_irq, cpu);
31+
32+ /* Don't kick if the target's kicker interrupt is not initialized. */
33+ if (irq == -1)
34+ return;
35+
3036 xen_send_IPI_one(cpu, XEN_SPIN_UNLOCK_VECTOR);
3137 }
3238
drivers/block/rbd.c+25−27
@@ -538,7 +538,6 @@ static int _rbd_dev_v2_snap_size(struct rbd_device *rbd_dev, u64 snap_id, · 537 unmodified lines
538538 u8 *order, u64 *snap_size);
539539 static int _rbd_dev_v2_snap_features(struct rbd_device *rbd_dev, u64 snap_id,
540540 u64 *snap_features);
541−static u64 rbd_snap_id_by_name(struct rbd_device *rbd_dev, const char *name);
542541
543542 static int rbd_open(struct block_device *bdev, fmode_t mode)
544543 {
@@ -3127,9 +3126,6 @@ static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data) · 2582 unmodified lines
31273126 struct rbd_device *rbd_dev = (struct rbd_device *)data;
31283127 int ret;
31293128
3130− if (!rbd_dev)
3131− return;
3132−
31333129 dout("%s: \"%s\" notify_id %llu opcode %u\n", __func__,
31343130 rbd_dev->header_name, (unsigned long long)notify_id,
31353131 (unsigned int)opcode);
@@ -3263,6 +3259,9 @@ static void rbd_dev_header_unwatch_sync(struct rbd_device *rbd_dev) · 127 unmodified lines
32633259
32643260 ceph_osdc_cancel_event(rbd_dev->watch_event);
32653261 rbd_dev->watch_event = NULL;
3262+
3263+ dout("%s flushing notifies\n", __func__);
3264+ ceph_osdc_flush_notifies(&rbd_dev->rbd_client->client->osdc);
32663265 }
32673266
32683267 /*
@@ -3642,21 +3641,14 @@ static void rbd_exists_validate(struct rbd_device *rbd_dev) · 373 unmodified lines
36423641 static void rbd_dev_update_size(struct rbd_device *rbd_dev)
36433642 {
36443643 sector_t size;
3645− bool removing;
36463644
36473645 /*
3648− * Don't hold the lock while doing disk operations,
3649− * or lock ordering will conflict with the bdev mutex via:
3650− * rbd_add() -> blkdev_get() -> rbd_open()
3646+ * If EXISTS is not set, rbd_dev->disk may be NULL, so don't
3647+ * try to update its size. If REMOVING is set, updating size
3648+ * is just useless work since the device can't be opened.
36513649 */
3652− spin_lock_irq(&rbd_dev->lock);
3653− removing = test_bit(RBD_DEV_FLAG_REMOVING, &rbd_dev->flags);
3654− spin_unlock_irq(&rbd_dev->lock);
3655− /*
3656− * If the device is being removed, rbd_dev->disk has
3657− * been destroyed, so don't try to update its size
3658− */
3659− if (!removing) {
3650+ if (test_bit(RBD_DEV_FLAG_EXISTS, &rbd_dev->flags) &&
3651+ !test_bit(RBD_DEV_FLAG_REMOVING, &rbd_dev->flags)) {
36603652 size = (sector_t)rbd_dev->mapping.size / SECTOR_SIZE;
36613653 dout("setting size to %llu sectors", (unsigned long long)size);
36623654 set_capacity(rbd_dev->disk, size);
@@ -4191,7 +4183,7 @@ static int _rbd_dev_v2_snap_features(struct rbd_device *rbd_dev, u64 snap_id, · 528 unmodified lines
41914183 __le64 features;
41924184 __le64 incompat;
41934185 } __attribute__ ((packed)) features_buf = { 0 };
4194− u64 incompat;
4186+ u64 unsup;
41954187 int ret;
41964188
41974189 ret = rbd_obj_method_sync(rbd_dev, rbd_dev->header_name,
@@ -4204,9 +4196,12 @@ static int _rbd_dev_v2_snap_features(struct rbd_device *rbd_dev, u64 snap_id, · 6 unmodified lines
42044196 if (ret < sizeof (features_buf))
42054197 return -ERANGE;
42064198
4207− incompat = le64_to_cpu(features_buf.incompat);
4208− if (incompat & ~RBD_FEATURES_SUPPORTED)
4199+ unsup = le64_to_cpu(features_buf.incompat) & ~RBD_FEATURES_SUPPORTED;
4200+ if (unsup) {
4201+ rbd_warn(rbd_dev, "image uses unsupported features: 0x%llx",
4202+ unsup);
42094203 return -ENXIO;
4204+ }
42104205
42114206 *snap_features = le64_to_cpu(features_buf.features);
42124207
@@ -5187,6 +5182,10 @@ out_err: · 974 unmodified lines
51875182 return ret;
51885183 }
51895184
5185+/*
5186+ * rbd_dev->header_rwsem must be locked for write and will be unlocked
5187+ * upon return.
5188+ */
51905189 static int rbd_dev_device_setup(struct rbd_device *rbd_dev)
51915190 {
51925191 int ret;
@@ -5195,7 +5194,7 @@ static int rbd_dev_device_setup(struct rbd_device *rbd_dev) · 2 unmodified lines
51955194
51965195 ret = rbd_dev_id_get(rbd_dev);
51975196 if (ret)
5198− return ret;
5197+ goto err_out_unlock;
51995198
52005199 BUILD_BUG_ON(DEV_NAME_LEN
52015200 < sizeof (RBD_DRV_NAME) + MAX_INT_FORMAT_WIDTH);
@@ -5236,8 +5235,9 @@ static int rbd_dev_device_setup(struct rbd_device *rbd_dev) · 34 unmodified lines
52365235 /* Everything's ready. Announce the disk to the world. */
52375236
52385237 set_bit(RBD_DEV_FLAG_EXISTS, &rbd_dev->flags);
5239− add_disk(rbd_dev->disk);
5238+ up_write(&rbd_dev->header_rwsem);
52405239
5240+ add_disk(rbd_dev->disk);
52415241 pr_info("%s: added with size 0x%llx\n", rbd_dev->disk->disk_name,
52425242 (unsigned long long) rbd_dev->mapping.size);
52435243
@@ -5252,6 +5252,8 @@ err_out_blkdev: · 8 unmodified lines
52525252 unregister_blkdev(rbd_dev->major, rbd_dev->name);
52535253 err_out_id:
52545254 rbd_dev_id_put(rbd_dev);
5255+err_out_unlock:
5256+ up_write(&rbd_dev->header_rwsem);
52555257 return ret;
52565258 }
52575259
@@ -5442,6 +5444,7 @@ static ssize_t do_rbd_add(struct bus_type *bus, · 184 unmodified lines
54425444 spec = NULL; /* rbd_dev now owns this */
54435445 rbd_opts = NULL; /* rbd_dev now owns this */
54445446
5447+ down_write(&rbd_dev->header_rwsem);
54455448 rc = rbd_dev_image_probe(rbd_dev, 0);
54465449 if (rc < 0)
54475450 goto err_out_rbd_dev;
@@ -5471,6 +5474,7 @@ out: · 23 unmodified lines
54715474 return rc;
54725475
54735476 err_out_rbd_dev:
5477+ up_write(&rbd_dev->header_rwsem);
54745478 rbd_dev_destroy(rbd_dev);
54755479 err_out_client:
54765480 rbd_put_client(rbdc);
@@ -5577,12 +5581,6 @@ static ssize_t do_rbd_remove(struct bus_type *bus, · 100 unmodified lines
55775581 return ret;
55785582
55795583 rbd_dev_header_unwatch_sync(rbd_dev);
5580− /*
5581− * flush remaining watch callbacks - these must be complete
5582− * before the osd_client is shutdown
5583− */
5584− dout("%s: flushing notifies", __func__);
5585− ceph_osdc_flush_notifies(&rbd_dev->rbd_client->client->osdc);
55865584
55875585 /*
55885586 * Don't free anything from rbd_dev->disk until after all
drivers/clk/imx/clk-imx6q.c+1−1
@@ -394,7 +394,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node) · 393 unmodified lines
394394 clk[IMX6QDL_CLK_LDB_DI1_DIV_3_5] = imx_clk_fixed_factor("ldb_di1_div_3_5", "ldb_di1", 2, 7);
395395 } else {
396396 clk[IMX6QDL_CLK_ECSPI_ROOT] = imx_clk_divider("ecspi_root", "pll3_60m", base + 0x38, 19, 6);
397− clk[IMX6QDL_CLK_CAN_ROOT] = imx_clk_divider("can_root", "pll3_60", base + 0x20, 2, 6);
397+ clk[IMX6QDL_CLK_CAN_ROOT] = imx_clk_divider("can_root", "pll3_60m", base + 0x20, 2, 6);
398398 clk[IMX6QDL_CLK_IPG_PER] = imx_clk_fixup_divider("ipg_per", "ipg", base + 0x1c, 0, 6, imx_cscmr1_fixup);
399399 clk[IMX6QDL_CLK_UART_SERIAL_PODF] = imx_clk_divider("uart_serial_podf", "pll3_80m", base + 0x24, 0, 6);
400400 clk[IMX6QDL_CLK_LDB_DI0_DIV_3_5] = imx_clk_fixed_factor("ldb_di0_div_3_5", "ldb_di0_sel", 2, 7);
drivers/cpufreq/cpufreq_governor.c+2−6
@@ -193,12 +193,8 @@ unsigned int dbs_update(struct cpufreq_policy *policy) · 192 unmodified lines
193193 wall_time = cur_wall_time - j_cdbs->prev_cpu_wall;
194194 j_cdbs->prev_cpu_wall = cur_wall_time;
195195
196− if (cur_idle_time <= j_cdbs->prev_cpu_idle) {
197− idle_time = 0;
198− } else {
199− idle_time = cur_idle_time - j_cdbs->prev_cpu_idle;
200− j_cdbs->prev_cpu_idle = cur_idle_time;
201− }
196+ idle_time = cur_idle_time - j_cdbs->prev_cpu_idle;
197+ j_cdbs->prev_cpu_idle = cur_idle_time;
202198
203199 if (ignore_nice) {
204200 u64 cur_nice = kcpustat_cpu(j).cpustat[CPUTIME_NICE];
drivers/cpufreq/intel_pstate.c+5−0
@@ -813,6 +813,11 @@ static int core_get_max_pstate(void) · 812 unmodified lines
813813 if (err)
814814 goto skip_tar;
815815
816+ /* For level 1 and 2, bits[23:16] contain the ratio */
817+ if (tdp_ctrl)
818+ tdp_ratio >>= 16;
819+
820+ tdp_ratio &= 0xff; /* ratios are only 8 bits long */
816821 if (tdp_ratio - 1 == tar) {
817822 max_pstate = tar;
818823 pr_debug("max_pstate=TAC %x\n", max_pstate);
drivers/edac/i7core_edac.c+1−1
@@ -1866,7 +1866,7 @@ static int i7core_mce_check_error(struct notifier_block *nb, unsigned long val, · 1865 unmodified lines
18661866
18671867 i7_dev = get_i7core_dev(mce->socketid);
18681868 if (!i7_dev)
1869− return NOTIFY_BAD;
1869+ return NOTIFY_DONE;
18701870
18711871 mci = i7_dev->mci;
18721872 pvt = mci->pvt_info;
drivers/edac/sb_edac.c+1−1
@@ -3168,7 +3168,7 @@ static int sbridge_mce_check_error(struct notifier_block *nb, unsigned long val, · 3167 unmodified lines
31683168
31693169 mci = get_mci_for_node_id(mce->socketid);
31703170 if (!mci)
3171− return NOTIFY_BAD;
3171+ return NOTIFY_DONE;
31723172 pvt = mci->pvt_info;
31733173
31743174 /*
drivers/firmware/efi/vars.c+26−11
@@ -202,29 +202,44 @@ static const struct variable_validate variable_validate[] = { · 201 unmodified lines
202202 { NULL_GUID, "", NULL },
203203 };
204204
205+/*
206+ * Check if @var_name matches the pattern given in @match_name.
207+ *
208+ * @var_name: an array of @len non-NUL characters.
209+ * @match_name: a NUL-terminated pattern string, optionally ending in "*". A
210+ * final "*" character matches any trailing characters @var_name,
211+ * including the case when there are none left in @var_name.
212+ * @match: on output, the number of non-wildcard characters in @match_name
213+ * that @var_name matches, regardless of the return value.
214+ * @return: whether @var_name fully matches @match_name.
215+ */
205216 static bool
206217 variable_matches(const char *var_name, size_t len, const char *match_name,
207218 int *match)
208219 {
209220 for (*match = 0; ; (*match)++) {
210221 char c = match_name[*match];
211− char u = var_name[*match];
212222
213− /* Wildcard in the matching name means we've matched */
214− if (c == '*')
223+ switch (c) {
224+ case '*':
225+ /* Wildcard in @match_name means we've matched. */
215226 return true;
216227
217− /* Case sensitive match */
218− if (!c && *match == len)
219− return true;
228+ case '\0':
229+ /* @match_name has ended. Has @var_name too? */
230+ return (*match == len);
220231
221− if (c != u)
232+ default:
233+ /*
234+ * We've reached a non-wildcard char in @match_name.
235+ * Continue only if there's an identical character in
236+ * @var_name.
237+ */
238+ if (*match < len && c == var_name[*match])
239+ continue;
222240 return false;
223−
224− if (!c)
225− return true;
241+ }
226242 }
227− return true;
228243 }
229244
230245 bool
drivers/gpio/gpio-rcar.c+6−59
@@ -196,44 +196,6 @@ static int gpio_rcar_irq_set_wake(struct irq_data *d, unsigned int on) · 195 unmodified lines
196196 return 0;
197197 }
198198
199−static void gpio_rcar_irq_bus_lock(struct irq_data *d)
200−{
201− struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
202− struct gpio_rcar_priv *p = gpiochip_get_data(gc);
203−
204− pm_runtime_get_sync(&p->pdev->dev);
205−}
206−
207−static void gpio_rcar_irq_bus_sync_unlock(struct irq_data *d)
208−{
209− struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
210− struct gpio_rcar_priv *p = gpiochip_get_data(gc);
211−
212− pm_runtime_put(&p->pdev->dev);
213−}
214−
215−
216−static int gpio_rcar_irq_request_resources(struct irq_data *d)
217−{
218− struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
219− struct gpio_rcar_priv *p = gpiochip_get_data(gc);
220− int error;
221−
222− error = pm_runtime_get_sync(&p->pdev->dev);
223− if (error < 0)
224− return error;
225−
226− return 0;
227−}
228−
229−static void gpio_rcar_irq_release_resources(struct irq_data *d)
230−{
231− struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
232− struct gpio_rcar_priv *p = gpiochip_get_data(gc);
233−
234− pm_runtime_put(&p->pdev->dev);
235−}
236−
237199 static irqreturn_t gpio_rcar_irq_handler(int irq, void *dev_id)
238200 {
239201 struct gpio_rcar_priv *p = dev_id;
@@ -280,32 +242,18 @@ static void gpio_rcar_config_general_input_output_mode(struct gpio_chip *chip, · 40 unmodified lines
280242
281243 static int gpio_rcar_request(struct gpio_chip *chip, unsigned offset)
282244 {
283− struct gpio_rcar_priv *p = gpiochip_get_data(chip);
284− int error;
285−
286− error = pm_runtime_get_sync(&p->pdev->dev);
287− if (error < 0)
288− return error;
289−
290− error = pinctrl_request_gpio(chip->base + offset);
291− if (error)
292− pm_runtime_put(&p->pdev->dev);
293−
294− return error;
245+ return pinctrl_request_gpio(chip->base + offset);
295246 }
296247
297248 static void gpio_rcar_free(struct gpio_chip *chip, unsigned offset)
298249 {
299− struct gpio_rcar_priv *p = gpiochip_get_data(chip);
300−
301250 pinctrl_free_gpio(chip->base + offset);
302251
303− /* Set the GPIO as an input to ensure that the next GPIO request won't
252+ /*
253+ * Set the GPIO as an input to ensure that the next GPIO request won't
304254 * drive the GPIO pin as an output.
305255 */
306256 gpio_rcar_config_general_input_output_mode(chip, offset, false);
307−
308− pm_runtime_put(&p->pdev->dev);
309257 }
310258
311259 static int gpio_rcar_direction_input(struct gpio_chip *chip, unsigned offset)
@@ -452,6 +400,7 @@ static int gpio_rcar_probe(struct platform_device *pdev) · 140 unmodified lines
452400 }
453401
454402 pm_runtime_enable(dev);
403+ pm_runtime_get_sync(dev);
455404
456405 io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
457406 irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
@@ -488,10 +437,6 @@ static int gpio_rcar_probe(struct platform_device *pdev) · 30 unmodified lines
488437 irq_chip->irq_unmask = gpio_rcar_irq_enable;
489438 irq_chip->irq_set_type = gpio_rcar_irq_set_type;
490439 irq_chip->irq_set_wake = gpio_rcar_irq_set_wake;
491− irq_chip->irq_bus_lock = gpio_rcar_irq_bus_lock;
492− irq_chip->irq_bus_sync_unlock = gpio_rcar_irq_bus_sync_unlock;
493− irq_chip->irq_request_resources = gpio_rcar_irq_request_resources;
494− irq_chip->irq_release_resources = gpio_rcar_irq_release_resources;
495440 irq_chip->flags = IRQCHIP_SET_TYPE_MASKED | IRQCHIP_MASK_ON_SUSPEND;
496441
497442 ret = gpiochip_add_data(gpio_chip, p);
@@ -522,6 +467,7 @@ static int gpio_rcar_probe(struct platform_device *pdev) · 24 unmodified lines
522467 err1:
523468 gpiochip_remove(gpio_chip);
524469 err0:
470+ pm_runtime_put(dev);
525471 pm_runtime_disable(dev);
526472 return ret;
527473 }
@@ -532,6 +478,7 @@ static int gpio_rcar_remove(struct platform_device *pdev) · 4 unmodified lines
532478
533479 gpiochip_remove(&p->gpio_chip);
534480
481+ pm_runtime_put(&pdev->dev);
535482 pm_runtime_disable(&pdev->dev);
536483 return 0;
537484 }
drivers/gpio/gpiolib-acpi.c+1−1
@@ -977,7 +977,7 @@ bool acpi_can_fallback_to_crs(struct acpi_device *adev, const char *con_id) · 976 unmodified lines
977977 lookup = kmalloc(sizeof(*lookup), GFP_KERNEL);
978978 if (lookup) {
979979 lookup->adev = adev;
980− lookup->con_id = con_id;
980+ lookup->con_id = kstrdup(con_id, GFP_KERNEL);
981981 list_add_tail(&lookup->node, &acpi_crs_lookup_list);
982982 }
983983 }
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c+7−4
@@ -63,10 +63,6 @@ bool amdgpu_has_atpx(void) { · 62 unmodified lines
6363 return amdgpu_atpx_priv.atpx_detected;
6464 }
6565
66−bool amdgpu_has_atpx_dgpu_power_cntl(void) {
67− return amdgpu_atpx_priv.atpx.functions.power_cntl;
68−}
69−
7066 /**
7167 * amdgpu_atpx_call - call an ATPX method
7268 *
@@ -146,6 +142,13 @@ static void amdgpu_atpx_parse_functions(struct amdgpu_atpx_functions *f, u32 mas · 73 unmodified lines
146142 */
147143 static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx)
148144 {
145+ /* make sure required functions are enabled */
146+ /* dGPU power control is required */
147+ if (atpx->functions.power_cntl == false) {
148+ printk("ATPX dGPU power cntl not present, forcing\n");
149+ atpx->functions.power_cntl = true;
150+ }
151+
149152 if (atpx->functions.px_params) {
150153 union acpi_object *info;
151154 struct atpx_px_params output;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c+1−7
@@ -62,12 +62,6 @@ static const char *amdgpu_asic_name[] = { · 61 unmodified lines
6262 "LAST",
6363 };
6464
65−#if defined(CONFIG_VGA_SWITCHEROO)
66−bool amdgpu_has_atpx_dgpu_power_cntl(void);
67−#else
68−static inline bool amdgpu_has_atpx_dgpu_power_cntl(void) { return false; }
69−#endif
70−
7165 bool amdgpu_device_is_px(struct drm_device *dev)
7266 {
7367 struct amdgpu_device *adev = dev->dev_private;
@@ -1485,7 +1479,7 @@ int amdgpu_device_init(struct amdgpu_device *adev, · 1411 unmodified lines
14851479
14861480 if (amdgpu_runtime_pm == 1)
14871481 runtime = true;
1488− if (amdgpu_device_is_px(ddev) && amdgpu_has_atpx_dgpu_power_cntl())
1482+ if (amdgpu_device_is_px(ddev))
14891483 runtime = true;
14901484 vga_switcheroo_register_client(adev->pdev, &amdgpu_switcheroo_ops, runtime);
14911485 if (runtime)
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c+4−1
@@ -910,7 +910,10 @@ static int gmc_v7_0_late_init(void *handle) · 909 unmodified lines
910910 {
911911 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
912912
913− return amdgpu_irq_get(adev, &adev->mc.vm_fault, 0);
913+ if (amdgpu_vm_fault_stop != AMDGPU_VM_FAULT_STOP_ALWAYS)
914+ return amdgpu_irq_get(adev, &adev->mc.vm_fault, 0);
915+ else
916+ return 0;
914917 }
915918
916919 static int gmc_v7_0_sw_init(void *handle)
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c+4−1
@@ -870,7 +870,10 @@ static int gmc_v8_0_late_init(void *handle) · 869 unmodified lines
870870 {
871871 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
872872
873− return amdgpu_irq_get(adev, &adev->mc.vm_fault, 0);
873+ if (amdgpu_vm_fault_stop != AMDGPU_VM_FAULT_STOP_ALWAYS)
874+ return amdgpu_irq_get(adev, &adev->mc.vm_fault, 0);
875+ else
876+ return 0;
874877 }
875878
876879 #define mmMC_SEQ_MISC0_FIJI 0xA71
drivers/gpu/drm/drm_dp_mst_topology.c+20−0
@@ -1796,6 +1796,11 @@ int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr) · 1795 unmodified lines
17961796 req_payload.start_slot = cur_slots;
17971797 if (mgr->proposed_vcpis[i]) {
17981798 port = container_of(mgr->proposed_vcpis[i], struct drm_dp_mst_port, vcpi);
1799+ port = drm_dp_get_validated_port_ref(mgr, port);
1800+ if (!port) {
1801+ mutex_unlock(&mgr->payload_lock);
1802+ return -EINVAL;
1803+ }
17991804 req_payload.num_slots = mgr->proposed_vcpis[i]->num_slots;
18001805 req_payload.vcpi = mgr->proposed_vcpis[i]->vcpi;
18011806 } else {
@@ -1823,6 +1828,9 @@ int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr) · 21 unmodified lines
18231828 mgr->payloads[i].payload_state = req_payload.payload_state;
18241829 }
18251830 cur_slots += req_payload.num_slots;
1831+
1832+ if (port)
1833+ drm_dp_put_port(port);
18261834 }
18271835
18281836 for (i = 0; i < mgr->max_payloads; i++) {
@@ -2128,6 +2136,8 @@ int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr) · 299 unmodified lines
21282136
21292137 if (mgr->mst_primary) {
21302138 int sret;
2139+ u8 guid[16];
2140+
21312141 sret = drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, mgr->dpcd, DP_RECEIVER_CAP_SIZE);
21322142 if (sret != DP_RECEIVER_CAP_SIZE) {
21332143 DRM_DEBUG_KMS("dpcd read failed - undocked during suspend?\n");
@@ -2142,6 +2152,16 @@ int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr) · 8 unmodified lines
21422152 ret = -1;
21432153 goto out_unlock;
21442154 }
2155+
2156+ /* Some hubs forget their guids after they resume */
2157+ sret = drm_dp_dpcd_read(mgr->aux, DP_GUID, guid, 16);
2158+ if (sret != 16) {
2159+ DRM_DEBUG_KMS("dpcd read failed - undocked during suspend?\n");
2160+ ret = -1;
2161+ goto out_unlock;
2162+ }
2163+ drm_dp_check_mstb_guid(mgr->mst_primary, guid);
2164+
21452165 ret = 0;
21462166 } else
21472167 ret = -1;
drivers/gpu/drm/etnaviv/etnaviv_gpu.c+18−13
@@ -572,6 +572,24 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu) · 571 unmodified lines
572572 goto fail;
573573 }
574574
575+ /*
576+ * Set the GPU linear window to be at the end of the DMA window, where
577+ * the CMA area is likely to reside. This ensures that we are able to
578+ * map the command buffers while having the linear window overlap as
579+ * much RAM as possible, so we can optimize mappings for other buffers.
580+ *
581+ * For 3D cores only do this if MC2.0 is present, as with MC1.0 it leads
582+ * to different views of the memory on the individual engines.
583+ */
584+ if (!(gpu->identity.features & chipFeatures_PIPE_3D) ||
585+ (gpu->identity.minor_features0 & chipMinorFeatures0_MC20)) {
586+ u32 dma_mask = (u32)dma_get_required_mask(gpu->dev);
587+ if (dma_mask < PHYS_OFFSET + SZ_2G)
588+ gpu->memory_base = PHYS_OFFSET;
589+ else
590+ gpu->memory_base = dma_mask - SZ_2G + 1;
591+ }
592+
575593 ret = etnaviv_hw_reset(gpu);
576594 if (ret)
577595 goto fail;
@@ -1566,7 +1584,6 @@ static int etnaviv_gpu_platform_probe(struct platform_device *pdev) · 988 unmodified lines
15661584 {
15671585 struct device *dev = &pdev->dev;
15681586 struct etnaviv_gpu *gpu;
1569− u32 dma_mask;
15701587 int err = 0;
15711588
15721589 gpu = devm_kzalloc(dev, sizeof(*gpu), GFP_KERNEL);
@@ -1576,18 +1593,6 @@ static int etnaviv_gpu_platform_probe(struct platform_device *pdev) · 3 unmodified lines
15761593 gpu->dev = &pdev->dev;
15771594 mutex_init(&gpu->lock);
15781595
1579− /*
1580− * Set the GPU linear window to be at the end of the DMA window, where
1581− * the CMA area is likely to reside. This ensures that we are able to
1582− * map the command buffers while having the linear window overlap as
1583− * much RAM as possible, so we can optimize mappings for other buffers.
1584− */
1585− dma_mask = (u32)dma_get_required_mask(dev);
1586− if (dma_mask < PHYS_OFFSET + SZ_2G)
1587− gpu->memory_base = PHYS_OFFSET;
1588− else
1589− gpu->memory_base = dma_mask - SZ_2G + 1;
1590−
15911596 /* Map registers: */
15921597 gpu->mmio = etnaviv_ioremap(pdev, NULL, dev_name(gpu->dev));
15931598 if (IS_ERR(gpu->mmio))
drivers/gpu/drm/radeon/evergreen.c+153−1
@@ -2608,10 +2608,152 @@ static void evergreen_agp_enable(struct radeon_device *rdev) · 2607 unmodified lines
26082608 WREG32(VM_CONTEXT1_CNTL, 0);
26092609 }
26102610
2611+static const unsigned ni_dig_offsets[] =
2612+{
2613+ NI_DIG0_REGISTER_OFFSET,
2614+ NI_DIG1_REGISTER_OFFSET,
2615+ NI_DIG2_REGISTER_OFFSET,
2616+ NI_DIG3_REGISTER_OFFSET,
2617+ NI_DIG4_REGISTER_OFFSET,
2618+ NI_DIG5_REGISTER_OFFSET
2619+};
2620+
2621+static const unsigned ni_tx_offsets[] =
2622+{
2623+ NI_DCIO_UNIPHY0_UNIPHY_TX_CONTROL1,
2624+ NI_DCIO_UNIPHY1_UNIPHY_TX_CONTROL1,
2625+ NI_DCIO_UNIPHY2_UNIPHY_TX_CONTROL1,
2626+ NI_DCIO_UNIPHY3_UNIPHY_TX_CONTROL1,
2627+ NI_DCIO_UNIPHY4_UNIPHY_TX_CONTROL1,
2628+ NI_DCIO_UNIPHY5_UNIPHY_TX_CONTROL1
2629+};
2630+
2631+static const unsigned evergreen_dp_offsets[] =
2632+{
2633+ EVERGREEN_DP0_REGISTER_OFFSET,
2634+ EVERGREEN_DP1_REGISTER_OFFSET,
2635+ EVERGREEN_DP2_REGISTER_OFFSET,
2636+ EVERGREEN_DP3_REGISTER_OFFSET,
2637+ EVERGREEN_DP4_REGISTER_OFFSET,
2638+ EVERGREEN_DP5_REGISTER_OFFSET
2639+};
2640+
2641+
2642+/*
2643+ * Assumption is that EVERGREEN_CRTC_MASTER_EN enable for requested crtc
2644+ * We go from crtc to connector and it is not relible since it
2645+ * should be an opposite direction .If crtc is enable then
2646+ * find the dig_fe which selects this crtc and insure that it enable.
2647+ * if such dig_fe is found then find dig_be which selects found dig_be and
2648+ * insure that it enable and in DP_SST mode.
2649+ * if UNIPHY_PLL_CONTROL1.enable then we should disconnect timing
2650+ * from dp symbols clocks .
2651+ */
2652+static bool evergreen_is_dp_sst_stream_enabled(struct radeon_device *rdev,
2653+ unsigned crtc_id, unsigned *ret_dig_fe)
2654+{
2655+ unsigned i;
2656+ unsigned dig_fe;
2657+ unsigned dig_be;
2658+ unsigned dig_en_be;
2659+ unsigned uniphy_pll;
2660+ unsigned digs_fe_selected;
2661+ unsigned dig_be_mode;
2662+ unsigned dig_fe_mask;
2663+ bool is_enabled = false;
2664+ bool found_crtc = false;
2665+
2666+ /* loop through all running dig_fe to find selected crtc */
2667+ for (i = 0; i < ARRAY_SIZE(ni_dig_offsets); i++) {
2668+ dig_fe = RREG32(NI_DIG_FE_CNTL + ni_dig_offsets[i]);
2669+ if (dig_fe & NI_DIG_FE_CNTL_SYMCLK_FE_ON &&
2670+ crtc_id == NI_DIG_FE_CNTL_SOURCE_SELECT(dig_fe)) {
2671+ /* found running pipe */
2672+ found_crtc = true;
2673+ dig_fe_mask = 1 << i;
2674+ dig_fe = i;
2675+ break;
2676+ }
2677+ }
2678+
2679+ if (found_crtc) {
2680+ /* loop through all running dig_be to find selected dig_fe */
2681+ for (i = 0; i < ARRAY_SIZE(ni_dig_offsets); i++) {
2682+ dig_be = RREG32(NI_DIG_BE_CNTL + ni_dig_offsets[i]);
2683+ /* if dig_fe_selected by dig_be? */
2684+ digs_fe_selected = NI_DIG_BE_CNTL_FE_SOURCE_SELECT(dig_be);
2685+ dig_be_mode = NI_DIG_FE_CNTL_MODE(dig_be);
2686+ if (dig_fe_mask & digs_fe_selected &&
2687+ /* if dig_be in sst mode? */
2688+ dig_be_mode == NI_DIG_BE_DPSST) {
2689+ dig_en_be = RREG32(NI_DIG_BE_EN_CNTL +
2690+ ni_dig_offsets[i]);
2691+ uniphy_pll = RREG32(NI_DCIO_UNIPHY0_PLL_CONTROL1 +
2692+ ni_tx_offsets[i]);
2693+ /* dig_be enable and tx is running */
2694+ if (dig_en_be & NI_DIG_BE_EN_CNTL_ENABLE &&
2695+ dig_en_be & NI_DIG_BE_EN_CNTL_SYMBCLK_ON &&
2696+ uniphy_pll & NI_DCIO_UNIPHY0_PLL_CONTROL1_ENABLE) {
2697+ is_enabled = true;
2698+ *ret_dig_fe = dig_fe;
2699+ break;
2700+ }
2701+ }
2702+ }
2703+ }
2704+
2705+ return is_enabled;
2706+}
2707+
2708+/*
2709+ * Blank dig when in dp sst mode
2710+ * Dig ignores crtc timing
2711+ */
2712+static void evergreen_blank_dp_output(struct radeon_device *rdev,
2713+ unsigned dig_fe)
2714+{
2715+ unsigned stream_ctrl;
2716+ unsigned fifo_ctrl;
2717+ unsigned counter = 0;
2718+
2719+ if (dig_fe >= ARRAY_SIZE(evergreen_dp_offsets)) {
2720+ DRM_ERROR("invalid dig_fe %d\n", dig_fe);
2721+ return;
2722+ }
2723+
2724+ stream_ctrl = RREG32(EVERGREEN_DP_VID_STREAM_CNTL +
2725+ evergreen_dp_offsets[dig_fe]);
2726+ if (!(stream_ctrl & EVERGREEN_DP_VID_STREAM_CNTL_ENABLE)) {
2727+ DRM_ERROR("dig %d , should be enable\n", dig_fe);
2728+ return;
2729+ }
2730+
2731+ stream_ctrl &=~EVERGREEN_DP_VID_STREAM_CNTL_ENABLE;
2732+ WREG32(EVERGREEN_DP_VID_STREAM_CNTL +
2733+ evergreen_dp_offsets[dig_fe], stream_ctrl);
2734+
2735+ stream_ctrl = RREG32(EVERGREEN_DP_VID_STREAM_CNTL +
2736+ evergreen_dp_offsets[dig_fe]);
2737+ while (counter < 32 && stream_ctrl & EVERGREEN_DP_VID_STREAM_STATUS) {
2738+ msleep(1);
2739+ counter++;
2740+ stream_ctrl = RREG32(EVERGREEN_DP_VID_STREAM_CNTL +
2741+ evergreen_dp_offsets[dig_fe]);
2742+ }
2743+ if (counter >= 32 )
2744+ DRM_ERROR("counter exceeds %d\n", counter);
2745+
2746+ fifo_ctrl = RREG32(EVERGREEN_DP_STEER_FIFO + evergreen_dp_offsets[dig_fe]);
2747+ fifo_ctrl |= EVERGREEN_DP_STEER_FIFO_RESET;
2748+ WREG32(EVERGREEN_DP_STEER_FIFO + evergreen_dp_offsets[dig_fe], fifo_ctrl);
2749+
2750+}
2751+
26112752 void evergreen_mc_stop(struct radeon_device *rdev, struct evergreen_mc_save *save)
26122753 {
26132754 u32 crtc_enabled, tmp, frame_count, blackout;
26142755 int i, j;
2756+ unsigned dig_fe;
26152757
26162758 if (!ASIC_IS_NODCE(rdev)) {
26172759 save->vga_render_control = RREG32(VGA_RENDER_CONTROL);
@@ -2651,7 +2793,17 @@ void evergreen_mc_stop(struct radeon_device *rdev, struct evergreen_mc_save *sav · 33 unmodified lines
26512793 break;
26522794 udelay(1);
26532795 }
2654−
2796+ /*we should disable dig if it drives dp sst*/
2797+ /*but we are in radeon_device_init and the topology is unknown*/
2798+ /*and it is available after radeon_modeset_init*/
2799+ /*the following method radeon_atom_encoder_dpms_dig*/
2800+ /*does the job if we initialize it properly*/
2801+ /*for now we do it this manually*/
2802+ /**/
2803+ if (ASIC_IS_DCE5(rdev) &&
2804+ evergreen_is_dp_sst_stream_enabled(rdev, i ,&dig_fe))
2805+ evergreen_blank_dp_output(rdev, dig_fe);
2806+ /*we could remove 6 lines below*/
26552807 /* XXX this is a hack to avoid strange behavior with EFI on certain systems */
26562808 WREG32(EVERGREEN_CRTC_UPDATE_LOCK + crtc_offsets[i], 1);
26572809 tmp = RREG32(EVERGREEN_CRTC_CONTROL + crtc_offsets[i]);
drivers/gpu/drm/radeon/evergreen_reg.h+46−0
@@ -250,8 +250,43 @@ · 249 unmodified lines
250250
251251 /* HDMI blocks at 0x7030, 0x7c30, 0x10830, 0x11430, 0x12030, 0x12c30 */
252252 #define EVERGREEN_HDMI_BASE 0x7030
253+/*DIG block*/
254+#define NI_DIG0_REGISTER_OFFSET (0x7000 - 0x7000)
255+#define NI_DIG1_REGISTER_OFFSET (0x7C00 - 0x7000)
256+#define NI_DIG2_REGISTER_OFFSET (0x10800 - 0x7000)
257+#define NI_DIG3_REGISTER_OFFSET (0x11400 - 0x7000)
258+#define NI_DIG4_REGISTER_OFFSET (0x12000 - 0x7000)
259+#define NI_DIG5_REGISTER_OFFSET (0x12C00 - 0x7000)
260+
261+
262+#define NI_DIG_FE_CNTL 0x7000
263+# define NI_DIG_FE_CNTL_SOURCE_SELECT(x) ((x) & 0x3)
264+# define NI_DIG_FE_CNTL_SYMCLK_FE_ON (1<<24)
265+
266+
267+#define NI_DIG_BE_CNTL 0x7140
268+# define NI_DIG_BE_CNTL_FE_SOURCE_SELECT(x) (((x) >> 8 ) & 0x3F)
269+# define NI_DIG_FE_CNTL_MODE(x) (((x) >> 16) & 0x7 )
270+
271+#define NI_DIG_BE_EN_CNTL 0x7144
272+# define NI_DIG_BE_EN_CNTL_ENABLE (1 << 0)
273+# define NI_DIG_BE_EN_CNTL_SYMBCLK_ON (1 << 8)
274+# define NI_DIG_BE_DPSST 0
253275
254276 /* Display Port block */
277+#define EVERGREEN_DP0_REGISTER_OFFSET (0x730C - 0x730C)
278+#define EVERGREEN_DP1_REGISTER_OFFSET (0x7F0C - 0x730C)
279+#define EVERGREEN_DP2_REGISTER_OFFSET (0x10B0C - 0x730C)
280+#define EVERGREEN_DP3_REGISTER_OFFSET (0x1170C - 0x730C)
281+#define EVERGREEN_DP4_REGISTER_OFFSET (0x1230C - 0x730C)
282+#define EVERGREEN_DP5_REGISTER_OFFSET (0x12F0C - 0x730C)
283+
284+
285+#define EVERGREEN_DP_VID_STREAM_CNTL 0x730C
286+# define EVERGREEN_DP_VID_STREAM_CNTL_ENABLE (1 << 0)
287+# define EVERGREEN_DP_VID_STREAM_STATUS (1 <<16)
288+#define EVERGREEN_DP_STEER_FIFO 0x7310
289+# define EVERGREEN_DP_STEER_FIFO_RESET (1 << 0)
255290 #define EVERGREEN_DP_SEC_CNTL 0x7280
256291 # define EVERGREEN_DP_SEC_STREAM_ENABLE (1 << 0)
257292 # define EVERGREEN_DP_SEC_ASP_ENABLE (1 << 4)
@@ -266,4 +301,15 @@ · 8 unmodified lines
266301 # define EVERGREEN_DP_SEC_N_BASE_MULTIPLE(x) (((x) & 0xf) << 24)
267302 # define EVERGREEN_DP_SEC_SS_EN (1 << 28)
268303
304+/*DCIO_UNIPHY block*/
305+#define NI_DCIO_UNIPHY0_UNIPHY_TX_CONTROL1 (0x6600 -0x6600)
306+#define NI_DCIO_UNIPHY1_UNIPHY_TX_CONTROL1 (0x6640 -0x6600)
307+#define NI_DCIO_UNIPHY2_UNIPHY_TX_CONTROL1 (0x6680 - 0x6600)
308+#define NI_DCIO_UNIPHY3_UNIPHY_TX_CONTROL1 (0x66C0 - 0x6600)
309+#define NI_DCIO_UNIPHY4_UNIPHY_TX_CONTROL1 (0x6700 - 0x6600)
310+#define NI_DCIO_UNIPHY5_UNIPHY_TX_CONTROL1 (0x6740 - 0x6600)
311+
312+#define NI_DCIO_UNIPHY0_PLL_CONTROL1 0x6618
313+# define NI_DCIO_UNIPHY0_PLL_CONTROL1_ENABLE (1 << 0)
314+
269315 #endif
drivers/gpu/drm/ttm/ttm_bo.c+4−13
@@ -230,22 +230,13 @@ EXPORT_SYMBOL(ttm_bo_del_sub_from_lru); · 229 unmodified lines
230230
231231 void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo)
232232 {
233− struct ttm_bo_device *bdev = bo->bdev;
234− struct ttm_mem_type_manager *man;
233+ int put_count = 0;
235234
236235 lockdep_assert_held(&bo->resv->lock.base);
237236
238− if (bo->mem.placement & TTM_PL_FLAG_NO_EVICT) {
239− list_del_init(&bo->swap);
240− list_del_init(&bo->lru);
241−
242− } else {
243− if (bo->ttm && !(bo->ttm->page_flags & TTM_PAGE_FLAG_SG))
244− list_move_tail(&bo->swap, &bo->glob->swap_lru);
245−
246− man = &bdev->man[bo->mem.mem_type];
247− list_move_tail(&bo->lru, &man->lru);
248− }
237+ put_count = ttm_bo_del_from_lru(bo);
238+ ttm_bo_list_ref_sub(bo, put_count, true);
239+ ttm_bo_add_to_lru(bo);
249240 }
250241 EXPORT_SYMBOL(ttm_bo_move_to_lru_tail);
251242
drivers/gpu/drm/virtio/virtgpu_display.c+12−0
@@ -267,11 +267,23 @@ static int virtio_gpu_crtc_atomic_check(struct drm_crtc *crtc, · 266 unmodified lines
267267 return 0;
268268 }
269269
270+static void virtio_gpu_crtc_atomic_flush(struct drm_crtc *crtc,
271+ struct drm_crtc_state *old_state)
272+{
273+ unsigned long flags;
274+
275+ spin_lock_irqsave(&crtc->dev->event_lock, flags);
276+ if (crtc->state->event)
277+ drm_crtc_send_vblank_event(crtc, crtc->state->event);
278+ spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
279+}
280+
270281 static const struct drm_crtc_helper_funcs virtio_gpu_crtc_helper_funcs = {
271282 .enable = virtio_gpu_crtc_enable,
272283 .disable = virtio_gpu_crtc_disable,
273284 .mode_set_nofb = virtio_gpu_crtc_mode_set_nofb,
274285 .atomic_check = virtio_gpu_crtc_atomic_check,
286+ .atomic_flush = virtio_gpu_crtc_atomic_flush,
275287 };
276288
277289 static void virtio_gpu_enc_mode_set(struct drm_encoder *encoder,
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c+5−5
@@ -3293,19 +3293,19 @@ static const struct vmw_cmd_entry vmw_cmd_entries[SVGA_3D_CMD_MAX] = { · 3292 unmodified lines
32933293 &vmw_cmd_dx_cid_check, true, false, true),
32943294 VMW_CMD_DEF(SVGA_3D_CMD_DX_DEFINE_QUERY, &vmw_cmd_dx_define_query,
32953295 true, false, true),
3296− VMW_CMD_DEF(SVGA_3D_CMD_DX_DESTROY_QUERY, &vmw_cmd_ok,
3296+ VMW_CMD_DEF(SVGA_3D_CMD_DX_DESTROY_QUERY, &vmw_cmd_dx_cid_check,
32973297 true, false, true),
32983298 VMW_CMD_DEF(SVGA_3D_CMD_DX_BIND_QUERY, &vmw_cmd_dx_bind_query,
32993299 true, false, true),
33003300 VMW_CMD_DEF(SVGA_3D_CMD_DX_SET_QUERY_OFFSET,
3301− &vmw_cmd_ok, true, false, true),
3302− VMW_CMD_DEF(SVGA_3D_CMD_DX_BEGIN_QUERY, &vmw_cmd_ok,
3301+ &vmw_cmd_dx_cid_check, true, false, true),
3302+ VMW_CMD_DEF(SVGA_3D_CMD_DX_BEGIN_QUERY, &vmw_cmd_dx_cid_check,
33033303 true, false, true),
3304− VMW_CMD_DEF(SVGA_3D_CMD_DX_END_QUERY, &vmw_cmd_ok,
3304+ VMW_CMD_DEF(SVGA_3D_CMD_DX_END_QUERY, &vmw_cmd_dx_cid_check,
33053305 true, false, true),
33063306 VMW_CMD_DEF(SVGA_3D_CMD_DX_READBACK_QUERY, &vmw_cmd_invalid,
33073307 true, false, true),
3308− VMW_CMD_DEF(SVGA_3D_CMD_DX_SET_PREDICATION, &vmw_cmd_invalid,
3308+ VMW_CMD_DEF(SVGA_3D_CMD_DX_SET_PREDICATION, &vmw_cmd_dx_cid_check,
33093309 true, false, true),
33103310 VMW_CMD_DEF(SVGA_3D_CMD_DX_SET_VIEWPORTS, &vmw_cmd_dx_cid_check,
33113311 true, false, true),
drivers/gpu/drm/vmwgfx/vmwgfx_fb.c+3−3
@@ -573,9 +573,9 @@ static int vmw_fb_set_par(struct fb_info *info) · 572 unmodified lines
573573 mode = old_mode;
574574 old_mode = NULL;
575575 } else if (!vmw_kms_validate_mode_vram(vmw_priv,
576− mode->hdisplay *
577− (var->bits_per_pixel + 7) / 8,
578− mode->vdisplay)) {
576+ mode->hdisplay *
577+ DIV_ROUND_UP(var->bits_per_pixel, 8),
578+ mode->vdisplay)) {
579579 drm_mode_destroy(vmw_priv->dev, mode);
580580 return -EINVAL;
581581 }
drivers/hid/hid-ids.h+1−0
@@ -259,6 +259,7 @@ · 258 unmodified lines
259259 #define USB_DEVICE_ID_CORSAIR_K90 0x1b02
260260
261261 #define USB_VENDOR_ID_CREATIVELABS 0x041e
262+#define USB_DEVICE_ID_CREATIVE_SB_OMNI_SURROUND_51 0x322c
262263 #define USB_DEVICE_ID_PRODIKEYS_PCMIDI 0x2801
263264
264265 #define USB_VENDOR_ID_CVTOUCH 0x1ff7
drivers/hid/usbhid/hid-quirks.c+1−0
@@ -71,6 +71,7 @@ static const struct hid_blacklist { · 70 unmodified lines
7171 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK, HID_QUIRK_NOGET },
7272 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET },
7373 { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
74+ { USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_CREATIVE_SB_OMNI_SURROUND_51, HID_QUIRK_NOGET },
7475 { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET },
7576 { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU, HID_QUIRK_MULTI_INPUT },
7677 { USB_VENDOR_ID_ELAN, HID_ANY_ID, HID_QUIRK_ALWAYS_POLL },
drivers/hid/wacom_wac.c+6−0
@@ -684,6 +684,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) · 683 unmodified lines
684684
685685 wacom->tool[idx] = wacom_intuos_get_tool_type(wacom->id[idx]);
686686
687+ wacom->shared->stylus_in_proximity = true;
687688 return 1;
688689 }
689690
@@ -3395,6 +3396,10 @@ static const struct wacom_features wacom_features_0x33E = · 2705 unmodified lines
33953396 { "Wacom Intuos PT M 2", 21600, 13500, 2047, 63,
33963397 INTUOSHT2, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16,
33973398 .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE };
3399+static const struct wacom_features wacom_features_0x343 =
3400+ { "Wacom DTK1651", 34616, 19559, 1023, 0,
3401+ DTUS, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4,
3402+ WACOM_DTU_OFFSET, WACOM_DTU_OFFSET };
33983403
33993404 static const struct wacom_features wacom_features_HID_ANY_ID =
34003405 { "Wacom HID", .type = HID_GENERIC };
@@ -3560,6 +3565,7 @@ const struct hid_device_id wacom_ids[] = { · 159 unmodified lines
35603565 { USB_DEVICE_WACOM(0x33C) },
35613566 { USB_DEVICE_WACOM(0x33D) },
35623567 { USB_DEVICE_WACOM(0x33E) },
3568+ { USB_DEVICE_WACOM(0x343) },
35633569 { USB_DEVICE_WACOM(0x4001) },
35643570 { USB_DEVICE_WACOM(0x4004) },
35653571 { USB_DEVICE_WACOM(0x5000) },
drivers/i2c/busses/Kconfig+2−2
@@ -975,10 +975,10 @@ config I2C_XLR · 974 unmodified lines
975975
976976 config I2C_XLP9XX
977977 tristate "XLP9XX I2C support"
978− depends on CPU_XLP || COMPILE_TEST
978+ depends on CPU_XLP || ARCH_VULCAN || COMPILE_TEST
979979 help
980980 This driver enables support for the on-chip I2C interface of
981− the Broadcom XLP9xx/XLP5xx MIPS processors.
981+ the Broadcom XLP9xx/XLP5xx MIPS and Vulcan ARM64 processors.
982982
983983 This driver can also be built as a module. If so, the module will
984984 be called i2c-xlp9xx.
drivers/i2c/busses/i2c-cpm.c+2−2
@@ -116,8 +116,8 @@ struct cpm_i2c { · 115 unmodified lines
116116 cbd_t __iomem *rbase;
117117 u_char *txbuf[CPM_MAXBD];
118118 u_char *rxbuf[CPM_MAXBD];
119− u32 txdma[CPM_MAXBD];
120− u32 rxdma[CPM_MAXBD];
119+ dma_addr_t txdma[CPM_MAXBD];
120+ dma_addr_t rxdma[CPM_MAXBD];
121121 };
122122
123123 static irqreturn_t cpm_i2c_interrupt(int irq, void *dev_id)
drivers/i2c/busses/i2c-exynos5.c+19−5
@@ -671,7 +671,9 @@ static int exynos5_i2c_xfer(struct i2c_adapter *adap, · 670 unmodified lines
671671 return -EIO;
672672 }
673673
674− clk_prepare_enable(i2c->clk);
674+ ret = clk_enable(i2c->clk);
675+ if (ret)
676+ return ret;
675677
676678 for (i = 0; i < num; i++, msgs++) {
677679 stop = (i == num - 1);
@@ -695,7 +697,7 @@ static int exynos5_i2c_xfer(struct i2c_adapter *adap, · 17 unmodified lines
695697 }
696698
697699 out:
698− clk_disable_unprepare(i2c->clk);
700+ clk_disable(i2c->clk);
699701 return ret;
700702 }
701703
@@ -747,7 +749,9 @@ static int exynos5_i2c_probe(struct platform_device *pdev) · 45 unmodified lines
747749 return -ENOENT;
748750 }
749751
750− clk_prepare_enable(i2c->clk);
752+ ret = clk_prepare_enable(i2c->clk);
753+ if (ret)
754+ return ret;
751755
752756 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
753757 i2c->regs = devm_ioremap_resource(&pdev->dev, mem);
@@ -799,6 +803,10 @@ static int exynos5_i2c_probe(struct platform_device *pdev) · 45 unmodified lines
799803
800804 platform_set_drvdata(pdev, i2c);
801805
806+ clk_disable(i2c->clk);
807+
808+ return 0;
809+
802810 err_clk:
803811 clk_disable_unprepare(i2c->clk);
804812 return ret;
@@ -810,6 +818,8 @@ static int exynos5_i2c_remove(struct platform_device *pdev) · 5 unmodified lines
810818
811819 i2c_del_adapter(&i2c->adap);
812820
821+ clk_unprepare(i2c->clk);
822+
813823 return 0;
814824 }
815825
@@ -821,6 +831,8 @@ static int exynos5_i2c_suspend_noirq(struct device *dev) · 5 unmodified lines
821831
822832 i2c->suspended = 1;
823833
834+ clk_unprepare(i2c->clk);
835+
824836 return 0;
825837 }
826838
@@ -830,7 +842,9 @@ static int exynos5_i2c_resume_noirq(struct device *dev) · 3 unmodified lines
830842 struct exynos5_i2c *i2c = platform_get_drvdata(pdev);
831843 int ret = 0;
832844
833− clk_prepare_enable(i2c->clk);
845+ ret = clk_prepare_enable(i2c->clk);
846+ if (ret)
847+ return ret;
834848
835849 ret = exynos5_hsi2c_clock_setup(i2c);
836850 if (ret) {
@@ -839,7 +853,7 @@ static int exynos5_i2c_resume_noirq(struct device *dev) · 2 unmodified lines
839853 }
840854
841855 exynos5_i2c_init(i2c);
842− clk_disable_unprepare(i2c->clk);
856+ clk_disable(i2c->clk);
843857 i2c->suspended = 0;
844858
845859 return 0;
drivers/i2c/busses/i2c-ismt.c+2−0
@@ -75,6 +75,7 @@ · 74 unmodified lines
7575 /* PCI DIDs for the Intel SMBus Message Transport (SMT) Devices */
7676 #define PCI_DEVICE_ID_INTEL_S1200_SMT0 0x0c59
7777 #define PCI_DEVICE_ID_INTEL_S1200_SMT1 0x0c5a
78+#define PCI_DEVICE_ID_INTEL_DNV_SMT 0x19ac
7879 #define PCI_DEVICE_ID_INTEL_AVOTON_SMT 0x1f15
7980
8081 #define ISMT_DESC_ENTRIES 2 /* number of descriptor entries */
@@ -180,6 +181,7 @@ struct ismt_priv { · 99 unmodified lines
180181 static const struct pci_device_id ismt_ids[] = {
181182 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_S1200_SMT0) },
182183 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_S1200_SMT1) },
184+ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_DNV_SMT) },
183185 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_AVOTON_SMT) },
184186 { 0, }
185187 };
drivers/i2c/busses/i2c-rk3x.c+1−0
@@ -855,6 +855,7 @@ static struct rk3x_i2c_soc_data soc_data[3] = { · 854 unmodified lines
855855 static const struct of_device_id rk3x_i2c_match[] = {
856856 { .compatible = "rockchip,rk3066-i2c", .data = (void *)&soc_data[0] },
857857 { .compatible = "rockchip,rk3188-i2c", .data = (void *)&soc_data[1] },
858+ { .compatible = "rockchip,rk3228-i2c", .data = (void *)&soc_data[2] },
858859 { .compatible = "rockchip,rk3288-i2c", .data = (void *)&soc_data[2] },
859860 {},
860861 };
drivers/infiniband/core/cache.c+2−1
@@ -691,7 +691,8 @@ void ib_cache_gid_set_default_gid(struct ib_device *ib_dev, u8 port, · 690 unmodified lines
691691 NULL);
692692
693693 /* Coudn't find default GID location */
694− WARN_ON(ix < 0);
694+ if (WARN_ON(ix < 0))
695+ goto release;
695696
696697 zattr_type.gid_type = gid_type;
697698
drivers/infiniband/core/ucm.c+4−0
@@ -48,6 +48,7 @@ · 47 unmodified lines
4848
4949 #include <asm/uaccess.h>
5050
51+#include <rdma/ib.h>
5152 #include <rdma/ib_cm.h>
5253 #include <rdma/ib_user_cm.h>
5354 #include <rdma/ib_marshall.h>
@@ -1103,6 +1104,9 @@ static ssize_t ib_ucm_write(struct file *filp, const char __user *buf, · 1049 unmodified lines
11031104 struct ib_ucm_cmd_hdr hdr;
11041105 ssize_t result;
11051106
1107+ if (WARN_ON_ONCE(!ib_safe_file_access(filp)))
1108+ return -EACCES;
1109+
11061110 if (len < sizeof(hdr))
11071111 return -EINVAL;
11081112
drivers/infiniband/core/ucma.c+3−0
@@ -1574,6 +1574,9 @@ static ssize_t ucma_write(struct file *filp, const char __user *buf, · 1573 unmodified lines
15741574 struct rdma_ucm_cmd_hdr hdr;
15751575 ssize_t ret;
15761576
1577+ if (WARN_ON_ONCE(!ib_safe_file_access(filp)))
1578+ return -EACCES;
1579+
15771580 if (len < sizeof(hdr))
15781581 return -EINVAL;
15791582
drivers/infiniband/core/uverbs_main.c+5−0
@@ -48,6 +48,8 @@ · 47 unmodified lines
4848
4949 #include <asm/uaccess.h>
5050
51+#include <rdma/ib.h>
52+
5153 #include "uverbs.h"
5254
5355 MODULE_AUTHOR("Roland Dreier");
@@ -709,6 +711,9 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf, · 655 unmodified lines
709711 int srcu_key;
710712 ssize_t ret;
711713
714+ if (WARN_ON_ONCE(!ib_safe_file_access(filp)))
715+ return -EACCES;
716+
712717 if (count < sizeof hdr)
713718 return -EINVAL;
714719
drivers/infiniband/core/verbs.c+2−1
@@ -1860,6 +1860,7 @@ EXPORT_SYMBOL(ib_drain_rq); · 1859 unmodified lines
18601860 void ib_drain_qp(struct ib_qp *qp)
18611861 {
18621862 ib_drain_sq(qp);
1863− ib_drain_rq(qp);
1863+ if (!qp->srq)
1864+ ib_drain_rq(qp);
18641865 }
18651866 EXPORT_SYMBOL(ib_drain_qp);
drivers/infiniband/hw/cxgb3/iwch_provider.c+2−0
@@ -1390,6 +1390,8 @@ int iwch_register_device(struct iwch_dev *dev) · 1389 unmodified lines
13901390 dev->ibdev.iwcm->add_ref = iwch_qp_add_ref;
13911391 dev->ibdev.iwcm->rem_ref = iwch_qp_rem_ref;
13921392 dev->ibdev.iwcm->get_qp = iwch_get_qp;
1393+ memcpy(dev->ibdev.iwcm->ifname, dev->rdev.t3cdev_p->lldev->name,
1394+ sizeof(dev->ibdev.iwcm->ifname));
13931395
13941396 ret = ib_register_device(&dev->ibdev, NULL);
13951397 if (ret)
drivers/infiniband/hw/cxgb4/cq.c+1−1
@@ -162,7 +162,7 @@ static int create_cq(struct c4iw_rdev *rdev, struct t4_cq *cq, · 161 unmodified lines
162162 cq->bar2_va = c4iw_bar2_addrs(rdev, cq->cqid, T4_BAR2_QTYPE_INGRESS,
163163 &cq->bar2_qid,
164164 user ? &cq->bar2_pa : NULL);
165− if (user && !cq->bar2_va) {
165+ if (user && !cq->bar2_pa) {
166166 pr_warn(MOD "%s: cqid %u not in BAR2 range.\n",
167167 pci_name(rdev->lldi.pdev), cq->cqid);
168168 ret = -EINVAL;
drivers/infiniband/hw/cxgb4/provider.c+2−0
@@ -580,6 +580,8 @@ int c4iw_register_device(struct c4iw_dev *dev) · 579 unmodified lines
580580 dev->ibdev.iwcm->add_ref = c4iw_qp_add_ref;
581581 dev->ibdev.iwcm->rem_ref = c4iw_qp_rem_ref;
582582 dev->ibdev.iwcm->get_qp = c4iw_get_qp;
583+ memcpy(dev->ibdev.iwcm->ifname, dev->rdev.lldi.ports[0]->name,
584+ sizeof(dev->ibdev.iwcm->ifname));
583585
584586 ret = ib_register_device(&dev->ibdev, NULL);
585587 if (ret)
drivers/infiniband/hw/cxgb4/qp.c+21−3
@@ -185,6 +185,10 @@ void __iomem *c4iw_bar2_addrs(struct c4iw_rdev *rdev, unsigned int qid, · 184 unmodified lines
185185
186186 if (pbar2_pa)
187187 *pbar2_pa = (rdev->bar2_pa + bar2_qoffset) & PAGE_MASK;
188+
189+ if (is_t4(rdev->lldi.adapter_type))
190+ return NULL;
191+
188192 return rdev->bar2_kva + bar2_qoffset;
189193 }
190194
@@ -270,7 +274,7 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq, · 79 unmodified lines
270274 /*
271275 * User mode must have bar2 access.
272276 */
273− if (user && (!wq->sq.bar2_va || !wq->rq.bar2_va)) {
277+ if (user && (!wq->sq.bar2_pa || !wq->rq.bar2_pa)) {
274278 pr_warn(MOD "%s: sqid %u or rqid %u not in BAR2 range.\n",
275279 pci_name(rdev->lldi.pdev), wq->sq.qid, wq->rq.qid);
276280 goto free_dma;
@@ -1895,13 +1899,27 @@ int c4iw_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, · 1618 unmodified lines
18951899 void c4iw_drain_sq(struct ib_qp *ibqp)
18961900 {
18971901 struct c4iw_qp *qp = to_c4iw_qp(ibqp);
1902+ unsigned long flag;
1903+ bool need_to_wait;
18981904
1899− wait_for_completion(&qp->sq_drained);
1905+ spin_lock_irqsave(&qp->lock, flag);
1906+ need_to_wait = !t4_sq_empty(&qp->wq);
1907+ spin_unlock_irqrestore(&qp->lock, flag);
1908+
1909+ if (need_to_wait)
1910+ wait_for_completion(&qp->sq_drained);
19001911 }
19011912
19021913 void c4iw_drain_rq(struct ib_qp *ibqp)
19031914 {
19041915 struct c4iw_qp *qp = to_c4iw_qp(ibqp);
1916+ unsigned long flag;
1917+ bool need_to_wait;
1918+
1919+ spin_lock_irqsave(&qp->lock, flag);
1920+ need_to_wait = !t4_rq_empty(&qp->wq);
1921+ spin_unlock_irqrestore(&qp->lock, flag);
19051922
1906− wait_for_completion(&qp->rq_drained);
1923+ if (need_to_wait)
1924+ wait_for_completion(&qp->rq_drained);
19071925 }
drivers/infiniband/hw/mlx5/main.c+1−1
@@ -530,7 +530,7 @@ static int mlx5_ib_query_device(struct ib_device *ibdev, · 529 unmodified lines
530530 sizeof(struct mlx5_wqe_ctrl_seg)) /
531531 sizeof(struct mlx5_wqe_data_seg);
532532 props->max_sge = min(max_rq_sg, max_sq_sg);
533− props->max_sge_rd = props->max_sge;
533+ props->max_sge_rd = MLX5_MAX_SGE_RD;
534534 props->max_cq = 1 << MLX5_CAP_GEN(mdev, log_max_cq);
535535 props->max_cqe = (1 << MLX5_CAP_GEN(mdev, log_max_cq_sz)) - 1;
536536 props->max_mr = 1 << MLX5_CAP_GEN(mdev, log_max_mkey);
drivers/infiniband/hw/nes/nes_nic.c+0−3
@@ -498,9 +498,6 @@ static int nes_netdev_start_xmit(struct sk_buff *skb, struct net_device *netdev) · 497 unmodified lines
498498 * skb_shinfo(skb)->nr_frags, skb_is_gso(skb));
499499 */
500500
501− if (!netif_carrier_ok(netdev))
502− return NETDEV_TX_OK;
503−
504501 if (netif_queue_stopped(netdev))
505502 return NETDEV_TX_BUSY;
506503
drivers/infiniband/hw/qib/qib_file_ops.c+5−0
@@ -45,6 +45,8 @@ · 44 unmodified lines
4545 #include <linux/export.h>
4646 #include <linux/uio.h>
4747
48+#include <rdma/ib.h>
49+
4850 #include "qib.h"
4951 #include "qib_common.h"
5052 #include "qib_user_sdma.h"
@@ -2067,6 +2069,9 @@ static ssize_t qib_write(struct file *fp, const char __user *data, · 2016 unmodified lines
20672069 ssize_t ret = 0;
20682070 void *dest;
20692071
2072+ if (WARN_ON_ONCE(!ib_safe_file_access(fp)))
2073+ return -EACCES;
2074+
20702075 if (count < sizeof(cmd.type)) {
20712076 ret = -EINVAL;
20722077 goto bail;
drivers/infiniband/sw/rdmavt/qp.c+2−2
@@ -1637,9 +1637,9 @@ bail: · 1636 unmodified lines
16371637 spin_unlock_irqrestore(&qp->s_hlock, flags);
16381638 if (nreq) {
16391639 if (call_send)
1640− rdi->driver_f.schedule_send_no_lock(qp);
1641− else
16421640 rdi->driver_f.do_send(qp);
1641+ else
1642+ rdi->driver_f.schedule_send_no_lock(qp);
16431643 }
16441644 return err;
16451645 }
drivers/md/md.c+2−0
@@ -284,6 +284,8 @@ static blk_qc_t md_make_request(struct request_queue *q, struct bio *bio) · 283 unmodified lines
284284 * go away inside make_request
285285 */
286286 sectors = bio_sectors(bio);
287+ /* bio could be mergeable after passing to underlayer */
288+ bio->bi_rw &= ~REQ_NOMERGE;
287289 mddev->pers->make_request(mddev, bio);
288290
289291 cpu = part_stat_lock();
drivers/md/raid0.c+1−1
@@ -70,7 +70,6 @@ static void dump_zones(struct mddev *mddev) · 69 unmodified lines
7070 (unsigned long long)zone_size>>1);
7171 zone_start = conf->strip_zone[j].zone_end;
7272 }
73− printk(KERN_INFO "\n");
7473 }
7574
7675 static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
@@ -85,6 +84,7 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) · 8 unmodified lines
8584 struct r0conf *conf = kzalloc(sizeof(*conf), GFP_KERNEL);
8685 unsigned short blksize = 512;
8786
87+ *private_conf = ERR_PTR(-ENOMEM);
8888 if (!conf)
8989 return -ENOMEM;
9090 rdev_for_each(rdev1, mddev) {
drivers/md/raid5.c+0−2
@@ -3502,8 +3502,6 @@ returnbi: · 3501 unmodified lines
35023502 dev = &sh->dev[i];
35033503 } else if (test_bit(R5_Discard, &dev->flags))
35043504 discard_pending = 1;
3505− WARN_ON(test_bit(R5_SkipCopy, &dev->flags));
3506− WARN_ON(dev->page != dev->orig_page);
35073505 }
35083506
35093507 r5l_stripe_write_finished(sh);
drivers/media/usb/usbvision/usbvision-video.c+0−7
@@ -1452,13 +1452,6 @@ static int usbvision_probe(struct usb_interface *intf, · 1451 unmodified lines
14521452 printk(KERN_INFO "%s: %s found\n", __func__,
14531453 usbvision_device_data[model].model_string);
14541454
1455− /*
1456− * this is a security check.
1457− * an exploit using an incorrect bInterfaceNumber is known
1458− */
1459− if (ifnum >= USB_MAXINTERFACES || !dev->actconfig->interface[ifnum])
1460− return -ENODEV;
1461−
14621455 if (usbvision_device_data[model].interface >= 0)
14631456 interface = &dev->actconfig->interface[usbvision_device_data[model].interface]->altsetting[0];
14641457 else if (ifnum < dev->actconfig->desc.bNumInterfaces)
drivers/media/v4l2-core/videobuf2-core.c+15−5
@@ -1645,7 +1645,7 @@ static int __vb2_wait_for_done_vb(struct vb2_queue *q, int nonblocking) · 1644 unmodified lines
16451645 * Will sleep if required for nonblocking == false.
16461646 */
16471647 static int __vb2_get_done_vb(struct vb2_queue *q, struct vb2_buffer **vb,
1648− int nonblocking)
1648+ void *pb, int nonblocking)
16491649 {
16501650 unsigned long flags;
16511651 int ret;
@@ -1666,10 +1666,10 @@ static int __vb2_get_done_vb(struct vb2_queue *q, struct vb2_buffer **vb, · 14 unmodified lines
16661666 /*
16671667 * Only remove the buffer from done_list if v4l2_buffer can handle all
16681668 * the planes.
1669− * Verifying planes is NOT necessary since it already has been checked
1670− * before the buffer is queued/prepared. So it can never fail.
16711669 */
1672− list_del(&(*vb)->done_entry);
1670+ ret = call_bufop(q, verify_planes_array, *vb, pb);
1671+ if (!ret)
1672+ list_del(&(*vb)->done_entry);
16731673 spin_unlock_irqrestore(&q->done_lock, flags);
16741674
16751675 return ret;
@@ -1748,7 +1748,7 @@ int vb2_core_dqbuf(struct vb2_queue *q, unsigned int *pindex, void *pb, · 72 unmodified lines
17481748 struct vb2_buffer *vb = NULL;
17491749 int ret;
17501750
1751− ret = __vb2_get_done_vb(q, &vb, nonblocking);
1751+ ret = __vb2_get_done_vb(q, &vb, pb, nonblocking);
17521752 if (ret < 0)
17531753 return ret;
17541754
@@ -2297,6 +2297,16 @@ unsigned int vb2_core_poll(struct vb2_queue *q, struct file *file, · 542 unmodified lines
22972297 if (!vb2_is_streaming(q) || q->error)
22982298 return POLLERR;
22992299
2300+ /*
2301+ * If this quirk is set and QBUF hasn't been called yet then
2302+ * return POLLERR as well. This only affects capture queues, output
2303+ * queues will always initialize waiting_for_buffers to false.
2304+ * This quirk is set by V4L2 for backwards compatibility reasons.
2305+ */
2306+ if (q->quirk_poll_must_check_waiting_for_buffers &&
2307+ q->waiting_for_buffers && (req_events & (POLLIN | POLLRDNORM)))
2308+ return POLLERR;
2309+
23002310 /*
23012311 * For output streams you can call write() as long as there are fewer
23022312 * buffers queued than there are buffers available.
drivers/media/v4l2-core/videobuf2-memops.c+1−1
@@ -49,7 +49,7 @@ struct frame_vector *vb2_create_framevec(unsigned long start, · 48 unmodified lines
4949 vec = frame_vector_create(nr);
5050 if (!vec)
5151 return ERR_PTR(-ENOMEM);
52− ret = get_vaddr_frames(start, nr, write, 1, vec);
52+ ret = get_vaddr_frames(start & PAGE_MASK, nr, write, true, vec);
5353 if (ret < 0)
5454 goto out_destroy;
5555 /* We accept only complete set of PFNs */
drivers/media/v4l2-core/videobuf2-v4l2.c+12−8
@@ -74,6 +74,11 @@ static int __verify_planes_array(struct vb2_buffer *vb, const struct v4l2_buffer · 73 unmodified lines
7474 return 0;
7575 }
7676
77+static int __verify_planes_array_core(struct vb2_buffer *vb, const void *pb)
78+{
79+ return __verify_planes_array(vb, pb);
80+}
81+
7782 /**
7883 * __verify_length() - Verify that the bytesused value for each plane fits in
7984 * the plane length and that the data offset doesn't exceed the bytesused value.
@@ -437,6 +442,7 @@ static int __fill_vb2_buffer(struct vb2_buffer *vb, · 357 unmodified lines
437442 }
438443
439444 static const struct vb2_buf_ops v4l2_buf_ops = {
445+ .verify_planes_array = __verify_planes_array_core,
440446 .fill_user_buffer = __fill_v4l2_buffer,
441447 .fill_vb2_buffer = __fill_vb2_buffer,
442448 .copy_timestamp = __copy_timestamp,
@@ -765,6 +771,12 @@ int vb2_queue_init(struct vb2_queue *q) · 322 unmodified lines
765771 q->is_output = V4L2_TYPE_IS_OUTPUT(q->type);
766772 q->copy_timestamp = (q->timestamp_flags & V4L2_BUF_FLAG_TIMESTAMP_MASK)
767773 == V4L2_BUF_FLAG_TIMESTAMP_COPY;
774+ /*
775+ * For compatibility with vb1: if QBUF hasn't been called yet, then
776+ * return POLLERR as well. This only affects capture queues, output
777+ * queues will always initialize waiting_for_buffers to false.
778+ */
779+ q->quirk_poll_must_check_waiting_for_buffers = true;
768780
769781 return vb2_core_queue_init(q);
770782 }
@@ -818,14 +830,6 @@ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait) · 47 unmodified lines
818830 poll_wait(file, &fh->wait, wait);
819831 }
820832
821− /*
822− * For compatibility with vb1: if QBUF hasn't been called yet, then
823− * return POLLERR as well. This only affects capture queues, output
824− * queues will always initialize waiting_for_buffers to false.
825− */
826− if (q->waiting_for_buffers && (req_events & (POLLIN | POLLRDNORM)))
827− return POLLERR;
828−
829833 return res | vb2_core_poll(q, file, wait);
830834 }
831835 EXPORT_SYMBOL_GPL(vb2_poll);
drivers/misc/cxl/context.c+7−0
@@ -223,6 +223,13 @@ int __detach_context(struct cxl_context *ctx) · 222 unmodified lines
223223 cxl_ops->link_ok(ctx->afu->adapter, ctx->afu));
224224 flush_work(&ctx->fault_work); /* Only needed for dedicated process */
225225
226+ /*
227+ * Wait until no further interrupts are presented by the PSL
228+ * for this context.
229+ */
230+ if (cxl_ops->irq_wait)
231+ cxl_ops->irq_wait(ctx);
232+
226233 /* release the reference to the group leader and mm handling pid */
227234 put_pid(ctx->pid);
228235 put_pid(ctx->glpid);
drivers/misc/cxl/cxl.h+2−0
@@ -274,6 +274,7 @@ static const cxl_p2n_reg_t CXL_PSL_WED_An = {0x0A0}; · 273 unmodified lines
274274 #define CXL_PSL_DSISR_An_PE (1ull << (63-4)) /* PSL Error (implementation specific) */
275275 #define CXL_PSL_DSISR_An_AE (1ull << (63-5)) /* AFU Error */
276276 #define CXL_PSL_DSISR_An_OC (1ull << (63-6)) /* OS Context Warning */
277+#define CXL_PSL_DSISR_PENDING (CXL_PSL_DSISR_TRANS | CXL_PSL_DSISR_An_PE | CXL_PSL_DSISR_An_AE | CXL_PSL_DSISR_An_OC)
277278 /* NOTE: Bits 32:63 are undefined if DSISR[DS] = 1 */
278279 #define CXL_PSL_DSISR_An_M DSISR_NOHPTE /* PTE not found */
279280 #define CXL_PSL_DSISR_An_P DSISR_PROTFAULT /* Storage protection violation */
@@ -855,6 +856,7 @@ struct cxl_backend_ops { · 575 unmodified lines
855856 u64 dsisr, u64 errstat);
856857 irqreturn_t (*psl_interrupt)(int irq, void *data);
857858 int (*ack_irq)(struct cxl_context *ctx, u64 tfc, u64 psl_reset_mask);
859+ void (*irq_wait)(struct cxl_context *ctx);
858860 int (*attach_process)(struct cxl_context *ctx, bool kernel,
859861 u64 wed, u64 amr);
860862 int (*detach_process)(struct cxl_context *ctx);
drivers/misc/cxl/irq.c+0−1
@@ -203,7 +203,6 @@ unsigned int cxl_map_irq(struct cxl *adapter, irq_hw_number_t hwirq, · 202 unmodified lines
203203 void cxl_unmap_irq(unsigned int virq, void *cookie)
204204 {
205205 free_irq(virq, cookie);
206− irq_dispose_mapping(virq);
207206 }
208207
209208 int cxl_register_one_irq(struct cxl *adapter,
drivers/misc/cxl/native.c+31−0
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 #include <linux/mutex.h>
1515 #include <linux/mm.h>
1616 #include <linux/uaccess.h>
17+#include <linux/delay.h>
1718 #include <asm/synch.h>
1819 #include <misc/cxl-base.h>
1920
@@ -797,6 +798,35 @@ static irqreturn_t native_irq_multiplexed(int irq, void *data) · 777 unmodified lines
797798 return fail_psl_irq(afu, &irq_info);
798799 }
799800
801+void native_irq_wait(struct cxl_context *ctx)
802+{
803+ u64 dsisr;
804+ int timeout = 1000;
805+ int ph;
806+
807+ /*
808+ * Wait until no further interrupts are presented by the PSL
809+ * for this context.
810+ */
811+ while (timeout--) {
812+ ph = cxl_p2n_read(ctx->afu, CXL_PSL_PEHandle_An) & 0xffff;
813+ if (ph != ctx->pe)
814+ return;
815+ dsisr = cxl_p2n_read(ctx->afu, CXL_PSL_DSISR_An);
816+ if ((dsisr & CXL_PSL_DSISR_PENDING) == 0)
817+ return;
818+ /*
819+ * We are waiting for the workqueue to process our
820+ * irq, so need to let that run here.
821+ */
822+ msleep(1);
823+ }
824+
825+ dev_warn(&ctx->afu->dev, "WARNING: waiting on DSI for PE %i"
826+ " DSISR %016llx!\n", ph, dsisr);
827+ return;
828+}
829+
800830 static irqreturn_t native_slice_irq_err(int irq, void *data)
801831 {
802832 struct cxl_afu *afu = data;
@@ -1076,6 +1106,7 @@ const struct cxl_backend_ops cxl_native_ops = { · 273 unmodified lines
10761106 .handle_psl_slice_error = native_handle_psl_slice_error,
10771107 .psl_interrupt = NULL,
10781108 .ack_irq = native_ack_irq,
1109+ .irq_wait = native_irq_wait,
10791110 .attach_process = native_attach_process,
10801111 .detach_process = native_detach_process,
10811112 .support_attributes = native_support_attributes,
drivers/mmc/host/Kconfig+1−0
@@ -97,6 +97,7 @@ config MMC_RICOH_MMC · 96 unmodified lines
9797 config MMC_SDHCI_ACPI
9898 tristate "SDHCI support for ACPI enumerated SDHCI controllers"
9999 depends on MMC_SDHCI && ACPI
100+ select IOSF_MBI if X86
100101 help
101102 This selects support for ACPI enumerated SDHCI controllers,
102103 identified by ACPI Compatibility ID PNP0D40 or specific
drivers/mmc/host/sdhci-acpi.c+81−0
@@ -41,6 +41,11 @@ · 40 unmodified lines
4141 #include <linux/mmc/pm.h>
4242 #include <linux/mmc/slot-gpio.h>
4343
44+#ifdef CONFIG_X86
45+#include <asm/cpu_device_id.h>
46+#include <asm/iosf_mbi.h>
47+#endif
48+
4449 #include "sdhci.h"
4550
4651 enum {
@@ -116,6 +121,75 @@ static const struct sdhci_acpi_chip sdhci_acpi_chip_int = { · 69 unmodified lines
116121 .ops = &sdhci_acpi_ops_int,
117122 };
118123
124+#ifdef CONFIG_X86
125+
126+static bool sdhci_acpi_byt(void)
127+{
128+ static const struct x86_cpu_id byt[] = {
129+ { X86_VENDOR_INTEL, 6, 0x37 },
130+ {}
131+ };
132+
133+ return x86_match_cpu(byt);
134+}
135+
136+#define BYT_IOSF_SCCEP 0x63
137+#define BYT_IOSF_OCP_NETCTRL0 0x1078
138+#define BYT_IOSF_OCP_TIMEOUT_BASE GENMASK(10, 8)
139+
140+static void sdhci_acpi_byt_setting(struct device *dev)
141+{
142+ u32 val = 0;
143+
144+ if (!sdhci_acpi_byt())
145+ return;
146+
147+ if (iosf_mbi_read(BYT_IOSF_SCCEP, MBI_CR_READ, BYT_IOSF_OCP_NETCTRL0,
148+ &val)) {
149+ dev_err(dev, "%s read error\n", __func__);
150+ return;
151+ }
152+
153+ if (!(val & BYT_IOSF_OCP_TIMEOUT_BASE))
154+ return;
155+
156+ val &= ~BYT_IOSF_OCP_TIMEOUT_BASE;
157+
158+ if (iosf_mbi_write(BYT_IOSF_SCCEP, MBI_CR_WRITE, BYT_IOSF_OCP_NETCTRL0,
159+ val)) {
160+ dev_err(dev, "%s write error\n", __func__);
161+ return;
162+ }
163+
164+ dev_dbg(dev, "%s completed\n", __func__);
165+}
166+
167+static bool sdhci_acpi_byt_defer(struct device *dev)
168+{
169+ if (!sdhci_acpi_byt())
170+ return false;
171+
172+ if (!iosf_mbi_available())
173+ return true;
174+
175+ sdhci_acpi_byt_setting(dev);
176+
177+ return false;
178+}
179+
180+#else
181+
182+static inline void sdhci_acpi_byt_setting(struct device *dev)
183+{
184+}
185+
186+static inline bool sdhci_acpi_byt_defer(struct device *dev)
187+{
188+ return false;
189+}
190+
191+#endif
192+
119193 static int bxt_get_cd(struct mmc_host *mmc)
120194 {
121195 int gpio_cd = mmc_gpio_get_cd(mmc);
@@ -322,6 +396,9 @@ static int sdhci_acpi_probe(struct platform_device *pdev) · 200 unmodified lines
322396 if (acpi_bus_get_status(device) || !device->status.present)
323397 return -ENODEV;
324398
399+ if (sdhci_acpi_byt_defer(dev))
400+ return -EPROBE_DEFER;
401+
325402 hid = acpi_device_hid(device);
326403 uid = device->pnp.unique_id;
327404
@@ -447,6 +524,8 @@ static int sdhci_acpi_resume(struct device *dev) · 119 unmodified lines
447524 {
448525 struct sdhci_acpi_host *c = dev_get_drvdata(dev);
449526
527+ sdhci_acpi_byt_setting(&c->pdev->dev);
528+
450529 return sdhci_resume_host(c->host);
451530 }
452531
@@ -470,6 +549,8 @@ static int sdhci_acpi_runtime_resume(struct device *dev) · 17 unmodified lines
470549 {
471550 struct sdhci_acpi_host *c = dev_get_drvdata(dev);
472551
552+ sdhci_acpi_byt_setting(&c->pdev->dev);
553+
473554 return sdhci_runtime_resume_host(c->host);
474555 }
475556
drivers/mmc/host/sunxi-mmc.c+5−0
@@ -1129,6 +1129,11 @@ static int sunxi_mmc_probe(struct platform_device *pdev) · 1128 unmodified lines
11291129 MMC_CAP_1_8V_DDR |
11301130 MMC_CAP_ERASE | MMC_CAP_SDIO_IRQ;
11311131
1132+ /* TODO MMC DDR is not working on A80 */
1133+ if (of_device_is_compatible(pdev->dev.of_node,
1134+ "allwinner,sun9i-a80-mmc"))
1135+ mmc->caps &= ~MMC_CAP_1_8V_DDR;
1136+
11321137 ret = mmc_of_parse(mmc);
11331138 if (ret)
11341139 goto error_free_dma;
drivers/net/dsa/mv88e6xxx.c+1−1
@@ -2202,7 +2202,7 @@ int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port, · 2201 unmodified lines
22022202 struct net_device *bridge)
22032203 {
22042204 struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
2205− int i, err;
2205+ int i, err = 0;
22062206
22072207 mutex_lock(&ps->smi_mutex);
22082208
drivers/net/ethernet/broadcom/bnxt/bnxt.c+39−14
@@ -588,12 +588,30 @@ static inline int bnxt_alloc_rx_page(struct bnxt *bp, · 587 unmodified lines
588588 struct page *page;
589589 dma_addr_t mapping;
590590 u16 sw_prod = rxr->rx_sw_agg_prod;
591+ unsigned int offset = 0;
591592
592− page = alloc_page(gfp);
593− if (!page)
594− return -ENOMEM;
593+ if (PAGE_SIZE > BNXT_RX_PAGE_SIZE) {
594+ page = rxr->rx_page;
595+ if (!page) {
596+ page = alloc_page(gfp);
597+ if (!page)
598+ return -ENOMEM;
599+ rxr->rx_page = page;
600+ rxr->rx_page_offset = 0;
601+ }
602+ offset = rxr->rx_page_offset;
603+ rxr->rx_page_offset += BNXT_RX_PAGE_SIZE;
604+ if (rxr->rx_page_offset == PAGE_SIZE)
605+ rxr->rx_page = NULL;
606+ else
607+ get_page(page);
608+ } else {
609+ page = alloc_page(gfp);
610+ if (!page)
611+ return -ENOMEM;
612+ }
595613
596− mapping = dma_map_page(&pdev->dev, page, 0, PAGE_SIZE,
614+ mapping = dma_map_page(&pdev->dev, page, offset, BNXT_RX_PAGE_SIZE,
597615 PCI_DMA_FROMDEVICE);
598616 if (dma_mapping_error(&pdev->dev, mapping)) {
599617 __free_page(page);
@@ -608,6 +626,7 @@ static inline int bnxt_alloc_rx_page(struct bnxt *bp, · 8 unmodified lines
608626 rxr->rx_sw_agg_prod = NEXT_RX_AGG(sw_prod);
609627
610628 rx_agg_buf->page = page;
629+ rx_agg_buf->offset = offset;
611630 rx_agg_buf->mapping = mapping;
612631 rxbd->rx_bd_haddr = cpu_to_le64(mapping);
613632 rxbd->rx_bd_opaque = sw_prod;
@@ -649,6 +668,7 @@ static void bnxt_reuse_rx_agg_bufs(struct bnxt_napi *bnapi, u16 cp_cons, · 35 unmodified lines
649668 page = cons_rx_buf->page;
650669 cons_rx_buf->page = NULL;
651670 prod_rx_buf->page = page;
671+ prod_rx_buf->offset = cons_rx_buf->offset;
652672
653673 prod_rx_buf->mapping = cons_rx_buf->mapping;
654674
@@ -716,7 +736,8 @@ static struct sk_buff *bnxt_rx_pages(struct bnxt *bp, struct bnxt_napi *bnapi, · 61 unmodified lines
716736 RX_AGG_CMP_LEN) >> RX_AGG_CMP_LEN_SHIFT;
717737
718738 cons_rx_buf = &rxr->rx_agg_ring[cons];
719− skb_fill_page_desc(skb, i, cons_rx_buf->page, 0, frag_len);
739+ skb_fill_page_desc(skb, i, cons_rx_buf->page,
740+ cons_rx_buf->offset, frag_len);
720741 __clear_bit(cons, rxr->rx_agg_bmap);
721742
722743 /* It is possible for bnxt_alloc_rx_page() to allocate
@@ -747,7 +768,7 @@ static struct sk_buff *bnxt_rx_pages(struct bnxt *bp, struct bnxt_napi *bnapi, · 24 unmodified lines
747768 return NULL;
748769 }
749770
750− dma_unmap_page(&pdev->dev, mapping, PAGE_SIZE,
771+ dma_unmap_page(&pdev->dev, mapping, BNXT_RX_PAGE_SIZE,
751772 PCI_DMA_FROMDEVICE);
752773
753774 skb->data_len += frag_len;
@@ -1635,13 +1656,17 @@ static void bnxt_free_rx_skbs(struct bnxt *bp) · 881 unmodified lines
16351656
16361657 dma_unmap_page(&pdev->dev,
16371658 dma_unmap_addr(rx_agg_buf, mapping),
1638− PAGE_SIZE, PCI_DMA_FROMDEVICE);
1659+ BNXT_RX_PAGE_SIZE, PCI_DMA_FROMDEVICE);
16391660
16401661 rx_agg_buf->page = NULL;
16411662 __clear_bit(j, rxr->rx_agg_bmap);
16421663
16431664 __free_page(page);
16441665 }
1666+ if (rxr->rx_page) {
1667+ __free_page(rxr->rx_page);
1668+ rxr->rx_page = NULL;
1669+ }
16451670 }
16461671 }
16471672
@@ -2024,7 +2049,7 @@ static int bnxt_init_one_rx_ring(struct bnxt *bp, int ring_nr) · 376 unmodified lines
20242049 if (!(bp->flags & BNXT_FLAG_AGG_RINGS))
20252050 return 0;
20262051
2027− type = ((u32)PAGE_SIZE << RX_BD_LEN_SHIFT) |
2052+ type = ((u32)BNXT_RX_PAGE_SIZE << RX_BD_LEN_SHIFT) |
20282053 RX_BD_TYPE_RX_AGG_BD | RX_BD_FLAGS_SOP;
20292054
20302055 bnxt_init_rxbd_pages(ring, type);
@@ -2215,7 +2240,7 @@ void bnxt_set_ring_params(struct bnxt *bp) · 184 unmodified lines
22152240 bp->rx_agg_nr_pages = 0;
22162241
22172242 if (bp->flags & BNXT_FLAG_TPA)
2218− agg_factor = 4;
2243+ agg_factor = min_t(u32, 4, 65536 / BNXT_RX_PAGE_SIZE);
22192244
22202245 bp->flags &= ~BNXT_FLAG_JUMBO;
22212246 if (rx_space > PAGE_SIZE) {
@@ -3076,12 +3101,12 @@ static int bnxt_hwrm_vnic_set_tpa(struct bnxt *bp, u16 vnic_id, u32 tpa_flags) · 854 unmodified lines
30763101 /* Number of segs are log2 units, and first packet is not
30773102 * included as part of this units.
30783103 */
3079− if (mss <= PAGE_SIZE) {
3080− n = PAGE_SIZE / mss;
3104+ if (mss <= BNXT_RX_PAGE_SIZE) {
3105+ n = BNXT_RX_PAGE_SIZE / mss;
30813106 nsegs = (MAX_SKB_FRAGS - 1) * n;
30823107 } else {
3083− n = mss / PAGE_SIZE;
3084− if (mss & (PAGE_SIZE - 1))
3108+ n = mss / BNXT_RX_PAGE_SIZE;
3109+ if (mss & (BNXT_RX_PAGE_SIZE - 1))
30853110 n++;
30863111 nsegs = (MAX_SKB_FRAGS - n) / n;
30873112 }
@@ -4367,7 +4392,7 @@ static int bnxt_setup_int_mode(struct bnxt *bp) · 1279 unmodified lines
43674392 if (bp->flags & BNXT_FLAG_MSIX_CAP)
43684393 rc = bnxt_setup_msix(bp);
43694394
4370− if (!(bp->flags & BNXT_FLAG_USING_MSIX)) {
4395+ if (!(bp->flags & BNXT_FLAG_USING_MSIX) && BNXT_PF(bp)) {
43714396 /* fallback to INTA */
43724397 rc = bnxt_setup_inta(bp);
43734398 }
drivers/net/ethernet/broadcom/bnxt/bnxt.h+13−0
@@ -407,6 +407,15 @@ struct rx_tpa_end_cmp_ext { · 406 unmodified lines
407407
408408 #define BNXT_PAGE_SIZE (1 << BNXT_PAGE_SHIFT)
409409
410+/* The RXBD length is 16-bit so we can only support page sizes < 64K */
411+#if (PAGE_SHIFT > 15)
412+#define BNXT_RX_PAGE_SHIFT 15
413+#else
414+#define BNXT_RX_PAGE_SHIFT PAGE_SHIFT
415+#endif
416+
417+#define BNXT_RX_PAGE_SIZE (1 << BNXT_RX_PAGE_SHIFT)
418+
410419 #define BNXT_MIN_PKT_SIZE 45
411420
412421 #define BNXT_NUM_TESTS(bp) 0
@@ -506,6 +515,7 @@ struct bnxt_sw_rx_bd { · 93 unmodified lines
506515
507516 struct bnxt_sw_rx_agg_bd {
508517 struct page *page;
518+ unsigned int offset;
509519 dma_addr_t mapping;
510520 };
511521
@@ -586,6 +596,9 @@ struct bnxt_rx_ring_info { · 74 unmodified lines
586596 unsigned long *rx_agg_bmap;
587597 u16 rx_agg_bmap_size;
588598
599+ struct page *rx_page;
600+ unsigned int rx_page_offset;
601+
589602 dma_addr_t rx_desc_mapping[MAX_RX_PAGES];
590603 dma_addr_t rx_agg_desc_mapping[MAX_RX_AGG_PAGES];
591604
drivers/net/ethernet/cadence/macb.c+21−13
@@ -440,7 +440,7 @@ static int macb_mii_init(struct macb *bp) · 439 unmodified lines
440440 snprintf(bp->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x",
441441 bp->pdev->name, bp->pdev->id);
442442 bp->mii_bus->priv = bp;
443− bp->mii_bus->parent = &bp->dev->dev;
443+ bp->mii_bus->parent = &bp->pdev->dev;
444444 pdata = dev_get_platdata(&bp->pdev->dev);
445445
446446 dev_set_drvdata(&bp->dev->dev, bp->mii_bus);
@@ -458,7 +458,8 @@ static int macb_mii_init(struct macb *bp) · 11 unmodified lines
458458 struct phy_device *phydev;
459459
460460 phydev = mdiobus_scan(bp->mii_bus, i);
461− if (IS_ERR(phydev)) {
461+ if (IS_ERR(phydev) &&
462+ PTR_ERR(phydev) != -ENODEV) {
462463 err = PTR_ERR(phydev);
463464 break;
464465 }
@@ -3005,29 +3006,36 @@ static int macb_probe(struct platform_device *pdev) · 2540 unmodified lines
30053006 if (err)
30063007 goto err_out_free_netdev;
30073008
3009+ err = macb_mii_init(bp);
3010+ if (err)
3011+ goto err_out_free_netdev;
3012+
3013+ phydev = bp->phy_dev;
3014+
3015+ netif_carrier_off(dev);
3016+
30083017 err = register_netdev(dev);
30093018 if (err) {
30103019 dev_err(&pdev->dev, "Cannot register net device, aborting.\n");
3011− goto err_out_unregister_netdev;
3020+ goto err_out_unregister_mdio;
30123021 }
30133022
3014− err = macb_mii_init(bp);
3015− if (err)
3016− goto err_out_unregister_netdev;
3017−
3018− netif_carrier_off(dev);
3023+ phy_attached_info(phydev);
30193024
30203025 netdev_info(dev, "Cadence %s rev 0x%08x at 0x%08lx irq %d (%pM)\n",
30213026 macb_is_gem(bp) ? "GEM" : "MACB", macb_readl(bp, MID),
30223027 dev->base_addr, dev->irq, dev->dev_addr);
30233028
3024− phydev = bp->phy_dev;
3025− phy_attached_info(phydev);
3026−
30273029 return 0;
30283030
3029−err_out_unregister_netdev:
3030− unregister_netdev(dev);
3031+err_out_unregister_mdio:
3032+ phy_disconnect(bp->phy_dev);
3033+ mdiobus_unregister(bp->mii_bus);
3034+ mdiobus_free(bp->mii_bus);
3035+
3036+ /* Shutdown the PHY if there is a GPIO reset */
3037+ if (bp->reset_gpio)
3038+ gpiod_set_value(bp->reset_gpio, 0);
30313039
30323040 err_out_free_netdev:
30333041 free_netdev(dev);
drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c+2−1
@@ -576,7 +576,7 @@ static void setup_rss(struct adapter *adap) · 575 unmodified lines
576576 unsigned int nq0 = adap2pinfo(adap, 0)->nqsets;
577577 unsigned int nq1 = adap->port[1] ? adap2pinfo(adap, 1)->nqsets : 1;
578578 u8 cpus[SGE_QSETS + 1];
579− u16 rspq_map[RSS_TABLE_SIZE];
579+ u16 rspq_map[RSS_TABLE_SIZE + 1];
580580
581581 for (i = 0; i < SGE_QSETS; ++i)
582582 cpus[i] = i;
@@ -586,6 +586,7 @@ static void setup_rss(struct adapter *adap) · 3 unmodified lines
586586 rspq_map[i] = i % nq0;
587587 rspq_map[i + RSS_TABLE_SIZE / 2] = (i % nq1) + nq0;
588588 }
589+ rspq_map[RSS_TABLE_SIZE] = 0xffff; /* terminator */
589590
590591 t3_config_rss(adap, F_RQFEEDBACKENABLE | F_TNLLKPEN | F_TNLMAPEN |
591592 F_TNLPRTEN | F_TNL2TUPEN | F_TNL4TUPEN |
drivers/net/ethernet/marvell/mvneta.c+2−4
@@ -3354,8 +3354,7 @@ static int mvneta_percpu_notifier(struct notifier_block *nfb, · 3353 unmodified lines
33543354 /* Enable per-CPU interrupts on the CPU that is
33553355 * brought up.
33563356 */
3357− smp_call_function_single(cpu, mvneta_percpu_enable,
3358− pp, true);
3357+ mvneta_percpu_enable(pp);
33593358
33603359 /* Enable per-CPU interrupt on the one CPU we care
33613360 * about.
@@ -3387,8 +3386,7 @@ static int mvneta_percpu_notifier(struct notifier_block *nfb, · 25 unmodified lines
33873386 /* Disable per-CPU interrupts on the CPU that is
33883387 * brought down.
33893388 */
3390− smp_call_function_single(cpu, mvneta_percpu_disable,
3391− pp, true);
3389+ mvneta_percpu_disable(pp);
33923390
33933391 break;
33943392 case CPU_DEAD:
drivers/net/ethernet/marvell/pxa168_eth.c+2−0
@@ -979,6 +979,8 @@ static int pxa168_init_phy(struct net_device *dev) · 978 unmodified lines
979979 return 0;
980980
981981 pep->phy = mdiobus_scan(pep->smi_bus, pep->phy_addr);
982+ if (IS_ERR(pep->phy))
983+ return PTR_ERR(pep->phy);
982984 if (!pep->phy)
983985 return -ENODEV;
984986
drivers/net/ethernet/mellanox/mlx5/core/Kconfig+1−0
@@ -14,6 +14,7 @@ config MLX5_CORE_EN · 13 unmodified lines
1414 bool "Mellanox Technologies ConnectX-4 Ethernet support"
1515 depends on NETDEVICES && ETHERNET && PCI && MLX5_CORE
1616 select PTP_1588_CLOCK
17+ select VXLAN if MLX5_CORE=y
1718 default n
1819 ---help---
1920 Ethernet support in Mellanox Technologies ConnectX-4 NIC.
drivers/net/ethernet/mellanox/mlx5/core/en.h+1−0
@@ -525,6 +525,7 @@ struct mlx5e_priv { · 524 unmodified lines
525525 struct mlx5e_vxlan_db vxlan;
526526
527527 struct mlx5e_params params;
528+ struct workqueue_struct *wq;
528529 struct work_struct update_carrier_work;
529530 struct work_struct set_rx_mode_work;
530531 struct delayed_work update_stats_work;
drivers/net/ethernet/mellanox/mlx5/core/en_main.c+21−13
@@ -231,9 +231,8 @@ static void mlx5e_update_stats_work(struct work_struct *work) · 230 unmodified lines
231231 mutex_lock(&priv->state_lock);
232232 if (test_bit(MLX5E_STATE_OPENED, &priv->state)) {
233233 mlx5e_update_stats(priv);
234− schedule_delayed_work(dwork,
235− msecs_to_jiffies(
236− MLX5E_UPDATE_STATS_INTERVAL));
234+ queue_delayed_work(priv->wq, dwork,
235+ msecs_to_jiffies(MLX5E_UPDATE_STATS_INTERVAL));
237236 }
238237 mutex_unlock(&priv->state_lock);
239238 }
@@ -249,7 +248,7 @@ static void mlx5e_async_event(struct mlx5_core_dev *mdev, void *vpriv, · 9 unmodified lines
249248 switch (event) {
250249 case MLX5_DEV_EVENT_PORT_UP:
251250 case MLX5_DEV_EVENT_PORT_DOWN:
252− schedule_work(&priv->update_carrier_work);
251+ queue_work(priv->wq, &priv->update_carrier_work);
253252 break;
254253
255254 default:
@@ -1695,7 +1694,7 @@ int mlx5e_open_locked(struct net_device *netdev) · 1439 unmodified lines
16951694 priv->netdev->rx_cpu_rmap = priv->mdev->rmap;
16961695 #endif
16971696
1698− schedule_delayed_work(&priv->update_stats_work, 0);
1697+ queue_delayed_work(priv->wq, &priv->update_stats_work, 0);
16991698
17001699 return 0;
17011700
@@ -2202,7 +2201,7 @@ static void mlx5e_set_rx_mode(struct net_device *dev) · 500 unmodified lines
22022201 {
22032202 struct mlx5e_priv *priv = netdev_priv(dev);
22042203
2205− schedule_work(&priv->set_rx_mode_work);
2204+ queue_work(priv->wq, &priv->set_rx_mode_work);
22062205 }
22072206
22082207 static int mlx5e_set_mac(struct net_device *netdev, void *addr)
@@ -2217,7 +2216,7 @@ static int mlx5e_set_mac(struct net_device *netdev, void *addr) · 8 unmodified lines
22172216 ether_addr_copy(netdev->dev_addr, saddr->sa_data);
22182217 netif_addr_unlock_bh(netdev);
22192218
2220− schedule_work(&priv->set_rx_mode_work);
2219+ queue_work(priv->wq, &priv->set_rx_mode_work);
22212220
22222221 return 0;
22232222 }
@@ -2503,7 +2502,7 @@ static void mlx5e_add_vxlan_port(struct net_device *netdev, · 279 unmodified lines
25032502 if (!mlx5e_vxlan_allowed(priv->mdev))
25042503 return;
25052504
2506− mlx5e_vxlan_add_port(priv, be16_to_cpu(port));
2505+ mlx5e_vxlan_queue_work(priv, sa_family, be16_to_cpu(port), 1);
25072506 }
25082507
25092508 static void mlx5e_del_vxlan_port(struct net_device *netdev,
@@ -2514,7 +2513,7 @@ static void mlx5e_del_vxlan_port(struct net_device *netdev, · 4 unmodified lines
25142513 if (!mlx5e_vxlan_allowed(priv->mdev))
25152514 return;
25162515
2517− mlx5e_vxlan_del_port(priv, be16_to_cpu(port));
2516+ mlx5e_vxlan_queue_work(priv, sa_family, be16_to_cpu(port), 0);
25182517 }
25192518
25202519 static netdev_features_t mlx5e_vxlan_features_check(struct mlx5e_priv *priv,
@@ -2947,10 +2946,14 @@ static void *mlx5e_create_netdev(struct mlx5_core_dev *mdev) · 426 unmodified lines
29472946
29482947 priv = netdev_priv(netdev);
29492948
2949+ priv->wq = create_singlethread_workqueue("mlx5e");
2950+ if (!priv->wq)
2951+ goto err_free_netdev;
2952+
29502953 err = mlx5_alloc_map_uar(mdev, &priv->cq_uar, false);
29512954 if (err) {
29522955 mlx5_core_err(mdev, "alloc_map uar failed, %d\n", err);
2953− goto err_free_netdev;
2956+ goto err_destroy_wq;
29542957 }
29552958
29562959 err = mlx5_core_alloc_pd(mdev, &priv->pdn);
@@ -3034,7 +3037,7 @@ static void *mlx5e_create_netdev(struct mlx5_core_dev *mdev) · 77 unmodified lines
30343037 }
30353038
30363039 mlx5e_enable_async_events(priv);
3037− schedule_work(&priv->set_rx_mode_work);
3040+ queue_work(priv->wq, &priv->set_rx_mode_work);
30383041
30393042 return priv;
30403043
@@ -3072,6 +3075,9 @@ err_dealloc_pd: · 31 unmodified lines
30723075 err_unmap_free_uar:
30733076 mlx5_unmap_free_uar(mdev, &priv->cq_uar);
30743077
3078+err_destroy_wq:
3079+ destroy_workqueue(priv->wq);
3080+
30753081 err_free_netdev:
30763082 free_netdev(netdev);
30773083
@@ -3085,9 +3091,9 @@ static void mlx5e_destroy_netdev(struct mlx5_core_dev *mdev, void *vpriv) · 7 unmodified lines
30853091
30863092 set_bit(MLX5E_STATE_DESTROYING, &priv->state);
30873093
3088− schedule_work(&priv->set_rx_mode_work);
3094+ queue_work(priv->wq, &priv->set_rx_mode_work);
30893095 mlx5e_disable_async_events(priv);
3090− flush_scheduled_work();
3096+ flush_workqueue(priv->wq);
30913097 if (test_bit(MLX5_INTERFACE_STATE_SHUTDOWN, &mdev->intf_state)) {
30923098 netif_device_detach(netdev);
30933099 mutex_lock(&priv->state_lock);
@@ -3111,6 +3117,8 @@ static void mlx5e_destroy_netdev(struct mlx5_core_dev *mdev, void *vpriv) · 17 unmodified lines
31113117 mlx5_core_dealloc_transport_domain(priv->mdev, priv->tdn);
31123118 mlx5_core_dealloc_pd(priv->mdev, priv->pdn);
31133119 mlx5_unmap_free_uar(priv->mdev, &priv->cq_uar);
3120+ cancel_delayed_work_sync(&priv->update_stats_work);
3121+ destroy_workqueue(priv->wq);
31143122
31153123 if (!test_bit(MLX5_INTERFACE_STATE_SHUTDOWN, &mdev->intf_state))
31163124 free_netdev(netdev);
drivers/net/ethernet/mellanox/mlx5/core/uar.c+4−2
@@ -269,8 +269,10 @@ EXPORT_SYMBOL(mlx5_alloc_map_uar); · 268 unmodified lines
269269
270270 void mlx5_unmap_free_uar(struct mlx5_core_dev *mdev, struct mlx5_uar *uar)
271271 {
272− iounmap(uar->map);
273− iounmap(uar->bf_map);
272+ if (uar->map)
273+ iounmap(uar->map);
274+ else
275+ iounmap(uar->bf_map);
274276 mlx5_cmd_free_uar(mdev, uar->index);
275277 }
276278 EXPORT_SYMBOL(mlx5_unmap_free_uar);
drivers/net/ethernet/mellanox/mlx5/core/vxlan.c+38−12
@@ -95,21 +95,22 @@ struct mlx5e_vxlan *mlx5e_vxlan_lookup_port(struct mlx5e_priv *priv, u16 port) · 94 unmodified lines
9595 return vxlan;
9696 }
9797
98−int mlx5e_vxlan_add_port(struct mlx5e_priv *priv, u16 port)
98+static void mlx5e_vxlan_add_port(struct work_struct *work)
9999 {
100+ struct mlx5e_vxlan_work *vxlan_work =
101+ container_of(work, struct mlx5e_vxlan_work, work);
102+ struct mlx5e_priv *priv = vxlan_work->priv;
100103 struct mlx5e_vxlan_db *vxlan_db = &priv->vxlan;
104+ u16 port = vxlan_work->port;
101105 struct mlx5e_vxlan *vxlan;
102106 int err;
103107
104− err = mlx5e_vxlan_core_add_port_cmd(priv->mdev, port);
105− if (err)
106− return err;
108+ if (mlx5e_vxlan_core_add_port_cmd(priv->mdev, port))
109+ goto free_work;
107110
108111 vxlan = kzalloc(sizeof(*vxlan), GFP_KERNEL);
109− if (!vxlan) {
110− err = -ENOMEM;
112+ if (!vxlan)
111113 goto err_delete_port;
112− }
113114
114115 vxlan->udp_port = port;
115116
@@ -119,13 +120,14 @@ int mlx5e_vxlan_add_port(struct mlx5e_priv *priv, u16 port) · 3 unmodified lines
119120 if (err)
120121 goto err_free;
121122
122− return 0;
123+ goto free_work;
123124
124125 err_free:
125126 kfree(vxlan);
126127 err_delete_port:
127128 mlx5e_vxlan_core_del_port_cmd(priv->mdev, port);
128− return err;
129+free_work:
130+ kfree(vxlan_work);
129131 }
130132
131133 static void __mlx5e_vxlan_core_del_port(struct mlx5e_priv *priv, u16 port)
@@ -145,12 +147,36 @@ static void __mlx5e_vxlan_core_del_port(struct mlx5e_priv *priv, u16 port) · 13 unmodified lines
145147 kfree(vxlan);
146148 }
147149
148−void mlx5e_vxlan_del_port(struct mlx5e_priv *priv, u16 port)
150+static void mlx5e_vxlan_del_port(struct work_struct *work)
149151 {
150− if (!mlx5e_vxlan_lookup_port(priv, port))
151− return;
152+ struct mlx5e_vxlan_work *vxlan_work =
153+ container_of(work, struct mlx5e_vxlan_work, work);
154+ struct mlx5e_priv *priv = vxlan_work->priv;
155+ u16 port = vxlan_work->port;
152156
153157 __mlx5e_vxlan_core_del_port(priv, port);
158+
159+ kfree(vxlan_work);
160+}
161+
162+void mlx5e_vxlan_queue_work(struct mlx5e_priv *priv, sa_family_t sa_family,
163+ u16 port, int add)
164+{
165+ struct mlx5e_vxlan_work *vxlan_work;
166+
167+ vxlan_work = kmalloc(sizeof(*vxlan_work), GFP_ATOMIC);
168+ if (!vxlan_work)
169+ return;
170+
171+ if (add)
172+ INIT_WORK(&vxlan_work->work, mlx5e_vxlan_add_port);
173+ else
174+ INIT_WORK(&vxlan_work->work, mlx5e_vxlan_del_port);
175+
176+ vxlan_work->priv = priv;
177+ vxlan_work->port = port;
178+ vxlan_work->sa_family = sa_family;
179+ queue_work(priv->wq, &vxlan_work->work);
154180 }
155181
156182 void mlx5e_vxlan_cleanup(struct mlx5e_priv *priv)
drivers/net/ethernet/mellanox/mlx5/core/vxlan.h+9−2
@@ -39,6 +39,13 @@ struct mlx5e_vxlan { · 38 unmodified lines
3939 u16 udp_port;
4040 };
4141
42+struct mlx5e_vxlan_work {
43+ struct work_struct work;
44+ struct mlx5e_priv *priv;
45+ sa_family_t sa_family;
46+ u16 port;
47+};
48+
4249 static inline bool mlx5e_vxlan_allowed(struct mlx5_core_dev *mdev)
4350 {
4451 return (MLX5_CAP_ETH(mdev, tunnel_stateless_vxlan) &&
@@ -46,8 +53,8 @@ static inline bool mlx5e_vxlan_allowed(struct mlx5_core_dev *mdev) · 1 unmodified line
4653 }
4754
4855 void mlx5e_vxlan_init(struct mlx5e_priv *priv);
49−int mlx5e_vxlan_add_port(struct mlx5e_priv *priv, u16 port);
50−void mlx5e_vxlan_del_port(struct mlx5e_priv *priv, u16 port);
56+void mlx5e_vxlan_queue_work(struct mlx5e_priv *priv, sa_family_t sa_family,
57+ u16 port, int add);
5158 struct mlx5e_vxlan *mlx5e_vxlan_lookup_port(struct mlx5e_priv *priv, u16 port);
5259 void mlx5e_vxlan_cleanup(struct mlx5e_priv *priv);
5360
drivers/net/ethernet/myricom/myri10ge/myri10ge.c+2−2
@@ -2668,9 +2668,9 @@ static int myri10ge_close(struct net_device *dev) · 2667 unmodified lines
26682668
26692669 del_timer_sync(&mgp->watchdog_timer);
26702670 mgp->running = MYRI10GE_ETH_STOPPING;
2671− local_bh_disable(); /* myri10ge_ss_lock_napi needs bh disabled */
26722671 for (i = 0; i < mgp->num_slices; i++) {
26732672 napi_disable(&mgp->ss[i].napi);
2673+ local_bh_disable(); /* myri10ge_ss_lock_napi needs this */
26742674 /* Lock the slice to prevent the busy_poll handler from
26752675 * accessing it. Later when we bring the NIC up, myri10ge_open
26762676 * resets the slice including this lock.
@@ -2679,8 +2679,8 @@ static int myri10ge_close(struct net_device *dev) · 2 unmodified lines
26792679 pr_info("Slice %d locked\n", i);
26802680 mdelay(1);
26812681 }
2682+ local_bh_enable();
26822683 }
2683− local_bh_enable();
26842684 netif_carrier_off(dev);
26852685
26862686 netif_tx_stop_all_queues(dev);
drivers/net/ethernet/sfc/ef10.c+13−2
@@ -1920,6 +1920,10 @@ static int efx_ef10_alloc_rss_context(struct efx_nic *efx, u32 *context, · 1919 unmodified lines
19201920 return 0;
19211921 }
19221922
1923+ if (nic_data->datapath_caps &
1924+ 1 << MC_CMD_GET_CAPABILITIES_OUT_RX_RSS_LIMITED_LBN)
1925+ return -EOPNOTSUPP;
1926+
19231927 MCDI_SET_DWORD(inbuf, RSS_CONTEXT_ALLOC_IN_UPSTREAM_PORT_ID,
19241928 nic_data->vport_id);
19251929 MCDI_SET_DWORD(inbuf, RSS_CONTEXT_ALLOC_IN_TYPE, alloc_type);
@@ -2923,9 +2927,16 @@ static void efx_ef10_filter_push_prep(struct efx_nic *efx, · 997 unmodified lines
29232927 bool replacing)
29242928 {
29252929 struct efx_ef10_nic_data *nic_data = efx->nic_data;
2930+ u32 flags = spec->flags;
29262931
29272932 memset(inbuf, 0, MC_CMD_FILTER_OP_IN_LEN);
29282933
2934+ /* Remove RSS flag if we don't have an RSS context. */
2935+ if (flags & EFX_FILTER_FLAG_RX_RSS &&
2936+ spec->rss_context == EFX_FILTER_RSS_CONTEXT_DEFAULT &&
2937+ nic_data->rx_rss_context == EFX_EF10_RSS_CONTEXT_INVALID)
2938+ flags &= ~EFX_FILTER_FLAG_RX_RSS;
2939+
29292940 if (replacing) {
29302941 MCDI_SET_DWORD(inbuf, FILTER_OP_IN_OP,
29312942 MC_CMD_FILTER_OP_IN_OP_REPLACE);
@@ -2985,10 +2996,10 @@ static void efx_ef10_filter_push_prep(struct efx_nic *efx, · 53 unmodified lines
29852996 spec->dmaq_id == EFX_FILTER_RX_DMAQ_ID_DROP ?
29862997 0 : spec->dmaq_id);
29872998 MCDI_SET_DWORD(inbuf, FILTER_OP_IN_RX_MODE,
2988− (spec->flags & EFX_FILTER_FLAG_RX_RSS) ?
2999+ (flags & EFX_FILTER_FLAG_RX_RSS) ?
29893000 MC_CMD_FILTER_OP_IN_RX_MODE_RSS :
29903001 MC_CMD_FILTER_OP_IN_RX_MODE_SIMPLE);
2991− if (spec->flags & EFX_FILTER_FLAG_RX_RSS)
3002+ if (flags & EFX_FILTER_FLAG_RX_RSS)
29923003 MCDI_SET_DWORD(inbuf, FILTER_OP_IN_RX_CONTEXT,
29933004 spec->rss_context !=
29943005 EFX_FILTER_RSS_CONTEXT_DEFAULT ?
drivers/net/ethernet/ti/cpsw.c+36−31
@@ -367,7 +367,6 @@ struct cpsw_priv { · 366 unmodified lines
367367 spinlock_t lock;
368368 struct platform_device *pdev;
369369 struct net_device *ndev;
370− struct device_node *phy_node;
371370 struct napi_struct napi_rx;
372371 struct napi_struct napi_tx;
373372 struct device *dev;
@@ -1142,25 +1141,34 @@ static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv) · 768 unmodified lines
11421141 cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast,
11431142 1 << slave_port, 0, 0, ALE_MCAST_FWD_2);
11441143
1145− if (priv->phy_node)
1146− slave->phy = of_phy_connect(priv->ndev, priv->phy_node,
1144+ if (slave->data->phy_node) {
1145+ slave->phy = of_phy_connect(priv->ndev, slave->data->phy_node,
11471146 &cpsw_adjust_link, 0, slave->data->phy_if);
1148− else
1147+ if (!slave->phy) {
1148+ dev_err(priv->dev, "phy \"%s\" not found on slave %d\n",
1149+ slave->data->phy_node->full_name,
1150+ slave->slave_num);
1151+ return;
1152+ }
1153+ } else {
11491154 slave->phy = phy_connect(priv->ndev, slave->data->phy_id,
11501155 &cpsw_adjust_link, slave->data->phy_if);
1151− if (IS_ERR(slave->phy)) {
1152− dev_err(priv->dev, "phy %s not found on slave %d\n",
1153− slave->data->phy_id, slave->slave_num);
1154− slave->phy = NULL;
1155− } else {
1156− phy_attached_info(slave->phy);
1156+ if (IS_ERR(slave->phy)) {
1157+ dev_err(priv->dev,
1158+ "phy \"%s\" not found on slave %d, err %ld\n",
1159+ slave->data->phy_id, slave->slave_num,
1160+ PTR_ERR(slave->phy));
1161+ slave->phy = NULL;
1162+ return;
1163+ }
1164+ }
11571165
1158− phy_start(slave->phy);
1166+ phy_attached_info(slave->phy);
11591167
1160− /* Configure GMII_SEL register */
1161− cpsw_phy_sel(&priv->pdev->dev, slave->phy->interface,
1162− slave->slave_num);
1163− }
1168+ phy_start(slave->phy);
1169+
1170+ /* Configure GMII_SEL register */
1171+ cpsw_phy_sel(&priv->pdev->dev, slave->phy->interface, slave->slave_num);
11641172 }
11651173
11661174 static inline void cpsw_add_default_vlan(struct cpsw_priv *priv)
@@ -1932,12 +1940,11 @@ static void cpsw_slave_init(struct cpsw_slave *slave, struct cpsw_priv *priv, · 765 unmodified lines
19321940 slave->port_vlan = data->dual_emac_res_vlan;
19331941 }
19341942
1935−static int cpsw_probe_dt(struct cpsw_priv *priv,
1943+static int cpsw_probe_dt(struct cpsw_platform_data *data,
19361944 struct platform_device *pdev)
19371945 {
19381946 struct device_node *node = pdev->dev.of_node;
19391947 struct device_node *slave_node;
1940− struct cpsw_platform_data *data = &priv->data;
19411948 int i = 0, ret;
19421949 u32 prop;
19431950
@@ -2025,25 +2032,21 @@ static int cpsw_probe_dt(struct cpsw_priv *priv, · 81 unmodified lines
20252032 if (strcmp(slave_node->name, "slave"))
20262033 continue;
20272034
2028− priv->phy_node = of_parse_phandle(slave_node, "phy-handle", 0);
2035+ slave_data->phy_node = of_parse_phandle(slave_node,
2036+ "phy-handle", 0);
20292037 parp = of_get_property(slave_node, "phy_id", &lenp);
2030− if (of_phy_is_fixed_link(slave_node)) {
2031− struct device_node *phy_node;
2032− struct phy_device *phy_dev;
2033−
2038+ if (slave_data->phy_node) {
2039+ dev_dbg(&pdev->dev,
2040+ "slave[%d] using phy-handle=\"%s\"\n",
2041+ i, slave_data->phy_node->full_name);
2042+ } else if (of_phy_is_fixed_link(slave_node)) {
20342043 /* In the case of a fixed PHY, the DT node associated
20352044 * to the PHY is the Ethernet MAC DT node.
20362045 */
20372046 ret = of_phy_register_fixed_link(slave_node);
20382047 if (ret)
20392048 return ret;
2040− phy_node = of_node_get(slave_node);
2041− phy_dev = of_phy_find_device(phy_node);
2042− if (!phy_dev)
2043− return -ENODEV;
2044− snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
2045− PHY_ID_FMT, phy_dev->mdio.bus->id,
2046− phy_dev->mdio.addr);
2049+ slave_data->phy_node = of_node_get(slave_node);
20472050 } else if (parp) {
20482051 u32 phyid;
20492052 struct device_node *mdio_node;
@@ -2064,7 +2067,9 @@ static int cpsw_probe_dt(struct cpsw_priv *priv, · 14 unmodified lines
20642067 snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
20652068 PHY_ID_FMT, mdio->name, phyid);
20662069 } else {
2067− dev_err(&pdev->dev, "No slave[%d] phy_id or fixed-link property\n", i);
2070+ dev_err(&pdev->dev,
2071+ "No slave[%d] phy_id, phy-handle, or fixed-link property\n",
2072+ i);
20682073 goto no_phy_slave;
20692074 }
20702075 slave_data->phy_if = of_get_phy_mode(slave_node);
@@ -2266,7 +2271,7 @@ static int cpsw_probe(struct platform_device *pdev) · 195 unmodified lines
22662271 /* Select default pin state */
22672272 pinctrl_pm_select_default_state(&pdev->dev);
22682273
2269− if (cpsw_probe_dt(priv, pdev)) {
2274+ if (cpsw_probe_dt(&priv->data, pdev)) {
22702275 dev_err(&pdev->dev, "cpsw: platform data missing\n");
22712276 ret = -ENODEV;
22722277 goto clean_runtime_disable_ret;
drivers/net/ethernet/ti/cpsw.h+1−0
@@ -18,6 +18,7 @@ · 17 unmodified lines
1818 #include <linux/phy.h>
1919
2020 struct cpsw_slave_data {
21+ struct device_node *phy_node;
2122 char phy_id[MII_BUS_ID_SIZE];
2223 int phy_if;
2324 u8 mac_addr[ETH_ALEN];
drivers/net/ethernet/ti/davinci_emac.c+4−1
@@ -1512,7 +1512,10 @@ static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd) · 1511 unmodified lines
15121512
15131513 /* TODO: Add phy read and write and private statistics get feature */
15141514
1515− return phy_mii_ioctl(priv->phydev, ifrq, cmd);
1515+ if (priv->phydev)
1516+ return phy_mii_ioctl(priv->phydev, ifrq, cmd);
1517+ else
1518+ return -EOPNOTSUPP;
15161519 }
15171520
15181521 static int match_first_device(struct device *dev, void *data)
drivers/net/ethernet/toshiba/ps3_gelic_wireless.c+1−1
@@ -1622,7 +1622,7 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl) · 1621 unmodified lines
16221622 continue;
16231623
16241624 /* copy hw scan info */
1625− memcpy(target->hwinfo, scan_info, scan_info->size);
1625+ memcpy(target->hwinfo, scan_info, be16_to_cpu(scan_info->size));
16261626 target->essid_len = strnlen(scan_info->essid,
16271627 sizeof(scan_info->essid));
16281628 target->rate_len = 0;
drivers/net/phy/at803x.c+18−22
@@ -359,27 +359,25 @@ static void at803x_link_change_notify(struct phy_device *phydev) · 358 unmodified lines
359359 * in the FIFO. In such cases, the FIFO enters an error mode it
360360 * cannot recover from by software.
361361 */
362− if (phydev->drv->phy_id == ATH8030_PHY_ID) {
363− if (phydev->state == PHY_NOLINK) {
364− if (priv->gpiod_reset && !priv->phy_reset) {
365− struct at803x_context context;
366−
367− at803x_context_save(phydev, &context);
368−
369− gpiod_set_value(priv->gpiod_reset, 1);
370− msleep(1);
371− gpiod_set_value(priv->gpiod_reset, 0);
372− msleep(1);
373−
374− at803x_context_restore(phydev, &context);
375−
376− phydev_dbg(phydev, "%s(): phy was reset\n",
377− __func__);
378− priv->phy_reset = true;
379− }
380− } else {
381− priv->phy_reset = false;
362+ if (phydev->state == PHY_NOLINK) {
363+ if (priv->gpiod_reset && !priv->phy_reset) {
364+ struct at803x_context context;
365+
366+ at803x_context_save(phydev, &context);
367+
368+ gpiod_set_value(priv->gpiod_reset, 1);
369+ msleep(1);
370+ gpiod_set_value(priv->gpiod_reset, 0);
371+ msleep(1);
372+
373+ at803x_context_restore(phydev, &context);
374+
375+ phydev_dbg(phydev, "%s(): phy was reset\n",
376+ __func__);
377+ priv->phy_reset = true;
382378 }
379+ } else {
380+ priv->phy_reset = false;
383381 }
384382 }
385383
@@ -391,7 +389,6 @@ static struct phy_driver at803x_driver[] = { · 5 unmodified lines
391389 .phy_id_mask = 0xffffffef,
392390 .probe = at803x_probe,
393391 .config_init = at803x_config_init,
394− .link_change_notify = at803x_link_change_notify,
395392 .set_wol = at803x_set_wol,
396393 .get_wol = at803x_get_wol,
397394 .suspend = at803x_suspend,
@@ -427,7 +424,6 @@ static struct phy_driver at803x_driver[] = { · 29 unmodified lines
427424 .phy_id_mask = 0xffffffef,
428425 .probe = at803x_probe,
429426 .config_init = at803x_config_init,
430− .link_change_notify = at803x_link_change_notify,
431427 .set_wol = at803x_set_wol,
432428 .get_wol = at803x_get_wol,
433429 .suspend = at803x_suspend,
drivers/net/usb/lan78xx.c+38−6
@@ -269,6 +269,7 @@ struct skb_data { /* skb->cb is one of these */ · 268 unmodified lines
269269 struct lan78xx_net *dev;
270270 enum skb_state state;
271271 size_t length;
272+ int num_of_packet;
272273 };
273274
274275 struct usb_context {
@@ -1803,7 +1804,34 @@ static void lan78xx_remove_mdio(struct lan78xx_net *dev) · 1528 unmodified lines
18031804
18041805 static void lan78xx_link_status_change(struct net_device *net)
18051806 {
1806− /* nothing to do */
1807+ struct phy_device *phydev = net->phydev;
1808+ int ret, temp;
1809+
1810+ /* At forced 100 F/H mode, chip may fail to set mode correctly
1811+ * when cable is switched between long(~50+m) and short one.
1812+ * As workaround, set to 10 before setting to 100
1813+ * at forced 100 F/H mode.
1814+ */
1815+ if (!phydev->autoneg && (phydev->speed == 100)) {
1816+ /* disable phy interrupt */
1817+ temp = phy_read(phydev, LAN88XX_INT_MASK);
1818+ temp &= ~LAN88XX_INT_MASK_MDINTPIN_EN_;
1819+ ret = phy_write(phydev, LAN88XX_INT_MASK, temp);
1820+
1821+ temp = phy_read(phydev, MII_BMCR);
1822+ temp &= ~(BMCR_SPEED100 | BMCR_SPEED1000);
1823+ phy_write(phydev, MII_BMCR, temp); /* set to 10 first */
1824+ temp |= BMCR_SPEED100;
1825+ phy_write(phydev, MII_BMCR, temp); /* set to 100 later */
1826+
1827+ /* clear pending interrupt generated while workaround */
1828+ temp = phy_read(phydev, LAN88XX_INT_STS);
1829+
1830+ /* enable phy interrupt back */
1831+ temp = phy_read(phydev, LAN88XX_INT_MASK);
1832+ temp |= LAN88XX_INT_MASK_MDINTPIN_EN_;
1833+ ret = phy_write(phydev, LAN88XX_INT_MASK, temp);
1834+ }
18071835 }
18081836
18091837 static int lan78xx_phy_init(struct lan78xx_net *dev)
@@ -2464,7 +2492,7 @@ static void tx_complete(struct urb *urb) · 654 unmodified lines
24642492 struct lan78xx_net *dev = entry->dev;
24652493
24662494 if (urb->status == 0) {
2467− dev->net->stats.tx_packets++;
2495+ dev->net->stats.tx_packets += entry->num_of_packet;
24682496 dev->net->stats.tx_bytes += entry->length;
24692497 } else {
24702498 dev->net->stats.tx_errors++;
@@ -2681,10 +2709,11 @@ void lan78xx_skb_return(struct lan78xx_net *dev, struct sk_buff *skb) · 210 unmodified lines
26812709 return;
26822710 }
26832711
2684− skb->protocol = eth_type_trans(skb, dev->net);
26852712 dev->net->stats.rx_packets++;
26862713 dev->net->stats.rx_bytes += skb->len;
26872714
2715+ skb->protocol = eth_type_trans(skb, dev->net);
2716+
26882717 netif_dbg(dev, rx_status, dev->net, "< rx, len %zu, type 0x%x\n",
26892718 skb->len + sizeof(struct ethhdr), skb->protocol);
26902719 memset(skb->cb, 0, sizeof(struct skb_data));
@@ -2934,13 +2963,16 @@ static void lan78xx_tx_bh(struct lan78xx_net *dev) · 243 unmodified lines
29342963
29352964 skb_totallen = 0;
29362965 pkt_cnt = 0;
2966+ count = 0;
2967+ length = 0;
29372968 for (skb = tqp->next; pkt_cnt < tqp->qlen; skb = skb->next) {
29382969 if (skb_is_gso(skb)) {
29392970 if (pkt_cnt) {
29402971 /* handle previous packets first */
29412972 break;
29422973 }
2943− length = skb->len;
2974+ count = 1;
2975+ length = skb->len - TX_OVERHEAD;
29442976 skb2 = skb_dequeue(tqp);
29452977 goto gso_skb;
29462978 }
@@ -2961,14 +2993,13 @@ static void lan78xx_tx_bh(struct lan78xx_net *dev) · 14 unmodified lines
29612993 for (count = pos = 0; count < pkt_cnt; count++) {
29622994 skb2 = skb_dequeue(tqp);
29632995 if (skb2) {
2996+ length += (skb2->len - TX_OVERHEAD);
29642997 memcpy(skb->data + pos, skb2->data, skb2->len);
29652998 pos += roundup(skb2->len, sizeof(u32));
29662999 dev_kfree_skb(skb2);
29673000 }
29683001 }
29693002
2970− length = skb_totallen;
2971−
29723003 gso_skb:
29733004 urb = usb_alloc_urb(0, GFP_ATOMIC);
29743005 if (!urb) {
@@ -2980,6 +3011,7 @@ gso_skb: · 5 unmodified lines
29803011 entry->urb = urb;
29813012 entry->dev = dev;
29823013 entry->length = length;
3014+ entry->num_of_packet = count;
29833015
29843016 spin_lock_irqsave(&dev->txq.lock, flags);
29853017 ret = usb_autopm_get_interface_async(dev->intf);
drivers/net/usb/pegasus.c+5−5
@@ -411,7 +411,7 @@ static int enable_net_traffic(struct net_device *dev, struct usb_device *usb) · 410 unmodified lines
411411 int ret;
412412
413413 read_mii_word(pegasus, pegasus->phy, MII_LPA, &linkpart);
414− data[0] = 0xc9;
414+ data[0] = 0xc8; /* TX & RX enable, append status, no CRC */
415415 data[1] = 0;
416416 if (linkpart & (ADVERTISE_100FULL | ADVERTISE_10FULL))
417417 data[1] |= 0x20; /* set full duplex */
@@ -497,7 +497,7 @@ static void read_bulk_callback(struct urb *urb) · 79 unmodified lines
497497 pkt_len = buf[count - 3] << 8;
498498 pkt_len += buf[count - 4];
499499 pkt_len &= 0xfff;
500− pkt_len -= 8;
500+ pkt_len -= 4;
501501 }
502502
503503 /*
@@ -528,7 +528,7 @@ static void read_bulk_callback(struct urb *urb) · 24 unmodified lines
528528 goon:
529529 usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb,
530530 usb_rcvbulkpipe(pegasus->usb, 1),
531− pegasus->rx_skb->data, PEGASUS_MTU + 8,
531+ pegasus->rx_skb->data, PEGASUS_MTU,
532532 read_bulk_callback, pegasus);
533533 rx_status = usb_submit_urb(pegasus->rx_urb, GFP_ATOMIC);
534534 if (rx_status == -ENODEV)
@@ -569,7 +569,7 @@ static void rx_fixup(unsigned long data) · 34 unmodified lines
569569 }
570570 usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb,
571571 usb_rcvbulkpipe(pegasus->usb, 1),
572− pegasus->rx_skb->data, PEGASUS_MTU + 8,
572+ pegasus->rx_skb->data, PEGASUS_MTU,
573573 read_bulk_callback, pegasus);
574574 try_again:
575575 status = usb_submit_urb(pegasus->rx_urb, GFP_ATOMIC);
@@ -823,7 +823,7 @@ static int pegasus_open(struct net_device *net) · 247 unmodified lines
823823
824824 usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb,
825825 usb_rcvbulkpipe(pegasus->usb, 1),
826− pegasus->rx_skb->data, PEGASUS_MTU + 8,
826+ pegasus->rx_skb->data, PEGASUS_MTU,
827827 read_bulk_callback, pegasus);
828828 if ((res = usb_submit_urb(pegasus->rx_urb, GFP_KERNEL))) {
829829 if (res == -ENODEV)
drivers/net/usb/smsc75xx.c+11−1
@@ -29,6 +29,7 @@ · 28 unmodified lines
2929 #include <linux/crc32.h>
3030 #include <linux/usb/usbnet.h>
3131 #include <linux/slab.h>
32+#include <linux/of_net.h>
3233 #include "smsc75xx.h"
3334
3435 #define SMSC_CHIPNAME "smsc75xx"
@@ -761,6 +762,15 @@ static int smsc75xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd) · 726 unmodified lines
761762
762763 static void smsc75xx_init_mac_address(struct usbnet *dev)
763764 {
765+ const u8 *mac_addr;
766+
767+ /* maybe the boot loader passed the MAC address in devicetree */
768+ mac_addr = of_get_mac_address(dev->udev->dev.of_node);
769+ if (mac_addr) {
770+ memcpy(dev->net->dev_addr, mac_addr, ETH_ALEN);
771+ return;
772+ }
773+
764774 /* try reading mac address from EEPROM */
765775 if (smsc75xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
766776 dev->net->dev_addr) == 0) {
@@ -772,7 +782,7 @@ static void smsc75xx_init_mac_address(struct usbnet *dev) · 5 unmodified lines
772782 }
773783 }
774784
775− /* no eeprom, or eeprom values are invalid. generate random MAC */
785+ /* no useful static MAC address found. generate a random one */
776786 eth_hw_addr_random(dev->net);
777787 netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n");
778788 }
drivers/net/usb/smsc95xx.c+11−1
@@ -29,6 +29,7 @@ · 28 unmodified lines
2929 #include <linux/crc32.h>
3030 #include <linux/usb/usbnet.h>
3131 #include <linux/slab.h>
32+#include <linux/of_net.h>
3233 #include "smsc95xx.h"
3334
3435 #define SMSC_CHIPNAME "smsc95xx"
@@ -765,6 +766,15 @@ static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd) · 730 unmodified lines
765766
766767 static void smsc95xx_init_mac_address(struct usbnet *dev)
767768 {
769+ const u8 *mac_addr;
770+
771+ /* maybe the boot loader passed the MAC address in devicetree */
772+ mac_addr = of_get_mac_address(dev->udev->dev.of_node);
773+ if (mac_addr) {
774+ memcpy(dev->net->dev_addr, mac_addr, ETH_ALEN);
775+ return;
776+ }
777+
768778 /* try reading mac address from EEPROM */
769779 if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
770780 dev->net->dev_addr) == 0) {
@@ -775,7 +785,7 @@ static void smsc95xx_init_mac_address(struct usbnet *dev) · 4 unmodified lines
775785 }
776786 }
777787
778− /* no eeprom, or eeprom values are invalid. generate random MAC */
788+ /* no useful static MAC address found. generate a random one */
779789 eth_hw_addr_random(dev->net);
780790 netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n");
781791 }
drivers/net/wireless/ath/ath9k/ar5008_phy.c+3−5
@@ -274,6 +274,9 @@ void ar5008_hw_cmn_spur_mitigate(struct ath_hw *ah, · 273 unmodified lines
274274 };
275275 static const int inc[4] = { 0, 100, 0, 0 };
276276
277+ memset(&mask_m, 0, sizeof(int8_t) * 123);
278+ memset(&mask_p, 0, sizeof(int8_t) * 123);
279+
277280 cur_bin = -6000;
278281 upper = bin + 100;
279282 lower = bin - 100;
@@ -424,14 +427,9 @@ static void ar5008_hw_spur_mitigate(struct ath_hw *ah, · 144 unmodified lines
424427 int tmp, new;
425428 int i;
426429
427− int8_t mask_m[123];
428− int8_t mask_p[123];
429430 int cur_bb_spur;
430431 bool is2GHz = IS_CHAN_2GHZ(chan);
431432
432− memset(&mask_m, 0, sizeof(int8_t) * 123);
433− memset(&mask_p, 0, sizeof(int8_t) * 123);
434−
435433 for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
436434 cur_bb_spur = ah->eep_ops->get_spur_channel(ah, i, is2GHz);
437435 if (AR_NO_SPUR == cur_bb_spur)
drivers/net/wireless/ath/ath9k/ar9002_phy.c+0−5
@@ -178,14 +178,9 @@ static void ar9002_hw_spur_mitigate(struct ath_hw *ah, · 177 unmodified lines
178178 int i;
179179 struct chan_centers centers;
180180
181− int8_t mask_m[123];
182− int8_t mask_p[123];
183181 int cur_bb_spur;
184182 bool is2GHz = IS_CHAN_2GHZ(chan);
185183
186− memset(&mask_m, 0, sizeof(int8_t) * 123);
187− memset(&mask_p, 0, sizeof(int8_t) * 123);
188−
189184 ath9k_hw_get_channel_centers(ah, chan, &centers);
190185 freq = centers.synth_center;
191186
drivers/net/wireless/intel/iwlwifi/iwl-8000.c+1−1
@@ -89,7 +89,7 @@ · 88 unmodified lines
8989 #define IWL8260_SMEM_OFFSET 0x400000
9090 #define IWL8260_SMEM_LEN 0x68000
9191
92−#define IWL8000_FW_PRE "iwlwifi-8000"
92+#define IWL8000_FW_PRE "iwlwifi-8000C-"
9393 #define IWL8000_MODULE_FIRMWARE(api) \
9494 IWL8000_FW_PRE "-" __stringify(api) ".ucode"
9595
drivers/net/wireless/intel/iwlwifi/iwl-drv.c+0−13
@@ -240,19 +240,6 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool first) · 239 unmodified lines
240240 snprintf(drv->firmware_name, sizeof(drv->firmware_name), "%s%s.ucode",
241241 name_pre, tag);
242242
243− /*
244− * Starting 8000B - FW name format has changed. This overwrites the
245− * previous name and uses the new format.
246− */
247− if (drv->trans->cfg->device_family == IWL_DEVICE_FAMILY_8000) {
248− char rev_step = 'A' + CSR_HW_REV_STEP(drv->trans->hw_rev);
249−
250− if (rev_step != 'A')
251− snprintf(drv->firmware_name,
252− sizeof(drv->firmware_name), "%s%c-%s.ucode",
253− name_pre, rev_step, tag);
254− }
255−
256243 IWL_DEBUG_INFO(drv, "attempting to load firmware %s'%s'\n",
257244 (drv->fw_index == UCODE_EXPERIMENTAL_INDEX)
258245 ? "EXPERIMENTAL " : "",
drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c+4−2
@@ -609,7 +609,8 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm) · 608 unmodified lines
609609 }
610610
611611 /* Make room for fw's virtual image pages, if it exists */
612− if (mvm->fw->img[mvm->cur_ucode].paging_mem_size)
612+ if (mvm->fw->img[mvm->cur_ucode].paging_mem_size &&
613+ mvm->fw_paging_db[0].fw_paging_block)
613614 file_len += mvm->num_of_paging_blk *
614615 (sizeof(*dump_data) +
615616 sizeof(struct iwl_fw_error_dump_paging) +
@@ -750,7 +751,8 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm) · 134 unmodified lines
750751 }
751752
752753 /* Dump fw's virtual image */
753− if (mvm->fw->img[mvm->cur_ucode].paging_mem_size) {
754+ if (mvm->fw->img[mvm->cur_ucode].paging_mem_size &&
755+ mvm->fw_paging_db[0].fw_paging_block) {
754756 for (i = 1; i < mvm->num_of_paging_blk + 1; i++) {
755757 struct iwl_fw_error_dump_paging *paging;
756758 struct page *pages =
drivers/net/wireless/intel/iwlwifi/mvm/fw.c+2−0
@@ -149,9 +149,11 @@ void iwl_free_fw_paging(struct iwl_mvm *mvm) · 148 unmodified lines
149149
150150 __free_pages(mvm->fw_paging_db[i].fw_paging_block,
151151 get_order(mvm->fw_paging_db[i].fw_paging_size));
152+ mvm->fw_paging_db[i].fw_paging_block = NULL;
152153 }
153154 kfree(mvm->trans->paging_download_buf);
154155 mvm->trans->paging_download_buf = NULL;
156+ mvm->trans->paging_db = NULL;
155157
156158 memset(mvm->fw_paging_db, 0, sizeof(mvm->fw_paging_db));
157159 }
drivers/net/wireless/intel/iwlwifi/pcie/drv.c+10−0
@@ -479,8 +479,18 @@ static const struct pci_device_id iwl_hw_card_ids[] = { · 478 unmodified lines
479479 {IWL_PCI_DEVICE(0x24F3, 0x0930, iwl8260_2ac_cfg)},
480480 {IWL_PCI_DEVICE(0x24F3, 0x0000, iwl8265_2ac_cfg)},
481481 {IWL_PCI_DEVICE(0x24FD, 0x0010, iwl8265_2ac_cfg)},
482+ {IWL_PCI_DEVICE(0x24FD, 0x0110, iwl8265_2ac_cfg)},
483+ {IWL_PCI_DEVICE(0x24FD, 0x1110, iwl8265_2ac_cfg)},
484+ {IWL_PCI_DEVICE(0x24FD, 0x1010, iwl8265_2ac_cfg)},
485+ {IWL_PCI_DEVICE(0x24FD, 0x0050, iwl8265_2ac_cfg)},
486+ {IWL_PCI_DEVICE(0x24FD, 0x0150, iwl8265_2ac_cfg)},
487+ {IWL_PCI_DEVICE(0x24FD, 0x9010, iwl8265_2ac_cfg)},
488+ {IWL_PCI_DEVICE(0x24FD, 0x8110, iwl8265_2ac_cfg)},
489+ {IWL_PCI_DEVICE(0x24FD, 0x8050, iwl8265_2ac_cfg)},
482490 {IWL_PCI_DEVICE(0x24FD, 0x8010, iwl8265_2ac_cfg)},
483491 {IWL_PCI_DEVICE(0x24FD, 0x0810, iwl8265_2ac_cfg)},
492+ {IWL_PCI_DEVICE(0x24FD, 0x9110, iwl8265_2ac_cfg)},
493+ {IWL_PCI_DEVICE(0x24FD, 0x8130, iwl8265_2ac_cfg)},
484494
485495 /* 9000 Series */
486496 {IWL_PCI_DEVICE(0x9DF0, 0x0A10, iwl9560_2ac_cfg)},
drivers/platform/x86/toshiba_acpi.c+1−1
@@ -135,7 +135,7 @@ MODULE_LICENSE("GPL"); · 134 unmodified lines
135135 /* Field definitions */
136136 #define HCI_ACCEL_MASK 0x7fff
137137 #define HCI_HOTKEY_DISABLE 0x0b
138−#define HCI_HOTKEY_ENABLE 0x01
138+#define HCI_HOTKEY_ENABLE 0x09
139139 #define HCI_HOTKEY_SPECIAL_FUNCTIONS 0x10
140140 #define HCI_LCD_BRIGHTNESS_BITS 3
141141 #define HCI_LCD_BRIGHTNESS_SHIFT (16-HCI_LCD_BRIGHTNESS_BITS)
drivers/rapidio/devices/rio_mport_cdev.c+2−2
@@ -2669,9 +2669,9 @@ static int __init mport_init(void) · 2668 unmodified lines
26692669
26702670 /* Create device class needed by udev */
26712671 dev_class = class_create(THIS_MODULE, DRV_NAME);
2672− if (!dev_class) {
2672+ if (IS_ERR(dev_class)) {
26732673 rmcd_error("Unable to create " DRV_NAME " class");
2674− return -EINVAL;
2674+ return PTR_ERR(dev_class);
26752675 }
26762676
26772677 ret = alloc_chrdev_region(&dev_number, 0, RIO_MAX_MPORTS, DRV_NAME);
drivers/s390/char/sclp_ctl.c+7−5
@@ -56,6 +56,7 @@ static int sclp_ctl_ioctl_sccb(void __user *user_area) · 55 unmodified lines
5656 {
5757 struct sclp_ctl_sccb ctl_sccb;
5858 struct sccb_header *sccb;
59+ unsigned long copied;
5960 int rc;
6061
6162 if (copy_from_user(&ctl_sccb, user_area, sizeof(ctl_sccb)))
@@ -65,14 +66,15 @@ static int sclp_ctl_ioctl_sccb(void __user *user_area) · 3 unmodified lines
6566 sccb = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
6667 if (!sccb)
6768 return -ENOMEM;
68− if (copy_from_user(sccb, u64_to_uptr(ctl_sccb.sccb), sizeof(*sccb))) {
69+ copied = PAGE_SIZE -
70+ copy_from_user(sccb, u64_to_uptr(ctl_sccb.sccb), PAGE_SIZE);
71+ if (offsetof(struct sccb_header, length) +
72+ sizeof(sccb->length) > copied || sccb->length > copied) {
6973 rc = -EFAULT;
7074 goto out_free;
7175 }
72− if (sccb->length > PAGE_SIZE || sccb->length < 8)
73− return -EINVAL;
74− if (copy_from_user(sccb, u64_to_uptr(ctl_sccb.sccb), sccb->length)) {
75− rc = -EFAULT;
76+ if (sccb->length < 8) {
77+ rc = -EINVAL;
7678 goto out_free;
7779 }
7880 rc = sclp_sync_request(ctl_sccb.cmdw, sccb);
drivers/staging/media/davinci_vpfe/vpfe_video.c+34−20
@@ -172,9 +172,11 @@ static int vpfe_prepare_pipeline(struct vpfe_video_device *video) · 171 unmodified lines
172172 static int vpfe_update_pipe_state(struct vpfe_video_device *video)
173173 {
174174 struct vpfe_pipeline *pipe = &video->pipe;
175+ int ret;
175176
176− if (vpfe_prepare_pipeline(video))
177− return vpfe_prepare_pipeline(video);
177+ ret = vpfe_prepare_pipeline(video);
178+ if (ret)
179+ return ret;
178180
179181 /*
180182 * Find out if there is any input video
@@ -182,9 +184,10 @@ static int vpfe_update_pipe_state(struct vpfe_video_device *video) · 1 unmodified line
182184 */
183185 if (pipe->input_num == 0) {
184186 pipe->state = VPFE_PIPELINE_STREAM_CONTINUOUS;
185− if (vpfe_update_current_ext_subdev(video)) {
187+ ret = vpfe_update_current_ext_subdev(video);
188+ if (ret) {
186189 pr_err("Invalid external subdev\n");
187− return vpfe_update_current_ext_subdev(video);
190+ return ret;
188191 }
189192 } else {
190193 pipe->state = VPFE_PIPELINE_STREAM_SINGLESHOT;
@@ -667,6 +670,7 @@ static int vpfe_enum_fmt(struct file *file, void *priv, · 476 unmodified lines
667670 struct v4l2_subdev *subdev;
668671 struct v4l2_format format;
669672 struct media_pad *remote;
673+ int ret;
670674
671675 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_enum_fmt\n");
672676
@@ -695,10 +699,11 @@ static int vpfe_enum_fmt(struct file *file, void *priv, · 22 unmodified lines
695699 sd_fmt.pad = remote->index;
696700 sd_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
697701 /* get output format of remote subdev */
698− if (v4l2_subdev_call(subdev, pad, get_fmt, NULL, &sd_fmt)) {
702+ ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &sd_fmt);
703+ if (ret) {
699704 v4l2_err(&vpfe_dev->v4l2_dev,
700705 "invalid remote subdev for video node\n");
701− return v4l2_subdev_call(subdev, pad, get_fmt, NULL, &sd_fmt);
706+ return ret;
702707 }
703708 /* convert to pix format */
704709 mbus.code = sd_fmt.format.code;
@@ -725,6 +730,7 @@ static int vpfe_s_fmt(struct file *file, void *priv, · 20 unmodified lines
725730 struct vpfe_video_device *video = video_drvdata(file);
726731 struct vpfe_device *vpfe_dev = video->vpfe_dev;
727732 struct v4l2_format format;
733+ int ret;
728734
729735 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_s_fmt\n");
730736 /* If streaming is started, return error */
@@ -733,8 +739,9 @@ static int vpfe_s_fmt(struct file *file, void *priv, · 2 unmodified lines
733739 return -EBUSY;
734740 }
735741 /* get adjacent subdev's output pad format */
736− if (__vpfe_video_get_format(video, &format))
737− return __vpfe_video_get_format(video, &format);
742+ ret = __vpfe_video_get_format(video, &format);
743+ if (ret)
744+ return ret;
738745 *fmt = format;
739746 video->fmt = *fmt;
740747 return 0;
@@ -757,11 +764,13 @@ static int vpfe_try_fmt(struct file *file, void *priv, · 16 unmodified lines
757764 struct vpfe_video_device *video = video_drvdata(file);
758765 struct vpfe_device *vpfe_dev = video->vpfe_dev;
759766 struct v4l2_format format;
767+ int ret;
760768
761769 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_try_fmt\n");
762770 /* get adjacent subdev's output pad format */
763− if (__vpfe_video_get_format(video, &format))
764− return __vpfe_video_get_format(video, &format);
771+ ret = __vpfe_video_get_format(video, &format);
772+ if (ret)
773+ return ret;
765774
766775 *fmt = format;
767776 return 0;
@@ -838,8 +847,9 @@ static int vpfe_s_input(struct file *file, void *priv, unsigned int index) · 70 unmodified lines
838847
839848 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_s_input\n");
840849
841− if (mutex_lock_interruptible(&video->lock))
842− return mutex_lock_interruptible(&video->lock);
850+ ret = mutex_lock_interruptible(&video->lock);
851+ if (ret)
852+ return ret;
843853 /*
844854 * If streaming is started return device busy
845855 * error
@@ -940,8 +950,9 @@ static int vpfe_s_std(struct file *file, void *priv, v4l2_std_id std_id) · 94 unmodified lines
940950 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_s_std\n");
941951
942952 /* Call decoder driver function to set the standard */
943− if (mutex_lock_interruptible(&video->lock))
944− return mutex_lock_interruptible(&video->lock);
953+ ret = mutex_lock_interruptible(&video->lock);
954+ if (ret)
955+ return ret;
945956 sdinfo = video->current_ext_subdev;
946957 /* If streaming is started, return device busy error */
947958 if (video->started) {
@@ -1327,8 +1338,9 @@ static int vpfe_reqbufs(struct file *file, void *priv, · 379 unmodified lines
13271338 return -EINVAL;
13281339 }
13291340
1330− if (mutex_lock_interruptible(&video->lock))
1331− return mutex_lock_interruptible(&video->lock);
1341+ ret = mutex_lock_interruptible(&video->lock);
1342+ if (ret)
1343+ return ret;
13321344
13331345 if (video->io_usrs != 0) {
13341346 v4l2_err(&vpfe_dev->v4l2_dev, "Only one IO user allowed\n");
@@ -1354,10 +1366,11 @@ static int vpfe_reqbufs(struct file *file, void *priv, · 19 unmodified lines
13541366 q->buf_struct_size = sizeof(struct vpfe_cap_buffer);
13551367 q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
13561368
1357− if (vb2_queue_init(q)) {
1369+ ret = vb2_queue_init(q);
1370+ if (ret) {
13581371 v4l2_err(&vpfe_dev->v4l2_dev, "vb2_queue_init() failed\n");
13591372 vb2_dma_contig_cleanup_ctx(vpfe_dev->pdev);
1360− return vb2_queue_init(q);
1373+ return ret;
13611374 }
13621375
13631376 fh->io_allowed = 1;
@@ -1533,8 +1546,9 @@ static int vpfe_streamoff(struct file *file, void *priv, · 169 unmodified lines
15331546 return -EINVAL;
15341547 }
15351548
1536− if (mutex_lock_interruptible(&video->lock))
1537− return mutex_lock_interruptible(&video->lock);
1549+ ret = mutex_lock_interruptible(&video->lock);
1550+ if (ret)
1551+ return ret;
15381552
15391553 vpfe_stop_capture(video);
15401554 ret = vb2_streamoff(&video->buffer_queue, buf_type);
drivers/staging/rdma/hfi1/TODO+1−1
@@ -3,4 +3,4 @@ July, 2015 · 2 unmodified lines
33 - Remove unneeded file entries in sysfs
44 - Remove software processing of IB protocol and place in library for use
55 by qib, ipath (if still present), hfi1, and eventually soft-roce
6−
6+- Replace incorrect uAPI
drivers/staging/rdma/hfi1/file_ops.c+35−56
@@ -49,6 +49,8 @@ · 48 unmodified lines
4949 #include <linux/vmalloc.h>
5050 #include <linux/io.h>
5151
52+#include <rdma/ib.h>
53+
5254 #include "hfi.h"
5355 #include "pio.h"
5456 #include "device.h"
@@ -190,6 +192,10 @@ static ssize_t hfi1_file_write(struct file *fp, const char __user *data, · 135 unmodified lines
190192 int uctxt_required = 1;
191193 int must_be_root = 0;
192194
195+ /* FIXME: This interface cannot continue out of staging */
196+ if (WARN_ON_ONCE(!ib_safe_file_access(fp)))
197+ return -EACCES;
198+
193199 if (count < sizeof(cmd)) {
194200 ret = -EINVAL;
195201 goto bail;
@@ -791,15 +797,16 @@ static int hfi1_file_close(struct inode *inode, struct file *fp) · 595 unmodified lines
791797 spin_unlock_irqrestore(&dd->uctxt_lock, flags);
792798
793799 dd->rcd[uctxt->ctxt] = NULL;
800+
801+ hfi1_user_exp_rcv_free(fdata);
802+ hfi1_clear_ctxt_pkey(dd, uctxt->ctxt);
803+
794804 uctxt->rcvwait_to = 0;
795805 uctxt->piowait_to = 0;
796806 uctxt->rcvnowait = 0;
797807 uctxt->pionowait = 0;
798808 uctxt->event_flags = 0;
799809
800− hfi1_user_exp_rcv_free(fdata);
801− hfi1_clear_ctxt_pkey(dd, uctxt->ctxt);
802−
803810 hfi1_stats.sps_ctxts--;
804811 if (++dd->freectxts == dd->num_user_contexts)
805812 aspm_enable_all(dd);
@@ -1127,27 +1134,13 @@ bail: · 321 unmodified lines
11271134
11281135 static int user_init(struct file *fp)
11291136 {
1130− int ret;
11311137 unsigned int rcvctrl_ops = 0;
11321138 struct hfi1_filedata *fd = fp->private_data;
11331139 struct hfi1_ctxtdata *uctxt = fd->uctxt;
11341140
11351141 /* make sure that the context has already been setup */
1136− if (!test_bit(HFI1_CTXT_SETUP_DONE, &uctxt->event_flags)) {
1137− ret = -EFAULT;
1138− goto done;
1139− }
1140−
1141− /*
1142− * Subctxts don't need to initialize anything since master
1143− * has done it.
1144− */
1145− if (fd->subctxt) {
1146− ret = wait_event_interruptible(uctxt->wait, !test_bit(
1147− HFI1_CTXT_MASTER_UNINIT,
1148− &uctxt->event_flags));
1149− goto expected;
1150− }
1142+ if (!test_bit(HFI1_CTXT_SETUP_DONE, &uctxt->event_flags))
1143+ return -EFAULT;
11511144
11521145 /* initialize poll variables... */
11531146 uctxt->urgent = 0;
@@ -1202,19 +1195,7 @@ static int user_init(struct file *fp) · 48 unmodified lines
12021195 wake_up(&uctxt->wait);
12031196 }
12041197
1205−expected:
1206− /*
1207− * Expected receive has to be setup for all processes (including
1208− * shared contexts). However, it has to be done after the master
1209− * context has been fully configured as it depends on the
1210− * eager/expected split of the RcvArray entries.
1211− * Setting it up here ensures that the subcontexts will be waiting
1212− * (due to the above wait_event_interruptible() until the master
1213− * is setup.
1214− */
1215− ret = hfi1_user_exp_rcv_init(fp);
1216−done:
1217− return ret;
1198+ return 0;
12181199 }
12191200
12201201 static int get_ctxt_info(struct file *fp, void __user *ubase, __u32 len)
@@ -1261,7 +1242,7 @@ static int setup_ctxt(struct file *fp) · 40 unmodified lines
12611242 int ret = 0;
12621243
12631244 /*
1264− * Context should be set up only once (including allocation and
1245+ * Context should be set up only once, including allocation and
12651246 * programming of eager buffers. This is done if context sharing
12661247 * is not requested or by the master process.
12671248 */
@@ -1282,8 +1263,27 @@ static int setup_ctxt(struct file *fp) · 14 unmodified lines
12821263 if (ret)
12831264 goto done;
12841265 }
1266+ } else {
1267+ ret = wait_event_interruptible(uctxt->wait, !test_bit(
1268+ HFI1_CTXT_MASTER_UNINIT,
1269+ &uctxt->event_flags));
1270+ if (ret)
1271+ goto done;
12851272 }
1273+
12861274 ret = hfi1_user_sdma_alloc_queues(uctxt, fp);
1275+ if (ret)
1276+ goto done;
1277+ /*
1278+ * Expected receive has to be setup for all processes (including
1279+ * shared contexts). However, it has to be done after the master
1280+ * context has been fully configured as it depends on the
1281+ * eager/expected split of the RcvArray entries.
1282+ * Setting it up here ensures that the subcontexts will be waiting
1283+ * (due to the above wait_event_interruptible() until the master
1284+ * is setup.
1285+ */
1286+ ret = hfi1_user_exp_rcv_init(fp);
12871287 if (ret)
12881288 goto done;
12891289
@@ -1565,29 +1565,8 @@ static loff_t ui_lseek(struct file *filp, loff_t offset, int whence) · 275 unmodified lines
15651565 {
15661566 struct hfi1_devdata *dd = filp->private_data;
15671567
1568− switch (whence) {
1569− case SEEK_SET:
1570− break;
1571− case SEEK_CUR:
1572− offset += filp->f_pos;
1573− break;
1574− case SEEK_END:
1575− offset = ((dd->kregend - dd->kregbase) + DC8051_DATA_MEM_SIZE) -
1576− offset;
1577− break;
1578− default:
1579− return -EINVAL;
1580− }
1581−
1582− if (offset < 0)
1583− return -EINVAL;
1584−
1585− if (offset >= (dd->kregend - dd->kregbase) + DC8051_DATA_MEM_SIZE)
1586− return -EINVAL;
1587−
1588− filp->f_pos = offset;
1589−
1590− return filp->f_pos;
1568+ return fixed_size_llseek(filp, offset, whence,
1569+ (dd->kregend - dd->kregbase) + DC8051_DATA_MEM_SIZE);
15911570 }
15921571
15931572 /* NOTE: assumes unsigned long is 8 bytes */
drivers/staging/rdma/hfi1/mmu_rb.c+25−15
@@ -71,6 +71,7 @@ static inline void mmu_notifier_range_start(struct mmu_notifier *, · 70 unmodified lines
7171 struct mm_struct *,
7272 unsigned long, unsigned long);
7373 static void mmu_notifier_mem_invalidate(struct mmu_notifier *,
74+ struct mm_struct *,
7475 unsigned long, unsigned long);
7576 static struct mmu_rb_node *__mmu_rb_search(struct mmu_rb_handler *,
7677 unsigned long, unsigned long);
@@ -137,7 +138,7 @@ void hfi1_mmu_rb_unregister(struct rb_root *root) · 60 unmodified lines
137138 rbnode = rb_entry(node, struct mmu_rb_node, node);
138139 rb_erase(node, root);
139140 if (handler->ops->remove)
140− handler->ops->remove(root, rbnode, false);
141+ handler->ops->remove(root, rbnode, NULL);
141142 }
142143 }
143144
@@ -176,7 +177,7 @@ unlock: · 32 unmodified lines
176177 return ret;
177178 }
178179
179−/* Caller must host handler lock */
180+/* Caller must hold handler lock */
180181 static struct mmu_rb_node *__mmu_rb_search(struct mmu_rb_handler *handler,
181182 unsigned long addr,
182183 unsigned long len)
@@ -200,15 +201,21 @@ static struct mmu_rb_node *__mmu_rb_search(struct mmu_rb_handler *handler, · 17 unmodified lines
200201 return node;
201202 }
202203
204+/* Caller must *not* hold handler lock. */
203205 static void __mmu_rb_remove(struct mmu_rb_handler *handler,
204− struct mmu_rb_node *node, bool arg)
206+ struct mmu_rb_node *node, struct mm_struct *mm)
205207 {
208+ unsigned long flags;
209+
206210 /* Validity of handler and node pointers has been checked by caller. */
207211 hfi1_cdbg(MMU, "Removing node addr 0x%llx, len %u", node->addr,
208212 node->len);
213+ spin_lock_irqsave(&handler->lock, flags);
209214 __mmu_int_rb_remove(node, handler->root);
215+ spin_unlock_irqrestore(&handler->lock, flags);
216+
210217 if (handler->ops->remove)
211− handler->ops->remove(handler->root, node, arg);
218+ handler->ops->remove(handler->root, node, mm);
212219 }
213220
214221 struct mmu_rb_node *hfi1_mmu_rb_search(struct rb_root *root, unsigned long addr,
@@ -231,14 +238,11 @@ struct mmu_rb_node *hfi1_mmu_rb_search(struct rb_root *root, unsigned long addr, · 16 unmodified lines
231238 void hfi1_mmu_rb_remove(struct rb_root *root, struct mmu_rb_node *node)
232239 {
233240 struct mmu_rb_handler *handler = find_mmu_handler(root);
234− unsigned long flags;
235241
236242 if (!handler || !node)
237243 return;
238244
239− spin_lock_irqsave(&handler->lock, flags);
240− __mmu_rb_remove(handler, node, false);
241− spin_unlock_irqrestore(&handler->lock, flags);
245+ __mmu_rb_remove(handler, node, NULL);
242246 }
243247
244248 static struct mmu_rb_handler *find_mmu_handler(struct rb_root *root)
@@ -260,7 +264,7 @@ unlock: · 15 unmodified lines
260264 static inline void mmu_notifier_page(struct mmu_notifier *mn,
261265 struct mm_struct *mm, unsigned long addr)
262266 {
263− mmu_notifier_mem_invalidate(mn, addr, addr + PAGE_SIZE);
267+ mmu_notifier_mem_invalidate(mn, mm, addr, addr + PAGE_SIZE);
264268 }
265269
266270 static inline void mmu_notifier_range_start(struct mmu_notifier *mn,
@@ -268,25 +272,31 @@ static inline void mmu_notifier_range_start(struct mmu_notifier *mn, · 1 unmodified line
268272 unsigned long start,
269273 unsigned long end)
270274 {
271− mmu_notifier_mem_invalidate(mn, start, end);
275+ mmu_notifier_mem_invalidate(mn, mm, start, end);
272276 }
273277
274278 static void mmu_notifier_mem_invalidate(struct mmu_notifier *mn,
279+ struct mm_struct *mm,
275280 unsigned long start, unsigned long end)
276281 {
277282 struct mmu_rb_handler *handler =
278283 container_of(mn, struct mmu_rb_handler, mn);
279284 struct rb_root *root = handler->root;
280− struct mmu_rb_node *node;
285+ struct mmu_rb_node *node, *ptr = NULL;
281286 unsigned long flags;
282287
283288 spin_lock_irqsave(&handler->lock, flags);
284− for (node = __mmu_int_rb_iter_first(root, start, end - 1); node;
285− node = __mmu_int_rb_iter_next(node, start, end - 1)) {
289+ for (node = __mmu_int_rb_iter_first(root, start, end - 1);
290+ node; node = ptr) {
291+ /* Guard against node removal. */
292+ ptr = __mmu_int_rb_iter_next(node, start, end - 1);
286293 hfi1_cdbg(MMU, "Invalidating node addr 0x%llx, len %u",
287294 node->addr, node->len);
288− if (handler->ops->invalidate(root, node))
289− __mmu_rb_remove(handler, node, true);
295+ if (handler->ops->invalidate(root, node)) {
296+ spin_unlock_irqrestore(&handler->lock, flags);
297+ __mmu_rb_remove(handler, node, mm);
298+ spin_lock_irqsave(&handler->lock, flags);
299+ }
290300 }
291301 spin_unlock_irqrestore(&handler->lock, flags);
292302 }
drivers/staging/rdma/hfi1/mmu_rb.h+2−1
@@ -59,7 +59,8 @@ struct mmu_rb_node { · 58 unmodified lines
5959 struct mmu_rb_ops {
6060 bool (*filter)(struct mmu_rb_node *, unsigned long, unsigned long);
6161 int (*insert)(struct rb_root *, struct mmu_rb_node *);
62− void (*remove)(struct rb_root *, struct mmu_rb_node *, bool);
62+ void (*remove)(struct rb_root *, struct mmu_rb_node *,
63+ struct mm_struct *);
6364 int (*invalidate)(struct rb_root *, struct mmu_rb_node *);
6465 };
6566
drivers/staging/rdma/hfi1/qp.c+2−0
@@ -519,10 +519,12 @@ static void iowait_sdma_drained(struct iowait *wait) · 518 unmodified lines
519519 * do the flush work until that QP's
520520 * sdma work has finished.
521521 */
522+ spin_lock(&qp->s_lock);
522523 if (qp->s_flags & RVT_S_WAIT_DMA) {
523524 qp->s_flags &= ~RVT_S_WAIT_DMA;
524525 hfi1_schedule_send(qp);
525526 }
527+ spin_unlock(&qp->s_lock);
526528 }
527529
528530 /**
drivers/staging/rdma/hfi1/user_exp_rcv.c+7−4
@@ -87,7 +87,8 @@ static u32 find_phys_blocks(struct page **, unsigned, struct tid_pageset *); · 86 unmodified lines
8787 static int set_rcvarray_entry(struct file *, unsigned long, u32,
8888 struct tid_group *, struct page **, unsigned);
8989 static int mmu_rb_insert(struct rb_root *, struct mmu_rb_node *);
90−static void mmu_rb_remove(struct rb_root *, struct mmu_rb_node *, bool);
90+static void mmu_rb_remove(struct rb_root *, struct mmu_rb_node *,
91+ struct mm_struct *);
9192 static int mmu_rb_invalidate(struct rb_root *, struct mmu_rb_node *);
9293 static int program_rcvarray(struct file *, unsigned long, struct tid_group *,
9394 struct tid_pageset *, unsigned, u16, struct page **,
@@ -254,6 +255,8 @@ int hfi1_user_exp_rcv_free(struct hfi1_filedata *fd) · 160 unmodified lines
254255 struct hfi1_ctxtdata *uctxt = fd->uctxt;
255256 struct tid_group *grp, *gptr;
256257
258+ if (!test_bit(HFI1_CTXT_SETUP_DONE, &uctxt->event_flags))
259+ return 0;
257260 /*
258261 * The notifier would have been removed when the process'es mm
259262 * was freed.
@@ -899,7 +902,7 @@ static int unprogram_rcvarray(struct file *fp, u32 tidinfo, · 639 unmodified lines
899902 if (!node || node->rcventry != (uctxt->expected_base + rcventry))
900903 return -EBADF;
901904 if (HFI1_CAP_IS_USET(TID_UNMAP))
902− mmu_rb_remove(&fd->tid_rb_root, &node->mmu, false);
905+ mmu_rb_remove(&fd->tid_rb_root, &node->mmu, NULL);
903906 else
904907 hfi1_mmu_rb_remove(&fd->tid_rb_root, &node->mmu);
905908
@@ -965,7 +968,7 @@ static void unlock_exp_tids(struct hfi1_ctxtdata *uctxt, · 59 unmodified lines
965968 continue;
966969 if (HFI1_CAP_IS_USET(TID_UNMAP))
967970 mmu_rb_remove(&fd->tid_rb_root,
968− &node->mmu, false);
971+ &node->mmu, NULL);
969972 else
970973 hfi1_mmu_rb_remove(&fd->tid_rb_root,
971974 &node->mmu);
@@ -1032,7 +1035,7 @@ static int mmu_rb_insert(struct rb_root *root, struct mmu_rb_node *node) · 60 unmodified lines
10321035 }
10331036
10341037 static void mmu_rb_remove(struct rb_root *root, struct mmu_rb_node *node,
1035− bool notifier)
1038+ struct mm_struct *mm)
10361039 {
10371040 struct hfi1_filedata *fdata =
10381041 container_of(root, struct hfi1_filedata, tid_rb_root);
drivers/staging/rdma/hfi1/user_sdma.c+22−11
@@ -278,7 +278,8 @@ static inline void pq_update(struct hfi1_user_sdma_pkt_q *); · 277 unmodified lines
278278 static void user_sdma_free_request(struct user_sdma_request *, bool);
279279 static int pin_vector_pages(struct user_sdma_request *,
280280 struct user_sdma_iovec *);
281−static void unpin_vector_pages(struct mm_struct *, struct page **, unsigned);
281+static void unpin_vector_pages(struct mm_struct *, struct page **, unsigned,
282+ unsigned);
282283 static int check_header_template(struct user_sdma_request *,
283284 struct hfi1_pkt_header *, u32, u32);
284285 static int set_txreq_header(struct user_sdma_request *,
@@ -299,7 +300,8 @@ static int defer_packet_queue( · 14 unmodified lines
299300 static void activate_packet_queue(struct iowait *, int);
300301 static bool sdma_rb_filter(struct mmu_rb_node *, unsigned long, unsigned long);
301302 static int sdma_rb_insert(struct rb_root *, struct mmu_rb_node *);
302−static void sdma_rb_remove(struct rb_root *, struct mmu_rb_node *, bool);
303+static void sdma_rb_remove(struct rb_root *, struct mmu_rb_node *,
304+ struct mm_struct *);
303305 static int sdma_rb_invalidate(struct rb_root *, struct mmu_rb_node *);
304306
305307 static struct mmu_rb_ops sdma_rb_ops = {
@@ -1063,8 +1065,10 @@ static int pin_vector_pages(struct user_sdma_request *req, · 757 unmodified lines
10631065 rb_node = hfi1_mmu_rb_search(&pq->sdma_rb_root,
10641066 (unsigned long)iovec->iov.iov_base,
10651067 iovec->iov.iov_len);
1066− if (rb_node)
1068+ if (rb_node && !IS_ERR(rb_node))
10671069 node = container_of(rb_node, struct sdma_mmu_node, rb);
1070+ else
1071+ rb_node = NULL;
10681072
10691073 if (!node) {
10701074 node = kzalloc(sizeof(*node), GFP_KERNEL);
@@ -1107,7 +1111,8 @@ retry: · 36 unmodified lines
11071111 goto bail;
11081112 }
11091113 if (pinned != npages) {
1110− unpin_vector_pages(current->mm, pages, pinned);
1114+ unpin_vector_pages(current->mm, pages, node->npages,
1115+ pinned);
11111116 ret = -EFAULT;
11121117 goto bail;
11131118 }
@@ -1147,9 +1152,9 @@ bail: · 33 unmodified lines
11471152 }
11481153
11491154 static void unpin_vector_pages(struct mm_struct *mm, struct page **pages,
1150− unsigned npages)
1155+ unsigned start, unsigned npages)
11511156 {
1152− hfi1_release_user_pages(mm, pages, npages, 0);
1157+ hfi1_release_user_pages(mm, pages + start, npages, 0);
11531158 kfree(pages);
11541159 }
11551160
@@ -1502,7 +1507,7 @@ static void user_sdma_free_request(struct user_sdma_request *req, bool unpin) · 346 unmodified lines
15021507 &req->pq->sdma_rb_root,
15031508 (unsigned long)req->iovs[i].iov.iov_base,
15041509 req->iovs[i].iov.iov_len);
1505− if (!mnode)
1510+ if (!mnode || IS_ERR(mnode))
15061511 continue;
15071512
15081513 node = container_of(mnode, struct sdma_mmu_node, rb);
@@ -1547,7 +1552,7 @@ static int sdma_rb_insert(struct rb_root *root, struct mmu_rb_node *mnode) · 38 unmodified lines
15471552 }
15481553
15491554 static void sdma_rb_remove(struct rb_root *root, struct mmu_rb_node *mnode,
1550− bool notifier)
1555+ struct mm_struct *mm)
15511556 {
15521557 struct sdma_mmu_node *node =
15531558 container_of(mnode, struct sdma_mmu_node, rb);
@@ -1557,14 +1562,20 @@ static void sdma_rb_remove(struct rb_root *root, struct mmu_rb_node *mnode, · 3 unmodified lines
15571562 node->pq->n_locked -= node->npages;
15581563 spin_unlock(&node->pq->evict_lock);
15591564
1560− unpin_vector_pages(notifier ? NULL : current->mm, node->pages,
1565+ /*
1566+ * If mm is set, we are being called by the MMU notifier and we
1567+ * should not pass a mm_struct to unpin_vector_page(). This is to
1568+ * prevent a deadlock when hfi1_release_user_pages() attempts to
1569+ * take the mmap_sem, which the MMU notifier has already taken.
1570+ */
1571+ unpin_vector_pages(mm ? NULL : current->mm, node->pages, 0,
15611572 node->npages);
15621573 /*
15631574 * If called by the MMU notifier, we have to adjust the pinned
15641575 * page count ourselves.
15651576 */
1566− if (notifier)
1567− current->mm->pinned_vm -= node->npages;
1577+ if (mm)
1578+ mm->pinned_vm -= node->npages;
15681579 kfree(node);
15691580 }
15701581
drivers/thermal/hisi_thermal.c+2−2
@@ -68,12 +68,12 @@ static inline int _step_to_temp(int step) · 67 unmodified lines
6868 * Every step equals (1 * 200) / 255 celsius, and finally
6969 * need convert to millicelsius.
7070 */
71− return (HISI_TEMP_BASE + (step * 200 / 255)) * 1000;
71+ return (HISI_TEMP_BASE * 1000 + (step * 200000 / 255));
7272 }
7373
7474 static inline long _temp_to_step(long temp)
7575 {
76− return ((temp / 1000 - HISI_TEMP_BASE) * 255 / 200);
76+ return ((temp - HISI_TEMP_BASE * 1000) * 255) / 200000;
7777 }
7878
7979 static long hisi_thermal_get_sensor_temp(struct hisi_thermal_data *data,
drivers/thermal/thermal_core.c+1−1
@@ -959,7 +959,7 @@ static DEVICE_ATTR(sustainable_power, S_IWUSR | S_IRUGO, sustainable_power_show, · 958 unmodified lines
959959 struct thermal_zone_device *tz = to_thermal_zone(dev); \
960960 \
961961 if (tz->tzp) \
962− return sprintf(buf, "%u\n", tz->tzp->name); \
962+ return sprintf(buf, "%d\n", tz->tzp->name); \
963963 else \
964964 return -EIO; \
965965 } \
fs/ceph/mds_client.c+2−4
@@ -386,9 +386,7 @@ void ceph_put_mds_session(struct ceph_mds_session *s) · 385 unmodified lines
386386 atomic_read(&s->s_ref), atomic_read(&s->s_ref)-1);
387387 if (atomic_dec_and_test(&s->s_ref)) {
388388 if (s->s_auth.authorizer)
389− ceph_auth_destroy_authorizer(
390− s->s_mdsc->fsc->client->monc.auth,
391− s->s_auth.authorizer);
389+ ceph_auth_destroy_authorizer(s->s_auth.authorizer);
392390 kfree(s);
393391 }
394392 }
@@ -3900,7 +3898,7 @@ static struct ceph_auth_handshake *get_authorizer(struct ceph_connection *con, · 3505 unmodified lines
39003898 struct ceph_auth_handshake *auth = &s->s_auth;
39013899
39023900 if (force_new && auth->authorizer) {
3903− ceph_auth_destroy_authorizer(ac, auth->authorizer);
3901+ ceph_auth_destroy_authorizer(auth->authorizer);
39043902 auth->authorizer = NULL;
39053903 }
39063904 if (!auth->authorizer) {
fs/fuse/file.c+1−1
@@ -1295,7 +1295,7 @@ static int fuse_get_user_pages(struct fuse_req *req, struct iov_iter *ii, · 1294 unmodified lines
12951295
12961296 *nbytesp = nbytes;
12971297
1298− return ret;
1298+ return ret < 0 ? ret : 0;
12991299 }
13001300
13011301 static inline int fuse_iter_npages(const struct iov_iter *ii_p)
fs/ocfs2/dlm/dlmmaster.c+2−0
@@ -2455,6 +2455,8 @@ int dlm_deref_lockres_done_handler(struct o2net_msg *msg, u32 len, void *data, · 2454 unmodified lines
24552455
24562456 spin_unlock(&dlm->spinlock);
24572457
2458+ ret = 0;
2459+
24582460 done:
24592461 dlm_put(dlm);
24602462 return ret;
fs/proc/task_mmu.c+30−3
@@ -1518,6 +1518,32 @@ static struct page *can_gather_numa_stats(pte_t pte, struct vm_area_struct *vma, · 1517 unmodified lines
15181518 return page;
15191519 }
15201520
1521+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
1522+static struct page *can_gather_numa_stats_pmd(pmd_t pmd,
1523+ struct vm_area_struct *vma,
1524+ unsigned long addr)
1525+{
1526+ struct page *page;
1527+ int nid;
1528+
1529+ if (!pmd_present(pmd))
1530+ return NULL;
1531+
1532+ page = vm_normal_page_pmd(vma, addr, pmd);
1533+ if (!page)
1534+ return NULL;
1535+
1536+ if (PageReserved(page))
1537+ return NULL;
1538+
1539+ nid = page_to_nid(page);
1540+ if (!node_isset(nid, node_states[N_MEMORY]))
1541+ return NULL;
1542+
1543+ return page;
1544+}
1545+#endif
1546+
15211547 static int gather_pte_stats(pmd_t *pmd, unsigned long addr,
15221548 unsigned long end, struct mm_walk *walk)
15231549 {
@@ -1527,14 +1553,14 @@ static int gather_pte_stats(pmd_t *pmd, unsigned long addr, · 3 unmodified lines
15271553 pte_t *orig_pte;
15281554 pte_t *pte;
15291555
1556+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
15301557 ptl = pmd_trans_huge_lock(pmd, vma);
15311558 if (ptl) {
1532− pte_t huge_pte = *(pte_t *)pmd;
15331559 struct page *page;
15341560
1535− page = can_gather_numa_stats(huge_pte, vma, addr);
1561+ page = can_gather_numa_stats_pmd(*pmd, vma, addr);
15361562 if (page)
1537− gather_stats(page, md, pte_dirty(huge_pte),
1563+ gather_stats(page, md, pmd_dirty(*pmd),
15381564 HPAGE_PMD_SIZE/PAGE_SIZE);
15391565 spin_unlock(ptl);
15401566 return 0;
@@ -1542,6 +1568,7 @@ static int gather_pte_stats(pmd_t *pmd, unsigned long addr, · 1 unmodified line
15421568
15431569 if (pmd_trans_unstable(pmd))
15441570 return 0;
1571+#endif
15451572 orig_pte = pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl);
15461573 do {
15471574 struct page *page = can_gather_numa_stats(*pte, vma, addr);
fs/udf/super.c+2−2
@@ -919,14 +919,14 @@ static int udf_load_pvoldesc(struct super_block *sb, sector_t block) · 918 unmodified lines
919919 #endif
920920 }
921921
922− ret = udf_CS0toUTF8(outstr, 31, pvoldesc->volIdent, 32);
922+ ret = udf_dstrCS0toUTF8(outstr, 31, pvoldesc->volIdent, 32);
923923 if (ret < 0)
924924 goto out_bh;
925925
926926 strncpy(UDF_SB(sb)->s_volume_ident, outstr, ret);
927927 udf_debug("volIdent[] = '%s'\n", UDF_SB(sb)->s_volume_ident);
928928
929− ret = udf_CS0toUTF8(outstr, 127, pvoldesc->volSetIdent, 128);
929+ ret = udf_dstrCS0toUTF8(outstr, 127, pvoldesc->volSetIdent, 128);
930930 if (ret < 0)
931931 goto out_bh;
932932
fs/udf/udfdecl.h+1−1
@@ -212,7 +212,7 @@ extern int udf_get_filename(struct super_block *, const uint8_t *, int, · 211 unmodified lines
212212 uint8_t *, int);
213213 extern int udf_put_filename(struct super_block *, const uint8_t *, int,
214214 uint8_t *, int);
215−extern int udf_CS0toUTF8(uint8_t *, int, const uint8_t *, int);
215+extern int udf_dstrCS0toUTF8(uint8_t *, int, const uint8_t *, int);
216216
217217 /* ialloc.c */
218218 extern void udf_free_inode(struct inode *);
fs/udf/unicode.c+14−2
@@ -335,9 +335,21 @@ try_again: · 334 unmodified lines
335335 return u_len;
336336 }
337337
338−int udf_CS0toUTF8(uint8_t *utf_o, int o_len, const uint8_t *ocu_i, int i_len)
338+int udf_dstrCS0toUTF8(uint8_t *utf_o, int o_len,
339+ const uint8_t *ocu_i, int i_len)
339340 {
340− return udf_name_from_CS0(utf_o, o_len, ocu_i, i_len,
341+ int s_len = 0;
342+
343+ if (i_len > 0) {
344+ s_len = ocu_i[i_len - 1];
345+ if (s_len >= i_len) {
346+ pr_err("incorrect dstring lengths (%d/%d)\n",
347+ s_len, i_len);
348+ return -EINVAL;
349+ }
350+ }
351+
352+ return udf_name_from_CS0(utf_o, o_len, ocu_i, s_len,
341353 udf_uni2char_utf8, 0);
342354 }
343355
include/linux/bpf.h+2−1
@@ -180,12 +180,13 @@ void bpf_register_prog_type(struct bpf_prog_type_list *tl); · 179 unmodified lines
180180 void bpf_register_map_type(struct bpf_map_type_list *tl);
181181
182182 struct bpf_prog *bpf_prog_get(u32 ufd);
183+struct bpf_prog *bpf_prog_inc(struct bpf_prog *prog);
183184 void bpf_prog_put(struct bpf_prog *prog);
184185 void bpf_prog_put_rcu(struct bpf_prog *prog);
185186
186187 struct bpf_map *bpf_map_get_with_uref(u32 ufd);
187188 struct bpf_map *__bpf_map_get(struct fd f);
188−void bpf_map_inc(struct bpf_map *map, bool uref);
189+struct bpf_map *bpf_map_inc(struct bpf_map *map, bool uref);
189190 void bpf_map_put_with_uref(struct bpf_map *map);
190191 void bpf_map_put(struct bpf_map *map);
191192 int bpf_map_precharge_memlock(u32 pages);
include/linux/ceph/auth.h+5−5
@@ -12,9 +12,12 @@ · 11 unmodified lines
1212 */
1313
1414 struct ceph_auth_client;
15−struct ceph_authorizer;
1615 struct ceph_msg;
1716
17+struct ceph_authorizer {
18+ void (*destroy)(struct ceph_authorizer *);
19+};
20+
1821 struct ceph_auth_handshake {
1922 struct ceph_authorizer *authorizer;
2023 void *authorizer_buf;
@@ -62,8 +65,6 @@ struct ceph_auth_client_ops { · 41 unmodified lines
6265 struct ceph_auth_handshake *auth);
6366 int (*verify_authorizer_reply)(struct ceph_auth_client *ac,
6467 struct ceph_authorizer *a, size_t len);
65− void (*destroy_authorizer)(struct ceph_auth_client *ac,
66− struct ceph_authorizer *a);
6768 void (*invalidate_authorizer)(struct ceph_auth_client *ac,
6869 int peer_type);
6970
@@ -112,8 +113,7 @@ extern int ceph_auth_is_authenticated(struct ceph_auth_client *ac); · 42 unmodified lines
112113 extern int ceph_auth_create_authorizer(struct ceph_auth_client *ac,
113114 int peer_type,
114115 struct ceph_auth_handshake *auth);
115−extern void ceph_auth_destroy_authorizer(struct ceph_auth_client *ac,
116− struct ceph_authorizer *a);
116+void ceph_auth_destroy_authorizer(struct ceph_authorizer *a);
117117 extern int ceph_auth_update_authorizer(struct ceph_auth_client *ac,
118118 int peer_type,
119119 struct ceph_auth_handshake *a);
include/linux/ceph/osd_client.h+0−1
@@ -16,7 +16,6 @@ struct ceph_msg; · 15 unmodified lines
1616 struct ceph_snap_context;
1717 struct ceph_osd_request;
1818 struct ceph_osd_client;
19−struct ceph_authorizer;
2019
2120 /*
2221 * completion callback for async writepages
include/linux/cgroup-defs.h+1−0
@@ -444,6 +444,7 @@ struct cgroup_subsys { · 443 unmodified lines
444444 int (*can_attach)(struct cgroup_taskset *tset);
445445 void (*cancel_attach)(struct cgroup_taskset *tset);
446446 void (*attach)(struct cgroup_taskset *tset);
447+ void (*post_attach)(void);
447448 int (*can_fork)(struct task_struct *task);
448449 void (*cancel_fork)(struct task_struct *task);
449450 void (*fork)(struct task_struct *task);
include/linux/cpuset.h+0−6
@@ -137,8 +137,6 @@ static inline void set_mems_allowed(nodemask_t nodemask) · 136 unmodified lines
137137 task_unlock(current);
138138 }
139139
140−extern void cpuset_post_attach_flush(void);
141−
142140 #else /* !CONFIG_CPUSETS */
143141
144142 static inline bool cpusets_enabled(void) { return false; }
@@ -245,10 +243,6 @@ static inline bool read_mems_allowed_retry(unsigned int seq) · 100 unmodified lines
245243 return false;
246244 }
247245
248−static inline void cpuset_post_attach_flush(void)
249−{
250−}
251−
252246 #endif /* !CONFIG_CPUSETS */
253247
254248 #endif /* _LINUX_CPUSET_H */
include/linux/hash.h+18−2
@@ -32,12 +32,28 @@ · 31 unmodified lines
3232 #error Wordsize not 32 or 64
3333 #endif
3434
35+/*
36+ * The above primes are actively bad for hashing, since they are
37+ * too sparse. The 32-bit one is mostly ok, the 64-bit one causes
38+ * real problems. Besides, the "prime" part is pointless for the
39+ * multiplicative hash.
40+ *
41+ * Although a random odd number will do, it turns out that the golden
42+ * ratio phi = (sqrt(5)-1)/2, or its negative, has particularly nice
43+ * properties.
44+ *
45+ * These are the negative, (1 - phi) = (phi^2) = (3 - sqrt(5))/2.
46+ * (See Knuth vol 3, section 6.4, exercise 9.)
47+ */
48+#define GOLDEN_RATIO_32 0x61C88647
49+#define GOLDEN_RATIO_64 0x61C8864680B583EBull
50+
3551 static __always_inline u64 hash_64(u64 val, unsigned int bits)
3652 {
3753 u64 hash = val;
3854
39−#if defined(CONFIG_ARCH_HAS_FAST_MULTIPLIER) && BITS_PER_LONG == 64
40− hash = hash * GOLDEN_RATIO_PRIME_64;
55+#if BITS_PER_LONG == 64
56+ hash = hash * GOLDEN_RATIO_64;
4157 #else
4258 /* Sigh, gcc can't optimise this alone like it does for 32 bits. */
4359 u64 n = hash;
include/linux/huge_mm.h+5−0
@@ -152,6 +152,7 @@ static inline bool is_huge_zero_pmd(pmd_t pmd) · 151 unmodified lines
152152 }
153153
154154 struct page *get_huge_zero_page(void);
155+void put_huge_zero_page(void);
155156
156157 #else /* CONFIG_TRANSPARENT_HUGEPAGE */
157158 #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
@@ -208,6 +209,10 @@ static inline bool is_huge_zero_page(struct page *page) · 50 unmodified lines
208209 return false;
209210 }
210211
212+static inline void put_huge_zero_page(void)
213+{
214+ BUILD_BUG();
215+}
211216
212217 static inline struct page *follow_devmap_pmd(struct vm_area_struct *vma,
213218 unsigned long addr, pmd_t *pmd, int flags)
include/linux/if_ether.h+5−0
@@ -28,6 +28,11 @@ static inline struct ethhdr *eth_hdr(const struct sk_buff *skb) · 27 unmodified lines
2828 return (struct ethhdr *)skb_mac_header(skb);
2929 }
3030
31+static inline struct ethhdr *inner_eth_hdr(const struct sk_buff *skb)
32+{
33+ return (struct ethhdr *)skb_inner_mac_header(skb);
34+}
35+
3136 int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
3237
3338 extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len);
include/linux/lockdep.h+5−3
@@ -196,9 +196,11 @@ struct lock_list { · 195 unmodified lines
196196 * We record lock dependency chains, so that we can cache them:
197197 */
198198 struct lock_chain {
199− u8 irq_context;
200− u8 depth;
201− u16 base;
199+ /* see BUILD_BUG_ON()s in lookup_chain_cache() */
200+ unsigned int irq_context : 2,
201+ depth : 6,
202+ base : 24;
203+ /* 4 byte hole */
202204 struct hlist_node entry;
203205 u64 chain_key;
204206 };
include/linux/mlx5/device.h+11−0
@@ -393,6 +393,17 @@ enum { · 392 unmodified lines
393393 MLX5_CAP_OFF_CMDIF_CSUM = 46,
394394 };
395395
396+enum {
397+ /*
398+ * Max wqe size for rdma read is 512 bytes, so this
399+ * limits our max_sge_rd as the wqe needs to fit:
400+ * - ctrl segment (16 bytes)
401+ * - rdma segment (16 bytes)
402+ * - scatter elements (16 bytes each)
403+ */
404+ MLX5_MAX_SGE_RD = (512 - 16 - 16) / 16
405+};
406+
396407 struct mlx5_inbox_hdr {
397408 __be16 opcode;
398409 u8 rsvd[4];
include/linux/mm.h+4−0
@@ -1031,6 +1031,8 @@ static inline bool page_mapped(struct page *page) · 1030 unmodified lines
10311031 page = compound_head(page);
10321032 if (atomic_read(compound_mapcount_ptr(page)) >= 0)
10331033 return true;
1034+ if (PageHuge(page))
1035+ return false;
10341036 for (i = 0; i < hpage_nr_pages(page); i++) {
10351037 if (atomic_read(&page[i]._mapcount) >= 0)
10361038 return true;
@@ -1138,6 +1140,8 @@ struct zap_details { · 101 unmodified lines
11381140
11391141 struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
11401142 pte_t pte);
1143+struct page *vm_normal_page_pmd(struct vm_area_struct *vma, unsigned long addr,
1144+ pmd_t pmd);
11411145
11421146 int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
11431147 unsigned long size);
include/linux/net.h+9−1
@@ -245,7 +245,15 @@ do { \ · 244 unmodified lines
245245 net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__)
246246 #define net_info_ratelimited(fmt, ...) \
247247 net_ratelimited_function(pr_info, fmt, ##__VA_ARGS__)
248−#if defined(DEBUG)
248+#if defined(CONFIG_DYNAMIC_DEBUG)
249+#define net_dbg_ratelimited(fmt, ...) \
250+do { \
251+ DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
252+ if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \
253+ net_ratelimit()) \
254+ __dynamic_pr_debug(&descriptor, fmt, ##__VA_ARGS__); \
255+} while (0)
256+#elif defined(DEBUG)
249257 #define net_dbg_ratelimited(fmt, ...) \
250258 net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__)
251259 #else
include/linux/netdevice.h+1−1
@@ -3992,7 +3992,7 @@ netdev_features_t netif_skb_features(struct sk_buff *skb); · 3991 unmodified lines
39923992
39933993 static inline bool net_gso_ok(netdev_features_t features, int gso_type)
39943994 {
3995− netdev_features_t feature = gso_type << NETIF_F_GSO_SHIFT;
3995+ netdev_features_t feature = (netdev_features_t)gso_type << NETIF_F_GSO_SHIFT;
39963996
39973997 /* check flags correspondence */
39983998 BUILD_BUG_ON(SKB_GSO_TCPV4 != (NETIF_F_TSO >> NETIF_F_GSO_SHIFT));
include/media/videobuf2-core.h+8−0
@@ -375,6 +375,9 @@ struct vb2_ops { · 374 unmodified lines
375375 /**
376376 * struct vb2_ops - driver-specific callbacks
377377 *
378+ * @verify_planes_array: Verify that a given user space structure contains
379+ * enough planes for the buffer. This is called
380+ * for each dequeued buffer.
378381 * @fill_user_buffer: given a vb2_buffer fill in the userspace structure.
379382 * For V4L2 this is a struct v4l2_buffer.
380383 * @fill_vb2_buffer: given a userspace structure, fill in the vb2_buffer.
@@ -384,6 +387,7 @@ struct vb2_ops { · 3 unmodified lines
384387 * the vb2_buffer struct.
385388 */
386389 struct vb2_buf_ops {
390+ int (*verify_planes_array)(struct vb2_buffer *vb, const void *pb);
387391 void (*fill_user_buffer)(struct vb2_buffer *vb, void *pb);
388392 int (*fill_vb2_buffer)(struct vb2_buffer *vb, const void *pb,
389393 struct vb2_plane *planes);
@@ -400,6 +404,9 @@ struct vb2_buf_ops { · 10 unmodified lines
400404 * @fileio_read_once: report EOF after reading the first buffer
401405 * @fileio_write_immediately: queue buffer after each write() call
402406 * @allow_zero_bytesused: allow bytesused == 0 to be passed to the driver
407+ * @quirk_poll_must_check_waiting_for_buffers: Return POLLERR at poll when QBUF
408+ * has not been called. This is a vb1 idiom that has been adopted
409+ * also by vb2.
403410 * @lock: pointer to a mutex that protects the vb2_queue struct. The
404411 * driver can set this to a mutex to let the v4l2 core serialize
405412 * the queuing ioctls. If the driver wants to handle locking
@@ -463,6 +470,7 @@ struct vb2_queue { · 57 unmodified lines
463470 unsigned fileio_read_once:1;
464471 unsigned fileio_write_immediately:1;
465472 unsigned allow_zero_bytesused:1;
473+ unsigned quirk_poll_must_check_waiting_for_buffers:1;
466474
467475 struct mutex *lock;
468476 void *owner;
include/net/vxlan.h+3−1
@@ -317,7 +317,9 @@ static inline netdev_features_t vxlan_features_check(struct sk_buff *skb, · 316 unmodified lines
317317 (skb->inner_protocol_type != ENCAP_TYPE_ETHER ||
318318 skb->inner_protocol != htons(ETH_P_TEB) ||
319319 (skb_inner_mac_header(skb) - skb_transport_header(skb) !=
320− sizeof(struct udphdr) + sizeof(struct vxlanhdr))))
320+ sizeof(struct udphdr) + sizeof(struct vxlanhdr)) ||
321+ (skb->ip_summed != CHECKSUM_NONE &&
322+ !can_checksum_protocol(features, inner_eth_hdr(skb)->h_proto))))
321323 return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
322324
323325 return features;
include/rdma/ib.h+16−0
@@ -34,6 +34,7 @@ · 33 unmodified lines
3434 #define _RDMA_IB_H
3535
3636 #include <linux/types.h>
37+#include <linux/sched.h>
3738
3839 struct ib_addr {
3940 union {
@@ -86,4 +87,19 @@ struct sockaddr_ib { · 46 unmodified lines
8687 __u64 sib_scope_id;
8788 };
8889
90+/*
91+ * The IB interfaces that use write() as bi-directional ioctl() are
92+ * fundamentally unsafe, since there are lots of ways to trigger "write()"
93+ * calls from various contexts with elevated privileges. That includes the
94+ * traditional suid executable error message writes, but also various kernel
95+ * interfaces that can write to file descriptors.
96+ *
97+ * This function provides protection for the legacy API by restricting the
98+ * calling context.
99+ */
100+static inline bool ib_safe_file_access(struct file *filp)
101+{
102+ return filp->f_cred == current_cred() && segment_eq(get_fs(), USER_DS);
103+}
104+
89105 #endif /* _RDMA_IB_H */
include/sound/hda_i915.h+2−3
@@ -9,7 +9,7 @@ · 8 unmodified lines
99 #ifdef CONFIG_SND_HDA_I915
1010 int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable);
1111 int snd_hdac_display_power(struct hdac_bus *bus, bool enable);
12−int snd_hdac_get_display_clk(struct hdac_bus *bus);
12+void snd_hdac_i915_set_bclk(struct hdac_bus *bus);
1313 int snd_hdac_sync_audio_rate(struct hdac_bus *bus, hda_nid_t nid, int rate);
1414 int snd_hdac_acomp_get_eld(struct hdac_bus *bus, hda_nid_t nid,
1515 bool *audio_enabled, char *buffer, int max_bytes);
@@ -25,9 +25,8 @@ static inline int snd_hdac_display_power(struct hdac_bus *bus, bool enable) · 9 unmodified lines
2525 {
2626 return 0;
2727 }
28−static inline int snd_hdac_get_display_clk(struct hdac_bus *bus)
28+static inline void snd_hdac_i915_set_bclk(struct hdac_bus *bus)
2929 {
30− return 0;
3130 }
3231 static inline int snd_hdac_sync_audio_rate(struct hdac_bus *bus, hda_nid_t nid,
3332 int rate)
include/uapi/linux/v4l2-dv-timings.h+20−10
@@ -183,7 +183,8 @@ · 182 unmodified lines
183183
184184 #define V4L2_DV_BT_CEA_3840X2160P24 { \
185185 .type = V4L2_DV_BT_656_1120, \
186− V4L2_INIT_BT_TIMINGS(3840, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
186+ V4L2_INIT_BT_TIMINGS(3840, 2160, 0, \
187+ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
187188 297000000, 1276, 88, 296, 8, 10, 72, 0, 0, 0, \
188189 V4L2_DV_BT_STD_CEA861, \
189190 V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO) \
@@ -191,14 +192,16 @@ · 1 unmodified line
191192
192193 #define V4L2_DV_BT_CEA_3840X2160P25 { \
193194 .type = V4L2_DV_BT_656_1120, \
194− V4L2_INIT_BT_TIMINGS(3840, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
195+ V4L2_INIT_BT_TIMINGS(3840, 2160, 0, \
196+ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
195197 297000000, 1056, 88, 296, 8, 10, 72, 0, 0, 0, \
196198 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_IS_CE_VIDEO) \
197199 }
198200
199201 #define V4L2_DV_BT_CEA_3840X2160P30 { \
200202 .type = V4L2_DV_BT_656_1120, \
201− V4L2_INIT_BT_TIMINGS(3840, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
203+ V4L2_INIT_BT_TIMINGS(3840, 2160, 0, \
204+ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
202205 297000000, 176, 88, 296, 8, 10, 72, 0, 0, 0, \
203206 V4L2_DV_BT_STD_CEA861, \
204207 V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO) \
@@ -206,14 +209,16 @@ · 1 unmodified line
206209
207210 #define V4L2_DV_BT_CEA_3840X2160P50 { \
208211 .type = V4L2_DV_BT_656_1120, \
209− V4L2_INIT_BT_TIMINGS(3840, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
212+ V4L2_INIT_BT_TIMINGS(3840, 2160, 0, \
213+ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
210214 594000000, 1056, 88, 296, 8, 10, 72, 0, 0, 0, \
211215 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_IS_CE_VIDEO) \
212216 }
213217
214218 #define V4L2_DV_BT_CEA_3840X2160P60 { \
215219 .type = V4L2_DV_BT_656_1120, \
216− V4L2_INIT_BT_TIMINGS(3840, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
220+ V4L2_INIT_BT_TIMINGS(3840, 2160, 0, \
221+ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
217222 594000000, 176, 88, 296, 8, 10, 72, 0, 0, 0, \
218223 V4L2_DV_BT_STD_CEA861, \
219224 V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO) \
@@ -221,7 +226,8 @@ · 1 unmodified line
221226
222227 #define V4L2_DV_BT_CEA_4096X2160P24 { \
223228 .type = V4L2_DV_BT_656_1120, \
224− V4L2_INIT_BT_TIMINGS(4096, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
229+ V4L2_INIT_BT_TIMINGS(4096, 2160, 0, \
230+ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
225231 297000000, 1020, 88, 296, 8, 10, 72, 0, 0, 0, \
226232 V4L2_DV_BT_STD_CEA861, \
227233 V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO) \
@@ -229,14 +235,16 @@ · 1 unmodified line
229235
230236 #define V4L2_DV_BT_CEA_4096X2160P25 { \
231237 .type = V4L2_DV_BT_656_1120, \
232− V4L2_INIT_BT_TIMINGS(4096, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
238+ V4L2_INIT_BT_TIMINGS(4096, 2160, 0, \
239+ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
233240 297000000, 968, 88, 128, 8, 10, 72, 0, 0, 0, \
234241 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_IS_CE_VIDEO) \
235242 }
236243
237244 #define V4L2_DV_BT_CEA_4096X2160P30 { \
238245 .type = V4L2_DV_BT_656_1120, \
239− V4L2_INIT_BT_TIMINGS(4096, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
246+ V4L2_INIT_BT_TIMINGS(4096, 2160, 0, \
247+ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
240248 297000000, 88, 88, 128, 8, 10, 72, 0, 0, 0, \
241249 V4L2_DV_BT_STD_CEA861, \
242250 V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO) \
@@ -244,14 +252,16 @@ · 1 unmodified line
244252
245253 #define V4L2_DV_BT_CEA_4096X2160P50 { \
246254 .type = V4L2_DV_BT_656_1120, \
247− V4L2_INIT_BT_TIMINGS(4096, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
255+ V4L2_INIT_BT_TIMINGS(4096, 2160, 0, \
256+ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
248257 594000000, 968, 88, 128, 8, 10, 72, 0, 0, 0, \
249258 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_IS_CE_VIDEO) \
250259 }
251260
252261 #define V4L2_DV_BT_CEA_4096X2160P60 { \
253262 .type = V4L2_DV_BT_656_1120, \
254− V4L2_INIT_BT_TIMINGS(4096, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
263+ V4L2_INIT_BT_TIMINGS(4096, 2160, 0, \
264+ V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
255265 594000000, 88, 88, 128, 8, 10, 72, 0, 0, 0, \
256266 V4L2_DV_BT_STD_CEA861, \
257267 V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_IS_CE_VIDEO) \
kernel/bpf/inode.c+4−3
@@ -31,10 +31,10 @@ static void *bpf_any_get(void *raw, enum bpf_type type) · 30 unmodified lines
3131 {
3232 switch (type) {
3333 case BPF_TYPE_PROG:
34− atomic_inc(&((struct bpf_prog *)raw)->aux->refcnt);
34+ raw = bpf_prog_inc(raw);
3535 break;
3636 case BPF_TYPE_MAP:
37− bpf_map_inc(raw, true);
37+ raw = bpf_map_inc(raw, true);
3838 break;
3939 default:
4040 WARN_ON_ONCE(1);
@@ -297,7 +297,8 @@ static void *bpf_obj_do_get(const struct filename *pathname, · 256 unmodified lines
297297 goto out;
298298
299299 raw = bpf_any_get(inode->i_private, *type);
300− touch_atime(&path);
300+ if (!IS_ERR(raw))
301+ touch_atime(&path);
301302
302303 path_put(&path);
303304 return raw;
kernel/bpf/syscall.c+20−4
@@ -218,11 +218,18 @@ struct bpf_map *__bpf_map_get(struct fd f) · 217 unmodified lines
218218 return f.file->private_data;
219219 }
220220
221−void bpf_map_inc(struct bpf_map *map, bool uref)
221+/* prog's and map's refcnt limit */
222+#define BPF_MAX_REFCNT 32768
223+
224+struct bpf_map *bpf_map_inc(struct bpf_map *map, bool uref)
222225 {
223− atomic_inc(&map->refcnt);
226+ if (atomic_inc_return(&map->refcnt) > BPF_MAX_REFCNT) {
227+ atomic_dec(&map->refcnt);
228+ return ERR_PTR(-EBUSY);
229+ }
224230 if (uref)
225231 atomic_inc(&map->usercnt);
232+ return map;
226233 }
227234
228235 struct bpf_map *bpf_map_get_with_uref(u32 ufd)
@@ -234,7 +241,7 @@ struct bpf_map *bpf_map_get_with_uref(u32 ufd) · 5 unmodified lines
234241 if (IS_ERR(map))
235242 return map;
236243
237− bpf_map_inc(map, true);
244+ map = bpf_map_inc(map, true);
238245 fdput(f);
239246
240247 return map;
@@ -658,6 +665,15 @@ static struct bpf_prog *__bpf_prog_get(struct fd f) · 417 unmodified lines
658665 return f.file->private_data;
659666 }
660667
668+struct bpf_prog *bpf_prog_inc(struct bpf_prog *prog)
669+{
670+ if (atomic_inc_return(&prog->aux->refcnt) > BPF_MAX_REFCNT) {
671+ atomic_dec(&prog->aux->refcnt);
672+ return ERR_PTR(-EBUSY);
673+ }
674+ return prog;
675+}
676+
661677 /* called by sockets/tracing/seccomp before attaching program to an event
662678 * pairs with bpf_prog_put()
663679 */
@@ -670,7 +686,7 @@ struct bpf_prog *bpf_prog_get(u32 ufd) · 6 unmodified lines
670686 if (IS_ERR(prog))
671687 return prog;
672688
673− atomic_inc(&prog->aux->refcnt);
689+ prog = bpf_prog_inc(prog);
674690 fdput(f);
675691
676692 return prog;
kernel/bpf/verifier.c+47−29
@@ -249,16 +249,6 @@ static const char * const reg_type_str[] = { · 248 unmodified lines
249249 [CONST_IMM] = "imm",
250250 };
251251
252−static const struct {
253− int map_type;
254− int func_id;
255−} func_limit[] = {
256− {BPF_MAP_TYPE_PROG_ARRAY, BPF_FUNC_tail_call},
257− {BPF_MAP_TYPE_PERF_EVENT_ARRAY, BPF_FUNC_perf_event_read},
258− {BPF_MAP_TYPE_PERF_EVENT_ARRAY, BPF_FUNC_perf_event_output},
259− {BPF_MAP_TYPE_STACK_TRACE, BPF_FUNC_get_stackid},
260−};
261−
262252 static void print_verifier_state(struct verifier_env *env)
263253 {
264254 enum bpf_reg_type t;
@@ -943,27 +933,52 @@ static int check_func_arg(struct verifier_env *env, u32 regno, · 678 unmodified lines
943933
944934 static int check_map_func_compatibility(struct bpf_map *map, int func_id)
945935 {
946− bool bool_map, bool_func;
947− int i;
948−
949936 if (!map)
950937 return 0;
951938
952− for (i = 0; i < ARRAY_SIZE(func_limit); i++) {
953− bool_map = (map->map_type == func_limit[i].map_type);
954− bool_func = (func_id == func_limit[i].func_id);
955− /* only when map & func pair match it can continue.
956− * don't allow any other map type to be passed into
957− * the special func;
958− */
959− if (bool_func && bool_map != bool_func) {
960− verbose("cannot pass map_type %d into func %d\n",
961− map->map_type, func_id);
962− return -EINVAL;
963− }
939+ /* We need a two way check, first is from map perspective ... */
940+ switch (map->map_type) {
941+ case BPF_MAP_TYPE_PROG_ARRAY:
942+ if (func_id != BPF_FUNC_tail_call)
943+ goto error;
944+ break;
945+ case BPF_MAP_TYPE_PERF_EVENT_ARRAY:
946+ if (func_id != BPF_FUNC_perf_event_read &&
947+ func_id != BPF_FUNC_perf_event_output)
948+ goto error;
949+ break;
950+ case BPF_MAP_TYPE_STACK_TRACE:
951+ if (func_id != BPF_FUNC_get_stackid)
952+ goto error;
953+ break;
954+ default:
955+ break;
956+ }
957+
958+ /* ... and second from the function itself. */
959+ switch (func_id) {
960+ case BPF_FUNC_tail_call:
961+ if (map->map_type != BPF_MAP_TYPE_PROG_ARRAY)
962+ goto error;
963+ break;
964+ case BPF_FUNC_perf_event_read:
965+ case BPF_FUNC_perf_event_output:
966+ if (map->map_type != BPF_MAP_TYPE_PERF_EVENT_ARRAY)
967+ goto error;
968+ break;
969+ case BPF_FUNC_get_stackid:
970+ if (map->map_type != BPF_MAP_TYPE_STACK_TRACE)
971+ goto error;
972+ break;
973+ default:
974+ break;
964975 }
965976
966977 return 0;
978+error:
979+ verbose("cannot pass map_type %d into func %d\n",
980+ map->map_type, func_id);
981+ return -EINVAL;
967982 }
968983
969984 static int check_raw_mode(const struct bpf_func_proto *fn)
@@ -2111,15 +2126,18 @@ static int replace_map_fd_with_map_ptr(struct verifier_env *env) · 1141 unmodified lines
21112126 return -E2BIG;
21122127 }
21132128
2114− /* remember this map */
2115− env->used_maps[env->used_map_cnt++] = map;
2116−
21172129 /* hold the map. If the program is rejected by verifier,
21182130 * the map will be released by release_maps() or it
21192131 * will be used by the valid program until it's unloaded
21202132 * and all maps are released in free_bpf_prog_info()
21212133 */
2122− bpf_map_inc(map, false);
2134+ map = bpf_map_inc(map, false);
2135+ if (IS_ERR(map)) {
2136+ fdput(f);
2137+ return PTR_ERR(map);
2138+ }
2139+ env->used_maps[env->used_map_cnt++] = map;
2140+
21232141 fdput(f);
21242142 next_insn:
21252143 insn++;
kernel/cgroup.c+5−2
@@ -2825,9 +2825,10 @@ static ssize_t __cgroup_procs_write(struct kernfs_open_file *of, char *buf, · 2824 unmodified lines
28252825 size_t nbytes, loff_t off, bool threadgroup)
28262826 {
28272827 struct task_struct *tsk;
2828+ struct cgroup_subsys *ss;
28282829 struct cgroup *cgrp;
28292830 pid_t pid;
2830− int ret;
2831+ int ssid, ret;
28312832
28322833 if (kstrtoint(strstrip(buf), 0, &pid) || pid < 0)
28332834 return -EINVAL;
@@ -2875,8 +2876,10 @@ out_unlock_rcu: · 41 unmodified lines
28752876 rcu_read_unlock();
28762877 out_unlock_threadgroup:
28772878 percpu_up_write(&cgroup_threadgroup_rwsem);
2879+ for_each_subsys(ss, ssid)
2880+ if (ss->post_attach)
2881+ ss->post_attach();
28782882 cgroup_kn_unlock(of->kn);
2879− cpuset_post_attach_flush();
28802883 return ret ?: nbytes;
28812884 }
28822885
kernel/cpuset.c+2−2
@@ -58,7 +58,6 @@ · 57 unmodified lines
5858 #include <asm/uaccess.h>
5959 #include <linux/atomic.h>
6060 #include <linux/mutex.h>
61−#include <linux/workqueue.h>
6261 #include <linux/cgroup.h>
6362 #include <linux/wait.h>
6463
@@ -1016,7 +1015,7 @@ static void cpuset_migrate_mm(struct mm_struct *mm, const nodemask_t *from, · 951 unmodified lines
10161015 }
10171016 }
10181017
1019−void cpuset_post_attach_flush(void)
1018+static void cpuset_post_attach(void)
10201019 {
10211020 flush_workqueue(cpuset_migrate_mm_wq);
10221021 }
@@ -2087,6 +2086,7 @@ struct cgroup_subsys cpuset_cgrp_subsys = { · 1064 unmodified lines
20872086 .can_attach = cpuset_can_attach,
20882087 .cancel_attach = cpuset_cancel_attach,
20892088 .attach = cpuset_attach,
2089+ .post_attach = cpuset_post_attach,
20902090 .bind = cpuset_bind,
20912091 .legacy_cftypes = files,
20922092 .early_init = true,
kernel/events/core.c+38−17
@@ -412,7 +412,8 @@ int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write, · 411 unmodified lines
412412 if (ret || !write)
413413 return ret;
414414
415− if (sysctl_perf_cpu_time_max_percent == 100) {
415+ if (sysctl_perf_cpu_time_max_percent == 100 ||
416+ sysctl_perf_cpu_time_max_percent == 0) {
416417 printk(KERN_WARNING
417418 "perf: Dynamic interrupt throttling disabled, can hang your system!\n");
418419 WRITE_ONCE(perf_sample_allowed_ns, 0);
@@ -1105,6 +1106,7 @@ static void put_ctx(struct perf_event_context *ctx) · 686 unmodified lines
11051106 * function.
11061107 *
11071108 * Lock order:
1109+ * cred_guard_mutex
11081110 * task_struct::perf_event_mutex
11091111 * perf_event_context::mutex
11101112 * perf_event::child_mutex;
@@ -3420,7 +3422,6 @@ static struct task_struct * · 2309 unmodified lines
34203422 find_lively_task_by_vpid(pid_t vpid)
34213423 {
34223424 struct task_struct *task;
3423− int err;
34243425
34253426 rcu_read_lock();
34263427 if (!vpid)
@@ -3434,16 +3435,7 @@ find_lively_task_by_vpid(pid_t vpid) · 7 unmodified lines
34343435 if (!task)
34353436 return ERR_PTR(-ESRCH);
34363437
3437− /* Reuse ptrace permission checks for now. */
3438− err = -EACCES;
3439− if (!ptrace_may_access(task, PTRACE_MODE_READ_REALCREDS))
3440− goto errout;
3441−
34423438 return task;
3443−errout:
3444− put_task_struct(task);
3445− return ERR_PTR(err);
3446−
34473439 }
34483440
34493441 /*
@@ -8446,6 +8438,24 @@ SYSCALL_DEFINE5(perf_event_open, · 4996 unmodified lines
84468438
84478439 get_online_cpus();
84488440
8441+ if (task) {
8442+ err = mutex_lock_interruptible(&task->signal->cred_guard_mutex);
8443+ if (err)
8444+ goto err_cpus;
8445+
8446+ /*
8447+ * Reuse ptrace permission checks for now.
8448+ *
8449+ * We must hold cred_guard_mutex across this and any potential
8450+ * perf_install_in_context() call for this new event to
8451+ * serialize against exec() altering our credentials (and the
8452+ * perf_event_exit_task() that could imply).
8453+ */
8454+ err = -EACCES;
8455+ if (!ptrace_may_access(task, PTRACE_MODE_READ_REALCREDS))
8456+ goto err_cred;
8457+ }
8458+
84498459 if (flags & PERF_FLAG_PID_CGROUP)
84508460 cgroup_fd = pid;
84518461
@@ -8453,7 +8463,7 @@ SYSCALL_DEFINE5(perf_event_open, · 1 unmodified line
84538463 NULL, NULL, cgroup_fd);
84548464 if (IS_ERR(event)) {
84558465 err = PTR_ERR(event);
8456− goto err_cpus;
8466+ goto err_cred;
84578467 }
84588468
84598469 if (is_sampling_event(event)) {
@@ -8512,11 +8522,6 @@ SYSCALL_DEFINE5(perf_event_open, · 52 unmodified lines
85128522 goto err_context;
85138523 }
85148524
8515− if (task) {
8516− put_task_struct(task);
8517− task = NULL;
8518− }
8519−
85208525 /*
85218526 * Look up the group leader (we will attach this event to it):
85228527 */
@@ -8614,6 +8619,11 @@ SYSCALL_DEFINE5(perf_event_open, · 91 unmodified lines
86148619
86158620 WARN_ON_ONCE(ctx->parent_ctx);
86168621
8622+ /*
8623+ * This is the point on no return; we cannot fail hereafter. This is
8624+ * where we start modifying current state.
8625+ */
8626+
86178627 if (move_group) {
86188628 /*
86198629 * See perf_event_ctx_lock() for comments on the details
@@ -8685,6 +8695,11 @@ SYSCALL_DEFINE5(perf_event_open, · 65 unmodified lines
86858695 mutex_unlock(&gctx->mutex);
86868696 mutex_unlock(&ctx->mutex);
86878697
8698+ if (task) {
8699+ mutex_unlock(&task->signal->cred_guard_mutex);
8700+ put_task_struct(task);
8701+ }
8702+
86888703 put_online_cpus();
86898704
86908705 mutex_lock(&current->perf_event_mutex);
@@ -8717,6 +8732,9 @@ err_alloc: · 26 unmodified lines
87178732 */
87188733 if (!event_file)
87198734 free_event(event);
8735+err_cred:
8736+ if (task)
8737+ mutex_unlock(&task->signal->cred_guard_mutex);
87208738 err_cpus:
87218739 put_online_cpus();
87228740 err_task:
@@ -9001,6 +9019,9 @@ static void perf_event_exit_task_context(struct task_struct *child, int ctxn) · 278 unmodified lines
90019019
90029020 /*
90039021 * When a child task exits, feed back event values to parent events.
9022+ *
9023+ * Can be called with cred_guard_mutex held when called from
9024+ * install_exec_creds().
90049025 */
90059026 void perf_event_exit_task(struct task_struct *child)
90069027 {
kernel/kcov.c+2−1
@@ -1,5 +1,6 @@
11 #define pr_fmt(fmt) "kcov: " fmt
22
3+#define DISABLE_BRANCH_PROFILING
34 #include <linux/compiler.h>
45 #include <linux/types.h>
56 #include <linux/file.h>
@@ -43,7 +44,7 @@ struct kcov { · 37 unmodified lines
4344 * Entry point from instrumented code.
4445 * This is called once per basic-block/edge.
4546 */
46−void __sanitizer_cov_trace_pc(void)
47+void notrace __sanitizer_cov_trace_pc(void)
4748 {
4849 struct task_struct *t;
4950 enum kcov_mode mode;
kernel/kexec_core.c+5−2
@@ -1415,6 +1415,9 @@ static int __init crash_save_vmcoreinfo_init(void) · 1414 unmodified lines
14151415 VMCOREINFO_OFFSET(page, lru);
14161416 VMCOREINFO_OFFSET(page, _mapcount);
14171417 VMCOREINFO_OFFSET(page, private);
1418+ VMCOREINFO_OFFSET(page, compound_dtor);
1419+ VMCOREINFO_OFFSET(page, compound_order);
1420+ VMCOREINFO_OFFSET(page, compound_head);
14181421 VMCOREINFO_OFFSET(pglist_data, node_zones);
14191422 VMCOREINFO_OFFSET(pglist_data, nr_zones);
14201423 #ifdef CONFIG_FLAT_NODE_MEM_MAP
@@ -1447,8 +1450,8 @@ static int __init crash_save_vmcoreinfo_init(void) · 26 unmodified lines
14471450 #ifdef CONFIG_X86
14481451 VMCOREINFO_NUMBER(KERNEL_IMAGE_SIZE);
14491452 #endif
1450−#ifdef CONFIG_HUGETLBFS
1451− VMCOREINFO_SYMBOL(free_huge_page);
1453+#ifdef CONFIG_HUGETLB_PAGE
1454+ VMCOREINFO_NUMBER(HUGETLB_PAGE_DTOR);
14521455 #endif
14531456
14541457 arch_crash_save_vmcoreinfo();
kernel/locking/lockdep.c+34−3
@@ -2176,15 +2176,37 @@ cache_hit: · 2175 unmodified lines
21762176 chain->irq_context = hlock->irq_context;
21772177 i = get_first_held_lock(curr, hlock);
21782178 chain->depth = curr->lockdep_depth + 1 - i;
2179+
2180+ BUILD_BUG_ON((1UL << 24) <= ARRAY_SIZE(chain_hlocks));
2181+ BUILD_BUG_ON((1UL << 6) <= ARRAY_SIZE(curr->held_locks));
2182+ BUILD_BUG_ON((1UL << 8*sizeof(chain_hlocks[0])) <= ARRAY_SIZE(lock_classes));
2183+
21792184 if (likely(nr_chain_hlocks + chain->depth <= MAX_LOCKDEP_CHAIN_HLOCKS)) {
21802185 chain->base = nr_chain_hlocks;
2181− nr_chain_hlocks += chain->depth;
21822186 for (j = 0; j < chain->depth - 1; j++, i++) {
21832187 int lock_id = curr->held_locks[i].class_idx - 1;
21842188 chain_hlocks[chain->base + j] = lock_id;
21852189 }
21862190 chain_hlocks[chain->base + j] = class - lock_classes;
21872191 }
2192+
2193+ if (nr_chain_hlocks < MAX_LOCKDEP_CHAIN_HLOCKS)
2194+ nr_chain_hlocks += chain->depth;
2195+
2196+#ifdef CONFIG_DEBUG_LOCKDEP
2197+ /*
2198+ * Important for check_no_collision().
2199+ */
2200+ if (unlikely(nr_chain_hlocks > MAX_LOCKDEP_CHAIN_HLOCKS)) {
2201+ if (debug_locks_off_graph_unlock())
2202+ return 0;
2203+
2204+ print_lockdep_off("BUG: MAX_LOCKDEP_CHAIN_HLOCKS too low!");
2205+ dump_stack();
2206+ return 0;
2207+ }
2208+#endif
2209+
21882210 hlist_add_head_rcu(&chain->entry, hash_head);
21892211 debug_atomic_inc(chain_lookup_misses);
21902212 inc_chains();
@@ -2932,6 +2954,11 @@ static int mark_irqflags(struct task_struct *curr, struct held_lock *hlock) · 741 unmodified lines
29322954 return 1;
29332955 }
29342956
2957+static inline unsigned int task_irq_context(struct task_struct *task)
2958+{
2959+ return 2 * !!task->hardirq_context + !!task->softirq_context;
2960+}
2961+
29352962 static int separate_irq_context(struct task_struct *curr,
29362963 struct held_lock *hlock)
29372964 {
@@ -2940,8 +2967,6 @@ static int separate_irq_context(struct task_struct *curr, · 2 unmodified lines
29402967 /*
29412968 * Keep track of points where we cross into an interrupt context:
29422969 */
2943− hlock->irq_context = 2*(curr->hardirq_context ? 1 : 0) +
2944− curr->softirq_context;
29452970 if (depth) {
29462971 struct held_lock *prev_hlock;
29472972
@@ -2973,6 +2998,11 @@ static inline int mark_irqflags(struct task_struct *curr, · 25 unmodified lines
29732998 return 1;
29742999 }
29753000
3001+static inline unsigned int task_irq_context(struct task_struct *task)
3002+{
3003+ return 0;
3004+}
3005+
29763006 static inline int separate_irq_context(struct task_struct *curr,
29773007 struct held_lock *hlock)
29783008 {
@@ -3241,6 +3271,7 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass, · 262 unmodified lines
32413271 hlock->acquire_ip = ip;
32423272 hlock->instance = lock;
32433273 hlock->nest_lock = nest_lock;
3274+ hlock->irq_context = task_irq_context(curr);
32443275 hlock->trylock = trylock;
32453276 hlock->read = read;
32463277 hlock->check = check;
kernel/locking/lockdep_proc.c+2−0
@@ -141,6 +141,8 @@ static int lc_show(struct seq_file *m, void *v) · 140 unmodified lines
141141 int i;
142142
143143 if (v == SEQ_START_TOKEN) {
144+ if (nr_chain_hlocks > MAX_LOCKDEP_CHAIN_HLOCKS)
145+ seq_printf(m, "(buggered) ");
144146 seq_printf(m, "all lock chains:\n");
145147 return 0;
146148 }
kernel/workqueue.c+29−0
@@ -666,6 +666,35 @@ static void set_work_pool_and_clear_pending(struct work_struct *work, · 665 unmodified lines
666666 */
667667 smp_wmb();
668668 set_work_data(work, (unsigned long)pool_id << WORK_OFFQ_POOL_SHIFT, 0);
669+ /*
670+ * The following mb guarantees that previous clear of a PENDING bit
671+ * will not be reordered with any speculative LOADS or STORES from
672+ * work->current_func, which is executed afterwards. This possible
673+ * reordering can lead to a missed execution on attempt to qeueue
674+ * the same @work. E.g. consider this case:
675+ *
676+ * CPU#0 CPU#1
677+ * ---------------------------- --------------------------------
678+ *
679+ * 1 STORE event_indicated
680+ * 2 queue_work_on() {
681+ * 3 test_and_set_bit(PENDING)
682+ * 4 } set_..._and_clear_pending() {
683+ * 5 set_work_data() # clear bit
684+ * 6 smp_mb()
685+ * 7 work->current_func() {
686+ * 8 LOAD event_indicated
687+ * }
688+ *
689+ * Without an explicit full barrier speculative LOAD on line 8 can
690+ * be executed before CPU#0 does STORE on line 1. If that happens,
691+ * CPU#0 observes the PENDING bit is still set and new execution of
692+ * a @work is not queued in a hope, that CPU#1 will eventually
693+ * finish the queued @work. Meanwhile CPU#1 does not see
694+ * event_indicated is set, because speculative LOAD was executed
695+ * before actual STORE.
696+ */
697+ smp_mb();
669698 }
670699
671700 static void clear_work_data(struct work_struct *work)
lib/stackdepot.c+0−4
@@ -210,10 +210,6 @@ depot_stack_handle_t depot_save_stack(struct stack_trace *trace, · 209 unmodified lines
210210 goto fast_exit;
211211
212212 hash = hash_stack(trace->entries, trace->nr_entries);
213− /* Bad luck, we won't store this stack. */
214− if (hash == 0)
215− goto exit;
216−
217213 bucket = &stack_table[hash & STACK_HASH_MASK];
218214
219215 /*
mm/huge_memory.c+5−7
@@ -232,7 +232,7 @@ retry: · 231 unmodified lines
232232 return READ_ONCE(huge_zero_page);
233233 }
234234
235−static void put_huge_zero_page(void)
235+void put_huge_zero_page(void)
236236 {
237237 /*
238238 * Counter should never go to zero here. Only shrinker can put
@@ -1684,12 +1684,12 @@ int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, · 1445 unmodified lines
16841684 if (vma_is_dax(vma)) {
16851685 spin_unlock(ptl);
16861686 if (is_huge_zero_pmd(orig_pmd))
1687− put_huge_zero_page();
1687+ tlb_remove_page(tlb, pmd_page(orig_pmd));
16881688 } else if (is_huge_zero_pmd(orig_pmd)) {
16891689 pte_free(tlb->mm, pgtable_trans_huge_withdraw(tlb->mm, pmd));
16901690 atomic_long_dec(&tlb->mm->nr_ptes);
16911691 spin_unlock(ptl);
1692− put_huge_zero_page();
1692+ tlb_remove_page(tlb, pmd_page(orig_pmd));
16931693 } else {
16941694 struct page *page = pmd_page(orig_pmd);
16951695 page_remove_rmap(page, true);
@@ -1960,10 +1960,9 @@ int khugepaged_enter_vma_merge(struct vm_area_struct *vma, · 264 unmodified lines
19601960 * page fault if needed.
19611961 */
19621962 return 0;
1963− if (vma->vm_ops)
1963+ if (vma->vm_ops || (vm_flags & VM_NO_THP))
19641964 /* khugepaged not yet working on file or special mappings */
19651965 return 0;
1966− VM_BUG_ON_VMA(vm_flags & VM_NO_THP, vma);
19671966 hstart = (vma->vm_start + ~HPAGE_PMD_MASK) & HPAGE_PMD_MASK;
19681967 hend = vma->vm_end & HPAGE_PMD_MASK;
19691968 if (hstart < hend)
@@ -2352,8 +2351,7 @@ static bool hugepage_vma_check(struct vm_area_struct *vma) · 382 unmodified lines
23522351 return false;
23532352 if (is_vma_temporary_stack(vma))
23542353 return false;
2355− VM_BUG_ON_VMA(vma->vm_flags & VM_NO_THP, vma);
2356− return true;
2354+ return !(vma->vm_flags & VM_NO_THP);
23572355 }
23582356
23592357 static void collapse_huge_page(struct mm_struct *mm,
mm/memcontrol.c+19−18
@@ -207,6 +207,7 @@ static void mem_cgroup_oom_notify(struct mem_cgroup *memcg); · 206 unmodified lines
207207 /* "mc" and its members are protected by cgroup_mutex */
208208 static struct move_charge_struct {
209209 spinlock_t lock; /* for from, to */
210+ struct mm_struct *mm;
210211 struct mem_cgroup *from;
211212 struct mem_cgroup *to;
212213 unsigned long flags;
@@ -4667,6 +4668,8 @@ static void __mem_cgroup_clear_mc(void) · 4454 unmodified lines
46674668
46684669 static void mem_cgroup_clear_mc(void)
46694670 {
4671+ struct mm_struct *mm = mc.mm;
4672+
46704673 /*
46714674 * we must clear moving_task before waking up waiters at the end of
46724675 * task migration.
@@ -4676,7 +4679,10 @@ static void mem_cgroup_clear_mc(void) · 3 unmodified lines
46764679 spin_lock(&mc.lock);
46774680 mc.from = NULL;
46784681 mc.to = NULL;
4682+ mc.mm = NULL;
46794683 spin_unlock(&mc.lock);
4684+
4685+ mmput(mm);
46804686 }
46814687
46824688 static int mem_cgroup_can_attach(struct cgroup_taskset *tset)
@@ -4733,6 +4739,7 @@ static int mem_cgroup_can_attach(struct cgroup_taskset *tset) · 50 unmodified lines
47334739 VM_BUG_ON(mc.moved_swap);
47344740
47354741 spin_lock(&mc.lock);
4742+ mc.mm = mm;
47364743 mc.from = from;
47374744 mc.to = memcg;
47384745 mc.flags = move_flags;
@@ -4742,8 +4749,9 @@ static int mem_cgroup_can_attach(struct cgroup_taskset *tset) · 3 unmodified lines
47424749 ret = mem_cgroup_precharge_mc(mm);
47434750 if (ret)
47444751 mem_cgroup_clear_mc();
4752+ } else {
4753+ mmput(mm);
47454754 }
4746− mmput(mm);
47474755 return ret;
47484756 }
47494757
@@ -4852,11 +4860,11 @@ put: /* get_mctgt_type() gets the page */ · 102 unmodified lines
48524860 return ret;
48534861 }
48544862
4855−static void mem_cgroup_move_charge(struct mm_struct *mm)
4863+static void mem_cgroup_move_charge(void)
48564864 {
48574865 struct mm_walk mem_cgroup_move_charge_walk = {
48584866 .pmd_entry = mem_cgroup_move_charge_pte_range,
4859− .mm = mm,
4867+ .mm = mc.mm,
48604868 };
48614869
48624870 lru_add_drain_all();
@@ -4868,7 +4876,7 @@ static void mem_cgroup_move_charge(struct mm_struct *mm) · 5 unmodified lines
48684876 atomic_inc(&mc.from->moving_account);
48694877 synchronize_rcu();
48704878 retry:
4871− if (unlikely(!down_read_trylock(&mm->mmap_sem))) {
4879+ if (unlikely(!down_read_trylock(&mc.mm->mmap_sem))) {
48724880 /*
48734881 * Someone who are holding the mmap_sem might be waiting in
48744882 * waitq. So we cancel all extra charges, wake up all waiters,
@@ -4885,23 +4893,16 @@ retry: · 10 unmodified lines
48854893 * additional charge, the page walk just aborts.
48864894 */
48874895 walk_page_range(0, ~0UL, &mem_cgroup_move_charge_walk);
4888− up_read(&mm->mmap_sem);
4896+ up_read(&mc.mm->mmap_sem);
48894897 atomic_dec(&mc.from->moving_account);
48904898 }
48914899
4892−static void mem_cgroup_move_task(struct cgroup_taskset *tset)
4900+static void mem_cgroup_move_task(void)
48934901 {
4894− struct cgroup_subsys_state *css;
4895− struct task_struct *p = cgroup_taskset_first(tset, &css);
4896− struct mm_struct *mm = get_task_mm(p);
4897−
4898− if (mm) {
4899− if (mc.to)
4900− mem_cgroup_move_charge(mm);
4901− mmput(mm);
4902− }
4903− if (mc.to)
4902+ if (mc.to) {
4903+ mem_cgroup_move_charge();
49044904 mem_cgroup_clear_mc();
4905+ }
49054906 }
49064907 #else /* !CONFIG_MMU */
49074908 static int mem_cgroup_can_attach(struct cgroup_taskset *tset)
@@ -4911,7 +4912,7 @@ static int mem_cgroup_can_attach(struct cgroup_taskset *tset) · 3 unmodified lines
49114912 static void mem_cgroup_cancel_attach(struct cgroup_taskset *tset)
49124913 {
49134914 }
4914−static void mem_cgroup_move_task(struct cgroup_taskset *tset)
4915+static void mem_cgroup_move_task(void)
49154916 {
49164917 }
49174918 #endif
@@ -5195,7 +5196,7 @@ struct cgroup_subsys memory_cgrp_subsys = { · 277 unmodified lines
51955196 .css_reset = mem_cgroup_css_reset,
51965197 .can_attach = mem_cgroup_can_attach,
51975198 .cancel_attach = mem_cgroup_cancel_attach,
5198− .attach = mem_cgroup_move_task,
5199+ .post_attach = mem_cgroup_move_task,
51995200 .bind = mem_cgroup_bind,
52005201 .dfl_cftypes = memory_files,
52015202 .legacy_cftypes = mem_cgroup_legacy_files,
mm/memory-failure.c+9−1
@@ -888,7 +888,15 @@ int get_hwpoison_page(struct page *page) · 887 unmodified lines
888888 }
889889 }
890890
891− return get_page_unless_zero(head);
891+ if (get_page_unless_zero(head)) {
892+ if (head == compound_head(page))
893+ return 1;
894+
895+ pr_info("MCE: %#lx cannot catch tail\n", page_to_pfn(page));
896+ put_page(head);
897+ }
898+
899+ return 0;
892900 }
893901 EXPORT_SYMBOL_GPL(get_hwpoison_page);
894902
mm/memory.c+40−0
@@ -789,6 +789,46 @@ out: · 788 unmodified lines
789789 return pfn_to_page(pfn);
790790 }
791791
792+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
793+struct page *vm_normal_page_pmd(struct vm_area_struct *vma, unsigned long addr,
794+ pmd_t pmd)
795+{
796+ unsigned long pfn = pmd_pfn(pmd);
797+
798+ /*
799+ * There is no pmd_special() but there may be special pmds, e.g.
800+ * in a direct-access (dax) mapping, so let's just replicate the
801+ * !HAVE_PTE_SPECIAL case from vm_normal_page() here.
802+ */
803+ if (unlikely(vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP))) {
804+ if (vma->vm_flags & VM_MIXEDMAP) {
805+ if (!pfn_valid(pfn))
806+ return NULL;
807+ goto out;
808+ } else {
809+ unsigned long off;
810+ off = (addr - vma->vm_start) >> PAGE_SHIFT;
811+ if (pfn == vma->vm_pgoff + off)
812+ return NULL;
813+ if (!is_cow_mapping(vma->vm_flags))
814+ return NULL;
815+ }
816+ }
817+
818+ if (is_zero_pfn(pfn))
819+ return NULL;
820+ if (unlikely(pfn > highest_memmap_pfn))
821+ return NULL;
822+
823+ /*
824+ * NOTE! We still have PageReserved() pages in the page tables.
825+ * eg. VDSO mappings can cause them to exist.
826+ */
827+out:
828+ return pfn_to_page(pfn);
829+}
830+#endif
831+
792832 /*
793833 * copy one vm_area from one task to the other. Assumes the page tables
794834 * already present in the new task to be cleared in the whole range
mm/migrate.c+7−1
@@ -975,7 +975,13 @@ out: · 974 unmodified lines
975975 dec_zone_page_state(page, NR_ISOLATED_ANON +
976976 page_is_file_cache(page));
977977 /* Soft-offlined page shouldn't go through lru cache list */
978− if (reason == MR_MEMORY_FAILURE) {
978+ if (reason == MR_MEMORY_FAILURE && rc == MIGRATEPAGE_SUCCESS) {
979+ /*
980+ * With this release, we free successfully migrated
981+ * page and set PG_HWPoison on just freed page
982+ * intentionally. Although it's rather weird, it's how
983+ * HWPoison flag works at the moment.
984+ */
979985 put_page(page);
980986 if (!test_set_page_hwpoison(page))
981987 num_poisoned_pages_inc();
mm/page_io.c+5−1
@@ -353,7 +353,11 @@ int swap_readpage(struct page *page) · 352 unmodified lines
353353
354354 ret = bdev_read_page(sis->bdev, swap_page_sector(page), page);
355355 if (!ret) {
356− swap_slot_free_notify(page);
356+ if (trylock_page(page)) {
357+ swap_slot_free_notify(page);
358+ unlock_page(page);
359+ }
360+
357361 count_vm_event(PSWPIN);
358362 return 0;
359363 }
mm/swap.c+5−0
@@ -728,6 +728,11 @@ void release_pages(struct page **pages, int nr, bool cold) · 727 unmodified lines
728728 zone = NULL;
729729 }
730730
731+ if (is_huge_zero_page(page)) {
732+ put_huge_zero_page();
733+ continue;
734+ }
735+
731736 page = compound_head(page);
732737 if (!put_page_testzero(page))
733738 continue;
mm/vmscan.c+15−15
@@ -2553,7 +2553,7 @@ static bool shrink_zones(struct zonelist *zonelist, struct scan_control *sc) · 2552 unmodified lines
25532553 sc->gfp_mask |= __GFP_HIGHMEM;
25542554
25552555 for_each_zone_zonelist_nodemask(zone, z, zonelist,
2556− requested_highidx, sc->nodemask) {
2556+ gfp_zone(sc->gfp_mask), sc->nodemask) {
25572557 enum zone_type classzone_idx;
25582558
25592559 if (!populated_zone(zone))
@@ -3318,6 +3318,20 @@ static void kswapd_try_to_sleep(pg_data_t *pgdat, int order, · 758 unmodified lines
33183318 /* Try to sleep for a short interval */
33193319 if (prepare_kswapd_sleep(pgdat, order, remaining,
33203320 balanced_classzone_idx)) {
3321+ /*
3322+ * Compaction records what page blocks it recently failed to
3323+ * isolate pages from and skips them in the future scanning.
3324+ * When kswapd is going to sleep, it is reasonable to assume
3325+ * that pages and compaction may succeed so reset the cache.
3326+ */
3327+ reset_isolation_suitable(pgdat);
3328+
3329+ /*
3330+ * We have freed the memory, now we should compact it to make
3331+ * allocation of the requested order possible.
3332+ */
3333+ wakeup_kcompactd(pgdat, order, classzone_idx);
3334+
33213335 remaining = schedule_timeout(HZ/10);
33223336 finish_wait(&pgdat->kswapd_wait, &wait);
33233337 prepare_to_wait(&pgdat->kswapd_wait, &wait, TASK_INTERRUPTIBLE);
@@ -3341,20 +3355,6 @@ static void kswapd_try_to_sleep(pg_data_t *pgdat, int order, · 17 unmodified lines
33413355 */
33423356 set_pgdat_percpu_threshold(pgdat, calculate_normal_threshold);
33433357
3344− /*
3345− * Compaction records what page blocks it recently failed to
3346− * isolate pages from and skips them in the future scanning.
3347− * When kswapd is going to sleep, it is reasonable to assume
3348− * that pages and compaction may succeed so reset the cache.
3349− */
3350− reset_isolation_suitable(pgdat);
3351−
3352− /*
3353− * We have freed the memory, now we should compact it to make
3354− * allocation of the requested order possible.
3355− */
3356− wakeup_kcompactd(pgdat, order, classzone_idx);
3357−
33583358 if (!kthread_should_stop())
33593359 schedule();
33603360
net/batman-adv/bat_v.c+12−0
@@ -32,10 +32,21 @@ · 31 unmodified lines
3232
3333 #include "bat_v_elp.h"
3434 #include "bat_v_ogm.h"
35+#include "hard-interface.h"
3536 #include "hash.h"
3637 #include "originator.h"
3738 #include "packet.h"
3839
40+static void batadv_v_iface_activate(struct batadv_hard_iface *hard_iface)
41+{
42+ /* B.A.T.M.A.N. V does not use any queuing mechanism, therefore it can
43+ * set the interface as ACTIVE right away, without any risk of race
44+ * condition
45+ */
46+ if (hard_iface->if_status == BATADV_IF_TO_BE_ACTIVATED)
47+ hard_iface->if_status = BATADV_IF_ACTIVE;
48+}
49+
3950 static int batadv_v_iface_enable(struct batadv_hard_iface *hard_iface)
4051 {
4152 int ret;
@@ -274,6 +285,7 @@ static bool batadv_v_neigh_is_sob(struct batadv_neigh_node *neigh1, · 232 unmodified lines
274285
275286 static struct batadv_algo_ops batadv_batman_v __read_mostly = {
276287 .name = "BATMAN_V",
288+ .bat_iface_activate = batadv_v_iface_activate,
277289 .bat_iface_enable = batadv_v_iface_enable,
278290 .bat_iface_disable = batadv_v_iface_disable,
279291 .bat_iface_update_mac = batadv_v_iface_update_mac,
net/batman-adv/distributed-arp-table.c+10−7
@@ -568,6 +568,7 @@ static void batadv_choose_next_candidate(struct batadv_priv *bat_priv, · 567 unmodified lines
568568 * be sent to
569569 * @bat_priv: the bat priv with all the soft interface information
570570 * @ip_dst: ipv4 to look up in the DHT
571+ * @vid: VLAN identifier
571572 *
572573 * An originator O is selected if and only if its DHT_ID value is one of three
573574 * closest values (from the LEFT, with wrap around if needed) then the hash
@@ -576,7 +577,8 @@ static void batadv_choose_next_candidate(struct batadv_priv *bat_priv, · 2 unmodified lines
576577 * Return: the candidate array of size BATADV_DAT_CANDIDATE_NUM.
577578 */
578579 static struct batadv_dat_candidate *
579−batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst)
580+batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst,
581+ unsigned short vid)
580582 {
581583 int select;
582584 batadv_dat_addr_t last_max = BATADV_DAT_ADDR_MAX, ip_key;
@@ -592,7 +594,7 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst) · 9 unmodified lines
592594 return NULL;
593595
594596 dat.ip = ip_dst;
595− dat.vid = 0;
597+ dat.vid = vid;
596598 ip_key = (batadv_dat_addr_t)batadv_hash_dat(&dat,
597599 BATADV_DAT_ADDR_MAX);
598600
@@ -612,6 +614,7 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst) · 13 unmodified lines
612614 * @bat_priv: the bat priv with all the soft interface information
613615 * @skb: payload to send
614616 * @ip: the DHT key
617+ * @vid: VLAN identifier
615618 * @packet_subtype: unicast4addr packet subtype to use
616619 *
617620 * This function copies the skb with pskb_copy() and is sent as unicast packet
@@ -622,7 +625,7 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst) · 4 unmodified lines
622625 */
623626 static bool batadv_dat_send_data(struct batadv_priv *bat_priv,
624627 struct sk_buff *skb, __be32 ip,
625− int packet_subtype)
628+ unsigned short vid, int packet_subtype)
626629 {
627630 int i;
628631 bool ret = false;
@@ -631,7 +634,7 @@ static bool batadv_dat_send_data(struct batadv_priv *bat_priv, · 2 unmodified lines
631634 struct sk_buff *tmp_skb;
632635 struct batadv_dat_candidate *cand;
633636
634− cand = batadv_dat_select_candidates(bat_priv, ip);
637+ cand = batadv_dat_select_candidates(bat_priv, ip, vid);
635638 if (!cand)
636639 goto out;
637640
@@ -1022,7 +1025,7 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv, · 384 unmodified lines
10221025 ret = true;
10231026 } else {
10241027 /* Send the request to the DHT */
1025− ret = batadv_dat_send_data(bat_priv, skb, ip_dst,
1028+ ret = batadv_dat_send_data(bat_priv, skb, ip_dst, vid,
10261029 BATADV_P_DAT_DHT_GET);
10271030 }
10281031 out:
@@ -1150,8 +1153,8 @@ void batadv_dat_snoop_outgoing_arp_reply(struct batadv_priv *bat_priv, · 121 unmodified lines
11501153 /* Send the ARP reply to the candidates for both the IP addresses that
11511154 * the node obtained from the ARP reply
11521155 */
1153− batadv_dat_send_data(bat_priv, skb, ip_src, BATADV_P_DAT_DHT_PUT);
1154− batadv_dat_send_data(bat_priv, skb, ip_dst, BATADV_P_DAT_DHT_PUT);
1156+ batadv_dat_send_data(bat_priv, skb, ip_src, vid, BATADV_P_DAT_DHT_PUT);
1157+ batadv_dat_send_data(bat_priv, skb, ip_dst, vid, BATADV_P_DAT_DHT_PUT);
11551158 }
11561159
11571160 /**
net/batman-adv/hard-interface.c+4−2
@@ -407,6 +407,9 @@ batadv_hardif_activate_interface(struct batadv_hard_iface *hard_iface) · 406 unmodified lines
407407
408408 batadv_update_min_mtu(hard_iface->soft_iface);
409409
410+ if (bat_priv->bat_algo_ops->bat_iface_activate)
411+ bat_priv->bat_algo_ops->bat_iface_activate(hard_iface);
412+
410413 out:
411414 if (primary_if)
412415 batadv_hardif_put(primary_if);
@@ -572,8 +575,7 @@ void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface, · 159 unmodified lines
572575 struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);
573576 struct batadv_hard_iface *primary_if = NULL;
574577
575− if (hard_iface->if_status == BATADV_IF_ACTIVE)
576− batadv_hardif_deactivate_interface(hard_iface);
578+ batadv_hardif_deactivate_interface(hard_iface);
577579
578580 if (hard_iface->if_status != BATADV_IF_INACTIVE)
579581 goto out;
net/batman-adv/originator.c+6−11
@@ -250,7 +250,6 @@ static void batadv_neigh_node_release(struct kref *ref) · 249 unmodified lines
250250 {
251251 struct hlist_node *node_tmp;
252252 struct batadv_neigh_node *neigh_node;
253− struct batadv_hardif_neigh_node *hardif_neigh;
254253 struct batadv_neigh_ifinfo *neigh_ifinfo;
255254 struct batadv_algo_ops *bao;
256255
@@ -262,13 +261,7 @@ static void batadv_neigh_node_release(struct kref *ref) · 5 unmodified lines
262261 batadv_neigh_ifinfo_put(neigh_ifinfo);
263262 }
264263
265− hardif_neigh = batadv_hardif_neigh_get(neigh_node->if_incoming,
266− neigh_node->addr);
267− if (hardif_neigh) {
268− /* batadv_hardif_neigh_get() increases refcount too */
269− batadv_hardif_neigh_put(hardif_neigh);
270− batadv_hardif_neigh_put(hardif_neigh);
271− }
264+ batadv_hardif_neigh_put(neigh_node->hardif_neigh);
272265
273266 if (bao->bat_neigh_free)
274267 bao->bat_neigh_free(neigh_node);
@@ -663,6 +656,11 @@ batadv_neigh_node_new(struct batadv_orig_node *orig_node, · 388 unmodified lines
663656 ether_addr_copy(neigh_node->addr, neigh_addr);
664657 neigh_node->if_incoming = hard_iface;
665658 neigh_node->orig_node = orig_node;
659+ neigh_node->last_seen = jiffies;
660+
661+ /* increment unique neighbor refcount */
662+ kref_get(&hardif_neigh->refcount);
663+ neigh_node->hardif_neigh = hardif_neigh;
666664
667665 /* extra reference for return */
668666 kref_init(&neigh_node->refcount);
@@ -672,9 +670,6 @@ batadv_neigh_node_new(struct batadv_orig_node *orig_node, · 3 unmodified lines
672670 hlist_add_head_rcu(&neigh_node->list, &orig_node->neigh_list);
673671 spin_unlock_bh(&orig_node->neigh_list_lock);
674672
675− /* increment unique neighbor refcount */
676− kref_get(&hardif_neigh->refcount);
677−
678673 batadv_dbg(BATADV_DBG_BATMAN, orig_node->bat_priv,
679674 "Creating new neighbor %pM for orig_node %pM on interface %s\n",
680675 neigh_addr, orig_node->orig, hard_iface->net_dev->name);
net/batman-adv/routing.c+9−0
@@ -105,6 +105,15 @@ static void _batadv_update_route(struct batadv_priv *bat_priv, · 104 unmodified lines
105105 neigh_node = NULL;
106106
107107 spin_lock_bh(&orig_node->neigh_list_lock);
108+ /* curr_router used earlier may not be the current orig_ifinfo->router
109+ * anymore because it was dereferenced outside of the neigh_list_lock
110+ * protected region. After the new best neighbor has replace the current
111+ * best neighbor the reference counter needs to decrease. Consequently,
112+ * the code needs to ensure the curr_router variable contains a pointer
113+ * to the replaced best neighbor.
114+ */
115+ curr_router = rcu_dereference_protected(orig_ifinfo->router, true);
116+
108117 rcu_assign_pointer(orig_ifinfo->router, neigh_node);
109118 spin_unlock_bh(&orig_node->neigh_list_lock);
110119 batadv_orig_ifinfo_put(orig_ifinfo);
net/batman-adv/send.c+6−0
@@ -675,6 +675,9 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv, · 674 unmodified lines
675675
676676 if (pending) {
677677 hlist_del(&forw_packet->list);
678+ if (!forw_packet->own)
679+ atomic_inc(&bat_priv->bcast_queue_left);
680+
678681 batadv_forw_packet_free(forw_packet);
679682 }
680683 }
@@ -702,6 +705,9 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv, · 21 unmodified lines
702705
703706 if (pending) {
704707 hlist_del(&forw_packet->list);
708+ if (!forw_packet->own)
709+ atomic_inc(&bat_priv->batman_queue_left);
710+
705711 batadv_forw_packet_free(forw_packet);
706712 }
707713 }
net/batman-adv/soft-interface.c+6−2
@@ -408,11 +408,17 @@ void batadv_interface_rx(struct net_device *soft_iface, · 407 unmodified lines
408408 */
409409 nf_reset(skb);
410410
411+ if (unlikely(!pskb_may_pull(skb, ETH_HLEN)))
412+ goto dropped;
413+
411414 vid = batadv_get_vid(skb, 0);
412415 ethhdr = eth_hdr(skb);
413416
414417 switch (ntohs(ethhdr->h_proto)) {
415418 case ETH_P_8021Q:
419+ if (!pskb_may_pull(skb, VLAN_ETH_HLEN))
420+ goto dropped;
421+
416422 vhdr = (struct vlan_ethhdr *)skb->data;
417423
418424 if (vhdr->h_vlan_encapsulated_proto != ethertype)
@@ -424,8 +430,6 @@ void batadv_interface_rx(struct net_device *soft_iface, · 5 unmodified lines
424430 }
425431
426432 /* skb->dev & skb->pkt_type are set here */
427− if (unlikely(!pskb_may_pull(skb, ETH_HLEN)))
428− goto dropped;
429433 skb->protocol = eth_type_trans(skb, soft_iface);
430434
431435 /* should not be necessary anymore as we use skb_pull_rcsum()
net/batman-adv/translation-table.c+4−38
@@ -215,6 +215,8 @@ static void batadv_tt_local_entry_release(struct kref *ref) · 214 unmodified lines
215215 tt_local_entry = container_of(ref, struct batadv_tt_local_entry,
216216 common.refcount);
217217
218+ batadv_softif_vlan_put(tt_local_entry->vlan);
219+
218220 kfree_rcu(tt_local_entry, common.rcu);
219221 }
220222
@@ -673,6 +675,7 @@ bool batadv_tt_local_add(struct net_device *soft_iface, const u8 *addr, · 452 unmodified lines
673675 kref_get(&tt_local->common.refcount);
674676 tt_local->last_seen = jiffies;
675677 tt_local->common.added_at = tt_local->last_seen;
678+ tt_local->vlan = vlan;
676679
677680 /* the batman interface mac and multicast addresses should never be
678681 * purged
@@ -991,7 +994,6 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset) · 312 unmodified lines
991994 struct batadv_tt_common_entry *tt_common_entry;
992995 struct batadv_tt_local_entry *tt_local;
993996 struct batadv_hard_iface *primary_if;
994− struct batadv_softif_vlan *vlan;
995997 struct hlist_head *head;
996998 unsigned short vid;
997999 u32 i;
@@ -1027,14 +1029,6 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset) · 29 unmodified lines
10271029 last_seen_msecs = last_seen_msecs % 1000;
10281030
10291031 no_purge = tt_common_entry->flags & np_flag;
1030−
1031− vlan = batadv_softif_vlan_get(bat_priv, vid);
1032− if (!vlan) {
1033− seq_printf(seq, "Cannot retrieve VLAN %d\n",
1034− BATADV_PRINT_VID(vid));
1035− continue;
1036− }
1037−
10381032 seq_printf(seq,
10391033 " * %pM %4i [%c%c%c%c%c%c] %3u.%03u (%#.8x)\n",
10401034 tt_common_entry->addr,
@@ -1052,9 +1046,7 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset) · 11 unmodified lines
10521046 BATADV_TT_CLIENT_ISOLA) ? 'I' : '.'),
10531047 no_purge ? 0 : last_seen_secs,
10541048 no_purge ? 0 : last_seen_msecs,
1055− vlan->tt.crc);
1056−
1057− batadv_softif_vlan_put(vlan);
1049+ tt_local->vlan->tt.crc);
10581050 }
10591051 rcu_read_unlock();
10601052 }
@@ -1099,7 +1091,6 @@ u16 batadv_tt_local_remove(struct batadv_priv *bat_priv, const u8 *addr, · 38 unmodified lines
10991091 {
11001092 struct batadv_tt_local_entry *tt_local_entry;
11011093 u16 flags, curr_flags = BATADV_NO_FLAGS;
1102− struct batadv_softif_vlan *vlan;
11031094 void *tt_entry_exists;
11041095
11051096 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid);
@@ -1139,14 +1130,6 @@ u16 batadv_tt_local_remove(struct batadv_priv *bat_priv, const u8 *addr, · 33 unmodified lines
11391130 /* extra call to free the local tt entry */
11401131 batadv_tt_local_entry_put(tt_local_entry);
11411132
1142− /* decrease the reference held for this vlan */
1143− vlan = batadv_softif_vlan_get(bat_priv, vid);
1144− if (!vlan)
1145− goto out;
1146−
1147− batadv_softif_vlan_put(vlan);
1148− batadv_softif_vlan_put(vlan);
1149−
11501133 out:
11511134 if (tt_local_entry)
11521135 batadv_tt_local_entry_put(tt_local_entry);
@@ -1219,7 +1202,6 @@ static void batadv_tt_local_table_free(struct batadv_priv *bat_priv) · 66 unmodified lines
12191202 spinlock_t *list_lock; /* protects write access to the hash lists */
12201203 struct batadv_tt_common_entry *tt_common_entry;
12211204 struct batadv_tt_local_entry *tt_local;
1222− struct batadv_softif_vlan *vlan;
12231205 struct hlist_node *node_tmp;
12241206 struct hlist_head *head;
12251207 u32 i;
@@ -1241,14 +1223,6 @@ static void batadv_tt_local_table_free(struct batadv_priv *bat_priv) · 15 unmodified lines
12411223 struct batadv_tt_local_entry,
12421224 common);
12431225
1244− /* decrease the reference held for this vlan */
1245− vlan = batadv_softif_vlan_get(bat_priv,
1246− tt_common_entry->vid);
1247− if (vlan) {
1248− batadv_softif_vlan_put(vlan);
1249− batadv_softif_vlan_put(vlan);
1250− }
1251−
12521226 batadv_tt_local_entry_put(tt_local);
12531227 }
12541228 spin_unlock_bh(list_lock);
@@ -3309,7 +3283,6 @@ static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv) · 2054 unmodified lines
33093283 struct batadv_hashtable *hash = bat_priv->tt.local_hash;
33103284 struct batadv_tt_common_entry *tt_common;
33113285 struct batadv_tt_local_entry *tt_local;
3312− struct batadv_softif_vlan *vlan;
33133286 struct hlist_node *node_tmp;
33143287 struct hlist_head *head;
33153288 spinlock_t *list_lock; /* protects write access to the hash lists */
@@ -3339,13 +3312,6 @@ static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv) · 23 unmodified lines
33393312 struct batadv_tt_local_entry,
33403313 common);
33413314
3342− /* decrease the reference held for this vlan */
3343− vlan = batadv_softif_vlan_get(bat_priv, tt_common->vid);
3344− if (vlan) {
3345− batadv_softif_vlan_put(vlan);
3346− batadv_softif_vlan_put(vlan);
3347− }
3348−
33493315 batadv_tt_local_entry_put(tt_local);
33503316 }
33513317 spin_unlock_bh(list_lock);
net/batman-adv/types.h+7−0
@@ -433,6 +433,7 @@ struct batadv_hardif_neigh_node { · 432 unmodified lines
433433 * @ifinfo_lock: lock protecting private ifinfo members and list
434434 * @if_incoming: pointer to incoming hard-interface
435435 * @last_seen: when last packet via this neighbor was received
436+ * @hardif_neigh: hardif_neigh of this neighbor
436437 * @refcount: number of contexts the object is used
437438 * @rcu: struct used for freeing in an RCU-safe manner
438439 */
@@ -444,6 +445,7 @@ struct batadv_neigh_node { · 5 unmodified lines
444445 spinlock_t ifinfo_lock; /* protects ifinfo_list and its members */
445446 struct batadv_hard_iface *if_incoming;
446447 unsigned long last_seen;
448+ struct batadv_hardif_neigh_node *hardif_neigh;
447449 struct kref refcount;
448450 struct rcu_head rcu;
449451 };
@@ -1073,10 +1075,12 @@ struct batadv_tt_common_entry { · 623 unmodified lines
10731075 * struct batadv_tt_local_entry - translation table local entry data
10741076 * @common: general translation table data
10751077 * @last_seen: timestamp used for purging stale tt local entries
1078+ * @vlan: soft-interface vlan of the entry
10761079 */
10771080 struct batadv_tt_local_entry {
10781081 struct batadv_tt_common_entry common;
10791082 unsigned long last_seen;
1083+ struct batadv_softif_vlan *vlan;
10801084 };
10811085
10821086 /**
@@ -1250,6 +1254,8 @@ struct batadv_forw_packet { · 167 unmodified lines
12501254 * struct batadv_algo_ops - mesh algorithm callbacks
12511255 * @list: list node for the batadv_algo_list
12521256 * @name: name of the algorithm
1257+ * @bat_iface_activate: start routing mechanisms when hard-interface is brought
1258+ * up
12531259 * @bat_iface_enable: init routing info when hard-interface is enabled
12541260 * @bat_iface_disable: de-init routing info when hard-interface is disabled
12551261 * @bat_iface_update_mac: (re-)init mac addresses of the protocol information
@@ -1277,6 +1283,7 @@ struct batadv_forw_packet { · 21 unmodified lines
12771283 struct batadv_algo_ops {
12781284 struct hlist_node list;
12791285 char *name;
1286+ void (*bat_iface_activate)(struct batadv_hard_iface *hard_iface);
12801287 int (*bat_iface_enable)(struct batadv_hard_iface *hard_iface);
12811288 void (*bat_iface_disable)(struct batadv_hard_iface *hard_iface);
12821289 void (*bat_iface_update_mac)(struct batadv_hard_iface *hard_iface);
net/ceph/auth.c+2−6
@@ -293,13 +293,9 @@ int ceph_auth_create_authorizer(struct ceph_auth_client *ac, · 292 unmodified lines
293293 }
294294 EXPORT_SYMBOL(ceph_auth_create_authorizer);
295295
296−void ceph_auth_destroy_authorizer(struct ceph_auth_client *ac,
297− struct ceph_authorizer *a)
296+void ceph_auth_destroy_authorizer(struct ceph_authorizer *a)
298297 {
299− mutex_lock(&ac->mutex);
300− if (ac->ops && ac->ops->destroy_authorizer)
301− ac->ops->destroy_authorizer(ac, a);
302− mutex_unlock(&ac->mutex);
298+ a->destroy(a);
303299 }
304300 EXPORT_SYMBOL(ceph_auth_destroy_authorizer);
305301
net/ceph/auth_none.c+39−32
@@ -16,7 +16,6 @@ static void reset(struct ceph_auth_client *ac) · 15 unmodified lines
1616 struct ceph_auth_none_info *xi = ac->private;
1717
1818 xi->starting = true;
19− xi->built_authorizer = false;
2019 }
2120
2221 static void destroy(struct ceph_auth_client *ac)
@@ -39,6 +38,27 @@ static int should_authenticate(struct ceph_auth_client *ac) · 16 unmodified lines
3938 return xi->starting;
4039 }
4140
41+static int ceph_auth_none_build_authorizer(struct ceph_auth_client *ac,
42+ struct ceph_none_authorizer *au)
43+{
44+ void *p = au->buf;
45+ void *const end = p + sizeof(au->buf);
46+ int ret;
47+
48+ ceph_encode_8_safe(&p, end, 1, e_range);
49+ ret = ceph_entity_name_encode(ac->name, &p, end);
50+ if (ret < 0)
51+ return ret;
52+
53+ ceph_encode_64_safe(&p, end, ac->global_id, e_range);
54+ au->buf_len = p - (void *)au->buf;
55+ dout("%s built authorizer len %d\n", __func__, au->buf_len);
56+ return 0;
57+
58+e_range:
59+ return -ERANGE;
60+}
61+
4262 static int build_request(struct ceph_auth_client *ac, void *buf, void *end)
4363 {
4464 return 0;
@@ -57,32 +77,32 @@ static int handle_reply(struct ceph_auth_client *ac, int result, · 12 unmodified lines
5777 return result;
5878 }
5979
80+static void ceph_auth_none_destroy_authorizer(struct ceph_authorizer *a)
81+{
82+ kfree(a);
83+}
84+
6085 /*
61− * build an 'authorizer' with our entity_name and global_id. we can
62− * reuse a single static copy since it is identical for all services
63− * we connect to.
86+ * build an 'authorizer' with our entity_name and global_id. it is
87+ * identical for all services we connect to.
6488 */
6589 static int ceph_auth_none_create_authorizer(
6690 struct ceph_auth_client *ac, int peer_type,
6791 struct ceph_auth_handshake *auth)
6892 {
69− struct ceph_auth_none_info *ai = ac->private;
70− struct ceph_none_authorizer *au = &ai->au;
71− void *p, *end;
93+ struct ceph_none_authorizer *au;
7294 int ret;
7395
74− if (!ai->built_authorizer) {
75− p = au->buf;
76− end = p + sizeof(au->buf);
77− ceph_encode_8(&p, 1);
78− ret = ceph_entity_name_encode(ac->name, &p, end - 8);
79− if (ret < 0)
80− goto bad;
81− ceph_decode_need(&p, end, sizeof(u64), bad2);
82− ceph_encode_64(&p, ac->global_id);
83− au->buf_len = p - (void *)au->buf;
84− ai->built_authorizer = true;
85− dout("built authorizer len %d\n", au->buf_len);
96+ au = kmalloc(sizeof(*au), GFP_NOFS);
97+ if (!au)
98+ return -ENOMEM;
99+
100+ au->base.destroy = ceph_auth_none_destroy_authorizer;
101+
102+ ret = ceph_auth_none_build_authorizer(ac, au);
103+ if (ret) {
104+ kfree(au);
105+ return ret;
86106 }
87107
88108 auth->authorizer = (struct ceph_authorizer *) au;
@@ -92,17 +112,6 @@ static int ceph_auth_none_create_authorizer( · 3 unmodified lines
92112 auth->authorizer_reply_buf_len = sizeof (au->reply_buf);
93113
94114 return 0;
95−
96−bad2:
97− ret = -ERANGE;
98−bad:
99− return ret;
100−}
101−
102−static void ceph_auth_none_destroy_authorizer(struct ceph_auth_client *ac,
103− struct ceph_authorizer *a)
104−{
105− /* nothing to do */
106115 }
107116
108117 static const struct ceph_auth_client_ops ceph_auth_none_ops = {
@@ -114,7 +123,6 @@ static const struct ceph_auth_client_ops ceph_auth_none_ops = { · 5 unmodified lines
114123 .build_request = build_request,
115124 .handle_reply = handle_reply,
116125 .create_authorizer = ceph_auth_none_create_authorizer,
117− .destroy_authorizer = ceph_auth_none_destroy_authorizer,
118126 };
119127
120128 int ceph_auth_none_init(struct ceph_auth_client *ac)
@@ -127,7 +135,6 @@ int ceph_auth_none_init(struct ceph_auth_client *ac) · 6 unmodified lines
127135 return -ENOMEM;
128136
129137 xi->starting = true;
130− xi->built_authorizer = false;
131138
132139 ac->protocol = CEPH_AUTH_NONE;
133140 ac->private = xi;
net/ceph/auth_none.h+1−2
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 */
1313
1414 struct ceph_none_authorizer {
15+ struct ceph_authorizer base;
1516 char buf[128];
1617 int buf_len;
1718 char reply_buf[0];
@@ -19,8 +20,6 @@ struct ceph_none_authorizer { · 1 unmodified line
1920
2021 struct ceph_auth_none_info {
2122 bool starting;
22− bool built_authorizer;
23− struct ceph_none_authorizer au; /* we only need one; it's static */
2423 };
2524
2625 int ceph_auth_none_init(struct ceph_auth_client *ac);
net/ceph/auth_x.c+10−11
@@ -565,6 +565,14 @@ static int ceph_x_handle_reply(struct ceph_auth_client *ac, int result, · 564 unmodified lines
565565 return -EAGAIN;
566566 }
567567
568+static void ceph_x_destroy_authorizer(struct ceph_authorizer *a)
569+{
570+ struct ceph_x_authorizer *au = (void *)a;
571+
572+ ceph_x_authorizer_cleanup(au);
573+ kfree(au);
574+}
575+
568576 static int ceph_x_create_authorizer(
569577 struct ceph_auth_client *ac, int peer_type,
570578 struct ceph_auth_handshake *auth)
@@ -581,6 +589,8 @@ static int ceph_x_create_authorizer( · 10 unmodified lines
581589 if (!au)
582590 return -ENOMEM;
583591
592+ au->base.destroy = ceph_x_destroy_authorizer;
593+
584594 ret = ceph_x_build_authorizer(ac, th, au);
585595 if (ret) {
586596 kfree(au);
@@ -643,16 +653,6 @@ static int ceph_x_verify_authorizer_reply(struct ceph_auth_client *ac, · 56 unmodified lines
643653 return ret;
644654 }
645655
646−static void ceph_x_destroy_authorizer(struct ceph_auth_client *ac,
647− struct ceph_authorizer *a)
648−{
649− struct ceph_x_authorizer *au = (void *)a;
650−
651− ceph_x_authorizer_cleanup(au);
652− kfree(au);
653−}
654−
655−
656656 static void ceph_x_reset(struct ceph_auth_client *ac)
657657 {
658658 struct ceph_x_info *xi = ac->private;
@@ -770,7 +770,6 @@ static const struct ceph_auth_client_ops ceph_x_ops = { · 111 unmodified lines
770770 .create_authorizer = ceph_x_create_authorizer,
771771 .update_authorizer = ceph_x_update_authorizer,
772772 .verify_authorizer_reply = ceph_x_verify_authorizer_reply,
773− .destroy_authorizer = ceph_x_destroy_authorizer,
774773 .invalidate_authorizer = ceph_x_invalidate_authorizer,
775774 .reset = ceph_x_reset,
776775 .destroy = ceph_x_destroy,
net/ceph/auth_x.h+1−0
@@ -26,6 +26,7 @@ struct ceph_x_ticket_handler { · 25 unmodified lines
2626
2727
2828 struct ceph_x_authorizer {
29+ struct ceph_authorizer base;
2930 struct ceph_crypto_key session_key;
3031 struct ceph_buffer *buf;
3132 unsigned int service;
net/ceph/osd_client.c+2−4
@@ -1087,10 +1087,8 @@ static void put_osd(struct ceph_osd *osd) · 1086 unmodified lines
10871087 dout("put_osd %p %d -> %d\n", osd, atomic_read(&osd->o_ref),
10881088 atomic_read(&osd->o_ref) - 1);
10891089 if (atomic_dec_and_test(&osd->o_ref)) {
1090− struct ceph_auth_client *ac = osd->o_osdc->client->monc.auth;
1091−
10921090 if (osd->o_auth.authorizer)
1093− ceph_auth_destroy_authorizer(ac, osd->o_auth.authorizer);
1091+ ceph_auth_destroy_authorizer(osd->o_auth.authorizer);
10941092 kfree(osd);
10951093 }
10961094 }
@@ -2984,7 +2982,7 @@ static struct ceph_auth_handshake *get_authorizer(struct ceph_connection *con, · 1887 unmodified lines
29842982 struct ceph_auth_handshake *auth = &o->o_auth;
29852983
29862984 if (force_new && auth->authorizer) {
2987− ceph_auth_destroy_authorizer(ac, auth->authorizer);
2985+ ceph_auth_destroy_authorizer(auth->authorizer);
29882986 auth->authorizer = NULL;
29892987 }
29902988 if (!auth->authorizer) {
net/core/dev.c+1−1
@@ -2815,7 +2815,7 @@ static netdev_features_t harmonize_features(struct sk_buff *skb, · 2814 unmodified lines
28152815
28162816 if (skb->ip_summed != CHECKSUM_NONE &&
28172817 !can_checksum_protocol(features, type)) {
2818− features &= ~NETIF_F_CSUM_MASK;
2818+ features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
28192819 } else if (illegal_highdma(skb->dev, skb)) {
28202820 features &= ~NETIF_F_SG;
28212821 }
net/ipv4/inet_hashtables.c+2−0
@@ -438,6 +438,7 @@ static int inet_reuseport_add_sock(struct sock *sk, · 437 unmodified lines
438438 const struct sock *sk2,
439439 bool match_wildcard))
440440 {
441+ struct inet_bind_bucket *tb = inet_csk(sk)->icsk_bind_hash;
441442 struct sock *sk2;
442443 kuid_t uid = sock_i_uid(sk);
443444
@@ -446,6 +447,7 @@ static int inet_reuseport_add_sock(struct sock *sk, · 2 unmodified lines
446447 sk2->sk_family == sk->sk_family &&
447448 ipv6_only_sock(sk2) == ipv6_only_sock(sk) &&
448449 sk2->sk_bound_dev_if == sk->sk_bound_dev_if &&
450+ inet_csk(sk2)->icsk_bind_hash == tb &&
449451 sk2->sk_reuseport && uid_eq(uid, sock_i_uid(sk2)) &&
450452 saddr_same(sk, sk2, false))
451453 return reuseport_add_sock(sk, sk2);
net/ipv4/ip_gre.c+13−6
@@ -369,7 +369,8 @@ static struct rtable *gre_get_rt(struct sk_buff *skb, · 368 unmodified lines
369369 return ip_route_output_key(net, fl);
370370 }
371371
372−static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev)
372+static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev,
373+ __be16 proto)
373374 {
374375 struct ip_tunnel_info *tun_info;
375376 const struct ip_tunnel_key *key;
@@ -418,7 +419,7 @@ static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev) · 42 unmodified lines
418419 goto err_free_rt;
419420
420421 flags = tun_info->key.tun_flags & (TUNNEL_CSUM | TUNNEL_KEY);
421− gre_build_header(skb, tunnel_hlen, flags, htons(ETH_P_TEB),
422+ gre_build_header(skb, tunnel_hlen, flags, proto,
422423 tunnel_id_to_key(tun_info->key.tun_id), 0);
423424
424425 df = key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0;
@@ -459,7 +460,7 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb, · 34 unmodified lines
459460 const struct iphdr *tnl_params;
460461
461462 if (tunnel->collect_md) {
462− gre_fb_xmit(skb, dev);
463+ gre_fb_xmit(skb, dev, skb->protocol);
463464 return NETDEV_TX_OK;
464465 }
465466
@@ -501,7 +502,7 @@ static netdev_tx_t gre_tap_xmit(struct sk_buff *skb, · 35 unmodified lines
501502 struct ip_tunnel *tunnel = netdev_priv(dev);
502503
503504 if (tunnel->collect_md) {
504− gre_fb_xmit(skb, dev);
505+ gre_fb_xmit(skb, dev, htons(ETH_P_TEB));
505506 return NETDEV_TX_OK;
506507 }
507508
@@ -732,7 +733,7 @@ static int ipgre_tunnel_init(struct net_device *dev) · 224 unmodified lines
732733 netif_keep_dst(dev);
733734 dev->addr_len = 4;
734735
735− if (iph->daddr) {
736+ if (iph->daddr && !tunnel->collect_md) {
736737 #ifdef CONFIG_NET_IPGRE_BROADCAST
737738 if (ipv4_is_multicast(iph->daddr)) {
738739 if (!iph->saddr)
@@ -741,8 +742,9 @@ static int ipgre_tunnel_init(struct net_device *dev) · 2 unmodified lines
741742 dev->header_ops = &ipgre_header_ops;
742743 }
743744 #endif
744− } else
745+ } else if (!tunnel->collect_md) {
745746 dev->header_ops = &ipgre_header_ops;
747+ }
746748
747749 return ip_tunnel_init(dev);
748750 }
@@ -785,6 +787,11 @@ static int ipgre_tunnel_validate(struct nlattr *tb[], struct nlattr *data[]) · 36 unmodified lines
785787 if (flags & (GRE_VERSION|GRE_ROUTING))
786788 return -EINVAL;
787789
790+ if (data[IFLA_GRE_COLLECT_METADATA] &&
791+ data[IFLA_GRE_ENCAP_TYPE] &&
792+ nla_get_u16(data[IFLA_GRE_ENCAP_TYPE]) != TUNNEL_ENCAP_NONE)
793+ return -EINVAL;
794+
788795 return 0;
789796 }
790797
net/ipv4/ip_tunnel.c+2−2
@@ -326,12 +326,12 @@ static int ip_tunnel_bind_dev(struct net_device *dev) · 325 unmodified lines
326326
327327 if (!IS_ERR(rt)) {
328328 tdev = rt->dst.dev;
329− dst_cache_set_ip4(&tunnel->dst_cache, &rt->dst,
330− fl4.saddr);
331329 ip_rt_put(rt);
332330 }
333331 if (dev->type != ARPHRD_ETHER)
334332 dev->flags |= IFF_POINTOPOINT;
333+
334+ dst_cache_reset(&tunnel->dst_cache);
335335 }
336336
337337 if (!tdev && tunnel->parms.link)
net/ipv6/ila/ila_lwt.c+1−2
@@ -144,8 +144,7 @@ nla_put_failure: · 143 unmodified lines
144144
145145 static int ila_encap_nlsize(struct lwtunnel_state *lwtstate)
146146 {
147− /* No encapsulation overhead */
148− return 0;
147+ return nla_total_size(sizeof(u64)); /* ILA_ATTR_LOCATOR */
149148 }
150149
151150 static int ila_encap_cmp(struct lwtunnel_state *a, struct lwtunnel_state *b)
net/l2tp/l2tp_core.c+2−2
@@ -1376,9 +1376,9 @@ static int l2tp_tunnel_sock_create(struct net *net, · 1375 unmodified lines
13761376 memcpy(&udp_conf.peer_ip6, cfg->peer_ip6,
13771377 sizeof(udp_conf.peer_ip6));
13781378 udp_conf.use_udp6_tx_checksums =
1379− cfg->udp6_zero_tx_checksums;
1379+ ! cfg->udp6_zero_tx_checksums;
13801380 udp_conf.use_udp6_rx_checksums =
1381− cfg->udp6_zero_rx_checksums;
1381+ ! cfg->udp6_zero_rx_checksums;
13821382 } else
13831383 #endif
13841384 {
net/mac80211/iface.c+2−2
@@ -1761,7 +1761,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, · 1760 unmodified lines
17611761
17621762 ret = dev_alloc_name(ndev, ndev->name);
17631763 if (ret < 0) {
1764− free_netdev(ndev);
1764+ ieee80211_if_free(ndev);
17651765 return ret;
17661766 }
17671767
@@ -1847,7 +1847,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, · 79 unmodified lines
18471847
18481848 ret = register_netdevice(ndev);
18491849 if (ret) {
1850− free_netdev(ndev);
1850+ ieee80211_if_free(ndev);
18511851 return ret;
18521852 }
18531853 }
net/rds/tcp.c+2−1
@@ -127,7 +127,7 @@ void rds_tcp_restore_callbacks(struct socket *sock, · 126 unmodified lines
127127
128128 /*
129129 * This is the only path that sets tc->t_sock. Send and receive trust that
130− * it is set. The RDS_CONN_CONNECTED bit protects those paths from being
130+ * it is set. The RDS_CONN_UP bit protects those paths from being
131131 * called while it isn't set.
132132 */
133133 void rds_tcp_set_callbacks(struct socket *sock, struct rds_connection *conn)
@@ -216,6 +216,7 @@ static int rds_tcp_conn_alloc(struct rds_connection *conn, gfp_t gfp) · 82 unmodified lines
216216 if (!tc)
217217 return -ENOMEM;
218218
219+ mutex_init(&tc->t_conn_lock);
219220 tc->t_sock = NULL;
220221 tc->t_tinc = NULL;
221222 tc->t_tinc_hdr_rem = sizeof(struct rds_header);
net/rds/tcp.h+4−0
@@ -12,6 +12,10 @@ struct rds_tcp_connection { · 11 unmodified lines
1212
1313 struct list_head t_tcp_node;
1414 struct rds_connection *conn;
15+ /* t_conn_lock synchronizes the connection establishment between
16+ * rds_tcp_accept_one and rds_tcp_conn_connect
17+ */
18+ struct mutex t_conn_lock;
1519 struct socket *t_sock;
1620 void *t_orig_write_space;
1721 void *t_orig_data_ready;
net/rds/tcp_connect.c+8−0
@@ -78,7 +78,14 @@ int rds_tcp_conn_connect(struct rds_connection *conn) · 77 unmodified lines
7878 struct socket *sock = NULL;
7979 struct sockaddr_in src, dest;
8080 int ret;
81+ struct rds_tcp_connection *tc = conn->c_transport_data;
82+
83+ mutex_lock(&tc->t_conn_lock);
8184
85+ if (rds_conn_up(conn)) {
86+ mutex_unlock(&tc->t_conn_lock);
87+ return 0;
88+ }
8289 ret = sock_create_kern(rds_conn_net(conn), PF_INET,
8390 SOCK_STREAM, IPPROTO_TCP, &sock);
8491 if (ret < 0)
@@ -120,6 +127,7 @@ int rds_tcp_conn_connect(struct rds_connection *conn) · 35 unmodified lines
120127 }
121128
122129 out:
130+ mutex_unlock(&tc->t_conn_lock);
123131 if (sock)
124132 sock_release(sock);
125133 return ret;
net/rds/tcp_listen.c+36−18
@@ -76,7 +76,9 @@ int rds_tcp_accept_one(struct socket *sock) · 75 unmodified lines
7676 struct rds_connection *conn;
7777 int ret;
7878 struct inet_sock *inet;
79− struct rds_tcp_connection *rs_tcp;
79+ struct rds_tcp_connection *rs_tcp = NULL;
80+ int conn_state;
81+ struct sock *nsk;
8082
8183 ret = sock_create_kern(sock_net(sock->sk), sock->sk->sk_family,
8284 sock->sk->sk_type, sock->sk->sk_protocol,
@@ -115,28 +117,44 @@ int rds_tcp_accept_one(struct socket *sock) · 32 unmodified lines
115117 * rds_tcp_state_change() will do that cleanup
116118 */
117119 rs_tcp = (struct rds_tcp_connection *)conn->c_transport_data;
118− if (rs_tcp->t_sock &&
119− ntohl(inet->inet_saddr) < ntohl(inet->inet_daddr)) {
120− struct sock *nsk = new_sock->sk;
121−
122− nsk->sk_user_data = NULL;
123− nsk->sk_prot->disconnect(nsk, 0);
124− tcp_done(nsk);
125− new_sock = NULL;
126− ret = 0;
127− goto out;
128− } else if (rs_tcp->t_sock) {
129− rds_tcp_restore_callbacks(rs_tcp->t_sock, rs_tcp);
130− conn->c_outgoing = 0;
131− }
132−
133120 rds_conn_transition(conn, RDS_CONN_DOWN, RDS_CONN_CONNECTING);
121+ mutex_lock(&rs_tcp->t_conn_lock);
122+ conn_state = rds_conn_state(conn);
123+ if (conn_state != RDS_CONN_CONNECTING && conn_state != RDS_CONN_UP)
124+ goto rst_nsk;
125+ if (rs_tcp->t_sock) {
126+ /* Need to resolve a duelling SYN between peers.
127+ * We have an outstanding SYN to this peer, which may
128+ * potentially have transitioned to the RDS_CONN_UP state,
129+ * so we must quiesce any send threads before resetting
130+ * c_transport_data.
131+ */
132+ wait_event(conn->c_waitq,
133+ !test_bit(RDS_IN_XMIT, &conn->c_flags));
134+ if (ntohl(inet->inet_saddr) < ntohl(inet->inet_daddr)) {
135+ goto rst_nsk;
136+ } else if (rs_tcp->t_sock) {
137+ rds_tcp_restore_callbacks(rs_tcp->t_sock, rs_tcp);
138+ conn->c_outgoing = 0;
139+ }
140+ }
134141 rds_tcp_set_callbacks(new_sock, conn);
135− rds_connect_complete(conn);
142+ rds_connect_complete(conn); /* marks RDS_CONN_UP */
143+ new_sock = NULL;
144+ ret = 0;
145+ goto out;
146+rst_nsk:
147+ /* reset the newly returned accept sock and bail */
148+ nsk = new_sock->sk;
149+ rds_tcp_stats_inc(s_tcp_listen_closed_stale);
150+ nsk->sk_user_data = NULL;
151+ nsk->sk_prot->disconnect(nsk, 0);
152+ tcp_done(nsk);
136153 new_sock = NULL;
137154 ret = 0;
138−
139155 out:
156+ if (rs_tcp)
157+ mutex_unlock(&rs_tcp->t_conn_lock);
140158 if (new_sock)
141159 sock_release(new_sock);
142160 return ret;
net/sched/sch_netem.c+59−2
@@ -395,6 +395,25 @@ static void tfifo_enqueue(struct sk_buff *nskb, struct Qdisc *sch) · 394 unmodified lines
395395 sch->q.qlen++;
396396 }
397397
398+/* netem can't properly corrupt a megapacket (like we get from GSO), so instead
399+ * when we statistically choose to corrupt one, we instead segment it, returning
400+ * the first packet to be corrupted, and re-enqueue the remaining frames
401+ */
402+static struct sk_buff *netem_segment(struct sk_buff *skb, struct Qdisc *sch)
403+{
404+ struct sk_buff *segs;
405+ netdev_features_t features = netif_skb_features(skb);
406+
407+ segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK);
408+
409+ if (IS_ERR_OR_NULL(segs)) {
410+ qdisc_reshape_fail(skb, sch);
411+ return NULL;
412+ }
413+ consume_skb(skb);
414+ return segs;
415+}
416+
398417 /*
399418 * Insert one skb into qdisc.
400419 * Note: parent depends on return value to account for queue length.
@@ -407,7 +426,11 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) · 6 unmodified lines
407426 /* We don't fill cb now as skb_unshare() may invalidate it */
408427 struct netem_skb_cb *cb;
409428 struct sk_buff *skb2;
429+ struct sk_buff *segs = NULL;
430+ unsigned int len = 0, last_len, prev_len = qdisc_pkt_len(skb);
431+ int nb = 0;
410432 int count = 1;
433+ int rc = NET_XMIT_SUCCESS;
411434
412435 /* Random duplication */
413436 if (q->duplicate && q->duplicate >= get_crandom(&q->dup_cor))
@@ -453,10 +476,23 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) · 39 unmodified lines
453476 * do it now in software before we mangle it.
454477 */
455478 if (q->corrupt && q->corrupt >= get_crandom(&q->corrupt_cor)) {
479+ if (skb_is_gso(skb)) {
480+ segs = netem_segment(skb, sch);
481+ if (!segs)
482+ return NET_XMIT_DROP;
483+ } else {
484+ segs = skb;
485+ }
486+
487+ skb = segs;
488+ segs = segs->next;
489+
456490 if (!(skb = skb_unshare(skb, GFP_ATOMIC)) ||
457491 (skb->ip_summed == CHECKSUM_PARTIAL &&
458− skb_checksum_help(skb)))
459− return qdisc_drop(skb, sch);
492+ skb_checksum_help(skb))) {
493+ rc = qdisc_drop(skb, sch);
494+ goto finish_segs;
495+ }
460496
461497 skb->data[prandom_u32() % skb_headlen(skb)] ^=
462498 1<<(prandom_u32() % 8);
@@ -516,6 +552,27 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) · 53 unmodified lines
516552 sch->qstats.requeues++;
517553 }
518554
555+finish_segs:
556+ if (segs) {
557+ while (segs) {
558+ skb2 = segs->next;
559+ segs->next = NULL;
560+ qdisc_skb_cb(segs)->pkt_len = segs->len;
561+ last_len = segs->len;
562+ rc = qdisc_enqueue(segs, sch);
563+ if (rc != NET_XMIT_SUCCESS) {
564+ if (net_xmit_drop_count(rc))
565+ qdisc_qstats_drop(sch);
566+ } else {
567+ nb++;
568+ len += last_len;
569+ }
570+ segs = skb2;
571+ }
572+ sch->q.qlen += nb;
573+ if (nb > 1)
574+ qdisc_tree_reduce_backlog(sch, 1 - nb, prev_len - len);
575+ }
519576 return NET_XMIT_SUCCESS;
520577 }
521578
net/tipc/node.c+5−0
@@ -1469,6 +1469,7 @@ void tipc_rcv(struct net *net, struct sk_buff *skb, struct tipc_bearer *b) · 1468 unmodified lines
14691469 int bearer_id = b->identity;
14701470 struct tipc_link_entry *le;
14711471 u16 bc_ack = msg_bcast_ack(hdr);
1472+ u32 self = tipc_own_addr(net);
14721473 int rc = 0;
14731474
14741475 __skb_queue_head_init(&xmitq);
@@ -1485,6 +1486,10 @@ void tipc_rcv(struct net *net, struct sk_buff *skb, struct tipc_bearer *b) · 10 unmodified lines
14851486 return tipc_node_bc_rcv(net, skb, bearer_id);
14861487 }
14871488
1489+ /* Discard unicast link messages destined for another node */
1490+ if (unlikely(!msg_short(hdr) && (msg_destnode(hdr) != self)))
1491+ goto discard;
1492+
14881493 /* Locate neighboring node that sent packet */
14891494 n = tipc_node_find(net, msg_prevnode(hdr));
14901495 if (unlikely(!n))
samples/bpf/trace_output_kern.c+0−1
@@ -18,7 +18,6 @@ int bpf_prog1(struct pt_regs *ctx) · 17 unmodified lines
1818 u64 cookie;
1919 } data;
2020
21− memset(&data, 0, sizeof(data));
2221 data.pid = bpf_get_current_pid_tgid();
2322 data.cookie = 0x12345678;
2423
sound/hda/ext/hdac_ext_stream.c+2−3
@@ -104,12 +104,11 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_init_all); · 103 unmodified lines
104104 */
105105 void snd_hdac_stream_free_all(struct hdac_ext_bus *ebus)
106106 {
107− struct hdac_stream *s;
107+ struct hdac_stream *s, *_s;
108108 struct hdac_ext_stream *stream;
109109 struct hdac_bus *bus = ebus_to_hbus(ebus);
110110
111− while (!list_empty(&bus->stream_list)) {
112− s = list_first_entry(&bus->stream_list, struct hdac_stream, list);
111+ list_for_each_entry_safe(s, _s, &bus->stream_list, list) {
113112 stream = stream_to_hdac_ext_stream(s);
114113 snd_hdac_ext_stream_decouple(ebus, stream, false);
115114 list_del(&s->list);
sound/hda/hdac_i915.c+51−11
@@ -20,6 +20,7 @@ · 19 unmodified lines
2020 #include <sound/core.h>
2121 #include <sound/hdaudio.h>
2222 #include <sound/hda_i915.h>
23+#include <sound/hda_register.h>
2324
2425 static struct i915_audio_component *hdac_acomp;
2526
@@ -97,26 +98,65 @@ int snd_hdac_display_power(struct hdac_bus *bus, bool enable) · 71 unmodified lines
9798 }
9899 EXPORT_SYMBOL_GPL(snd_hdac_display_power);
99100
101+#define CONTROLLER_IN_GPU(pci) (((pci)->device == 0x0a0c) || \
102+ ((pci)->device == 0x0c0c) || \
103+ ((pci)->device == 0x0d0c) || \
104+ ((pci)->device == 0x160c))
105+
100106 /**
101− * snd_hdac_get_display_clk - Get CDCLK in kHz
107+ * snd_hdac_i915_set_bclk - Reprogram BCLK for HSW/BDW
102108 * @bus: HDA core bus
103109 *
104− * This function is supposed to be used only by a HD-audio controller
105− * driver that needs the interaction with i915 graphics.
110+ * Intel HSW/BDW display HDA controller is in GPU. Both its power and link BCLK
111+ * depends on GPU. Two Extended Mode registers EM4 (M value) and EM5 (N Value)
112+ * are used to convert CDClk (Core Display Clock) to 24MHz BCLK:
113+ * BCLK = CDCLK * M / N
114+ * The values will be lost when the display power well is disabled and need to
115+ * be restored to avoid abnormal playback speed.
106116 *
107− * This function queries CDCLK value in kHz from the graphics driver and
108− * returns the value. A negative code is returned in error.
117+ * Call this function at initializing and changing power well, as well as
118+ * at ELD notifier for the hotplug.
109119 */
110−int snd_hdac_get_display_clk(struct hdac_bus *bus)
120+void snd_hdac_i915_set_bclk(struct hdac_bus *bus)
111121 {
112122 struct i915_audio_component *acomp = bus->audio_component;
123+ struct pci_dev *pci = to_pci_dev(bus->dev);
124+ int cdclk_freq;
125+ unsigned int bclk_m, bclk_n;
126+
127+ if (!acomp || !acomp->ops || !acomp->ops->get_cdclk_freq)
128+ return; /* only for i915 binding */
129+ if (!CONTROLLER_IN_GPU(pci))
130+ return; /* only HSW/BDW */
131+
132+ cdclk_freq = acomp->ops->get_cdclk_freq(acomp->dev);
133+ switch (cdclk_freq) {
134+ case 337500:
135+ bclk_m = 16;
136+ bclk_n = 225;
137+ break;
138+
139+ case 450000:
140+ default: /* default CDCLK 450MHz */
141+ bclk_m = 4;
142+ bclk_n = 75;
143+ break;
144+
145+ case 540000:
146+ bclk_m = 4;
147+ bclk_n = 90;
148+ break;
149+
150+ case 675000:
151+ bclk_m = 8;
152+ bclk_n = 225;
153+ break;
154+ }
113155
114− if (!acomp || !acomp->ops)
115− return -ENODEV;
116−
117− return acomp->ops->get_cdclk_freq(acomp->dev);
156+ snd_hdac_chip_writew(bus, HSW_EM4, bclk_m);
157+ snd_hdac_chip_writew(bus, HSW_EM5, bclk_n);
118158 }
119−EXPORT_SYMBOL_GPL(snd_hdac_get_display_clk);
159+EXPORT_SYMBOL_GPL(snd_hdac_i915_set_bclk);
120160
121161 /* There is a fixed mapping between audio pin node and display port
122162 * on current Intel platforms:
sound/pci/hda/hda_intel.c+4−52
@@ -857,50 +857,6 @@ static int param_set_xint(const char *val, const struct kernel_param *kp) · 856 unmodified lines
857857 #define azx_del_card_list(chip) /* NOP */
858858 #endif /* CONFIG_PM */
859859
860−/* Intel HSW/BDW display HDA controller is in GPU. Both its power and link BCLK
861− * depends on GPU. Two Extended Mode registers EM4 (M value) and EM5 (N Value)
862− * are used to convert CDClk (Core Display Clock) to 24MHz BCLK:
863− * BCLK = CDCLK * M / N
864− * The values will be lost when the display power well is disabled and need to
865− * be restored to avoid abnormal playback speed.
866− */
867−static void haswell_set_bclk(struct hda_intel *hda)
868−{
869− struct azx *chip = &hda->chip;
870− int cdclk_freq;
871− unsigned int bclk_m, bclk_n;
872−
873− if (!hda->need_i915_power)
874− return;
875−
876− cdclk_freq = snd_hdac_get_display_clk(azx_bus(chip));
877− switch (cdclk_freq) {
878− case 337500:
879− bclk_m = 16;
880− bclk_n = 225;
881− break;
882−
883− case 450000:
884− default: /* default CDCLK 450MHz */
885− bclk_m = 4;
886− bclk_n = 75;
887− break;
888−
889− case 540000:
890− bclk_m = 4;
891− bclk_n = 90;
892− break;
893−
894− case 675000:
895− bclk_m = 8;
896− bclk_n = 225;
897− break;
898− }
899−
900− azx_writew(chip, HSW_EM4, bclk_m);
901− azx_writew(chip, HSW_EM5, bclk_n);
902−}
903−
904860 #if defined(CONFIG_PM_SLEEP) || defined(SUPPORT_VGA_SWITCHEROO)
905861 /*
906862 * power management
@@ -958,7 +914,7 @@ static int azx_resume(struct device *dev) · 51 unmodified lines
958914 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL
959915 && hda->need_i915_power) {
960916 snd_hdac_display_power(azx_bus(chip), true);
961− haswell_set_bclk(hda);
917+ snd_hdac_i915_set_bclk(azx_bus(chip));
962918 }
963919 if (chip->msi)
964920 if (pci_enable_msi(pci) < 0)
@@ -1058,7 +1014,7 @@ static int azx_runtime_resume(struct device *dev) · 93 unmodified lines
10581014 bus = azx_bus(chip);
10591015 if (hda->need_i915_power) {
10601016 snd_hdac_display_power(bus, true);
1061− haswell_set_bclk(hda);
1017+ snd_hdac_i915_set_bclk(bus);
10621018 } else {
10631019 /* toggle codec wakeup bit for STATESTS read */
10641020 snd_hdac_set_codec_wakeup(bus, true);
@@ -1796,12 +1752,8 @@ static int azx_first_init(struct azx *chip) · 731 unmodified lines
17961752 /* initialize chip */
17971753 azx_init_pci(chip);
17981754
1799− if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
1800− struct hda_intel *hda;
1801−
1802− hda = container_of(chip, struct hda_intel, chip);
1803− haswell_set_bclk(hda);
1804− }
1755+ if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
1756+ snd_hdac_i915_set_bclk(bus);
18051757
18061758 hda_intel_init_chip(chip, (probe_only[dev] & 2) == 0);
18071759
sound/pci/hda/patch_hdmi.c+1−0
@@ -2232,6 +2232,7 @@ static void intel_pin_eld_notify(void *audio_ptr, int port) · 2231 unmodified lines
22322232 if (atomic_read(&(codec)->core.in_pm))
22332233 return;
22342234
2235+ snd_hdac_i915_set_bclk(&codec->bus->core);
22352236 check_presence_and_report(codec, pin_nid);
22362237 }
22372238
sound/pci/hda/patch_realtek.c+1−0
@@ -5584,6 +5584,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 5583 unmodified lines
55845584 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
55855585 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
55865586 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
5587+ SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
55875588 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
55885589 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
55895590 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
sound/soc/codecs/Kconfig+1−0
@@ -629,6 +629,7 @@ config SND_SOC_RT5514 · 628 unmodified lines
629629
630630 config SND_SOC_RT5616
631631 tristate "Realtek RT5616 CODEC"
632+ depends on I2C
632633
633634 config SND_SOC_RT5631
634635 tristate "Realtek ALC5631/RT5631 CODEC"
sound/soc/codecs/arizona.c+12−0
@@ -249,6 +249,18 @@ int arizona_init_spk(struct snd_soc_codec *codec) · 248 unmodified lines
249249 }
250250 EXPORT_SYMBOL_GPL(arizona_init_spk);
251251
252+int arizona_free_spk(struct snd_soc_codec *codec)
253+{
254+ struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
255+ struct arizona *arizona = priv->arizona;
256+
257+ arizona_free_irq(arizona, ARIZONA_IRQ_SPK_OVERHEAT_WARN, arizona);
258+ arizona_free_irq(arizona, ARIZONA_IRQ_SPK_OVERHEAT, arizona);
259+
260+ return 0;
261+}
262+EXPORT_SYMBOL_GPL(arizona_free_spk);
263+
252264 static const struct snd_soc_dapm_route arizona_mono_routes[] = {
253265 { "OUT1R", NULL, "OUT1L" },
254266 { "OUT2R", NULL, "OUT2L" },
sound/soc/codecs/arizona.h+2−0
@@ -307,6 +307,8 @@ extern int arizona_init_spk(struct snd_soc_codec *codec); · 306 unmodified lines
307307 extern int arizona_init_gpio(struct snd_soc_codec *codec);
308308 extern int arizona_init_mono(struct snd_soc_codec *codec);
309309
310+extern int arizona_free_spk(struct snd_soc_codec *codec);
311+
310312 extern int arizona_init_dai(struct arizona_priv *priv, int dai);
311313
312314 int arizona_set_output_mode(struct snd_soc_codec *codec, int output,
sound/soc/codecs/cs35l32.c+13−4
@@ -274,7 +274,9 @@ static int cs35l32_handle_of_data(struct i2c_client *i2c_client, · 273 unmodified lines
274274 if (of_property_read_u32(np, "cirrus,sdout-share", &val) >= 0)
275275 pdata->sdout_share = val;
276276
277− of_property_read_u32(np, "cirrus,boost-manager", &val);
277+ if (of_property_read_u32(np, "cirrus,boost-manager", &val))
278+ val = -1u;
279+
278280 switch (val) {
279281 case CS35L32_BOOST_MGR_AUTO:
280282 case CS35L32_BOOST_MGR_AUTO_AUDIO:
@@ -282,13 +284,15 @@ static int cs35l32_handle_of_data(struct i2c_client *i2c_client, · 1 unmodified line
282284 case CS35L32_BOOST_MGR_FIXED:
283285 pdata->boost_mng = val;
284286 break;
287+ case -1u:
285288 default:
286289 dev_err(&i2c_client->dev,
287290 "Wrong cirrus,boost-manager DT value %d\n", val);
288291 pdata->boost_mng = CS35L32_BOOST_MGR_BYPASS;
289292 }
290293
291− of_property_read_u32(np, "cirrus,sdout-datacfg", &val);
294+ if (of_property_read_u32(np, "cirrus,sdout-datacfg", &val))
295+ val = -1u;
292296 switch (val) {
293297 case CS35L32_DATA_CFG_LR_VP:
294298 case CS35L32_DATA_CFG_LR_STAT:
@@ -296,13 +300,15 @@ static int cs35l32_handle_of_data(struct i2c_client *i2c_client, · 1 unmodified line
296300 case CS35L32_DATA_CFG_LR_VPSTAT:
297301 pdata->sdout_datacfg = val;
298302 break;
303+ case -1u:
299304 default:
300305 dev_err(&i2c_client->dev,
301306 "Wrong cirrus,sdout-datacfg DT value %d\n", val);
302307 pdata->sdout_datacfg = CS35L32_DATA_CFG_LR;
303308 }
304309
305− of_property_read_u32(np, "cirrus,battery-threshold", &val);
310+ if (of_property_read_u32(np, "cirrus,battery-threshold", &val))
311+ val = -1u;
306312 switch (val) {
307313 case CS35L32_BATT_THRESH_3_1V:
308314 case CS35L32_BATT_THRESH_3_2V:
@@ -310,13 +316,15 @@ static int cs35l32_handle_of_data(struct i2c_client *i2c_client, · 1 unmodified line
310316 case CS35L32_BATT_THRESH_3_4V:
311317 pdata->batt_thresh = val;
312318 break;
319+ case -1u:
313320 default:
314321 dev_err(&i2c_client->dev,
315322 "Wrong cirrus,battery-threshold DT value %d\n", val);
316323 pdata->batt_thresh = CS35L32_BATT_THRESH_3_3V;
317324 }
318325
319− of_property_read_u32(np, "cirrus,battery-recovery", &val);
326+ if (of_property_read_u32(np, "cirrus,battery-recovery", &val))
327+ val = -1u;
320328 switch (val) {
321329 case CS35L32_BATT_RECOV_3_1V:
322330 case CS35L32_BATT_RECOV_3_2V:
@@ -326,6 +334,7 @@ static int cs35l32_handle_of_data(struct i2c_client *i2c_client, · 3 unmodified lines
326334 case CS35L32_BATT_RECOV_3_6V:
327335 pdata->batt_recov = val;
328336 break;
337+ case -1u:
329338 default:
330339 dev_err(&i2c_client->dev,
331340 "Wrong cirrus,battery-recovery DT value %d\n", val);
sound/soc/codecs/cs47l24.c+3−0
@@ -1108,6 +1108,9 @@ static int cs47l24_codec_remove(struct snd_soc_codec *codec) · 1107 unmodified lines
11081108 priv->core.arizona->dapm = NULL;
11091109
11101110 arizona_free_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, priv);
1111+
1112+ arizona_free_spk(codec);
1113+
11111114 return 0;
11121115 }
11131116
sound/soc/codecs/hdac_hdmi.c+42−52
@@ -1420,32 +1420,39 @@ static int hdmi_codec_remove(struct snd_soc_codec *codec) · 1419 unmodified lines
14201420 }
14211421
14221422 #ifdef CONFIG_PM
1423−static int hdmi_codec_resume(struct snd_soc_codec *codec)
1423+static int hdmi_codec_prepare(struct device *dev)
14241424 {
1425− struct hdac_ext_device *edev = snd_soc_codec_get_drvdata(codec);
1425+ struct hdac_ext_device *edev = to_hda_ext_device(dev);
1426+ struct hdac_device *hdac = &edev->hdac;
1427+
1428+ pm_runtime_get_sync(&edev->hdac.dev);
1429+
1430+ /*
1431+ * Power down afg.
1432+ * codec_read is preferred over codec_write to set the power state.
1433+ * This way verb is send to set the power state and response
1434+ * is received. So setting power state is ensured without using loop
1435+ * to read the state.
1436+ */
1437+ snd_hdac_codec_read(hdac, hdac->afg, 0, AC_VERB_SET_POWER_STATE,
1438+ AC_PWRST_D3);
1439+
1440+ return 0;
1441+}
1442+
1443+static void hdmi_codec_complete(struct device *dev)
1444+{
1445+ struct hdac_ext_device *edev = to_hda_ext_device(dev);
14261446 struct hdac_hdmi_priv *hdmi = edev->private_data;
14271447 struct hdac_hdmi_pin *pin;
14281448 struct hdac_device *hdac = &edev->hdac;
1429− struct hdac_bus *bus = hdac->bus;
1430− int err;
1431− unsigned long timeout;
1432−
1433− hdac_hdmi_skl_enable_all_pins(&edev->hdac);
1434− hdac_hdmi_skl_enable_dp12(&edev->hdac);
14351449
14361450 /* Power up afg */
1437− if (!snd_hdac_check_power_state(hdac, hdac->afg, AC_PWRST_D0)) {
1438−
1439− snd_hdac_codec_write(hdac, hdac->afg, 0,
1440− AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
1451+ snd_hdac_codec_read(hdac, hdac->afg, 0, AC_VERB_SET_POWER_STATE,
1452+ AC_PWRST_D0);
14411453
1442− /* Wait till power state is set to D0 */
1443− timeout = jiffies + msecs_to_jiffies(1000);
1444− while (!snd_hdac_check_power_state(hdac, hdac->afg, AC_PWRST_D0)
1445− && time_before(jiffies, timeout)) {
1446− msleep(50);
1447− }
1448− }
1454+ hdac_hdmi_skl_enable_all_pins(&edev->hdac);
1455+ hdac_hdmi_skl_enable_dp12(&edev->hdac);
14491456
14501457 /*
14511458 * As the ELD notify callback request is not entertained while the
@@ -1455,28 +1462,16 @@ static int hdmi_codec_resume(struct snd_soc_codec *codec) · 3 unmodified lines
14551462 list_for_each_entry(pin, &hdmi->pin_list, head)
14561463 hdac_hdmi_present_sense(pin, 1);
14571464
1458− /*
1459− * Codec power is turned ON during controller resume.
1460− * Turn it OFF here
1461− */
1462− err = snd_hdac_display_power(bus, false);
1463− if (err < 0) {
1464− dev_err(bus->dev,
1465− "Cannot turn OFF display power on i915, err: %d\n",
1466− err);
1467− return err;
1468− }
1469−
1470− return 0;
1465+ pm_runtime_put_sync(&edev->hdac.dev);
14711466 }
14721467 #else
1473−#define hdmi_codec_resume NULL
1468+#define hdmi_codec_prepare NULL
1469+#define hdmi_codec_complete NULL
14741470 #endif
14751471
14761472 static struct snd_soc_codec_driver hdmi_hda_codec = {
14771473 .probe = hdmi_codec_probe,
14781474 .remove = hdmi_codec_remove,
1479− .resume = hdmi_codec_resume,
14801475 .idle_bias_off = true,
14811476 };
14821477
@@ -1561,7 +1556,6 @@ static int hdac_hdmi_runtime_suspend(struct device *dev) · 78 unmodified lines
15611556 struct hdac_ext_device *edev = to_hda_ext_device(dev);
15621557 struct hdac_device *hdac = &edev->hdac;
15631558 struct hdac_bus *bus = hdac->bus;
1564− unsigned long timeout;
15651559 int err;
15661560
15671561 dev_dbg(dev, "Enter: %s\n", __func__);
@@ -1570,20 +1564,15 @@ static int hdac_hdmi_runtime_suspend(struct device *dev) · 2 unmodified lines
15701564 if (!bus)
15711565 return 0;
15721566
1573− /* Power down afg */
1574− if (!snd_hdac_check_power_state(hdac, hdac->afg, AC_PWRST_D3)) {
1575− snd_hdac_codec_write(hdac, hdac->afg, 0,
1576− AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
1577−
1578− /* Wait till power state is set to D3 */
1579− timeout = jiffies + msecs_to_jiffies(1000);
1580− while (!snd_hdac_check_power_state(hdac, hdac->afg, AC_PWRST_D3)
1581− && time_before(jiffies, timeout)) {
1582−
1583− msleep(50);
1584− }
1585− }
1586−
1567+ /*
1568+ * Power down afg.
1569+ * codec_read is preferred over codec_write to set the power state.
1570+ * This way verb is send to set the power state and response
1571+ * is received. So setting power state is ensured without using loop
1572+ * to read the state.
1573+ */
1574+ snd_hdac_codec_read(hdac, hdac->afg, 0, AC_VERB_SET_POWER_STATE,
1575+ AC_PWRST_D3);
15871576 err = snd_hdac_display_power(bus, false);
15881577 if (err < 0) {
15891578 dev_err(bus->dev, "Cannot turn on display power on i915\n");
@@ -1616,9 +1605,8 @@ static int hdac_hdmi_runtime_resume(struct device *dev) · 26 unmodified lines
16161605 hdac_hdmi_skl_enable_dp12(&edev->hdac);
16171606
16181607 /* Power up afg */
1619− if (!snd_hdac_check_power_state(hdac, hdac->afg, AC_PWRST_D0))
1620− snd_hdac_codec_write(hdac, hdac->afg, 0,
1621− AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
1608+ snd_hdac_codec_read(hdac, hdac->afg, 0, AC_VERB_SET_POWER_STATE,
1609+ AC_PWRST_D0);
16221610
16231611 return 0;
16241612 }
@@ -1629,6 +1617,8 @@ static int hdac_hdmi_runtime_resume(struct device *dev) · 4 unmodified lines
16291617
16301618 static const struct dev_pm_ops hdac_hdmi_pm = {
16311619 SET_RUNTIME_PM_OPS(hdac_hdmi_runtime_suspend, hdac_hdmi_runtime_resume, NULL)
1620+ .prepare = hdmi_codec_prepare,
1621+ .complete = hdmi_codec_complete,
16321622 };
16331623
16341624 static const struct hda_device_id hdmi_list[] = {
sound/soc/codecs/nau8825.c+71−55
@@ -343,9 +343,12 @@ static const struct snd_soc_dapm_widget nau8825_dapm_widgets[] = { · 342 unmodified lines
343343 SND_SOC_DAPM_SUPPLY("ADC Power", NAU8825_REG_ANALOG_ADC_2, 6, 0, NULL,
344344 0),
345345
346− /* ADC for button press detection */
347− SND_SOC_DAPM_ADC("SAR", NULL, NAU8825_REG_SAR_CTRL,
348− NAU8825_SAR_ADC_EN_SFT, 0),
346+ /* ADC for button press detection. A dapm supply widget is used to
347+ * prevent dapm_power_widgets keeping the codec at SND_SOC_BIAS_ON
348+ * during suspend.
349+ */
350+ SND_SOC_DAPM_SUPPLY("SAR", NAU8825_REG_SAR_CTRL,
351+ NAU8825_SAR_ADC_EN_SFT, 0, NULL, 0),
349352
350353 SND_SOC_DAPM_PGA_S("ADACL", 2, NAU8825_REG_RDAC, 12, 0, NULL, 0),
351354 SND_SOC_DAPM_PGA_S("ADACR", 2, NAU8825_REG_RDAC, 13, 0, NULL, 0),
@@ -607,6 +610,16 @@ static bool nau8825_is_jack_inserted(struct regmap *regmap) · 255 unmodified lines
607610
608611 static void nau8825_restart_jack_detection(struct regmap *regmap)
609612 {
613+ /* Chip needs one FSCLK cycle in order to generate interrupts,
614+ * as we cannot guarantee one will be provided by the system. Turning
615+ * master mode on then off enables us to generate that FSCLK cycle
616+ * with a minimum of contention on the clock bus.
617+ */
618+ regmap_update_bits(regmap, NAU8825_REG_I2S_PCM_CTRL2,
619+ NAU8825_I2S_MS_MASK, NAU8825_I2S_MS_MASTER);
620+ regmap_update_bits(regmap, NAU8825_REG_I2S_PCM_CTRL2,
621+ NAU8825_I2S_MS_MASK, NAU8825_I2S_MS_SLAVE);
622+
610623 /* this will restart the entire jack detection process including MIC/GND
611624 * switching and create interrupts. We have to go from 0 to 1 and back
612625 * to 0 to restart.
@@ -728,7 +741,10 @@ static irqreturn_t nau8825_interrupt(int irq, void *data) · 115 unmodified lines
728741 struct regmap *regmap = nau8825->regmap;
729742 int active_irq, clear_irq = 0, event = 0, event_mask = 0;
730743
731− regmap_read(regmap, NAU8825_REG_IRQ_STATUS, &active_irq);
744+ if (regmap_read(regmap, NAU8825_REG_IRQ_STATUS, &active_irq)) {
745+ dev_err(nau8825->dev, "failed to read irq status\n");
746+ return IRQ_NONE;
747+ }
732748
733749 if ((active_irq & NAU8825_JACK_EJECTION_IRQ_MASK) ==
734750 NAU8825_JACK_EJECTION_DETECTED) {
@@ -1141,33 +1157,74 @@ static int nau8825_set_bias_level(struct snd_soc_codec *codec, · 406 unmodified lines
11411157 return ret;
11421158 }
11431159 }
1144−
1145− ret = regcache_sync(nau8825->regmap);
1146− if (ret) {
1147− dev_err(codec->dev,
1148− "Failed to sync cache: %d\n", ret);
1149− return ret;
1150− }
11511160 }
1152−
11531161 break;
11541162
11551163 case SND_SOC_BIAS_OFF:
11561164 if (nau8825->mclk_freq)
11571165 clk_disable_unprepare(nau8825->mclk);
1158−
1159− regcache_mark_dirty(nau8825->regmap);
11601166 break;
11611167 }
11621168 return 0;
11631169 }
11641170
1171+#ifdef CONFIG_PM
1172+static int nau8825_suspend(struct snd_soc_codec *codec)
1173+{
1174+ struct nau8825 *nau8825 = snd_soc_codec_get_drvdata(codec);
1175+
1176+ disable_irq(nau8825->irq);
1177+ regcache_cache_only(nau8825->regmap, true);
1178+ regcache_mark_dirty(nau8825->regmap);
1179+
1180+ return 0;
1181+}
1182+
1183+static int nau8825_resume(struct snd_soc_codec *codec)
1184+{
1185+ struct nau8825 *nau8825 = snd_soc_codec_get_drvdata(codec);
1186+
1187+ /* The chip may lose power and reset in S3. regcache_sync restores
1188+ * register values including configurations for sysclk, irq, and
1189+ * jack/button detection.
1190+ */
1191+ regcache_cache_only(nau8825->regmap, false);
1192+ regcache_sync(nau8825->regmap);
1193+
1194+ /* Check the jack plug status directly. If the headset is unplugged
1195+ * during S3 when the chip has no power, there will be no jack
1196+ * detection irq even after the nau8825_restart_jack_detection below,
1197+ * because the chip just thinks no headset has ever been plugged in.
1198+ */
1199+ if (!nau8825_is_jack_inserted(nau8825->regmap)) {
1200+ nau8825_eject_jack(nau8825);
1201+ snd_soc_jack_report(nau8825->jack, 0, SND_JACK_HEADSET);
1202+ }
1203+
1204+ enable_irq(nau8825->irq);
1205+
1206+ /* Run jack detection to check the type (OMTP or CTIA) of the headset
1207+ * if there is one. This handles the case where a different type of
1208+ * headset is plugged in during S3. This triggers an IRQ iff a headset
1209+ * is already plugged in.
1210+ */
1211+ nau8825_restart_jack_detection(nau8825->regmap);
1212+
1213+ return 0;
1214+}
1215+#else
1216+#define nau8825_suspend NULL
1217+#define nau8825_resume NULL
1218+#endif
1219+
11651220 static struct snd_soc_codec_driver nau8825_codec_driver = {
11661221 .probe = nau8825_codec_probe,
11671222 .set_sysclk = nau8825_set_sysclk,
11681223 .set_pll = nau8825_set_pll,
11691224 .set_bias_level = nau8825_set_bias_level,
11701225 .suspend_bias_off = true,
1226+ .suspend = nau8825_suspend,
1227+ .resume = nau8825_resume,
11711228
11721229 .controls = nau8825_controls,
11731230 .num_controls = ARRAY_SIZE(nau8825_controls),
@@ -1277,16 +1334,6 @@ static int nau8825_setup_irq(struct nau8825 *nau8825) · 103 unmodified lines
12771334 regmap_update_bits(regmap, NAU8825_REG_ENA_CTRL,
12781335 NAU8825_ENABLE_DACR, NAU8825_ENABLE_DACR);
12791336
1280− /* Chip needs one FSCLK cycle in order to generate interrupts,
1281− * as we cannot guarantee one will be provided by the system. Turning
1282− * master mode on then off enables us to generate that FSCLK cycle
1283− * with a minimum of contention on the clock bus.
1284− */
1285− regmap_update_bits(regmap, NAU8825_REG_I2S_PCM_CTRL2,
1286− NAU8825_I2S_MS_MASK, NAU8825_I2S_MS_MASTER);
1287− regmap_update_bits(regmap, NAU8825_REG_I2S_PCM_CTRL2,
1288− NAU8825_I2S_MS_MASK, NAU8825_I2S_MS_SLAVE);
1289−
12901337 ret = devm_request_threaded_irq(nau8825->dev, nau8825->irq, NULL,
12911338 nau8825_interrupt, IRQF_TRIGGER_LOW | IRQF_ONESHOT,
12921339 "nau8825", nau8825);
@@ -1354,36 +1401,6 @@ static int nau8825_i2c_remove(struct i2c_client *client) · 61 unmodified lines
13541401 return 0;
13551402 }
13561403
1357−#ifdef CONFIG_PM_SLEEP
1358−static int nau8825_suspend(struct device *dev)
1359−{
1360− struct i2c_client *client = to_i2c_client(dev);
1361− struct nau8825 *nau8825 = dev_get_drvdata(dev);
1362−
1363− disable_irq(client->irq);
1364− regcache_cache_only(nau8825->regmap, true);
1365− regcache_mark_dirty(nau8825->regmap);
1366−
1367− return 0;
1368−}
1369−
1370−static int nau8825_resume(struct device *dev)
1371−{
1372− struct i2c_client *client = to_i2c_client(dev);
1373− struct nau8825 *nau8825 = dev_get_drvdata(dev);
1374−
1375− regcache_cache_only(nau8825->regmap, false);
1376− regcache_sync(nau8825->regmap);
1377− enable_irq(client->irq);
1378−
1379− return 0;
1380−}
1381−#endif
1382−
1383−static const struct dev_pm_ops nau8825_pm = {
1384− SET_SYSTEM_SLEEP_PM_OPS(nau8825_suspend, nau8825_resume)
1385−};
1386−
13871404 static const struct i2c_device_id nau8825_i2c_ids[] = {
13881405 { "nau8825", 0 },
13891406 { }
@@ -1410,7 +1427,6 @@ static struct i2c_driver nau8825_driver = { · 20 unmodified lines
14101427 .name = "nau8825",
14111428 .of_match_table = of_match_ptr(nau8825_of_ids),
14121429 .acpi_match_table = ACPI_PTR(nau8825_acpi_match),
1413− .pm = &nau8825_pm,
14141430 },
14151431 .probe = nau8825_i2c_probe,
14161432 .remove = nau8825_i2c_remove,
sound/soc/codecs/rt5640.c+1−1
@@ -359,7 +359,7 @@ static const DECLARE_TLV_DB_RANGE(bst_tlv, · 358 unmodified lines
359359
360360 /* Interface data select */
361361 static const char * const rt5640_data_select[] = {
362− "Normal", "left copy to right", "right copy to left", "Swap"};
362+ "Normal", "Swap", "left copy to right", "right copy to left"};
363363
364364 static SOC_ENUM_SINGLE_DECL(rt5640_if1_dac_enum, RT5640_DIG_INF_DATA,
365365 RT5640_IF1_DAC_SEL_SFT, rt5640_data_select);
sound/soc/codecs/rt5640.h+18−18
@@ -443,39 +443,39 @@ · 442 unmodified lines
443443 #define RT5640_IF1_DAC_SEL_MASK (0x3 << 14)
444444 #define RT5640_IF1_DAC_SEL_SFT 14
445445 #define RT5640_IF1_DAC_SEL_NOR (0x0 << 14)
446−#define RT5640_IF1_DAC_SEL_L2R (0x1 << 14)
447−#define RT5640_IF1_DAC_SEL_R2L (0x2 << 14)
448−#define RT5640_IF1_DAC_SEL_SWAP (0x3 << 14)
446+#define RT5640_IF1_DAC_SEL_SWAP (0x1 << 14)
447+#define RT5640_IF1_DAC_SEL_L2R (0x2 << 14)
448+#define RT5640_IF1_DAC_SEL_R2L (0x3 << 14)
449449 #define RT5640_IF1_ADC_SEL_MASK (0x3 << 12)
450450 #define RT5640_IF1_ADC_SEL_SFT 12
451451 #define RT5640_IF1_ADC_SEL_NOR (0x0 << 12)
452−#define RT5640_IF1_ADC_SEL_L2R (0x1 << 12)
453−#define RT5640_IF1_ADC_SEL_R2L (0x2 << 12)
454−#define RT5640_IF1_ADC_SEL_SWAP (0x3 << 12)
452+#define RT5640_IF1_ADC_SEL_SWAP (0x1 << 12)
453+#define RT5640_IF1_ADC_SEL_L2R (0x2 << 12)
454+#define RT5640_IF1_ADC_SEL_R2L (0x3 << 12)
455455 #define RT5640_IF2_DAC_SEL_MASK (0x3 << 10)
456456 #define RT5640_IF2_DAC_SEL_SFT 10
457457 #define RT5640_IF2_DAC_SEL_NOR (0x0 << 10)
458−#define RT5640_IF2_DAC_SEL_L2R (0x1 << 10)
459−#define RT5640_IF2_DAC_SEL_R2L (0x2 << 10)
460−#define RT5640_IF2_DAC_SEL_SWAP (0x3 << 10)
458+#define RT5640_IF2_DAC_SEL_SWAP (0x1 << 10)
459+#define RT5640_IF2_DAC_SEL_L2R (0x2 << 10)
460+#define RT5640_IF2_DAC_SEL_R2L (0x3 << 10)
461461 #define RT5640_IF2_ADC_SEL_MASK (0x3 << 8)
462462 #define RT5640_IF2_ADC_SEL_SFT 8
463463 #define RT5640_IF2_ADC_SEL_NOR (0x0 << 8)
464−#define RT5640_IF2_ADC_SEL_L2R (0x1 << 8)
465−#define RT5640_IF2_ADC_SEL_R2L (0x2 << 8)
466−#define RT5640_IF2_ADC_SEL_SWAP (0x3 << 8)
464+#define RT5640_IF2_ADC_SEL_SWAP (0x1 << 8)
465+#define RT5640_IF2_ADC_SEL_L2R (0x2 << 8)
466+#define RT5640_IF2_ADC_SEL_R2L (0x3 << 8)
467467 #define RT5640_IF3_DAC_SEL_MASK (0x3 << 6)
468468 #define RT5640_IF3_DAC_SEL_SFT 6
469469 #define RT5640_IF3_DAC_SEL_NOR (0x0 << 6)
470−#define RT5640_IF3_DAC_SEL_L2R (0x1 << 6)
471−#define RT5640_IF3_DAC_SEL_R2L (0x2 << 6)
472−#define RT5640_IF3_DAC_SEL_SWAP (0x3 << 6)
470+#define RT5640_IF3_DAC_SEL_SWAP (0x1 << 6)
471+#define RT5640_IF3_DAC_SEL_L2R (0x2 << 6)
472+#define RT5640_IF3_DAC_SEL_R2L (0x3 << 6)
473473 #define RT5640_IF3_ADC_SEL_MASK (0x3 << 4)
474474 #define RT5640_IF3_ADC_SEL_SFT 4
475475 #define RT5640_IF3_ADC_SEL_NOR (0x0 << 4)
476−#define RT5640_IF3_ADC_SEL_L2R (0x1 << 4)
477−#define RT5640_IF3_ADC_SEL_R2L (0x2 << 4)
478−#define RT5640_IF3_ADC_SEL_SWAP (0x3 << 4)
476+#define RT5640_IF3_ADC_SEL_SWAP (0x1 << 4)
477+#define RT5640_IF3_ADC_SEL_L2R (0x2 << 4)
478+#define RT5640_IF3_ADC_SEL_R2L (0x3 << 4)
479479
480480 /* REC Left Mixer Control 1 (0x3b) */
481481 #define RT5640_G_HP_L_RM_L_MASK (0x7 << 13)
sound/soc/codecs/wm5102.c+5−0
@@ -1955,11 +1955,16 @@ err_adsp2_codec_probe: · 1954 unmodified lines
19551955 static int wm5102_codec_remove(struct snd_soc_codec *codec)
19561956 {
19571957 struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec);
1958+ struct arizona *arizona = priv->core.arizona;
19581959
19591960 wm_adsp2_codec_remove(&priv->core.adsp[0], codec);
19601961
19611962 priv->core.arizona->dapm = NULL;
19621963
1964+ arizona_free_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, priv);
1965+
1966+ arizona_free_spk(codec);
1967+
19631968 return 0;
19641969 }
19651970
sound/soc/codecs/wm5110.c+2−0
@@ -2298,6 +2298,8 @@ static int wm5110_codec_remove(struct snd_soc_codec *codec) · 2297 unmodified lines
22982298
22992299 arizona_free_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, priv);
23002300
2301+ arizona_free_spk(codec);
2302+
23012303 return 0;
23022304 }
23032305
sound/soc/codecs/wm8962.c+1−1
@@ -2471,7 +2471,7 @@ static void wm8962_configure_bclk(struct snd_soc_codec *codec) · 2470 unmodified lines
24712471 break;
24722472 default:
24732473 dev_warn(codec->dev, "Unknown DSPCLK divisor read back\n");
2474− dspclk = wm8962->sysclk;
2474+ dspclk = wm8962->sysclk_rate;
24752475 }
24762476
24772477 dev_dbg(codec->dev, "DSPCLK is %dHz, BCLK %d\n", dspclk, wm8962->bclk);
sound/soc/codecs/wm8997.c+2−0
@@ -1072,6 +1072,8 @@ static int wm8997_codec_remove(struct snd_soc_codec *codec) · 1071 unmodified lines
10721072
10731073 priv->core.arizona->dapm = NULL;
10741074
1075+ arizona_free_spk(codec);
1076+
10751077 return 0;
10761078 }
10771079
sound/soc/codecs/wm8998.c+2−0
@@ -1324,6 +1324,8 @@ static int wm8998_codec_remove(struct snd_soc_codec *codec) · 1323 unmodified lines
13241324
13251325 priv->core.arizona->dapm = NULL;
13261326
1327+ arizona_free_spk(codec);
1328+
13271329 return 0;
13281330 }
13291331
sound/soc/intel/Kconfig+0−1
@@ -163,7 +163,6 @@ config SND_SOC_INTEL_SKYLAKE · 162 unmodified lines
163163 tristate
164164 select SND_HDA_EXT_CORE
165165 select SND_SOC_TOPOLOGY
166− select SND_HDA_I915
167166 select SND_SOC_INTEL_SST
168167
169168 config SND_SOC_INTEL_SKL_RT286_MACH
sound/soc/intel/haswell/sst-haswell-ipc.c+1−1
@@ -1345,7 +1345,7 @@ int sst_hsw_stream_reset(struct sst_hsw *hsw, struct sst_hsw_stream *stream) · 1344 unmodified lines
13451345 return 0;
13461346
13471347 /* wait for pause to complete before we reset the stream */
1348− while (stream->running && tries--)
1348+ while (stream->running && --tries)
13491349 msleep(1);
13501350 if (!tries) {
13511351 dev_err(hsw->dev, "error: reset stream %d still running\n",
sound/soc/intel/skylake/skl-sst-dsp.c+5−0
@@ -336,6 +336,11 @@ void skl_dsp_free(struct sst_dsp *dsp) · 335 unmodified lines
336336 skl_ipc_int_disable(dsp);
337337
338338 free_irq(dsp->irq, dsp);
339+ dsp->cl_dev.ops.cl_cleanup_controller(dsp);
340+ skl_cldma_int_disable(dsp);
341+ skl_ipc_op_int_disable(dsp);
342+ skl_ipc_int_disable(dsp);
343+
339344 skl_dsp_disable_core(dsp);
340345 }
341346 EXPORT_SYMBOL_GPL(skl_dsp_free);
sound/soc/intel/skylake/skl-topology.c+28−14
@@ -239,6 +239,7 @@ static void skl_tplg_update_buffer_size(struct skl_sst *ctx, · 238 unmodified lines
239239 {
240240 int multiplier = 1;
241241 struct skl_module_fmt *in_fmt, *out_fmt;
242+ int in_rate, out_rate;
242243
243244
244245 /* Since fixups is applied to pin 0 only, ibs, obs needs
@@ -249,15 +250,24 @@ static void skl_tplg_update_buffer_size(struct skl_sst *ctx, · 4 unmodified lines
249250
250251 if (mcfg->m_type == SKL_MODULE_TYPE_SRCINT)
251252 multiplier = 5;
252− mcfg->ibs = (in_fmt->s_freq / 1000) *
253− (mcfg->in_fmt->channels) *
254− (mcfg->in_fmt->bit_depth >> 3) *
255− multiplier;
256−
257− mcfg->obs = (mcfg->out_fmt->s_freq / 1000) *
258− (mcfg->out_fmt->channels) *
259− (mcfg->out_fmt->bit_depth >> 3) *
260− multiplier;
253+
254+ if (in_fmt->s_freq % 1000)
255+ in_rate = (in_fmt->s_freq / 1000) + 1;
256+ else
257+ in_rate = (in_fmt->s_freq / 1000);
258+
259+ mcfg->ibs = in_rate * (mcfg->in_fmt->channels) *
260+ (mcfg->in_fmt->bit_depth >> 3) *
261+ multiplier;
262+
263+ if (mcfg->out_fmt->s_freq % 1000)
264+ out_rate = (mcfg->out_fmt->s_freq / 1000) + 1;
265+ else
266+ out_rate = (mcfg->out_fmt->s_freq / 1000);
267+
268+ mcfg->obs = out_rate * (mcfg->out_fmt->channels) *
269+ (mcfg->out_fmt->bit_depth >> 3) *
270+ multiplier;
261271 }
262272
263273 static int skl_tplg_update_be_blob(struct snd_soc_dapm_widget *w,
@@ -485,11 +495,15 @@ skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe) · 221 unmodified lines
485495 if (!skl_is_pipe_mcps_avail(skl, mconfig))
486496 return -ENOMEM;
487497
498+ skl_tplg_alloc_pipe_mcps(skl, mconfig);
499+
488500 if (mconfig->is_loadable && ctx->dsp->fw_ops.load_mod) {
489501 ret = ctx->dsp->fw_ops.load_mod(ctx->dsp,
490502 mconfig->id.module_id, mconfig->guid);
491503 if (ret < 0)
492504 return ret;
505+
506+ mconfig->m_state = SKL_MODULE_LOADED;
493507 }
494508
495509 /* update blob if blob is null for be with default value */
@@ -509,7 +523,6 @@ skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe) · 13 unmodified lines
509523 ret = skl_tplg_set_module_params(w, ctx);
510524 if (ret < 0)
511525 return ret;
512− skl_tplg_alloc_pipe_mcps(skl, mconfig);
513526 }
514527
515528 return 0;
@@ -524,7 +537,8 @@ static int skl_tplg_unload_pipe_modules(struct skl_sst *ctx, · 8 unmodified lines
524537 list_for_each_entry(w_module, &pipe->w_list, node) {
525538 mconfig = w_module->w->priv;
526539
527− if (mconfig->is_loadable && ctx->dsp->fw_ops.unload_mod)
540+ if (mconfig->is_loadable && ctx->dsp->fw_ops.unload_mod &&
541+ mconfig->m_state > SKL_MODULE_UNINIT)
528542 return ctx->dsp->fw_ops.unload_mod(ctx->dsp,
529543 mconfig->id.module_id);
530544 }
@@ -558,6 +572,9 @@ static int skl_tplg_mixer_dapm_pre_pmu_event(struct snd_soc_dapm_widget *w, · 27 unmodified lines
558572 if (!skl_is_pipe_mem_avail(skl, mconfig))
559573 return -ENOMEM;
560574
575+ skl_tplg_alloc_pipe_mem(skl, mconfig);
576+ skl_tplg_alloc_pipe_mcps(skl, mconfig);
577+
561578 /*
562579 * Create a list of modules for pipe.
563580 * This list contains modules from source to sink
@@ -601,9 +618,6 @@ static int skl_tplg_mixer_dapm_pre_pmu_event(struct snd_soc_dapm_widget *w, · 37 unmodified lines
601618 src_module = dst_module;
602619 }
603620
604− skl_tplg_alloc_pipe_mem(skl, mconfig);
605− skl_tplg_alloc_pipe_mcps(skl, mconfig);
606−
607621 return 0;
608622 }
609623
sound/soc/intel/skylake/skl-topology.h+4−4
@@ -274,10 +274,10 @@ struct skl_pipe { · 273 unmodified lines
274274
275275 enum skl_module_state {
276276 SKL_MODULE_UNINIT = 0,
277− SKL_MODULE_INIT_DONE = 1,
278− SKL_MODULE_LOADED = 2,
279− SKL_MODULE_UNLOADED = 3,
280− SKL_MODULE_BIND_DONE = 4
277+ SKL_MODULE_LOADED = 1,
278+ SKL_MODULE_INIT_DONE = 2,
279+ SKL_MODULE_BIND_DONE = 3,
280+ SKL_MODULE_UNLOADED = 4,
281281 };
282282
283283 struct skl_module_cfg {
sound/soc/intel/skylake/skl.c+23−9
@@ -222,6 +222,7 @@ static int skl_suspend(struct device *dev) · 221 unmodified lines
222222 struct hdac_ext_bus *ebus = pci_get_drvdata(pci);
223223 struct skl *skl = ebus_to_skl(ebus);
224224 struct hdac_bus *bus = ebus_to_hbus(ebus);
225+ int ret = 0;
225226
226227 /*
227228 * Do not suspend if streams which are marked ignore suspend are
@@ -232,10 +233,20 @@ static int skl_suspend(struct device *dev) · 4 unmodified lines
232233 enable_irq_wake(bus->irq);
233234 pci_save_state(pci);
234235 pci_disable_device(pci);
235− return 0;
236236 } else {
237− return _skl_suspend(ebus);
237+ ret = _skl_suspend(ebus);
238+ if (ret < 0)
239+ return ret;
240+ }
241+
242+ if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) {
243+ ret = snd_hdac_display_power(bus, false);
244+ if (ret < 0)
245+ dev_err(bus->dev,
246+ "Cannot turn OFF display power on i915\n");
238247 }
248+
249+ return ret;
239250 }
240251
241252 static int skl_resume(struct device *dev)
@@ -316,17 +327,20 @@ static int skl_free(struct hdac_ext_bus *ebus) · 74 unmodified lines
316327
317328 if (bus->irq >= 0)
318329 free_irq(bus->irq, (void *)bus);
319− if (bus->remap_addr)
320− iounmap(bus->remap_addr);
321−
322330 snd_hdac_bus_free_stream_pages(bus);
323331 snd_hdac_stream_free_all(ebus);
324332 snd_hdac_link_free_all(ebus);
333+
334+ if (bus->remap_addr)
335+ iounmap(bus->remap_addr);
336+
325337 pci_release_regions(skl->pci);
326338 pci_disable_device(skl->pci);
327339
328340 snd_hdac_ext_bus_exit(ebus);
329341
342+ if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI))
343+ snd_hdac_i915_exit(&ebus->bus);
330344 return 0;
331345 }
332346
@@ -719,12 +733,12 @@ static void skl_remove(struct pci_dev *pci) · 386 unmodified lines
719733 if (skl->tplg)
720734 release_firmware(skl->tplg);
721735
722− if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI))
723− snd_hdac_i915_exit(&ebus->bus);
724−
725736 if (pci_dev_run_wake(pci))
726737 pm_runtime_get_noresume(&pci->dev);
727− pci_dev_put(pci);
738+
739+ /* codec removal, invoke bus_device_remove */
740+ snd_hdac_ext_bus_device_remove(ebus);
741+
728742 skl_platform_unregister(&pci->dev);
729743 skl_free_dsp(skl);
730744 skl_machine_device_unregister(skl);
sound/soc/soc-dapm.c+7−0
@@ -2188,6 +2188,13 @@ static ssize_t dapm_widget_show_component(struct snd_soc_component *cmpnt, · 2187 unmodified lines
21882188 int count = 0;
21892189 char *state = "not set";
21902190
2191+ /* card won't be set for the dummy component, as a spot fix
2192+ * we're checking for that case specifically here but in future
2193+ * we will ensure that the dummy component looks like others.
2194+ */
2195+ if (!cmpnt->card)
2196+ return 0;
2197+
21912198 list_for_each_entry(w, &cmpnt->card->widgets, list) {
21922199 if (w->dapm != dapm)
21932200 continue;