History

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

Conflicts: drivers/net/ethernet/cavium/Kconfig The cavium conflict was overlapping dependency changes.

David S. Miller committed 11 years ago

Commit 182ad462 parents e8fed98 5b3e2e1314 files · +3071 −1831Browse files

Unified · Split

314 files
  1. Documentation/devicetree/bindings/dma/apm-xgene-dma.txt +1 −1
  2. Documentation/devicetree/bindings/phy/ti-phy.txt +16 −0
  3. Documentation/input/alps.txt +4 −2
  4. MAINTAINERS +5 −1
  5. Makefile +8 −3
  6. arch/arc/Kconfig +11 −2
  7. arch/arc/Makefile +9 −1
  8. arch/arc/include/asm/arcregs.h +3 −4
  9. arch/arc/include/asm/atomic.h +55 −23
  10. arch/arc/include/asm/ptrace.h +27 −27
  11. arch/arc/include/asm/spinlock.h +523 −15
  12. arch/arc/include/asm/spinlock_types.h +2 −0
  13. arch/arc/include/uapi/asm/ptrace.h +10 −10
  14. arch/arc/kernel/setup.c +11 −1
  15. arch/arc/kernel/time.c +15 −25
  16. arch/arc/lib/memcpy-archs.S +1 −1
  17. arch/arc/lib/memset-archs.S +36 −7
  18. arch/arc/plat-axs10x/axs10x.c +15 −0
  19. arch/arm/boot/dts/dra7.dtsi +1 −0
  20. arch/arm/boot/dts/exynos3250.dtsi +1 −1
  21. arch/arm/boot/dts/exynos4210-origen.dts +4 −0
  22. arch/arm/boot/dts/exynos4210-trats.dts +4 −0
  23. arch/arm/boot/dts/exynos4210-universal_c210.dts +4 −0
  24. arch/arm/boot/dts/exynos4210.dtsi +12 −0
  25. arch/arm/boot/dts/imx35.dtsi +4 −4
  26. arch/arm/boot/dts/k2e-clocks.dtsi +2 −3
  27. arch/arm/boot/dts/k2hk-clocks.dtsi +2 −3
  28. arch/arm/boot/dts/k2l-clocks.dtsi +2 −3
  29. arch/arm/boot/dts/ste-nomadik-nhk15.dts +1 −0
  30. arch/arm/boot/dts/ste-nomadik-s8815.dts +4 −0
  31. arch/arm/boot/dts/ste-nomadik-stn8815.dtsi +1 −0
  32. arch/arm/mach-omap2/omap_hwmod.c +16 −8
  33. arch/arm/mach-omap2/omap_hwmod_7xx_data.c +2 −3
  34. arch/arm64/boot/dts/apm/apm-storm.dtsi +1 −1
  35. arch/arm64/kernel/signal32.c +2 −3
  36. arch/arm64/kernel/vdso.c +3 −4
  37. arch/mips/Kconfig +0 −1
  38. arch/mips/ath79/setup.c +1 −0
  39. arch/mips/cavium-octeon/smp.c +1 −1
  40. arch/mips/include/asm/mach-bcm63xx/dma-coherence.h +0 −10
  41. arch/mips/include/asm/pgtable.h +31 −0
  42. arch/mips/include/asm/smp.h +0 −2
  43. arch/mips/include/asm/stackframe.h +25 −0
  44. arch/mips/kernel/mips-mt-fpaff.c +3 −2
  45. arch/mips/kernel/prom.c +1 −1
  46. arch/mips/kernel/relocate_kernel.S +4 −4
  47. arch/mips/kernel/signal32.c +0 −2
  48. arch/mips/kernel/smp-bmips.c +2 −2
  49. arch/mips/kernel/smp.c +0 −10
  50. arch/mips/kernel/traps.c +13 −0
  51. arch/mips/kernel/unaligned.c +1 −1
  52. arch/mips/lantiq/irq.c +2 −1
  53. arch/mips/loongson64/loongson-3/smp.c +5 −2
  54. arch/mips/mm/cache.c +4 −4
  55. arch/mips/mm/fault.c +2 −1
  56. arch/mips/mti-malta/malta-int.c +1 −1
  57. arch/mips/mti-malta/malta-time.c +10 −6
  58. arch/mips/mti-sead3/sead3-time.c +1 −0
  59. arch/mips/netlogic/common/smp.c +1 −1
  60. arch/mips/paravirt/paravirt-smp.c +1 −1
  61. arch/mips/pistachio/time.c +1 −0
  62. arch/mips/pmcs-msp71xx/msp_smp.c +1 −1
  63. arch/mips/ralink/irq.c +1 −0
  64. arch/mips/sgi-ip27/ip27-irq.c +6 −2
  65. arch/mips/sibyte/bcm1480/smp.c +5 −4
  66. arch/mips/sibyte/sb1250/smp.c +5 −2
  67. arch/powerpc/kernel/signal_32.c +0 −2
  68. arch/powerpc/platforms/powernv/eeh-powernv.c +1 −1
  69. arch/powerpc/platforms/powernv/pci-ioda.c +6 −5
  70. arch/s390/kvm/kvm-s390.c +2 −2
  71. arch/sparc/include/asm/visasm.h +5 −11
  72. arch/sparc/lib/NG4memcpy.S +4 −1
  73. arch/sparc/lib/VISsave.S +2 −65
  74. arch/sparc/lib/ksyms.c +0 −4
  75. arch/tile/kernel/compat_signal.c +0 −2
  76. arch/x86/boot/compressed/eboot.c +4 −0
  77. arch/x86/include/asm/desc.h +0 −15
  78. arch/x86/include/asm/mmu.h +1 −2
  79. arch/x86/include/asm/mmu_context.h +49 −5
  80. arch/x86/include/asm/sigcontext.h +3 −3
  81. arch/x86/include/uapi/asm/sigcontext.h +3 −18
  82. arch/x86/kernel/apic/io_apic.c +1 −1
  83. arch/x86/kernel/cpu/common.c +2 −2
  84. arch/x86/kernel/cpu/perf_event.c +8 −4
  85. arch/x86/kernel/ldt.c +142 −120
  86. arch/x86/kernel/process_64.c +2 −2
  87. arch/x86/kernel/signal.c +11 −15
  88. arch/x86/kernel/step.c +4 −2
  89. arch/x86/kvm/mtrr.c +4 −4
  90. arch/x86/platform/efi/efi.c +5 −0
  91. arch/x86/power/cpu.c +2 −1
  92. arch/x86/xen/Makefile +2 −2
  93. arch/x86/xen/enlighten.c +40 −0
  94. arch/x86/xen/xen-ops.h +2 −4
  95. drivers/base/regmap/regcache-rbtree.c +14 −5
  96. drivers/block/rbd.c +17 −5
  97. drivers/block/xen-blkback/blkback.c +2 −2
  98. drivers/block/xen-blkfront.c +72 −56
  99. drivers/char/hw_random/core.c +1 −1
  100. drivers/cpufreq/loongson2_cpufreq.c +1 −1
  101. drivers/crypto/ixp4xx_crypto.c +0 −1
  102. drivers/crypto/qat/qat_common/qat_algs.c +16 −8
  103. drivers/dma/at_hdmac.c +87 −45
  104. drivers/dma/at_hdmac_regs.h +1 −2
  105. drivers/dma/at_xdmac.c +14 −12
  106. drivers/dma/mv_xor.c +5 −4
  107. drivers/dma/pl330.c +2 −1
  108. drivers/dma/virt-dma.c +6 −13
  109. drivers/dma/virt-dma.h +1 −12
  110. drivers/dma/xgene-dma.c +3 −0
  111. drivers/edac/ppc4xx_edac.c +1 −1
  112. drivers/extcon/extcon-palmas.c +0 −13
  113. drivers/extcon/extcon.c +44 −17
  114. drivers/firmware/efi/efi.c +5 −0
  115. drivers/gpu/drm/amd/amdgpu/amdgpu.h +4 −0
  116. drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +7 −6
  117. drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +14 −3
  118. drivers/gpu/drm/amd/amdgpu/cik_sdma.c +1 −0
  119. drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +7 −1
  120. drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +24 −14
  121. drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +4 −2
  122. drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +4 −2
  123. drivers/gpu/drm/drm_atomic_helper.c +9 −1
  124. drivers/gpu/drm/drm_dp_mst_topology.c +0 −1
  125. drivers/gpu/drm/drm_irq.c +1 −1
  126. drivers/gpu/drm/i2c/tda998x_drv.c +2 −2
  127. drivers/gpu/drm/i915/intel_bios.c +23 −4
  128. drivers/gpu/drm/i915/intel_dp_mst.c +11 −0
  129. drivers/hid/hid-input.c +5 −2
  130. drivers/hid/hid-uclogic.c +1 −1
  131. drivers/hid/wacom_sys.c +37 −33
  132. drivers/hwmon/dell-smm-hwmon.c +17 −1
  133. drivers/hwmon/g762.c +1 −0
  134. drivers/hwmon/nct7904.c +1 −0
  135. drivers/i2c/busses/i2c-bfin-twi.c +2 −2
  136. drivers/i2c/busses/i2c-omap.c +11 −0
  137. drivers/i2c/i2c-core.c +17 −7
  138. drivers/i2c/i2c-slave-eeprom.c +0 −6
  139. drivers/input/joystick/turbografx.c +1 −1
  140. drivers/input/misc/axp20x-pek.c +1 −0
  141. drivers/input/misc/twl4030-vibra.c +2 −1
  142. drivers/input/mouse/alps.c +6 −2
  143. drivers/input/mouse/elantech.c +20 −2
  144. drivers/input/mouse/elantech.h +1 −0
  145. drivers/irqchip/irq-mips-gic.c +1 −1
  146. drivers/macintosh/ans-lcd.c +1 −1
  147. drivers/md/dm-cache-policy-mq.c +0 −2
  148. drivers/md/dm-cache-policy-smq.c +2 −0
  149. drivers/md/dm-thin-metadata.c +2 −2
  150. drivers/md/dm.c +10 −17
  151. drivers/md/md.c +1 −1
  152. drivers/md/persistent-data/dm-btree-internal.h +6 −0
  153. drivers/md/persistent-data/dm-btree-remove.c +7 −10
  154. drivers/md/persistent-data/dm-btree-spine.c +37 −0
  155. drivers/md/persistent-data/dm-btree.c +1 −6
  156. drivers/md/raid1.c +6 −4
  157. drivers/md/raid5.c +3 −2
  158. drivers/mfd/Kconfig +1 −1
  159. drivers/mfd/arizona-core.c +7 −9
  160. drivers/misc/eeprom/at24.c +0 −3
  161. drivers/net/bonding/bond_main.c +1 −0
  162. drivers/net/ethernet/3com/3c59x.c +8 −9
  163. drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +1 −1
  164. drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +16 −0
  165. drivers/net/ethernet/brocade/bna/bnad.c +1 −1
  166. drivers/net/ethernet/cavium/Kconfig +0 −3
  167. drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c +2 −1
  168. drivers/net/ethernet/emulex/benet/be_cmds.h +5 −0
  169. drivers/net/ethernet/emulex/benet/be_main.c +120 −67
  170. drivers/net/ethernet/freescale/fec_main.c +1 −0
  171. drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +2 −1
  172. drivers/net/ethernet/freescale/fs_enet/mac-fec.c +1 −1
  173. drivers/net/ethernet/freescale/gianfar_ethtool.c +4 −341
  174. drivers/net/ethernet/marvell/mvpp2.c +167 −77
  175. drivers/net/ethernet/mellanox/mlx5/core/main.c +2 −0
  176. drivers/net/ethernet/realtek/r8169.c +3 −1
  177. drivers/net/ethernet/rocker/rocker.c +1 −0
  178. drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c +2 −2
  179. drivers/net/ethernet/ti/netcp.h +0 −1
  180. drivers/net/ethernet/ti/netcp_core.c +13 −22
  181. drivers/net/hamradio/mkiss.c +4 −3
  182. drivers/net/ntb_netdev.c +8 −1
  183. drivers/net/virtio_net.c +2 −2
  184. drivers/net/wan/cosa.c +2 −1
  185. drivers/net/wireless/b43/tables_nphy.c +1 −1
  186. drivers/net/wireless/iwlwifi/mvm/scan.c +1 −1
  187. drivers/net/wireless/iwlwifi/pcie/trans.c +19 −3
  188. drivers/net/wireless/iwlwifi/pcie/tx.c +13 −2
  189. drivers/net/wireless/rsi/rsi_91x_sdio_ops.c +7 −1
  190. drivers/net/wireless/rsi/rsi_91x_usb_ops.c +4 −0
  191. drivers/net/wireless/rtlwifi/core.c +5 −2
  192. drivers/net/wireless/rtlwifi/rtl8723be/sw.c +1 −0
  193. drivers/net/xen-netback/interface.c +6 −0
  194. drivers/net/xen-netback/netback.c +33 −29
  195. drivers/ntb/ntb.c +1 −1
  196. drivers/ntb/ntb_transport.c +124 −77
  197. drivers/phy/phy-sun4i-usb.c +1 −0
  198. drivers/phy/phy-ti-pipe3.c +55 −6
  199. drivers/platform/chrome/Kconfig +0 −1
  200. drivers/scsi/ipr.c +18 −10
  201. drivers/scsi/ipr.h +1 −0
  202. drivers/scsi/scsi_error.c +1 −1
  203. drivers/scsi/scsi_lib.c +3 −3
  204. drivers/staging/comedi/drivers/das1800.c +1 −0
  205. drivers/staging/lustre/lustre/obdclass/debug.c +1 −1
  206. drivers/staging/vt6655/device_main.c +3 −2
  207. drivers/thermal/hisi_thermal.c +0 −1
  208. drivers/thermal/power_allocator.c +16 −10
  209. drivers/thermal/samsung/Kconfig +1 −1
  210. drivers/thermal/samsung/exynos_tmu.c +2 −3
  211. drivers/thermal/thermal_core.c +1 −0
  212. drivers/usb/chipidea/core.c +12 −1
  213. drivers/usb/chipidea/host.c +5 −2
  214. drivers/usb/chipidea/host.h +6 −0
  215. drivers/usb/gadget/function/f_hid.c +4 −0
  216. drivers/usb/gadget/function/f_printer.c +9 −1
  217. drivers/usb/gadget/function/f_uac2.c +2 −2
  218. drivers/usb/gadget/udc/bdc/bdc_ep.c +1 −1
  219. drivers/usb/gadget/udc/udc-core.c +1 −0
  220. drivers/usb/host/xhci-mem.c +2 −1
  221. drivers/usb/host/xhci-ring.c +1 −1
  222. drivers/usb/serial/option.c +2 −0
  223. drivers/usb/serial/qcserial.c +1 −1
  224. drivers/usb/serial/sierra.c +1 −0
  225. drivers/video/console/fbcon.c +2 −1
  226. drivers/video/fbdev/Kconfig +1 −1
  227. drivers/video/fbdev/omap2/dss/dss-of.c +3 −1
  228. drivers/video/fbdev/pxa3xx-gcu.c +2 −2
  229. drivers/video/of_videomode.c +1 −3
  230. drivers/virtio/virtio_input.c +4 −0
  231. drivers/xen/balloon.c +7 −8
  232. drivers/xen/gntdev.c +2 −0
  233. drivers/xen/xenbus/xenbus_client.c +3 −1
  234. fs/btrfs/qgroup.c +5 −0
  235. fs/ceph/caps.c +5 −17
  236. fs/ceph/locks.c +1 −1
  237. fs/ceph/super.h +0 −1
  238. fs/dcache.c +3 −10
  239. fs/file_table.c +15 −9
  240. fs/hugetlbfs/inode.c +2 −0
  241. fs/namei.c +7 −2
  242. fs/nfsd/nfs4layouts.c +1 −0
  243. fs/nfsd/nfs4state.c +6 −6
  244. fs/nfsd/nfs4xdr.c +6 −5
  245. fs/notify/mark.c +25 −5
  246. fs/ocfs2/aops.c +2 −2
  247. fs/ocfs2/dlmglue.c +7 −3
  248. fs/signalfd.c +3 −2
  249. include/drm/drmP.h +1 −1
  250. include/drm/drm_crtc_helper.h +3 −0
  251. include/drm/drm_pciids.h +1 −0
  252. include/linux/fs.h +3 −2
  253. include/linux/page-flags.h +7 −3
  254. include/linux/skbuff.h +3 −3
  255. include/uapi/linux/pci_regs.h +1 −0
  256. include/uapi/sound/asoc.h +24 −11
  257. init/main.c +1 −1
  258. ipc/mqueue.c +0 −5
  259. ipc/shm.c +1 −1
  260. kernel/kthread.c +4 −0
  261. kernel/module.c +6 −2
  262. kernel/signal.c +8 −5
  263. lib/iommu-common.c +1 −1
  264. mm/huge_memory.c +1 −6
  265. mm/memory-failure.c +18 −14
  266. mm/memory_hotplug.c +9 −1
  267. mm/migrate.c +6 −2
  268. mm/page-writeback.c +2 −2
  269. mm/page_alloc.c +30 −15
  270. mm/shmem.c +2 −2
  271. mm/slab_common.c +1 −2
  272. mm/vmscan.c +6 −10
  273. net/batman-adv/distributed-arp-table.c +13 −5
  274. net/batman-adv/gateway_client.c +2 −0
  275. net/batman-adv/soft-interface.c +3 −0
  276. net/batman-adv/translation-table.c +24 −5
  277. net/bluetooth/mgmt.c +1 −1
  278. net/bridge/br_netlink.c +4 −0
  279. net/core/datagram.c +7 −6
  280. net/core/pktgen.c +0 −3
  281. net/core/request_sock.c +7 −1
  282. net/dsa/slave.c +2 −1
  283. net/ipv4/inet_connection_sock.c +1 −1
  284. net/ipv4/netfilter/ipt_SYNPROXY.c +2 −1
  285. net/ipv4/tcp_ipv4.c +1 −1
  286. net/ipv4/udp.c +10 −3
  287. net/ipv6/netfilter/ip6t_SYNPROXY.c +11 −8
  288. net/ipv6/route.c +4 −2
  289. net/ipv6/tcp_ipv6.c +1 −1
  290. net/netfilter/nf_conntrack_core.c +3 −5
  291. net/netfilter/nf_synproxy_core.c +1 −3
  292. net/netfilter/xt_CT.c +3 −2
  293. net/netlink/af_netlink.c +5 −0
  294. net/openvswitch/actions.c +12 −4
  295. net/rds/info.c +1 −1
  296. net/sched/act_mirred.c +2 −0
  297. net/sched/sch_fq_codel.c +19 −3
  298. scripts/kconfig/streamline_config.pl +1 −1
  299. security/yama/yama_lsm.c +1 −0
  300. sound/firewire/amdtp.c +3 −2
  301. sound/firewire/amdtp.h +2 −0
  302. sound/firewire/fireworks/fireworks.c +8 −2
  303. sound/firewire/fireworks/fireworks.h +1 −1
  304. sound/firewire/fireworks/fireworks_stream.c +9 −3
  305. sound/hda/ext/hdac_ext_controller.c +0 −6
  306. sound/hda/ext/hdac_ext_stream.c +1 −1
  307. sound/pci/hda/patch_realtek.c +1 −0
  308. sound/pci/oxygen/oxygen_mixer.c +1 −1
  309. sound/soc/codecs/cs4265.c +5 −5
  310. sound/soc/codecs/rt5645.c +2 −0
  311. sound/soc/codecs/rt5645.h +4 −0
  312. sound/soc/intel/baytrail/sst-baytrail-ipc.c +2 −0
  313. sound/soc/intel/haswell/sst-haswell-ipc.c +2 −0
  314. sound/soc/soc-topology.c +43 −18
Documentation/devicetree/bindings/dma/apm-xgene-dma.txt+1−1
@@ -35,7 +35,7 @@ Example: · 34 unmodified lines
3535 device_type = "dma";
3636 reg = <0x0 0x1f270000 0x0 0x10000>,
3737 <0x0 0x1f200000 0x0 0x10000>,
38− <0x0 0x1b008000 0x0 0x2000>,
38+ <0x0 0x1b000000 0x0 0x400000>,
3939 <0x0 0x1054a000 0x0 0x100>;
4040 interrupts = <0x0 0x82 0x4>,
4141 <0x0 0xb8 0x4>,
Documentation/devicetree/bindings/phy/ti-phy.txt+16−0
@@ -82,6 +82,9 @@ Optional properties: · 81 unmodified lines
8282 - id: If there are multiple instance of the same type, in order to
8383 differentiate between each instance "id" can be used (e.g., multi-lane PCIe
8484 PHY). If "id" is not provided, it is set to default value of '1'.
85+ - syscon-pllreset: Handle to system control region that contains the
86+ CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0
87+ register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy.
8588
8689 This is usually a subnode of ocp2scp to which it is connected.
8790
@@ -100,3 +103,16 @@ usb3phy@4a084400 { · 12 unmodified lines
100103 "sysclk",
101104 "refclk";
102105 };
106+
107+sata_phy: phy@4A096000 {
108+ compatible = "ti,phy-pipe3-sata";
109+ reg = <0x4A096000 0x80>, /* phy_rx */
110+ <0x4A096400 0x64>, /* phy_tx */
111+ <0x4A096800 0x40>; /* pll_ctrl */
112+ reg-names = "phy_rx", "phy_tx", "pll_ctrl";
113+ ctrl-module = <&omap_control_sata>;
114+ clocks = <&sys_clkin1>, <&sata_ref_clk>;
115+ clock-names = "sysclk", "refclk";
116+ syscon-pllreset = <&scm_conf 0x3fc>;
117+ #phy-cells = <0>;
118+};
Documentation/input/alps.txt+4−2
@@ -119,8 +119,10 @@ ALPS Absolute Mode - Protocol Version 2 · 118 unmodified lines
119119 byte 5: 0 z6 z5 z4 z3 z2 z1 z0
120120
121121 Protocol Version 2 DualPoint devices send standard PS/2 mouse packets for
122−the DualPoint Stick. For non interleaved dualpoint devices the pointingstick
123−buttons get reported separately in the PSM, PSR and PSL bits.
122+the DualPoint Stick. The M, R and L bits signal the combined status of both
123+the pointingstick and touchpad buttons, except for Dell dualpoint devices
124+where the pointingstick buttons get reported separately in the PSM, PSR
125+and PSL bits.
124126
125127 Dualpoint device -- interleaved packet format
126128 ---------------------------------------------
MAINTAINERS+5−1
@@ -5600,6 +5600,7 @@ F: kernel/irq/ · 5599 unmodified lines
56005600 IRQCHIP DRIVERS
56015601 M: Thomas Gleixner <tglx@linutronix.de>
56025602 M: Jason Cooper <jason@lakedaemon.net>
5603+M: Marc Zyngier <marc.zyngier@arm.com>
56035604 L: linux-kernel@vger.kernel.org
56045605 S: Maintained
56055606 T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core
@@ -5608,11 +5609,14 @@ F: Documentation/devicetree/bindings/interrupt-controller/ · 2 unmodified lines
56085609 F: drivers/irqchip/
56095610
56105611 IRQ DOMAINS (IRQ NUMBER MAPPING LIBRARY)
5611−M: Benjamin Herrenschmidt <benh@kernel.crashing.org>
5612+M: Jiang Liu <jiang.liu@linux.intel.com>
5613+M: Marc Zyngier <marc.zyngier@arm.com>
56125614 S: Maintained
5615+T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core
56135616 F: Documentation/IRQ-domain.txt
56145617 F: include/linux/irqdomain.h
56155618 F: kernel/irq/irqdomain.c
5619+F: kernel/irq/msi.c
56165620
56175621 ISAPNP
56185622 M: Jaroslav Kysela <perex@perex.cz>
Makefile+8−3
@@ -1,7 +1,7 @@
11 VERSION = 4
22 PATCHLEVEL = 2
33 SUBLEVEL = 0
4−EXTRAVERSION = -rc4
4+EXTRAVERSION = -rc6
55 NAME = Hurr durr I'ma sheep
66
77 # *DOCUMENTATION*
@@ -597,6 +597,11 @@ endif # $(dot-config) · 589 unmodified lines
597597 # Defaults to vmlinux, but the arch makefile usually adds further targets
598598 all: vmlinux
599599
600+# The arch Makefile can set ARCH_{CPP,A,C}FLAGS to override the default
601+# values of the respective KBUILD_* variables
602+ARCH_CPPFLAGS :=
603+ARCH_AFLAGS :=
604+ARCH_CFLAGS :=
600605 include arch/$(SRCARCH)/Makefile
601606
602607 KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
@@ -848,10 +853,10 @@ export mod_strip_cmd · 245 unmodified lines
848853 mod_compress_cmd = true
849854 ifdef CONFIG_MODULE_COMPRESS
850855 ifdef CONFIG_MODULE_COMPRESS_GZIP
851− mod_compress_cmd = gzip -n
856+ mod_compress_cmd = gzip -n -f
852857 endif # CONFIG_MODULE_COMPRESS_GZIP
853858 ifdef CONFIG_MODULE_COMPRESS_XZ
854− mod_compress_cmd = xz
859+ mod_compress_cmd = xz -f
855860 endif # CONFIG_MODULE_COMPRESS_XZ
856861 endif # CONFIG_MODULE_COMPRESS
857862 export mod_compress_cmd
arch/arc/Kconfig+11−2
@@ -313,11 +313,11 @@ config ARC_PAGE_SIZE_8K · 312 unmodified lines
313313
314314 config ARC_PAGE_SIZE_16K
315315 bool "16KB"
316− depends on ARC_MMU_V3
316+ depends on ARC_MMU_V3 || ARC_MMU_V4
317317
318318 config ARC_PAGE_SIZE_4K
319319 bool "4KB"
320− depends on ARC_MMU_V3
320+ depends on ARC_MMU_V3 || ARC_MMU_V4
321321
322322 endchoice
323323
@@ -365,6 +365,11 @@ config ARC_HAS_LLSC · 41 unmodified lines
365365 default y
366366 depends on !ARC_CANT_LLSC
367367
368+config ARC_STAR_9000923308
369+ bool "Workaround for llock/scond livelock"
370+ default y
371+ depends on ISA_ARCV2 && SMP && ARC_HAS_LLSC
372+
368373 config ARC_HAS_SWAPE
369374 bool "Insn: SWAPE (endian-swap)"
370375 default y
@@ -379,6 +384,10 @@ config ARC_HAS_LL64 · 8 unmodified lines
379384 dest operands with 2 possible source operands.
380385 default y
381386
387+config ARC_HAS_DIV_REM
388+ bool "Insn: div, divu, rem, remu"
389+ default y
390+
382391 config ARC_HAS_RTC
383392 bool "Local 64-bit r/o cycle counter"
384393 default n
arch/arc/Makefile+9−1
@@ -36,8 +36,16 @@ cflags-$(atleast_gcc44) += -fsection-anchors · 35 unmodified lines
3636 cflags-$(CONFIG_ARC_HAS_LLSC) += -mlock
3737 cflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape
3838
39+ifdef CONFIG_ISA_ARCV2
40+
3941 ifndef CONFIG_ARC_HAS_LL64
40−cflags-$(CONFIG_ISA_ARCV2) += -mno-ll64
42+cflags-y += -mno-ll64
43+endif
44+
45+ifndef CONFIG_ARC_HAS_DIV_REM
46+cflags-y += -mno-div-rem
47+endif
48+
4149 endif
4250
4351 cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables
arch/arc/include/asm/arcregs.h+3−4
@@ -89,11 +89,10 @@ · 88 unmodified lines
8989 #define ECR_C_BIT_DTLB_LD_MISS 8
9090 #define ECR_C_BIT_DTLB_ST_MISS 9
9191
92−
9392 /* Auxiliary registers */
9493 #define AUX_IDENTITY 4
9594 #define AUX_INTR_VEC_BASE 0x25
96−
95+#define AUX_NON_VOL 0x5e
9796
9897 /*
9998 * Floating Pt Registers
@@ -240,9 +239,9 @@ struct bcr_extn_xymem { · 140 unmodified lines
240239
241240 struct bcr_perip {
242241 #ifdef CONFIG_CPU_BIG_ENDIAN
243− unsigned int start:8, pad2:8, sz:8, pad:8;
242+ unsigned int start:8, pad2:8, sz:8, ver:8;
244243 #else
245− unsigned int pad:8, sz:8, pad2:8, start:8;
244+ unsigned int ver:8, sz:8, pad2:8, start:8;
246245 #endif
247246 };
248247
arch/arc/include/asm/atomic.h+55−23
@@ -23,33 +23,60 @@ · 22 unmodified lines
2323
2424 #define atomic_set(v, i) (((v)->counter) = (i))
2525
26−#ifdef CONFIG_ISA_ARCV2
27−#define PREFETCHW " prefetchw [%1] \n"
28−#else
29−#define PREFETCHW
26+#ifdef CONFIG_ARC_STAR_9000923308
27+
28+#define SCOND_FAIL_RETRY_VAR_DEF \
29+ unsigned int delay = 1, tmp; \
30+
31+#define SCOND_FAIL_RETRY_ASM \
32+ " bz 4f \n" \
33+ " ; --- scond fail delay --- \n" \
34+ " mov %[tmp], %[delay] \n" /* tmp = delay */ \
35+ "2: brne.d %[tmp], 0, 2b \n" /* while (tmp != 0) */ \
36+ " sub %[tmp], %[tmp], 1 \n" /* tmp-- */ \
37+ " rol %[delay], %[delay] \n" /* delay *= 2 */ \
38+ " b 1b \n" /* start over */ \
39+ "4: ; --- success --- \n" \
40+
41+#define SCOND_FAIL_RETRY_VARS \
42+ ,[delay] "+&r" (delay),[tmp] "=&r" (tmp) \
43+
44+#else /* !CONFIG_ARC_STAR_9000923308 */
45+
46+#define SCOND_FAIL_RETRY_VAR_DEF
47+
48+#define SCOND_FAIL_RETRY_ASM \
49+ " bnz 1b \n" \
50+
51+#define SCOND_FAIL_RETRY_VARS
52+
3053 #endif
3154
3255 #define ATOMIC_OP(op, c_op, asm_op) \
3356 static inline void atomic_##op(int i, atomic_t *v) \
3457 { \
35− unsigned int temp; \
58+ unsigned int val; \
59+ SCOND_FAIL_RETRY_VAR_DEF \
3660 \
3761 __asm__ __volatile__( \
38− "1: \n" \
39− PREFETCHW \
40− " llock %0, [%1] \n" \
41− " " #asm_op " %0, %0, %2 \n" \
42− " scond %0, [%1] \n" \
43− " bnz 1b \n" \
44− : "=&r"(temp) /* Early clobber, to prevent reg reuse */ \
45− : "r"(&v->counter), "ir"(i) \
62+ "1: llock %[val], [%[ctr]] \n" \
63+ " " #asm_op " %[val], %[val], %[i] \n" \
64+ " scond %[val], [%[ctr]] \n" \
65+ " \n" \
66+ SCOND_FAIL_RETRY_ASM \
67+ \
68+ : [val] "=&r" (val) /* Early clobber to prevent reg reuse */ \
69+ SCOND_FAIL_RETRY_VARS \
70+ : [ctr] "r" (&v->counter), /* Not "m": llock only supports reg direct addr mode */ \
71+ [i] "ir" (i) \
4672 : "cc"); \
4773 } \
4874
4975 #define ATOMIC_OP_RETURN(op, c_op, asm_op) \
5076 static inline int atomic_##op##_return(int i, atomic_t *v) \
5177 { \
52− unsigned int temp; \
78+ unsigned int val; \
79+ SCOND_FAIL_RETRY_VAR_DEF \
5380 \
5481 /* \
5582 * Explicit full memory barrier needed before/after as \
@@ -58,19 +85,21 @@ static inline int atomic_##op##_return(int i, atomic_t *v) \ · 2 unmodified lines
5885 smp_mb(); \
5986 \
6087 __asm__ __volatile__( \
61− "1: \n" \
62− PREFETCHW \
63− " llock %0, [%1] \n" \
64− " " #asm_op " %0, %0, %2 \n" \
65− " scond %0, [%1] \n" \
66− " bnz 1b \n" \
67− : "=&r"(temp) \
68− : "r"(&v->counter), "ir"(i) \
88+ "1: llock %[val], [%[ctr]] \n" \
89+ " " #asm_op " %[val], %[val], %[i] \n" \
90+ " scond %[val], [%[ctr]] \n" \
91+ " \n" \
92+ SCOND_FAIL_RETRY_ASM \
93+ \
94+ : [val] "=&r" (val) \
95+ SCOND_FAIL_RETRY_VARS \
96+ : [ctr] "r" (&v->counter), \
97+ [i] "ir" (i) \
6998 : "cc"); \
7099 \
71100 smp_mb(); \
72101 \
73− return temp; \
102+ return val; \
74103 }
75104
76105 #else /* !CONFIG_ARC_HAS_LLSC */
@@ -150,6 +179,9 @@ ATOMIC_OP(and, &=, and) · 73 unmodified lines
150179 #undef ATOMIC_OPS
151180 #undef ATOMIC_OP_RETURN
152181 #undef ATOMIC_OP
182+#undef SCOND_FAIL_RETRY_VAR_DEF
183+#undef SCOND_FAIL_RETRY_ASM
184+#undef SCOND_FAIL_RETRY_VARS
153185
154186 /**
155187 * __atomic_add_unless - add unless the number is a given value
arch/arc/include/asm/ptrace.h+27−27
@@ -20,20 +20,20 @@ · 19 unmodified lines
2020 struct pt_regs {
2121
2222 /* Real registers */
23− long bta; /* bta_l1, bta_l2, erbta */
23+ unsigned long bta; /* bta_l1, bta_l2, erbta */
2424
25− long lp_start, lp_end, lp_count;
25+ unsigned long lp_start, lp_end, lp_count;
2626
27− long status32; /* status32_l1, status32_l2, erstatus */
28− long ret; /* ilink1, ilink2 or eret */
29− long blink;
30− long fp;
31− long r26; /* gp */
27+ unsigned long status32; /* status32_l1, status32_l2, erstatus */
28+ unsigned long ret; /* ilink1, ilink2 or eret */
29+ unsigned long blink;
30+ unsigned long fp;
31+ unsigned long r26; /* gp */
3232
33− long r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r1, r0;
33+ unsigned long r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r1, r0;
3434
35− long sp; /* user/kernel sp depending on where we came from */
36− long orig_r0;
35+ unsigned long sp; /* User/Kernel depending on where we came from */
36+ unsigned long orig_r0;
3737
3838 /*
3939 * To distinguish bet excp, syscall, irq
@@ -55,13 +55,13 @@ struct pt_regs { · 15 unmodified lines
5555 unsigned long event;
5656 };
5757
58− long user_r25;
58+ unsigned long user_r25;
5959 };
6060 #else
6161
6262 struct pt_regs {
6363
64− long orig_r0;
64+ unsigned long orig_r0;
6565
6666 union {
6767 struct {
@@ -76,26 +76,26 @@ struct pt_regs { · 8 unmodified lines
7676 unsigned long event;
7777 };
7878
79− long bta; /* bta_l1, bta_l2, erbta */
79+ unsigned long bta; /* bta_l1, bta_l2, erbta */
8080
81− long user_r25;
81+ unsigned long user_r25;
8282
83− long r26; /* gp */
84− long fp;
85− long sp; /* user/kernel sp depending on where we came from */
83+ unsigned long r26; /* gp */
84+ unsigned long fp;
85+ unsigned long sp; /* user/kernel sp depending on where we came from */
8686
87− long r12;
87+ unsigned long r12;
8888
8989 /*------- Below list auto saved by h/w -----------*/
90− long r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11;
90+ unsigned long r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11;
9191
92− long blink;
93− long lp_end, lp_start, lp_count;
92+ unsigned long blink;
93+ unsigned long lp_end, lp_start, lp_count;
9494
95− long ei, ldi, jli;
95+ unsigned long ei, ldi, jli;
9696
97− long ret;
98− long status32;
97+ unsigned long ret;
98+ unsigned long status32;
9999 };
100100
101101 #endif
@@ -103,10 +103,10 @@ struct pt_regs { · 1 unmodified line
103103 /* Callee saved registers - need to be saved only when you are scheduled out */
104104
105105 struct callee_regs {
106− long r25, r24, r23, r22, r21, r20, r19, r18, r17, r16, r15, r14, r13;
106+ unsigned long r25, r24, r23, r22, r21, r20, r19, r18, r17, r16, r15, r14, r13;
107107 };
108108
109−#define instruction_pointer(regs) (unsigned long)((regs)->ret)
109+#define instruction_pointer(regs) ((regs)->ret)
110110 #define profile_pc(regs) instruction_pointer(regs)
111111
112112 /* return 1 if user mode or 0 if kernel mode */
@@ -142,7 +142,7 @@ struct callee_regs { · 29 unmodified lines
142142
143143 static inline long regs_return_value(struct pt_regs *regs)
144144 {
145− return regs->r0;
145+ return (long)regs->r0;
146146 }
147147
148148 #endif /* !__ASSEMBLY__ */
arch/arc/include/asm/spinlock.h+523−15
@@ -18,9 +18,518 @@ · 17 unmodified lines
1818 #define arch_spin_unlock_wait(x) \
1919 do { while (arch_spin_is_locked(x)) cpu_relax(); } while (0)
2020
21+#ifdef CONFIG_ARC_HAS_LLSC
22+
23+/*
24+ * A normal LLOCK/SCOND based system, w/o need for livelock workaround
25+ */
26+#ifndef CONFIG_ARC_STAR_9000923308
27+
2128 static inline void arch_spin_lock(arch_spinlock_t *lock)
2229 {
23− unsigned int tmp = __ARCH_SPIN_LOCK_LOCKED__;
30+ unsigned int val;
31+
32+ smp_mb();
33+
34+ __asm__ __volatile__(
35+ "1: llock %[val], [%[slock]] \n"
36+ " breq %[val], %[LOCKED], 1b \n" /* spin while LOCKED */
37+ " scond %[LOCKED], [%[slock]] \n" /* acquire */
38+ " bnz 1b \n"
39+ " \n"
40+ : [val] "=&r" (val)
41+ : [slock] "r" (&(lock->slock)),
42+ [LOCKED] "r" (__ARCH_SPIN_LOCK_LOCKED__)
43+ : "memory", "cc");
44+
45+ smp_mb();
46+}
47+
48+/* 1 - lock taken successfully */
49+static inline int arch_spin_trylock(arch_spinlock_t *lock)
50+{
51+ unsigned int val, got_it = 0;
52+
53+ smp_mb();
54+
55+ __asm__ __volatile__(
56+ "1: llock %[val], [%[slock]] \n"
57+ " breq %[val], %[LOCKED], 4f \n" /* already LOCKED, just bail */
58+ " scond %[LOCKED], [%[slock]] \n" /* acquire */
59+ " bnz 1b \n"
60+ " mov %[got_it], 1 \n"
61+ "4: \n"
62+ " \n"
63+ : [val] "=&r" (val),
64+ [got_it] "+&r" (got_it)
65+ : [slock] "r" (&(lock->slock)),
66+ [LOCKED] "r" (__ARCH_SPIN_LOCK_LOCKED__)
67+ : "memory", "cc");
68+
69+ smp_mb();
70+
71+ return got_it;
72+}
73+
74+static inline void arch_spin_unlock(arch_spinlock_t *lock)
75+{
76+ smp_mb();
77+
78+ lock->slock = __ARCH_SPIN_LOCK_UNLOCKED__;
79+
80+ smp_mb();
81+}
82+
83+/*
84+ * Read-write spinlocks, allowing multiple readers but only one writer.
85+ * Unfair locking as Writers could be starved indefinitely by Reader(s)
86+ */
87+
88+static inline void arch_read_lock(arch_rwlock_t *rw)
89+{
90+ unsigned int val;
91+
92+ smp_mb();
93+
94+ /*
95+ * zero means writer holds the lock exclusively, deny Reader.
96+ * Otherwise grant lock to first/subseq reader
97+ *
98+ * if (rw->counter > 0) {
99+ * rw->counter--;
100+ * ret = 1;
101+ * }
102+ */
103+
104+ __asm__ __volatile__(
105+ "1: llock %[val], [%[rwlock]] \n"
106+ " brls %[val], %[WR_LOCKED], 1b\n" /* <= 0: spin while write locked */
107+ " sub %[val], %[val], 1 \n" /* reader lock */
108+ " scond %[val], [%[rwlock]] \n"
109+ " bnz 1b \n"
110+ " \n"
111+ : [val] "=&r" (val)
112+ : [rwlock] "r" (&(rw->counter)),
113+ [WR_LOCKED] "ir" (0)
114+ : "memory", "cc");
115+
116+ smp_mb();
117+}
118+
119+/* 1 - lock taken successfully */
120+static inline int arch_read_trylock(arch_rwlock_t *rw)
121+{
122+ unsigned int val, got_it = 0;
123+
124+ smp_mb();
125+
126+ __asm__ __volatile__(
127+ "1: llock %[val], [%[rwlock]] \n"
128+ " brls %[val], %[WR_LOCKED], 4f\n" /* <= 0: already write locked, bail */
129+ " sub %[val], %[val], 1 \n" /* counter-- */
130+ " scond %[val], [%[rwlock]] \n"
131+ " bnz 1b \n" /* retry if collided with someone */
132+ " mov %[got_it], 1 \n"
133+ " \n"
134+ "4: ; --- done --- \n"
135+
136+ : [val] "=&r" (val),
137+ [got_it] "+&r" (got_it)
138+ : [rwlock] "r" (&(rw->counter)),
139+ [WR_LOCKED] "ir" (0)
140+ : "memory", "cc");
141+
142+ smp_mb();
143+
144+ return got_it;
145+}
146+
147+static inline void arch_write_lock(arch_rwlock_t *rw)
148+{
149+ unsigned int val;
150+
151+ smp_mb();
152+
153+ /*
154+ * If reader(s) hold lock (lock < __ARCH_RW_LOCK_UNLOCKED__),
155+ * deny writer. Otherwise if unlocked grant to writer
156+ * Hence the claim that Linux rwlocks are unfair to writers.
157+ * (can be starved for an indefinite time by readers).
158+ *
159+ * if (rw->counter == __ARCH_RW_LOCK_UNLOCKED__) {
160+ * rw->counter = 0;
161+ * ret = 1;
162+ * }
163+ */
164+
165+ __asm__ __volatile__(
166+ "1: llock %[val], [%[rwlock]] \n"
167+ " brne %[val], %[UNLOCKED], 1b \n" /* while !UNLOCKED spin */
168+ " mov %[val], %[WR_LOCKED] \n"
169+ " scond %[val], [%[rwlock]] \n"
170+ " bnz 1b \n"
171+ " \n"
172+ : [val] "=&r" (val)
173+ : [rwlock] "r" (&(rw->counter)),
174+ [UNLOCKED] "ir" (__ARCH_RW_LOCK_UNLOCKED__),
175+ [WR_LOCKED] "ir" (0)
176+ : "memory", "cc");
177+
178+ smp_mb();
179+}
180+
181+/* 1 - lock taken successfully */
182+static inline int arch_write_trylock(arch_rwlock_t *rw)
183+{
184+ unsigned int val, got_it = 0;
185+
186+ smp_mb();
187+
188+ __asm__ __volatile__(
189+ "1: llock %[val], [%[rwlock]] \n"
190+ " brne %[val], %[UNLOCKED], 4f \n" /* !UNLOCKED, bail */
191+ " mov %[val], %[WR_LOCKED] \n"
192+ " scond %[val], [%[rwlock]] \n"
193+ " bnz 1b \n" /* retry if collided with someone */
194+ " mov %[got_it], 1 \n"
195+ " \n"
196+ "4: ; --- done --- \n"
197+
198+ : [val] "=&r" (val),
199+ [got_it] "+&r" (got_it)
200+ : [rwlock] "r" (&(rw->counter)),
201+ [UNLOCKED] "ir" (__ARCH_RW_LOCK_UNLOCKED__),
202+ [WR_LOCKED] "ir" (0)
203+ : "memory", "cc");
204+
205+ smp_mb();
206+
207+ return got_it;
208+}
209+
210+static inline void arch_read_unlock(arch_rwlock_t *rw)
211+{
212+ unsigned int val;
213+
214+ smp_mb();
215+
216+ /*
217+ * rw->counter++;
218+ */
219+ __asm__ __volatile__(
220+ "1: llock %[val], [%[rwlock]] \n"
221+ " add %[val], %[val], 1 \n"
222+ " scond %[val], [%[rwlock]] \n"
223+ " bnz 1b \n"
224+ " \n"
225+ : [val] "=&r" (val)
226+ : [rwlock] "r" (&(rw->counter))
227+ : "memory", "cc");
228+
229+ smp_mb();
230+}
231+
232+static inline void arch_write_unlock(arch_rwlock_t *rw)
233+{
234+ smp_mb();
235+
236+ rw->counter = __ARCH_RW_LOCK_UNLOCKED__;
237+
238+ smp_mb();
239+}
240+
241+#else /* CONFIG_ARC_STAR_9000923308 */
242+
243+/*
244+ * HS38x4 could get into a LLOCK/SCOND livelock in case of multiple overlapping
245+ * coherency transactions in the SCU. The exclusive line state keeps rotating
246+ * among contenting cores leading to a never ending cycle. So break the cycle
247+ * by deferring the retry of failed exclusive access (SCOND). The actual delay
248+ * needed is function of number of contending cores as well as the unrelated
249+ * coherency traffic from other cores. To keep the code simple, start off with
250+ * small delay of 1 which would suffice most cases and in case of contention
251+ * double the delay. Eventually the delay is sufficient such that the coherency
252+ * pipeline is drained, thus a subsequent exclusive access would succeed.
253+ */
254+
255+#define SCOND_FAIL_RETRY_VAR_DEF \
256+ unsigned int delay, tmp; \
257+
258+#define SCOND_FAIL_RETRY_ASM \
259+ " ; --- scond fail delay --- \n" \
260+ " mov %[tmp], %[delay] \n" /* tmp = delay */ \
261+ "2: brne.d %[tmp], 0, 2b \n" /* while (tmp != 0) */ \
262+ " sub %[tmp], %[tmp], 1 \n" /* tmp-- */ \
263+ " rol %[delay], %[delay] \n" /* delay *= 2 */ \
264+ " b 1b \n" /* start over */ \
265+ " \n" \
266+ "4: ; --- done --- \n" \
267+
268+#define SCOND_FAIL_RETRY_VARS \
269+ ,[delay] "=&r" (delay), [tmp] "=&r" (tmp) \
270+
271+static inline void arch_spin_lock(arch_spinlock_t *lock)
272+{
273+ unsigned int val;
274+ SCOND_FAIL_RETRY_VAR_DEF;
275+
276+ smp_mb();
277+
278+ __asm__ __volatile__(
279+ "0: mov %[delay], 1 \n"
280+ "1: llock %[val], [%[slock]] \n"
281+ " breq %[val], %[LOCKED], 0b \n" /* spin while LOCKED */
282+ " scond %[LOCKED], [%[slock]] \n" /* acquire */
283+ " bz 4f \n" /* done */
284+ " \n"
285+ SCOND_FAIL_RETRY_ASM
286+
287+ : [val] "=&r" (val)
288+ SCOND_FAIL_RETRY_VARS
289+ : [slock] "r" (&(lock->slock)),
290+ [LOCKED] "r" (__ARCH_SPIN_LOCK_LOCKED__)
291+ : "memory", "cc");
292+
293+ smp_mb();
294+}
295+
296+/* 1 - lock taken successfully */
297+static inline int arch_spin_trylock(arch_spinlock_t *lock)
298+{
299+ unsigned int val, got_it = 0;
300+ SCOND_FAIL_RETRY_VAR_DEF;
301+
302+ smp_mb();
303+
304+ __asm__ __volatile__(
305+ "0: mov %[delay], 1 \n"
306+ "1: llock %[val], [%[slock]] \n"
307+ " breq %[val], %[LOCKED], 4f \n" /* already LOCKED, just bail */
308+ " scond %[LOCKED], [%[slock]] \n" /* acquire */
309+ " bz.d 4f \n"
310+ " mov.z %[got_it], 1 \n" /* got it */
311+ " \n"
312+ SCOND_FAIL_RETRY_ASM
313+
314+ : [val] "=&r" (val),
315+ [got_it] "+&r" (got_it)
316+ SCOND_FAIL_RETRY_VARS
317+ : [slock] "r" (&(lock->slock)),
318+ [LOCKED] "r" (__ARCH_SPIN_LOCK_LOCKED__)
319+ : "memory", "cc");
320+
321+ smp_mb();
322+
323+ return got_it;
324+}
325+
326+static inline void arch_spin_unlock(arch_spinlock_t *lock)
327+{
328+ smp_mb();
329+
330+ lock->slock = __ARCH_SPIN_LOCK_UNLOCKED__;
331+
332+ smp_mb();
333+}
334+
335+/*
336+ * Read-write spinlocks, allowing multiple readers but only one writer.
337+ * Unfair locking as Writers could be starved indefinitely by Reader(s)
338+ */
339+
340+static inline void arch_read_lock(arch_rwlock_t *rw)
341+{
342+ unsigned int val;
343+ SCOND_FAIL_RETRY_VAR_DEF;
344+
345+ smp_mb();
346+
347+ /*
348+ * zero means writer holds the lock exclusively, deny Reader.
349+ * Otherwise grant lock to first/subseq reader
350+ *
351+ * if (rw->counter > 0) {
352+ * rw->counter--;
353+ * ret = 1;
354+ * }
355+ */
356+
357+ __asm__ __volatile__(
358+ "0: mov %[delay], 1 \n"
359+ "1: llock %[val], [%[rwlock]] \n"
360+ " brls %[val], %[WR_LOCKED], 0b\n" /* <= 0: spin while write locked */
361+ " sub %[val], %[val], 1 \n" /* reader lock */
362+ " scond %[val], [%[rwlock]] \n"
363+ " bz 4f \n" /* done */
364+ " \n"
365+ SCOND_FAIL_RETRY_ASM
366+
367+ : [val] "=&r" (val)
368+ SCOND_FAIL_RETRY_VARS
369+ : [rwlock] "r" (&(rw->counter)),
370+ [WR_LOCKED] "ir" (0)
371+ : "memory", "cc");
372+
373+ smp_mb();
374+}
375+
376+/* 1 - lock taken successfully */
377+static inline int arch_read_trylock(arch_rwlock_t *rw)
378+{
379+ unsigned int val, got_it = 0;
380+ SCOND_FAIL_RETRY_VAR_DEF;
381+
382+ smp_mb();
383+
384+ __asm__ __volatile__(
385+ "0: mov %[delay], 1 \n"
386+ "1: llock %[val], [%[rwlock]] \n"
387+ " brls %[val], %[WR_LOCKED], 4f\n" /* <= 0: already write locked, bail */
388+ " sub %[val], %[val], 1 \n" /* counter-- */
389+ " scond %[val], [%[rwlock]] \n"
390+ " bz.d 4f \n"
391+ " mov.z %[got_it], 1 \n" /* got it */
392+ " \n"
393+ SCOND_FAIL_RETRY_ASM
394+
395+ : [val] "=&r" (val),
396+ [got_it] "+&r" (got_it)
397+ SCOND_FAIL_RETRY_VARS
398+ : [rwlock] "r" (&(rw->counter)),
399+ [WR_LOCKED] "ir" (0)
400+ : "memory", "cc");
401+
402+ smp_mb();
403+
404+ return got_it;
405+}
406+
407+static inline void arch_write_lock(arch_rwlock_t *rw)
408+{
409+ unsigned int val;
410+ SCOND_FAIL_RETRY_VAR_DEF;
411+
412+ smp_mb();
413+
414+ /*
415+ * If reader(s) hold lock (lock < __ARCH_RW_LOCK_UNLOCKED__),
416+ * deny writer. Otherwise if unlocked grant to writer
417+ * Hence the claim that Linux rwlocks are unfair to writers.
418+ * (can be starved for an indefinite time by readers).
419+ *
420+ * if (rw->counter == __ARCH_RW_LOCK_UNLOCKED__) {
421+ * rw->counter = 0;
422+ * ret = 1;
423+ * }
424+ */
425+
426+ __asm__ __volatile__(
427+ "0: mov %[delay], 1 \n"
428+ "1: llock %[val], [%[rwlock]] \n"
429+ " brne %[val], %[UNLOCKED], 0b \n" /* while !UNLOCKED spin */
430+ " mov %[val], %[WR_LOCKED] \n"
431+ " scond %[val], [%[rwlock]] \n"
432+ " bz 4f \n"
433+ " \n"
434+ SCOND_FAIL_RETRY_ASM
435+
436+ : [val] "=&r" (val)
437+ SCOND_FAIL_RETRY_VARS
438+ : [rwlock] "r" (&(rw->counter)),
439+ [UNLOCKED] "ir" (__ARCH_RW_LOCK_UNLOCKED__),
440+ [WR_LOCKED] "ir" (0)
441+ : "memory", "cc");
442+
443+ smp_mb();
444+}
445+
446+/* 1 - lock taken successfully */
447+static inline int arch_write_trylock(arch_rwlock_t *rw)
448+{
449+ unsigned int val, got_it = 0;
450+ SCOND_FAIL_RETRY_VAR_DEF;
451+
452+ smp_mb();
453+
454+ __asm__ __volatile__(
455+ "0: mov %[delay], 1 \n"
456+ "1: llock %[val], [%[rwlock]] \n"
457+ " brne %[val], %[UNLOCKED], 4f \n" /* !UNLOCKED, bail */
458+ " mov %[val], %[WR_LOCKED] \n"
459+ " scond %[val], [%[rwlock]] \n"
460+ " bz.d 4f \n"
461+ " mov.z %[got_it], 1 \n" /* got it */
462+ " \n"
463+ SCOND_FAIL_RETRY_ASM
464+
465+ : [val] "=&r" (val),
466+ [got_it] "+&r" (got_it)
467+ SCOND_FAIL_RETRY_VARS
468+ : [rwlock] "r" (&(rw->counter)),
469+ [UNLOCKED] "ir" (__ARCH_RW_LOCK_UNLOCKED__),
470+ [WR_LOCKED] "ir" (0)
471+ : "memory", "cc");
472+
473+ smp_mb();
474+
475+ return got_it;
476+}
477+
478+static inline void arch_read_unlock(arch_rwlock_t *rw)
479+{
480+ unsigned int val;
481+
482+ smp_mb();
483+
484+ /*
485+ * rw->counter++;
486+ */
487+ __asm__ __volatile__(
488+ "1: llock %[val], [%[rwlock]] \n"
489+ " add %[val], %[val], 1 \n"
490+ " scond %[val], [%[rwlock]] \n"
491+ " bnz 1b \n"
492+ " \n"
493+ : [val] "=&r" (val)
494+ : [rwlock] "r" (&(rw->counter))
495+ : "memory", "cc");
496+
497+ smp_mb();
498+}
499+
500+static inline void arch_write_unlock(arch_rwlock_t *rw)
501+{
502+ unsigned int val;
503+
504+ smp_mb();
505+
506+ /*
507+ * rw->counter = __ARCH_RW_LOCK_UNLOCKED__;
508+ */
509+ __asm__ __volatile__(
510+ "1: llock %[val], [%[rwlock]] \n"
511+ " scond %[UNLOCKED], [%[rwlock]]\n"
512+ " bnz 1b \n"
513+ " \n"
514+ : [val] "=&r" (val)
515+ : [rwlock] "r" (&(rw->counter)),
516+ [UNLOCKED] "r" (__ARCH_RW_LOCK_UNLOCKED__)
517+ : "memory", "cc");
518+
519+ smp_mb();
520+}
521+
522+#undef SCOND_FAIL_RETRY_VAR_DEF
523+#undef SCOND_FAIL_RETRY_ASM
524+#undef SCOND_FAIL_RETRY_VARS
525+
526+#endif /* CONFIG_ARC_STAR_9000923308 */
527+
528+#else /* !CONFIG_ARC_HAS_LLSC */
529+
530+static inline void arch_spin_lock(arch_spinlock_t *lock)
531+{
532+ unsigned int val = __ARCH_SPIN_LOCK_LOCKED__;
24533
25534 /*
26535 * This smp_mb() is technically superfluous, we only need the one
@@ -33,7 +542,7 @@ static inline void arch_spin_lock(arch_spinlock_t *lock) · 6 unmodified lines
33542 __asm__ __volatile__(
34543 "1: ex %0, [%1] \n"
35544 " breq %0, %2, 1b \n"
36− : "+&r" (tmp)
545+ : "+&r" (val)
37546 : "r"(&(lock->slock)), "ir"(__ARCH_SPIN_LOCK_LOCKED__)
38547 : "memory");
39548
@@ -48,26 +557,27 @@ static inline void arch_spin_lock(arch_spinlock_t *lock) · 8 unmodified lines
48557 smp_mb();
49558 }
50559
560+/* 1 - lock taken successfully */
51561 static inline int arch_spin_trylock(arch_spinlock_t *lock)
52562 {
53− unsigned int tmp = __ARCH_SPIN_LOCK_LOCKED__;
563+ unsigned int val = __ARCH_SPIN_LOCK_LOCKED__;
54564
55565 smp_mb();
56566
57567 __asm__ __volatile__(
58568 "1: ex %0, [%1] \n"
59− : "+r" (tmp)
569+ : "+r" (val)
60570 : "r"(&(lock->slock))
61571 : "memory");
62572
63573 smp_mb();
64574
65− return (tmp == __ARCH_SPIN_LOCK_UNLOCKED__);
575+ return (val == __ARCH_SPIN_LOCK_UNLOCKED__);
66576 }
67577
68578 static inline void arch_spin_unlock(arch_spinlock_t *lock)
69579 {
70− unsigned int tmp = __ARCH_SPIN_LOCK_UNLOCKED__;
580+ unsigned int val = __ARCH_SPIN_LOCK_UNLOCKED__;
71581
72582 /*
73583 * RELEASE barrier: given the instructions avail on ARCv2, full barrier
@@ -77,7 +587,7 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock) · 3 unmodified lines
77587
78588 __asm__ __volatile__(
79589 " ex %0, [%1] \n"
80− : "+r" (tmp)
590+ : "+r" (val)
81591 : "r"(&(lock->slock))
82592 : "memory");
83593
@@ -90,19 +600,12 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock) · 6 unmodified lines
90600
91601 /*
92602 * Read-write spinlocks, allowing multiple readers but only one writer.
603+ * Unfair locking as Writers could be starved indefinitely by Reader(s)
93604 *
94605 * The spinlock itself is contained in @counter and access to it is
95606 * serialized with @lock_mutex.
96− *
97− * Unfair locking as Writers could be starved indefinitely by Reader(s)
98607 */
99608
100−/* Would read_trylock() succeed? */
101−#define arch_read_can_lock(x) ((x)->counter > 0)
102−
103−/* Would write_trylock() succeed? */
104−#define arch_write_can_lock(x) ((x)->counter == __ARCH_RW_LOCK_UNLOCKED__)
105−
106609 /* 1 - lock taken successfully */
107610 static inline int arch_read_trylock(arch_rwlock_t *rw)
108611 {
@@ -173,6 +676,11 @@ static inline void arch_write_unlock(arch_rwlock_t *rw) · 64 unmodified lines
173676 arch_spin_unlock(&(rw->lock_mutex));
174677 }
175678
679+#endif
680+
681+#define arch_read_can_lock(x) ((x)->counter > 0)
682+#define arch_write_can_lock(x) ((x)->counter == __ARCH_RW_LOCK_UNLOCKED__)
683+
176684 #define arch_read_lock_flags(lock, flags) arch_read_lock(lock)
177685 #define arch_write_lock_flags(lock, flags) arch_write_lock(lock)
178686
arch/arc/include/asm/spinlock_types.h+2−0
@@ -26,7 +26,9 @@ typedef struct { · 25 unmodified lines
2626 */
2727 typedef struct {
2828 volatile unsigned int counter;
29+#ifndef CONFIG_ARC_HAS_LLSC
2930 arch_spinlock_t lock_mutex;
31+#endif
3032 } arch_rwlock_t;
3133
3234 #define __ARCH_RW_LOCK_UNLOCKED__ 0x01000000
arch/arc/include/uapi/asm/ptrace.h+10−10
@@ -32,20 +32,20 @@ · 31 unmodified lines
3232 */
3333 struct user_regs_struct {
3434
35− long pad;
35+ unsigned long pad;
3636 struct {
37− long bta, lp_start, lp_end, lp_count;
38− long status32, ret, blink, fp, gp;
39− long r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r1, r0;
40− long sp;
37+ unsigned long bta, lp_start, lp_end, lp_count;
38+ unsigned long status32, ret, blink, fp, gp;
39+ unsigned long r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r1, r0;
40+ unsigned long sp;
4141 } scratch;
42− long pad2;
42+ unsigned long pad2;
4343 struct {
44− long r25, r24, r23, r22, r21, r20;
45− long r19, r18, r17, r16, r15, r14, r13;
44+ unsigned long r25, r24, r23, r22, r21, r20;
45+ unsigned long r19, r18, r17, r16, r15, r14, r13;
4646 } callee;
47− long efa; /* break pt addr, for break points in delay slots */
48− long stop_pc; /* give dbg stop_pc after ensuring brkpt trap */
47+ unsigned long efa; /* break pt addr, for break points in delay slots */
48+ unsigned long stop_pc; /* give dbg stop_pc after ensuring brkpt trap */
4949 };
5050 #endif /* !__ASSEMBLY__ */
5151
arch/arc/kernel/setup.c+11−1
@@ -47,6 +47,7 @@ static void read_arc_build_cfg_regs(void) · 46 unmodified lines
4747 struct bcr_perip uncached_space;
4848 struct bcr_generic bcr;
4949 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()];
50+ unsigned long perip_space;
5051 FIX_PTR(cpu);
5152
5253 READ_BCR(AUX_IDENTITY, cpu->core);
@@ -56,7 +57,12 @@ static void read_arc_build_cfg_regs(void) · 3 unmodified lines
5657 cpu->vec_base = read_aux_reg(AUX_INTR_VEC_BASE);
5758
5859 READ_BCR(ARC_REG_D_UNCACH_BCR, uncached_space);
59− BUG_ON((uncached_space.start << 24) != ARC_UNCACHED_ADDR_SPACE);
60+ if (uncached_space.ver < 3)
61+ perip_space = uncached_space.start << 24;
62+ else
63+ perip_space = read_aux_reg(AUX_NON_VOL) & 0xF0000000;
64+
65+ BUG_ON(perip_space != ARC_UNCACHED_ADDR_SPACE);
6066
6167 READ_BCR(ARC_REG_MUL_BCR, cpu->extn_mpy);
6268
@@ -330,6 +336,10 @@ static void arc_chk_core_config(void) · 267 unmodified lines
330336 pr_warn("CONFIG_ARC_FPU_SAVE_RESTORE needed for working apps\n");
331337 else if (!cpu->extn.fpu_dp && fpu_enabled)
332338 panic("FPU non-existent, disable CONFIG_ARC_FPU_SAVE_RESTORE\n");
339+
340+ if (is_isa_arcv2() && IS_ENABLED(CONFIG_SMP) && cpu->isa.atomic &&
341+ !IS_ENABLED(CONFIG_ARC_STAR_9000923308))
342+ panic("llock/scond livelock workaround missing\n");
333343 }
334344
335345 /*
arch/arc/kernel/time.c+15−25
@@ -203,34 +203,24 @@ static int arc_clkevent_set_next_event(unsigned long delta, · 202 unmodified lines
203203 return 0;
204204 }
205205
206−static void arc_clkevent_set_mode(enum clock_event_mode mode,
207− struct clock_event_device *dev)
206+static int arc_clkevent_set_periodic(struct clock_event_device *dev)
208207 {
209− switch (mode) {
210− case CLOCK_EVT_MODE_PERIODIC:
211− /*
212− * At X Hz, 1 sec = 1000ms -> X cycles;
213− * 10ms -> X / 100 cycles
214− */
215− arc_timer_event_setup(arc_get_core_freq() / HZ);
216− break;
217− case CLOCK_EVT_MODE_ONESHOT:
218− break;
219− default:
220− break;
221− }
222−
223− return;
208+ /*
209+ * At X Hz, 1 sec = 1000ms -> X cycles;
210+ * 10ms -> X / 100 cycles
211+ */
212+ arc_timer_event_setup(arc_get_core_freq() / HZ);
213+ return 0;
224214 }
225215
226216 static DEFINE_PER_CPU(struct clock_event_device, arc_clockevent_device) = {
227− .name = "ARC Timer0",
228− .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC,
229− .mode = CLOCK_EVT_MODE_UNUSED,
230− .rating = 300,
231− .irq = TIMER0_IRQ, /* hardwired, no need for resources */
232− .set_next_event = arc_clkevent_set_next_event,
233− .set_mode = arc_clkevent_set_mode,
217+ .name = "ARC Timer0",
218+ .features = CLOCK_EVT_FEAT_ONESHOT |
219+ CLOCK_EVT_FEAT_PERIODIC,
220+ .rating = 300,
221+ .irq = TIMER0_IRQ, /* hardwired, no need for resources */
222+ .set_next_event = arc_clkevent_set_next_event,
223+ .set_state_periodic = arc_clkevent_set_periodic,
234224 };
235225
236226 static irqreturn_t timer_irq_handler(int irq, void *dev_id)
@@ -240,7 +230,7 @@ static irqreturn_t timer_irq_handler(int irq, void *dev_id) · 3 unmodified lines
240230 * irq_set_chip_and_handler() asked for handle_percpu_devid_irq()
241231 */
242232 struct clock_event_device *evt = this_cpu_ptr(&arc_clockevent_device);
243− int irq_reenable = evt->mode == CLOCK_EVT_MODE_PERIODIC;
233+ int irq_reenable = clockevent_state_periodic(evt);
244234
245235 /*
246236 * Any write to CTRL reg ACks the interrupt, we rewrite the
arch/arc/lib/memcpy-archs.S+1−1
@@ -206,7 +206,7 @@ unalignedOffby3: · 205 unmodified lines
206206 ld.ab r6, [r1, 4]
207207 prefetch [r1, 28] ;Prefetch the next read location
208208 ld.ab r8, [r1,4]
209− prefetch [r3, 32] ;Prefetch the next write location
209+ prefetchw [r3, 32] ;Prefetch the next write location
210210
211211 SHIFT_1 (r7, r6, 8)
212212 or r7, r7, r5
arch/arc/lib/memset-archs.S+36−7
@@ -10,12 +10,6 @@ · 9 unmodified lines
1010
1111 #undef PREALLOC_NOT_AVAIL
1212
13−#ifdef PREALLOC_NOT_AVAIL
14−#define PREWRITE(A,B) prefetchw [(A),(B)]
15−#else
16−#define PREWRITE(A,B) prealloc [(A),(B)]
17−#endif
18−
1913 ENTRY(memset)
2014 prefetchw [r0] ; Prefetch the write location
2115 mov.f 0, r2
@@ -51,9 +45,15 @@ ENTRY(memset) · 29 unmodified lines
5145
5246 ;;; Convert len to Dwords, unfold x8
5347 lsr.f lp_count, lp_count, 6
48+
5449 lpnz @.Lset64bytes
5550 ;; LOOP START
56− PREWRITE(r3, 64) ;Prefetch the next write location
51+#ifdef PREALLOC_NOT_AVAIL
52+ prefetchw [r3, 64] ;Prefetch the next write location
53+#else
54+ prealloc [r3, 64]
55+#endif
56+#ifdef CONFIG_ARC_HAS_LL64
5757 std.ab r4, [r3, 8]
5858 std.ab r4, [r3, 8]
5959 std.ab r4, [r3, 8]
@@ -62,16 +62,45 @@ ENTRY(memset) · 2 unmodified lines
6262 std.ab r4, [r3, 8]
6363 std.ab r4, [r3, 8]
6464 std.ab r4, [r3, 8]
65+#else
66+ st.ab r4, [r3, 4]
67+ st.ab r4, [r3, 4]
68+ st.ab r4, [r3, 4]
69+ st.ab r4, [r3, 4]
70+ st.ab r4, [r3, 4]
71+ st.ab r4, [r3, 4]
72+ st.ab r4, [r3, 4]
73+ st.ab r4, [r3, 4]
74+ st.ab r4, [r3, 4]
75+ st.ab r4, [r3, 4]
76+ st.ab r4, [r3, 4]
77+ st.ab r4, [r3, 4]
78+ st.ab r4, [r3, 4]
79+ st.ab r4, [r3, 4]
80+ st.ab r4, [r3, 4]
81+ st.ab r4, [r3, 4]
82+#endif
6583 .Lset64bytes:
6684
6785 lsr.f lp_count, r2, 5 ;Last remaining max 124 bytes
6886 lpnz .Lset32bytes
6987 ;; LOOP START
7088 prefetchw [r3, 32] ;Prefetch the next write location
89+#ifdef CONFIG_ARC_HAS_LL64
7190 std.ab r4, [r3, 8]
7291 std.ab r4, [r3, 8]
7392 std.ab r4, [r3, 8]
7493 std.ab r4, [r3, 8]
94+#else
95+ st.ab r4, [r3, 4]
96+ st.ab r4, [r3, 4]
97+ st.ab r4, [r3, 4]
98+ st.ab r4, [r3, 4]
99+ st.ab r4, [r3, 4]
100+ st.ab r4, [r3, 4]
101+ st.ab r4, [r3, 4]
102+ st.ab r4, [r3, 4]
103+#endif
75104 .Lset32bytes:
76105
77106 and.f lp_count, r2, 0x1F ;Last remaining 31 bytes
arch/arc/plat-axs10x/axs10x.c+15−0
@@ -389,6 +389,21 @@ axs103_set_freq(unsigned int id, unsigned int fd, unsigned int od) · 388 unmodified lines
389389
390390 static void __init axs103_early_init(void)
391391 {
392+ /*
393+ * AXS103 configurations for SMP/QUAD configurations share device tree
394+ * which defaults to 90 MHz. However recent failures of Quad config
395+ * revealed P&R timing violations so clamp it down to safe 50 MHz
396+ * Instead of duplicating defconfig/DT for SMP/QUAD, add a small hack
397+ *
398+ * This hack is really hacky as of now. Fix it properly by getting the
399+ * number of cores as return value of platform's early SMP callback
400+ */
401+#ifdef CONFIG_ARC_MCIP
402+ unsigned int num_cores = (read_aux_reg(ARC_REG_MCIP_BCR) >> 16) & 0x3F;
403+ if (num_cores > 2)
404+ arc_set_core_freq(50 * 1000000);
405+#endif
406+
392407 switch (arc_get_core_freq()/1000000) {
393408 case 33:
394409 axs103_set_freq(1, 1, 1);
arch/arm/boot/dts/dra7.dtsi+1−0
@@ -1140,6 +1140,7 @@ · 1139 unmodified lines
11401140 ctrl-module = <&omap_control_sata>;
11411141 clocks = <&sys_clkin1>, <&sata_ref_clk>;
11421142 clock-names = "sysclk", "refclk";
1143+ syscon-pllreset = <&scm_conf 0x3fc>;
11431144 #phy-cells = <0>;
11441145 };
11451146
arch/arm/boot/dts/exynos3250.dtsi+1−1
@@ -138,8 +138,8 @@ · 137 unmodified lines
138138
139139 mipi_phy: video-phy@10020710 {
140140 compatible = "samsung,s5pv210-mipi-video-phy";
141− reg = <0x10020710 8>;
142141 #phy-cells = <1>;
142+ syscon = <&pmu_system_controller>;
143143 };
144144
145145 pd_cam: cam-power-domain@10023C00 {
arch/arm/boot/dts/exynos4210-origen.dts+4−0
@@ -127,6 +127,10 @@ · 126 unmodified lines
127127 };
128128 };
129129
130+&cpu0 {
131+ cpu0-supply = <&buck1_reg>;
132+};
133+
130134 &fimd {
131135 pinctrl-0 = <&lcd_en &lcd_clk &lcd_data24 &pwm0_out>;
132136 pinctrl-names = "default";
arch/arm/boot/dts/exynos4210-trats.dts+4−0
@@ -188,6 +188,10 @@ · 187 unmodified lines
188188 };
189189 };
190190
191+&cpu0 {
192+ cpu0-supply = <&varm_breg>;
193+};
194+
191195 &dsi_0 {
192196 vddcore-supply = <&vusb_reg>;
193197 vddio-supply = <&vmipi_reg>;
arch/arm/boot/dts/exynos4210-universal_c210.dts+4−0
@@ -548,6 +548,10 @@ · 547 unmodified lines
548548 };
549549 };
550550
551+&cpu0 {
552+ cpu0-supply = <&vdd_arm_reg>;
553+};
554+
551555 &pinctrl_1 {
552556 hdmi_hpd: hdmi-hpd {
553557 samsung,pins = "gpx3-7";
arch/arm/boot/dts/exynos4210.dtsi+12−0
@@ -40,6 +40,18 @@ · 39 unmodified lines
4040 device_type = "cpu";
4141 compatible = "arm,cortex-a9";
4242 reg = <0x900>;
43+ clocks = <&clock CLK_ARM_CLK>;
44+ clock-names = "cpu";
45+ clock-latency = <160000>;
46+
47+ operating-points = <
48+ 1200000 1250000
49+ 1000000 1150000
50+ 800000 1075000
51+ 500000 975000
52+ 400000 975000
53+ 200000 950000
54+ >;
4355 cooling-min-level = <4>;
4456 cooling-max-level = <2>;
4557 #cooling-cells = <2>; /* min followed by max */
arch/arm/boot/dts/imx35.dtsi+4−4
@@ -286,8 +286,8 @@ · 285 unmodified lines
286286 can1: can@53fe4000 {
287287 compatible = "fsl,imx35-flexcan", "fsl,p1010-flexcan";
288288 reg = <0x53fe4000 0x1000>;
289− clocks = <&clks 33>;
290− clock-names = "ipg";
289+ clocks = <&clks 33>, <&clks 33>;
290+ clock-names = "ipg", "per";
291291 interrupts = <43>;
292292 status = "disabled";
293293 };
@@ -295,8 +295,8 @@ · 1 unmodified line
295295 can2: can@53fe8000 {
296296 compatible = "fsl,imx35-flexcan", "fsl,p1010-flexcan";
297297 reg = <0x53fe8000 0x1000>;
298− clocks = <&clks 34>;
299− clock-names = "ipg";
298+ clocks = <&clks 34>, <&clks 34>;
299+ clock-names = "ipg", "per";
300300 interrupts = <44>;
301301 status = "disabled";
302302 };
arch/arm/boot/dts/k2e-clocks.dtsi+2−3
@@ -13,9 +13,8 @@ clocks { · 12 unmodified lines
1313 #clock-cells = <0>;
1414 compatible = "ti,keystone,main-pll-clock";
1515 clocks = <&refclksys>;
16− reg = <0x02620350 4>, <0x02310110 4>;
17− reg-names = "control", "multiplier";
18− fixed-postdiv = <2>;
16+ reg = <0x02620350 4>, <0x02310110 4>, <0x02310108 4>;
17+ reg-names = "control", "multiplier", "post-divider";
1918 };
2019
2120 papllclk: papllclk@2620358 {
arch/arm/boot/dts/k2hk-clocks.dtsi+2−3
@@ -22,9 +22,8 @@ clocks { · 21 unmodified lines
2222 #clock-cells = <0>;
2323 compatible = "ti,keystone,main-pll-clock";
2424 clocks = <&refclksys>;
25− reg = <0x02620350 4>, <0x02310110 4>;
26− reg-names = "control", "multiplier";
27− fixed-postdiv = <2>;
25+ reg = <0x02620350 4>, <0x02310110 4>, <0x02310108 4>;
26+ reg-names = "control", "multiplier", "post-divider";
2827 };
2928
3029 papllclk: papllclk@2620358 {
arch/arm/boot/dts/k2l-clocks.dtsi+2−3
@@ -22,9 +22,8 @@ clocks { · 21 unmodified lines
2222 #clock-cells = <0>;
2323 compatible = "ti,keystone,main-pll-clock";
2424 clocks = <&refclksys>;
25− reg = <0x02620350 4>, <0x02310110 4>;
26− reg-names = "control", "multiplier";
27− fixed-postdiv = <2>;
25+ reg = <0x02620350 4>, <0x02310110 4>, <0x02310108 4>;
26+ reg-names = "control", "multiplier", "post-divider";
2827 };
2928
3029 papllclk: papllclk@2620358 {
arch/arm/boot/dts/ste-nomadik-nhk15.dts+1−0
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 };
1818
1919 aliases {
20+ serial1 = &uart1;
2021 stmpe-i2c0 = &stmpe0;
2122 stmpe-i2c1 = &stmpe1;
2223 };
arch/arm/boot/dts/ste-nomadik-s8815.dts+4−0
@@ -15,6 +15,10 @@ · 14 unmodified lines
1515 bootargs = "root=/dev/ram0 console=ttyAMA1,115200n8 earlyprintk";
1616 };
1717
18+ aliases {
19+ serial1 = &uart1;
20+ };
21+
1822 src@101e0000 {
1923 /* These chrystal drivers are not used on this board */
2024 disable-sxtalo;
arch/arm/boot/dts/ste-nomadik-stn8815.dtsi+1−0
@@ -757,6 +757,7 @@ · 756 unmodified lines
757757 clock-names = "uartclk", "apb_pclk";
758758 pinctrl-names = "default";
759759 pinctrl-0 = <&uart0_default_mux>;
760+ status = "disabled";
760761 };
761762
762763 uart1: uart@101fb000 {
arch/arm/mach-omap2/omap_hwmod.c+16−8
@@ -2373,6 +2373,9 @@ static int of_dev_hwmod_lookup(struct device_node *np, · 2372 unmodified lines
23732373 * registers. This address is needed early so the OCP registers that
23742374 * are part of the device's address space can be ioremapped properly.
23752375 *
2376+ * If SYSC access is not needed, the registers will not be remapped
2377+ * and non-availability of MPU access is not treated as an error.
2378+ *
23762379 * Returns 0 on success, -EINVAL if an invalid hwmod is passed, and
23772380 * -ENXIO on absent or invalid register target address space.
23782381 */
@@ -2387,6 +2390,11 @@ static int __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data, · 8 unmodified lines
23872390
23882391 _save_mpu_port_index(oh);
23892392
2393+ /* if we don't need sysc access we don't need to ioremap */
2394+ if (!oh->class->sysc)
2395+ return 0;
2396+
2397+ /* we can't continue without MPU PORT if we need sysc access */
23902398 if (oh->_int_flags & _HWMOD_NO_MPU_PORT)
23912399 return -ENXIO;
23922400
@@ -2396,8 +2404,10 @@ static int __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data, · 3 unmodified lines
23962404 oh->name);
23972405
23982406 /* Extract the IO space from device tree blob */
2399− if (!np)
2407+ if (!np) {
2408+ pr_err("omap_hwmod: %s: no dt node\n", oh->name);
24002409 return -ENXIO;
2410+ }
24012411
24022412 va_start = of_iomap(np, index + oh->mpu_rt_idx);
24032413 } else {
@@ -2456,13 +2466,11 @@ static int __init _init(struct omap_hwmod *oh, void *data) · 52 unmodified lines
24562466 oh->name, np->name);
24572467 }
24582468
2459− if (oh->class->sysc) {
2460− r = _init_mpu_rt_base(oh, NULL, index, np);
2461− if (r < 0) {
2462− WARN(1, "omap_hwmod: %s: doesn't have mpu register target base\n",
2463− oh->name);
2464− return 0;
2465− }
2469+ r = _init_mpu_rt_base(oh, NULL, index, np);
2470+ if (r < 0) {
2471+ WARN(1, "omap_hwmod: %s: doesn't have mpu register target base\n",
2472+ oh->name);
2473+ return 0;
24662474 }
24672475
24682476 r = _init_clocks(oh, NULL);
arch/arm/mach-omap2/omap_hwmod_7xx_data.c+2−3
@@ -827,8 +827,7 @@ static struct omap_hwmod_class_sysconfig dra7xx_gpmc_sysc = { · 826 unmodified lines
827827 .syss_offs = 0x0014,
828828 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_SIDLEMODE |
829829 SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
830− .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
831− SIDLE_SMART_WKUP),
830+ .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
832831 .sysc_fields = &omap_hwmod_sysc_type1,
833832 };
834833
@@ -844,7 +843,7 @@ static struct omap_hwmod dra7xx_gpmc_hwmod = { · 9 unmodified lines
844843 .class = &dra7xx_gpmc_hwmod_class,
845844 .clkdm_name = "l3main1_clkdm",
846845 /* Skip reset for CONFIG_OMAP_GPMC_DEBUG for bootloader timings */
847− .flags = HWMOD_SWSUP_SIDLE | DEBUG_OMAP_GPMC_HWMOD_FLAGS,
846+ .flags = DEBUG_OMAP_GPMC_HWMOD_FLAGS,
848847 .main_clk = "l3_iclk_div",
849848 .prcm = {
850849 .omap4 = {
arch/arm64/boot/dts/apm/apm-storm.dtsi+1−1
@@ -823,7 +823,7 @@ · 822 unmodified lines
823823 device_type = "dma";
824824 reg = <0x0 0x1f270000 0x0 0x10000>,
825825 <0x0 0x1f200000 0x0 0x10000>,
826− <0x0 0x1b008000 0x0 0x2000>,
826+ <0x0 0x1b000000 0x0 0x400000>,
827827 <0x0 0x1054a000 0x0 0x100>;
828828 interrupts = <0x0 0x82 0x4>,
829829 <0x0 0xb8 0x4>,
arch/arm64/kernel/signal32.c+2−3
@@ -168,7 +168,8 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from) · 167 unmodified lines
168168 * Other callers might not initialize the si_lsb field,
169169 * so check explicitely for the right codes here.
170170 */
171− if (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO)
171+ if (from->si_signo == SIGBUS &&
172+ (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO))
172173 err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb);
173174 #endif
174175 break;
@@ -201,8 +202,6 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from) · 26 unmodified lines
201202
202203 int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from)
203204 {
204− memset(to, 0, sizeof *to);
205−
206205 if (copy_from_user(to, from, __ARCH_SI_PREAMBLE_SIZE) ||
207206 copy_from_user(to->_sifields._pad,
208207 from->_sifields._pad, SI_PAD_SIZE))
arch/arm64/kernel/vdso.c+3−4
@@ -199,16 +199,15 @@ up_fail: · 198 unmodified lines
199199 */
200200 void update_vsyscall(struct timekeeper *tk)
201201 {
202− struct timespec xtime_coarse;
203202 u32 use_syscall = strcmp(tk->tkr_mono.clock->name, "arch_sys_counter");
204203
205204 ++vdso_data->tb_seq_count;
206205 smp_wmb();
207206
208− xtime_coarse = __current_kernel_time();
209207 vdso_data->use_syscall = use_syscall;
210− vdso_data->xtime_coarse_sec = xtime_coarse.tv_sec;
211− vdso_data->xtime_coarse_nsec = xtime_coarse.tv_nsec;
208+ vdso_data->xtime_coarse_sec = tk->xtime_sec;
209+ vdso_data->xtime_coarse_nsec = tk->tkr_mono.xtime_nsec >>
210+ tk->tkr_mono.shift;
212211 vdso_data->wtm_clock_sec = tk->wall_to_monotonic.tv_sec;
213212 vdso_data->wtm_clock_nsec = tk->wall_to_monotonic.tv_nsec;
214213
arch/mips/Kconfig+0−1
@@ -151,7 +151,6 @@ config BMIPS_GENERIC · 150 unmodified lines
151151 select BCM7120_L2_IRQ
152152 select BRCMSTB_L2_IRQ
153153 select IRQ_MIPS_CPU
154− select RAW_IRQ_ACCESSORS
155154 select DMA_NONCOHERENT
156155 select SYS_SUPPORTS_32BIT_KERNEL
157156 select SYS_SUPPORTS_LITTLE_ENDIAN
arch/mips/ath79/setup.c+1−0
@@ -190,6 +190,7 @@ int get_c0_perfcount_int(void) · 189 unmodified lines
190190 {
191191 return ATH79_MISC_IRQ(5);
192192 }
193+EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
193194
194195 unsigned int get_c0_compare_int(void)
195196 {
arch/mips/cavium-octeon/smp.c+1−1
@@ -42,7 +42,7 @@ static irqreturn_t mailbox_interrupt(int irq, void *dev_id) · 41 unmodified lines
4242 cvmx_write_csr(CVMX_CIU_MBOX_CLRX(coreid), action);
4343
4444 if (action & SMP_CALL_FUNCTION)
45− smp_call_function_interrupt();
45+ generic_smp_call_function_interrupt();
4646 if (action & SMP_RESCHEDULE_YOURSELF)
4747 scheduler_ipi();
4848
arch/mips/include/asm/mach-bcm63xx/dma-coherence.h+0−10
@@ -1,10 +0,0 @@
1−#ifndef __ASM_MACH_BCM63XX_DMA_COHERENCE_H
2−#define __ASM_MACH_BCM63XX_DMA_COHERENCE_H
3−
4−#include <asm/bmips.h>
5−
6−#define plat_post_dma_flush bmips_post_dma_flush
7−
8−#include <asm/mach-generic/dma-coherence.h>
9−
10−#endif /* __ASM_MACH_BCM63XX_DMA_COHERENCE_H */
arch/mips/include/asm/pgtable.h+31−0
@@ -182,8 +182,39 @@ static inline void set_pte(pte_t *ptep, pte_t pteval) · 181 unmodified lines
182182 * Make sure the buddy is global too (if it's !none,
183183 * it better already be global)
184184 */
185+#ifdef CONFIG_SMP
186+ /*
187+ * For SMP, multiple CPUs can race, so we need to do
188+ * this atomically.
189+ */
190+#ifdef CONFIG_64BIT
191+#define LL_INSN "lld"
192+#define SC_INSN "scd"
193+#else /* CONFIG_32BIT */
194+#define LL_INSN "ll"
195+#define SC_INSN "sc"
196+#endif
197+ unsigned long page_global = _PAGE_GLOBAL;
198+ unsigned long tmp;
199+
200+ __asm__ __volatile__ (
201+ " .set push\n"
202+ " .set noreorder\n"
203+ "1: " LL_INSN " %[tmp], %[buddy]\n"
204+ " bnez %[tmp], 2f\n"
205+ " or %[tmp], %[tmp], %[global]\n"
206+ " " SC_INSN " %[tmp], %[buddy]\n"
207+ " beqz %[tmp], 1b\n"
208+ " nop\n"
209+ "2:\n"
210+ " .set pop"
211+ : [buddy] "+m" (buddy->pte),
212+ [tmp] "=&r" (tmp)
213+ : [global] "r" (page_global));
214+#else /* !CONFIG_SMP */
185215 if (pte_none(*buddy))
186216 pte_val(*buddy) = pte_val(*buddy) | _PAGE_GLOBAL;
217+#endif /* CONFIG_SMP */
187218 }
188219 #endif
189220 }
arch/mips/include/asm/smp.h+0−2
@@ -83,8 +83,6 @@ static inline void __cpu_die(unsigned int cpu) · 82 unmodified lines
8383 extern void play_dead(void);
8484 #endif
8585
86−extern asmlinkage void smp_call_function_interrupt(void);
87−
8886 static inline void arch_send_call_function_single_ipi(int cpu)
8987 {
9088 extern struct plat_smp_ops *mp_ops; /* private */
arch/mips/include/asm/stackframe.h+25−0
@@ -152,6 +152,31 @@ · 151 unmodified lines
152152 .set noreorder
153153 bltz k0, 8f
154154 move k1, sp
155+#ifdef CONFIG_EVA
156+ /*
157+ * Flush interAptiv's Return Prediction Stack (RPS) by writing
158+ * EntryHi. Toggling Config7.RPS is slower and less portable.
159+ *
160+ * The RPS isn't automatically flushed when exceptions are
161+ * taken, which can result in kernel mode speculative accesses
162+ * to user addresses if the RPS mispredicts. That's harmless
163+ * when user and kernel share the same address space, but with
164+ * EVA the same user segments may be unmapped to kernel mode,
165+ * even containing sensitive MMIO regions or invalid memory.
166+ *
167+ * This can happen when the kernel sets the return address to
168+ * ret_from_* and jr's to the exception handler, which looks
169+ * more like a tail call than a function call. If nested calls
170+ * don't evict the last user address in the RPS, it will
171+ * mispredict the return and fetch from a user controlled
172+ * address into the icache.
173+ *
174+ * More recent EVA-capable cores with MAAR to restrict
175+ * speculative accesses aren't affected.
176+ */
177+ MFC0 k0, CP0_ENTRYHI
178+ MTC0 k0, CP0_ENTRYHI
179+#endif
155180 .set reorder
156181 /* Called from user mode, new stack. */
157182 get_saved_sp
arch/mips/kernel/mips-mt-fpaff.c+3−2
@@ -154,7 +154,7 @@ asmlinkage long mipsmt_sys_sched_getaffinity(pid_t pid, unsigned int len, · 153 unmodified lines
154154 unsigned long __user *user_mask_ptr)
155155 {
156156 unsigned int real_len;
157− cpumask_t mask;
157+ cpumask_t allowed, mask;
158158 int retval;
159159 struct task_struct *p;
160160
@@ -173,7 +173,8 @@ asmlinkage long mipsmt_sys_sched_getaffinity(pid_t pid, unsigned int len, · 12 unmodified lines
173173 if (retval)
174174 goto out_unlock;
175175
176− cpumask_and(&mask, &p->thread.user_cpus_allowed, cpu_possible_mask);
176+ cpumask_or(&allowed, &p->thread.user_cpus_allowed, &p->cpus_allowed);
177+ cpumask_and(&mask, &allowed, cpu_active_mask);
177178
178179 out_unlock:
179180 read_unlock(&tasklist_lock);
arch/mips/kernel/prom.c+1−1
@@ -38,7 +38,7 @@ char *mips_get_machine_name(void) · 37 unmodified lines
3838 return mips_machine_name;
3939 }
4040
41−#ifdef CONFIG_OF
41+#ifdef CONFIG_USE_OF
4242 void __init early_init_dt_add_memory_arch(u64 base, u64 size)
4343 {
4444 return add_memory_region(base, size, BOOT_MEM_RAM);
arch/mips/kernel/relocate_kernel.S+4−4
@@ -24,7 +24,7 @@ LEAF(relocate_new_kernel) · 23 unmodified lines
2424
2525 process_entry:
2626 PTR_L s2, (s0)
27− PTR_ADD s0, s0, SZREG
27+ PTR_ADDIU s0, s0, SZREG
2828
2929 /*
3030 * In case of a kdump/crash kernel, the indirection page is not
@@ -61,9 +61,9 @@ copy_word: · 30 unmodified lines
6161 /* copy page word by word */
6262 REG_L s5, (s2)
6363 REG_S s5, (s4)
64− PTR_ADD s4, s4, SZREG
65− PTR_ADD s2, s2, SZREG
66− LONG_SUB s6, s6, 1
64+ PTR_ADDIU s4, s4, SZREG
65+ PTR_ADDIU s2, s2, SZREG
66+ LONG_ADDIU s6, s6, -1
6767 beq s6, zero, process_entry
6868 b copy_word
6969 b process_entry
arch/mips/kernel/signal32.c+0−2
@@ -409,8 +409,6 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from) · 408 unmodified lines
409409
410410 int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from)
411411 {
412− memset(to, 0, sizeof *to);
413−
414412 if (copy_from_user(to, from, 3*sizeof(int)) ||
415413 copy_from_user(to->_sifields._pad,
416414 from->_sifields._pad, SI_PAD_SIZE32))
arch/mips/kernel/smp-bmips.c+2−2
@@ -284,7 +284,7 @@ static irqreturn_t bmips5000_ipi_interrupt(int irq, void *dev_id) · 283 unmodified lines
284284 if (action == 0)
285285 scheduler_ipi();
286286 else
287− smp_call_function_interrupt();
287+ generic_smp_call_function_interrupt();
288288
289289 return IRQ_HANDLED;
290290 }
@@ -336,7 +336,7 @@ static irqreturn_t bmips43xx_ipi_interrupt(int irq, void *dev_id) · 45 unmodified lines
336336 if (action & SMP_RESCHEDULE_YOURSELF)
337337 scheduler_ipi();
338338 if (action & SMP_CALL_FUNCTION)
339− smp_call_function_interrupt();
339+ generic_smp_call_function_interrupt();
340340
341341 return IRQ_HANDLED;
342342 }
arch/mips/kernel/smp.c+0−10
@@ -192,16 +192,6 @@ asmlinkage void start_secondary(void) · 191 unmodified lines
192192 cpu_startup_entry(CPUHP_ONLINE);
193193 }
194194
195−/*
196− * Call into both interrupt handlers, as we share the IPI for them
197− */
198−void __irq_entry smp_call_function_interrupt(void)
199−{
200− irq_enter();
201− generic_smp_call_function_interrupt();
202− irq_exit();
203−}
204−
205195 static void stop_this_cpu(void *dummy)
206196 {
207197 /*
arch/mips/kernel/traps.c+13−0
@@ -192,6 +192,7 @@ static void show_stacktrace(struct task_struct *task, · 191 unmodified lines
192192 void show_stack(struct task_struct *task, unsigned long *sp)
193193 {
194194 struct pt_regs regs;
195+ mm_segment_t old_fs = get_fs();
195196 if (sp) {
196197 regs.regs[29] = (unsigned long)sp;
197198 regs.regs[31] = 0;
@@ -210,7 +211,13 @@ void show_stack(struct task_struct *task, unsigned long *sp) · 12 unmodified lines
210211 prepare_frametrace(&regs);
211212 }
212213 }
214+ /*
215+ * show_stack() deals exclusively with kernel mode, so be sure to access
216+ * the stack in the kernel (not user) address space.
217+ */
218+ set_fs(KERNEL_DS);
213219 show_stacktrace(task, &regs);
220+ set_fs(old_fs);
214221 }
215222
216223 static void show_code(unsigned int __user *pc)
@@ -1519,6 +1526,7 @@ asmlinkage void do_mcheck(struct pt_regs *regs) · 1302 unmodified lines
15191526 const int field = 2 * sizeof(unsigned long);
15201527 int multi_match = regs->cp0_status & ST0_TS;
15211528 enum ctx_state prev_state;
1529+ mm_segment_t old_fs = get_fs();
15221530
15231531 prev_state = exception_enter();
15241532 show_regs(regs);
@@ -1540,8 +1548,13 @@ asmlinkage void do_mcheck(struct pt_regs *regs) · 15 unmodified lines
15401548 dump_tlb_all();
15411549 }
15421550
1551+ if (!user_mode(regs))
1552+ set_fs(KERNEL_DS);
1553+
15431554 show_code((unsigned int __user *) regs->cp0_epc);
15441555
1556+ set_fs(old_fs);
1557+
15451558 /*
15461559 * Some chips may have other causes of machine check (e.g. SB1
15471560 * graduation timer)
arch/mips/kernel/unaligned.c+1−1
@@ -438,7 +438,7 @@ do { \ · 437 unmodified lines
438438 : "memory"); \
439439 } while(0)
440440
441−#define StoreDW(addr, value, res) \
441+#define _StoreDW(addr, value, res) \
442442 do { \
443443 __asm__ __volatile__ ( \
444444 ".set\tpush\n\t" \
arch/mips/lantiq/irq.c+2−1
@@ -293,7 +293,7 @@ static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id) · 292 unmodified lines
293293
294294 static irqreturn_t ipi_call_interrupt(int irq, void *dev_id)
295295 {
296− smp_call_function_interrupt();
296+ generic_smp_call_function_interrupt();
297297 return IRQ_HANDLED;
298298 }
299299
@@ -466,6 +466,7 @@ int get_c0_perfcount_int(void) · 166 unmodified lines
466466 {
467467 return ltq_perfcount_irq;
468468 }
469+EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
469470
470471 unsigned int get_c0_compare_int(void)
471472 {
arch/mips/loongson64/loongson-3/smp.c+5−2
@@ -266,8 +266,11 @@ void loongson3_ipi_interrupt(struct pt_regs *regs) · 265 unmodified lines
266266 if (action & SMP_RESCHEDULE_YOURSELF)
267267 scheduler_ipi();
268268
269− if (action & SMP_CALL_FUNCTION)
270− smp_call_function_interrupt();
269+ if (action & SMP_CALL_FUNCTION) {
270+ irq_enter();
271+ generic_smp_call_function_interrupt();
272+ irq_exit();
273+ }
271274
272275 if (action & SMP_ASK_C0COUNT) {
273276 BUG_ON(cpu != 0);
arch/mips/mm/cache.c+4−4
@@ -160,18 +160,18 @@ static inline void setup_protection_map(void) · 159 unmodified lines
160160 protection_map[1] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC);
161161 protection_map[2] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
162162 protection_map[3] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC);
163− protection_map[4] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_READ);
163+ protection_map[4] = __pgprot(_page_cachable_default | _PAGE_PRESENT);
164164 protection_map[5] = __pgprot(_page_cachable_default | _PAGE_PRESENT);
165− protection_map[6] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_READ);
165+ protection_map[6] = __pgprot(_page_cachable_default | _PAGE_PRESENT);
166166 protection_map[7] = __pgprot(_page_cachable_default | _PAGE_PRESENT);
167167
168168 protection_map[8] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
169169 protection_map[9] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC);
170170 protection_map[10] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE | _PAGE_NO_READ);
171171 protection_map[11] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE);
172− protection_map[12] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_READ);
172+ protection_map[12] = __pgprot(_page_cachable_default | _PAGE_PRESENT);
173173 protection_map[13] = __pgprot(_page_cachable_default | _PAGE_PRESENT);
174− protection_map[14] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_WRITE | _PAGE_NO_READ);
174+ protection_map[14] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_WRITE);
175175 protection_map[15] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_WRITE);
176176
177177 } else {
arch/mips/mm/fault.c+2−1
@@ -133,7 +133,8 @@ good_area: · 132 unmodified lines
133133 #endif
134134 goto bad_area;
135135 }
136− if (!(vma->vm_flags & VM_READ)) {
136+ if (!(vma->vm_flags & VM_READ) &&
137+ exception_epc(regs) != address) {
137138 #if 0
138139 pr_notice("Cpu%d[%s:%d:%0*lx:%ld:%0*lx] RI violation\n",
139140 raw_smp_processor_id(),
arch/mips/mti-malta/malta-int.c+1−1
@@ -222,7 +222,7 @@ static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id) · 221 unmodified lines
222222
223223 static irqreturn_t ipi_call_interrupt(int irq, void *dev_id)
224224 {
225− smp_call_function_interrupt();
225+ generic_smp_call_function_interrupt();
226226
227227 return IRQ_HANDLED;
228228 }
arch/mips/mti-malta/malta-time.c+10−6
@@ -154,6 +154,7 @@ int get_c0_perfcount_int(void) · 153 unmodified lines
154154
155155 return mips_cpu_perf_irq;
156156 }
157+EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
157158
158159 unsigned int get_c0_compare_int(void)
159160 {
@@ -171,14 +172,17 @@ unsigned int get_c0_compare_int(void) · 11 unmodified lines
171172
172173 static void __init init_rtc(void)
173174 {
174− /* stop the clock whilst setting it up */
175− CMOS_WRITE(RTC_SET | RTC_24H, RTC_CONTROL);
175+ unsigned char freq, ctrl;
176176
177− /* 32KHz time base */
178− CMOS_WRITE(RTC_REF_CLCK_32KHZ, RTC_FREQ_SELECT);
177+ /* Set 32KHz time base if not already set */
178+ freq = CMOS_READ(RTC_FREQ_SELECT);
179+ if ((freq & RTC_DIV_CTL) != RTC_REF_CLCK_32KHZ)
180+ CMOS_WRITE(RTC_REF_CLCK_32KHZ, RTC_FREQ_SELECT);
179181
180− /* start the clock */
181− CMOS_WRITE(RTC_24H, RTC_CONTROL);
182+ /* Ensure SET bit is clear so RTC can run */
183+ ctrl = CMOS_READ(RTC_CONTROL);
184+ if (ctrl & RTC_SET)
185+ CMOS_WRITE(ctrl & ~RTC_SET, RTC_CONTROL);
182186 }
183187
184188 void __init plat_time_init(void)
arch/mips/mti-sead3/sead3-time.c+1−0
@@ -77,6 +77,7 @@ int get_c0_perfcount_int(void) · 76 unmodified lines
7777 return MIPS_CPU_IRQ_BASE + cp0_perfcount_irq;
7878 return -1;
7979 }
80+EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
8081
8182 unsigned int get_c0_compare_int(void)
8283 {
arch/mips/netlogic/common/smp.c+1−1
@@ -86,7 +86,7 @@ void nlm_smp_function_ipi_handler(unsigned int irq, struct irq_desc *desc) · 85 unmodified lines
8686 {
8787 clear_c0_eimr(irq);
8888 ack_c0_eirr(irq);
89− smp_call_function_interrupt();
89+ generic_smp_call_function_interrupt();
9090 set_c0_eimr(irq);
9191 }
9292
arch/mips/paravirt/paravirt-smp.c+1−1
@@ -114,7 +114,7 @@ static irqreturn_t paravirt_reched_interrupt(int irq, void *dev_id) · 113 unmodified lines
114114
115115 static irqreturn_t paravirt_function_interrupt(int irq, void *dev_id)
116116 {
117− smp_call_function_interrupt();
117+ generic_smp_call_function_interrupt();
118118 return IRQ_HANDLED;
119119 }
120120
arch/mips/pistachio/time.c+1−0
@@ -26,6 +26,7 @@ int get_c0_perfcount_int(void) · 25 unmodified lines
2626 {
2727 return gic_get_c0_perfcount_int();
2828 }
29+EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
2930
3031 int get_c0_fdc_int(void)
3132 {
arch/mips/pmcs-msp71xx/msp_smp.c+1−1
@@ -44,7 +44,7 @@ static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id) · 43 unmodified lines
4444
4545 static irqreturn_t ipi_call_interrupt(int irq, void *dev_id)
4646 {
47− smp_call_function_interrupt();
47+ generic_smp_call_function_interrupt();
4848
4949 return IRQ_HANDLED;
5050 }
arch/mips/ralink/irq.c+1−0
@@ -89,6 +89,7 @@ int get_c0_perfcount_int(void) · 88 unmodified lines
8989 {
9090 return rt_perfcount_irq;
9191 }
92+EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
9293
9394 unsigned int get_c0_compare_int(void)
9495 {
arch/mips/sgi-ip27/ip27-irq.c+6−2
@@ -107,10 +107,14 @@ static void ip27_do_irq_mask0(void) · 106 unmodified lines
107107 scheduler_ipi();
108108 } else if (pend0 & (1UL << CPU_CALL_A_IRQ)) {
109109 LOCAL_HUB_CLR_INTR(CPU_CALL_A_IRQ);
110− smp_call_function_interrupt();
110+ irq_enter();
111+ generic_smp_call_function_interrupt();
112+ irq_exit();
111113 } else if (pend0 & (1UL << CPU_CALL_B_IRQ)) {
112114 LOCAL_HUB_CLR_INTR(CPU_CALL_B_IRQ);
113− smp_call_function_interrupt();
115+ irq_enter();
116+ generic_smp_call_function_interrupt();
117+ irq_exit();
114118 } else
115119 #endif
116120 {
arch/mips/sibyte/bcm1480/smp.c+5−4
@@ -29,8 +29,6 @@ · 28 unmodified lines
2929 #include <asm/sibyte/bcm1480_regs.h>
3030 #include <asm/sibyte/bcm1480_int.h>
3131
32−extern void smp_call_function_interrupt(void);
33−
3432 /*
3533 * These are routines for dealing with the bcm1480 smp capabilities
3634 * independent of board/firmware
@@ -184,6 +182,9 @@ void bcm1480_mailbox_interrupt(void) · 147 unmodified lines
184182 if (action & SMP_RESCHEDULE_YOURSELF)
185183 scheduler_ipi();
186184
187− if (action & SMP_CALL_FUNCTION)
188− smp_call_function_interrupt();
185+ if (action & SMP_CALL_FUNCTION) {
186+ irq_enter();
187+ generic_smp_call_function_interrupt();
188+ irq_exit();
189+ }
189190 }
arch/mips/sibyte/sb1250/smp.c+5−2
@@ -172,6 +172,9 @@ void sb1250_mailbox_interrupt(void) · 171 unmodified lines
172172 if (action & SMP_RESCHEDULE_YOURSELF)
173173 scheduler_ipi();
174174
175− if (action & SMP_CALL_FUNCTION)
176− smp_call_function_interrupt();
175+ if (action & SMP_CALL_FUNCTION) {
176+ irq_enter();
177+ generic_smp_call_function_interrupt();
178+ irq_exit();
179+ }
177180 }
arch/powerpc/kernel/signal_32.c+0−2
@@ -966,8 +966,6 @@ int copy_siginfo_to_user32(struct compat_siginfo __user *d, const siginfo_t *s) · 965 unmodified lines
966966
967967 int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from)
968968 {
969− memset(to, 0, sizeof *to);
970−
971969 if (copy_from_user(to, from, 3*sizeof(int)) ||
972970 copy_from_user(to->_sifields._pad,
973971 from->_sifields._pad, SI_PAD_SIZE32))
arch/powerpc/platforms/powernv/eeh-powernv.c+1−1
@@ -1478,7 +1478,7 @@ static int pnv_eeh_next_error(struct eeh_pe **pe) · 1477 unmodified lines
14781478 }
14791479
14801480 /* Unmask the event */
1481− if (eeh_enabled())
1481+ if (ret == EEH_NEXT_ERR_NONE && eeh_enabled())
14821482 enable_irq(eeh_event_irq);
14831483
14841484 return ret;
arch/powerpc/platforms/powernv/pci-ioda.c+6−5
@@ -2220,7 +2220,7 @@ static void pnv_pci_ioda_setup_opal_tce_kill(struct pnv_phb *phb) · 2219 unmodified lines
22202220
22212221 static __be64 *pnv_pci_ioda2_table_do_alloc_pages(int nid, unsigned shift,
22222222 unsigned levels, unsigned long limit,
2223− unsigned long *current_offset)
2223+ unsigned long *current_offset, unsigned long *total_allocated)
22242224 {
22252225 struct page *tce_mem = NULL;
22262226 __be64 *addr, *tmp;
@@ -2236,6 +2236,7 @@ static __be64 *pnv_pci_ioda2_table_do_alloc_pages(int nid, unsigned shift, · 9 unmodified lines
22362236 }
22372237 addr = page_address(tce_mem);
22382238 memset(addr, 0, allocated);
2239+ *total_allocated += allocated;
22392240
22402241 --levels;
22412242 if (!levels) {
@@ -2245,7 +2246,7 @@ static __be64 *pnv_pci_ioda2_table_do_alloc_pages(int nid, unsigned shift, · 3 unmodified lines
22452246
22462247 for (i = 0; i < entries; ++i) {
22472248 tmp = pnv_pci_ioda2_table_do_alloc_pages(nid, shift,
2248− levels, limit, current_offset);
2249+ levels, limit, current_offset, total_allocated);
22492250 if (!tmp)
22502251 break;
22512252
@@ -2267,7 +2268,7 @@ static long pnv_pci_ioda2_table_alloc_pages(int nid, __u64 bus_offset, · 15 unmodified lines
22672268 struct iommu_table *tbl)
22682269 {
22692270 void *addr;
2270− unsigned long offset = 0, level_shift;
2271+ unsigned long offset = 0, level_shift, total_allocated = 0;
22712272 const unsigned window_shift = ilog2(window_size);
22722273 unsigned entries_shift = window_shift - page_shift;
22732274 unsigned table_shift = max_t(unsigned, entries_shift + 3, PAGE_SHIFT);
@@ -2286,7 +2287,7 @@ static long pnv_pci_ioda2_table_alloc_pages(int nid, __u64 bus_offset, · 12 unmodified lines
22862287
22872288 /* Allocate TCE table */
22882289 addr = pnv_pci_ioda2_table_do_alloc_pages(nid, level_shift,
2289− levels, tce_table_size, &offset);
2290+ levels, tce_table_size, &offset, &total_allocated);
22902291
22912292 /* addr==NULL means that the first level allocation failed */
22922293 if (!addr)
@@ -2308,7 +2309,7 @@ static long pnv_pci_ioda2_table_alloc_pages(int nid, __u64 bus_offset, · 15 unmodified lines
23082309 page_shift);
23092310 tbl->it_level_size = 1ULL << (level_shift - 3);
23102311 tbl->it_indirect_levels = levels - 1;
2311− tbl->it_allocated_size = offset;
2312+ tbl->it_allocated_size = total_allocated;
23122313
23132314 pr_devel("Created TCE table: ws=%08llx ts=%lx @%08llx\n",
23142315 window_size, tce_table_size, bus_offset);
arch/s390/kvm/kvm-s390.c+2−2
@@ -1742,10 +1742,10 @@ static bool ibs_enabled(struct kvm_vcpu *vcpu) · 1741 unmodified lines
17421742
17431743 static int kvm_s390_handle_requests(struct kvm_vcpu *vcpu)
17441744 {
1745− if (!vcpu->requests)
1746− return 0;
17471745 retry:
17481746 kvm_s390_vcpu_request_handled(vcpu);
1747+ if (!vcpu->requests)
1748+ return 0;
17491749 /*
17501750 * We use MMU_RELOAD just to re-arm the ipte notifier for the
17511751 * guest prefix page. gmap_ipte_notify will wait on the ptl lock.
arch/sparc/include/asm/visasm.h+5−11
@@ -28,16 +28,10 @@ · 27 unmodified lines
2828 * Must preserve %o5 between VISEntryHalf and VISExitHalf */
2929
3030 #define VISEntryHalf \
31− rd %fprs, %o5; \
32− andcc %o5, FPRS_FEF, %g0; \
33− be,pt %icc, 297f; \
34− sethi %hi(298f), %g7; \
35− sethi %hi(VISenterhalf), %g1; \
36− jmpl %g1 + %lo(VISenterhalf), %g0; \
37− or %g7, %lo(298f), %g7; \
38− clr %o5; \
39−297: wr %o5, FPRS_FEF, %fprs; \
40−298:
31+ VISEntry
32+
33+#define VISExitHalf \
34+ VISExit
4135
4236 #define VISEntryHalfFast(fail_label) \
4337 rd %fprs, %o5; \
@@ -47,7 +41,7 @@ · 3 unmodified lines
4741 ba,a,pt %xcc, fail_label; \
4842 297: wr %o5, FPRS_FEF, %fprs;
4943
50−#define VISExitHalf \
44+#define VISExitHalfFast \
5145 wr %o5, 0, %fprs;
5246
5347 #ifndef __ASSEMBLY__
arch/sparc/lib/NG4memcpy.S+4−1
@@ -240,8 +240,11 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */ · 239 unmodified lines
240240 add %o0, 0x40, %o0
241241 bne,pt %icc, 1b
242242 LOAD(prefetch, %g1 + 0x200, #n_reads_strong)
243+#ifdef NON_USER_COPY
244+ VISExitHalfFast
245+#else
243246 VISExitHalf
244−
247+#endif
245248 brz,pn %o2, .Lexit
246249 cmp %o2, 19
247250 ble,pn %icc, .Lsmall_unaligned
arch/sparc/lib/VISsave.S+2−65
@@ -44,9 +44,8 @@ vis1: ldub [%g6 + TI_FPSAVED], %g3 · 43 unmodified lines
4444
4545 stx %g3, [%g6 + TI_GSR]
4646 2: add %g6, %g1, %g3
47− cmp %o5, FPRS_DU
48− be,pn %icc, 6f
49− sll %g1, 3, %g1
47+ mov FPRS_DU | FPRS_DL | FPRS_FEF, %o5
48+ sll %g1, 3, %g1
5049 stb %o5, [%g3 + TI_FPSAVED]
5150 rd %gsr, %g2
5251 add %g6, %g1, %g3
@@ -80,65 +79,3 @@ vis1: ldub [%g6 + TI_FPSAVED], %g3 · 27 unmodified lines
8079 .align 32
8180 80: jmpl %g7 + %g0, %g0
8281 nop
83−
84−6: ldub [%g3 + TI_FPSAVED], %o5
85− or %o5, FPRS_DU, %o5
86− add %g6, TI_FPREGS+0x80, %g2
87− stb %o5, [%g3 + TI_FPSAVED]
88−
89− sll %g1, 5, %g1
90− add %g6, TI_FPREGS+0xc0, %g3
91− wr %g0, FPRS_FEF, %fprs
92− membar #Sync
93− stda %f32, [%g2 + %g1] ASI_BLK_P
94− stda %f48, [%g3 + %g1] ASI_BLK_P
95− membar #Sync
96− ba,pt %xcc, 80f
97− nop
98−
99− .align 32
100−80: jmpl %g7 + %g0, %g0
101− nop
102−
103− .align 32
104−VISenterhalf:
105− ldub [%g6 + TI_FPDEPTH], %g1
106− brnz,a,pn %g1, 1f
107− cmp %g1, 1
108− stb %g0, [%g6 + TI_FPSAVED]
109− stx %fsr, [%g6 + TI_XFSR]
110− clr %o5
111− jmpl %g7 + %g0, %g0
112− wr %g0, FPRS_FEF, %fprs
113−
114−1: bne,pn %icc, 2f
115− srl %g1, 1, %g1
116− ba,pt %xcc, vis1
117− sub %g7, 8, %g7
118−2: addcc %g6, %g1, %g3
119− sll %g1, 3, %g1
120− andn %o5, FPRS_DU, %g2
121− stb %g2, [%g3 + TI_FPSAVED]
122−
123− rd %gsr, %g2
124− add %g6, %g1, %g3
125− stx %g2, [%g3 + TI_GSR]
126− add %g6, %g1, %g2
127− stx %fsr, [%g2 + TI_XFSR]
128− sll %g1, 5, %g1
129−3: andcc %o5, FPRS_DL, %g0
130− be,pn %icc, 4f
131− add %g6, TI_FPREGS, %g2
132−
133− add %g6, TI_FPREGS+0x40, %g3
134− membar #Sync
135− stda %f0, [%g2 + %g1] ASI_BLK_P
136− stda %f16, [%g3 + %g1] ASI_BLK_P
137− membar #Sync
138− ba,pt %xcc, 4f
139− nop
140−
141− .align 32
142−4: and %o5, FPRS_DU, %o5
143− jmpl %g7 + %g0, %g0
144− wr %o5, FPRS_FEF, %fprs
arch/sparc/lib/ksyms.c+0−4
@@ -135,10 +135,6 @@ EXPORT_SYMBOL(copy_user_page); · 134 unmodified lines
135135 void VISenter(void);
136136 EXPORT_SYMBOL(VISenter);
137137
138−/* CRYPTO code needs this */
139−void VISenterhalf(void);
140−EXPORT_SYMBOL(VISenterhalf);
141−
142138 extern void xor_vis_2(unsigned long, unsigned long *, unsigned long *);
143139 extern void xor_vis_3(unsigned long, unsigned long *, unsigned long *,
144140 unsigned long *);
arch/tile/kernel/compat_signal.c+0−2
@@ -113,8 +113,6 @@ int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from) · 112 unmodified lines
113113 if (!access_ok(VERIFY_READ, from, sizeof(struct compat_siginfo)))
114114 return -EFAULT;
115115
116− memset(to, 0, sizeof(*to));
117−
118116 err = __get_user(to->si_signo, &from->si_signo);
119117 err |= __get_user(to->si_errno, &from->si_errno);
120118 err |= __get_user(to->si_code, &from->si_code);
arch/x86/boot/compressed/eboot.c+4−0
@@ -1193,6 +1193,10 @@ static efi_status_t setup_e820(struct boot_params *params, · 1192 unmodified lines
11931193 unsigned int e820_type = 0;
11941194 unsigned long m = efi->efi_memmap;
11951195
1196+#ifdef CONFIG_X86_64
1197+ m |= (u64)efi->efi_memmap_hi << 32;
1198+#endif
1199+
11961200 d = (efi_memory_desc_t *)(m + (i * efi->efi_memdesc_size));
11971201 switch (d->type) {
11981202 case EFI_RESERVED_TYPE:
arch/x86/include/asm/desc.h+0−15
@@ -280,21 +280,6 @@ static inline void clear_LDT(void) · 279 unmodified lines
280280 set_ldt(NULL, 0);
281281 }
282282
283−/*
284− * load one particular LDT into the current CPU
285− */
286−static inline void load_LDT_nolock(mm_context_t *pc)
287−{
288− set_ldt(pc->ldt, pc->size);
289−}
290−
291−static inline void load_LDT(mm_context_t *pc)
292−{
293− preempt_disable();
294− load_LDT_nolock(pc);
295− preempt_enable();
296−}
297−
298283 static inline unsigned long get_desc_base(const struct desc_struct *desc)
299284 {
300285 return (unsigned)(desc->base0 | ((desc->base1) << 16) | ((desc->base2) << 24));
arch/x86/include/asm/mmu.h+1−2
@@ -9,8 +9,7 @@ · 8 unmodified lines
99 * we put the segment information here.
1010 */
1111 typedef struct {
12− void *ldt;
13− int size;
12+ struct ldt_struct *ldt;
1413
1514 #ifdef CONFIG_X86_64
1615 /* True if mm supports a task running in 32 bit compatibility mode. */
arch/x86/include/asm/mmu_context.h+49−5
@@ -33,6 +33,50 @@ static inline void load_mm_cr4(struct mm_struct *mm) · 32 unmodified lines
3333 static inline void load_mm_cr4(struct mm_struct *mm) {}
3434 #endif
3535
36+/*
37+ * ldt_structs can be allocated, used, and freed, but they are never
38+ * modified while live.
39+ */
40+struct ldt_struct {
41+ /*
42+ * Xen requires page-aligned LDTs with special permissions. This is
43+ * needed to prevent us from installing evil descriptors such as
44+ * call gates. On native, we could merge the ldt_struct and LDT
45+ * allocations, but it's not worth trying to optimize.
46+ */
47+ struct desc_struct *entries;
48+ int size;
49+};
50+
51+static inline void load_mm_ldt(struct mm_struct *mm)
52+{
53+ struct ldt_struct *ldt;
54+
55+ /* lockless_dereference synchronizes with smp_store_release */
56+ ldt = lockless_dereference(mm->context.ldt);
57+
58+ /*
59+ * Any change to mm->context.ldt is followed by an IPI to all
60+ * CPUs with the mm active. The LDT will not be freed until
61+ * after the IPI is handled by all such CPUs. This means that,
62+ * if the ldt_struct changes before we return, the values we see
63+ * will be safe, and the new values will be loaded before we run
64+ * any user code.
65+ *
66+ * NB: don't try to convert this to use RCU without extreme care.
67+ * We would still need IRQs off, because we don't want to change
68+ * the local LDT after an IPI loaded a newer value than the one
69+ * that we can see.
70+ */
71+
72+ if (unlikely(ldt))
73+ set_ldt(ldt->entries, ldt->size);
74+ else
75+ clear_LDT();
76+
77+ DEBUG_LOCKS_WARN_ON(preemptible());
78+}
79+
3680 /*
3781 * Used for LDT copy/destruction.
3882 */
@@ -78,12 +122,12 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, · 39 unmodified lines
78122 * was called and then modify_ldt changed
79123 * prev->context.ldt but suppressed an IPI to this CPU.
80124 * In this case, prev->context.ldt != NULL, because we
81− * never free an LDT while the mm still exists. That
82− * means that next->context.ldt != prev->context.ldt,
83− * because mms never share an LDT.
125+ * never set context.ldt to NULL while the mm still
126+ * exists. That means that next->context.ldt !=
127+ * prev->context.ldt, because mms never share an LDT.
84128 */
85129 if (unlikely(prev->context.ldt != next->context.ldt))
86− load_LDT_nolock(&next->context);
130+ load_mm_ldt(next);
87131 }
88132 #ifdef CONFIG_SMP
89133 else {
@@ -106,7 +150,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, · 16 unmodified lines
106150 load_cr3(next->pgd);
107151 trace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL);
108152 load_mm_cr4(next);
109− load_LDT_nolock(&next->context);
153+ load_mm_ldt(next);
110154 }
111155 }
112156 #endif
arch/x86/include/asm/sigcontext.h+3−3
@@ -57,9 +57,9 @@ struct sigcontext { · 56 unmodified lines
5757 unsigned long ip;
5858 unsigned long flags;
5959 unsigned short cs;
60− unsigned short __pad2; /* Was called gs, but was always zero. */
61− unsigned short __pad1; /* Was called fs, but was always zero. */
62− unsigned short ss;
60+ unsigned short gs;
61+ unsigned short fs;
62+ unsigned short __pad0;
6363 unsigned long err;
6464 unsigned long trapno;
6565 unsigned long oldmask;
arch/x86/include/uapi/asm/sigcontext.h+3−18
@@ -177,24 +177,9 @@ struct sigcontext { · 176 unmodified lines
177177 __u64 rip;
178178 __u64 eflags; /* RFLAGS */
179179 __u16 cs;
180−
181− /*
182− * Prior to 2.5.64 ("[PATCH] x86-64 updates for 2.5.64-bk3"),
183− * Linux saved and restored fs and gs in these slots. This
184− * was counterproductive, as fsbase and gsbase were never
185− * saved, so arch_prctl was presumably unreliable.
186− *
187− * If these slots are ever needed for any other purpose, there
188− * is some risk that very old 64-bit binaries could get
189− * confused. I doubt that many such binaries still work,
190− * though, since the same patch in 2.5.64 also removed the
191− * 64-bit set_thread_area syscall, so it appears that there is
192− * no TLS API that works in both pre- and post-2.5.64 kernels.
193− */
194− __u16 __pad2; /* Was gs. */
195− __u16 __pad1; /* Was fs. */
196−
197− __u16 ss;
180+ __u16 gs;
181+ __u16 fs;
182+ __u16 __pad0;
198183 __u64 err;
199184 __u64 trapno;
200185 __u64 oldmask;
arch/x86/kernel/apic/io_apic.c+1−1
@@ -943,7 +943,7 @@ static bool mp_check_pin_attr(int irq, struct irq_alloc_info *info) · 942 unmodified lines
943943 */
944944 if (irq < nr_legacy_irqs() && data->count == 1) {
945945 if (info->ioapic_trigger != data->trigger)
946− mp_register_handler(irq, data->trigger);
946+ mp_register_handler(irq, info->ioapic_trigger);
947947 data->entry.trigger = data->trigger = info->ioapic_trigger;
948948 data->entry.polarity = data->polarity = info->ioapic_polarity;
949949 }
arch/x86/kernel/cpu/common.c+2−2
@@ -1410,7 +1410,7 @@ void cpu_init(void) · 1409 unmodified lines
14101410 load_sp0(t, &current->thread);
14111411 set_tss_desc(cpu, t);
14121412 load_TR_desc();
1413− load_LDT(&init_mm.context);
1413+ load_mm_ldt(&init_mm);
14141414
14151415 clear_all_debug_regs();
14161416 dbg_restore_debug_regs();
@@ -1459,7 +1459,7 @@ void cpu_init(void) · 42 unmodified lines
14591459 load_sp0(t, thread);
14601460 set_tss_desc(cpu, t);
14611461 load_TR_desc();
1462− load_LDT(&init_mm.context);
1462+ load_mm_ldt(&init_mm);
14631463
14641464 t->x86_tss.io_bitmap_base = offsetof(struct tss_struct, io_bitmap);
14651465
arch/x86/kernel/cpu/perf_event.c+8−4
@@ -2179,21 +2179,25 @@ static unsigned long get_segment_base(unsigned int segment) · 2178 unmodified lines
21792179 int idx = segment >> 3;
21802180
21812181 if ((segment & SEGMENT_TI_MASK) == SEGMENT_LDT) {
2182+ struct ldt_struct *ldt;
2183+
21822184 if (idx > LDT_ENTRIES)
21832185 return 0;
21842186
2185− if (idx > current->active_mm->context.size)
2187+ /* IRQs are off, so this synchronizes with smp_store_release */
2188+ ldt = lockless_dereference(current->active_mm->context.ldt);
2189+ if (!ldt || idx > ldt->size)
21862190 return 0;
21872191
2188− desc = current->active_mm->context.ldt;
2192+ desc = &ldt->entries[idx];
21892193 } else {
21902194 if (idx > GDT_ENTRIES)
21912195 return 0;
21922196
2193− desc = raw_cpu_ptr(gdt_page.gdt);
2197+ desc = raw_cpu_ptr(gdt_page.gdt) + idx;
21942198 }
21952199
2196− return get_desc_base(desc + idx);
2200+ return get_desc_base(desc);
21972201 }
21982202
21992203 #ifdef CONFIG_COMPAT
arch/x86/kernel/ldt.c+142−120
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #include <linux/string.h>
1313 #include <linux/mm.h>
1414 #include <linux/smp.h>
15+#include <linux/slab.h>
1516 #include <linux/vmalloc.h>
1617 #include <linux/uaccess.h>
1718
@@ -20,82 +21,82 @@ · 2 unmodified lines
2021 #include <asm/mmu_context.h>
2122 #include <asm/syscalls.h>
2223
23−#ifdef CONFIG_SMP
24+/* context.lock is held for us, so we don't need any locking. */
2425 static void flush_ldt(void *current_mm)
2526 {
26− if (current->active_mm == current_mm)
27− load_LDT(&current->active_mm->context);
27+ mm_context_t *pc;
28+
29+ if (current->active_mm != current_mm)
30+ return;
31+
32+ pc = &current->active_mm->context;
33+ set_ldt(pc->ldt->entries, pc->ldt->size);
2834 }
29−#endif
3035
31−static int alloc_ldt(mm_context_t *pc, int mincount, int reload)
36+/* The caller must call finalize_ldt_struct on the result. LDT starts zeroed. */
37+static struct ldt_struct *alloc_ldt_struct(int size)
3238 {
33− void *oldldt, *newldt;
34− int oldsize;
35−
36− if (mincount <= pc->size)
37− return 0;
38− oldsize = pc->size;
39− mincount = (mincount + (PAGE_SIZE / LDT_ENTRY_SIZE - 1)) &
40− (~(PAGE_SIZE / LDT_ENTRY_SIZE - 1));
41− if (mincount * LDT_ENTRY_SIZE > PAGE_SIZE)
42− newldt = vmalloc(mincount * LDT_ENTRY_SIZE);
39+ struct ldt_struct *new_ldt;
40+ int alloc_size;
41+
42+ if (size > LDT_ENTRIES)
43+ return NULL;
44+
45+ new_ldt = kmalloc(sizeof(struct ldt_struct), GFP_KERNEL);
46+ if (!new_ldt)
47+ return NULL;
48+
49+ BUILD_BUG_ON(LDT_ENTRY_SIZE != sizeof(struct desc_struct));
50+ alloc_size = size * LDT_ENTRY_SIZE;
51+
52+ /*
53+ * Xen is very picky: it requires a page-aligned LDT that has no
54+ * trailing nonzero bytes in any page that contains LDT descriptors.
55+ * Keep it simple: zero the whole allocation and never allocate less
56+ * than PAGE_SIZE.
57+ */
58+ if (alloc_size > PAGE_SIZE)
59+ new_ldt->entries = vzalloc(alloc_size);
4360 else
44− newldt = (void *)__get_free_page(GFP_KERNEL);
45−
46− if (!newldt)
47− return -ENOMEM;
61+ new_ldt->entries = kzalloc(PAGE_SIZE, GFP_KERNEL);
4862
49− if (oldsize)
50− memcpy(newldt, pc->ldt, oldsize * LDT_ENTRY_SIZE);
51− oldldt = pc->ldt;
52− memset(newldt + oldsize * LDT_ENTRY_SIZE, 0,
53− (mincount - oldsize) * LDT_ENTRY_SIZE);
63+ if (!new_ldt->entries) {
64+ kfree(new_ldt);
65+ return NULL;
66+ }
5467
55− paravirt_alloc_ldt(newldt, mincount);
68+ new_ldt->size = size;
69+ return new_ldt;
70+}
5671
57−#ifdef CONFIG_X86_64
58− /* CHECKME: Do we really need this ? */
59− wmb();
60−#endif
61− pc->ldt = newldt;
62− wmb();
63− pc->size = mincount;
64− wmb();
65−
66− if (reload) {
67−#ifdef CONFIG_SMP
68− preempt_disable();
69− load_LDT(pc);
70− if (!cpumask_equal(mm_cpumask(current->mm),
71− cpumask_of(smp_processor_id())))
72− smp_call_function(flush_ldt, current->mm, 1);
73− preempt_enable();
74−#else
75− load_LDT(pc);
76−#endif
77− }
78− if (oldsize) {
79− paravirt_free_ldt(oldldt, oldsize);
80− if (oldsize * LDT_ENTRY_SIZE > PAGE_SIZE)
81− vfree(oldldt);
82− else
83− put_page(virt_to_page(oldldt));
84− }
85− return 0;
72+/* After calling this, the LDT is immutable. */
73+static void finalize_ldt_struct(struct ldt_struct *ldt)
74+{
75+ paravirt_alloc_ldt(ldt->entries, ldt->size);
8676 }
8777
88−static inline int copy_ldt(mm_context_t *new, mm_context_t *old)
78+/* context.lock is held */
79+static void install_ldt(struct mm_struct *current_mm,
80+ struct ldt_struct *ldt)
8981 {
90− int err = alloc_ldt(new, old->size, 0);
91− int i;
82+ /* Synchronizes with lockless_dereference in load_mm_ldt. */
83+ smp_store_release(&current_mm->context.ldt, ldt);
84+
85+ /* Activate the LDT for all CPUs using current_mm. */
86+ on_each_cpu_mask(mm_cpumask(current_mm), flush_ldt, current_mm, true);
87+}
9288
93− if (err < 0)
94− return err;
89+static void free_ldt_struct(struct ldt_struct *ldt)
90+{
91+ if (likely(!ldt))
92+ return;
9593
96− for (i = 0; i < old->size; i++)
97− write_ldt_entry(new->ldt, i, old->ldt + i * LDT_ENTRY_SIZE);
98− return 0;
94+ paravirt_free_ldt(ldt->entries, ldt->size);
95+ if (ldt->size * LDT_ENTRY_SIZE > PAGE_SIZE)
96+ vfree(ldt->entries);
97+ else
98+ kfree(ldt->entries);
99+ kfree(ldt);
99100 }
100101
101102 /*
@@ -104,17 +105,37 @@ static inline int copy_ldt(mm_context_t *new, mm_context_t *old) · 2 unmodified lines
104105 */
105106 int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
106107 {
108+ struct ldt_struct *new_ldt;
107109 struct mm_struct *old_mm;
108110 int retval = 0;
109111
110112 mutex_init(&mm->context.lock);
111− mm->context.size = 0;
112113 old_mm = current->mm;
113− if (old_mm && old_mm->context.size > 0) {
114− mutex_lock(&old_mm->context.lock);
115− retval = copy_ldt(&mm->context, &old_mm->context);
116− mutex_unlock(&old_mm->context.lock);
114+ if (!old_mm) {
115+ mm->context.ldt = NULL;
116+ return 0;
117117 }
118+
119+ mutex_lock(&old_mm->context.lock);
120+ if (!old_mm->context.ldt) {
121+ mm->context.ldt = NULL;
122+ goto out_unlock;
123+ }
124+
125+ new_ldt = alloc_ldt_struct(old_mm->context.ldt->size);
126+ if (!new_ldt) {
127+ retval = -ENOMEM;
128+ goto out_unlock;
129+ }
130+
131+ memcpy(new_ldt->entries, old_mm->context.ldt->entries,
132+ new_ldt->size * LDT_ENTRY_SIZE);
133+ finalize_ldt_struct(new_ldt);
134+
135+ mm->context.ldt = new_ldt;
136+
137+out_unlock:
138+ mutex_unlock(&old_mm->context.lock);
118139 return retval;
119140 }
120141
@@ -125,53 +146,47 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm) · 4 unmodified lines
125146 */
126147 void destroy_context(struct mm_struct *mm)
127148 {
128− if (mm->context.size) {
129−#ifdef CONFIG_X86_32
130− /* CHECKME: Can this ever happen ? */
131− if (mm == current->active_mm)
132− clear_LDT();
133−#endif
134− paravirt_free_ldt(mm->context.ldt, mm->context.size);
135− if (mm->context.size * LDT_ENTRY_SIZE > PAGE_SIZE)
136− vfree(mm->context.ldt);
137− else
138− put_page(virt_to_page(mm->context.ldt));
139− mm->context.size = 0;
140− }
149+ free_ldt_struct(mm->context.ldt);
150+ mm->context.ldt = NULL;
141151 }
142152
143153 static int read_ldt(void __user *ptr, unsigned long bytecount)
144154 {
145− int err;
155+ int retval;
146156 unsigned long size;
147157 struct mm_struct *mm = current->mm;
148158
149− if (!mm->context.size)
150− return 0;
159+ mutex_lock(&mm->context.lock);
160+
161+ if (!mm->context.ldt) {
162+ retval = 0;
163+ goto out_unlock;
164+ }
165+
151166 if (bytecount > LDT_ENTRY_SIZE * LDT_ENTRIES)
152167 bytecount = LDT_ENTRY_SIZE * LDT_ENTRIES;
153168
154− mutex_lock(&mm->context.lock);
155− size = mm->context.size * LDT_ENTRY_SIZE;
169+ size = mm->context.ldt->size * LDT_ENTRY_SIZE;
156170 if (size > bytecount)
157171 size = bytecount;
158172
159− err = 0;
160− if (copy_to_user(ptr, mm->context.ldt, size))
161− err = -EFAULT;
162− mutex_unlock(&mm->context.lock);
163− if (err < 0)
164− goto error_return;
173+ if (copy_to_user(ptr, mm->context.ldt->entries, size)) {
174+ retval = -EFAULT;
175+ goto out_unlock;
176+ }
177+
165178 if (size != bytecount) {
166− /* zero-fill the rest */
167− if (clear_user(ptr + size, bytecount - size) != 0) {
168− err = -EFAULT;
169− goto error_return;
179+ /* Zero-fill the rest and pretend we read bytecount bytes. */
180+ if (clear_user(ptr + size, bytecount - size)) {
181+ retval = -EFAULT;
182+ goto out_unlock;
170183 }
171184 }
172− return bytecount;
173−error_return:
174− return err;
185+ retval = bytecount;
186+
187+out_unlock:
188+ mutex_unlock(&mm->context.lock);
189+ return retval;
175190 }
176191
177192 static int read_default_ldt(void __user *ptr, unsigned long bytecount)
@@ -195,6 +210,8 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode) · 17 unmodified lines
195210 struct desc_struct ldt;
196211 int error;
197212 struct user_desc ldt_info;
213+ int oldsize, newsize;
214+ struct ldt_struct *new_ldt, *old_ldt;
198215
199216 error = -EINVAL;
200217 if (bytecount != sizeof(ldt_info))
@@ -213,34 +230,39 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode) · 12 unmodified lines
213230 goto out;
214231 }
215232
216− mutex_lock(&mm->context.lock);
217− if (ldt_info.entry_number >= mm->context.size) {
218− error = alloc_ldt(&current->mm->context,
219− ldt_info.entry_number + 1, 1);
220− if (error < 0)
221− goto out_unlock;
222− }
223−
224− /* Allow LDTs to be cleared by the user. */
225− if (ldt_info.base_addr == 0 && ldt_info.limit == 0) {
226− if (oldmode || LDT_empty(&ldt_info)) {
227− memset(&ldt, 0, sizeof(ldt));
228− goto install;
233+ if ((oldmode && !ldt_info.base_addr && !ldt_info.limit) ||
234+ LDT_empty(&ldt_info)) {
235+ /* The user wants to clear the entry. */
236+ memset(&ldt, 0, sizeof(ldt));
237+ } else {
238+ if (!IS_ENABLED(CONFIG_X86_16BIT) && !ldt_info.seg_32bit) {
239+ error = -EINVAL;
240+ goto out;
229241 }
242+
243+ fill_ldt(&ldt, &ldt_info);
244+ if (oldmode)
245+ ldt.avl = 0;
230246 }
231247
232− if (!IS_ENABLED(CONFIG_X86_16BIT) && !ldt_info.seg_32bit) {
233− error = -EINVAL;
248+ mutex_lock(&mm->context.lock);
249+
250+ old_ldt = mm->context.ldt;
251+ oldsize = old_ldt ? old_ldt->size : 0;
252+ newsize = max((int)(ldt_info.entry_number + 1), oldsize);
253+
254+ error = -ENOMEM;
255+ new_ldt = alloc_ldt_struct(newsize);
256+ if (!new_ldt)
234257 goto out_unlock;
235− }
236258
237− fill_ldt(&ldt, &ldt_info);
238− if (oldmode)
239− ldt.avl = 0;
259+ if (old_ldt)
260+ memcpy(new_ldt->entries, old_ldt->entries, oldsize * LDT_ENTRY_SIZE);
261+ new_ldt->entries[ldt_info.entry_number] = ldt;
262+ finalize_ldt_struct(new_ldt);
240263
241− /* Install the new entry ... */
242−install:
243− write_ldt_entry(mm->context.ldt, ldt_info.entry_number, &ldt);
264+ install_ldt(mm, new_ldt);
265+ free_ldt_struct(old_ldt);
244266 error = 0;
245267
246268 out_unlock:
arch/x86/kernel/process_64.c+2−2
@@ -121,11 +121,11 @@ void __show_regs(struct pt_regs *regs, int all) · 120 unmodified lines
121121 void release_thread(struct task_struct *dead_task)
122122 {
123123 if (dead_task->mm) {
124− if (dead_task->mm->context.size) {
124+ if (dead_task->mm->context.ldt) {
125125 pr_warn("WARNING: dead process %s still has LDT? <%p/%d>\n",
126126 dead_task->comm,
127127 dead_task->mm->context.ldt,
128− dead_task->mm->context.size);
128+ dead_task->mm->context.ldt->size);
129129 BUG();
130130 }
131131 }
arch/x86/kernel/signal.c+11−15
@@ -93,8 +93,15 @@ int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) · 92 unmodified lines
9393 COPY(r15);
9494 #endif /* CONFIG_X86_64 */
9595
96+#ifdef CONFIG_X86_32
9697 COPY_SEG_CPL3(cs);
9798 COPY_SEG_CPL3(ss);
99+#else /* !CONFIG_X86_32 */
100+ /* Kernel saves and restores only the CS segment register on signals,
101+ * which is the bare minimum needed to allow mixed 32/64-bit code.
102+ * App's signal handler can save/restore other segments if needed. */
103+ COPY_SEG_CPL3(cs);
104+#endif /* CONFIG_X86_32 */
98105
99106 get_user_ex(tmpflags, &sc->flags);
100107 regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS);
@@ -154,9 +161,8 @@ int setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate, · 53 unmodified lines
154161 #else /* !CONFIG_X86_32 */
155162 put_user_ex(regs->flags, &sc->flags);
156163 put_user_ex(regs->cs, &sc->cs);
157− put_user_ex(0, &sc->__pad2);
158− put_user_ex(0, &sc->__pad1);
159− put_user_ex(regs->ss, &sc->ss);
164+ put_user_ex(0, &sc->gs);
165+ put_user_ex(0, &sc->fs);
160166 #endif /* CONFIG_X86_32 */
161167
162168 put_user_ex(fpstate, &sc->fpstate);
@@ -451,19 +457,9 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig, · 288 unmodified lines
451457
452458 regs->sp = (unsigned long)frame;
453459
454− /*
455− * Set up the CS and SS registers to run signal handlers in
456− * 64-bit mode, even if the handler happens to be interrupting
457− * 32-bit or 16-bit code.
458− *
459− * SS is subtle. In 64-bit mode, we don't need any particular
460− * SS descriptor, but we do need SS to be valid. It's possible
461− * that the old SS is entirely bogus -- this can happen if the
462− * signal we're trying to deliver is #GP or #SS caused by a bad
463− * SS value.
464− */
460+ /* Set up the CS register to run signal handlers in 64-bit mode,
461+ even if the handler happens to be interrupting 32-bit code. */
465462 regs->cs = __USER_CS;
466− regs->ss = __USER_DS;
467463
468464 return 0;
469465 }
arch/x86/kernel/step.c+4−2
@@ -5,6 +5,7 @@ · 4 unmodified lines
55 #include <linux/mm.h>
66 #include <linux/ptrace.h>
77 #include <asm/desc.h>
8+#include <asm/mmu_context.h>
89
910 unsigned long convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs)
1011 {
@@ -30,10 +31,11 @@ unsigned long convert_ip_to_linear(struct task_struct *child, struct pt_regs *re · 19 unmodified lines
3031 seg &= ~7UL;
3132
3233 mutex_lock(&child->mm->context.lock);
33− if (unlikely((seg >> 3) >= child->mm->context.size))
34+ if (unlikely(!child->mm->context.ldt ||
35+ (seg >> 3) >= child->mm->context.ldt->size))
3436 addr = -1L; /* bogus selector, access would fault */
3537 else {
36− desc = child->mm->context.ldt + seg;
38+ desc = &child->mm->context.ldt->entries[seg];
3739 base = get_desc_base(desc);
3840
3941 /* 16-bit code segment? */
arch/x86/kvm/mtrr.c+4−4
@@ -672,16 +672,16 @@ u8 kvm_mtrr_get_guest_memory_type(struct kvm_vcpu *vcpu, gfn_t gfn) · 671 unmodified lines
672672 if (iter.mtrr_disabled)
673673 return mtrr_disabled_type();
674674
675+ /* not contained in any MTRRs. */
676+ if (type == -1)
677+ return mtrr_default_type(mtrr_state);
678+
675679 /*
676680 * We just check one page, partially covered by MTRRs is
677681 * impossible.
678682 */
679683 WARN_ON(iter.partial_map);
680684
681− /* not contained in any MTRRs. */
682− if (type == -1)
683− return mtrr_default_type(mtrr_state);
684−
685685 return type;
686686 }
687687 EXPORT_SYMBOL_GPL(kvm_mtrr_get_guest_memory_type);
arch/x86/platform/efi/efi.c+5−0
@@ -972,6 +972,11 @@ u64 efi_mem_attributes(unsigned long phys_addr) · 971 unmodified lines
972972
973973 static int __init arch_parse_efi_cmdline(char *str)
974974 {
975+ if (!str) {
976+ pr_warn("need at least one option\n");
977+ return -EINVAL;
978+ }
979+
975980 if (parse_option_str(str, "old_map"))
976981 set_bit(EFI_OLD_MEMMAP, &efi.flags);
977982 if (parse_option_str(str, "debug"))
arch/x86/power/cpu.c+2−1
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 #include <asm/fpu/internal.h>
2323 #include <asm/debugreg.h>
2424 #include <asm/cpu.h>
25+#include <asm/mmu_context.h>
2526
2627 #ifdef CONFIG_X86_32
2728 __visible unsigned long saved_context_ebx;
@@ -153,7 +154,7 @@ static void fix_processor_context(void) · 125 unmodified lines
153154 syscall_init(); /* This sets MSR_*STAR and related */
154155 #endif
155156 load_TR_desc(); /* This does ltr */
156− load_LDT(&current->active_mm->context); /* This does lldt */
157+ load_mm_ldt(current->active_mm); /* This does lldt */
157158
158159 fpu__resume_cpu();
159160 }
arch/x86/xen/Makefile+2−2
@@ -13,13 +13,13 @@ CFLAGS_mmu.o := $(nostackp) · 12 unmodified lines
1313 obj-y := enlighten.o setup.o multicalls.o mmu.o irq.o \
1414 time.o xen-asm.o xen-asm_$(BITS).o \
1515 grant-table.o suspend.o platform-pci-unplug.o \
16− p2m.o
16+ p2m.o apic.o
1717
1818 obj-$(CONFIG_EVENT_TRACING) += trace.o
1919
2020 obj-$(CONFIG_SMP) += smp.o
2121 obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o
2222 obj-$(CONFIG_XEN_DEBUG_FS) += debugfs.o
23−obj-$(CONFIG_XEN_DOM0) += apic.o vga.o
23+obj-$(CONFIG_XEN_DOM0) += vga.o
2424 obj-$(CONFIG_SWIOTLB_XEN) += pci-swiotlb-xen.o
2525 obj-$(CONFIG_XEN_EFI) += efi.o
arch/x86/xen/enlighten.c+40−0
@@ -483,6 +483,7 @@ static void set_aliased_prot(void *v, pgprot_t prot) · 482 unmodified lines
483483 pte_t pte;
484484 unsigned long pfn;
485485 struct page *page;
486+ unsigned char dummy;
486487
487488 ptep = lookup_address((unsigned long)v, &level);
488489 BUG_ON(ptep == NULL);
@@ -492,6 +493,32 @@ static void set_aliased_prot(void *v, pgprot_t prot) · 3 unmodified lines
492493
493494 pte = pfn_pte(pfn, prot);
494495
496+ /*
497+ * Careful: update_va_mapping() will fail if the virtual address
498+ * we're poking isn't populated in the page tables. We don't
499+ * need to worry about the direct map (that's always in the page
500+ * tables), but we need to be careful about vmap space. In
501+ * particular, the top level page table can lazily propagate
502+ * entries between processes, so if we've switched mms since we
503+ * vmapped the target in the first place, we might not have the
504+ * top-level page table entry populated.
505+ *
506+ * We disable preemption because we want the same mm active when
507+ * we probe the target and when we issue the hypercall. We'll
508+ * have the same nominal mm, but if we're a kernel thread, lazy
509+ * mm dropping could change our pgd.
510+ *
511+ * Out of an abundance of caution, this uses __get_user() to fault
512+ * in the target address just in case there's some obscure case
513+ * in which the target address isn't readable.
514+ */
515+
516+ preempt_disable();
517+
518+ pagefault_disable(); /* Avoid warnings due to being atomic. */
519+ __get_user(dummy, (unsigned char __user __force *)v);
520+ pagefault_enable();
521+
495522 if (HYPERVISOR_update_va_mapping((unsigned long)v, pte, 0))
496523 BUG();
497524
@@ -503,6 +530,8 @@ static void set_aliased_prot(void *v, pgprot_t prot) · 5 unmodified lines
503530 BUG();
504531 } else
505532 kmap_flush_unused();
533+
534+ preempt_enable();
506535 }
507536
508537 static void xen_alloc_ldt(struct desc_struct *ldt, unsigned entries)
@@ -510,6 +539,17 @@ static void xen_alloc_ldt(struct desc_struct *ldt, unsigned entries) · 1 unmodified line
510539 const unsigned entries_per_page = PAGE_SIZE / LDT_ENTRY_SIZE;
511540 int i;
512541
542+ /*
543+ * We need to mark the all aliases of the LDT pages RO. We
544+ * don't need to call vm_flush_aliases(), though, since that's
545+ * only responsible for flushing aliases out the TLBs, not the
546+ * page tables, and Xen will flush the TLB for us if needed.
547+ *
548+ * To avoid confusing future readers: none of this is necessary
549+ * to load the LDT. The hypervisor only checks this when the
550+ * LDT is faulted in due to subsequent descriptor access.
551+ */
552+
513553 for(i = 0; i < entries; i += entries_per_page)
514554 set_aliased_prot(ldt + i, PAGE_KERNEL_RO);
515555 }
arch/x86/xen/xen-ops.h+2−4
@@ -101,17 +101,15 @@ struct dom0_vga_console_info; · 100 unmodified lines
101101
102102 #ifdef CONFIG_XEN_DOM0
103103 void __init xen_init_vga(const struct dom0_vga_console_info *, size_t size);
104−void __init xen_init_apic(void);
105104 #else
106105 static inline void __init xen_init_vga(const struct dom0_vga_console_info *info,
107106 size_t size)
108107 {
109108 }
110−static inline void __init xen_init_apic(void)
111−{
112−}
113109 #endif
114110
111+void __init xen_init_apic(void);
112+
115113 #ifdef CONFIG_XEN_EFI
116114 extern void xen_efi_init(void);
117115 #else
drivers/base/regmap/regcache-rbtree.c+14−5
@@ -296,11 +296,20 @@ static int regcache_rbtree_insert_to_block(struct regmap *map, · 295 unmodified lines
296296 if (!blk)
297297 return -ENOMEM;
298298
299− present = krealloc(rbnode->cache_present,
300− BITS_TO_LONGS(blklen) * sizeof(*present), GFP_KERNEL);
301− if (!present) {
302− kfree(blk);
303− return -ENOMEM;
299+ if (BITS_TO_LONGS(blklen) > BITS_TO_LONGS(rbnode->blklen)) {
300+ present = krealloc(rbnode->cache_present,
301+ BITS_TO_LONGS(blklen) * sizeof(*present),
302+ GFP_KERNEL);
303+ if (!present) {
304+ kfree(blk);
305+ return -ENOMEM;
306+ }
307+
308+ memset(present + BITS_TO_LONGS(rbnode->blklen), 0,
309+ (BITS_TO_LONGS(blklen) - BITS_TO_LONGS(rbnode->blklen))
310+ * sizeof(*present));
311+ } else {
312+ present = rbnode->cache_present;
304313 }
305314
306315 /* insert the register value in the correct place in the rbnode block */
drivers/block/rbd.c+17−5
@@ -523,6 +523,7 @@ void rbd_warn(struct rbd_device *rbd_dev, const char *fmt, ...) · 522 unmodified lines
523523 # define rbd_assert(expr) ((void) 0)
524524 #endif /* !RBD_DEBUG */
525525
526+static void rbd_osd_copyup_callback(struct rbd_obj_request *obj_request);
526527 static int rbd_img_obj_request_submit(struct rbd_obj_request *obj_request);
527528 static void rbd_img_parent_read(struct rbd_obj_request *obj_request);
528529 static void rbd_dev_remove_parent(struct rbd_device *rbd_dev);
@@ -1818,6 +1819,16 @@ static void rbd_osd_stat_callback(struct rbd_obj_request *obj_request) · 1289 unmodified lines
18181819 obj_request_done_set(obj_request);
18191820 }
18201821
1822+static void rbd_osd_call_callback(struct rbd_obj_request *obj_request)
1823+{
1824+ dout("%s: obj %p\n", __func__, obj_request);
1825+
1826+ if (obj_request_img_data_test(obj_request))
1827+ rbd_osd_copyup_callback(obj_request);
1828+ else
1829+ obj_request_done_set(obj_request);
1830+}
1831+
18211832 static void rbd_osd_req_callback(struct ceph_osd_request *osd_req,
18221833 struct ceph_msg *msg)
18231834 {
@@ -1866,6 +1877,8 @@ static void rbd_osd_req_callback(struct ceph_osd_request *osd_req, · 42 unmodified lines
18661877 rbd_osd_discard_callback(obj_request);
18671878 break;
18681879 case CEPH_OSD_OP_CALL:
1880+ rbd_osd_call_callback(obj_request);
1881+ break;
18691882 case CEPH_OSD_OP_NOTIFY_ACK:
18701883 case CEPH_OSD_OP_WATCH:
18711884 rbd_osd_trivial_callback(obj_request);
@@ -2530,13 +2543,15 @@ out_unwind: · 658 unmodified lines
25302543 }
25312544
25322545 static void
2533−rbd_img_obj_copyup_callback(struct rbd_obj_request *obj_request)
2546+rbd_osd_copyup_callback(struct rbd_obj_request *obj_request)
25342547 {
25352548 struct rbd_img_request *img_request;
25362549 struct rbd_device *rbd_dev;
25372550 struct page **pages;
25382551 u32 page_count;
25392552
2553+ dout("%s: obj %p\n", __func__, obj_request);
2554+
25402555 rbd_assert(obj_request->type == OBJ_REQUEST_BIO ||
25412556 obj_request->type == OBJ_REQUEST_NODATA);
25422557 rbd_assert(obj_request_img_data_test(obj_request));
@@ -2563,9 +2578,7 @@ rbd_img_obj_copyup_callback(struct rbd_obj_request *obj_request) · 20 unmodified lines
25632578 if (!obj_request->result)
25642579 obj_request->xferred = obj_request->length;
25652580
2566− /* Finish up with the normal image object callback */
2567−
2568− rbd_img_obj_callback(obj_request);
2581+ obj_request_done_set(obj_request);
25692582 }
25702583
25712584 static void
@@ -2650,7 +2663,6 @@ rbd_img_obj_parent_read_full_callback(struct rbd_img_request *img_request) · 78 unmodified lines
26502663
26512664 /* All set, send it off. */
26522665
2653− orig_request->callback = rbd_img_obj_copyup_callback;
26542666 osdc = &rbd_dev->rbd_client->client->osdc;
26552667 img_result = rbd_obj_request_submit(osdc, orig_request);
26562668 if (!img_result)
drivers/block/xen-blkback/blkback.c+2−2
@@ -369,8 +369,8 @@ static void purge_persistent_gnt(struct xen_blkif *blkif) · 368 unmodified lines
369369 return;
370370 }
371371
372− if (work_pending(&blkif->persistent_purge_work)) {
373− pr_alert_ratelimited("Scheduled work from previous purge is still pending, cannot purge list\n");
372+ if (work_busy(&blkif->persistent_purge_work)) {
373+ pr_alert_ratelimited("Scheduled work from previous purge is still busy, cannot purge list\n");
374374 return;
375375 }
376376
drivers/block/xen-blkfront.c+72−56
@@ -179,6 +179,7 @@ static DEFINE_SPINLOCK(minor_lock); · 178 unmodified lines
179179 ((_segs + SEGS_PER_INDIRECT_FRAME - 1)/SEGS_PER_INDIRECT_FRAME)
180180
181181 static int blkfront_setup_indirect(struct blkfront_info *info);
182+static int blkfront_gather_backend_features(struct blkfront_info *info);
182183
183184 static int get_id_from_freelist(struct blkfront_info *info)
184185 {
@@ -1128,8 +1129,10 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, · 943 unmodified lines
11281129 * Add the used indirect page back to the list of
11291130 * available pages for indirect grefs.
11301131 */
1131− indirect_page = pfn_to_page(s->indirect_grants[i]->pfn);
1132− list_add(&indirect_page->lru, &info->indirect_pages);
1132+ if (!info->feature_persistent) {
1133+ indirect_page = pfn_to_page(s->indirect_grants[i]->pfn);
1134+ list_add(&indirect_page->lru, &info->indirect_pages);
1135+ }
11331136 s->indirect_grants[i]->gref = GRANT_INVALID_REF;
11341137 list_add_tail(&s->indirect_grants[i]->node, &info->grants);
11351138 }
@@ -1519,7 +1522,7 @@ static int blkif_recover(struct blkfront_info *info) · 383 unmodified lines
15191522 info->shadow_free = info->ring.req_prod_pvt;
15201523 info->shadow[BLK_RING_SIZE(info)-1].req.u.rw.id = 0x0fffffff;
15211524
1522− rc = blkfront_setup_indirect(info);
1525+ rc = blkfront_gather_backend_features(info);
15231526 if (rc) {
15241527 kfree(copy);
15251528 return rc;
@@ -1720,20 +1723,13 @@ static void blkfront_setup_discard(struct blkfront_info *info) · 194 unmodified lines
17201723
17211724 static int blkfront_setup_indirect(struct blkfront_info *info)
17221725 {
1723− unsigned int indirect_segments, segs;
1726+ unsigned int segs;
17241727 int err, i;
17251728
1726− err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
1727− "feature-max-indirect-segments", "%u", &indirect_segments,
1728− NULL);
1729− if (err) {
1730− info->max_indirect_segments = 0;
1729+ if (info->max_indirect_segments == 0)
17311730 segs = BLKIF_MAX_SEGMENTS_PER_REQUEST;
1732− } else {
1733− info->max_indirect_segments = min(indirect_segments,
1734− xen_blkif_max_segments);
1731+ else
17351732 segs = info->max_indirect_segments;
1736− }
17371733
17381734 err = fill_grant_buffer(info, (segs + INDIRECT_GREFS(segs)) * BLK_RING_SIZE(info));
17391735 if (err)
@@ -1796,6 +1792,68 @@ out_of_memory: · 56 unmodified lines
17961792 return -ENOMEM;
17971793 }
17981794
1795+/*
1796+ * Gather all backend feature-*
1797+ */
1798+static int blkfront_gather_backend_features(struct blkfront_info *info)
1799+{
1800+ int err;
1801+ int barrier, flush, discard, persistent;
1802+ unsigned int indirect_segments;
1803+
1804+ info->feature_flush = 0;
1805+
1806+ err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
1807+ "feature-barrier", "%d", &barrier,
1808+ NULL);
1809+
1810+ /*
1811+ * If there's no "feature-barrier" defined, then it means
1812+ * we're dealing with a very old backend which writes
1813+ * synchronously; nothing to do.
1814+ *
1815+ * If there are barriers, then we use flush.
1816+ */
1817+ if (!err && barrier)
1818+ info->feature_flush = REQ_FLUSH | REQ_FUA;
1819+ /*
1820+ * And if there is "feature-flush-cache" use that above
1821+ * barriers.
1822+ */
1823+ err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
1824+ "feature-flush-cache", "%d", &flush,
1825+ NULL);
1826+
1827+ if (!err && flush)
1828+ info->feature_flush = REQ_FLUSH;
1829+
1830+ err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
1831+ "feature-discard", "%d", &discard,
1832+ NULL);
1833+
1834+ if (!err && discard)
1835+ blkfront_setup_discard(info);
1836+
1837+ err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
1838+ "feature-persistent", "%u", &persistent,
1839+ NULL);
1840+ if (err)
1841+ info->feature_persistent = 0;
1842+ else
1843+ info->feature_persistent = persistent;
1844+
1845+ err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
1846+ "feature-max-indirect-segments", "%u", &indirect_segments,
1847+ NULL);
1848+ if (err)
1849+ info->max_indirect_segments = 0;
1850+ else
1851+ info->max_indirect_segments = min(indirect_segments,
1852+ xen_blkif_max_segments);
1853+
1854+ return blkfront_setup_indirect(info);
1855+}
1856+
17991857 /*
18001858 * Invoked when the backend is finally 'ready' (and has told produced
18011859 * the details about the physical device - #sectors, size, etc).
@@ -1807,7 +1865,6 @@ static void blkfront_connect(struct blkfront_info *info) · 5 unmodified lines
18071865 unsigned int physical_sector_size;
18081866 unsigned int binfo;
18091867 int err;
1810− int barrier, flush, discard, persistent;
18111868
18121869 switch (info->connected) {
18131870 case BLKIF_STATE_CONNECTED:
@@ -1864,48 +1921,7 @@ static void blkfront_connect(struct blkfront_info *info) · 50 unmodified lines
18641921 if (err != 1)
18651922 physical_sector_size = sector_size;
18661923
1867− info->feature_flush = 0;
1868−
1869− err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
1870− "feature-barrier", "%d", &barrier,
1871− NULL);
1872−
1873− /*
1874− * If there's no "feature-barrier" defined, then it means
1875− * we're dealing with a very old backend which writes
1876− * synchronously; nothing to do.
1877− *
1878− * If there are barriers, then we use flush.
1879− */
1880− if (!err && barrier)
1881− info->feature_flush = REQ_FLUSH | REQ_FUA;
1882− /*
1883− * And if there is "feature-flush-cache" use that above
1884− * barriers.
1885− */
1886− err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
1887− "feature-flush-cache", "%d", &flush,
1888− NULL);
1889−
1890− if (!err && flush)
1891− info->feature_flush = REQ_FLUSH;
1892−
1893− err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
1894− "feature-discard", "%d", &discard,
1895− NULL);
1896−
1897− if (!err && discard)
1898− blkfront_setup_discard(info);
1899−
1900− err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
1901− "feature-persistent", "%u", &persistent,
1902− NULL);
1903− if (err)
1904− info->feature_persistent = 0;
1905− else
1906− info->feature_persistent = persistent;
1907−
1908− err = blkfront_setup_indirect(info);
1924+ err = blkfront_gather_backend_features(info);
19091925 if (err) {
19101926 xenbus_dev_fatal(info->xbdev, err, "setup_indirect at %s",
19111927 info->xbdev->otherend);
drivers/char/hw_random/core.c+1−1
@@ -429,7 +429,7 @@ static int hwrng_fillfn(void *unused) · 428 unmodified lines
429429 static void start_khwrngd(void)
430430 {
431431 hwrng_fill = kthread_run(hwrng_fillfn, NULL, "hwrng");
432− if (hwrng_fill == ERR_PTR(-ENOMEM)) {
432+ if (IS_ERR(hwrng_fill)) {
433433 pr_err("hwrng_fill thread creation failed");
434434 hwrng_fill = NULL;
435435 }
drivers/cpufreq/loongson2_cpufreq.c+1−1
@@ -20,7 +20,7 @@ · 19 unmodified lines
2020 #include <asm/clock.h>
2121 #include <asm/idle.h>
2222
23−#include <asm/mach-loongson/loongson.h>
23+#include <asm/mach-loongson64/loongson.h>
2424
2525 static uint nowait;
2626
drivers/crypto/ixp4xx_crypto.c+0−1
@@ -905,7 +905,6 @@ static int ablk_perform(struct ablkcipher_request *req, int encrypt) · 904 unmodified lines
905905 crypt->mode |= NPE_OP_NOT_IN_PLACE;
906906 /* This was never tested by Intel
907907 * for more than one dst buffer, I think. */
908− BUG_ON(req->dst->length < nbytes);
909908 req_ctx->dst = NULL;
910909 if (!chainup_buffers(dev, req->dst, nbytes, &dst_hook,
911910 flags, DMA_FROM_DEVICE))
drivers/crypto/qat/qat_common/qat_algs.c+16−8
@@ -73,7 +73,8 @@ · 72 unmodified lines
7373 ICP_QAT_HW_CIPHER_KEY_CONVERT, \
7474 ICP_QAT_HW_CIPHER_DECRYPT)
7575
76−static atomic_t active_dev;
76+static DEFINE_MUTEX(algs_lock);
77+static unsigned int active_devs;
7778
7879 struct qat_alg_buf {
7980 uint32_t len;
@@ -1280,7 +1281,10 @@ static struct crypto_alg qat_algs[] = { { · 1200 unmodified lines
12801281
12811282 int qat_algs_register(void)
12821283 {
1283− if (atomic_add_return(1, &active_dev) == 1) {
1284+ int ret = 0;
1285+
1286+ mutex_lock(&algs_lock);
1287+ if (++active_devs == 1) {
12841288 int i;
12851289
12861290 for (i = 0; i < ARRAY_SIZE(qat_algs); i++)
@@ -1289,21 +1293,25 @@ int qat_algs_register(void) · 2 unmodified lines
12891293 CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC :
12901294 CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC;
12911295
1292− return crypto_register_algs(qat_algs, ARRAY_SIZE(qat_algs));
1296+ ret = crypto_register_algs(qat_algs, ARRAY_SIZE(qat_algs));
12931297 }
1294− return 0;
1298+ mutex_unlock(&algs_lock);
1299+ return ret;
12951300 }
12961301
12971302 int qat_algs_unregister(void)
12981303 {
1299− if (atomic_sub_return(1, &active_dev) == 0)
1300− return crypto_unregister_algs(qat_algs, ARRAY_SIZE(qat_algs));
1301− return 0;
1304+ int ret = 0;
1305+
1306+ mutex_lock(&algs_lock);
1307+ if (--active_devs == 0)
1308+ ret = crypto_unregister_algs(qat_algs, ARRAY_SIZE(qat_algs));
1309+ mutex_unlock(&algs_lock);
1310+ return ret;
13021311 }
13031312
13041313 int qat_algs_init(void)
13051314 {
1306− atomic_set(&active_dev, 0);
13071315 crypto_get_default_rng();
13081316 return 0;
13091317 }
drivers/dma/at_hdmac.c+87−45
@@ -48,6 +48,8 @@ · 47 unmodified lines
4848 BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) |\
4949 BIT(DMA_SLAVE_BUSWIDTH_4_BYTES))
5050
51+#define ATC_MAX_DSCR_TRIALS 10
52+
5153 /*
5254 * Initial number of descriptors to allocate for each channel. This could
5355 * be increased during dma usage.
@@ -285,28 +287,19 @@ static struct at_desc *atc_get_desc_by_cookie(struct at_dma_chan *atchan, · 231 unmodified lines
285287 *
286288 * @current_len: the number of bytes left before reading CTRLA
287289 * @ctrla: the value of CTRLA
288− * @desc: the descriptor containing the transfer width
289290 */
290−static inline int atc_calc_bytes_left(int current_len, u32 ctrla,
291− struct at_desc *desc)
291+static inline int atc_calc_bytes_left(int current_len, u32 ctrla)
292292 {
293− return current_len - ((ctrla & ATC_BTSIZE_MAX) << desc->tx_width);
294−}
293+ u32 btsize = (ctrla & ATC_BTSIZE_MAX);
294+ u32 src_width = ATC_REG_TO_SRC_WIDTH(ctrla);
295295
296−/**
297− * atc_calc_bytes_left_from_reg - calculates the number of bytes left according
298− * to the current value of CTRLA.
299− *
300− * @current_len: the number of bytes left before reading CTRLA
301− * @atchan: the channel to read CTRLA for
302− * @desc: the descriptor containing the transfer width
303− */
304−static inline int atc_calc_bytes_left_from_reg(int current_len,
305− struct at_dma_chan *atchan, struct at_desc *desc)
306−{
307− u32 ctrla = channel_readl(atchan, CTRLA);
308−
309− return atc_calc_bytes_left(current_len, ctrla, desc);
296+ /*
297+ * According to the datasheet, when reading the Control A Register
298+ * (ctrla), the Buffer Transfer Size (btsize) bitfield refers to the
299+ * number of transfers completed on the Source Interface.
300+ * So btsize is always a number of source width transfers.
301+ */
302+ return current_len - (btsize << src_width);
310303 }
311304
312305 /**
@@ -320,7 +313,7 @@ static int atc_get_bytes_left(struct dma_chan *chan, dma_cookie_t cookie) · 7 unmodified lines
320313 struct at_desc *desc_first = atc_first_active(atchan);
321314 struct at_desc *desc;
322315 int ret;
323− u32 ctrla, dscr;
316+ u32 ctrla, dscr, trials;
324317
325318 /*
326319 * If the cookie doesn't match to the currently running transfer then
@@ -346,15 +339,82 @@ static int atc_get_bytes_left(struct dma_chan *chan, dma_cookie_t cookie) · 19 unmodified lines
346339 * the channel's DSCR register and compare it against the value
347340 * of the hardware linked list structure of each child
348341 * descriptor.
342+ *
343+ * The CTRLA register provides us with the amount of data
344+ * already read from the source for the current child
345+ * descriptor. So we can compute a more accurate residue by also
346+ * removing the number of bytes corresponding to this amount of
347+ * data.
348+ *
349+ * However, the DSCR and CTRLA registers cannot be read both
350+ * atomically. Hence a race condition may occur: the first read
351+ * register may refer to one child descriptor whereas the second
352+ * read may refer to a later child descriptor in the list
353+ * because of the DMA transfer progression inbetween the two
354+ * reads.
355+ *
356+ * One solution could have been to pause the DMA transfer, read
357+ * the DSCR and CTRLA then resume the DMA transfer. Nonetheless,
358+ * this approach presents some drawbacks:
359+ * - If the DMA transfer is paused, RX overruns or TX underruns
360+ * are more likey to occur depending on the system latency.
361+ * Taking the USART driver as an example, it uses a cyclic DMA
362+ * transfer to read data from the Receive Holding Register
363+ * (RHR) to avoid RX overruns since the RHR is not protected
364+ * by any FIFO on most Atmel SoCs. So pausing the DMA transfer
365+ * to compute the residue would break the USART driver design.
366+ * - The atc_pause() function masks interrupts but we'd rather
367+ * avoid to do so for system latency purpose.
368+ *
369+ * Then we'd rather use another solution: the DSCR is read a
370+ * first time, the CTRLA is read in turn, next the DSCR is read
371+ * a second time. If the two consecutive read values of the DSCR
372+ * are the same then we assume both refers to the very same
373+ * child descriptor as well as the CTRLA value read inbetween
374+ * does. For cyclic tranfers, the assumption is that a full loop
375+ * is "not so fast".
376+ * If the two DSCR values are different, we read again the CTRLA
377+ * then the DSCR till two consecutive read values from DSCR are
378+ * equal or till the maxium trials is reach.
379+ * This algorithm is very unlikely not to find a stable value for
380+ * DSCR.
349381 */
350382
351− ctrla = channel_readl(atchan, CTRLA);
352− rmb(); /* ensure CTRLA is read before DSCR */
353383 dscr = channel_readl(atchan, DSCR);
384+ rmb(); /* ensure DSCR is read before CTRLA */
385+ ctrla = channel_readl(atchan, CTRLA);
386+ for (trials = 0; trials < ATC_MAX_DSCR_TRIALS; ++trials) {
387+ u32 new_dscr;
388+
389+ rmb(); /* ensure DSCR is read after CTRLA */
390+ new_dscr = channel_readl(atchan, DSCR);
391+
392+ /*
393+ * If the DSCR register value has not changed inside the
394+ * DMA controller since the previous read, we assume
395+ * that both the dscr and ctrla values refers to the
396+ * very same descriptor.
397+ */
398+ if (likely(new_dscr == dscr))
399+ break;
400+
401+ /*
402+ * DSCR has changed inside the DMA controller, so the
403+ * previouly read value of CTRLA may refer to an already
404+ * processed descriptor hence could be outdated.
405+ * We need to update ctrla to match the current
406+ * descriptor.
407+ */
408+ dscr = new_dscr;
409+ rmb(); /* ensure DSCR is read before CTRLA */
410+ ctrla = channel_readl(atchan, CTRLA);
411+ }
412+ if (unlikely(trials >= ATC_MAX_DSCR_TRIALS))
413+ return -ETIMEDOUT;
354414
355415 /* for the first descriptor we can be more accurate */
356416 if (desc_first->lli.dscr == dscr)
357− return atc_calc_bytes_left(ret, ctrla, desc_first);
417+ return atc_calc_bytes_left(ret, ctrla);
358418
359419 ret -= desc_first->len;
360420 list_for_each_entry(desc, &desc_first->tx_list, desc_node) {
@@ -365,16 +425,14 @@ static int atc_get_bytes_left(struct dma_chan *chan, dma_cookie_t cookie) · 4 unmodified lines
365425 }
366426
367427 /*
368− * For the last descriptor in the chain we can calculate
428+ * For the current descriptor in the chain we can calculate
369429 * the remaining bytes using the channel's register.
370− * Note that the transfer width of the first and last
371− * descriptor may differ.
372430 */
373− if (!desc->lli.dscr)
374− ret = atc_calc_bytes_left_from_reg(ret, atchan, desc);
431+ ret = atc_calc_bytes_left(ret, ctrla);
375432 } else {
376433 /* single transfer */
377− ret = atc_calc_bytes_left_from_reg(ret, atchan, desc_first);
434+ ctrla = channel_readl(atchan, CTRLA);
435+ ret = atc_calc_bytes_left(ret, ctrla);
378436 }
379437
380438 return ret;
@@ -726,7 +784,6 @@ atc_prep_dma_interleaved(struct dma_chan *chan, · 345 unmodified lines
726784
727785 desc->txd.cookie = -EBUSY;
728786 desc->total_len = desc->len = len;
729− desc->tx_width = dwidth;
730787
731788 /* set end-of-link to the last link descriptor of list*/
732789 set_desc_eol(desc);
@@ -804,10 +861,6 @@ atc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src, · 71 unmodified lines
804861 first->txd.cookie = -EBUSY;
805862 first->total_len = len;
806863
807− /* set transfer width for the calculation of the residue */
808− first->tx_width = src_width;
809− prev->tx_width = src_width;
810−
811864 /* set end-of-link to the last link descriptor of list*/
812865 set_desc_eol(desc);
813866
@@ -956,10 +1009,6 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, · 142 unmodified lines
9561009 first->txd.cookie = -EBUSY;
9571010 first->total_len = total_len;
9581011
959− /* set transfer width for the calculation of the residue */
960− first->tx_width = reg_width;
961− prev->tx_width = reg_width;
962−
9631012 /* first link descriptor of list is responsible of flags */
9641013 first->txd.flags = flags; /* client is in control of this ack */
9651014
@@ -1077,12 +1126,6 @@ atc_prep_dma_sg(struct dma_chan *chan, · 111 unmodified lines
10771126 desc->txd.cookie = 0;
10781127 desc->len = len;
10791128
1080− /*
1081− * Although we only need the transfer width for the first and
1082− * the last descriptor, its easier to set it to all descriptors.
1083− */
1084− desc->tx_width = src_width;
1085−
10861129 atc_desc_chain(&first, &prev, desc);
10871130
10881131 /* update the lengths and addresses for the next loop cycle */
@@ -1256,7 +1299,6 @@ atc_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len, · 167 unmodified lines
12561299 /* First descriptor of the chain embedds additional information */
12571300 first->txd.cookie = -EBUSY;
12581301 first->total_len = buf_len;
1259− first->tx_width = reg_width;
12601302
12611303 return &first->txd;
12621304
drivers/dma/at_hdmac_regs.h+1−2
@@ -112,6 +112,7 @@ · 111 unmodified lines
112112 #define ATC_SRC_WIDTH_BYTE (0x0 << 24)
113113 #define ATC_SRC_WIDTH_HALFWORD (0x1 << 24)
114114 #define ATC_SRC_WIDTH_WORD (0x2 << 24)
115+#define ATC_REG_TO_SRC_WIDTH(r) (((r) >> 24) & 0x3)
115116 #define ATC_DST_WIDTH_MASK (0x3 << 28) /* Destination Single Transfer Size */
116117 #define ATC_DST_WIDTH(x) ((x) << 28)
117118 #define ATC_DST_WIDTH_BYTE (0x0 << 28)
@@ -182,7 +183,6 @@ struct at_lli { · 64 unmodified lines
182183 * @txd: support for the async_tx api
183184 * @desc_node: node on the channed descriptors list
184185 * @len: descriptor byte count
185− * @tx_width: transfer width
186186 * @total_len: total transaction byte count
187187 */
188188 struct at_desc {
@@ -194,7 +194,6 @@ struct at_desc { · 5 unmodified lines
194194 struct dma_async_tx_descriptor txd;
195195 struct list_head desc_node;
196196 size_t len;
197− u32 tx_width;
198197 size_t total_len;
199198
200199 /* Interleaved data */
drivers/dma/at_xdmac.c+14−12
@@ -359,18 +359,19 @@ static void at_xdmac_start_xfer(struct at_xdmac_chan *atchan, · 358 unmodified lines
359359 * descriptor view 2 since some fields of the configuration register
360360 * depend on transfer size and src/dest addresses.
361361 */
362− if (at_xdmac_chan_is_cyclic(atchan)) {
362+ if (at_xdmac_chan_is_cyclic(atchan))
363363 reg = AT_XDMAC_CNDC_NDVIEW_NDV1;
364− at_xdmac_chan_write(atchan, AT_XDMAC_CC, first->lld.mbr_cfg);
365− } else if (first->lld.mbr_ubc & AT_XDMAC_MBR_UBC_NDV3) {
364+ else if (first->lld.mbr_ubc & AT_XDMAC_MBR_UBC_NDV3)
366365 reg = AT_XDMAC_CNDC_NDVIEW_NDV3;
367− } else {
368− /*
369− * No need to write AT_XDMAC_CC reg, it will be done when the
370− * descriptor is fecthed.
371− */
366+ else
372367 reg = AT_XDMAC_CNDC_NDVIEW_NDV2;
373− }
368+ /*
369+ * Even if the register will be updated from the configuration in the
370+ * descriptor when using view 2 or higher, the PROT bit won't be set
371+ * properly. This bit can be modified only by using the channel
372+ * configuration register.
373+ */
374+ at_xdmac_chan_write(atchan, AT_XDMAC_CC, first->lld.mbr_cfg);
374375
375376 reg |= AT_XDMAC_CNDC_NDDUP
376377 | AT_XDMAC_CNDC_NDSUP
@@ -681,15 +682,16 @@ at_xdmac_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, · 304 unmodified lines
681682 desc->lld.mbr_sa = mem;
682683 desc->lld.mbr_da = atchan->sconfig.dst_addr;
683684 }
684− desc->lld.mbr_cfg = atchan->cfg;
685− dwidth = at_xdmac_get_dwidth(desc->lld.mbr_cfg);
685+ dwidth = at_xdmac_get_dwidth(atchan->cfg);
686686 fixed_dwidth = IS_ALIGNED(len, 1 << dwidth)
687− ? at_xdmac_get_dwidth(desc->lld.mbr_cfg)
687+ ? dwidth
688688 : AT_XDMAC_CC_DWIDTH_BYTE;
689689 desc->lld.mbr_ubc = AT_XDMAC_MBR_UBC_NDV2 /* next descriptor view */
690690 | AT_XDMAC_MBR_UBC_NDEN /* next descriptor dst parameter update */
691691 | AT_XDMAC_MBR_UBC_NSEN /* next descriptor src parameter update */
692692 | (len >> fixed_dwidth); /* microblock length */
693+ desc->lld.mbr_cfg = (atchan->cfg & ~AT_XDMAC_CC_DWIDTH_MASK) |
694+ AT_XDMAC_CC_DWIDTH(fixed_dwidth);
693695 dev_dbg(chan2dev(chan),
694696 "%s: lld: mbr_sa=%pad, mbr_da=%pad, mbr_ubc=0x%08x\n",
695697 __func__, &desc->lld.mbr_sa, &desc->lld.mbr_da, desc->lld.mbr_ubc);
drivers/dma/mv_xor.c+5−4
@@ -162,10 +162,11 @@ static void mv_chan_set_mode(struct mv_xor_chan *chan, · 161 unmodified lines
162162 config &= ~0x7;
163163 config |= op_mode;
164164
165− if (IS_ENABLED(__BIG_ENDIAN))
166− config |= XOR_DESCRIPTOR_SWAP;
167− else
168− config &= ~XOR_DESCRIPTOR_SWAP;
165+#if defined(__BIG_ENDIAN)
166+ config |= XOR_DESCRIPTOR_SWAP;
167+#else
168+ config &= ~XOR_DESCRIPTOR_SWAP;
169+#endif
169170
170171 writel_relaxed(config, XOR_CONFIG(chan));
171172 chan->current_type = type;
drivers/dma/pl330.c+2−1
@@ -2328,7 +2328,7 @@ static dma_cookie_t pl330_tx_submit(struct dma_async_tx_descriptor *tx) · 2327 unmodified lines
23282328 desc->txd.callback = last->txd.callback;
23292329 desc->txd.callback_param = last->txd.callback_param;
23302330 }
2331− last->last = false;
2331+ desc->last = false;
23322332
23332333 dma_cookie_assign(&desc->txd);
23342334
@@ -2623,6 +2623,7 @@ pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst, · 288 unmodified lines
26232623 desc->rqcfg.brst_len = 1;
26242624
26252625 desc->rqcfg.brst_len = get_burst_len(desc, len);
2626+ desc->bytes_requested = len;
26262627
26272628 desc->txd.flags = flags;
26282629
drivers/dma/virt-dma.c+6−13
@@ -29,7 +29,7 @@ dma_cookie_t vchan_tx_submit(struct dma_async_tx_descriptor *tx) · 28 unmodified lines
2929 spin_lock_irqsave(&vc->lock, flags);
3030 cookie = dma_cookie_assign(tx);
3131
32− list_move_tail(&vd->node, &vc->desc_submitted);
32+ list_add_tail(&vd->node, &vc->desc_submitted);
3333 spin_unlock_irqrestore(&vc->lock, flags);
3434
3535 dev_dbg(vc->chan.device->dev, "vchan %p: txd %p[%x]: submitted\n",
@@ -83,10 +83,8 @@ static void vchan_complete(unsigned long arg) · 47 unmodified lines
8383 cb_data = vd->tx.callback_param;
8484
8585 list_del(&vd->node);
86− if (async_tx_test_ack(&vd->tx))
87− list_add(&vd->node, &vc->desc_allocated);
88− else
89− vc->desc_free(vd);
86+
87+ vc->desc_free(vd);
9088
9189 if (cb)
9290 cb(cb_data);
@@ -98,13 +96,9 @@ void vchan_dma_desc_free_list(struct virt_dma_chan *vc, struct list_head *head) · 5 unmodified lines
9896 while (!list_empty(head)) {
9997 struct virt_dma_desc *vd = list_first_entry(head,
10098 struct virt_dma_desc, node);
101− if (async_tx_test_ack(&vd->tx)) {
102− list_move_tail(&vd->node, &vc->desc_allocated);
103− } else {
104− dev_dbg(vc->chan.device->dev, "txd %p: freeing\n", vd);
105− list_del(&vd->node);
106− vc->desc_free(vd);
107− }
99+ list_del(&vd->node);
100+ dev_dbg(vc->chan.device->dev, "txd %p: freeing\n", vd);
101+ vc->desc_free(vd);
108102 }
109103 }
110104 EXPORT_SYMBOL_GPL(vchan_dma_desc_free_list);
@@ -114,7 +108,6 @@ void vchan_init(struct virt_dma_chan *vc, struct dma_device *dmadev) · 3 unmodified lines
114108 dma_cookie_init(&vc->chan);
115109
116110 spin_lock_init(&vc->lock);
117− INIT_LIST_HEAD(&vc->desc_allocated);
118111 INIT_LIST_HEAD(&vc->desc_submitted);
119112 INIT_LIST_HEAD(&vc->desc_issued);
120113 INIT_LIST_HEAD(&vc->desc_completed);
drivers/dma/virt-dma.h+1−12
@@ -29,7 +29,6 @@ struct virt_dma_chan { · 28 unmodified lines
2929 spinlock_t lock;
3030
3131 /* protected by vc.lock */
32− struct list_head desc_allocated;
3332 struct list_head desc_submitted;
3433 struct list_head desc_issued;
3534 struct list_head desc_completed;
@@ -56,16 +55,11 @@ static inline struct dma_async_tx_descriptor *vchan_tx_prep(struct virt_dma_chan · 20 unmodified lines
5655 struct virt_dma_desc *vd, unsigned long tx_flags)
5756 {
5857 extern dma_cookie_t vchan_tx_submit(struct dma_async_tx_descriptor *);
59− unsigned long flags;
6058
6159 dma_async_tx_descriptor_init(&vd->tx, &vc->chan);
6260 vd->tx.flags = tx_flags;
6361 vd->tx.tx_submit = vchan_tx_submit;
6462
65− spin_lock_irqsave(&vc->lock, flags);
66− list_add_tail(&vd->node, &vc->desc_allocated);
67− spin_unlock_irqrestore(&vc->lock, flags);
68−
6963 return &vd->tx;
7064 }
7165
@@ -128,8 +122,7 @@ static inline struct virt_dma_desc *vchan_next_desc(struct virt_dma_chan *vc) · 56 unmodified lines
128122 }
129123
130124 /**
131− * vchan_get_all_descriptors - obtain all allocated, submitted and issued
132− * descriptors
125+ * vchan_get_all_descriptors - obtain all submitted and issued descriptors
133126 * vc: virtual channel to get descriptors from
134127 * head: list of descriptors found
135128 *
@@ -141,7 +134,6 @@ static inline struct virt_dma_desc *vchan_next_desc(struct virt_dma_chan *vc) · 5 unmodified lines
141134 static inline void vchan_get_all_descriptors(struct virt_dma_chan *vc,
142135 struct list_head *head)
143136 {
144− list_splice_tail_init(&vc->desc_allocated, head);
145137 list_splice_tail_init(&vc->desc_submitted, head);
146138 list_splice_tail_init(&vc->desc_issued, head);
147139 list_splice_tail_init(&vc->desc_completed, head);
@@ -149,14 +141,11 @@ static inline void vchan_get_all_descriptors(struct virt_dma_chan *vc, · 1 unmodified line
149141
150142 static inline void vchan_free_chan_resources(struct virt_dma_chan *vc)
151143 {
152− struct virt_dma_desc *vd;
153144 unsigned long flags;
154145 LIST_HEAD(head);
155146
156147 spin_lock_irqsave(&vc->lock, flags);
157148 vchan_get_all_descriptors(vc, &head);
158− list_for_each_entry(vd, &head, node)
159− async_tx_clear_ack(&vd->tx);
160149 spin_unlock_irqrestore(&vc->lock, flags);
161150
162151 vchan_dma_desc_free_list(vc, &head);
drivers/dma/xgene-dma.c+3−0
@@ -111,6 +111,7 @@ · 110 unmodified lines
111111 #define XGENE_DMA_MEM_RAM_SHUTDOWN 0xD070
112112 #define XGENE_DMA_BLK_MEM_RDY 0xD074
113113 #define XGENE_DMA_BLK_MEM_RDY_VAL 0xFFFFFFFF
114+#define XGENE_DMA_RING_CMD_SM_OFFSET 0x8000
114115
115116 /* X-Gene SoC EFUSE csr register and bit defination */
116117 #define XGENE_SOC_JTAG1_SHADOW 0x18
@@ -1887,6 +1888,8 @@ static int xgene_dma_get_resources(struct platform_device *pdev, · 1770 unmodified lines
18871888 return -ENOMEM;
18881889 }
18891890
1891+ pdma->csr_ring_cmd += XGENE_DMA_RING_CMD_SM_OFFSET;
1892+
18901893 /* Get efuse csr region */
18911894 res = platform_get_resource(pdev, IORESOURCE_MEM, 3);
18921895 if (!res) {
drivers/edac/ppc4xx_edac.c+1−1
@@ -920,7 +920,7 @@ static int ppc4xx_edac_init_csrows(struct mem_ctl_info *mci, u32 mcopt1) · 919 unmodified lines
920920 */
921921
922922 for (row = 0; row < mci->nr_csrows; row++) {
923− struct csrow_info *csi = &mci->csrows[row];
923+ struct csrow_info *csi = mci->csrows[row];
924924
925925 /*
926926 * Get the configuration settings for this
drivers/extcon/extcon-palmas.c+0−13
@@ -200,7 +200,6 @@ static int palmas_usb_probe(struct platform_device *pdev) · 199 unmodified lines
200200 status = devm_extcon_dev_register(&pdev->dev, palmas_usb->edev);
201201 if (status) {
202202 dev_err(&pdev->dev, "failed to register extcon device\n");
203− kfree(palmas_usb->edev->name);
204203 return status;
205204 }
206205
@@ -214,7 +213,6 @@ static int palmas_usb_probe(struct platform_device *pdev) · 7 unmodified lines
214213 if (status < 0) {
215214 dev_err(&pdev->dev, "can't get IRQ %d, err %d\n",
216215 palmas_usb->id_irq, status);
217− kfree(palmas_usb->edev->name);
218216 return status;
219217 }
220218 }
@@ -229,7 +227,6 @@ static int palmas_usb_probe(struct platform_device *pdev) · 8 unmodified lines
229227 if (status < 0) {
230228 dev_err(&pdev->dev, "can't get IRQ %d, err %d\n",
231229 palmas_usb->vbus_irq, status);
232− kfree(palmas_usb->edev->name);
233230 return status;
234231 }
235232 }
@@ -239,15 +236,6 @@ static int palmas_usb_probe(struct platform_device *pdev) · 3 unmodified lines
239236 return 0;
240237 }
241238
242−static int palmas_usb_remove(struct platform_device *pdev)
243−{
244− struct palmas_usb *palmas_usb = platform_get_drvdata(pdev);
245−
246− kfree(palmas_usb->edev->name);
247−
248− return 0;
249−}
250−
251239 #ifdef CONFIG_PM_SLEEP
252240 static int palmas_usb_suspend(struct device *dev)
253241 {
@@ -288,7 +276,6 @@ static const struct of_device_id of_palmas_match_tbl[] = { · 34 unmodified lines
288276
289277 static struct platform_driver palmas_usb_driver = {
290278 .probe = palmas_usb_probe,
291− .remove = palmas_usb_remove,
292279 .driver = {
293280 .name = "palmas-usb",
294281 .of_match_table = of_palmas_match_tbl,
drivers/extcon/extcon.c+44−17
@@ -124,25 +124,35 @@ static int find_cable_index_by_id(struct extcon_dev *edev, const unsigned int id · 123 unmodified lines
124124 return -EINVAL;
125125 }
126126
127−static int find_cable_index_by_name(struct extcon_dev *edev, const char *name)
127+static int find_cable_id_by_name(struct extcon_dev *edev, const char *name)
128128 {
129− unsigned int id = EXTCON_NONE;
129+ unsigned int id = -EINVAL;
130130 int i = 0;
131131
132− if (edev->max_supported == 0)
133− return -EINVAL;
134−
135− /* Find the the number of extcon cable */
132+ /* Find the id of extcon cable */
136133 while (extcon_name[i]) {
137134 if (!strncmp(extcon_name[i], name, CABLE_NAME_MAX)) {
138135 id = i;
139136 break;
140137 }
138+ i++;
141139 }
142140
143− if (id == EXTCON_NONE)
141+ return id;
142+}
143+
144+static int find_cable_index_by_name(struct extcon_dev *edev, const char *name)
145+{
146+ unsigned int id;
147+
148+ if (edev->max_supported == 0)
144149 return -EINVAL;
145150
151+ /* Find the the number of extcon cable */
152+ id = find_cable_id_by_name(edev, name);
153+ if (id < 0)
154+ return id;
155+
146156 return find_cable_index_by_id(edev, id);
147157 }
148158
@@ -228,9 +238,11 @@ static ssize_t cable_state_show(struct device *dev, · 79 unmodified lines
228238 struct extcon_cable *cable = container_of(attr, struct extcon_cable,
229239 attr_state);
230240
241+ int i = cable->cable_index;
242+
231243 return sprintf(buf, "%d\n",
232244 extcon_get_cable_state_(cable->edev,
233− cable->cable_index));
245+ cable->edev->supported_cable[i]));
234246 }
235247
236248 /**
@@ -263,20 +275,25 @@ int extcon_update_state(struct extcon_dev *edev, u32 mask, u32 state) · 26 unmodified lines
263275 spin_lock_irqsave(&edev->lock, flags);
264276
265277 if (edev->state != ((edev->state & ~mask) | (state & mask))) {
278+ u32 old_state;
279+
266280 if (check_mutually_exclusive(edev, (edev->state & ~mask) |
267281 (state & mask))) {
268282 spin_unlock_irqrestore(&edev->lock, flags);
269283 return -EPERM;
270284 }
271285
272− for (index = 0; index < edev->max_supported; index++) {
273− if (is_extcon_changed(edev->state, state, index, &attached))
274− raw_notifier_call_chain(&edev->nh[index], attached, edev);
275− }
276−
286+ old_state = edev->state;
277287 edev->state &= ~mask;
278288 edev->state |= state & mask;
279289
290+ for (index = 0; index < edev->max_supported; index++) {
291+ if (is_extcon_changed(old_state, edev->state, index,
292+ &attached))
293+ raw_notifier_call_chain(&edev->nh[index],
294+ attached, edev);
295+ }
296+
280297 /* This could be in interrupt handler */
281298 prop_buf = (char *)get_zeroed_page(GFP_ATOMIC);
282299 if (prop_buf) {
@@ -361,8 +378,13 @@ EXPORT_SYMBOL_GPL(extcon_get_cable_state_); · 78 unmodified lines
361378 */
362379 int extcon_get_cable_state(struct extcon_dev *edev, const char *cable_name)
363380 {
364− return extcon_get_cable_state_(edev, find_cable_index_by_name
365− (edev, cable_name));
381+ unsigned int id;
382+
383+ id = find_cable_id_by_name(edev, cable_name);
384+ if (id < 0)
385+ return id;
386+
387+ return extcon_get_cable_state_(edev, id);
366388 }
367389 EXPORT_SYMBOL_GPL(extcon_get_cable_state);
368390
@@ -404,8 +426,13 @@ EXPORT_SYMBOL_GPL(extcon_set_cable_state_); · 35 unmodified lines
404426 int extcon_set_cable_state(struct extcon_dev *edev,
405427 const char *cable_name, bool cable_state)
406428 {
407− return extcon_set_cable_state_(edev, find_cable_index_by_name
408− (edev, cable_name), cable_state);
429+ unsigned int id;
430+
431+ id = find_cable_id_by_name(edev, cable_name);
432+ if (id < 0)
433+ return id;
434+
435+ return extcon_set_cable_state_(edev, id, cable_state);
409436 }
410437 EXPORT_SYMBOL_GPL(extcon_set_cable_state);
411438
drivers/firmware/efi/efi.c+5−0
@@ -58,6 +58,11 @@ bool efi_runtime_disabled(void) · 57 unmodified lines
5858
5959 static int __init parse_efi_cmdline(char *str)
6060 {
61+ if (!str) {
62+ pr_warn("need at least one option\n");
63+ return -EINVAL;
64+ }
65+
6166 if (parse_option_str(str, "noruntime"))
6267 disable_runtime = true;
6368
drivers/gpu/drm/amd/amdgpu/amdgpu.h+4−0
@@ -1130,6 +1130,9 @@ struct amdgpu_gfx { · 1129 unmodified lines
11301130 uint32_t me_feature_version;
11311131 uint32_t ce_feature_version;
11321132 uint32_t pfp_feature_version;
1133+ uint32_t rlc_feature_version;
1134+ uint32_t mec_feature_version;
1135+ uint32_t mec2_feature_version;
11331136 struct amdgpu_ring gfx_ring[AMDGPU_MAX_GFX_RINGS];
11341137 unsigned num_gfx_rings;
11351138 struct amdgpu_ring compute_ring[AMDGPU_MAX_COMPUTE_RINGS];
@@ -1639,6 +1642,7 @@ struct amdgpu_sdma { · 503 unmodified lines
16391642 /* SDMA firmware */
16401643 const struct firmware *fw;
16411644 uint32_t fw_version;
1645+ uint32_t feature_version;
16421646
16431647 struct amdgpu_ring ring;
16441648 };
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c+7−6
@@ -317,16 +317,17 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file · 316 unmodified lines
317317 break;
318318 case AMDGPU_INFO_FW_GFX_RLC:
319319 fw_info.ver = adev->gfx.rlc_fw_version;
320− fw_info.feature = 0;
320+ fw_info.feature = adev->gfx.rlc_feature_version;
321321 break;
322322 case AMDGPU_INFO_FW_GFX_MEC:
323− if (info->query_fw.index == 0)
323+ if (info->query_fw.index == 0) {
324324 fw_info.ver = adev->gfx.mec_fw_version;
325− else if (info->query_fw.index == 1)
325+ fw_info.feature = adev->gfx.mec_feature_version;
326+ } else if (info->query_fw.index == 1) {
326327 fw_info.ver = adev->gfx.mec2_fw_version;
327− else
328+ fw_info.feature = adev->gfx.mec2_feature_version;
329+ } else
328330 return -EINVAL;
329− fw_info.feature = 0;
330331 break;
331332 case AMDGPU_INFO_FW_SMC:
332333 fw_info.ver = adev->pm.fw_version;
@@ -336,7 +337,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file · 3 unmodified lines
336337 if (info->query_fw.index >= 2)
337338 return -EINVAL;
338339 fw_info.ver = adev->sdma[info->query_fw.index].fw_version;
339− fw_info.feature = 0;
340+ fw_info.feature = adev->sdma[info->query_fw.index].feature_version;
340341 break;
341342 default:
342343 return -EINVAL;
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c+14−3
@@ -374,7 +374,7 @@ static int amdgpu_uvd_cs_msg_decode(uint32_t *msg, unsigned buf_sizes[]) · 373 unmodified lines
374374 unsigned height_in_mb = ALIGN(height / 16, 2);
375375 unsigned fs_in_mb = width_in_mb * height_in_mb;
376376
377− unsigned image_size, tmp, min_dpb_size, num_dpb_buffer;
377+ unsigned image_size, tmp, min_dpb_size, num_dpb_buffer, min_ctx_size;
378378
379379 image_size = width * height;
380380 image_size += image_size / 2;
@@ -466,6 +466,8 @@ static int amdgpu_uvd_cs_msg_decode(uint32_t *msg, unsigned buf_sizes[]) · 85 unmodified lines
466466
467467 num_dpb_buffer = (le32_to_cpu(msg[59]) & 0xff) + 2;
468468 min_dpb_size = image_size * num_dpb_buffer;
469+ min_ctx_size = ((width + 255) / 16) * ((height + 255) / 16)
470+ * 16 * num_dpb_buffer + 52 * 1024;
469471 break;
470472
471473 default:
@@ -486,6 +488,7 @@ static int amdgpu_uvd_cs_msg_decode(uint32_t *msg, unsigned buf_sizes[]) · 14 unmodified lines
486488
487489 buf_sizes[0x1] = dpb_size;
488490 buf_sizes[0x2] = image_size;
491+ buf_sizes[0x4] = min_ctx_size;
489492 return 0;
490493 }
491494
@@ -628,6 +631,13 @@ static int amdgpu_uvd_cs_pass2(struct amdgpu_uvd_cs_ctx *ctx) · 136 unmodified lines
628631 return -EINVAL;
629632 }
630633
634+ } else if (cmd == 0x206) {
635+ if ((end - start) < ctx->buf_sizes[4]) {
636+ DRM_ERROR("buffer (%d) to small (%d / %d)!\n", cmd,
637+ (unsigned)(end - start),
638+ ctx->buf_sizes[4]);
639+ return -EINVAL;
640+ }
631641 } else if ((cmd != 0x100) && (cmd != 0x204)) {
632642 DRM_ERROR("invalid UVD command %X!\n", cmd);
633643 return -EINVAL;
@@ -755,9 +765,10 @@ int amdgpu_uvd_ring_parse_cs(struct amdgpu_cs_parser *parser, uint32_t ib_idx) · 121 unmodified lines
755765 struct amdgpu_uvd_cs_ctx ctx = {};
756766 unsigned buf_sizes[] = {
757767 [0x00000000] = 2048,
758− [0x00000001] = 32 * 1024 * 1024,
759− [0x00000002] = 2048 * 1152 * 3,
768+ [0x00000001] = 0xFFFFFFFF,
769+ [0x00000002] = 0xFFFFFFFF,
760770 [0x00000003] = 2048,
771+ [0x00000004] = 0xFFFFFFFF,
761772 };
762773 struct amdgpu_ib *ib = &parser->ibs[ib_idx];
763774 int r;
drivers/gpu/drm/amd/amdgpu/cik_sdma.c+1−0
@@ -500,6 +500,7 @@ static int cik_sdma_load_microcode(struct amdgpu_device *adev) · 499 unmodified lines
500500 amdgpu_ucode_print_sdma_hdr(&hdr->header);
501501 fw_size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4;
502502 adev->sdma[i].fw_version = le32_to_cpu(hdr->header.ucode_version);
503+ adev->sdma[i].feature_version = le32_to_cpu(hdr->ucode_feature_version);
503504 fw_data = (const __le32 *)
504505 (adev->sdma[i].fw->data + le32_to_cpu(hdr->header.ucode_array_offset_bytes));
505506 WREG32(mmSDMA0_UCODE_ADDR + sdma_offsets[i], 0);
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c+7−1
@@ -3080,6 +3080,8 @@ static int gfx_v7_0_cp_compute_load_microcode(struct amdgpu_device *adev) · 3079 unmodified lines
30803080 mec_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec_fw->data;
30813081 amdgpu_ucode_print_gfx_hdr(&mec_hdr->header);
30823082 adev->gfx.mec_fw_version = le32_to_cpu(mec_hdr->header.ucode_version);
3083+ adev->gfx.mec_feature_version = le32_to_cpu(
3084+ mec_hdr->ucode_feature_version);
30833085
30843086 gfx_v7_0_cp_compute_enable(adev, false);
30853087
@@ -3102,6 +3104,8 @@ static int gfx_v7_0_cp_compute_load_microcode(struct amdgpu_device *adev) · 16 unmodified lines
31023104 mec2_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec2_fw->data;
31033105 amdgpu_ucode_print_gfx_hdr(&mec2_hdr->header);
31043106 adev->gfx.mec2_fw_version = le32_to_cpu(mec2_hdr->header.ucode_version);
3107+ adev->gfx.mec2_feature_version = le32_to_cpu(
3108+ mec2_hdr->ucode_feature_version);
31053109
31063110 /* MEC2 */
31073111 fw_data = (const __le32 *)
@@ -4066,6 +4070,8 @@ static int gfx_v7_0_rlc_resume(struct amdgpu_device *adev) · 958 unmodified lines
40664070 hdr = (const struct rlc_firmware_header_v1_0 *)adev->gfx.rlc_fw->data;
40674071 amdgpu_ucode_print_rlc_hdr(&hdr->header);
40684072 adev->gfx.rlc_fw_version = le32_to_cpu(hdr->header.ucode_version);
4073+ adev->gfx.rlc_feature_version = le32_to_cpu(
4074+ hdr->ucode_feature_version);
40694075
40704076 gfx_v7_0_rlc_stop(adev);
40714077
@@ -5122,7 +5128,7 @@ static void gfx_v7_0_print_status(void *handle) · 1050 unmodified lines
51225128 dev_info(adev->dev, " CP_HPD_EOP_CONTROL=0x%08X\n",
51235129 RREG32(mmCP_HPD_EOP_CONTROL));
51245130
5125− for (queue = 0; queue < 8; i++) {
5131+ for (queue = 0; queue < 8; queue++) {
51265132 cik_srbm_select(adev, me, pipe, queue, 0);
51275133 dev_info(adev->dev, " queue: %d\n", queue);
51285134 dev_info(adev->dev, " CP_PQ_WPTR_POLL_CNTL=0x%08X\n",
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c+24−14
@@ -587,6 +587,7 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) · 586 unmodified lines
587587 int err;
588588 struct amdgpu_firmware_info *info = NULL;
589589 const struct common_firmware_header *header = NULL;
590+ const struct gfx_firmware_header_v1_0 *cp_hdr;
590591
591592 DRM_DEBUG("\n");
592593
@@ -611,6 +612,9 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) · 18 unmodified lines
611612 err = amdgpu_ucode_validate(adev->gfx.pfp_fw);
612613 if (err)
613614 goto out;
615+ cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.pfp_fw->data;
616+ adev->gfx.pfp_fw_version = le32_to_cpu(cp_hdr->header.ucode_version);
617+ adev->gfx.pfp_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
614618
615619 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name);
616620 err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
@@ -619,6 +623,9 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) · 2 unmodified lines
619623 err = amdgpu_ucode_validate(adev->gfx.me_fw);
620624 if (err)
621625 goto out;
626+ cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.me_fw->data;
627+ adev->gfx.me_fw_version = le32_to_cpu(cp_hdr->header.ucode_version);
628+ adev->gfx.me_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
622629
623630 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name);
624631 err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev);
@@ -627,12 +634,18 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) · 2 unmodified lines
627634 err = amdgpu_ucode_validate(adev->gfx.ce_fw);
628635 if (err)
629636 goto out;
637+ cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.ce_fw->data;
638+ adev->gfx.ce_fw_version = le32_to_cpu(cp_hdr->header.ucode_version);
639+ adev->gfx.ce_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
630640
631641 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
632642 err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);
633643 if (err)
634644 goto out;
635645 err = amdgpu_ucode_validate(adev->gfx.rlc_fw);
646+ cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.rlc_fw->data;
647+ adev->gfx.rlc_fw_version = le32_to_cpu(cp_hdr->header.ucode_version);
648+ adev->gfx.rlc_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
636649
637650 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
638651 err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
@@ -641,6 +654,9 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) · 2 unmodified lines
641654 err = amdgpu_ucode_validate(adev->gfx.mec_fw);
642655 if (err)
643656 goto out;
657+ cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec_fw->data;
658+ adev->gfx.mec_fw_version = le32_to_cpu(cp_hdr->header.ucode_version);
659+ adev->gfx.mec_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
644660
645661 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name);
646662 err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev);
@@ -648,6 +664,12 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) · 1 unmodified line
648664 err = amdgpu_ucode_validate(adev->gfx.mec2_fw);
649665 if (err)
650666 goto out;
667+ cp_hdr = (const struct gfx_firmware_header_v1_0 *)
668+ adev->gfx.mec2_fw->data;
669+ adev->gfx.mec2_fw_version = le32_to_cpu(
670+ cp_hdr->header.ucode_version);
671+ adev->gfx.mec2_feature_version = le32_to_cpu(
672+ cp_hdr->ucode_feature_version);
651673 } else {
652674 err = 0;
653675 adev->gfx.mec2_fw = NULL;
@@ -1983,6 +2005,7 @@ static void gfx_v8_0_gpu_init(struct amdgpu_device *adev) · 1329 unmodified lines
19832005 adev->gfx.config.max_shader_engines = 1;
19842006 adev->gfx.config.max_tile_pipes = 2;
19852007 adev->gfx.config.max_sh_per_se = 1;
2008+ adev->gfx.config.max_backends_per_se = 2;
19862009
19872010 switch (adev->pdev->revision) {
19882011 case 0xc4:
@@ -1991,7 +2014,6 @@ static void gfx_v8_0_gpu_init(struct amdgpu_device *adev) · 2 unmodified lines
19912014 case 0xcc:
19922015 /* B10 */
19932016 adev->gfx.config.max_cu_per_sh = 8;
1994− adev->gfx.config.max_backends_per_se = 2;
19952017 break;
19962018 case 0xc5:
19972019 case 0x81:
@@ -2000,14 +2022,12 @@ static void gfx_v8_0_gpu_init(struct amdgpu_device *adev) · 2 unmodified lines
20002022 case 0xcd:
20012023 /* B8 */
20022024 adev->gfx.config.max_cu_per_sh = 6;
2003− adev->gfx.config.max_backends_per_se = 2;
20042025 break;
20052026 case 0xc6:
20062027 case 0xca:
20072028 case 0xce:
20082029 /* B6 */
20092030 adev->gfx.config.max_cu_per_sh = 6;
2010− adev->gfx.config.max_backends_per_se = 2;
20112031 break;
20122032 case 0xc7:
20132033 case 0x87:
@@ -2015,7 +2035,6 @@ static void gfx_v8_0_gpu_init(struct amdgpu_device *adev) · 1 unmodified line
20152035 default:
20162036 /* B4 */
20172037 adev->gfx.config.max_cu_per_sh = 4;
2018− adev->gfx.config.max_backends_per_se = 1;
20192038 break;
20202039 }
20212040
@@ -2275,7 +2294,6 @@ static int gfx_v8_0_rlc_load_microcode(struct amdgpu_device *adev) · 253 unmodified lines
22752294
22762295 hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data;
22772296 amdgpu_ucode_print_rlc_hdr(&hdr->header);
2278− adev->gfx.rlc_fw_version = le32_to_cpu(hdr->header.ucode_version);
22792297
22802298 fw_data = (const __le32 *)(adev->gfx.rlc_fw->data +
22812299 le32_to_cpu(hdr->header.ucode_array_offset_bytes));
@@ -2361,12 +2379,6 @@ static int gfx_v8_0_cp_gfx_load_microcode(struct amdgpu_device *adev) · 79 unmodified lines
23612379 amdgpu_ucode_print_gfx_hdr(&pfp_hdr->header);
23622380 amdgpu_ucode_print_gfx_hdr(&ce_hdr->header);
23632381 amdgpu_ucode_print_gfx_hdr(&me_hdr->header);
2364− adev->gfx.pfp_fw_version = le32_to_cpu(pfp_hdr->header.ucode_version);
2365− adev->gfx.ce_fw_version = le32_to_cpu(ce_hdr->header.ucode_version);
2366− adev->gfx.me_fw_version = le32_to_cpu(me_hdr->header.ucode_version);
2367− adev->gfx.me_feature_version = le32_to_cpu(me_hdr->ucode_feature_version);
2368− adev->gfx.ce_feature_version = le32_to_cpu(ce_hdr->ucode_feature_version);
2369− adev->gfx.pfp_feature_version = le32_to_cpu(pfp_hdr->ucode_feature_version);
23702382
23712383 gfx_v8_0_cp_gfx_enable(adev, false);
23722384
@@ -2622,7 +2634,6 @@ static int gfx_v8_0_cp_compute_load_microcode(struct amdgpu_device *adev) · 249 unmodified lines
26222634
26232635 mec_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec_fw->data;
26242636 amdgpu_ucode_print_gfx_hdr(&mec_hdr->header);
2625− adev->gfx.mec_fw_version = le32_to_cpu(mec_hdr->header.ucode_version);
26262637
26272638 fw_data = (const __le32 *)
26282639 (adev->gfx.mec_fw->data +
@@ -2641,7 +2652,6 @@ static int gfx_v8_0_cp_compute_load_microcode(struct amdgpu_device *adev) · 12 unmodified lines
26412652
26422653 mec2_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec2_fw->data;
26432654 amdgpu_ucode_print_gfx_hdr(&mec2_hdr->header);
2644− adev->gfx.mec2_fw_version = le32_to_cpu(mec2_hdr->header.ucode_version);
26452655
26462656 fw_data = (const __le32 *)
26472657 (adev->gfx.mec2_fw->data +
@@ -3125,7 +3135,7 @@ static int gfx_v8_0_cp_compute_resume(struct amdgpu_device *adev) · 477 unmodified lines
31253135 WREG32(mmCP_MEC_DOORBELL_RANGE_LOWER,
31263136 AMDGPU_DOORBELL_KIQ << 2);
31273137 WREG32(mmCP_MEC_DOORBELL_RANGE_UPPER,
3128− 0x7FFFF << 2);
3138+ AMDGPU_DOORBELL_MEC_RING7 << 2);
31293139 }
31303140 tmp = RREG32(mmCP_HQD_PQ_DOORBELL_CONTROL);
31313141 tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_DOORBELL_CONTROL,
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c+4−2
@@ -121,6 +121,7 @@ static int sdma_v2_4_init_microcode(struct amdgpu_device *adev) · 120 unmodified lines
121121 int err, i;
122122 struct amdgpu_firmware_info *info = NULL;
123123 const struct common_firmware_header *header = NULL;
124+ const struct sdma_firmware_header_v1_0 *hdr;
124125
125126 DRM_DEBUG("\n");
126127
@@ -142,6 +143,9 @@ static int sdma_v2_4_init_microcode(struct amdgpu_device *adev) · 15 unmodified lines
142143 err = amdgpu_ucode_validate(adev->sdma[i].fw);
143144 if (err)
144145 goto out;
146+ hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma[i].fw->data;
147+ adev->sdma[i].fw_version = le32_to_cpu(hdr->header.ucode_version);
148+ adev->sdma[i].feature_version = le32_to_cpu(hdr->ucode_feature_version);
145149
146150 if (adev->firmware.smu_load) {
147151 info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SDMA0 + i];
@@ -541,8 +545,6 @@ static int sdma_v2_4_load_microcode(struct amdgpu_device *adev) · 393 unmodified lines
541545 hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma[i].fw->data;
542546 amdgpu_ucode_print_sdma_hdr(&hdr->header);
543547 fw_size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4;
544− adev->sdma[i].fw_version = le32_to_cpu(hdr->header.ucode_version);
545−
546548 fw_data = (const __le32 *)
547549 (adev->sdma[i].fw->data +
548550 le32_to_cpu(hdr->header.ucode_array_offset_bytes));
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c+4−2
@@ -159,6 +159,7 @@ static int sdma_v3_0_init_microcode(struct amdgpu_device *adev) · 158 unmodified lines
159159 int err, i;
160160 struct amdgpu_firmware_info *info = NULL;
161161 const struct common_firmware_header *header = NULL;
162+ const struct sdma_firmware_header_v1_0 *hdr;
162163
163164 DRM_DEBUG("\n");
164165
@@ -183,6 +184,9 @@ static int sdma_v3_0_init_microcode(struct amdgpu_device *adev) · 18 unmodified lines
183184 err = amdgpu_ucode_validate(adev->sdma[i].fw);
184185 if (err)
185186 goto out;
187+ hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma[i].fw->data;
188+ adev->sdma[i].fw_version = le32_to_cpu(hdr->header.ucode_version);
189+ adev->sdma[i].feature_version = le32_to_cpu(hdr->ucode_feature_version);
186190
187191 if (adev->firmware.smu_load) {
188192 info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SDMA0 + i];
@@ -630,8 +634,6 @@ static int sdma_v3_0_load_microcode(struct amdgpu_device *adev) · 441 unmodified lines
630634 hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma[i].fw->data;
631635 amdgpu_ucode_print_sdma_hdr(&hdr->header);
632636 fw_size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4;
633− adev->sdma[i].fw_version = le32_to_cpu(hdr->header.ucode_version);
634−
635637 fw_data = (const __le32 *)
636638 (adev->sdma[i].fw->data +
637639 le32_to_cpu(hdr->header.ucode_array_offset_bytes));
drivers/gpu/drm/drm_atomic_helper.c+9−1
@@ -196,7 +196,12 @@ update_connector_routing(struct drm_atomic_state *state, int conn_idx) · 195 unmodified lines
196196 }
197197
198198 funcs = connector->helper_private;
199− new_encoder = funcs->best_encoder(connector);
199+
200+ if (funcs->atomic_best_encoder)
201+ new_encoder = funcs->atomic_best_encoder(connector,
202+ connector_state);
203+ else
204+ new_encoder = funcs->best_encoder(connector);
200205
201206 if (!new_encoder) {
202207 DRM_DEBUG_ATOMIC("No suitable encoder found for [CONNECTOR:%d:%s]\n",
@@ -229,6 +234,9 @@ update_connector_routing(struct drm_atomic_state *state, int conn_idx) · 26 unmodified lines
229234 }
230235 }
231236
237+ if (WARN_ON(!connector_state->crtc))
238+ return -EINVAL;
239+
232240 connector_state->best_encoder = new_encoder;
233241 idx = drm_crtc_index(connector_state->crtc);
234242
drivers/gpu/drm/drm_dp_mst_topology.c+0−1
@@ -1294,7 +1294,6 @@ retry: · 1293 unmodified lines
12941294 goto retry;
12951295 }
12961296 DRM_DEBUG_KMS("failed to dpcd write %d %d\n", tosend, ret);
1297− WARN(1, "fail\n");
12981297
12991298 return -EIO;
13001299 }
drivers/gpu/drm/drm_irq.c+1−1
@@ -75,7 +75,7 @@ module_param_named(timestamp_precision_usec, drm_timestamp_precision, int, 0600) · 74 unmodified lines
7575 module_param_named(timestamp_monotonic, drm_timestamp_monotonic, int, 0600);
7676
7777 static void store_vblank(struct drm_device *dev, int crtc,
78− unsigned vblank_count_inc,
78+ u32 vblank_count_inc,
7979 struct timeval *t_vblank)
8080 {
8181 struct drm_vblank_crtc *vblank = &dev->vblank[crtc];
drivers/gpu/drm/i2c/tda998x_drv.c+2−2
@@ -606,8 +606,6 @@ static void · 605 unmodified lines
606606 tda998x_write_if(struct tda998x_priv *priv, uint8_t bit, uint16_t addr,
607607 uint8_t *buf, size_t size)
608608 {
609− buf[PB(0)] = tda998x_cksum(buf, size);
610−
611609 reg_clear(priv, REG_DIP_IF_FLAGS, bit);
612610 reg_write_range(priv, addr, buf, size);
613611 reg_set(priv, REG_DIP_IF_FLAGS, bit);
@@ -627,6 +625,8 @@ tda998x_write_aif(struct tda998x_priv *priv, struct tda998x_encoder_params *p) · 13 unmodified lines
627625 buf[PB(4)] = p->audio_frame[4];
628626 buf[PB(5)] = p->audio_frame[5] & 0xf8; /* DM_INH + LSV */
629627
628+ buf[PB(0)] = tda998x_cksum(buf, sizeof(buf));
629+
630630 tda998x_write_if(priv, DIP_IF_FLAGS_IF4, REG_IF4_HB0, buf,
631631 sizeof(buf));
632632 }
drivers/gpu/drm/i915/intel_bios.c+23−4
@@ -1075,15 +1075,34 @@ parse_device_mapping(struct drm_i915_private *dev_priv, · 1074 unmodified lines
10751075 const union child_device_config *p_child;
10761076 union child_device_config *child_dev_ptr;
10771077 int i, child_device_num, count;
1078− u16 block_size;
1078+ u8 expected_size;
1079+ u16 block_size;
10791080
10801081 p_defs = find_section(bdb, BDB_GENERAL_DEFINITIONS);
10811082 if (!p_defs) {
10821083 DRM_DEBUG_KMS("No general definition block is found, no devices defined.\n");
10831084 return;
10841085 }
1085− if (p_defs->child_dev_size < sizeof(*p_child)) {
1086− DRM_ERROR("General definiton block child device size is too small.\n");
1086+ if (bdb->version < 195) {
1087+ expected_size = 33;
1088+ } else if (bdb->version == 195) {
1089+ expected_size = 37;
1090+ } else if (bdb->version <= 197) {
1091+ expected_size = 38;
1092+ } else {
1093+ expected_size = 38;
1094+ DRM_DEBUG_DRIVER("Expected child_device_config size for BDB version %u not known; assuming %u\n",
1095+ expected_size, bdb->version);
1096+ }
1097+
1098+ if (expected_size > sizeof(*p_child)) {
1099+ DRM_ERROR("child_device_config cannot fit in p_child\n");
1100+ return;
1101+ }
1102+
1103+ if (p_defs->child_dev_size != expected_size) {
1104+ DRM_ERROR("Size mismatch; child_device_config size=%u (expected %u); bdb->version: %u\n",
1105+ p_defs->child_dev_size, expected_size, bdb->version);
10871106 return;
10881107 }
10891108 /* get the block size of general definitions */
@@ -1130,7 +1149,7 @@ parse_device_mapping(struct drm_i915_private *dev_priv, · 40 unmodified lines
11301149
11311150 child_dev_ptr = dev_priv->vbt.child_dev + count;
11321151 count++;
1133− memcpy(child_dev_ptr, p_child, sizeof(*p_child));
1152+ memcpy(child_dev_ptr, p_child, p_defs->child_dev_size);
11341153 }
11351154 return;
11361155 }
drivers/gpu/drm/i915/intel_dp_mst.c+11−0
@@ -357,6 +357,16 @@ intel_dp_mst_mode_valid(struct drm_connector *connector, · 356 unmodified lines
357357 return MODE_OK;
358358 }
359359
360+static struct drm_encoder *intel_mst_atomic_best_encoder(struct drm_connector *connector,
361+ struct drm_connector_state *state)
362+{
363+ struct intel_connector *intel_connector = to_intel_connector(connector);
364+ struct intel_dp *intel_dp = intel_connector->mst_port;
365+ struct intel_crtc *crtc = to_intel_crtc(state->crtc);
366+
367+ return &intel_dp->mst_encoders[crtc->pipe]->base.base;
368+}
369+
360370 static struct drm_encoder *intel_mst_best_encoder(struct drm_connector *connector)
361371 {
362372 struct intel_connector *intel_connector = to_intel_connector(connector);
@@ -367,6 +377,7 @@ static struct drm_encoder *intel_mst_best_encoder(struct drm_connector *connecto · 4 unmodified lines
367377 static const struct drm_connector_helper_funcs intel_dp_mst_connector_helper_funcs = {
368378 .get_modes = intel_dp_mst_get_modes,
369379 .mode_valid = intel_dp_mst_mode_valid,
380+ .atomic_best_encoder = intel_mst_atomic_best_encoder,
370381 .best_encoder = intel_mst_best_encoder,
371382 };
372383
drivers/hid/hid-input.c+5−2
@@ -462,12 +462,15 @@ out: · 461 unmodified lines
462462
463463 static void hidinput_cleanup_battery(struct hid_device *dev)
464464 {
465+ const struct power_supply_desc *psy_desc;
466+
465467 if (!dev->battery)
466468 return;
467469
470+ psy_desc = dev->battery->desc;
468471 power_supply_unregister(dev->battery);
469− kfree(dev->battery->desc->name);
470− kfree(dev->battery->desc);
472+ kfree(psy_desc->name);
473+ kfree(psy_desc);
471474 dev->battery = NULL;
472475 }
473476 #else /* !CONFIG_HID_BATTERY_STRENGTH */
drivers/hid/hid-uclogic.c+1−1
@@ -858,7 +858,7 @@ static int uclogic_tablet_enable(struct hid_device *hdev) · 857 unmodified lines
858858 for (p = drvdata->rdesc;
859859 p <= drvdata->rdesc + drvdata->rsize - 4;) {
860860 if (p[0] == 0xFE && p[1] == 0xED && p[2] == 0x1D &&
861− p[3] < sizeof(params)) {
861+ p[3] < ARRAY_SIZE(params)) {
862862 v = params[p[3]];
863863 put_unaligned(cpu_to_le32(v), (s32 *)p);
864864 p += 4;
drivers/hid/wacom_sys.c+37−33
@@ -1284,6 +1284,39 @@ fail_register_pen_input: · 1283 unmodified lines
12841284 return error;
12851285 }
12861286
1287+/*
1288+ * Not all devices report physical dimensions from HID.
1289+ * Compute the default from hardcoded logical dimension
1290+ * and resolution before driver overwrites them.
1291+ */
1292+static void wacom_set_default_phy(struct wacom_features *features)
1293+{
1294+ if (features->x_resolution) {
1295+ features->x_phy = (features->x_max * 100) /
1296+ features->x_resolution;
1297+ features->y_phy = (features->y_max * 100) /
1298+ features->y_resolution;
1299+ }
1300+}
1301+
1302+static void wacom_calculate_res(struct wacom_features *features)
1303+{
1304+ /* set unit to "100th of a mm" for devices not reported by HID */
1305+ if (!features->unit) {
1306+ features->unit = 0x11;
1307+ features->unitExpo = -3;
1308+ }
1309+
1310+ features->x_resolution = wacom_calc_hid_res(features->x_max,
1311+ features->x_phy,
1312+ features->unit,
1313+ features->unitExpo);
1314+ features->y_resolution = wacom_calc_hid_res(features->y_max,
1315+ features->y_phy,
1316+ features->unit,
1317+ features->unitExpo);
1318+}
1319+
12871320 static void wacom_wireless_work(struct work_struct *work)
12881321 {
12891322 struct wacom *wacom = container_of(work, struct wacom, work);
@@ -1341,6 +1374,8 @@ static void wacom_wireless_work(struct work_struct *work) · 51 unmodified lines
13411374 if (wacom_wac1->features.type != INTUOSHT &&
13421375 wacom_wac1->features.type != BAMBOO_PT)
13431376 wacom_wac1->features.device_type |= WACOM_DEVICETYPE_PAD;
1377+ wacom_set_default_phy(&wacom_wac1->features);
1378+ wacom_calculate_res(&wacom_wac1->features);
13441379 snprintf(wacom_wac1->pen_name, WACOM_NAME_MAX, "%s (WL) Pen",
13451380 wacom_wac1->features.name);
13461381 snprintf(wacom_wac1->pad_name, WACOM_NAME_MAX, "%s (WL) Pad",
@@ -1359,7 +1394,9 @@ static void wacom_wireless_work(struct work_struct *work) · 12 unmodified lines
13591394 wacom_wac2->features =
13601395 *((struct wacom_features *)id->driver_data);
13611396 wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3;
1397+ wacom_set_default_phy(&wacom_wac2->features);
13621398 wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096;
1399+ wacom_calculate_res(&wacom_wac2->features);
13631400 snprintf(wacom_wac2->touch_name, WACOM_NAME_MAX,
13641401 "%s (WL) Finger",wacom_wac2->features.name);
13651402 snprintf(wacom_wac2->pad_name, WACOM_NAME_MAX,
@@ -1407,39 +1444,6 @@ void wacom_battery_work(struct work_struct *work) · 41 unmodified lines
14071444 }
14081445 }
14091446
1410−/*
1411− * Not all devices report physical dimensions from HID.
1412− * Compute the default from hardcoded logical dimension
1413− * and resolution before driver overwrites them.
1414− */
1415−static void wacom_set_default_phy(struct wacom_features *features)
1416−{
1417− if (features->x_resolution) {
1418− features->x_phy = (features->x_max * 100) /
1419− features->x_resolution;
1420− features->y_phy = (features->y_max * 100) /
1421− features->y_resolution;
1422− }
1423−}
1424−
1425−static void wacom_calculate_res(struct wacom_features *features)
1426−{
1427− /* set unit to "100th of a mm" for devices not reported by HID */
1428− if (!features->unit) {
1429− features->unit = 0x11;
1430− features->unitExpo = -3;
1431− }
1432−
1433− features->x_resolution = wacom_calc_hid_res(features->x_max,
1434− features->x_phy,
1435− features->unit,
1436− features->unitExpo);
1437− features->y_resolution = wacom_calc_hid_res(features->y_max,
1438− features->y_phy,
1439− features->unit,
1440− features->unitExpo);
1441−}
1442−
14431447 static size_t wacom_compute_pktlen(struct hid_device *hdev)
14441448 {
14451449 struct hid_report_enum *report_enum;
drivers/hwmon/dell-smm-hwmon.c+17−1
@@ -929,6 +929,21 @@ static struct dmi_system_id i8k_dmi_table[] __initdata = { · 928 unmodified lines
929929
930930 MODULE_DEVICE_TABLE(dmi, i8k_dmi_table);
931931
932+static struct dmi_system_id i8k_blacklist_dmi_table[] __initdata = {
933+ {
934+ /*
935+ * CPU fan speed going up and down on Dell Studio XPS 8100
936+ * for unknown reasons.
937+ */
938+ .ident = "Dell Studio XPS 8100",
939+ .matches = {
940+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
941+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Studio XPS 8100"),
942+ },
943+ },
944+ { }
945+};
946+
932947 /*
933948 * Probe for the presence of a supported laptop.
934949 */
@@ -940,7 +955,8 @@ static int __init i8k_probe(void) · 5 unmodified lines
940955 /*
941956 * Get DMI information
942957 */
943− if (!dmi_check_system(i8k_dmi_table)) {
958+ if (!dmi_check_system(i8k_dmi_table) ||
959+ dmi_check_system(i8k_blacklist_dmi_table)) {
944960 if (!ignore_dmi && !force)
945961 return -ENODEV;
946962
drivers/hwmon/g762.c+1−0
@@ -582,6 +582,7 @@ static const struct of_device_id g762_dt_match[] = { · 581 unmodified lines
582582 { .compatible = "gmt,g763" },
583583 { },
584584 };
585+MODULE_DEVICE_TABLE(of, g762_dt_match);
585586
586587 /*
587588 * Grab clock (a required property), enable it, get (fixed) clock frequency
drivers/hwmon/nct7904.c+1−0
@@ -575,6 +575,7 @@ static const struct i2c_device_id nct7904_id[] = { · 574 unmodified lines
575575 {"nct7904", 0},
576576 {}
577577 };
578+MODULE_DEVICE_TABLE(i2c, nct7904_id);
578579
579580 static struct i2c_driver nct7904_driver = {
580581 .class = I2C_CLASS_HWMON,
drivers/i2c/busses/i2c-bfin-twi.c+2−2
@@ -692,7 +692,7 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev) · 691 unmodified lines
692692
693693 platform_set_drvdata(pdev, iface);
694694
695− dev_info(&pdev->dev, "Blackfin BF5xx on-chip I2C TWI Contoller, "
695+ dev_info(&pdev->dev, "Blackfin BF5xx on-chip I2C TWI Controller, "
696696 "regs_base@%p\n", iface->regs_base);
697697
698698 return 0;
@@ -735,6 +735,6 @@ subsys_initcall(i2c_bfin_twi_init); · 36 unmodified lines
735735 module_exit(i2c_bfin_twi_exit);
736736
737737 MODULE_AUTHOR("Bryan Wu, Sonic Zhang");
738−MODULE_DESCRIPTION("Blackfin BF5xx on-chip I2C TWI Contoller Driver");
738+MODULE_DESCRIPTION("Blackfin BF5xx on-chip I2C TWI Controller Driver");
739739 MODULE_LICENSE("GPL");
740740 MODULE_ALIAS("platform:i2c-bfin-twi");
drivers/i2c/busses/i2c-omap.c+11−0
@@ -1247,7 +1247,14 @@ static void omap_i2c_prepare_recovery(struct i2c_adapter *adap) · 1246 unmodified lines
12471247 u32 reg;
12481248
12491249 reg = omap_i2c_read_reg(dev, OMAP_I2C_SYSTEST_REG);
1250+ /* enable test mode */
12501251 reg |= OMAP_I2C_SYSTEST_ST_EN;
1252+ /* select SDA/SCL IO mode */
1253+ reg |= 3 << OMAP_I2C_SYSTEST_TMODE_SHIFT;
1254+ /* set SCL to high-impedance state (reset value is 0) */
1255+ reg |= OMAP_I2C_SYSTEST_SCL_O;
1256+ /* set SDA to high-impedance state (reset value is 0) */
1257+ reg |= OMAP_I2C_SYSTEST_SDA_O;
12511258 omap_i2c_write_reg(dev, OMAP_I2C_SYSTEST_REG, reg);
12521259 }
12531260
@@ -1257,7 +1264,11 @@ static void omap_i2c_unprepare_recovery(struct i2c_adapter *adap) · 3 unmodified lines
12571264 u32 reg;
12581265
12591266 reg = omap_i2c_read_reg(dev, OMAP_I2C_SYSTEST_REG);
1267+ /* restore reset values */
12601268 reg &= ~OMAP_I2C_SYSTEST_ST_EN;
1269+ reg &= ~OMAP_I2C_SYSTEST_TMODE_MASK;
1270+ reg &= ~OMAP_I2C_SYSTEST_SCL_O;
1271+ reg &= ~OMAP_I2C_SYSTEST_SDA_O;
12611272 omap_i2c_write_reg(dev, OMAP_I2C_SYSTEST_REG, reg);
12621273 }
12631274
drivers/i2c/i2c-core.c+17−7
@@ -567,6 +567,9 @@ static int i2c_generic_recovery(struct i2c_adapter *adap) · 566 unmodified lines
567567 if (bri->prepare_recovery)
568568 bri->prepare_recovery(adap);
569569
570+ bri->set_scl(adap, val);
571+ ndelay(RECOVERY_NDELAY);
572+
570573 /*
571574 * By this time SCL is high, as we need to give 9 falling-rising edges
572575 */
@@ -597,7 +600,6 @@ static int i2c_generic_recovery(struct i2c_adapter *adap) · 24 unmodified lines
597600
598601 int i2c_generic_scl_recovery(struct i2c_adapter *adap)
599602 {
600− adap->bus_recovery_info->set_scl(adap, 1);
601603 return i2c_generic_recovery(adap);
602604 }
603605 EXPORT_SYMBOL_GPL(i2c_generic_scl_recovery);
@@ -1338,13 +1340,17 @@ static int of_dev_node_match(struct device *dev, void *data) · 734 unmodified lines
13381340 struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
13391341 {
13401342 struct device *dev;
1343+ struct i2c_client *client;
13411344
1342− dev = bus_find_device(&i2c_bus_type, NULL, node,
1343− of_dev_node_match);
1345+ dev = bus_find_device(&i2c_bus_type, NULL, node, of_dev_node_match);
13441346 if (!dev)
13451347 return NULL;
13461348
1347− return i2c_verify_client(dev);
1349+ client = i2c_verify_client(dev);
1350+ if (!client)
1351+ put_device(dev);
1352+
1353+ return client;
13481354 }
13491355 EXPORT_SYMBOL(of_find_i2c_device_by_node);
13501356
@@ -1352,13 +1358,17 @@ EXPORT_SYMBOL(of_find_i2c_device_by_node); · 1 unmodified line
13521358 struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node)
13531359 {
13541360 struct device *dev;
1361+ struct i2c_adapter *adapter;
13551362
1356− dev = bus_find_device(&i2c_bus_type, NULL, node,
1357− of_dev_node_match);
1363+ dev = bus_find_device(&i2c_bus_type, NULL, node, of_dev_node_match);
13581364 if (!dev)
13591365 return NULL;
13601366
1361− return i2c_verify_adapter(dev);
1367+ adapter = i2c_verify_adapter(dev);
1368+ if (!adapter)
1369+ put_device(dev);
1370+
1371+ return adapter;
13621372 }
13631373 EXPORT_SYMBOL(of_find_i2c_adapter_by_node);
13641374 #else
drivers/i2c/i2c-slave-eeprom.c+0−6
@@ -80,9 +80,6 @@ static ssize_t i2c_slave_eeprom_bin_read(struct file *filp, struct kobject *kobj · 79 unmodified lines
8080 struct eeprom_data *eeprom;
8181 unsigned long flags;
8282
83− if (off + count > attr->size)
84− return -EFBIG;
85−
8683 eeprom = dev_get_drvdata(container_of(kobj, struct device, kobj));
8784
8885 spin_lock_irqsave(&eeprom->buffer_lock, flags);
@@ -98,9 +95,6 @@ static ssize_t i2c_slave_eeprom_bin_write(struct file *filp, struct kobject *kob · 9 unmodified lines
9895 struct eeprom_data *eeprom;
9996 unsigned long flags;
10097
101− if (off + count > attr->size)
102− return -EFBIG;
103−
10498 eeprom = dev_get_drvdata(container_of(kobj, struct device, kobj));
10599
106100 spin_lock_irqsave(&eeprom->buffer_lock, flags);
drivers/input/joystick/turbografx.c+1−1
@@ -196,7 +196,7 @@ static struct tgfx __init *tgfx_probe(int parport, int *n_buttons, int n_devs) · 195 unmodified lines
196196 if (n_buttons[i] < 1)
197197 continue;
198198
199− if (n_buttons[i] > 6) {
199+ if (n_buttons[i] > ARRAY_SIZE(tgfx_buttons)) {
200200 printk(KERN_ERR "turbografx.c: Invalid number of buttons %d\n", n_buttons[i]);
201201 err = -EINVAL;
202202 goto err_unreg_devs;
drivers/input/misc/axp20x-pek.c+1−0
@@ -292,3 +292,4 @@ module_platform_driver(axp20x_pek_driver); · 291 unmodified lines
292292 MODULE_DESCRIPTION("axp20x Power Button");
293293 MODULE_AUTHOR("Carlo Caione <carlo@caione.org>");
294294 MODULE_LICENSE("GPL");
295+MODULE_ALIAS("platform:axp20x-pek");
drivers/input/misc/twl4030-vibra.c+2−1
@@ -183,7 +183,8 @@ static bool twl4030_vibra_check_coexist(struct twl4030_vibra_data *pdata, · 182 unmodified lines
183183 if (pdata && pdata->coexist)
184184 return true;
185185
186− if (of_find_node_by_name(node, "codec")) {
186+ node = of_find_node_by_name(node, "codec");
187+ if (node) {
187188 of_node_put(node);
188189 return true;
189190 }
drivers/input/mouse/alps.c+6−2
@@ -20,6 +20,7 @@ · 19 unmodified lines
2020 #include <linux/input/mt.h>
2121 #include <linux/serio.h>
2222 #include <linux/libps2.h>
23+#include <linux/dmi.h>
2324
2425 #include "psmouse.h"
2526 #include "alps.h"
@@ -99,6 +100,7 @@ static const struct alps_nibble_commands alps_v6_nibble_commands[] = { · 73 unmodified lines
99100 #define ALPS_FOUR_BUTTONS 0x40 /* 4 direction button present */
100101 #define ALPS_PS2_INTERLEAVED 0x80 /* 3-byte PS/2 packet interleaved with
101102 6-byte ALPS packet */
103+#define ALPS_DELL 0x100 /* device is a Dell laptop */
102104 #define ALPS_BUTTONPAD 0x200 /* device is a clickpad */
103105
104106 static const struct alps_model_info alps_model_data[] = {
@@ -251,9 +253,9 @@ static void alps_process_packet_v1_v2(struct psmouse *psmouse) · 146 unmodified lines
251253 return;
252254 }
253255
254− /* Non interleaved V2 dualpoint has separate stick button bits */
256+ /* Dell non interleaved V2 dualpoint has separate stick button bits */
255257 if (priv->proto_version == ALPS_PROTO_V2 &&
256− priv->flags == (ALPS_PASS | ALPS_DUALPOINT)) {
258+ priv->flags == (ALPS_DELL | ALPS_PASS | ALPS_DUALPOINT)) {
257259 left |= packet[0] & 1;
258260 right |= packet[0] & 2;
259261 middle |= packet[0] & 4;
@@ -2550,6 +2552,8 @@ static int alps_set_protocol(struct psmouse *psmouse, · 2290 unmodified lines
25502552 priv->byte0 = protocol->byte0;
25512553 priv->mask0 = protocol->mask0;
25522554 priv->flags = protocol->flags;
2555+ if (dmi_name_in_vendors("Dell"))
2556+ priv->flags |= ALPS_DELL;
25532557
25542558 priv->x_max = 2000;
25552559 priv->y_max = 1400;
drivers/input/mouse/elantech.c+20−2
@@ -783,19 +783,26 @@ static int elantech_packet_check_v4(struct psmouse *psmouse) · 782 unmodified lines
783783 struct elantech_data *etd = psmouse->private;
784784 unsigned char *packet = psmouse->packet;
785785 unsigned char packet_type = packet[3] & 0x03;
786+ unsigned int ic_version;
786787 bool sanity_check;
787788
788789 if (etd->tp_dev && (packet[3] & 0x0f) == 0x06)
789790 return PACKET_TRACKPOINT;
790791
792+ /* This represents the version of IC body. */
793+ ic_version = (etd->fw_version & 0x0f0000) >> 16;
794+
791795 /*
792796 * Sanity check based on the constant bits of a packet.
793797 * The constant bits change depending on the value of
794− * the hardware flag 'crc_enabled' but are the same for
795− * every packet, regardless of the type.
798+ * the hardware flag 'crc_enabled' and the version of
799+ * the IC body, but are the same for every packet,
800+ * regardless of the type.
796801 */
797802 if (etd->crc_enabled)
798803 sanity_check = ((packet[3] & 0x08) == 0x00);
804+ else if (ic_version == 7 && etd->samples[1] == 0x2A)
805+ sanity_check = ((packet[3] & 0x1c) == 0x10);
799806 else
800807 sanity_check = ((packet[0] & 0x0c) == 0x04 &&
801808 (packet[3] & 0x1c) == 0x10);
@@ -1116,6 +1123,7 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse, · 314 unmodified lines
11161123 * Avatar AVIU-145A2 0x361f00 ? clickpad
11171124 * Fujitsu LIFEBOOK E544 0x470f00 d0, 12, 09 2 hw buttons
11181125 * Fujitsu LIFEBOOK E554 0x570f01 40, 14, 0c 2 hw buttons
1126+ * Fujitsu T725 0x470f01 05, 12, 09 2 hw buttons
11191127 * Fujitsu H730 0x570f00 c0, 14, 0c 3 hw buttons (**)
11201128 * Gigabyte U2442 0x450f01 58, 17, 0c 2 hw buttons
11211129 * Lenovo L430 0x350f02 b9, 15, 0c 2 hw buttons (*)
@@ -1651,6 +1659,16 @@ int elantech_init(struct psmouse *psmouse) · 529 unmodified lines
16511659 etd->capabilities[0], etd->capabilities[1],
16521660 etd->capabilities[2]);
16531661
1662+ if (etd->hw_version != 1) {
1663+ if (etd->send_cmd(psmouse, ETP_SAMPLE_QUERY, etd->samples)) {
1664+ psmouse_err(psmouse, "failed to query sample data\n");
1665+ goto init_fail;
1666+ }
1667+ psmouse_info(psmouse,
1668+ "Elan sample query result %02x, %02x, %02x\n",
1669+ etd->samples[0], etd->samples[1], etd->samples[2]);
1670+ }
1671+
16541672 if (elantech_set_absolute_mode(psmouse)) {
16551673 psmouse_err(psmouse,
16561674 "failed to put touchpad into absolute mode.\n");
drivers/input/mouse/elantech.h+1−0
@@ -129,6 +129,7 @@ struct elantech_data { · 128 unmodified lines
129129 unsigned char reg_26;
130130 unsigned char debug;
131131 unsigned char capabilities[3];
132+ unsigned char samples[3];
132133 bool paritycheck;
133134 bool jumpy_cursor;
134135 bool reports_pressure;
drivers/irqchip/irq-mips-gic.c+1−1
@@ -538,7 +538,7 @@ static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id) · 537 unmodified lines
538538
539539 static irqreturn_t ipi_call_interrupt(int irq, void *dev_id)
540540 {
541− smp_call_function_interrupt();
541+ generic_smp_call_function_interrupt();
542542
543543 return IRQ_HANDLED;
544544 }
drivers/macintosh/ans-lcd.c+1−1
@@ -7,7 +7,7 @@ · 6 unmodified lines
77 #include <linux/kernel.h>
88 #include <linux/miscdevice.h>
99 #include <linux/fcntl.h>
10−#include <linux/init.h>
10+#include <linux/module.h>
1111 #include <linux/delay.h>
1212 #include <linux/fs.h>
1313
drivers/md/dm-cache-policy-mq.c+0−2
@@ -1471,5 +1471,3 @@ module_exit(mq_exit); · 1470 unmodified lines
14711471 MODULE_AUTHOR("Joe Thornber <dm-devel@redhat.com>");
14721472 MODULE_LICENSE("GPL");
14731473 MODULE_DESCRIPTION("mq cache policy");
1474−
1475−MODULE_ALIAS("dm-cache-default");
drivers/md/dm-cache-policy-smq.c+2−0
@@ -1789,3 +1789,5 @@ module_exit(smq_exit); · 1788 unmodified lines
17891789 MODULE_AUTHOR("Joe Thornber <dm-devel@redhat.com>");
17901790 MODULE_LICENSE("GPL");
17911791 MODULE_DESCRIPTION("smq cache policy");
1792+
1793+MODULE_ALIAS("dm-cache-default");
drivers/md/dm-thin-metadata.c+2−2
@@ -1293,8 +1293,8 @@ static int __release_metadata_snap(struct dm_pool_metadata *pmd) · 1292 unmodified lines
12931293 return r;
12941294
12951295 disk_super = dm_block_data(copy);
1296− dm_sm_dec_block(pmd->metadata_sm, le64_to_cpu(disk_super->data_mapping_root));
1297− dm_sm_dec_block(pmd->metadata_sm, le64_to_cpu(disk_super->device_details_root));
1296+ dm_btree_del(&pmd->info, le64_to_cpu(disk_super->data_mapping_root));
1297+ dm_btree_del(&pmd->details_info, le64_to_cpu(disk_super->device_details_root));
12981298 dm_sm_dec_block(pmd->metadata_sm, held_root);
12991299
13001300 return dm_tm_unlock(pmd->tm, copy);
drivers/md/dm.c+10−17
@@ -1729,7 +1729,8 @@ static int dm_merge_bvec(struct request_queue *q, · 1728 unmodified lines
17291729 struct mapped_device *md = q->queuedata;
17301730 struct dm_table *map = dm_get_live_table_fast(md);
17311731 struct dm_target *ti;
1732− sector_t max_sectors, max_size = 0;
1732+ sector_t max_sectors;
1733+ int max_size = 0;
17331734
17341735 if (unlikely(!map))
17351736 goto out;
@@ -1742,18 +1743,10 @@ static int dm_merge_bvec(struct request_queue *q, · 6 unmodified lines
17421743 * Find maximum amount of I/O that won't need splitting
17431744 */
17441745 max_sectors = min(max_io_len(bvm->bi_sector, ti),
1745− (sector_t) queue_max_sectors(q));
1746+ (sector_t) BIO_MAX_SECTORS);
17461747 max_size = (max_sectors << SECTOR_SHIFT) - bvm->bi_size;
1747−
1748− /*
1749− * FIXME: this stop-gap fix _must_ be cleaned up (by passing a sector_t
1750− * to the targets' merge function since it holds sectors not bytes).
1751− * Just doing this as an interim fix for stable@ because the more
1752− * comprehensive cleanup of switching to sector_t will impact every
1753− * DM target that implements a ->merge hook.
1754− */
1755− if (max_size > INT_MAX)
1756− max_size = INT_MAX;
1748+ if (max_size < 0)
1749+ max_size = 0;
17571750
17581751 /*
17591752 * merge_bvec_fn() returns number of bytes
@@ -1761,13 +1754,13 @@ static int dm_merge_bvec(struct request_queue *q, · 1 unmodified line
17611754 * max is precomputed maximal io size
17621755 */
17631756 if (max_size && ti->type->merge)
1764− max_size = ti->type->merge(ti, bvm, biovec, (int) max_size);
1757+ max_size = ti->type->merge(ti, bvm, biovec, max_size);
17651758 /*
17661759 * If the target doesn't support merge method and some of the devices
1767− * provided their merge_bvec method (we know this by looking for the
1768− * max_hw_sectors that dm_set_device_limits may set), then we can't
1769− * allow bios with multiple vector entries. So always set max_size
1770− * to 0, and the code below allows just one page.
1760+ * provided their merge_bvec method (we know this by looking at
1761+ * queue_max_hw_sectors), then we can't allow bios with multiple vector
1762+ * entries. So always set max_size to 0, and the code below allows
1763+ * just one page.
17711764 */
17721765 else if (queue_max_hw_sectors(q) <= PAGE_SIZE >> 9)
17731766 max_size = 0;
drivers/md/md.c+1−1
@@ -5759,7 +5759,7 @@ static int get_bitmap_file(struct mddev *mddev, void __user * arg) · 5758 unmodified lines
57595759 char *ptr;
57605760 int err;
57615761
5762− file = kmalloc(sizeof(*file), GFP_NOIO);
5762+ file = kzalloc(sizeof(*file), GFP_NOIO);
57635763 if (!file)
57645764 return -ENOMEM;
57655765
drivers/md/persistent-data/dm-btree-internal.h+6−0
@@ -138,4 +138,10 @@ int lower_bound(struct btree_node *n, uint64_t key); · 137 unmodified lines
138138
139139 extern struct dm_block_validator btree_node_validator;
140140
141+/*
142+ * Value type for upper levels of multi-level btrees.
143+ */
144+extern void init_le64_type(struct dm_transaction_manager *tm,
145+ struct dm_btree_value_type *vt);
146+
141147 #endif /* DM_BTREE_INTERNAL_H */
drivers/md/persistent-data/dm-btree-remove.c+7−10
@@ -544,14 +544,6 @@ static int remove_raw(struct shadow_spine *s, struct dm_btree_info *info, · 543 unmodified lines
544544 return r;
545545 }
546546
547−static struct dm_btree_value_type le64_type = {
548− .context = NULL,
549− .size = sizeof(__le64),
550− .inc = NULL,
551− .dec = NULL,
552− .equal = NULL
553−};
554−
555547 int dm_btree_remove(struct dm_btree_info *info, dm_block_t root,
556548 uint64_t *keys, dm_block_t *new_root)
557549 {
@@ -559,12 +551,14 @@ int dm_btree_remove(struct dm_btree_info *info, dm_block_t root, · 1 unmodified line
559551 int index = 0, r = 0;
560552 struct shadow_spine spine;
561553 struct btree_node *n;
554+ struct dm_btree_value_type le64_vt;
562555
556+ init_le64_type(info->tm, &le64_vt);
563557 init_shadow_spine(&spine, info);
564558 for (level = 0; level < info->levels; level++) {
565559 r = remove_raw(&spine, info,
566560 (level == last_level ?
567− &info->value_type : &le64_type),
561+ &info->value_type : &le64_vt),
568562 root, keys[level], (unsigned *)&index);
569563 if (r < 0)
570564 break;
@@ -654,11 +648,13 @@ static int remove_one(struct dm_btree_info *info, dm_block_t root, · 83 unmodified lines
654648 int index = 0, r = 0;
655649 struct shadow_spine spine;
656650 struct btree_node *n;
651+ struct dm_btree_value_type le64_vt;
657652 uint64_t k;
658653
654+ init_le64_type(info->tm, &le64_vt);
659655 init_shadow_spine(&spine, info);
660656 for (level = 0; level < last_level; level++) {
661− r = remove_raw(&spine, info, &le64_type,
657+ r = remove_raw(&spine, info, &le64_vt,
662658 root, keys[level], (unsigned *) &index);
663659 if (r < 0)
664660 goto out;
@@ -689,6 +685,7 @@ static int remove_one(struct dm_btree_info *info, dm_block_t root, · 24 unmodified lines
689685 value_ptr(n, index));
690686
691687 delete_at(n, index);
688+ keys[last_level] = k + 1ull;
692689
693690 } else
694691 r = -ENODATA;
drivers/md/persistent-data/dm-btree-spine.c+37−0
@@ -249,3 +249,40 @@ int shadow_root(struct shadow_spine *s) · 248 unmodified lines
249249 {
250250 return s->root;
251251 }
252+
253+static void le64_inc(void *context, const void *value_le)
254+{
255+ struct dm_transaction_manager *tm = context;
256+ __le64 v_le;
257+
258+ memcpy(&v_le, value_le, sizeof(v_le));
259+ dm_tm_inc(tm, le64_to_cpu(v_le));
260+}
261+
262+static void le64_dec(void *context, const void *value_le)
263+{
264+ struct dm_transaction_manager *tm = context;
265+ __le64 v_le;
266+
267+ memcpy(&v_le, value_le, sizeof(v_le));
268+ dm_tm_dec(tm, le64_to_cpu(v_le));
269+}
270+
271+static int le64_equal(void *context, const void *value1_le, const void *value2_le)
272+{
273+ __le64 v1_le, v2_le;
274+
275+ memcpy(&v1_le, value1_le, sizeof(v1_le));
276+ memcpy(&v2_le, value2_le, sizeof(v2_le));
277+ return v1_le == v2_le;
278+}
279+
280+void init_le64_type(struct dm_transaction_manager *tm,
281+ struct dm_btree_value_type *vt)
282+{
283+ vt->context = tm;
284+ vt->size = sizeof(__le64);
285+ vt->inc = le64_inc;
286+ vt->dec = le64_dec;
287+ vt->equal = le64_equal;
288+}
drivers/md/persistent-data/dm-btree.c+1−6
@@ -667,12 +667,7 @@ static int insert(struct dm_btree_info *info, dm_block_t root, · 666 unmodified lines
667667 struct btree_node *n;
668668 struct dm_btree_value_type le64_type;
669669
670− le64_type.context = NULL;
671− le64_type.size = sizeof(__le64);
672− le64_type.inc = NULL;
673− le64_type.dec = NULL;
674− le64_type.equal = NULL;
675−
670+ init_le64_type(info->tm, &le64_type);
676671 init_shadow_spine(&spine, info);
677672
678673 for (level = 0; level < (info->levels - 1); level++) {
drivers/md/raid1.c+6−4
@@ -1476,6 +1476,7 @@ static void error(struct mddev *mddev, struct md_rdev *rdev) · 1475 unmodified lines
14761476 {
14771477 char b[BDEVNAME_SIZE];
14781478 struct r1conf *conf = mddev->private;
1479+ unsigned long flags;
14791480
14801481 /*
14811482 * If it is not operational, then we have already marked it as dead
@@ -1495,14 +1496,13 @@ static void error(struct mddev *mddev, struct md_rdev *rdev) · 13 unmodified lines
14951496 return;
14961497 }
14971498 set_bit(Blocked, &rdev->flags);
1499+ spin_lock_irqsave(&conf->device_lock, flags);
14981500 if (test_and_clear_bit(In_sync, &rdev->flags)) {
1499− unsigned long flags;
1500− spin_lock_irqsave(&conf->device_lock, flags);
15011501 mddev->degraded++;
15021502 set_bit(Faulty, &rdev->flags);
1503− spin_unlock_irqrestore(&conf->device_lock, flags);
15041503 } else
15051504 set_bit(Faulty, &rdev->flags);
1505+ spin_unlock_irqrestore(&conf->device_lock, flags);
15061506 /*
15071507 * if recovery is running, make sure it aborts.
15081508 */
@@ -1568,7 +1568,10 @@ static int raid1_spare_active(struct mddev *mddev) · 59 unmodified lines
15681568 * Find all failed disks within the RAID1 configuration
15691569 * and mark them readable.
15701570 * Called under mddev lock, so rcu protection not needed.
1571+ * device_lock used to avoid races with raid1_end_read_request
1572+ * which expects 'In_sync' flags and ->degraded to be consistent.
15711573 */
1574+ spin_lock_irqsave(&conf->device_lock, flags);
15721575 for (i = 0; i < conf->raid_disks; i++) {
15731576 struct md_rdev *rdev = conf->mirrors[i].rdev;
15741577 struct md_rdev *repl = conf->mirrors[conf->raid_disks + i].rdev;
@@ -1599,7 +1602,6 @@ static int raid1_spare_active(struct mddev *mddev) · 24 unmodified lines
15991602 sysfs_notify_dirent_safe(rdev->sysfs_state);
16001603 }
16011604 }
1602− spin_lock_irqsave(&conf->device_lock, flags);
16031605 mddev->degraded -= count;
16041606 spin_unlock_irqrestore(&conf->device_lock, flags);
16051607
drivers/md/raid5.c+3−2
@@ -2256,7 +2256,7 @@ static int resize_stripes(struct r5conf *conf, int newsize) · 2255 unmodified lines
22562256 static int drop_one_stripe(struct r5conf *conf)
22572257 {
22582258 struct stripe_head *sh;
2259− int hash = (conf->max_nr_stripes - 1) % NR_STRIPE_HASH_LOCKS;
2259+ int hash = (conf->max_nr_stripes - 1) & STRIPE_HASH_LOCKS_MASK;
22602260
22612261 spin_lock_irq(conf->hash_locks + hash);
22622262 sh = get_free_stripe(conf, hash);
@@ -6388,7 +6388,8 @@ static unsigned long raid5_cache_scan(struct shrinker *shrink, · 4125 unmodified lines
63886388
63896389 if (mutex_trylock(&conf->cache_size_mutex)) {
63906390 ret= 0;
6391− while (ret < sc->nr_to_scan) {
6391+ while (ret < sc->nr_to_scan &&
6392+ conf->max_nr_stripes > conf->min_nr_stripes) {
63926393 if (drop_one_stripe(conf) == 0) {
63936394 ret = SHRINK_STOP;
63946395 break;
drivers/mfd/Kconfig+1−1
@@ -115,7 +115,7 @@ config MFD_CROS_EC_I2C · 114 unmodified lines
115115
116116 config MFD_CROS_EC_SPI
117117 tristate "ChromeOS Embedded Controller (SPI)"
118− depends on MFD_CROS_EC && CROS_EC_PROTO && SPI && OF
118+ depends on MFD_CROS_EC && CROS_EC_PROTO && SPI
119119
120120 ---help---
121121 If you say Y here, you get support for talking to the ChromeOS EC
drivers/mfd/arizona-core.c+7−9
@@ -651,7 +651,7 @@ static int arizona_runtime_suspend(struct device *dev) · 650 unmodified lines
651651
652652 arizona->has_fully_powered_off = true;
653653
654− disable_irq(arizona->irq);
654+ disable_irq_nosync(arizona->irq);
655655 arizona_enable_reset(arizona);
656656 regulator_bulk_disable(arizona->num_core_supplies,
657657 arizona->core_supplies);
@@ -1141,10 +1141,6 @@ int arizona_dev_init(struct arizona *arizona) · 483 unmodified lines
11411141 arizona->pdata.gpio_defaults[i]);
11421142 }
11431143
1144− pm_runtime_set_autosuspend_delay(arizona->dev, 100);
1145− pm_runtime_use_autosuspend(arizona->dev);
1146− pm_runtime_enable(arizona->dev);
1147−
11481144 /* Chip default */
11491145 if (!arizona->pdata.clk32k_src)
11501146 arizona->pdata.clk32k_src = ARIZONA_32KZ_MCLK2;
@@ -1245,11 +1241,17 @@ int arizona_dev_init(struct arizona *arizona) · 94 unmodified lines
12451241 arizona->pdata.spk_fmt[i]);
12461242 }
12471243
1244+ pm_runtime_set_active(arizona->dev);
1245+ pm_runtime_enable(arizona->dev);
1246+
12481247 /* Set up for interrupts */
12491248 ret = arizona_irq_init(arizona);
12501249 if (ret != 0)
12511250 goto err_reset;
12521251
1252+ pm_runtime_set_autosuspend_delay(arizona->dev, 100);
1253+ pm_runtime_use_autosuspend(arizona->dev);
1254+
12531255 arizona_request_irq(arizona, ARIZONA_IRQ_CLKGEN_ERR, "CLKGEN error",
12541256 arizona_clkgen_err, arizona);
12551257 arizona_request_irq(arizona, ARIZONA_IRQ_OVERCLOCKED, "Overclocked",
@@ -1278,10 +1280,6 @@ int arizona_dev_init(struct arizona *arizona) · 22 unmodified lines
12781280 goto err_irq;
12791281 }
12801282
1281−#ifdef CONFIG_PM
1282− regulator_disable(arizona->dcvdd);
1283−#endif
1284−
12851283 return 0;
12861284
12871285 err_irq:
drivers/misc/eeprom/at24.c+0−3
@@ -438,9 +438,6 @@ static ssize_t at24_bin_write(struct file *filp, struct kobject *kobj, · 437 unmodified lines
438438 {
439439 struct at24_data *at24;
440440
441− if (unlikely(off >= attr->size))
442− return -EFBIG;
443−
444441 at24 = dev_get_drvdata(container_of(kobj, struct device, kobj));
445442 return at24_write(at24, buf, off, count);
446443 }
drivers/net/bonding/bond_main.c+1−0
@@ -786,6 +786,7 @@ static bool bond_should_notify_peers(struct bonding *bond) · 785 unmodified lines
786786 slave ? slave->dev->name : "NULL");
787787
788788 if (!slave || !bond->send_peer_notif ||
789+ !netif_carrier_ok(bond->dev) ||
789790 test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state))
790791 return false;
791792
drivers/net/ethernet/3com/3c59x.c+8−9
@@ -1763,16 +1763,9 @@ vortex_open(struct net_device *dev) · 1762 unmodified lines
17631763 vp->rx_ring[i].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, PKT_BUF_SZ, PCI_DMA_FROMDEVICE));
17641764 }
17651765 if (i != RX_RING_SIZE) {
1766− int j;
17671766 pr_emerg("%s: no memory for rx ring\n", dev->name);
1768− for (j = 0; j < i; j++) {
1769− if (vp->rx_skbuff[j]) {
1770− dev_kfree_skb(vp->rx_skbuff[j]);
1771− vp->rx_skbuff[j] = NULL;
1772− }
1773− }
17741767 retval = -ENOMEM;
1775− goto err_free_irq;
1768+ goto err_free_skb;
17761769 }
17771770 /* Wrap the ring. */
17781771 vp->rx_ring[i-1].next = cpu_to_le32(vp->rx_ring_dma);
@@ -1782,7 +1775,13 @@ vortex_open(struct net_device *dev) · 3 unmodified lines
17821775 if (!retval)
17831776 goto out;
17841777
1785−err_free_irq:
1778+err_free_skb:
1779+ for (i = 0; i < RX_RING_SIZE; i++) {
1780+ if (vp->rx_skbuff[i]) {
1781+ dev_kfree_skb(vp->rx_skbuff[i]);
1782+ vp->rx_skbuff[i] = NULL;
1783+ }
1784+ }
17861785 free_irq(dev->irq, dev);
17871786 err:
17881787 if (vortex_debug > 1)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c+1−1
@@ -264,9 +264,9 @@ static u16 bnx2x_free_tx_pkt(struct bnx2x *bp, struct bnx2x_fp_txdata *txdata, · 263 unmodified lines
264264 if (likely(skb)) {
265265 (*pkts_compl)++;
266266 (*bytes_compl) += skb->len;
267+ dev_kfree_skb_any(skb);
267268 }
268269
269− dev_kfree_skb_any(skb);
270270 tx_buf->first_bd = 0;
271271 tx_buf->skb = NULL;
272272
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c+16−0
@@ -1723,6 +1723,22 @@ static int bnx2x_nvram_write(struct bnx2x *bp, u32 offset, u8 *data_buf, · 1722 unmodified lines
17231723 offset += sizeof(u32);
17241724 data_buf += sizeof(u32);
17251725 written_so_far += sizeof(u32);
1726+
1727+ /* At end of each 4Kb page, release nvram lock to allow MFW
1728+ * chance to take it for its own use.
1729+ */
1730+ if ((cmd_flags & MCPR_NVM_COMMAND_LAST) &&
1731+ (written_so_far < buf_size)) {
1732+ DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
1733+ "Releasing NVM lock after offset 0x%x\n",
1734+ (u32)(offset - sizeof(u32)));
1735+ bnx2x_release_nvram_lock(bp);
1736+ usleep_range(1000, 2000);
1737+ rc = bnx2x_acquire_nvram_lock(bp);
1738+ if (rc)
1739+ return rc;
1740+ }
1741+
17261742 cmd_flags = 0;
17271743 }
17281744
drivers/net/ethernet/brocade/bna/bnad.c+1−1
@@ -676,6 +676,7 @@ bnad_cq_process(struct bnad *bnad, struct bna_ccb *ccb, int budget) · 675 unmodified lines
676676 if (!next_cmpl->valid)
677677 break;
678678 }
679+ packets++;
679680
680681 /* TODO: BNA_CQ_EF_LOCAL ? */
681682 if (unlikely(flags & (BNA_CQ_EF_MAC_ERROR |
@@ -692,7 +693,6 @@ bnad_cq_process(struct bnad *bnad, struct bna_ccb *ccb, int budget) · 10 unmodified lines
692693 else
693694 bnad_cq_setup_skb_frags(rcb, skb, sop_ci, nvecs, len);
694695
695− packets++;
696696 rcb->rxq->rx_packets++;
697697 rcb->rxq->rx_bytes += totlen;
698698 ccb->bytes_per_intr += totlen;
drivers/net/ethernet/cavium/Kconfig+0−3
@@ -16,7 +16,6 @@ if NET_VENDOR_CAVIUM · 15 unmodified lines
1616 config THUNDER_NIC_PF
1717 tristate "Thunder Physical function driver"
1818 depends on 64BIT
19− default ARCH_THUNDER
2019 select THUNDER_NIC_BGX
2120 ---help---
2221 This driver supports Thunder's NIC physical function.
@@ -29,14 +28,12 @@ config THUNDER_NIC_PF · 6 unmodified lines
2928 config THUNDER_NIC_VF
3029 tristate "Thunder Virtual function driver"
3130 depends on 64BIT
32− default ARCH_THUNDER
3331 ---help---
3432 This driver supports Thunder's NIC virtual function
3533
3634 config THUNDER_NIC_BGX
3735 tristate "Thunder MAC interface driver (BGX)"
3836 depends on 64BIT
39− default ARCH_THUNDER
4037 select PHYLIB
4138 select MDIO_OCTEON
4239 ---help---
drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c+2−1
@@ -2778,10 +2778,11 @@ int t4_setup_debugfs(struct adapter *adap) · 2777 unmodified lines
27782778 EXT_MEM1_SIZE_G(size));
27792779 }
27802780 } else {
2781− if (i & EXT_MEM_ENABLE_F)
2781+ if (i & EXT_MEM_ENABLE_F) {
27822782 size = t4_read_reg(adap, MA_EXT_MEMORY_BAR_A);
27832783 add_debugfs_mem(adap, "mc", MEM_MC,
27842784 EXT_MEM_SIZE_G(size));
2785+ }
27852786 }
27862787
27872788 de = debugfs_create_file_size("flash", S_IRUSR, adap->debugfs_root, adap,
drivers/net/ethernet/emulex/benet/be_cmds.h+5−0
@@ -620,6 +620,11 @@ enum be_if_flags { · 619 unmodified lines
620620 BE_IF_FLAGS_VLAN_PROMISCUOUS |\
621621 BE_IF_FLAGS_MCAST_PROMISCUOUS)
622622
623+#define BE_IF_EN_FLAGS (BE_IF_FLAGS_BROADCAST | BE_IF_FLAGS_PASS_L3L4_ERRORS |\
624+ BE_IF_FLAGS_MULTICAST | BE_IF_FLAGS_UNTAGGED)
625+
626+#define BE_IF_ALL_FILT_FLAGS (BE_IF_EN_FLAGS | BE_IF_FLAGS_ALL_PROMISCUOUS)
627+
623628 /* An RX interface is an object with one or more MAC addresses and
624629 * filtering capabilities. */
625630 struct be_cmd_req_if_create {
drivers/net/ethernet/emulex/benet/be_main.c+120−67
@@ -273,6 +273,10 @@ static int be_mac_addr_set(struct net_device *netdev, void *p) · 272 unmodified lines
273273 if (ether_addr_equal(addr->sa_data, netdev->dev_addr))
274274 return 0;
275275
276+ /* if device is not running, copy MAC to netdev->dev_addr */
277+ if (!netif_running(netdev))
278+ goto done;
279+
276280 /* The PMAC_ADD cmd may fail if the VF doesn't have FILTMGMT
277281 * privilege or if PF did not provision the new MAC address.
278282 * On BE3, this cmd will always fail if the VF doesn't have the
@@ -307,9 +311,9 @@ static int be_mac_addr_set(struct net_device *netdev, void *p) · 28 unmodified lines
307311 status = -EPERM;
308312 goto err;
309313 }
310−
311− memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
312− dev_info(dev, "MAC address changed to %pM\n", mac);
314+done:
315+ ether_addr_copy(netdev->dev_addr, addr->sa_data);
316+ dev_info(dev, "MAC address changed to %pM\n", addr->sa_data);
313317 return 0;
314318 err:
315319 dev_warn(dev, "MAC address change to %pM failed\n", addr->sa_data);
@@ -2452,10 +2456,24 @@ static void be_eq_clean(struct be_eq_obj *eqo) · 2136 unmodified lines
24522456 be_eq_notify(eqo->adapter, eqo->q.id, false, true, num, 0);
24532457 }
24542458
2455−static void be_rx_cq_clean(struct be_rx_obj *rxo)
2459+/* Free posted rx buffers that were not used */
2460+static void be_rxq_clean(struct be_rx_obj *rxo)
24562461 {
2457− struct be_rx_page_info *page_info;
24582462 struct be_queue_info *rxq = &rxo->q;
2463+ struct be_rx_page_info *page_info;
2464+
2465+ while (atomic_read(&rxq->used) > 0) {
2466+ page_info = get_rx_page_info(rxo);
2467+ put_page(page_info->page);
2468+ memset(page_info, 0, sizeof(*page_info));
2469+ }
2470+ BUG_ON(atomic_read(&rxq->used));
2471+ rxq->tail = 0;
2472+ rxq->head = 0;
2473+}
2474+
2475+static void be_rx_cq_clean(struct be_rx_obj *rxo)
2476+{
24592477 struct be_queue_info *rx_cq = &rxo->cq;
24602478 struct be_rx_compl_info *rxcp;
24612479 struct be_adapter *adapter = rxo->adapter;
@@ -2492,16 +2510,6 @@ static void be_rx_cq_clean(struct be_rx_obj *rxo) · 30 unmodified lines
24922510
24932511 /* After cleanup, leave the CQ in unarmed state */
24942512 be_cq_notify(adapter, rx_cq->id, false, 0);
2495−
2496− /* Then free posted rx buffers that were not used */
2497− while (atomic_read(&rxq->used) > 0) {
2498− page_info = get_rx_page_info(rxo);
2499− put_page(page_info->page);
2500− memset(page_info, 0, sizeof(*page_info));
2501− }
2502− BUG_ON(atomic_read(&rxq->used));
2503− rxq->tail = 0;
2504− rxq->head = 0;
25052513 }
25062514
25072515 static void be_tx_compl_clean(struct be_adapter *adapter)
@@ -2581,8 +2589,8 @@ static void be_evt_queues_destroy(struct be_adapter *adapter) · 73 unmodified lines
25812589 be_cmd_q_destroy(adapter, &eqo->q, QTYPE_EQ);
25822590 napi_hash_del(&eqo->napi);
25832591 netif_napi_del(&eqo->napi);
2592+ free_cpumask_var(eqo->affinity_mask);
25842593 }
2585− free_cpumask_var(eqo->affinity_mask);
25862594 be_queue_free(adapter, &eqo->q);
25872595 }
25882596 }
@@ -2599,13 +2607,7 @@ static int be_evt_queues_create(struct be_adapter *adapter) · 10 unmodified lines
25992607
26002608 for_all_evt_queues(adapter, eqo, i) {
26012609 int numa_node = dev_to_node(&adapter->pdev->dev);
2602− if (!zalloc_cpumask_var(&eqo->affinity_mask, GFP_KERNEL))
2603− return -ENOMEM;
2604− cpumask_set_cpu(cpumask_local_spread(i, numa_node),
2605− eqo->affinity_mask);
2606− netif_napi_add(adapter->netdev, &eqo->napi, be_poll,
2607− BE_NAPI_WEIGHT);
2608− napi_hash_add(&eqo->napi);
2610+
26092611 aic = &adapter->aic_obj[i];
26102612 eqo->adapter = adapter;
26112613 eqo->idx = i;
@@ -2621,6 +2623,14 @@ static int be_evt_queues_create(struct be_adapter *adapter) · 9 unmodified lines
26212623 rc = be_cmd_eq_create(adapter, eqo);
26222624 if (rc)
26232625 return rc;
2626+
2627+ if (!zalloc_cpumask_var(&eqo->affinity_mask, GFP_KERNEL))
2628+ return -ENOMEM;
2629+ cpumask_set_cpu(cpumask_local_spread(i, numa_node),
2630+ eqo->affinity_mask);
2631+ netif_napi_add(adapter->netdev, &eqo->napi, be_poll,
2632+ BE_NAPI_WEIGHT);
2633+ napi_hash_add(&eqo->napi);
26242634 }
26252635 return 0;
26262636 }
@@ -3359,13 +3369,54 @@ static void be_rx_qs_destroy(struct be_adapter *adapter) · 732 unmodified lines
33593369 for_all_rx_queues(adapter, rxo, i) {
33603370 q = &rxo->q;
33613371 if (q->created) {
3372+ /* If RXQs are destroyed while in an "out of buffer"
3373+ * state, there is a possibility of an HW stall on
3374+ * Lancer. So, post 64 buffers to each queue to relieve
3375+ * the "out of buffer" condition.
3376+ * Make sure there's space in the RXQ before posting.
3377+ */
3378+ if (lancer_chip(adapter)) {
3379+ be_rx_cq_clean(rxo);
3380+ if (atomic_read(&q->used) == 0)
3381+ be_post_rx_frags(rxo, GFP_KERNEL,
3382+ MAX_RX_POST);
3383+ }
3384+
33623385 be_cmd_rxq_destroy(adapter, q);
33633386 be_rx_cq_clean(rxo);
3387+ be_rxq_clean(rxo);
33643388 }
33653389 be_queue_free(adapter, q);
33663390 }
33673391 }
33683392
3393+static void be_disable_if_filters(struct be_adapter *adapter)
3394+{
3395+ be_cmd_pmac_del(adapter, adapter->if_handle,
3396+ adapter->pmac_id[0], 0);
3397+
3398+ be_clear_uc_list(adapter);
3399+
3400+ /* The IFACE flags are enabled in the open path and cleared
3401+ * in the close path. When a VF gets detached from the host and
3402+ * assigned to a VM the following happens:
3403+ * - VF's IFACE flags get cleared in the detach path
3404+ * - IFACE create is issued by the VF in the attach path
3405+ * Due to a bug in the BE3/Skyhawk-R FW
3406+ * (Lancer FW doesn't have the bug), the IFACE capability flags
3407+ * specified along with the IFACE create cmd issued by a VF are not
3408+ * honoured by FW. As a consequence, if a *new* driver
3409+ * (that enables/disables IFACE flags in open/close)
3410+ * is loaded in the host and an *old* driver is * used by a VM/VF,
3411+ * the IFACE gets created *without* the needed flags.
3412+ * To avoid this, disable RX-filter flags only for Lancer.
3413+ */
3414+ if (lancer_chip(adapter)) {
3415+ be_cmd_rx_filter(adapter, BE_IF_ALL_FILT_FLAGS, OFF);
3416+ adapter->if_flags &= ~BE_IF_ALL_FILT_FLAGS;
3417+ }
3418+}
3419+
33693420 static int be_close(struct net_device *netdev)
33703421 {
33713422 struct be_adapter *adapter = netdev_priv(netdev);
@@ -3378,6 +3429,8 @@ static int be_close(struct net_device *netdev) · 6 unmodified lines
33783429 if (!(adapter->flags & BE_FLAGS_SETUP_DONE))
33793430 return 0;
33803431
3432+ be_disable_if_filters(adapter);
3433+
33813434 be_roce_dev_close(adapter);
33823435
33833436 if (adapter->flags & BE_FLAGS_NAPI_ENABLED) {
@@ -3397,7 +3450,6 @@ static int be_close(struct net_device *netdev) · 13 unmodified lines
33973450 be_tx_compl_clean(adapter);
33983451
33993452 be_rx_qs_destroy(adapter);
3400− be_clear_uc_list(adapter);
34013453
34023454 for_all_evt_queues(adapter, eqo, i) {
34033455 if (msix_enabled(adapter))
@@ -3482,6 +3534,31 @@ static int be_rx_qs_create(struct be_adapter *adapter) · 78 unmodified lines
34823534 return 0;
34833535 }
34843536
3537+static int be_enable_if_filters(struct be_adapter *adapter)
3538+{
3539+ int status;
3540+
3541+ status = be_cmd_rx_filter(adapter, BE_IF_EN_FLAGS, ON);
3542+ if (status)
3543+ return status;
3544+
3545+ /* For BE3 VFs, the PF programs the initial MAC address */
3546+ if (!(BEx_chip(adapter) && be_virtfn(adapter))) {
3547+ status = be_cmd_pmac_add(adapter, adapter->netdev->dev_addr,
3548+ adapter->if_handle,
3549+ &adapter->pmac_id[0], 0);
3550+ if (status)
3551+ return status;
3552+ }
3553+
3554+ if (adapter->vlans_added)
3555+ be_vid_config(adapter);
3556+
3557+ be_set_rx_mode(adapter->netdev);
3558+
3559+ return 0;
3560+}
3561+
34853562 static int be_open(struct net_device *netdev)
34863563 {
34873564 struct be_adapter *adapter = netdev_priv(netdev);
@@ -3495,6 +3572,10 @@ static int be_open(struct net_device *netdev) · 7 unmodified lines
34953572 if (status)
34963573 goto err;
34973574
3575+ status = be_enable_if_filters(adapter);
3576+ if (status)
3577+ goto err;
3578+
34983579 status = be_irq_register(adapter);
34993580 if (status)
35003581 goto err;
@@ -3685,16 +3766,6 @@ static void be_cancel_err_detection(struct be_adapter *adapter) · 184 unmodified lines
36853766 }
36863767 }
36873768
3688−static void be_mac_clear(struct be_adapter *adapter)
3689−{
3690− if (adapter->pmac_id) {
3691− be_cmd_pmac_del(adapter, adapter->if_handle,
3692− adapter->pmac_id[0], 0);
3693− kfree(adapter->pmac_id);
3694− adapter->pmac_id = NULL;
3695− }
3696−}
3697−
36983769 #ifdef CONFIG_BE2NET_VXLAN
36993770 static void be_disable_vxlan_offloads(struct be_adapter *adapter)
37003771 {
@@ -3769,8 +3840,8 @@ static int be_clear(struct be_adapter *adapter) · 68 unmodified lines
37693840 #ifdef CONFIG_BE2NET_VXLAN
37703841 be_disable_vxlan_offloads(adapter);
37713842 #endif
3772− /* delete the primary mac along with the uc-mac list */
3773− be_mac_clear(adapter);
3843+ kfree(adapter->pmac_id);
3844+ adapter->pmac_id = NULL;
37743845
37753846 be_cmd_if_destroy(adapter, adapter->if_handle, 0);
37763847
@@ -3781,25 +3852,11 @@ static int be_clear(struct be_adapter *adapter) · 4 unmodified lines
37813852 return 0;
37823853 }
37833854
3784−static int be_if_create(struct be_adapter *adapter, u32 *if_handle,
3785− u32 cap_flags, u32 vf)
3786−{
3787− u32 en_flags;
3788−
3789− en_flags = BE_IF_FLAGS_UNTAGGED | BE_IF_FLAGS_BROADCAST |
3790− BE_IF_FLAGS_MULTICAST | BE_IF_FLAGS_PASS_L3L4_ERRORS |
3791− BE_IF_FLAGS_RSS | BE_IF_FLAGS_DEFQ_RSS;
3792−
3793− en_flags &= cap_flags;
3794−
3795− return be_cmd_if_create(adapter, cap_flags, en_flags, if_handle, vf);
3796−}
3797−
37983855 static int be_vfs_if_create(struct be_adapter *adapter)
37993856 {
38003857 struct be_resources res = {0};
3858+ u32 cap_flags, en_flags, vf;
38013859 struct be_vf_cfg *vf_cfg;
3802− u32 cap_flags, vf;
38033860 int status;
38043861
38053862 /* If a FW profile exists, then cap_flags are updated */
@@ -3820,8 +3877,12 @@ static int be_vfs_if_create(struct be_adapter *adapter) · 14 unmodified lines
38203877 }
38213878 }
38223879
3823− status = be_if_create(adapter, &vf_cfg->if_handle,
3824− cap_flags, vf + 1);
3880+ en_flags = cap_flags & (BE_IF_FLAGS_UNTAGGED |
3881+ BE_IF_FLAGS_BROADCAST |
3882+ BE_IF_FLAGS_MULTICAST |
3883+ BE_IF_FLAGS_PASS_L3L4_ERRORS);
3884+ status = be_cmd_if_create(adapter, cap_flags, en_flags,
3885+ &vf_cfg->if_handle, vf + 1);
38253886 if (status)
38263887 return status;
38273888 }
@@ -4193,15 +4254,8 @@ static int be_mac_setup(struct be_adapter *adapter) · 365 unmodified lines
41934254
41944255 memcpy(adapter->netdev->dev_addr, mac, ETH_ALEN);
41954256 memcpy(adapter->netdev->perm_addr, mac, ETH_ALEN);
4196− } else {
4197− /* Maybe the HW was reset; dev_addr must be re-programmed */
4198− memcpy(mac, adapter->netdev->dev_addr, ETH_ALEN);
41994257 }
42004258
4201− /* For BE3-R VFs, the PF programs the initial MAC address */
4202− if (!(BEx_chip(adapter) && be_virtfn(adapter)))
4203− be_cmd_pmac_add(adapter, mac, adapter->if_handle,
4204− &adapter->pmac_id[0], 0);
42054259 return 0;
42064260 }
42074261
@@ -4341,6 +4395,7 @@ static int be_func_init(struct be_adapter *adapter) · 133 unmodified lines
43414395 static int be_setup(struct be_adapter *adapter)
43424396 {
43434397 struct device *dev = &adapter->pdev->dev;
4398+ u32 en_flags;
43444399 int status;
43454400
43464401 status = be_func_init(adapter);
@@ -4363,8 +4418,11 @@ static int be_setup(struct be_adapter *adapter) · 16 unmodified lines
43634418 if (status)
43644419 goto err;
43654420
4366− status = be_if_create(adapter, &adapter->if_handle,
4367− be_if_cap_flags(adapter), 0);
4421+ /* will enable all the needed filter flags in be_open() */
4422+ en_flags = BE_IF_FLAGS_RSS | BE_IF_FLAGS_DEFQ_RSS;
4423+ en_flags = en_flags & be_if_cap_flags(adapter);
4424+ status = be_cmd_if_create(adapter, be_if_cap_flags(adapter), en_flags,
4425+ &adapter->if_handle, 0);
43684426 if (status)
43694427 goto err;
43704428
@@ -4390,11 +4448,6 @@ static int be_setup(struct be_adapter *adapter) · 19 unmodified lines
43904448 dev_err(dev, "Please upgrade firmware to version >= 4.0\n");
43914449 }
43924450
4393− if (adapter->vlans_added)
4394− be_vid_config(adapter);
4395−
4396− be_set_rx_mode(adapter->netdev);
4397−
43984451 status = be_cmd_set_flow_control(adapter, adapter->tx_fc,
43994452 adapter->rx_fc);
44004453 if (status)
drivers/net/ethernet/freescale/fec_main.c+1−0
@@ -3438,6 +3438,7 @@ fec_probe(struct platform_device *pdev) · 3437 unmodified lines
34383438
34393439 pm_runtime_set_autosuspend_delay(&pdev->dev, FEC_MDIO_PM_TIMEOUT);
34403440 pm_runtime_use_autosuspend(&pdev->dev);
3441+ pm_runtime_get_noresume(&pdev->dev);
34413442 pm_runtime_set_active(&pdev->dev);
34423443 pm_runtime_enable(&pdev->dev);
34433444
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c+2−1
@@ -586,7 +586,8 @@ static int fs_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) · 585 unmodified lines
586586 frag = skb_shinfo(skb)->frags;
587587 while (nr_frags) {
588588 CBDC_SC(bdp,
589− BD_ENET_TX_STATS | BD_ENET_TX_LAST | BD_ENET_TX_TC);
589+ BD_ENET_TX_STATS | BD_ENET_TX_INTR | BD_ENET_TX_LAST |
590+ BD_ENET_TX_TC);
590591 CBDS_SC(bdp, BD_ENET_TX_READY);
591592
592593 if ((CBDR_SC(bdp) & BD_ENET_TX_WRAP) == 0)
drivers/net/ethernet/freescale/fs_enet/mac-fec.c+1−1
@@ -110,7 +110,7 @@ static int do_pd_setup(struct fs_enet_private *fep) · 109 unmodified lines
110110 }
111111
112112 #define FEC_NAPI_RX_EVENT_MSK (FEC_ENET_RXF | FEC_ENET_RXB)
113−#define FEC_NAPI_TX_EVENT_MSK (FEC_ENET_TXF | FEC_ENET_TXB)
113+#define FEC_NAPI_TX_EVENT_MSK (FEC_ENET_TXF)
114114 #define FEC_RX_EVENT (FEC_ENET_RXF)
115115 #define FEC_TX_EVENT (FEC_ENET_TXF)
116116 #define FEC_ERR_EVENT_MSK (FEC_ENET_HBERR | FEC_ENET_BABR | \
drivers/net/ethernet/freescale/gianfar_ethtool.c+4−341
@@ -902,27 +902,6 @@ static int gfar_check_filer_hardware(struct gfar_private *priv) · 901 unmodified lines
902902 return 0;
903903 }
904904
905−static int gfar_comp_asc(const void *a, const void *b)
906−{
907− return memcmp(a, b, 4);
908−}
909−
910−static int gfar_comp_desc(const void *a, const void *b)
911−{
912− return -memcmp(a, b, 4);
913−}
914−
915−static void gfar_swap(void *a, void *b, int size)
916−{
917− u32 *_a = a;
918− u32 *_b = b;
919−
920− swap(_a[0], _b[0]);
921− swap(_a[1], _b[1]);
922− swap(_a[2], _b[2]);
923− swap(_a[3], _b[3]);
924−}
925−
926905 /* Write a mask to filer cache */
927906 static void gfar_set_mask(u32 mask, struct filer_table *tab)
928907 {
@@ -1272,310 +1251,6 @@ static int gfar_convert_to_filer(struct ethtool_rx_flow_spec *rule, · 343 unmodified lines
12721251 return 0;
12731252 }
12741253
1275−/* Copy size filer entries */
1276−static void gfar_copy_filer_entries(struct gfar_filer_entry dst[0],
1277− struct gfar_filer_entry src[0], s32 size)
1278−{
1279− while (size > 0) {
1280− size--;
1281− dst[size].ctrl = src[size].ctrl;
1282− dst[size].prop = src[size].prop;
1283− }
1284−}
1285−
1286−/* Delete the contents of the filer-table between start and end
1287− * and collapse them
1288− */
1289−static int gfar_trim_filer_entries(u32 begin, u32 end, struct filer_table *tab)
1290−{
1291− int length;
1292−
1293− if (end > MAX_FILER_CACHE_IDX || end < begin)
1294− return -EINVAL;
1295−
1296− end++;
1297− length = end - begin;
1298−
1299− /* Copy */
1300− while (end < tab->index) {
1301− tab->fe[begin].ctrl = tab->fe[end].ctrl;
1302− tab->fe[begin++].prop = tab->fe[end++].prop;
1303−
1304− }
1305− /* Fill up with don't cares */
1306− while (begin < tab->index) {
1307− tab->fe[begin].ctrl = 0x60;
1308− tab->fe[begin].prop = 0xFFFFFFFF;
1309− begin++;
1310− }
1311−
1312− tab->index -= length;
1313− return 0;
1314−}
1315−
1316−/* Make space on the wanted location */
1317−static int gfar_expand_filer_entries(u32 begin, u32 length,
1318− struct filer_table *tab)
1319−{
1320− if (length == 0 || length + tab->index > MAX_FILER_CACHE_IDX ||
1321− begin > MAX_FILER_CACHE_IDX)
1322− return -EINVAL;
1323−
1324− gfar_copy_filer_entries(&(tab->fe[begin + length]), &(tab->fe[begin]),
1325− tab->index - length + 1);
1326−
1327− tab->index += length;
1328− return 0;
1329−}
1330−
1331−static int gfar_get_next_cluster_start(int start, struct filer_table *tab)
1332−{
1333− for (; (start < tab->index) && (start < MAX_FILER_CACHE_IDX - 1);
1334− start++) {
1335− if ((tab->fe[start].ctrl & (RQFCR_AND | RQFCR_CLE)) ==
1336− (RQFCR_AND | RQFCR_CLE))
1337− return start;
1338− }
1339− return -1;
1340−}
1341−
1342−static int gfar_get_next_cluster_end(int start, struct filer_table *tab)
1343−{
1344− for (; (start < tab->index) && (start < MAX_FILER_CACHE_IDX - 1);
1345− start++) {
1346− if ((tab->fe[start].ctrl & (RQFCR_AND | RQFCR_CLE)) ==
1347− (RQFCR_CLE))
1348− return start;
1349− }
1350− return -1;
1351−}
1352−
1353−/* Uses hardwares clustering option to reduce
1354− * the number of filer table entries
1355− */
1356−static void gfar_cluster_filer(struct filer_table *tab)
1357−{
1358− s32 i = -1, j, iend, jend;
1359−
1360− while ((i = gfar_get_next_cluster_start(++i, tab)) != -1) {
1361− j = i;
1362− while ((j = gfar_get_next_cluster_start(++j, tab)) != -1) {
1363− /* The cluster entries self and the previous one
1364− * (a mask) must be identical!
1365− */
1366− if (tab->fe[i].ctrl != tab->fe[j].ctrl)
1367− break;
1368− if (tab->fe[i].prop != tab->fe[j].prop)
1369− break;
1370− if (tab->fe[i - 1].ctrl != tab->fe[j - 1].ctrl)
1371− break;
1372− if (tab->fe[i - 1].prop != tab->fe[j - 1].prop)
1373− break;
1374− iend = gfar_get_next_cluster_end(i, tab);
1375− jend = gfar_get_next_cluster_end(j, tab);
1376− if (jend == -1 || iend == -1)
1377− break;
1378−
1379− /* First we make some free space, where our cluster
1380− * element should be. Then we copy it there and finally
1381− * delete in from its old location.
1382− */
1383− if (gfar_expand_filer_entries(iend, (jend - j), tab) ==
1384− -EINVAL)
1385− break;
1386−
1387− gfar_copy_filer_entries(&(tab->fe[iend + 1]),
1388− &(tab->fe[jend + 1]), jend - j);
1389−
1390− if (gfar_trim_filer_entries(jend - 1,
1391− jend + (jend - j),
1392− tab) == -EINVAL)
1393− return;
1394−
1395− /* Mask out cluster bit */
1396− tab->fe[iend].ctrl &= ~(RQFCR_CLE);
1397− }
1398− }
1399−}
1400−
1401−/* Swaps the masked bits of a1<>a2 and b1<>b2 */
1402−static void gfar_swap_bits(struct gfar_filer_entry *a1,
1403− struct gfar_filer_entry *a2,
1404− struct gfar_filer_entry *b1,
1405− struct gfar_filer_entry *b2, u32 mask)
1406−{
1407− u32 temp[4];
1408− temp[0] = a1->ctrl & mask;
1409− temp[1] = a2->ctrl & mask;
1410− temp[2] = b1->ctrl & mask;
1411− temp[3] = b2->ctrl & mask;
1412−
1413− a1->ctrl &= ~mask;
1414− a2->ctrl &= ~mask;
1415− b1->ctrl &= ~mask;
1416− b2->ctrl &= ~mask;
1417−
1418− a1->ctrl |= temp[1];
1419− a2->ctrl |= temp[0];
1420− b1->ctrl |= temp[3];
1421− b2->ctrl |= temp[2];
1422−}
1423−
1424−/* Generate a list consisting of masks values with their start and
1425− * end of validity and block as indicator for parts belonging
1426− * together (glued by ANDs) in mask_table
1427− */
1428−static u32 gfar_generate_mask_table(struct gfar_mask_entry *mask_table,
1429− struct filer_table *tab)
1430−{
1431− u32 i, and_index = 0, block_index = 1;
1432−
1433− for (i = 0; i < tab->index; i++) {
1434−
1435− /* LSByte of control = 0 sets a mask */
1436− if (!(tab->fe[i].ctrl & 0xF)) {
1437− mask_table[and_index].mask = tab->fe[i].prop;
1438− mask_table[and_index].start = i;
1439− mask_table[and_index].block = block_index;
1440− if (and_index >= 1)
1441− mask_table[and_index - 1].end = i - 1;
1442− and_index++;
1443− }
1444− /* cluster starts and ends will be separated because they should
1445− * hold their position
1446− */
1447− if (tab->fe[i].ctrl & RQFCR_CLE)
1448− block_index++;
1449− /* A not set AND indicates the end of a depended block */
1450− if (!(tab->fe[i].ctrl & RQFCR_AND))
1451− block_index++;
1452− }
1453−
1454− mask_table[and_index - 1].end = i - 1;
1455−
1456− return and_index;
1457−}
1458−
1459−/* Sorts the entries of mask_table by the values of the masks.
1460− * Important: The 0xFF80 flags of the first and last entry of a
1461− * block must hold their position (which queue, CLusterEnable, ReJEct,
1462− * AND)
1463− */
1464−static void gfar_sort_mask_table(struct gfar_mask_entry *mask_table,
1465− struct filer_table *temp_table, u32 and_index)
1466−{
1467− /* Pointer to compare function (_asc or _desc) */
1468− int (*gfar_comp)(const void *, const void *);
1469−
1470− u32 i, size = 0, start = 0, prev = 1;
1471− u32 old_first, old_last, new_first, new_last;
1472−
1473− gfar_comp = &gfar_comp_desc;
1474−
1475− for (i = 0; i < and_index; i++) {
1476− if (prev != mask_table[i].block) {
1477− old_first = mask_table[start].start + 1;
1478− old_last = mask_table[i - 1].end;
1479− sort(mask_table + start, size,
1480− sizeof(struct gfar_mask_entry),
1481− gfar_comp, &gfar_swap);
1482−
1483− /* Toggle order for every block. This makes the
1484− * thing more efficient!
1485− */
1486− if (gfar_comp == gfar_comp_desc)
1487− gfar_comp = &gfar_comp_asc;
1488− else
1489− gfar_comp = &gfar_comp_desc;
1490−
1491− new_first = mask_table[start].start + 1;
1492− new_last = mask_table[i - 1].end;
1493−
1494− gfar_swap_bits(&temp_table->fe[new_first],
1495− &temp_table->fe[old_first],
1496− &temp_table->fe[new_last],
1497− &temp_table->fe[old_last],
1498− RQFCR_QUEUE | RQFCR_CLE |
1499− RQFCR_RJE | RQFCR_AND);
1500−
1501− start = i;
1502− size = 0;
1503− }
1504− size++;
1505− prev = mask_table[i].block;
1506− }
1507−}
1508−
1509−/* Reduces the number of masks needed in the filer table to save entries
1510− * This is done by sorting the masks of a depended block. A depended block is
1511− * identified by gluing ANDs or CLE. The sorting order toggles after every
1512− * block. Of course entries in scope of a mask must change their location with
1513− * it.
1514− */
1515−static int gfar_optimize_filer_masks(struct filer_table *tab)
1516−{
1517− struct filer_table *temp_table;
1518− struct gfar_mask_entry *mask_table;
1519−
1520− u32 and_index = 0, previous_mask = 0, i = 0, j = 0, size = 0;
1521− s32 ret = 0;
1522−
1523− /* We need a copy of the filer table because
1524− * we want to change its order
1525− */
1526− temp_table = kmemdup(tab, sizeof(*temp_table), GFP_KERNEL);
1527− if (temp_table == NULL)
1528− return -ENOMEM;
1529−
1530− mask_table = kcalloc(MAX_FILER_CACHE_IDX / 2 + 1,
1531− sizeof(struct gfar_mask_entry), GFP_KERNEL);
1532−
1533− if (mask_table == NULL) {
1534− ret = -ENOMEM;
1535− goto end;
1536− }
1537−
1538− and_index = gfar_generate_mask_table(mask_table, tab);
1539−
1540− gfar_sort_mask_table(mask_table, temp_table, and_index);
1541−
1542− /* Now we can copy the data from our duplicated filer table to
1543− * the real one in the order the mask table says
1544− */
1545− for (i = 0; i < and_index; i++) {
1546− size = mask_table[i].end - mask_table[i].start + 1;
1547− gfar_copy_filer_entries(&(tab->fe[j]),
1548− &(temp_table->fe[mask_table[i].start]), size);
1549− j += size;
1550− }
1551−
1552− /* And finally we just have to check for duplicated masks and drop the
1553− * second ones
1554− */
1555− for (i = 0; i < tab->index && i < MAX_FILER_CACHE_IDX; i++) {
1556− if (tab->fe[i].ctrl == 0x80) {
1557− previous_mask = i++;
1558− break;
1559− }
1560− }
1561− for (; i < tab->index && i < MAX_FILER_CACHE_IDX; i++) {
1562− if (tab->fe[i].ctrl == 0x80) {
1563− if (tab->fe[i].prop == tab->fe[previous_mask].prop) {
1564− /* Two identical ones found!
1565− * So drop the second one!
1566− */
1567− gfar_trim_filer_entries(i, i, tab);
1568− } else
1569− /* Not identical! */
1570− previous_mask = i;
1571− }
1572− }
1573−
1574− kfree(mask_table);
1575−end: kfree(temp_table);
1576− return ret;
1577−}
1578−
15791254 /* Write the bit-pattern from software's buffer to hardware registers */
15801255 static int gfar_write_filer_table(struct gfar_private *priv,
15811256 struct filer_table *tab)
@@ -1585,11 +1260,10 @@ static int gfar_write_filer_table(struct gfar_private *priv, · 3 unmodified lines
15851260 return -EBUSY;
15861261
15871262 /* Fill regular entries */
1588− for (; i < MAX_FILER_IDX - 1 && (tab->fe[i].ctrl | tab->fe[i].prop);
1589− i++)
1263+ for (; i < MAX_FILER_IDX && (tab->fe[i].ctrl | tab->fe[i].prop); i++)
15901264 gfar_write_filer(priv, i, tab->fe[i].ctrl, tab->fe[i].prop);
15911265 /* Fill the rest with fall-troughs */
1592− for (; i < MAX_FILER_IDX - 1; i++)
1266+ for (; i < MAX_FILER_IDX; i++)
15931267 gfar_write_filer(priv, i, 0x60, 0xFFFFFFFF);
15941268 /* Last entry must be default accept
15951269 * because that's what people expect
@@ -1623,7 +1297,6 @@ static int gfar_process_filer_changes(struct gfar_private *priv) · 27 unmodified lines
16231297 {
16241298 struct ethtool_flow_spec_container *j;
16251299 struct filer_table *tab;
1626− s32 i = 0;
16271300 s32 ret = 0;
16281301
16291302 /* So index is set to zero, too! */
@@ -1648,17 +1321,6 @@ static int gfar_process_filer_changes(struct gfar_private *priv) · 18 unmodified lines
16481321 }
16491322 }
16501323
1651− i = tab->index;
1652−
1653− /* Optimizations to save entries */
1654− gfar_cluster_filer(tab);
1655− gfar_optimize_filer_masks(tab);
1656−
1657− pr_debug("\tSummary:\n"
1658− "\tData on hardware: %d\n"
1659− "\tCompression rate: %d%%\n",
1660− tab->index, 100 - (100 * tab->index) / i);
1661−
16621324 /* Write everything to hardware */
16631325 ret = gfar_write_filer_table(priv, tab);
16641326 if (ret == -EBUSY) {
@@ -1724,13 +1386,14 @@ static int gfar_add_cls(struct gfar_private *priv, · 59 unmodified lines
17241386 }
17251387
17261388 process:
1389+ priv->rx_list.count++;
17271390 ret = gfar_process_filer_changes(priv);
17281391 if (ret)
17291392 goto clean_list;
1730− priv->rx_list.count++;
17311393 return ret;
17321394
17331395 clean_list:
1396+ priv->rx_list.count--;
17341397 list_del(&temp->list);
17351398 clean_mem:
17361399 kfree(temp);
drivers/net/ethernet/marvell/mvpp2.c+167−77
@@ -27,6 +27,8 @@ · 26 unmodified lines
2727 #include <linux/of_address.h>
2828 #include <linux/phy.h>
2929 #include <linux/clk.h>
30+#include <linux/hrtimer.h>
31+#include <linux/ktime.h>
3032 #include <uapi/linux/ppp_defs.h>
3133 #include <net/ip.h>
3234 #include <net/ipv6.h>
@@ -299,6 +301,7 @@ · 266 unmodified lines
299301
300302 /* Coalescing */
301303 #define MVPP2_TXDONE_COAL_PKTS_THRESH 15
304+#define MVPP2_TXDONE_HRTIMER_PERIOD_NS 1000000UL
302305 #define MVPP2_RX_COAL_PKTS 32
303306 #define MVPP2_RX_COAL_USEC 100
304307
@@ -660,6 +663,14 @@ struct mvpp2_pcpu_stats { · 355 unmodified lines
660663 u64 tx_bytes;
661664 };
662665
666+/* Per-CPU port control */
667+struct mvpp2_port_pcpu {
668+ struct hrtimer tx_done_timer;
669+ bool timer_scheduled;
670+ /* Tasklet for egress finalization */
671+ struct tasklet_struct tx_done_tasklet;
672+};
673+
663674 struct mvpp2_port {
664675 u8 id;
665676
@@ -679,6 +690,9 @@ struct mvpp2_port { · 13 unmodified lines
679690 u32 pending_cause_rx;
680691 struct napi_struct napi;
681692
693+ /* Per-CPU port control */
694+ struct mvpp2_port_pcpu __percpu *pcpu;
695+
682696 /* Flags */
683697 unsigned long flags;
684698
@@ -776,6 +790,9 @@ struct mvpp2_txq_pcpu { · 91 unmodified lines
776790 /* Array of transmitted skb */
777791 struct sk_buff **tx_skb;
778792
793+ /* Array of transmitted buffers' physical addresses */
794+ dma_addr_t *tx_buffs;
795+
779796 /* Index of last TX DMA descriptor that was inserted */
780797 int txq_put_index;
781798
@@ -913,8 +930,6 @@ struct mvpp2_bm_pool { · 131 unmodified lines
913930 /* Occupied buffers indicator */
914931 atomic_t in_use;
915932 int in_use_thresh;
916−
917− spinlock_t lock;
918933 };
919934
920935 struct mvpp2_buff_hdr {
@@ -963,9 +978,13 @@ static void mvpp2_txq_inc_get(struct mvpp2_txq_pcpu *txq_pcpu) · 42 unmodified lines
963978 }
964979
965980 static void mvpp2_txq_inc_put(struct mvpp2_txq_pcpu *txq_pcpu,
966− struct sk_buff *skb)
981+ struct sk_buff *skb,
982+ struct mvpp2_tx_desc *tx_desc)
967983 {
968984 txq_pcpu->tx_skb[txq_pcpu->txq_put_index] = skb;
985+ if (skb)
986+ txq_pcpu->tx_buffs[txq_pcpu->txq_put_index] =
987+ tx_desc->buf_phys_addr;
969988 txq_pcpu->txq_put_index++;
970989 if (txq_pcpu->txq_put_index == txq_pcpu->size)
971990 txq_pcpu->txq_put_index = 0;
@@ -3376,7 +3395,6 @@ static int mvpp2_bm_pool_create(struct platform_device *pdev, · 2404 unmodified lines
33763395 bm_pool->pkt_size = 0;
33773396 bm_pool->buf_num = 0;
33783397 atomic_set(&bm_pool->in_use, 0);
3379− spin_lock_init(&bm_pool->lock);
33803398
33813399 return 0;
33823400 }
@@ -3647,7 +3665,6 @@ static struct mvpp2_bm_pool * · 264 unmodified lines
36473665 mvpp2_bm_pool_use(struct mvpp2_port *port, int pool, enum mvpp2_bm_type type,
36483666 int pkt_size)
36493667 {
3650− unsigned long flags = 0;
36513668 struct mvpp2_bm_pool *new_pool = &port->priv->bm_pools[pool];
36523669 int num;
36533670
@@ -3656,8 +3673,6 @@ mvpp2_bm_pool_use(struct mvpp2_port *port, int pool, enum mvpp2_bm_type type, · 2 unmodified lines
36563673 return NULL;
36573674 }
36583675
3659− spin_lock_irqsave(&new_pool->lock, flags);
3660−
36613676 if (new_pool->type == MVPP2_BM_FREE)
36623677 new_pool->type = type;
36633678
@@ -3686,8 +3701,6 @@ mvpp2_bm_pool_use(struct mvpp2_port *port, int pool, enum mvpp2_bm_type type, · 22 unmodified lines
36863701 if (num != pkts_num) {
36873702 WARN(1, "pool %d: %d of %d allocated\n",
36883703 new_pool->id, num, pkts_num);
3689− /* We need to undo the bufs_add() allocations */
3690− spin_unlock_irqrestore(&new_pool->lock, flags);
36913704 return NULL;
36923705 }
36933706 }
@@ -3695,15 +3708,12 @@ mvpp2_bm_pool_use(struct mvpp2_port *port, int pool, enum mvpp2_bm_type type, · 1 unmodified line
36953708 mvpp2_bm_pool_bufsize_set(port->priv, new_pool,
36963709 MVPP2_RX_BUF_SIZE(new_pool->pkt_size));
36973710
3698− spin_unlock_irqrestore(&new_pool->lock, flags);
3699−
37003711 return new_pool;
37013712 }
37023713
37033714 /* Initialize pools for swf */
37043715 static int mvpp2_swf_bm_pool_init(struct mvpp2_port *port)
37053716 {
3706− unsigned long flags = 0;
37073717 int rxq;
37083718
37093719 if (!port->pool_long) {
@@ -3714,9 +3724,7 @@ static int mvpp2_swf_bm_pool_init(struct mvpp2_port *port) · 4 unmodified lines
37143724 if (!port->pool_long)
37153725 return -ENOMEM;
37163726
3717− spin_lock_irqsave(&port->pool_long->lock, flags);
37183727 port->pool_long->port_map |= (1 << port->id);
3719− spin_unlock_irqrestore(&port->pool_long->lock, flags);
37203728
37213729 for (rxq = 0; rxq < rxq_number; rxq++)
37223730 mvpp2_rxq_long_pool_set(port, rxq, port->pool_long->id);
@@ -3730,9 +3738,7 @@ static int mvpp2_swf_bm_pool_init(struct mvpp2_port *port) · 7 unmodified lines
37303738 if (!port->pool_short)
37313739 return -ENOMEM;
37323740
3733− spin_lock_irqsave(&port->pool_short->lock, flags);
37343741 port->pool_short->port_map |= (1 << port->id);
3735− spin_unlock_irqrestore(&port->pool_short->lock, flags);
37363742
37373743 for (rxq = 0; rxq < rxq_number; rxq++)
37383744 mvpp2_rxq_short_pool_set(port, rxq,
@@ -3806,7 +3812,6 @@ static void mvpp2_interrupts_unmask(void *arg) · 67 unmodified lines
38063812
38073813 mvpp2_write(port->priv, MVPP2_ISR_RX_TX_MASK_REG(port->id),
38083814 (MVPP2_CAUSE_MISC_SUM_MASK |
3809− MVPP2_CAUSE_TXQ_OCCUP_DESC_ALL_MASK |
38103815 MVPP2_CAUSE_RXQ_OCCUP_DESC_ALL_MASK));
38113816 }
38123817
@@ -4382,23 +4387,6 @@ static void mvpp2_rx_time_coal_set(struct mvpp2_port *port, · 569 unmodified lines
43824387 rxq->time_coal = usec;
43834388 }
43844389
4385−/* Set threshold for TX_DONE pkts coalescing */
4386−static void mvpp2_tx_done_pkts_coal_set(void *arg)
4387−{
4388− struct mvpp2_port *port = arg;
4389− int queue;
4390− u32 val;
4391−
4392− for (queue = 0; queue < txq_number; queue++) {
4393− struct mvpp2_tx_queue *txq = port->txqs[queue];
4394−
4395− val = (txq->done_pkts_coal << MVPP2_TRANSMITTED_THRESH_OFFSET) &
4396− MVPP2_TRANSMITTED_THRESH_MASK;
4397− mvpp2_write(port->priv, MVPP2_TXQ_NUM_REG, txq->id);
4398− mvpp2_write(port->priv, MVPP2_TXQ_THRESH_REG, val);
4399− }
4400−}
4401−
44024390 /* Free Tx queue skbuffs */
44034391 static void mvpp2_txq_bufs_free(struct mvpp2_port *port,
44044392 struct mvpp2_tx_queue *txq,
@@ -4407,8 +4395,8 @@ static void mvpp2_txq_bufs_free(struct mvpp2_port *port, · 2 unmodified lines
44074395 int i;
44084396
44094397 for (i = 0; i < num; i++) {
4410− struct mvpp2_tx_desc *tx_desc = txq->descs +
4411− txq_pcpu->txq_get_index;
4398+ dma_addr_t buf_phys_addr =
4399+ txq_pcpu->tx_buffs[txq_pcpu->txq_get_index];
44124400 struct sk_buff *skb = txq_pcpu->tx_skb[txq_pcpu->txq_get_index];
44134401
44144402 mvpp2_txq_inc_get(txq_pcpu);
@@ -4416,8 +4404,8 @@ static void mvpp2_txq_bufs_free(struct mvpp2_port *port, · 1 unmodified line
44164404 if (!skb)
44174405 continue;
44184406
4419− dma_unmap_single(port->dev->dev.parent, tx_desc->buf_phys_addr,
4420− tx_desc->data_size, DMA_TO_DEVICE);
4407+ dma_unmap_single(port->dev->dev.parent, buf_phys_addr,
4408+ skb_headlen(skb), DMA_TO_DEVICE);
44214409 dev_kfree_skb_any(skb);
44224410 }
44234411 }
@@ -4433,7 +4421,7 @@ static inline struct mvpp2_rx_queue *mvpp2_get_rx_queue(struct mvpp2_port *port, · 9 unmodified lines
44334421 static inline struct mvpp2_tx_queue *mvpp2_get_tx_queue(struct mvpp2_port *port,
44344422 u32 cause)
44354423 {
4436− int queue = fls(cause >> 16) - 1;
4424+ int queue = fls(cause) - 1;
44374425
44384426 return port->txqs[queue];
44394427 }
@@ -4460,6 +4448,29 @@ static void mvpp2_txq_done(struct mvpp2_port *port, struct mvpp2_tx_queue *txq, · 20 unmodified lines
44604448 netif_tx_wake_queue(nq);
44614449 }
44624450
4451+static unsigned int mvpp2_tx_done(struct mvpp2_port *port, u32 cause)
4452+{
4453+ struct mvpp2_tx_queue *txq;
4454+ struct mvpp2_txq_pcpu *txq_pcpu;
4455+ unsigned int tx_todo = 0;
4456+
4457+ while (cause) {
4458+ txq = mvpp2_get_tx_queue(port, cause);
4459+ if (!txq)
4460+ break;
4461+
4462+ txq_pcpu = this_cpu_ptr(txq->pcpu);
4463+
4464+ if (txq_pcpu->count) {
4465+ mvpp2_txq_done(port, txq, txq_pcpu);
4466+ tx_todo += txq_pcpu->count;
4467+ }
4468+
4469+ cause &= ~(1 << txq->log_id);
4470+ }
4471+ return tx_todo;
4472+}
4473+
44634474 /* Rx/Tx queue initialization/cleanup methods */
44644475
44654476 /* Allocate and initialize descriptors for aggr TXQ */
@@ -4649,12 +4660,13 @@ static int mvpp2_txq_init(struct mvpp2_port *port, · 183 unmodified lines
46494660 txq_pcpu->tx_skb = kmalloc(txq_pcpu->size *
46504661 sizeof(*txq_pcpu->tx_skb),
46514662 GFP_KERNEL);
4652− if (!txq_pcpu->tx_skb) {
4653− dma_free_coherent(port->dev->dev.parent,
4654− txq->size * MVPP2_DESC_ALIGNED_SIZE,
4655− txq->descs, txq->descs_phys);
4656− return -ENOMEM;
4657− }
4663+ if (!txq_pcpu->tx_skb)
4664+ goto error;
4665+
4666+ txq_pcpu->tx_buffs = kmalloc(txq_pcpu->size *
4667+ sizeof(dma_addr_t), GFP_KERNEL);
4668+ if (!txq_pcpu->tx_buffs)
4669+ goto error;
46584670
46594671 txq_pcpu->count = 0;
46604672 txq_pcpu->reserved_num = 0;
@@ -4663,6 +4675,19 @@ static int mvpp2_txq_init(struct mvpp2_port *port, · 2 unmodified lines
46634675 }
46644676
46654677 return 0;
4678+
4679+error:
4680+ for_each_present_cpu(cpu) {
4681+ txq_pcpu = per_cpu_ptr(txq->pcpu, cpu);
4682+ kfree(txq_pcpu->tx_skb);
4683+ kfree(txq_pcpu->tx_buffs);
4684+ }
4685+
4686+ dma_free_coherent(port->dev->dev.parent,
4687+ txq->size * MVPP2_DESC_ALIGNED_SIZE,
4688+ txq->descs, txq->descs_phys);
4689+
4690+ return -ENOMEM;
46664691 }
46674692
46684693 /* Free allocated TXQ resources */
@@ -4675,6 +4700,7 @@ static void mvpp2_txq_deinit(struct mvpp2_port *port, · 6 unmodified lines
46754700 for_each_present_cpu(cpu) {
46764701 txq_pcpu = per_cpu_ptr(txq->pcpu, cpu);
46774702 kfree(txq_pcpu->tx_skb);
4703+ kfree(txq_pcpu->tx_buffs);
46784704 }
46794705
46804706 if (txq->descs)
@@ -4805,7 +4831,6 @@ static int mvpp2_setup_txqs(struct mvpp2_port *port) · 124 unmodified lines
48054831 goto err_cleanup;
48064832 }
48074833
4808− on_each_cpu(mvpp2_tx_done_pkts_coal_set, port, 1);
48094834 on_each_cpu(mvpp2_txq_sent_counter_clear, port, 1);
48104835 return 0;
48114836
@@ -4887,6 +4912,49 @@ static void mvpp2_link_event(struct net_device *dev) · 75 unmodified lines
48874912 }
48884913 }
48894914
4915+static void mvpp2_timer_set(struct mvpp2_port_pcpu *port_pcpu)
4916+{
4917+ ktime_t interval;
4918+
4919+ if (!port_pcpu->timer_scheduled) {
4920+ port_pcpu->timer_scheduled = true;
4921+ interval = ktime_set(0, MVPP2_TXDONE_HRTIMER_PERIOD_NS);
4922+ hrtimer_start(&port_pcpu->tx_done_timer, interval,
4923+ HRTIMER_MODE_REL_PINNED);
4924+ }
4925+}
4926+
4927+static void mvpp2_tx_proc_cb(unsigned long data)
4928+{
4929+ struct net_device *dev = (struct net_device *)data;
4930+ struct mvpp2_port *port = netdev_priv(dev);
4931+ struct mvpp2_port_pcpu *port_pcpu = this_cpu_ptr(port->pcpu);
4932+ unsigned int tx_todo, cause;
4933+
4934+ if (!netif_running(dev))
4935+ return;
4936+ port_pcpu->timer_scheduled = false;
4937+
4938+ /* Process all the Tx queues */
4939+ cause = (1 << txq_number) - 1;
4940+ tx_todo = mvpp2_tx_done(port, cause);
4941+
4942+ /* Set the timer in case not all the packets were processed */
4943+ if (tx_todo)
4944+ mvpp2_timer_set(port_pcpu);
4945+}
4946+
4947+static enum hrtimer_restart mvpp2_hr_timer_cb(struct hrtimer *timer)
4948+{
4949+ struct mvpp2_port_pcpu *port_pcpu = container_of(timer,
4950+ struct mvpp2_port_pcpu,
4951+ tx_done_timer);
4952+
4953+ tasklet_schedule(&port_pcpu->tx_done_tasklet);
4954+
4955+ return HRTIMER_NORESTART;
4956+}
4957+
48904958 /* Main RX/TX processing routines */
48914959
48924960 /* Display more error info */
@@ -5144,11 +5212,11 @@ static int mvpp2_tx_frag_process(struct mvpp2_port *port, struct sk_buff *skb, · 251 unmodified lines
51445212 if (i == (skb_shinfo(skb)->nr_frags - 1)) {
51455213 /* Last descriptor */
51465214 tx_desc->command = MVPP2_TXD_L_DESC;
5147− mvpp2_txq_inc_put(txq_pcpu, skb);
5215+ mvpp2_txq_inc_put(txq_pcpu, skb, tx_desc);
51485216 } else {
51495217 /* Descriptor in the middle: Not First, Not Last */
51505218 tx_desc->command = 0;
5151− mvpp2_txq_inc_put(txq_pcpu, NULL);
5219+ mvpp2_txq_inc_put(txq_pcpu, NULL, tx_desc);
51525220 }
51535221 }
51545222
@@ -5214,12 +5282,12 @@ static int mvpp2_tx(struct sk_buff *skb, struct net_device *dev) · 59 unmodified lines
52145282 /* First and Last descriptor */
52155283 tx_cmd |= MVPP2_TXD_F_DESC | MVPP2_TXD_L_DESC;
52165284 tx_desc->command = tx_cmd;
5217− mvpp2_txq_inc_put(txq_pcpu, skb);
5285+ mvpp2_txq_inc_put(txq_pcpu, skb, tx_desc);
52185286 } else {
52195287 /* First but not Last */
52205288 tx_cmd |= MVPP2_TXD_F_DESC | MVPP2_TXD_PADDING_DISABLE;
52215289 tx_desc->command = tx_cmd;
5222− mvpp2_txq_inc_put(txq_pcpu, NULL);
5290+ mvpp2_txq_inc_put(txq_pcpu, NULL, tx_desc);
52235291
52245292 /* Continue with other skb fragments */
52255293 if (mvpp2_tx_frag_process(port, skb, aggr_txq, txq)) {
@@ -5255,6 +5323,17 @@ out: · 29 unmodified lines
52555323 dev_kfree_skb_any(skb);
52565324 }
52575325
5326+ /* Finalize TX processing */
5327+ if (txq_pcpu->count >= txq->done_pkts_coal)
5328+ mvpp2_txq_done(port, txq, txq_pcpu);
5329+
5330+ /* Set the timer in case not all frags were processed */
5331+ if (txq_pcpu->count <= frags && txq_pcpu->count > 0) {
5332+ struct mvpp2_port_pcpu *port_pcpu = this_cpu_ptr(port->pcpu);
5333+
5334+ mvpp2_timer_set(port_pcpu);
5335+ }
5336+
52585337 return NETDEV_TX_OK;
52595338 }
52605339
@@ -5268,10 +5347,11 @@ static inline void mvpp2_cause_error(struct net_device *dev, int cause) · 7 unmodified lines
52685347 netdev_err(dev, "tx fifo underrun error\n");
52695348 }
52705349
5271−static void mvpp2_txq_done_percpu(void *arg)
5350+static int mvpp2_poll(struct napi_struct *napi, int budget)
52725351 {
5273− struct mvpp2_port *port = arg;
5274− u32 cause_rx_tx, cause_tx, cause_misc;
5352+ u32 cause_rx_tx, cause_rx, cause_misc;
5353+ int rx_done = 0;
5354+ struct mvpp2_port *port = netdev_priv(napi->dev);
52755355
52765356 /* Rx/Tx cause register
52775357 *
@@ -5285,7 +5365,7 @@ static void mvpp2_txq_done_percpu(void *arg) · 7 unmodified lines
52855365 */
52865366 cause_rx_tx = mvpp2_read(port->priv,
52875367 MVPP2_ISR_RX_TX_CAUSE_REG(port->id));
5288− cause_tx = cause_rx_tx & MVPP2_CAUSE_TXQ_OCCUP_DESC_ALL_MASK;
5368+ cause_rx_tx &= ~MVPP2_CAUSE_TXQ_OCCUP_DESC_ALL_MASK;
52895369 cause_misc = cause_rx_tx & MVPP2_CAUSE_MISC_SUM_MASK;
52905370
52915371 if (cause_misc) {
@@ -5297,26 +5377,6 @@ static void mvpp2_txq_done_percpu(void *arg) · 5 unmodified lines
52975377 cause_rx_tx & ~MVPP2_CAUSE_MISC_SUM_MASK);
52985378 }
52995379
5300− /* Release TX descriptors */
5301− if (cause_tx) {
5302− struct mvpp2_tx_queue *txq = mvpp2_get_tx_queue(port, cause_tx);
5303− struct mvpp2_txq_pcpu *txq_pcpu = this_cpu_ptr(txq->pcpu);
5304−
5305− if (txq_pcpu->count)
5306− mvpp2_txq_done(port, txq, txq_pcpu);
5307− }
5308−}
5309−
5310−static int mvpp2_poll(struct napi_struct *napi, int budget)
5311−{
5312− u32 cause_rx_tx, cause_rx;
5313− int rx_done = 0;
5314− struct mvpp2_port *port = netdev_priv(napi->dev);
5315−
5316− on_each_cpu(mvpp2_txq_done_percpu, port, 1);
5317−
5318− cause_rx_tx = mvpp2_read(port->priv,
5319− MVPP2_ISR_RX_TX_CAUSE_REG(port->id));
53205380 cause_rx = cause_rx_tx & MVPP2_CAUSE_RXQ_OCCUP_DESC_ALL_MASK;
53215381
53225382 /* Process RX packets */
@@ -5561,6 +5621,8 @@ err_cleanup_rxqs: · 238 unmodified lines
55615621 static int mvpp2_stop(struct net_device *dev)
55625622 {
55635623 struct mvpp2_port *port = netdev_priv(dev);
5624+ struct mvpp2_port_pcpu *port_pcpu;
5625+ int cpu;
55645626
55655627 mvpp2_stop_dev(port);
55665628 mvpp2_phy_disconnect(port);
@@ -5569,6 +5631,13 @@ static int mvpp2_stop(struct net_device *dev) · 2 unmodified lines
55695631 on_each_cpu(mvpp2_interrupts_mask, port, 1);
55705632
55715633 free_irq(port->irq, port);
5634+ for_each_present_cpu(cpu) {
5635+ port_pcpu = per_cpu_ptr(port->pcpu, cpu);
5636+
5637+ hrtimer_cancel(&port_pcpu->tx_done_timer);
5638+ port_pcpu->timer_scheduled = false;
5639+ tasklet_kill(&port_pcpu->tx_done_tasklet);
5640+ }
55725641 mvpp2_cleanup_rxqs(port);
55735642 mvpp2_cleanup_txqs(port);
55745643
@@ -5784,7 +5853,6 @@ static int mvpp2_ethtool_set_coalesce(struct net_device *dev, · 209 unmodified lines
57845853 txq->done_pkts_coal = c->tx_max_coalesced_frames;
57855854 }
57865855
5787− on_each_cpu(mvpp2_tx_done_pkts_coal_set, port, 1);
57885856 return 0;
57895857 }
57905858
@@ -6035,6 +6103,7 @@ static int mvpp2_port_probe(struct platform_device *pdev, · 244 unmodified lines
60356103 {
60366104 struct device_node *phy_node;
60376105 struct mvpp2_port *port;
6106+ struct mvpp2_port_pcpu *port_pcpu;
60386107 struct net_device *dev;
60396108 struct resource *res;
60406109 const char *dt_mac_addr;
@@ -6044,7 +6113,7 @@ static int mvpp2_port_probe(struct platform_device *pdev, · 3 unmodified lines
60446113 int features;
60456114 int phy_mode;
60466115 int priv_common_regs_num = 2;
6047− int err, i;
6116+ int err, i, cpu;
60486117
60496118 dev = alloc_etherdev_mqs(sizeof(struct mvpp2_port), txq_number,
60506119 rxq_number);
@@ -6135,6 +6204,24 @@ static int mvpp2_port_probe(struct platform_device *pdev, · 84 unmodified lines
61356204 }
61366205 mvpp2_port_power_up(port);
61376206
6207+ port->pcpu = alloc_percpu(struct mvpp2_port_pcpu);
6208+ if (!port->pcpu) {
6209+ err = -ENOMEM;
6210+ goto err_free_txq_pcpu;
6211+ }
6212+
6213+ for_each_present_cpu(cpu) {
6214+ port_pcpu = per_cpu_ptr(port->pcpu, cpu);
6215+
6216+ hrtimer_init(&port_pcpu->tx_done_timer, CLOCK_MONOTONIC,
6217+ HRTIMER_MODE_REL_PINNED);
6218+ port_pcpu->tx_done_timer.function = mvpp2_hr_timer_cb;
6219+ port_pcpu->timer_scheduled = false;
6220+
6221+ tasklet_init(&port_pcpu->tx_done_tasklet, mvpp2_tx_proc_cb,
6222+ (unsigned long)dev);
6223+ }
6224+
61386225 netif_napi_add(dev, &port->napi, mvpp2_poll, NAPI_POLL_WEIGHT);
61396226 features = NETIF_F_SG | NETIF_F_IP_CSUM;
61406227 dev->features = features | NETIF_F_RXCSUM;
@@ -6144,7 +6231,7 @@ static int mvpp2_port_probe(struct platform_device *pdev, · 3 unmodified lines
61446231 err = register_netdev(dev);
61456232 if (err < 0) {
61466233 dev_err(&pdev->dev, "failed to register netdev\n");
6147− goto err_free_txq_pcpu;
6234+ goto err_free_port_pcpu;
61486235 }
61496236 netdev_info(dev, "Using %s mac address %pM\n", mac_from, dev->dev_addr);
61506237
@@ -6153,6 +6240,8 @@ static int mvpp2_port_probe(struct platform_device *pdev, · 2 unmodified lines
61536240 priv->port_list[id] = port;
61546241 return 0;
61556242
6243+err_free_port_pcpu:
6244+ free_percpu(port->pcpu);
61566245 err_free_txq_pcpu:
61576246 for (i = 0; i < txq_number; i++)
61586247 free_percpu(port->txqs[i]->pcpu);
@@ -6171,6 +6260,7 @@ static void mvpp2_port_remove(struct mvpp2_port *port) · 12 unmodified lines
61716260 int i;
61726261
61736262 unregister_netdev(port->dev);
6263+ free_percpu(port->pcpu);
61746264 free_percpu(port->stats);
61756265 for (i = 0; i < txq_number; i++)
61766266 free_percpu(port->txqs[i]->pcpu);
drivers/net/ethernet/mellanox/mlx5/core/main.c+2−0
@@ -391,6 +391,8 @@ static int handle_hca_cap(struct mlx5_core_dev *dev) · 390 unmodified lines
391391 /* disable cmdif checksum */
392392 MLX5_SET(cmd_hca_cap, set_hca_cap, cmdif_checksum, 0);
393393
394+ MLX5_SET(cmd_hca_cap, set_hca_cap, log_uar_page_sz, PAGE_SHIFT - 12);
395+
394396 err = set_caps(dev, set_ctx, set_sz);
395397
396398 query_ex:
drivers/net/ethernet/realtek/r8169.c+3−1
@@ -4875,10 +4875,12 @@ static void rtl_init_rxcfg(struct rtl8169_private *tp) · 4874 unmodified lines
48754875 case RTL_GIGA_MAC_VER_46:
48764876 case RTL_GIGA_MAC_VER_47:
48774877 case RTL_GIGA_MAC_VER_48:
4878+ RTL_W32(RxConfig, RX128_INT_EN | RX_DMA_BURST | RX_EARLY_OFF);
4879+ break;
48784880 case RTL_GIGA_MAC_VER_49:
48794881 case RTL_GIGA_MAC_VER_50:
48804882 case RTL_GIGA_MAC_VER_51:
4881− RTL_W32(RxConfig, RX128_INT_EN | RX_DMA_BURST | RX_EARLY_OFF);
4883+ RTL_W32(RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST | RX_EARLY_OFF);
48824884 break;
48834885 default:
48844886 RTL_W32(RxConfig, RX128_INT_EN | RX_DMA_BURST);
drivers/net/ethernet/rocker/rocker.c+1−0
@@ -4927,6 +4927,7 @@ static void rocker_remove_ports(const struct rocker *rocker) · 4926 unmodified lines
49274927 rocker_port_ig_tbl(rocker_port, SWITCHDEV_TRANS_NONE,
49284928 ROCKER_OP_FLAG_REMOVE);
49294929 unregister_netdev(rocker_port->dev);
4930+ free_netdev(rocker_port->dev);
49304931 }
49314932 kfree(rocker->ports);
49324933 }
drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c+2−2
@@ -42,7 +42,7 @@ · 41 unmodified lines
4242 #define NSS_COMMON_CLK_DIV_MASK 0x7f
4343
4444 #define NSS_COMMON_CLK_SRC_CTRL 0x14
45−#define NSS_COMMON_CLK_SRC_CTRL_OFFSET(x) (1 << x)
45+#define NSS_COMMON_CLK_SRC_CTRL_OFFSET(x) (x)
4646 /* Mode is coded on 1 bit but is different depending on the MAC ID:
4747 * MAC0: QSGMII=0 RGMII=1
4848 * MAC1: QSGMII=0 SGMII=0 RGMII=1
@@ -308,7 +308,7 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) · 259 unmodified lines
308308
309309 /* Configure the clock src according to the mode */
310310 regmap_read(gmac->nss_common, NSS_COMMON_CLK_SRC_CTRL, &val);
311− val &= ~NSS_COMMON_CLK_SRC_CTRL_OFFSET(gmac->id);
311+ val &= ~(1 << NSS_COMMON_CLK_SRC_CTRL_OFFSET(gmac->id));
312312 switch (gmac->phy_mode) {
313313 case PHY_INTERFACE_MODE_RGMII:
314314 val |= NSS_COMMON_CLK_SRC_CTRL_RGMII(gmac->id) <<
drivers/net/ethernet/ti/netcp.h+0−1
@@ -85,7 +85,6 @@ struct netcp_intf { · 84 unmodified lines
8585 struct list_head rxhook_list_head;
8686 unsigned int rx_queue_id;
8787 void *rx_fdq[KNAV_DMA_FDQ_PER_CHAN];
88− u32 rx_buffer_sizes[KNAV_DMA_FDQ_PER_CHAN];
8988 struct napi_struct rx_napi;
9089 struct napi_struct tx_napi;
9190
drivers/net/ethernet/ti/netcp_core.c+13−22
@@ -34,6 +34,7 @@ · 33 unmodified lines
3434 #define NETCP_SOP_OFFSET (NET_IP_ALIGN + NET_SKB_PAD)
3535 #define NETCP_NAPI_WEIGHT 64
3636 #define NETCP_TX_TIMEOUT (5 * HZ)
37+#define NETCP_PACKET_SIZE (ETH_FRAME_LEN + ETH_FCS_LEN)
3738 #define NETCP_MIN_PACKET_SIZE ETH_ZLEN
3839 #define NETCP_MAX_MCAST_ADDR 16
3940
@@ -815,30 +816,28 @@ static void netcp_allocate_rx_buf(struct netcp_intf *netcp, int fdq) · 775 unmodified lines
815816 if (likely(fdq == 0)) {
816817 unsigned int primary_buf_len;
817818 /* Allocate a primary receive queue entry */
818− buf_len = netcp->rx_buffer_sizes[0] + NETCP_SOP_OFFSET;
819+ buf_len = NETCP_PACKET_SIZE + NETCP_SOP_OFFSET;
819820 primary_buf_len = SKB_DATA_ALIGN(buf_len) +
820821 SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
821822
822− if (primary_buf_len <= PAGE_SIZE) {
823− bufptr = netdev_alloc_frag(primary_buf_len);
824− pad[1] = primary_buf_len;
825− } else {
826− bufptr = kmalloc(primary_buf_len, GFP_ATOMIC |
827− GFP_DMA32 | __GFP_COLD);
828− pad[1] = 0;
829− }
823+ bufptr = netdev_alloc_frag(primary_buf_len);
824+ pad[1] = primary_buf_len;
830825
831826 if (unlikely(!bufptr)) {
832− dev_warn_ratelimited(netcp->ndev_dev, "Primary RX buffer alloc failed\n");
827+ dev_warn_ratelimited(netcp->ndev_dev,
828+ "Primary RX buffer alloc failed\n");
833829 goto fail;
834830 }
835831 dma = dma_map_single(netcp->dev, bufptr, buf_len,
836832 DMA_TO_DEVICE);
833+ if (unlikely(dma_mapping_error(netcp->dev, dma)))
834+ goto fail;
835+
837836 pad[0] = (u32)bufptr;
838837
839838 } else {
840839 /* Allocate a secondary receive queue entry */
841− page = alloc_page(GFP_ATOMIC | GFP_DMA32 | __GFP_COLD);
840+ page = alloc_page(GFP_ATOMIC | GFP_DMA | __GFP_COLD);
842841 if (unlikely(!page)) {
843842 dev_warn_ratelimited(netcp->ndev_dev, "Secondary page alloc failed\n");
844843 goto fail;
@@ -1021,7 +1020,7 @@ netcp_tx_map_skb(struct sk_buff *skb, struct netcp_intf *netcp) · 176 unmodified lines
10211020
10221021 /* Map the linear buffer */
10231022 dma_addr = dma_map_single(dev, skb->data, pkt_len, DMA_TO_DEVICE);
1024− if (unlikely(!dma_addr)) {
1023+ if (unlikely(dma_mapping_error(dev, dma_addr))) {
10251024 dev_err(netcp->ndev_dev, "Failed to map skb buffer\n");
10261025 return NULL;
10271026 }
@@ -1557,8 +1556,8 @@ static int netcp_setup_navigator_resources(struct net_device *ndev) · 529 unmodified lines
15571556 knav_queue_disable_notify(netcp->rx_queue);
15581557
15591558 /* open Rx FDQs */
1560− for (i = 0; i < KNAV_DMA_FDQ_PER_CHAN &&
1561− netcp->rx_queue_depths[i] && netcp->rx_buffer_sizes[i]; ++i) {
1559+ for (i = 0; i < KNAV_DMA_FDQ_PER_CHAN && netcp->rx_queue_depths[i];
1560+ ++i) {
15621561 snprintf(name, sizeof(name), "rx-fdq-%s-%d", ndev->name, i);
15631562 netcp->rx_fdq[i] = knav_queue_open(name, KNAV_QUEUE_GP, 0);
15641563 if (IS_ERR_OR_NULL(netcp->rx_fdq[i])) {
@@ -1952,14 +1951,6 @@ static int netcp_create_interface(struct netcp_device *netcp_device, · 387 unmodified lines
19521951 netcp->rx_queue_depths[0] = 128;
19531952 }
19541953
1955− ret = of_property_read_u32_array(node_interface, "rx-buffer-size",
1956− netcp->rx_buffer_sizes,
1957− KNAV_DMA_FDQ_PER_CHAN);
1958− if (ret) {
1959− dev_err(dev, "missing \"rx-buffer-size\" parameter\n");
1960− netcp->rx_buffer_sizes[0] = 1536;
1961− }
1962−
19631954 ret = of_property_read_u32_array(node_interface, "rx-pool", temp, 2);
19641955 if (ret < 0) {
19651956 dev_err(dev, "missing \"rx-pool\" parameter\n");
drivers/net/hamradio/mkiss.c+4−3
@@ -728,11 +728,12 @@ static int mkiss_open(struct tty_struct *tty) · 727 unmodified lines
728728 dev->type = ARPHRD_AX25;
729729
730730 /* Perform the low-level AX25 initialization. */
731− if ((err = ax_open(ax->dev))) {
731+ err = ax_open(ax->dev);
732+ if (err)
732733 goto out_free_netdev;
733− }
734734
735− if (register_netdev(dev))
735+ err = register_netdev(dev);
736+ if (err)
736737 goto out_free_buffers;
737738
738739 /* after register_netdev() - because else printk smashes the kernel */
drivers/net/ntb_netdev.c+8−1
@@ -102,6 +102,12 @@ static void ntb_netdev_rx_handler(struct ntb_transport_qp *qp, void *qp_data, · 101 unmodified lines
102102
103103 netdev_dbg(ndev, "%s: %d byte payload received\n", __func__, len);
104104
105+ if (len < 0) {
106+ ndev->stats.rx_errors++;
107+ ndev->stats.rx_length_errors++;
108+ goto enqueue_again;
109+ }
110+
105111 skb_put(skb, len);
106112 skb->protocol = eth_type_trans(skb, ndev);
107113 skb->ip_summed = CHECKSUM_NONE;
@@ -121,6 +127,7 @@ static void ntb_netdev_rx_handler(struct ntb_transport_qp *qp, void *qp_data, · 13 unmodified lines
121127 return;
122128 }
123129
130+enqueue_again:
124131 rc = ntb_transport_rx_enqueue(qp, skb, skb->data, ndev->mtu + ETH_HLEN);
125132 if (rc) {
126133 dev_kfree_skb(skb);
@@ -184,7 +191,7 @@ static int ntb_netdev_open(struct net_device *ndev) · 57 unmodified lines
184191
185192 rc = ntb_transport_rx_enqueue(dev->qp, skb, skb->data,
186193 ndev->mtu + ETH_HLEN);
187− if (rc == -EINVAL) {
194+ if (rc) {
188195 dev_kfree_skb(skb);
189196 goto err;
190197 }
drivers/net/virtio_net.c+2−2
@@ -1756,9 +1756,9 @@ static int virtnet_probe(struct virtio_device *vdev) · 1755 unmodified lines
17561756 /* Do we support "hardware" checksums? */
17571757 if (virtio_has_feature(vdev, VIRTIO_NET_F_CSUM)) {
17581758 /* This opens up the world of extra features. */
1759− dev->hw_features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST;
1759+ dev->hw_features |= NETIF_F_HW_CSUM | NETIF_F_SG;
17601760 if (csum)
1761− dev->features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST;
1761+ dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG;
17621762
17631763 if (virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) {
17641764 dev->hw_features |= NETIF_F_TSO | NETIF_F_UFO
drivers/net/wan/cosa.c+2−1
@@ -589,7 +589,8 @@ static int cosa_probe(int base, int irq, int dma) · 588 unmodified lines
589589 chan->netdev->base_addr = chan->cosa->datareg;
590590 chan->netdev->irq = chan->cosa->irq;
591591 chan->netdev->dma = chan->cosa->dma;
592− if (register_hdlc_device(chan->netdev)) {
592+ err = register_hdlc_device(chan->netdev);
593+ if (err) {
593594 netdev_warn(chan->netdev,
594595 "register_hdlc_device() failed\n");
595596 free_netdev(chan->netdev);
drivers/net/wireless/b43/tables_nphy.c+1−1
@@ -3728,7 +3728,7 @@ const u32 *b43_nphy_get_tx_gain_table(struct b43_wldev *dev) · 3727 unmodified lines
37283728 switch (phy->rev) {
37293729 case 6:
37303730 case 5:
3731− if (sprom->fem.ghz5.extpa_gain == 3)
3731+ if (sprom->fem.ghz2.extpa_gain == 3)
37323732 return b43_ntab_tx_gain_epa_rev3_hi_pwr_2g;
37333733 /* fall through */
37343734 case 4:
drivers/net/wireless/iwlwifi/mvm/scan.c+1−1
@@ -1023,7 +1023,7 @@ static void iwl_mvm_scan_umac_dwell(struct iwl_mvm *mvm, · 1022 unmodified lines
10231023 cmd->scan_priority =
10241024 iwl_mvm_scan_priority(mvm, IWL_SCAN_PRIORITY_EXT_6);
10251025
1026− if (iwl_mvm_scan_total_iterations(params) == 0)
1026+ if (iwl_mvm_scan_total_iterations(params) == 1)
10271027 cmd->ooc_priority =
10281028 iwl_mvm_scan_priority(mvm, IWL_SCAN_PRIORITY_EXT_6);
10291029 else
drivers/net/wireless/iwlwifi/pcie/trans.c+19−3
@@ -478,10 +478,16 @@ static void iwl_pcie_apm_stop(struct iwl_trans *trans, bool op_mode_leave) · 477 unmodified lines
478478 if (trans->cfg->device_family == IWL_DEVICE_FAMILY_7000)
479479 iwl_set_bits_prph(trans, APMG_PCIDEV_STT_REG,
480480 APMG_PCIDEV_STT_VAL_WAKE_ME);
481− else if (trans->cfg->device_family == IWL_DEVICE_FAMILY_8000)
481+ else if (trans->cfg->device_family == IWL_DEVICE_FAMILY_8000) {
482+ iwl_set_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG,
483+ CSR_RESET_LINK_PWR_MGMT_DISABLED);
482484 iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG,
483485 CSR_HW_IF_CONFIG_REG_PREPARE |
484486 CSR_HW_IF_CONFIG_REG_ENABLE_PME);
487+ mdelay(1);
488+ iwl_clear_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG,
489+ CSR_RESET_LINK_PWR_MGMT_DISABLED);
490+ }
485491 mdelay(5);
486492 }
487493
@@ -575,6 +581,10 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans) · 87 unmodified lines
575581 if (ret >= 0)
576582 return 0;
577583
584+ iwl_set_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG,
585+ CSR_RESET_LINK_PWR_MGMT_DISABLED);
586+ msleep(1);
587+
578588 for (iter = 0; iter < 10; iter++) {
579589 /* If HW is not ready, prepare the conditions to check again */
580590 iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG,
@@ -582,8 +592,10 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans) · 1 unmodified line
582592
583593 do {
584594 ret = iwl_pcie_set_hw_ready(trans);
585− if (ret >= 0)
586− return 0;
595+ if (ret >= 0) {
596+ ret = 0;
597+ goto out;
598+ }
587599
588600 usleep_range(200, 1000);
589601 t += 200;
@@ -593,6 +605,10 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans) · 3 unmodified lines
593605
594606 IWL_ERR(trans, "Couldn't prepare the card\n");
595607
608+out:
609+ iwl_clear_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG,
610+ CSR_RESET_LINK_PWR_MGMT_DISABLED);
611+
596612 return ret;
597613 }
598614
drivers/net/wireless/iwlwifi/pcie/tx.c+13−2
@@ -1875,8 +1875,19 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, · 1874 unmodified lines
18751875
18761876 /* start timer if queue currently empty */
18771877 if (q->read_ptr == q->write_ptr) {
1878− if (txq->wd_timeout)
1879− mod_timer(&txq->stuck_timer, jiffies + txq->wd_timeout);
1878+ if (txq->wd_timeout) {
1879+ /*
1880+ * If the TXQ is active, then set the timer, if not,
1881+ * set the timer in remainder so that the timer will
1882+ * be armed with the right value when the station will
1883+ * wake up.
1884+ */
1885+ if (!txq->frozen)
1886+ mod_timer(&txq->stuck_timer,
1887+ jiffies + txq->wd_timeout);
1888+ else
1889+ txq->frozen_expiry_remainder = txq->wd_timeout;
1890+ }
18801891 IWL_DEBUG_RPM(trans, "Q: %d first tx - take ref\n", q->id);
18811892 iwl_trans_pcie_ref(trans);
18821893 }
drivers/net/wireless/rsi/rsi_91x_sdio_ops.c+7−1
@@ -172,6 +172,7 @@ static int rsi_load_ta_instructions(struct rsi_common *common) · 171 unmodified lines
172172 (struct rsi_91x_sdiodev *)adapter->rsi_dev;
173173 u32 len;
174174 u32 num_blocks;
175+ const u8 *fw;
175176 const struct firmware *fw_entry = NULL;
176177 u32 block_size = dev->tx_blk_size;
177178 int status = 0;
@@ -200,6 +201,10 @@ static int rsi_load_ta_instructions(struct rsi_common *common) · 22 unmodified lines
200201 return status;
201202 }
202203
204+ /* Copy firmware into DMA-accessible memory */
205+ fw = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL);
206+ if (!fw)
207+ return -ENOMEM;
203208 len = fw_entry->size;
204209
205210 if (len % 4)
@@ -210,7 +215,8 @@ static int rsi_load_ta_instructions(struct rsi_common *common) · 4 unmodified lines
210215 rsi_dbg(INIT_ZONE, "%s: Instruction size:%d\n", __func__, len);
211216 rsi_dbg(INIT_ZONE, "%s: num blocks: %d\n", __func__, num_blocks);
212217
213− status = rsi_copy_to_card(common, fw_entry->data, len, num_blocks);
218+ status = rsi_copy_to_card(common, fw, len, num_blocks);
219+ kfree(fw);
214220 release_firmware(fw_entry);
215221 return status;
216222 }
drivers/net/wireless/rsi/rsi_91x_usb_ops.c+4−0
@@ -146,7 +146,10 @@ static int rsi_load_ta_instructions(struct rsi_common *common) · 145 unmodified lines
146146 return status;
147147 }
148148
149+ /* Copy firmware into DMA-accessible memory */
149150 fw = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL);
151+ if (!fw)
152+ return -ENOMEM;
150153 len = fw_entry->size;
151154
152155 if (len % 4)
@@ -158,6 +161,7 @@ static int rsi_load_ta_instructions(struct rsi_common *common) · 5 unmodified lines
158161 rsi_dbg(INIT_ZONE, "%s: num blocks: %d\n", __func__, num_blocks);
159162
160163 status = rsi_copy_to_card(common, fw, len, num_blocks);
164+ kfree(fw);
161165 release_firmware(fw_entry);
162166 return status;
163167 }
drivers/net/wireless/rtlwifi/core.c+5−2
@@ -1015,9 +1015,12 @@ static void send_beacon_frame(struct ieee80211_hw *hw, · 1014 unmodified lines
10151015 {
10161016 struct rtl_priv *rtlpriv = rtl_priv(hw);
10171017 struct sk_buff *skb = ieee80211_beacon_get(hw, vif);
1018+ struct rtl_tcb_desc tcb_desc;
10181019
1019− if (skb)
1020− rtlpriv->intf_ops->adapter_tx(hw, NULL, skb, NULL);
1020+ if (skb) {
1021+ memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc));
1022+ rtlpriv->intf_ops->adapter_tx(hw, NULL, skb, &tcb_desc);
1023+ }
10211024 }
10221025
10231026 static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
drivers/net/wireless/rtlwifi/rtl8723be/sw.c+1−0
@@ -385,6 +385,7 @@ module_param_named(debug, rtl8723be_mod_params.debug, int, 0444); · 384 unmodified lines
385385 module_param_named(ips, rtl8723be_mod_params.inactiveps, bool, 0444);
386386 module_param_named(swlps, rtl8723be_mod_params.swctrl_lps, bool, 0444);
387387 module_param_named(fwlps, rtl8723be_mod_params.fwctrl_lps, bool, 0444);
388+module_param_named(msi, rtl8723be_mod_params.msi_support, bool, 0444);
388389 module_param_named(disable_watchdog, rtl8723be_mod_params.disable_watchdog,
389390 bool, 0444);
390391 MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n");
drivers/net/xen-netback/interface.c+6−0
@@ -61,6 +61,12 @@ void xenvif_skb_zerocopy_prepare(struct xenvif_queue *queue, · 60 unmodified lines
6161 void xenvif_skb_zerocopy_complete(struct xenvif_queue *queue)
6262 {
6363 atomic_dec(&queue->inflight_packets);
64+
65+ /* Wake the dealloc thread _after_ decrementing inflight_packets so
66+ * that if kthread_stop() has already been called, the dealloc thread
67+ * does not wait forever with nothing to wake it.
68+ */
69+ wake_up(&queue->dealloc_wq);
6470 }
6571
6672 int xenvif_schedulable(struct xenvif *vif)
drivers/net/xen-netback/netback.c+33−29
@@ -810,23 +810,17 @@ static inline struct sk_buff *xenvif_alloc_skb(unsigned int size) · 809 unmodified lines
810810 static struct gnttab_map_grant_ref *xenvif_get_requests(struct xenvif_queue *queue,
811811 struct sk_buff *skb,
812812 struct xen_netif_tx_request *txp,
813− struct gnttab_map_grant_ref *gop)
813+ struct gnttab_map_grant_ref *gop,
814+ unsigned int frag_overflow,
815+ struct sk_buff *nskb)
814816 {
815817 struct skb_shared_info *shinfo = skb_shinfo(skb);
816818 skb_frag_t *frags = shinfo->frags;
817819 u16 pending_idx = XENVIF_TX_CB(skb)->pending_idx;
818820 int start;
819821 pending_ring_idx_t index;
820− unsigned int nr_slots, frag_overflow = 0;
822+ unsigned int nr_slots;
821823
822− /* At this point shinfo->nr_frags is in fact the number of
823− * slots, which can be as large as XEN_NETBK_LEGACY_SLOTS_MAX.
824− */
825− if (shinfo->nr_frags > MAX_SKB_FRAGS) {
826− frag_overflow = shinfo->nr_frags - MAX_SKB_FRAGS;
827− BUG_ON(frag_overflow > MAX_SKB_FRAGS);
828− shinfo->nr_frags = MAX_SKB_FRAGS;
829− }
830824 nr_slots = shinfo->nr_frags;
831825
832826 /* Skip first skb fragment if it is on same page as header fragment. */
@@ -841,13 +835,6 @@ static struct gnttab_map_grant_ref *xenvif_get_requests(struct xenvif_queue *que · 8 unmodified lines
841835 }
842836
843837 if (frag_overflow) {
844− struct sk_buff *nskb = xenvif_alloc_skb(0);
845− if (unlikely(nskb == NULL)) {
846− if (net_ratelimit())
847− netdev_err(queue->vif->dev,
848− "Can't allocate the frag_list skb.\n");
849− return NULL;
850− }
851838
852839 shinfo = skb_shinfo(nskb);
853840 frags = shinfo->frags;
@@ -1175,9 +1162,10 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, · 321 unmodified lines
11751162 unsigned *copy_ops,
11761163 unsigned *map_ops)
11771164 {
1178− struct gnttab_map_grant_ref *gop = queue->tx_map_ops, *request_gop;
1179− struct sk_buff *skb;
1165+ struct gnttab_map_grant_ref *gop = queue->tx_map_ops;
1166+ struct sk_buff *skb, *nskb;
11801167 int ret;
1168+ unsigned int frag_overflow;
11811169
11821170 while (skb_queue_len(&queue->tx_queue) < budget) {
11831171 struct xen_netif_tx_request txreq;
@@ -1265,6 +1253,29 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, · 81 unmodified lines
12651253 break;
12661254 }
12671255
1256+ skb_shinfo(skb)->nr_frags = ret;
1257+ if (data_len < txreq.size)
1258+ skb_shinfo(skb)->nr_frags++;
1259+ /* At this point shinfo->nr_frags is in fact the number of
1260+ * slots, which can be as large as XEN_NETBK_LEGACY_SLOTS_MAX.
1261+ */
1262+ frag_overflow = 0;
1263+ nskb = NULL;
1264+ if (skb_shinfo(skb)->nr_frags > MAX_SKB_FRAGS) {
1265+ frag_overflow = skb_shinfo(skb)->nr_frags - MAX_SKB_FRAGS;
1266+ BUG_ON(frag_overflow > MAX_SKB_FRAGS);
1267+ skb_shinfo(skb)->nr_frags = MAX_SKB_FRAGS;
1268+ nskb = xenvif_alloc_skb(0);
1269+ if (unlikely(nskb == NULL)) {
1270+ kfree_skb(skb);
1271+ xenvif_tx_err(queue, &txreq, idx);
1272+ if (net_ratelimit())
1273+ netdev_err(queue->vif->dev,
1274+ "Can't allocate the frag_list skb.\n");
1275+ break;
1276+ }
1277+ }
1278+
12681279 if (extras[XEN_NETIF_EXTRA_TYPE_GSO - 1].type) {
12691280 struct xen_netif_extra_info *gso;
12701281 gso = &extras[XEN_NETIF_EXTRA_TYPE_GSO - 1];
@@ -1272,6 +1283,7 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, · 1 unmodified line
12721283 if (xenvif_set_skb_gso(queue->vif, skb, gso)) {
12731284 /* Failure in xenvif_set_skb_gso is fatal. */
12741285 kfree_skb(skb);
1286+ kfree_skb(nskb);
12751287 break;
12761288 }
12771289 }
@@ -1294,9 +1306,7 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, · 16 unmodified lines
12941306
12951307 (*copy_ops)++;
12961308
1297− skb_shinfo(skb)->nr_frags = ret;
12981309 if (data_len < txreq.size) {
1299− skb_shinfo(skb)->nr_frags++;
13001310 frag_set_pending_idx(&skb_shinfo(skb)->frags[0],
13011311 pending_idx);
13021312 xenvif_tx_create_map_op(queue, pending_idx, &txreq, gop);
@@ -1310,13 +1320,8 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, · 7 unmodified lines
13101320
13111321 queue->pending_cons++;
13121322
1313− request_gop = xenvif_get_requests(queue, skb, txfrags, gop);
1314− if (request_gop == NULL) {
1315− kfree_skb(skb);
1316− xenvif_tx_err(queue, &txreq, idx);
1317− break;
1318− }
1319− gop = request_gop;
1323+ gop = xenvif_get_requests(queue, skb, txfrags, gop,
1324+ frag_overflow, nskb);
13201325
13211326 __skb_queue_tail(&queue->tx_queue, skb);
13221327
@@ -1536,7 +1541,6 @@ void xenvif_zerocopy_callback(struct ubuf_info *ubuf, bool zerocopy_success) · 213 unmodified lines
15361541 smp_wmb();
15371542 queue->dealloc_prod++;
15381543 } while (ubuf);
1539− wake_up(&queue->dealloc_wq);
15401544 spin_unlock_irqrestore(&queue->callback_lock, flags);
15411545
15421546 if (likely(zerocopy_success))
drivers/ntb/ntb.c+1−1
@@ -114,7 +114,7 @@ int ntb_register_device(struct ntb_dev *ntb) · 113 unmodified lines
114114 ntb->dev.bus = &ntb_bus;
115115 ntb->dev.parent = &ntb->pdev->dev;
116116 ntb->dev.release = ntb_dev_release;
117− dev_set_name(&ntb->dev, pci_name(ntb->pdev));
117+ dev_set_name(&ntb->dev, "%s", pci_name(ntb->pdev));
118118
119119 ntb->ctx = NULL;
120120 ntb->ctx_ops = NULL;
drivers/ntb/ntb_transport.c+124−77
@@ -142,10 +142,11 @@ struct ntb_transport_qp { · 141 unmodified lines
142142
143143 void (*rx_handler)(struct ntb_transport_qp *qp, void *qp_data,
144144 void *data, int len);
145+ struct list_head rx_post_q;
145146 struct list_head rx_pend_q;
146147 struct list_head rx_free_q;
147− spinlock_t ntb_rx_pend_q_lock;
148− spinlock_t ntb_rx_free_q_lock;
148+ /* ntb_rx_q_lock: synchronize access to rx_XXXX_q */
149+ spinlock_t ntb_rx_q_lock;
149150 void *rx_buff;
150151 unsigned int rx_index;
151152 unsigned int rx_max_entry;
@@ -211,6 +212,8 @@ struct ntb_transport_ctx { · 59 unmodified lines
211212 bool link_is_up;
212213 struct delayed_work link_work;
213214 struct work_struct link_cleanup;
215+
216+ struct dentry *debugfs_node_dir;
214217 };
215218
216219 enum {
@@ -436,13 +439,17 @@ static ssize_t debugfs_read(struct file *filp, char __user *ubuf, size_t count, · 219 unmodified lines
436439 char *buf;
437440 ssize_t ret, out_offset, out_count;
438441
442+ qp = filp->private_data;
443+
444+ if (!qp || !qp->link_is_up)
445+ return 0;
446+
439447 out_count = 1000;
440448
441449 buf = kmalloc(out_count, GFP_KERNEL);
442450 if (!buf)
443451 return -ENOMEM;
444452
445− qp = filp->private_data;
446453 out_offset = 0;
447454 out_offset += snprintf(buf + out_offset, out_count - out_offset,
448455 "NTB QP stats\n");
@@ -534,6 +541,27 @@ out: · 85 unmodified lines
534541 return entry;
535542 }
536543
544+static struct ntb_queue_entry *ntb_list_mv(spinlock_t *lock,
545+ struct list_head *list,
546+ struct list_head *to_list)
547+{
548+ struct ntb_queue_entry *entry;
549+ unsigned long flags;
550+
551+ spin_lock_irqsave(lock, flags);
552+
553+ if (list_empty(list)) {
554+ entry = NULL;
555+ } else {
556+ entry = list_first_entry(list, struct ntb_queue_entry, entry);
557+ list_move_tail(&entry->entry, to_list);
558+ }
559+
560+ spin_unlock_irqrestore(lock, flags);
561+
562+ return entry;
563+}
564+
537565 static int ntb_transport_setup_qp_mw(struct ntb_transport_ctx *nt,
538566 unsigned int qp_num)
539567 {
@@ -601,13 +629,16 @@ static void ntb_free_mw(struct ntb_transport_ctx *nt, int num_mw) · 61 unmodified lines
601629 }
602630
603631 static int ntb_set_mw(struct ntb_transport_ctx *nt, int num_mw,
604− unsigned int size)
632+ resource_size_t size)
605633 {
606634 struct ntb_transport_mw *mw = &nt->mw_vec[num_mw];
607635 struct pci_dev *pdev = nt->ndev->pdev;
608− unsigned int xlat_size, buff_size;
636+ size_t xlat_size, buff_size;
609637 int rc;
610638
639+ if (!size)
640+ return -EINVAL;
641+
611642 xlat_size = round_up(size, mw->xlat_align_size);
612643 buff_size = round_up(size, mw->xlat_align);
613644
@@ -627,7 +658,7 @@ static int ntb_set_mw(struct ntb_transport_ctx *nt, int num_mw, · 13 unmodified lines
627658 if (!mw->virt_addr) {
628659 mw->xlat_size = 0;
629660 mw->buff_size = 0;
630− dev_err(&pdev->dev, "Unable to alloc MW buff of size %d\n",
661+ dev_err(&pdev->dev, "Unable to alloc MW buff of size %zu\n",
631662 buff_size);
632663 return -ENOMEM;
633664 }
@@ -867,6 +898,8 @@ static void ntb_qp_link_work(struct work_struct *work) · 233 unmodified lines
867898
868899 if (qp->event_handler)
869900 qp->event_handler(qp->cb_data, qp->link_is_up);
901+
902+ tasklet_schedule(&qp->rxc_db_work);
870903 } else if (nt->link_is_up)
871904 schedule_delayed_work(&qp->link_work,
872905 msecs_to_jiffies(NTB_LINK_DOWN_TIMEOUT));
@@ -923,12 +956,12 @@ static int ntb_transport_init_queue(struct ntb_transport_ctx *nt, · 50 unmodified lines
923956 qp->tx_max_frame = min(transport_mtu, tx_size / 2);
924957 qp->tx_max_entry = tx_size / qp->tx_max_frame;
925958
926− if (nt_debugfs_dir) {
959+ if (nt->debugfs_node_dir) {
927960 char debugfs_name[4];
928961
929962 snprintf(debugfs_name, 4, "qp%d", qp_num);
930963 qp->debugfs_dir = debugfs_create_dir(debugfs_name,
931− nt_debugfs_dir);
964+ nt->debugfs_node_dir);
932965
933966 qp->debugfs_stats = debugfs_create_file("stats", S_IRUSR,
934967 qp->debugfs_dir, qp,
@@ -941,10 +974,10 @@ static int ntb_transport_init_queue(struct ntb_transport_ctx *nt, · 6 unmodified lines
941974 INIT_DELAYED_WORK(&qp->link_work, ntb_qp_link_work);
942975 INIT_WORK(&qp->link_cleanup, ntb_qp_link_cleanup_work);
943976
944− spin_lock_init(&qp->ntb_rx_pend_q_lock);
945− spin_lock_init(&qp->ntb_rx_free_q_lock);
977+ spin_lock_init(&qp->ntb_rx_q_lock);
946978 spin_lock_init(&qp->ntb_tx_free_q_lock);
947979
980+ INIT_LIST_HEAD(&qp->rx_post_q);
948981 INIT_LIST_HEAD(&qp->rx_pend_q);
949982 INIT_LIST_HEAD(&qp->rx_free_q);
950983 INIT_LIST_HEAD(&qp->tx_free_q);
@@ -1031,6 +1064,12 @@ static int ntb_transport_probe(struct ntb_client *self, struct ntb_dev *ndev) · 80 unmodified lines
10311064 goto err2;
10321065 }
10331066
1067+ if (nt_debugfs_dir) {
1068+ nt->debugfs_node_dir =
1069+ debugfs_create_dir(pci_name(ndev->pdev),
1070+ nt_debugfs_dir);
1071+ }
1072+
10341073 for (i = 0; i < qp_count; i++) {
10351074 rc = ntb_transport_init_queue(nt, i);
10361075 if (rc)
@@ -1107,22 +1146,47 @@ static void ntb_transport_free(struct ntb_client *self, struct ntb_dev *ndev) · 70 unmodified lines
11071146 kfree(nt);
11081147 }
11091148
1110−static void ntb_rx_copy_callback(void *data)
1149+static void ntb_complete_rxc(struct ntb_transport_qp *qp)
11111150 {
1112− struct ntb_queue_entry *entry = data;
1113− struct ntb_transport_qp *qp = entry->qp;
1114− void *cb_data = entry->cb_data;
1115− unsigned int len = entry->len;
1116− struct ntb_payload_header *hdr = entry->rx_hdr;
1151+ struct ntb_queue_entry *entry;
1152+ void *cb_data;
1153+ unsigned int len;
1154+ unsigned long irqflags;
1155+
1156+ spin_lock_irqsave(&qp->ntb_rx_q_lock, irqflags);
1157+
1158+ while (!list_empty(&qp->rx_post_q)) {
1159+ entry = list_first_entry(&qp->rx_post_q,
1160+ struct ntb_queue_entry, entry);
1161+ if (!(entry->flags & DESC_DONE_FLAG))
1162+ break;
1163+
1164+ entry->rx_hdr->flags = 0;
1165+ iowrite32(entry->index, &qp->rx_info->entry);
11171166
1118− hdr->flags = 0;
1167+ cb_data = entry->cb_data;
1168+ len = entry->len;
11191169
1120− iowrite32(entry->index, &qp->rx_info->entry);
1170+ list_move_tail(&entry->entry, &qp->rx_free_q);
11211171
1122− ntb_list_add(&qp->ntb_rx_free_q_lock, &entry->entry, &qp->rx_free_q);
1172+ spin_unlock_irqrestore(&qp->ntb_rx_q_lock, irqflags);
11231173
1124− if (qp->rx_handler && qp->client_ready)
1125− qp->rx_handler(qp, qp->cb_data, cb_data, len);
1174+ if (qp->rx_handler && qp->client_ready)
1175+ qp->rx_handler(qp, qp->cb_data, cb_data, len);
1176+
1177+ spin_lock_irqsave(&qp->ntb_rx_q_lock, irqflags);
1178+ }
1179+
1180+ spin_unlock_irqrestore(&qp->ntb_rx_q_lock, irqflags);
1181+}
1182+
1183+static void ntb_rx_copy_callback(void *data)
1184+{
1185+ struct ntb_queue_entry *entry = data;
1186+
1187+ entry->flags |= DESC_DONE_FLAG;
1188+
1189+ ntb_complete_rxc(entry->qp);
11261190 }
11271191
11281192 static void ntb_memcpy_rx(struct ntb_queue_entry *entry, void *offset)
@@ -1138,19 +1202,18 @@ static void ntb_memcpy_rx(struct ntb_queue_entry *entry, void *offset) · 9 unmodified lines
11381202 ntb_rx_copy_callback(entry);
11391203 }
11401204
1141−static void ntb_async_rx(struct ntb_queue_entry *entry, void *offset,
1142− size_t len)
1205+static void ntb_async_rx(struct ntb_queue_entry *entry, void *offset)
11431206 {
11441207 struct dma_async_tx_descriptor *txd;
11451208 struct ntb_transport_qp *qp = entry->qp;
11461209 struct dma_chan *chan = qp->dma_chan;
11471210 struct dma_device *device;
1148− size_t pay_off, buff_off;
1211+ size_t pay_off, buff_off, len;
11491212 struct dmaengine_unmap_data *unmap;
11501213 dma_cookie_t cookie;
11511214 void *buf = entry->buf;
11521215
1153− entry->len = len;
1216+ len = entry->len;
11541217
11551218 if (!chan)
11561219 goto err;
@@ -1226,7 +1289,6 @@ static int ntb_process_rxc(struct ntb_transport_qp *qp) · 69 unmodified lines
12261289 struct ntb_payload_header *hdr;
12271290 struct ntb_queue_entry *entry;
12281291 void *offset;
1229− int rc;
12301292
12311293 offset = qp->rx_buff + qp->rx_max_frame * qp->rx_index;
12321294 hdr = offset + qp->rx_max_frame - sizeof(struct ntb_payload_header);
@@ -1255,65 +1317,43 @@ static int ntb_process_rxc(struct ntb_transport_qp *qp) · 22 unmodified lines
12551317 return -EIO;
12561318 }
12571319
1258− entry = ntb_list_rm(&qp->ntb_rx_pend_q_lock, &qp->rx_pend_q);
1320+ entry = ntb_list_mv(&qp->ntb_rx_q_lock, &qp->rx_pend_q, &qp->rx_post_q);
12591321 if (!entry) {
12601322 dev_dbg(&qp->ndev->pdev->dev, "no receive buffer\n");
12611323 qp->rx_err_no_buf++;
1262−
1263− rc = -ENOMEM;
1264− goto err;
1324+ return -EAGAIN;
12651325 }
12661326
1327+ entry->rx_hdr = hdr;
1328+ entry->index = qp->rx_index;
1329+
12671330 if (hdr->len > entry->len) {
12681331 dev_dbg(&qp->ndev->pdev->dev,
12691332 "receive buffer overflow! Wanted %d got %d\n",
12701333 hdr->len, entry->len);
12711334 qp->rx_err_oflow++;
12721335
1273− rc = -EIO;
1274− goto err;
1275− }
1336+ entry->len = -EIO;
1337+ entry->flags |= DESC_DONE_FLAG;
12761338
1277− dev_dbg(&qp->ndev->pdev->dev,
1278− "RX OK index %u ver %u size %d into buf size %d\n",
1279− qp->rx_index, hdr->ver, hdr->len, entry->len);
1339+ ntb_complete_rxc(qp);
1340+ } else {
1341+ dev_dbg(&qp->ndev->pdev->dev,
1342+ "RX OK index %u ver %u size %d into buf size %d\n",
1343+ qp->rx_index, hdr->ver, hdr->len, entry->len);
12801344
1281− qp->rx_bytes += hdr->len;
1282− qp->rx_pkts++;
1345+ qp->rx_bytes += hdr->len;
1346+ qp->rx_pkts++;
12831347
1284− entry->index = qp->rx_index;
1285− entry->rx_hdr = hdr;
1348+ entry->len = hdr->len;
12861349
1287− ntb_async_rx(entry, offset, hdr->len);
1350+ ntb_async_rx(entry, offset);
1351+ }
12881352
12891353 qp->rx_index++;
12901354 qp->rx_index %= qp->rx_max_entry;
12911355
12921356 return 0;
1293−
1294−err:
1295− /* FIXME: if this syncrhonous update of the rx_index gets ahead of
1296− * asyncrhonous ntb_rx_copy_callback of previous entry, there are three
1297− * scenarios:
1298− *
1299− * 1) The peer might miss this update, but observe the update
1300− * from the memcpy completion callback. In this case, the buffer will
1301− * not be freed on the peer to be reused for a different packet. The
1302− * successful rx of a later packet would clear the condition, but the
1303− * condition could persist if several rx fail in a row.
1304− *
1305− * 2) The peer may observe this update before the asyncrhonous copy of
1306− * prior packets is completed. The peer may overwrite the buffers of
1307− * the prior packets before they are copied.
1308− *
1309− * 3) Both: the peer may observe the update, and then observe the index
1310− * decrement by the asynchronous completion callback. Who knows what
1311− * badness that will cause.
1312− */
1313− hdr->flags = 0;
1314− iowrite32(qp->rx_index, &qp->rx_info->entry);
1315−
1316− return rc;
13171357 }
13181358
13191359 static void ntb_transport_rxc_db(unsigned long data)
@@ -1333,7 +1373,7 @@ static void ntb_transport_rxc_db(unsigned long data) · 13 unmodified lines
13331373 break;
13341374 }
13351375
1336− if (qp->dma_chan)
1376+ if (i && qp->dma_chan)
13371377 dma_async_issue_pending(qp->dma_chan);
13381378
13391379 if (i == qp->rx_max_entry) {
@@ -1609,7 +1649,7 @@ ntb_transport_create_queue(void *data, struct device *client_dev, · 269 unmodified lines
16091649 goto err1;
16101650
16111651 entry->qp = qp;
1612− ntb_list_add(&qp->ntb_rx_free_q_lock, &entry->entry,
1652+ ntb_list_add(&qp->ntb_rx_q_lock, &entry->entry,
16131653 &qp->rx_free_q);
16141654 }
16151655
@@ -1634,7 +1674,7 @@ err2: · 18 unmodified lines
16341674 while ((entry = ntb_list_rm(&qp->ntb_tx_free_q_lock, &qp->tx_free_q)))
16351675 kfree(entry);
16361676 err1:
1637− while ((entry = ntb_list_rm(&qp->ntb_rx_free_q_lock, &qp->rx_free_q)))
1677+ while ((entry = ntb_list_rm(&qp->ntb_rx_q_lock, &qp->rx_free_q)))
16381678 kfree(entry);
16391679 if (qp->dma_chan)
16401680 dma_release_channel(qp->dma_chan);
@@ -1652,7 +1692,6 @@ EXPORT_SYMBOL_GPL(ntb_transport_create_queue); · 11 unmodified lines
16521692 */
16531693 void ntb_transport_free_queue(struct ntb_transport_qp *qp)
16541694 {
1655− struct ntb_transport_ctx *nt = qp->transport;
16561695 struct pci_dev *pdev;
16571696 struct ntb_queue_entry *entry;
16581697 u64 qp_bit;
@@ -1689,18 +1728,23 @@ void ntb_transport_free_queue(struct ntb_transport_qp *qp) · 30 unmodified lines
16891728 qp->tx_handler = NULL;
16901729 qp->event_handler = NULL;
16911730
1692− while ((entry = ntb_list_rm(&qp->ntb_rx_free_q_lock, &qp->rx_free_q)))
1731+ while ((entry = ntb_list_rm(&qp->ntb_rx_q_lock, &qp->rx_free_q)))
16931732 kfree(entry);
16941733
1695− while ((entry = ntb_list_rm(&qp->ntb_rx_pend_q_lock, &qp->rx_pend_q))) {
1696− dev_warn(&pdev->dev, "Freeing item from a non-empty queue\n");
1734+ while ((entry = ntb_list_rm(&qp->ntb_rx_q_lock, &qp->rx_pend_q))) {
1735+ dev_warn(&pdev->dev, "Freeing item from non-empty rx_pend_q\n");
1736+ kfree(entry);
1737+ }
1738+
1739+ while ((entry = ntb_list_rm(&qp->ntb_rx_q_lock, &qp->rx_post_q))) {
1740+ dev_warn(&pdev->dev, "Freeing item from non-empty rx_post_q\n");
16971741 kfree(entry);
16981742 }
16991743
17001744 while ((entry = ntb_list_rm(&qp->ntb_tx_free_q_lock, &qp->tx_free_q)))
17011745 kfree(entry);
17021746
1703− nt->qp_bitmap_free |= qp_bit;
1747+ qp->transport->qp_bitmap_free |= qp_bit;
17041748
17051749 dev_info(&pdev->dev, "NTB Transport QP %d freed\n", qp->qp_num);
17061750 }
@@ -1724,14 +1768,14 @@ void *ntb_transport_rx_remove(struct ntb_transport_qp *qp, unsigned int *len) · 17 unmodified lines
17241768 if (!qp || qp->client_ready)
17251769 return NULL;
17261770
1727− entry = ntb_list_rm(&qp->ntb_rx_pend_q_lock, &qp->rx_pend_q);
1771+ entry = ntb_list_rm(&qp->ntb_rx_q_lock, &qp->rx_pend_q);
17281772 if (!entry)
17291773 return NULL;
17301774
17311775 buf = entry->cb_data;
17321776 *len = entry->len;
17331777
1734− ntb_list_add(&qp->ntb_rx_free_q_lock, &entry->entry, &qp->rx_free_q);
1778+ ntb_list_add(&qp->ntb_rx_q_lock, &entry->entry, &qp->rx_free_q);
17351779
17361780 return buf;
17371781 }
@@ -1757,15 +1801,18 @@ int ntb_transport_rx_enqueue(struct ntb_transport_qp *qp, void *cb, void *data, · 19 unmodified lines
17571801 if (!qp)
17581802 return -EINVAL;
17591803
1760− entry = ntb_list_rm(&qp->ntb_rx_free_q_lock, &qp->rx_free_q);
1804+ entry = ntb_list_rm(&qp->ntb_rx_q_lock, &qp->rx_free_q);
17611805 if (!entry)
17621806 return -ENOMEM;
17631807
17641808 entry->cb_data = cb;
17651809 entry->buf = data;
17661810 entry->len = len;
1811+ entry->flags = 0;
1812+
1813+ ntb_list_add(&qp->ntb_rx_q_lock, &entry->entry, &qp->rx_pend_q);
17671814
1768− ntb_list_add(&qp->ntb_rx_pend_q_lock, &entry->entry, &qp->rx_pend_q);
1815+ tasklet_schedule(&qp->rxc_db_work);
17691816
17701817 return 0;
17711818 }
drivers/phy/phy-sun4i-usb.c+1−0
@@ -212,6 +212,7 @@ void sun4i_usb_phy_set_squelch_detect(struct phy *_phy, bool enabled) · 211 unmodified lines
212212
213213 sun4i_usb_phy_write(phy, PHY_SQUELCH_DETECT, enabled ? 0 : 2, 2);
214214 }
215+EXPORT_SYMBOL_GPL(sun4i_usb_phy_set_squelch_detect);
215216
216217 static struct phy_ops sun4i_usb_phy_ops = {
217218 .init = sun4i_usb_phy_init,
drivers/phy/phy-ti-pipe3.c+55−6
@@ -28,6 +28,8 @@ · 27 unmodified lines
2828 #include <linux/delay.h>
2929 #include <linux/phy/omap_control_phy.h>
3030 #include <linux/of_platform.h>
31+#include <linux/mfd/syscon.h>
32+#include <linux/regmap.h>
3133
3234 #define PLL_STATUS 0x00000004
3335 #define PLL_GO 0x00000008
@@ -52,6 +54,8 @@ · 18 unmodified lines
5254 #define PLL_LOCK 0x2
5355 #define PLL_IDLE 0x1
5456
57+#define SATA_PLL_SOFT_RESET BIT(18)
58+
5559 /*
5660 * This is an Empirical value that works, need to confirm the actual
5761 * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status
@@ -82,6 +86,9 @@ struct ti_pipe3 { · 24 unmodified lines
8286 struct clk *refclk;
8387 struct clk *div_clk;
8488 struct pipe3_dpll_map *dpll_map;
89+ struct regmap *dpll_reset_syscon; /* ctrl. reg. acces */
90+ unsigned int dpll_reset_reg; /* reg. index within syscon */
91+ bool sata_refclk_enabled;
8592 };
8693
8794 static struct pipe3_dpll_map dpll_map_usb[] = {
@@ -249,8 +256,11 @@ static int ti_pipe3_exit(struct phy *x) · 161 unmodified lines
249256 u32 val;
250257 unsigned long timeout;
251258
252− /* SATA DPLL can't be powered down due to Errata i783 */
253− if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata"))
259+ /* If dpll_reset_syscon is not present we wont power down SATA DPLL
260+ * due to Errata i783
261+ */
262+ if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata") &&
263+ !phy->dpll_reset_syscon)
254264 return 0;
255265
256266 /* PCIe doesn't have internal DPLL */
@@ -276,6 +286,14 @@ static int ti_pipe3_exit(struct phy *x) · 19 unmodified lines
276286 }
277287 }
278288
289+ /* i783: SATA needs control bit toggle after PLL unlock */
290+ if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata")) {
291+ regmap_update_bits(phy->dpll_reset_syscon, phy->dpll_reset_reg,
292+ SATA_PLL_SOFT_RESET, SATA_PLL_SOFT_RESET);
293+ regmap_update_bits(phy->dpll_reset_syscon, phy->dpll_reset_reg,
294+ SATA_PLL_SOFT_RESET, 0);
295+ }
296+
279297 ti_pipe3_disable_clocks(phy);
280298
281299 return 0;
@@ -350,6 +368,21 @@ static int ti_pipe3_probe(struct platform_device *pdev) · 68 unmodified lines
350368 }
351369 } else {
352370 phy->wkupclk = ERR_PTR(-ENODEV);
371+ phy->dpll_reset_syscon = syscon_regmap_lookup_by_phandle(node,
372+ "syscon-pllreset");
373+ if (IS_ERR(phy->dpll_reset_syscon)) {
374+ dev_info(&pdev->dev,
375+ "can't get syscon-pllreset, sata dpll won't idle\n");
376+ phy->dpll_reset_syscon = NULL;
377+ } else {
378+ if (of_property_read_u32_index(node,
379+ "syscon-pllreset", 1,
380+ &phy->dpll_reset_reg)) {
381+ dev_err(&pdev->dev,
382+ "couldn't get pllreset reg. offset\n");
383+ return -EINVAL;
384+ }
385+ }
353386 }
354387
355388 if (of_device_is_compatible(node, "ti,phy-pipe3-pcie")) {
@@ -402,10 +435,16 @@ static int ti_pipe3_probe(struct platform_device *pdev) · 46 unmodified lines
402435
403436 platform_set_drvdata(pdev, phy);
404437 pm_runtime_enable(phy->dev);
405− /* Prevent auto-disable of refclk for SATA PHY due to Errata i783 */
406− if (of_device_is_compatible(node, "ti,phy-pipe3-sata"))
407− if (!IS_ERR(phy->refclk))
438+
439+ /*
440+ * Prevent auto-disable of refclk for SATA PHY due to Errata i783
441+ */
442+ if (of_device_is_compatible(node, "ti,phy-pipe3-sata")) {
443+ if (!IS_ERR(phy->refclk)) {
408444 clk_prepare_enable(phy->refclk);
445+ phy->sata_refclk_enabled = true;
446+ }
447+ }
409448
410449 generic_phy = devm_phy_create(phy->dev, NULL, &ops);
411450 if (IS_ERR(generic_phy))
@@ -472,8 +511,18 @@ static void ti_pipe3_disable_clocks(struct ti_pipe3 *phy) · 60 unmodified lines
472511 {
473512 if (!IS_ERR(phy->wkupclk))
474513 clk_disable_unprepare(phy->wkupclk);
475− if (!IS_ERR(phy->refclk))
514+ if (!IS_ERR(phy->refclk)) {
476515 clk_disable_unprepare(phy->refclk);
516+ /*
517+ * SATA refclk needs an additional disable as we left it
518+ * on in probe to avoid Errata i783
519+ */
520+ if (phy->sata_refclk_enabled) {
521+ clk_disable_unprepare(phy->refclk);
522+ phy->sata_refclk_enabled = false;
523+ }
524+ }
525+
477526 if (!IS_ERR(phy->div_clk))
478527 clk_disable_unprepare(phy->div_clk);
479528 }
drivers/platform/chrome/Kconfig+0−1
@@ -4,7 +4,6 @@ · 3 unmodified lines
44
55 menuconfig CHROME_PLATFORMS
66 bool "Platform support for Chrome hardware"
7− depends on X86 || ARM
87 ---help---
98 Say Y here to get to see options for platform support for
109 various Chromebooks and Chromeboxes. This option alone does
drivers/scsi/ipr.c+18−10
@@ -599,9 +599,10 @@ static void ipr_trc_hook(struct ipr_cmnd *ipr_cmd, · 598 unmodified lines
599599 {
600600 struct ipr_trace_entry *trace_entry;
601601 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
602+ unsigned int trace_index;
602603
603− trace_entry = &ioa_cfg->trace[atomic_add_return
604− (1, &ioa_cfg->trace_index)%IPR_NUM_TRACE_ENTRIES];
604+ trace_index = atomic_add_return(1, &ioa_cfg->trace_index) & IPR_TRACE_INDEX_MASK;
605+ trace_entry = &ioa_cfg->trace[trace_index];
605606 trace_entry->time = jiffies;
606607 trace_entry->op_code = ipr_cmd->ioarcb.cmd_pkt.cdb[0];
607608 trace_entry->type = type;
@@ -1051,10 +1052,15 @@ static void ipr_send_blocking_cmd(struct ipr_cmnd *ipr_cmd, · 443 unmodified lines
10511052
10521053 static int ipr_get_hrrq_index(struct ipr_ioa_cfg *ioa_cfg)
10531054 {
1055+ unsigned int hrrq;
1056+
10541057 if (ioa_cfg->hrrq_num == 1)
1055− return 0;
1056− else
1057− return (atomic_add_return(1, &ioa_cfg->hrrq_index) % (ioa_cfg->hrrq_num - 1)) + 1;
1058+ hrrq = 0;
1059+ else {
1060+ hrrq = atomic_add_return(1, &ioa_cfg->hrrq_index);
1061+ hrrq = (hrrq % (ioa_cfg->hrrq_num - 1)) + 1;
1062+ }
1063+ return hrrq;
10581064 }
10591065
10601066 /**
@@ -6263,21 +6269,23 @@ static void ipr_scsi_done(struct ipr_cmnd *ipr_cmd) · 5202 unmodified lines
62636269 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
62646270 struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd;
62656271 u32 ioasc = be32_to_cpu(ipr_cmd->s.ioasa.hdr.ioasc);
6266− unsigned long hrrq_flags;
6272+ unsigned long lock_flags;
62676273
62686274 scsi_set_resid(scsi_cmd, be32_to_cpu(ipr_cmd->s.ioasa.hdr.residual_data_len));
62696275
62706276 if (likely(IPR_IOASC_SENSE_KEY(ioasc) == 0)) {
62716277 scsi_dma_unmap(scsi_cmd);
62726278
6273− spin_lock_irqsave(ipr_cmd->hrrq->lock, hrrq_flags);
6279+ spin_lock_irqsave(ipr_cmd->hrrq->lock, lock_flags);
62746280 list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q);
62756281 scsi_cmd->scsi_done(scsi_cmd);
6276− spin_unlock_irqrestore(ipr_cmd->hrrq->lock, hrrq_flags);
6282+ spin_unlock_irqrestore(ipr_cmd->hrrq->lock, lock_flags);
62776283 } else {
6278− spin_lock_irqsave(ipr_cmd->hrrq->lock, hrrq_flags);
6284+ spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
6285+ spin_lock(&ipr_cmd->hrrq->_lock);
62796286 ipr_erp_start(ioa_cfg, ipr_cmd);
6280− spin_unlock_irqrestore(ipr_cmd->hrrq->lock, hrrq_flags);
6287+ spin_unlock(&ipr_cmd->hrrq->_lock);
6288+ spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
62816289 }
62826290 }
62836291
drivers/scsi/ipr.h+1−0
@@ -1486,6 +1486,7 @@ struct ipr_ioa_cfg { · 1485 unmodified lines
14861486
14871487 #define IPR_NUM_TRACE_INDEX_BITS 8
14881488 #define IPR_NUM_TRACE_ENTRIES (1 << IPR_NUM_TRACE_INDEX_BITS)
1489+#define IPR_TRACE_INDEX_MASK (IPR_NUM_TRACE_ENTRIES - 1)
14891490 #define IPR_TRACE_SIZE (sizeof(struct ipr_trace_entry) * IPR_NUM_TRACE_ENTRIES)
14901491 char trace_start[8];
14911492 #define IPR_TRACE_START_LABEL "trace"
drivers/scsi/scsi_error.c+1−1
@@ -944,7 +944,7 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses, · 943 unmodified lines
944944 scmd->sdb.length);
945945 scmd->sdb.table.sgl = &ses->sense_sgl;
946946 scmd->sc_data_direction = DMA_FROM_DEVICE;
947− scmd->sdb.table.nents = 1;
947+ scmd->sdb.table.nents = scmd->sdb.table.orig_nents = 1;
948948 scmd->cmnd[0] = REQUEST_SENSE;
949949 scmd->cmnd[4] = scmd->sdb.length;
950950 scmd->cmd_len = COMMAND_SIZE(scmd->cmnd[0]);
drivers/scsi/scsi_lib.c+3−3
@@ -583,7 +583,7 @@ static struct scatterlist *scsi_sg_alloc(unsigned int nents, gfp_t gfp_mask) · 582 unmodified lines
583583
584584 static void scsi_free_sgtable(struct scsi_data_buffer *sdb, bool mq)
585585 {
586− if (mq && sdb->table.nents <= SCSI_MAX_SG_SEGMENTS)
586+ if (mq && sdb->table.orig_nents <= SCSI_MAX_SG_SEGMENTS)
587587 return;
588588 __sg_free_table(&sdb->table, SCSI_MAX_SG_SEGMENTS, mq, scsi_sg_free);
589589 }
@@ -597,8 +597,8 @@ static int scsi_alloc_sgtable(struct scsi_data_buffer *sdb, int nents, bool mq) · 7 unmodified lines
597597
598598 if (mq) {
599599 if (nents <= SCSI_MAX_SG_SEGMENTS) {
600− sdb->table.nents = nents;
601− sg_init_table(sdb->table.sgl, sdb->table.nents);
600+ sdb->table.nents = sdb->table.orig_nents = nents;
601+ sg_init_table(sdb->table.sgl, nents);
602602 return 0;
603603 }
604604 first_chunk = sdb->table.sgl;
drivers/staging/comedi/drivers/das1800.c+1−0
@@ -1266,6 +1266,7 @@ static const struct das1800_board *das1800_probe(struct comedi_device *dev) · 1265 unmodified lines
12661266 if (index == das1801hc || index == das1802hc)
12671267 return board;
12681268 index = das1801hc;
1269+ break;
12691270 default:
12701271 dev_err(dev->class_dev,
12711272 "Board model: probe returned 0x%x (unknown, please report)\n",
drivers/staging/lustre/lustre/obdclass/debug.c+1−1
@@ -40,7 +40,7 @@ · 39 unmodified lines
4040
4141 #define DEBUG_SUBSYSTEM D_OTHER
4242
43−#include <linux/unaligned/access_ok.h>
43+#include <asm/unaligned.h>
4444
4545 #include "../include/obd_support.h"
4646 #include "../include/lustre_debug.h"
drivers/staging/vt6655/device_main.c+3−2
@@ -1483,8 +1483,9 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw, · 1482 unmodified lines
14831483 }
14841484 }
14851485
1486− if (changed & BSS_CHANGED_ASSOC && priv->op_mode != NL80211_IFTYPE_AP) {
1487− if (conf->assoc) {
1486+ if (changed & (BSS_CHANGED_ASSOC | BSS_CHANGED_BEACON_INFO) &&
1487+ priv->op_mode != NL80211_IFTYPE_AP) {
1488+ if (conf->assoc && conf->beacon_rate) {
14881489 CARDbUpdateTSF(priv, conf->beacon_rate->hw_value,
14891490 conf->sync_tsf);
14901491
drivers/thermal/hisi_thermal.c+0−1
@@ -405,7 +405,6 @@ static SIMPLE_DEV_PM_OPS(hisi_thermal_pm_ops, · 404 unmodified lines
405405 static struct platform_driver hisi_thermal_driver = {
406406 .driver = {
407407 .name = "hisi_thermal",
408− .owner = THIS_MODULE,
409408 .pm = &hisi_thermal_pm_ops,
410409 .of_match_table = of_hisi_thermal_match,
411410 },
drivers/thermal/power_allocator.c+16−10
@@ -229,7 +229,8 @@ static int allocate_power(struct thermal_zone_device *tz, · 228 unmodified lines
229229 struct thermal_instance *instance;
230230 struct power_allocator_params *params = tz->governor_data;
231231 u32 *req_power, *max_power, *granted_power, *extra_actor_power;
232− u32 total_req_power, max_allocatable_power;
232+ u32 *weighted_req_power;
233+ u32 total_req_power, max_allocatable_power, total_weighted_req_power;
233234 u32 total_granted_power, power_range;
234235 int i, num_actors, total_weight, ret = 0;
235236 int trip_max_desired_temperature = params->trip_max_desired_temperature;
@@ -247,16 +248,17 @@ static int allocate_power(struct thermal_zone_device *tz, · 11 unmodified lines
247248 }
248249
249250 /*
250− * We need to allocate three arrays of the same size:
251− * req_power, max_power and granted_power. They are going to
252− * be needed until this function returns. Allocate them all
253− * in one go to simplify the allocation and deallocation
254− * logic.
251+ * We need to allocate five arrays of the same size:
252+ * req_power, max_power, granted_power, extra_actor_power and
253+ * weighted_req_power. They are going to be needed until this
254+ * function returns. Allocate them all in one go to simplify
255+ * the allocation and deallocation logic.
255256 */
256257 BUILD_BUG_ON(sizeof(*req_power) != sizeof(*max_power));
257258 BUILD_BUG_ON(sizeof(*req_power) != sizeof(*granted_power));
258259 BUILD_BUG_ON(sizeof(*req_power) != sizeof(*extra_actor_power));
259− req_power = devm_kcalloc(&tz->device, num_actors * 4,
260+ BUILD_BUG_ON(sizeof(*req_power) != sizeof(*weighted_req_power));
261+ req_power = devm_kcalloc(&tz->device, num_actors * 5,
260262 sizeof(*req_power), GFP_KERNEL);
261263 if (!req_power) {
262264 ret = -ENOMEM;
@@ -266,8 +268,10 @@ static int allocate_power(struct thermal_zone_device *tz, · 3 unmodified lines
266268 max_power = &req_power[num_actors];
267269 granted_power = &req_power[2 * num_actors];
268270 extra_actor_power = &req_power[3 * num_actors];
271+ weighted_req_power = &req_power[4 * num_actors];
269272
270273 i = 0;
274+ total_weighted_req_power = 0;
271275 total_req_power = 0;
272276 max_allocatable_power = 0;
273277
@@ -289,13 +293,14 @@ static int allocate_power(struct thermal_zone_device *tz, · 15 unmodified lines
289293 else
290294 weight = instance->weight;
291295
292− req_power[i] = frac_to_int(weight * req_power[i]);
296+ weighted_req_power[i] = frac_to_int(weight * req_power[i]);
293297
294298 if (power_actor_get_max_power(cdev, tz, &max_power[i]))
295299 continue;
296300
297301 total_req_power += req_power[i];
298302 max_allocatable_power += max_power[i];
303+ total_weighted_req_power += weighted_req_power[i];
299304
300305 i++;
301306 }
@@ -303,8 +308,9 @@ static int allocate_power(struct thermal_zone_device *tz, · 1 unmodified line
303308 power_range = pid_controller(tz, current_temp, control_temp,
304309 max_allocatable_power);
305310
306− divvy_up_power(req_power, max_power, num_actors, total_req_power,
307− power_range, granted_power, extra_actor_power);
311+ divvy_up_power(weighted_req_power, max_power, num_actors,
312+ total_weighted_req_power, power_range, granted_power,
313+ extra_actor_power);
308314
309315 total_granted_power = 0;
310316 i = 0;
drivers/thermal/samsung/Kconfig+1−1
@@ -1,6 +1,6 @@
11 config EXYNOS_THERMAL
22 tristate "Exynos thermal management unit driver"
3− depends on OF
3+ depends on THERMAL_OF
44 help
55 If you say yes here you get support for the TMU (Thermal Management
66 Unit) driver for SAMSUNG EXYNOS series of SoCs. This driver initialises
drivers/thermal/samsung/exynos_tmu.c+2−3
@@ -1296,7 +1296,6 @@ static struct thermal_zone_of_device_ops exynos_sensor_ops = { · 1295 unmodified lines
12961296
12971297 static int exynos_tmu_probe(struct platform_device *pdev)
12981298 {
1299− struct exynos_tmu_platform_data *pdata;
13001299 struct exynos_tmu_data *data;
13011300 int ret;
13021301
@@ -1318,8 +1317,6 @@ static int exynos_tmu_probe(struct platform_device *pdev) · 15 unmodified lines
13181317 if (ret)
13191318 goto err_sensor;
13201319
1321− pdata = data->pdata;
1322−
13231320 INIT_WORK(&data->irq_work, exynos_tmu_work);
13241321
13251322 data->clk = devm_clk_get(&pdev->dev, "tmu_apbif");
@@ -1392,6 +1389,8 @@ err_clk_sec: · 66 unmodified lines
13921389 if (!IS_ERR(data->clk_sec))
13931390 clk_unprepare(data->clk_sec);
13941391 err_sensor:
1392+ if (!IS_ERR_OR_NULL(data->regulator))
1393+ regulator_disable(data->regulator);
13951394 thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd);
13961395
13971396 return ret;
drivers/thermal/thermal_core.c+1−0
@@ -1333,6 +1333,7 @@ int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz, · 1332 unmodified lines
13331333 return -ENODEV;
13341334
13351335 unbind:
1336+ device_remove_file(&tz->device, &pos->weight_attr);
13361337 device_remove_file(&tz->device, &pos->attr);
13371338 sysfs_remove_link(&tz->device.kobj, pos->name);
13381339 release_idr(&tz->idr, &tz->lock, pos->id);
drivers/usb/chipidea/core.c+12−1
@@ -1024,7 +1024,18 @@ static struct platform_driver ci_hdrc_driver = { · 1023 unmodified lines
10241024 },
10251025 };
10261026
1027−module_platform_driver(ci_hdrc_driver);
1027+static int __init ci_hdrc_platform_register(void)
1028+{
1029+ ci_hdrc_host_driver_init();
1030+ return platform_driver_register(&ci_hdrc_driver);
1031+}
1032+module_init(ci_hdrc_platform_register);
1033+
1034+static void __exit ci_hdrc_platform_unregister(void)
1035+{
1036+ platform_driver_unregister(&ci_hdrc_driver);
1037+}
1038+module_exit(ci_hdrc_platform_unregister);
10281039
10291040 MODULE_ALIAS("platform:ci_hdrc");
10301041 MODULE_LICENSE("GPL v2");
drivers/usb/chipidea/host.c+5−2
@@ -249,9 +249,12 @@ int ci_hdrc_host_init(struct ci_hdrc *ci) · 248 unmodified lines
249249 rdrv->name = "host";
250250 ci->roles[CI_ROLE_HOST] = rdrv;
251251
252+ return 0;
253+}
254+
255+void ci_hdrc_host_driver_init(void)
256+{
252257 ehci_init_driver(&ci_ehci_hc_driver, &ehci_ci_overrides);
253258 orig_bus_suspend = ci_ehci_hc_driver.bus_suspend;
254259 ci_ehci_hc_driver.bus_suspend = ci_ehci_bus_suspend;
255−
256− return 0;
257260 }
drivers/usb/chipidea/host.h+6−0
@@ -5,6 +5,7 @@ · 4 unmodified lines
55
66 int ci_hdrc_host_init(struct ci_hdrc *ci);
77 void ci_hdrc_host_destroy(struct ci_hdrc *ci);
8+void ci_hdrc_host_driver_init(void);
89
910 #else
1011
@@ -18,6 +19,11 @@ static inline void ci_hdrc_host_destroy(struct ci_hdrc *ci) · 7 unmodified lines
1819
1920 }
2021
22+static void ci_hdrc_host_driver_init(void)
23+{
24+
25+}
26+
2127 #endif
2228
2329 #endif /* __DRIVERS_USB_CHIPIDEA_HOST_H */
drivers/usb/gadget/function/f_hid.c+4−0
@@ -699,6 +699,10 @@ static inline int hidg_get_minor(void) · 698 unmodified lines
699699 int ret;
700700
701701 ret = ida_simple_get(&hidg_ida, 0, 0, GFP_KERNEL);
702+ if (ret >= HIDG_MINORS) {
703+ ida_simple_remove(&hidg_ida, ret);
704+ ret = -ENODEV;
705+ }
702706
703707 return ret;
704708 }
drivers/usb/gadget/function/f_printer.c+9−1
@@ -1248,7 +1248,15 @@ static struct config_item_type printer_func_type = { · 1247 unmodified lines
12481248
12491249 static inline int gprinter_get_minor(void)
12501250 {
1251− return ida_simple_get(&printer_ida, 0, 0, GFP_KERNEL);
1251+ int ret;
1252+
1253+ ret = ida_simple_get(&printer_ida, 0, 0, GFP_KERNEL);
1254+ if (ret >= PRINTER_MINORS) {
1255+ ida_simple_remove(&printer_ida, ret);
1256+ ret = -ENODEV;
1257+ }
1258+
1259+ return ret;
12521260 }
12531261
12541262 static inline void gprinter_put_minor(int minor)
drivers/usb/gadget/function/f_uac2.c+2−2
@@ -1162,14 +1162,14 @@ afunc_set_alt(struct usb_function *fn, unsigned intf, unsigned alt) · 1161 unmodified lines
11621162 factor = 1000;
11631163 } else {
11641164 ep_desc = &hs_epin_desc;
1165− factor = 125;
1165+ factor = 8000;
11661166 }
11671167
11681168 /* pre-compute some values for iso_complete() */
11691169 uac2->p_framesize = opts->p_ssize *
11701170 num_channels(opts->p_chmask);
11711171 rate = opts->p_srate * uac2->p_framesize;
1172− uac2->p_interval = (1 << (ep_desc->bInterval - 1)) * factor;
1172+ uac2->p_interval = factor / (1 << (ep_desc->bInterval - 1));
11731173 uac2->p_pktsize = min_t(unsigned int, rate / uac2->p_interval,
11741174 prm->max_psize);
11751175
drivers/usb/gadget/udc/bdc/bdc_ep.c+1−1
@@ -779,7 +779,7 @@ static int ep_dequeue(struct bdc_ep *ep, struct bdc_req *req) · 778 unmodified lines
779779 /* The current hw dequeue pointer */
780780 tmp_32 = bdc_readl(bdc->regs, BDC_EPSTS0(0));
781781 deq_ptr_64 = tmp_32;
782− tmp_32 = bdc_readl(bdc->regs, BDC_EPSTS0(1));
782+ tmp_32 = bdc_readl(bdc->regs, BDC_EPSTS1(0));
783783 deq_ptr_64 |= ((u64)tmp_32 << 32);
784784
785785 /* we have the dma addr of next bd that will be fetched by hardware */
drivers/usb/gadget/udc/udc-core.c+1−0
@@ -323,6 +323,7 @@ err4: · 322 unmodified lines
323323
324324 err3:
325325 put_device(&udc->dev);
326+ device_del(&gadget->dev);
326327
327328 err2:
328329 put_device(&gadget->dev);
drivers/usb/host/xhci-mem.c+2−1
@@ -1792,7 +1792,8 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) · 1791 unmodified lines
17921792 int size;
17931793 int i, j, num_ports;
17941794
1795− del_timer_sync(&xhci->cmd_timer);
1795+ if (timer_pending(&xhci->cmd_timer))
1796+ del_timer_sync(&xhci->cmd_timer);
17961797
17971798 /* Free the Event Ring Segment Table and the actual Event Ring */
17981799 size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries);
drivers/usb/host/xhci-ring.c+1−1
@@ -82,7 +82,7 @@ dma_addr_t xhci_trb_virt_to_dma(struct xhci_segment *seg, · 81 unmodified lines
8282 return 0;
8383 /* offset in TRBs */
8484 segment_offset = trb - seg->trbs;
85− if (segment_offset > TRBS_PER_SEGMENT)
85+ if (segment_offset >= TRBS_PER_SEGMENT)
8686 return 0;
8787 return seg->dma + (segment_offset * sizeof(*trb));
8888 }
drivers/usb/serial/option.c+2−0
@@ -1099,6 +1099,8 @@ static const struct usb_device_id option_ids[] = { · 1098 unmodified lines
10991099 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */
11001100 { USB_DEVICE_INTERFACE_CLASS(SIERRA_VENDOR_ID, 0x68c0, 0xff),
11011101 .driver_info = (kernel_ulong_t)&sierra_mc73xx_blacklist }, /* MC73xx */
1102+ { USB_DEVICE_INTERFACE_CLASS(SIERRA_VENDOR_ID, 0x9041, 0xff),
1103+ .driver_info = (kernel_ulong_t)&sierra_mc73xx_blacklist }, /* MC7305/MC7355 */
11021104 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) },
11031105 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },
11041106 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003),
drivers/usb/serial/qcserial.c+1−1
@@ -145,7 +145,6 @@ static const struct usb_device_id id_table[] = { · 144 unmodified lines
145145 {DEVICE_SWI(0x1199, 0x901c)}, /* Sierra Wireless EM7700 */
146146 {DEVICE_SWI(0x1199, 0x901f)}, /* Sierra Wireless EM7355 */
147147 {DEVICE_SWI(0x1199, 0x9040)}, /* Sierra Wireless Modem */
148− {DEVICE_SWI(0x1199, 0x9041)}, /* Sierra Wireless MC7305/MC7355 */
149148 {DEVICE_SWI(0x1199, 0x9051)}, /* Netgear AirCard 340U */
150149 {DEVICE_SWI(0x1199, 0x9053)}, /* Sierra Wireless Modem */
151150 {DEVICE_SWI(0x1199, 0x9054)}, /* Sierra Wireless Modem */
@@ -158,6 +157,7 @@ static const struct usb_device_id id_table[] = { · 6 unmodified lines
158157 {DEVICE_SWI(0x413c, 0x81a4)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */
159158 {DEVICE_SWI(0x413c, 0x81a8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */
160159 {DEVICE_SWI(0x413c, 0x81a9)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */
160+ {DEVICE_SWI(0x413c, 0x81b1)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card */
161161
162162 /* Huawei devices */
163163 {DEVICE_HWI(0x03f0, 0x581d)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Modem (Huawei me906e) */
drivers/usb/serial/sierra.c+1−0
@@ -289,6 +289,7 @@ static const struct usb_device_id id_table[] = { · 288 unmodified lines
289289 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x68AA, 0xFF, 0xFF, 0xFF),
290290 .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist
291291 },
292+ { USB_DEVICE(0x1199, 0x68AB) }, /* Sierra Wireless AR8550 */
292293 /* AT&T Direct IP LTE modems */
293294 { USB_DEVICE_AND_INTERFACE_INFO(0x0F3D, 0x68AA, 0xFF, 0xFF, 0xFF),
294295 .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist
drivers/video/console/fbcon.c+2−1
@@ -1306,10 +1306,11 @@ static void fbcon_cursor(struct vc_data *vc, int mode) · 1305 unmodified lines
13061306 int y;
13071307 int c = scr_readw((u16 *) vc->vc_pos);
13081308
1309+ ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms);
1310+
13091311 if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1)
13101312 return;
13111313
1312− ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms);
13131314 if (vc->vc_cursor_type & 0x10)
13141315 fbcon_del_cursor_timer(info);
13151316 else
drivers/video/fbdev/Kconfig+1−1
@@ -298,7 +298,7 @@ config FB_ARMCLCD · 297 unmodified lines
298298
299299 # Helper logic selected only by the ARM Versatile platform family.
300300 config PLAT_VERSATILE_CLCD
301− def_bool ARCH_VERSATILE || ARCH_REALVIEW || ARCH_VEXPRESS
301+ def_bool ARCH_VERSATILE || ARCH_REALVIEW || ARCH_VEXPRESS || ARCH_INTEGRATOR
302302 depends on ARM
303303 depends on FB_ARMCLCD && FB=y
304304
drivers/video/fbdev/omap2/dss/dss-of.c+3−1
@@ -60,6 +60,8 @@ omapdss_of_get_next_port(const struct device_node *parent, · 59 unmodified lines
6060 }
6161 prev = port;
6262 } while (of_node_cmp(port->name, "port") != 0);
63+
64+ of_node_put(ports);
6365 }
6466
6567 return port;
@@ -94,7 +96,7 @@ struct device_node *dss_of_port_get_parent_device(struct device_node *port) · 28 unmodified lines
9496 if (!port)
9597 return NULL;
9698
97− np = of_get_next_parent(port);
99+ np = of_get_parent(port);
98100
99101 for (i = 0; i < 2 && np; ++i) {
100102 struct property *prop;
drivers/video/fbdev/pxa3xx-gcu.c+2−2
@@ -653,7 +653,7 @@ static int pxa3xx_gcu_probe(struct platform_device *pdev) · 652 unmodified lines
653653 goto err_free_dma;
654654 }
655655
656− ret = clk_enable(priv->clk);
656+ ret = clk_prepare_enable(priv->clk);
657657 if (ret < 0) {
658658 dev_err(dev, "failed to enable clock\n");
659659 goto err_misc_deregister;
@@ -685,7 +685,7 @@ err_misc_deregister: · 25 unmodified lines
685685 misc_deregister(&priv->misc_dev);
686686
687687 err_disable_clk:
688− clk_disable(priv->clk);
688+ clk_disable_unprepare(priv->clk);
689689
690690 return ret;
691691 }
drivers/video/of_videomode.c+1−3
@@ -44,11 +44,9 @@ int of_get_videomode(struct device_node *np, struct videomode *vm, · 43 unmodified lines
4444 index = disp->native_mode;
4545
4646 ret = videomode_from_timings(disp, vm, index);
47− if (ret)
48− return ret;
4947
5048 display_timings_release(disp);
5149
52− return 0;
50+ return ret;
5351 }
5452 EXPORT_SYMBOL_GPL(of_get_videomode);
drivers/virtio/virtio_input.c+4−0
@@ -313,6 +313,7 @@ err_init_vq: · 312 unmodified lines
313313 static void virtinput_remove(struct virtio_device *vdev)
314314 {
315315 struct virtio_input *vi = vdev->priv;
316+ void *buf;
316317 unsigned long flags;
317318
318319 spin_lock_irqsave(&vi->lock, flags);
@@ -320,6 +321,9 @@ static void virtinput_remove(struct virtio_device *vdev) · 1 unmodified line
320321 spin_unlock_irqrestore(&vi->lock, flags);
321322
322323 input_unregister_device(vi->idev);
324+ vdev->config->reset(vdev);
325+ while ((buf = virtqueue_detach_unused_buf(vi->sts)) != NULL)
326+ kfree(buf);
323327 vdev->config->del_vqs(vdev);
324328 kfree(vi);
325329 }
drivers/xen/balloon.c+7−8
@@ -472,7 +472,7 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) · 471 unmodified lines
472472 }
473473
474474 /*
475− * We avoid multiple worker processes conflicting via the balloon mutex.
475+ * As this is a work item it is guaranteed to run as a single instance only.
476476 * We may of course race updates of the target counts (which are protected
477477 * by the balloon lock), or with changes to the Xen hard limit, but we will
478478 * recover from these in time.
@@ -482,9 +482,10 @@ static void balloon_process(struct work_struct *work) · 3 unmodified lines
482482 enum bp_state state = BP_DONE;
483483 long credit;
484484
485− mutex_lock(&balloon_mutex);
486485
487486 do {
487+ mutex_lock(&balloon_mutex);
488+
488489 credit = current_credit();
489490
490491 if (credit > 0) {
@@ -499,17 +500,15 @@ static void balloon_process(struct work_struct *work) · 8 unmodified lines
499500
500501 state = update_schedule(state);
501502
502−#ifndef CONFIG_PREEMPT
503− if (need_resched())
504− schedule();
505−#endif
503+ mutex_unlock(&balloon_mutex);
504+
505+ cond_resched();
506+
506507 } while (credit && state == BP_DONE);
507508
508509 /* Schedule more work if there is some still to be done. */
509510 if (state == BP_EAGAIN)
510511 schedule_delayed_work(&balloon_worker, balloon_stats.schedule_delay * HZ);
511−
512− mutex_unlock(&balloon_mutex);
513512 }
514513
515514 /* Resets the Xen limit, sets new target, and kicks off processing. */
drivers/xen/gntdev.c+2−0
@@ -568,12 +568,14 @@ static int gntdev_release(struct inode *inode, struct file *flip) · 567 unmodified lines
568568
569569 pr_debug("priv %p\n", priv);
570570
571+ mutex_lock(&priv->lock);
571572 while (!list_empty(&priv->maps)) {
572573 map = list_entry(priv->maps.next, struct grant_map, next);
573574 list_del(&map->next);
574575 gntdev_put_map(NULL /* already removed */, map);
575576 }
576577 WARN_ON(!list_empty(&priv->freeable_maps));
578+ mutex_unlock(&priv->lock);
577579
578580 if (use_ptemod)
579581 mmu_notifier_unregister(&priv->mn, priv->mm);
drivers/xen/xenbus/xenbus_client.c+3−1
@@ -814,8 +814,10 @@ static int xenbus_unmap_ring_vfree_hvm(struct xenbus_device *dev, void *vaddr) · 813 unmodified lines
814814
815815 rv = xenbus_unmap_ring(dev, node->handles, node->nr_handles,
816816 addrs);
817− if (!rv)
817+ if (!rv) {
818818 vunmap(vaddr);
819+ free_xenballooned_pages(node->nr_handles, node->hvm.pages);
820+ }
819821 else
820822 WARN(1, "Leaking %p, size %u page(s)\n", vaddr,
821823 node->nr_handles);
fs/btrfs/qgroup.c+5−0
@@ -1651,6 +1651,11 @@ static int qgroup_update_counters(struct btrfs_fs_info *fs_info, · 1650 unmodified lines
16511651 /* Exclusive -> exclusive, nothing changed */
16521652 }
16531653 }
1654+
1655+ /* For exclusive extent, free its reserved bytes too */
1656+ if (nr_old_roots == 0 && nr_new_roots == 1 &&
1657+ cur_new_count == nr_new_roots)
1658+ qg->reserved -= num_bytes;
16541659 if (dirty)
16551660 qgroup_dirty(fs_info, qg);
16561661 }
fs/ceph/caps.c+5−17
@@ -1506,7 +1506,6 @@ static int __mark_caps_flushing(struct inode *inode, · 1505 unmodified lines
15061506
15071507 swap(cf, ci->i_prealloc_cap_flush);
15081508 cf->caps = flushing;
1509− cf->kick = false;
15101509
15111510 spin_lock(&mdsc->cap_dirty_lock);
15121511 list_del_init(&ci->i_dirty_item);
@@ -2123,8 +2122,7 @@ static void kick_flushing_capsnaps(struct ceph_mds_client *mdsc, · 610 unmodified lines
21232122
21242123 static int __kick_flushing_caps(struct ceph_mds_client *mdsc,
21252124 struct ceph_mds_session *session,
2126− struct ceph_inode_info *ci,
2127− bool kick_all)
2125+ struct ceph_inode_info *ci)
21282126 {
21292127 struct inode *inode = &ci->vfs_inode;
21302128 struct ceph_cap *cap;
@@ -2150,9 +2148,7 @@ static int __kick_flushing_caps(struct ceph_mds_client *mdsc, · 19 unmodified lines
21502148
21512149 for (n = rb_first(&ci->i_cap_flush_tree); n; n = rb_next(n)) {
21522150 cf = rb_entry(n, struct ceph_cap_flush, i_node);
2153− if (cf->tid < first_tid)
2154− continue;
2155− if (kick_all || cf->kick)
2151+ if (cf->tid >= first_tid)
21562152 break;
21572153 }
21582154 if (!n) {
@@ -2161,7 +2157,6 @@ static int __kick_flushing_caps(struct ceph_mds_client *mdsc, · 2 unmodified lines
21612157 }
21622158
21632159 cf = rb_entry(n, struct ceph_cap_flush, i_node);
2164− cf->kick = false;
21652160
21662161 first_tid = cf->tid + 1;
21672162
@@ -2181,8 +2176,6 @@ void ceph_early_kick_flushing_caps(struct ceph_mds_client *mdsc, · 13 unmodified lines
21812176 {
21822177 struct ceph_inode_info *ci;
21832178 struct ceph_cap *cap;
2184− struct ceph_cap_flush *cf;
2185− struct rb_node *n;
21862179
21872180 dout("early_kick_flushing_caps mds%d\n", session->s_mds);
21882181 list_for_each_entry(ci, &session->s_cap_flushing, i_flushing_item) {
@@ -2205,16 +2198,11 @@ void ceph_early_kick_flushing_caps(struct ceph_mds_client *mdsc, · 16 unmodified lines
22052198 if ((cap->issued & ci->i_flushing_caps) !=
22062199 ci->i_flushing_caps) {
22072200 spin_unlock(&ci->i_ceph_lock);
2208− if (!__kick_flushing_caps(mdsc, session, ci, true))
2201+ if (!__kick_flushing_caps(mdsc, session, ci))
22092202 continue;
22102203 spin_lock(&ci->i_ceph_lock);
22112204 }
22122205
2213− for (n = rb_first(&ci->i_cap_flush_tree); n; n = rb_next(n)) {
2214− cf = rb_entry(n, struct ceph_cap_flush, i_node);
2215− cf->kick = true;
2216− }
2217−
22182206 spin_unlock(&ci->i_ceph_lock);
22192207 }
22202208 }
@@ -2228,7 +2216,7 @@ void ceph_kick_flushing_caps(struct ceph_mds_client *mdsc, · 7 unmodified lines
22282216
22292217 dout("kick_flushing_caps mds%d\n", session->s_mds);
22302218 list_for_each_entry(ci, &session->s_cap_flushing, i_flushing_item) {
2231− int delayed = __kick_flushing_caps(mdsc, session, ci, false);
2219+ int delayed = __kick_flushing_caps(mdsc, session, ci);
22322220 if (delayed) {
22332221 spin_lock(&ci->i_ceph_lock);
22342222 __cap_delay_requeue(mdsc, ci);
@@ -2261,7 +2249,7 @@ static void kick_flushing_inode_caps(struct ceph_mds_client *mdsc, · 26 unmodified lines
22612249
22622250 spin_unlock(&ci->i_ceph_lock);
22632251
2264− delayed = __kick_flushing_caps(mdsc, session, ci, true);
2252+ delayed = __kick_flushing_caps(mdsc, session, ci);
22652253 if (delayed) {
22662254 spin_lock(&ci->i_ceph_lock);
22672255 __cap_delay_requeue(mdsc, ci);
fs/ceph/locks.c+1−1
@@ -287,7 +287,7 @@ int ceph_encode_locks_to_buffer(struct inode *inode, · 286 unmodified lines
287287 return 0;
288288
289289 spin_lock(&ctx->flc_lock);
290− list_for_each_entry(lock, &ctx->flc_flock, fl_list) {
290+ list_for_each_entry(lock, &ctx->flc_posix, fl_list) {
291291 ++seen_fcntl;
292292 if (seen_fcntl > num_fcntl_locks) {
293293 err = -ENOSPC;
fs/ceph/super.h+0−1
@@ -189,7 +189,6 @@ static inline void ceph_put_cap_snap(struct ceph_cap_snap *capsnap) · 188 unmodified lines
189189 struct ceph_cap_flush {
190190 u64 tid;
191191 int caps;
192− bool kick;
193192 struct rb_node g_node; // global
194193 union {
195194 struct rb_node i_node; // inode
fs/dcache.c+3−10
@@ -3442,22 +3442,15 @@ void __init vfs_caches_init_early(void) · 3441 unmodified lines
34423442 inode_init_early();
34433443 }
34443444
3445−void __init vfs_caches_init(unsigned long mempages)
3445+void __init vfs_caches_init(void)
34463446 {
3447− unsigned long reserve;
3448−
3449− /* Base hash sizes on available memory, with a reserve equal to
3450− 150% of current kernel size */
3451−
3452− reserve = min((mempages - nr_free_pages()) * 3/2, mempages - 1);
3453− mempages -= reserve;
3454−
34553447 names_cachep = kmem_cache_create("names_cache", PATH_MAX, 0,
34563448 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
34573449
34583450 dcache_init();
34593451 inode_init();
3460− files_init(mempages);
3452+ files_init();
3453+ files_maxfiles_init();
34613454 mnt_init();
34623455 bdev_cache_init();
34633456 chrdev_init();
fs/file_table.c+15−9
@@ -25,6 +25,7 @@ · 24 unmodified lines
2525 #include <linux/hardirq.h>
2626 #include <linux/task_work.h>
2727 #include <linux/ima.h>
28+#include <linux/swap.h>
2829
2930 #include <linux/atomic.h>
3031
@@ -308,19 +309,24 @@ void put_filp(struct file *file) · 277 unmodified lines
308309 }
309310 }
310311
311−void __init files_init(unsigned long mempages)
312+void __init files_init(void)
312313 {
313− unsigned long n;
314−
315314 filp_cachep = kmem_cache_create("filp", sizeof(struct file), 0,
316315 SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL);
316+ percpu_counter_init(&nr_files, 0, GFP_KERNEL);
317+}
317318
318− /*
319− * One file with associated inode and dcache is very roughly 1K.
320− * Per default don't use more than 10% of our memory for files.
321− */
319+/*
320+ * One file with associated inode and dcache is very roughly 1K. Per default
321+ * do not use more than 10% of our memory for files.
322+ */
323+void __init files_maxfiles_init(void)
324+{
325+ unsigned long n;
326+ unsigned long memreserve = (totalram_pages - nr_free_pages()) * 3/2;
327+
328+ memreserve = min(memreserve, totalram_pages - 1);
329+ n = ((totalram_pages - memreserve) * (PAGE_SIZE / 1024)) / 10;
322330
323− n = (mempages * (PAGE_SIZE / 1024)) / 10;
324331 files_stat.max_files = max_t(unsigned long, n, NR_FILE);
325− percpu_counter_init(&nr_files, 0, GFP_KERNEL);
326332 }
fs/hugetlbfs/inode.c+2−0
@@ -1010,6 +1010,8 @@ struct file *hugetlb_file_setup(const char *name, size_t size, · 1009 unmodified lines
10101010 inode = hugetlbfs_get_inode(sb, NULL, S_IFREG | S_IRWXUGO, 0);
10111011 if (!inode)
10121012 goto out_dentry;
1013+ if (creat_flags == HUGETLB_SHMFS_INODE)
1014+ inode->i_flags |= S_PRIVATE;
10131015
10141016 file = ERR_PTR(-ENOMEM);
10151017 if (hugetlb_reserve_pages(inode, 0,
fs/namei.c+7−2
@@ -879,7 +879,7 @@ static inline int may_follow_link(struct nameidata *nd) · 878 unmodified lines
879879 return 0;
880880
881881 /* Allowed if parent directory not sticky and world-writable. */
882− parent = nd->path.dentry->d_inode;
882+ parent = nd->inode;
883883 if ((parent->i_mode & (S_ISVTX|S_IWOTH)) != (S_ISVTX|S_IWOTH))
884884 return 0;
885885
@@ -1954,8 +1954,13 @@ OK: · 1068 unmodified lines
19541954 continue;
19551955 }
19561956 }
1957− if (unlikely(!d_can_lookup(nd->path.dentry)))
1957+ if (unlikely(!d_can_lookup(nd->path.dentry))) {
1958+ if (nd->flags & LOOKUP_RCU) {
1959+ if (unlazy_walk(nd, NULL, 0))
1960+ return -ECHILD;
1961+ }
19581962 return -ENOTDIR;
1963+ }
19591964 }
19601965 }
19611966
fs/nfsd/nfs4layouts.c+1−0
@@ -212,6 +212,7 @@ nfsd4_alloc_layout_stateid(struct nfsd4_compound_state *cstate, · 211 unmodified lines
212212 BUG_ON(!ls->ls_file);
213213
214214 if (nfsd4_layout_setlease(ls)) {
215+ fput(ls->ls_file);
215216 put_nfs4_file(fp);
216217 kmem_cache_free(nfs4_layout_stateid_cache, ls);
217218 return NULL;
fs/nfsd/nfs4state.c+6−6
@@ -4396,9 +4396,9 @@ laundromat_main(struct work_struct *laundry) · 4395 unmodified lines
43964396 queue_delayed_work(laundry_wq, &nn->laundromat_work, t*HZ);
43974397 }
43984398
4399−static inline __be32 nfs4_check_fh(struct svc_fh *fhp, struct nfs4_ol_stateid *stp)
4399+static inline __be32 nfs4_check_fh(struct svc_fh *fhp, struct nfs4_stid *stp)
44004400 {
4401− if (!fh_match(&fhp->fh_handle, &stp->st_stid.sc_file->fi_fhandle))
4401+ if (!fh_match(&fhp->fh_handle, &stp->sc_file->fi_fhandle))
44024402 return nfserr_bad_stateid;
44034403 return nfs_ok;
44044404 }
@@ -4601,9 +4601,6 @@ nfs4_check_olstateid(struct svc_fh *fhp, struct nfs4_ol_stateid *ols, int flags) · 196 unmodified lines
46014601 {
46024602 __be32 status;
46034603
4604− status = nfs4_check_fh(fhp, ols);
4605− if (status)
4606− return status;
46074604 status = nfsd4_check_openowner_confirmed(ols);
46084605 if (status)
46094606 return status;
@@ -4690,6 +4687,9 @@ nfs4_preprocess_stateid_op(struct svc_rqst *rqstp, · 80 unmodified lines
46904687 status = nfserr_bad_stateid;
46914688 break;
46924689 }
4690+ if (status)
4691+ goto out;
4692+ status = nfs4_check_fh(fhp, s);
46934693
46944694 done:
46954695 if (!status && filpp)
@@ -4798,7 +4798,7 @@ static __be32 nfs4_seqid_op_checks(struct nfsd4_compound_state *cstate, stateid_ · 102 unmodified lines
47984798 status = check_stateid_generation(stateid, &stp->st_stid.sc_stateid, nfsd4_has_session(cstate));
47994799 if (status)
48004800 return status;
4801− return nfs4_check_fh(current_fh, stp);
4801+ return nfs4_check_fh(current_fh, &stp->st_stid);
48024802 }
48034803
48044804 /*
fs/nfsd/nfs4xdr.c+6−5
@@ -2143,6 +2143,7 @@ nfsd4_encode_aclname(struct xdr_stream *xdr, struct svc_rqst *rqstp, · 2142 unmodified lines
21432143 #define WORD0_ABSENT_FS_ATTRS (FATTR4_WORD0_FS_LOCATIONS | FATTR4_WORD0_FSID | \
21442144 FATTR4_WORD0_RDATTR_ERROR)
21452145 #define WORD1_ABSENT_FS_ATTRS FATTR4_WORD1_MOUNTED_ON_FILEID
2146+#define WORD2_ABSENT_FS_ATTRS 0
21462147
21472148 #ifdef CONFIG_NFSD_V4_SECURITY_LABEL
21482149 static inline __be32
@@ -2171,7 +2172,7 @@ nfsd4_encode_security_label(struct xdr_stream *xdr, struct svc_rqst *rqstp, · 22 unmodified lines
21712172 { return 0; }
21722173 #endif
21732174
2174−static __be32 fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *rdattr_err)
2175+static __be32 fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *bmval2, u32 *rdattr_err)
21752176 {
21762177 /* As per referral draft: */
21772178 if (*bmval0 & ~WORD0_ABSENT_FS_ATTRS ||
@@ -2184,6 +2185,7 @@ static __be32 fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *rdattr_err) · 6 unmodified lines
21842185 }
21852186 *bmval0 &= WORD0_ABSENT_FS_ATTRS;
21862187 *bmval1 &= WORD1_ABSENT_FS_ATTRS;
2188+ *bmval2 &= WORD2_ABSENT_FS_ATTRS;
21872189 return 0;
21882190 }
21892191
@@ -2246,8 +2248,7 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp, · 56 unmodified lines
22462248 BUG_ON(bmval2 & ~nfsd_suppattrs2(minorversion));
22472249
22482250 if (exp->ex_fslocs.migrated) {
2249− BUG_ON(bmval[2]);
2250− status = fattr_handle_absent_fs(&bmval0, &bmval1, &rdattr_err);
2251+ status = fattr_handle_absent_fs(&bmval0, &bmval1, &bmval2, &rdattr_err);
22512252 if (status)
22522253 goto out;
22532254 }
@@ -2286,8 +2287,8 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp, · 32 unmodified lines
22862287 }
22872288
22882289 #ifdef CONFIG_NFSD_V4_SECURITY_LABEL
2289− if ((bmval[2] & FATTR4_WORD2_SECURITY_LABEL) ||
2290− bmval[0] & FATTR4_WORD0_SUPPORTED_ATTRS) {
2290+ if ((bmval2 & FATTR4_WORD2_SECURITY_LABEL) ||
2291+ bmval0 & FATTR4_WORD0_SUPPORTED_ATTRS) {
22912292 err = security_inode_getsecctx(d_inode(dentry),
22922293 &context, &contextlen);
22932294 contextsupport = (err == 0);
fs/notify/mark.c+25−5
@@ -412,16 +412,36 @@ void fsnotify_clear_marks_by_group_flags(struct fsnotify_group *group, · 411 unmodified lines
412412 unsigned int flags)
413413 {
414414 struct fsnotify_mark *lmark, *mark;
415+ LIST_HEAD(to_free);
415416
417+ /*
418+ * We have to be really careful here. Anytime we drop mark_mutex, e.g.
419+ * fsnotify_clear_marks_by_inode() can come and free marks. Even in our
420+ * to_free list so we have to use mark_mutex even when accessing that
421+ * list. And freeing mark requires us to drop mark_mutex. So we can
422+ * reliably free only the first mark in the list. That's why we first
423+ * move marks to free to to_free list in one go and then free marks in
424+ * to_free list one by one.
425+ */
416426 mutex_lock_nested(&group->mark_mutex, SINGLE_DEPTH_NESTING);
417427 list_for_each_entry_safe(mark, lmark, &group->marks_list, g_list) {
418− if (mark->flags & flags) {
419− fsnotify_get_mark(mark);
420− fsnotify_destroy_mark_locked(mark, group);
421− fsnotify_put_mark(mark);
422− }
428+ if (mark->flags & flags)
429+ list_move(&mark->g_list, &to_free);
423430 }
424431 mutex_unlock(&group->mark_mutex);
432+
433+ while (1) {
434+ mutex_lock_nested(&group->mark_mutex, SINGLE_DEPTH_NESTING);
435+ if (list_empty(&to_free)) {
436+ mutex_unlock(&group->mark_mutex);
437+ break;
438+ }
439+ mark = list_first_entry(&to_free, struct fsnotify_mark, g_list);
440+ fsnotify_get_mark(mark);
441+ fsnotify_destroy_mark_locked(mark, group);
442+ mutex_unlock(&group->mark_mutex);
443+ fsnotify_put_mark(mark);
444+ }
425445 }
426446
427447 /*
fs/ocfs2/aops.c+2−2
@@ -685,7 +685,7 @@ static int ocfs2_direct_IO_zero_extend(struct ocfs2_super *osb, · 684 unmodified lines
685685
686686 if (p_cpos && !(ext_flags & OCFS2_EXT_UNWRITTEN)) {
687687 u64 s = i_size_read(inode);
688− sector_t sector = (p_cpos << (osb->s_clustersize_bits - 9)) +
688+ sector_t sector = ((u64)p_cpos << (osb->s_clustersize_bits - 9)) +
689689 (do_div(s, osb->s_clustersize) >> 9);
690690
691691 ret = blkdev_issue_zeroout(osb->sb->s_bdev, sector,
@@ -910,7 +910,7 @@ static ssize_t ocfs2_direct_IO_write(struct kiocb *iocb, · 218 unmodified lines
910910 BUG_ON(!p_cpos || (ext_flags & OCFS2_EXT_UNWRITTEN));
911911
912912 ret = blkdev_issue_zeroout(osb->sb->s_bdev,
913− p_cpos << (osb->s_clustersize_bits - 9),
913+ (u64)p_cpos << (osb->s_clustersize_bits - 9),
914914 zero_len_head >> 9, GFP_NOFS, false);
915915 if (ret < 0)
916916 mlog_errno(ret);
fs/ocfs2/dlmglue.c+7−3
@@ -4025,9 +4025,13 @@ static void ocfs2_downconvert_thread_do_work(struct ocfs2_super *osb) · 4024 unmodified lines
40254025 osb->dc_work_sequence = osb->dc_wake_sequence;
40264026
40274027 processed = osb->blocked_lock_count;
4028− while (processed) {
4029− BUG_ON(list_empty(&osb->blocked_lock_list));
4030−
4028+ /*
4029+ * blocked lock processing in this loop might call iput which can
4030+ * remove items off osb->blocked_lock_list. Downconvert up to
4031+ * 'processed' number of locks, but stop short if we had some
4032+ * removed in ocfs2_mark_lockres_freeing when downconverting.
4033+ */
4034+ while (processed && !list_empty(&osb->blocked_lock_list)) {
40314035 lockres = list_entry(osb->blocked_lock_list.next,
40324036 struct ocfs2_lock_res, l_blocked_list);
40334037 list_del_init(&lockres->l_blocked_list);
fs/signalfd.c+3−2
@@ -121,8 +121,9 @@ static int signalfd_copyinfo(struct signalfd_siginfo __user *uinfo, · 120 unmodified lines
121121 * Other callers might not initialize the si_lsb field,
122122 * so check explicitly for the right codes here.
123123 */
124− if (kinfo->si_code == BUS_MCEERR_AR ||
125− kinfo->si_code == BUS_MCEERR_AO)
124+ if (kinfo->si_signo == SIGBUS &&
125+ (kinfo->si_code == BUS_MCEERR_AR ||
126+ kinfo->si_code == BUS_MCEERR_AO))
126127 err |= __put_user((short) kinfo->si_addr_lsb,
127128 &uinfo->ssi_addr_lsb);
128129 #endif
include/drm/drmP.h+1−1
@@ -691,7 +691,7 @@ struct drm_vblank_crtc { · 690 unmodified lines
691691 struct timer_list disable_timer; /* delayed disable timer */
692692
693693 /* vblank counter, protected by dev->vblank_time_lock for writes */
694− unsigned long count;
694+ u32 count;
695695 /* vblank timestamps, protected by dev->vblank_time_lock for writes */
696696 struct timeval time[DRM_VBLANKTIME_RBSIZE];
697697
include/drm/drm_crtc_helper.h+3−0
@@ -168,6 +168,7 @@ struct drm_encoder_helper_funcs { · 167 unmodified lines
168168 * @get_modes: get mode list for this connector
169169 * @mode_valid: is this mode valid on the given connector? (optional)
170170 * @best_encoder: return the preferred encoder for this connector
171+ * @atomic_best_encoder: atomic version of @best_encoder
171172 *
172173 * The helper operations are called by the mid-layer CRTC helper.
173174 */
@@ -176,6 +177,8 @@ struct drm_connector_helper_funcs { · 2 unmodified lines
176177 enum drm_mode_status (*mode_valid)(struct drm_connector *connector,
177178 struct drm_display_mode *mode);
178179 struct drm_encoder *(*best_encoder)(struct drm_connector *connector);
180+ struct drm_encoder *(*atomic_best_encoder)(struct drm_connector *connector,
181+ struct drm_connector_state *connector_state);
179182 };
180183
181184 extern void drm_helper_disable_unused_functions(struct drm_device *dev);
include/drm/drm_pciids.h+1−0
@@ -172,6 +172,7 @@ · 171 unmodified lines
172172 {0x1002, 0x6610, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
173173 {0x1002, 0x6611, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
174174 {0x1002, 0x6613, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
175+ {0x1002, 0x6617, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
175176 {0x1002, 0x6620, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
176177 {0x1002, 0x6621, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
177178 {0x1002, 0x6623, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
include/linux/fs.h+3−2
@@ -55,7 +55,8 @@ struct vm_fault; · 54 unmodified lines
5555
5656 extern void __init inode_init(void);
5757 extern void __init inode_init_early(void);
58−extern void __init files_init(unsigned long);
58+extern void __init files_init(void);
59+extern void __init files_maxfiles_init(void);
5960
6061 extern struct files_stat_struct files_stat;
6162 extern unsigned long get_max_files(void);
@@ -2245,7 +2246,7 @@ extern int ioctl_preallocate(struct file *filp, void __user *argp); · 2183 unmodified lines
22452246
22462247 /* fs/dcache.c */
22472248 extern void __init vfs_caches_init_early(void);
2248−extern void __init vfs_caches_init(unsigned long);
2249+extern void __init vfs_caches_init(void);
22492250
22502251 extern struct kmem_cache *names_cachep;
22512252
include/linux/page-flags.h+7−3
@@ -631,15 +631,19 @@ static inline void ClearPageSlabPfmemalloc(struct page *page) · 630 unmodified lines
631631 1 << PG_private | 1 << PG_private_2 | \
632632 1 << PG_writeback | 1 << PG_reserved | \
633633 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \
634− 1 << PG_unevictable | __PG_MLOCKED | __PG_HWPOISON | \
634+ 1 << PG_unevictable | __PG_MLOCKED | \
635635 __PG_COMPOUND_LOCK)
636636
637637 /*
638638 * Flags checked when a page is prepped for return by the page allocator.
639− * Pages being prepped should not have any flags set. It they are set,
639+ * Pages being prepped should not have these flags set. It they are set,
640640 * there has been a kernel bug or struct page corruption.
641+ *
642+ * __PG_HWPOISON is exceptional because it needs to be kept beyond page's
643+ * alloc-free cycle to prevent from reusing the page.
641644 */
642−#define PAGE_FLAGS_CHECK_AT_PREP ((1 << NR_PAGEFLAGS) - 1)
645+#define PAGE_FLAGS_CHECK_AT_PREP \
646+ (((1 << NR_PAGEFLAGS) - 1) & ~__PG_HWPOISON)
643647
644648 #define PAGE_FLAGS_PRIVATE \
645649 (1 << PG_private | 1 << PG_private_2)
include/linux/skbuff.h+3−3
@@ -2913,11 +2913,11 @@ static inline bool skb_defer_rx_timestamp(struct sk_buff *skb) · 2912 unmodified lines
29132913 *
29142914 * PHY drivers may accept clones of transmitted packets for
29152915 * timestamping via their phy_driver.txtstamp method. These drivers
2916− * must call this function to return the skb back to the stack, with
2917− * or without a timestamp.
2916+ * must call this function to return the skb back to the stack with a
2917+ * timestamp.
29182918 *
29192919 * @skb: clone of the the original outgoing packet
2920− * @hwtstamps: hardware time stamps, may be NULL if not available
2920+ * @hwtstamps: hardware time stamps
29212921 *
29222922 */
29232923 void skb_complete_tx_timestamp(struct sk_buff *skb,
include/uapi/linux/pci_regs.h+1−0
@@ -319,6 +319,7 @@ · 318 unmodified lines
319319 #define PCI_MSIX_PBA 8 /* Pending Bit Array offset */
320320 #define PCI_MSIX_PBA_BIR 0x00000007 /* BAR index */
321321 #define PCI_MSIX_PBA_OFFSET 0xfffffff8 /* Offset into specified BAR */
322+#define PCI_MSIX_FLAGS_BIRMASK PCI_MSIX_PBA_BIR /* deprecated */
322323 #define PCI_CAP_MSIX_SIZEOF 12 /* size of MSIX registers */
323324
324325 /* MSI-X Table entry format */
include/uapi/sound/asoc.h+24−11
@@ -77,7 +77,7 @@ · 76 unmodified lines
7777 #define SND_SOC_TPLG_NUM_TEXTS 16
7878
7979 /* ABI version */
80−#define SND_SOC_TPLG_ABI_VERSION 0x2
80+#define SND_SOC_TPLG_ABI_VERSION 0x3
8181
8282 /* Max size of TLV data */
8383 #define SND_SOC_TPLG_TLV_SIZE 32
@@ -97,7 +97,8 @@ · 13 unmodified lines
9797 #define SND_SOC_TPLG_TYPE_PCM 7
9898 #define SND_SOC_TPLG_TYPE_MANIFEST 8
9999 #define SND_SOC_TPLG_TYPE_CODEC_LINK 9
100−#define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_CODEC_LINK
100+#define SND_SOC_TPLG_TYPE_PDATA 10
101+#define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_PDATA
101102
102103 /* vendor block IDs - please add new vendor types to end */
103104 #define SND_SOC_TPLG_TYPE_VENDOR_FW 1000
@@ -137,11 +138,19 @@ struct snd_soc_tplg_private { · 33 unmodified lines
137138 /*
138139 * Kcontrol TLV data.
139140 */
141+struct snd_soc_tplg_tlv_dbscale {
142+ __le32 min;
143+ __le32 step;
144+ __le32 mute;
145+} __attribute__((packed));
146+
140147 struct snd_soc_tplg_ctl_tlv {
141− __le32 size; /* in bytes aligned to 4 */
142− __le32 numid; /* control element numeric identification */
143− __le32 count; /* number of elem in data array */
144− __le32 data[SND_SOC_TPLG_TLV_SIZE];
148+ __le32 size; /* in bytes of this structure */
149+ __le32 type; /* SNDRV_CTL_TLVT_*, type of TLV */
150+ union {
151+ __le32 data[SND_SOC_TPLG_TLV_SIZE];
152+ struct snd_soc_tplg_tlv_dbscale scale;
153+ };
145154 } __attribute__((packed));
146155
147156 /*
@@ -155,9 +164,11 @@ struct snd_soc_tplg_channel { · 7 unmodified lines
155164 } __attribute__((packed));
156165
157166 /*
158− * Kcontrol Operations IDs
167+ * Genericl Operations IDs, for binding Kcontrol or Bytes ext ops
168+ * Kcontrol ops need get/put/info.
169+ * Bytes ext ops need get/put.
159170 */
160−struct snd_soc_tplg_kcontrol_ops_id {
171+struct snd_soc_tplg_io_ops {
161172 __le32 get;
162173 __le32 put;
163174 __le32 info;
@@ -171,8 +182,8 @@ struct snd_soc_tplg_ctl_hdr { · 7 unmodified lines
171182 __le32 type;
172183 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
173184 __le32 access;
174− struct snd_soc_tplg_kcontrol_ops_id ops;
175− __le32 tlv_size; /* non zero means control has TLV data */
185+ struct snd_soc_tplg_io_ops ops;
186+ struct snd_soc_tplg_ctl_tlv tlv;
176187 } __attribute__((packed));
177188
178189 /*
@@ -238,6 +249,7 @@ struct snd_soc_tplg_manifest { · 59 unmodified lines
238249 __le32 graph_elems; /* number of graph elements */
239250 __le32 dai_elems; /* number of DAI elements */
240251 __le32 dai_link_elems; /* number of DAI link elements */
252+ struct snd_soc_tplg_private priv;
241253 } __attribute__((packed));
242254
243255 /*
@@ -259,7 +271,6 @@ struct snd_soc_tplg_mixer_control { · 15 unmodified lines
259271 __le32 invert;
260272 __le32 num_channels;
261273 struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];
262− struct snd_soc_tplg_ctl_tlv tlv;
263274 struct snd_soc_tplg_private priv;
264275 } __attribute__((packed));
265276
@@ -303,6 +314,7 @@ struct snd_soc_tplg_bytes_control { · 37 unmodified lines
303314 __le32 mask;
304315 __le32 base;
305316 __le32 num_regs;
317+ struct snd_soc_tplg_io_ops ext_ops;
306318 struct snd_soc_tplg_private priv;
307319 } __attribute__((packed));
308320
@@ -347,6 +359,7 @@ struct snd_soc_tplg_dapm_widget { · 38 unmodified lines
347359 __le32 reg; /* negative reg = no direct dapm */
348360 __le32 shift; /* bits to shift */
349361 __le32 mask; /* non-shifted mask */
362+ __le32 subseq; /* sort within widget type */
350363 __u32 invert; /* invert the power bit */
351364 __u32 ignore_suspend; /* kept enabled over suspend */
352365 __u16 event_flags;
init/main.c+1−1
@@ -656,7 +656,7 @@ asmlinkage __visible void __init start_kernel(void) · 655 unmodified lines
656656 key_init();
657657 security_init();
658658 dbg_late_init();
659− vfs_caches_init(totalram_pages);
659+ vfs_caches_init();
660660 signals_init();
661661 /* rootfs populating might need page-writeback */
662662 page_writeback_init();
ipc/mqueue.c+0−5
@@ -142,7 +142,6 @@ static int msg_insert(struct msg_msg *msg, struct mqueue_inode_info *info) · 141 unmodified lines
142142 if (!leaf)
143143 return -ENOMEM;
144144 INIT_LIST_HEAD(&leaf->msg_list);
145− info->qsize += sizeof(*leaf);
146145 }
147146 leaf->priority = msg->m_type;
148147 rb_link_node(&leaf->rb_node, parent, p);
@@ -187,7 +186,6 @@ try_again: · 38 unmodified lines
187186 "lazy leaf delete!\n");
188187 rb_erase(&leaf->rb_node, &info->msg_tree);
189188 if (info->node_cache) {
190− info->qsize -= sizeof(*leaf);
191189 kfree(leaf);
192190 } else {
193191 info->node_cache = leaf;
@@ -200,7 +198,6 @@ try_again: · 6 unmodified lines
200198 if (list_empty(&leaf->msg_list)) {
201199 rb_erase(&leaf->rb_node, &info->msg_tree);
202200 if (info->node_cache) {
203− info->qsize -= sizeof(*leaf);
204201 kfree(leaf);
205202 } else {
206203 info->node_cache = leaf;
@@ -1034,7 +1031,6 @@ SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr, · 827 unmodified lines
10341031 /* Save our speculative allocation into the cache */
10351032 INIT_LIST_HEAD(&new_leaf->msg_list);
10361033 info->node_cache = new_leaf;
1037− info->qsize += sizeof(*new_leaf);
10381034 new_leaf = NULL;
10391035 } else {
10401036 kfree(new_leaf);
@@ -1142,7 +1138,6 @@ SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr, · 101 unmodified lines
11421138 /* Save our speculative allocation into the cache */
11431139 INIT_LIST_HEAD(&new_leaf->msg_list);
11441140 info->node_cache = new_leaf;
1145− info->qsize += sizeof(*new_leaf);
11461141 } else {
11471142 kfree(new_leaf);
11481143 }
ipc/shm.c+1−1
@@ -545,7 +545,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params) · 544 unmodified lines
545545 if ((shmflg & SHM_NORESERVE) &&
546546 sysctl_overcommit_memory != OVERCOMMIT_NEVER)
547547 acctflag = VM_NORESERVE;
548− file = shmem_file_setup(name, size, acctflag);
548+ file = shmem_kernel_file_setup(name, size, acctflag);
549549 }
550550 error = PTR_ERR(file);
551551 if (IS_ERR(file))
kernel/kthread.c+4−0
@@ -97,6 +97,7 @@ bool kthread_should_park(void) · 96 unmodified lines
9797 {
9898 return test_bit(KTHREAD_SHOULD_PARK, &to_kthread(current)->flags);
9999 }
100+EXPORT_SYMBOL_GPL(kthread_should_park);
100101
101102 /**
102103 * kthread_freezable_should_stop - should this freezable kthread return now?
@@ -171,6 +172,7 @@ void kthread_parkme(void) · 68 unmodified lines
171172 {
172173 __kthread_parkme(to_kthread(current));
173174 }
175+EXPORT_SYMBOL_GPL(kthread_parkme);
174176
175177 static int kthread(void *_create)
176178 {
@@ -411,6 +413,7 @@ void kthread_unpark(struct task_struct *k) · 234 unmodified lines
411413 if (kthread)
412414 __kthread_unpark(k, kthread);
413415 }
416+EXPORT_SYMBOL_GPL(kthread_unpark);
414417
415418 /**
416419 * kthread_park - park a thread created by kthread_create().
@@ -441,6 +444,7 @@ int kthread_park(struct task_struct *k) · 24 unmodified lines
441444 }
442445 return ret;
443446 }
447+EXPORT_SYMBOL_GPL(kthread_park);
444448
445449 /**
446450 * kthread_stop - stop a thread created by kthread_create().
kernel/module.c+6−2
@@ -602,13 +602,16 @@ const struct kernel_symbol *find_symbol(const char *name, · 601 unmodified lines
602602 }
603603 EXPORT_SYMBOL_GPL(find_symbol);
604604
605−/* Search for module by name: must hold module_mutex. */
605+/*
606+ * Search for module by name: must hold module_mutex (or preempt disabled
607+ * for read-only access).
608+ */
606609 static struct module *find_module_all(const char *name, size_t len,
607610 bool even_unformed)
608611 {
609612 struct module *mod;
610613
611− module_assert_mutex();
614+ module_assert_mutex_or_preempt();
612615
613616 list_for_each_entry(mod, &modules, list) {
614617 if (!even_unformed && mod->state == MODULE_STATE_UNFORMED)
@@ -621,6 +624,7 @@ static struct module *find_module_all(const char *name, size_t len, · 6 unmodified lines
621624
622625 struct module *find_module(const char *name)
623626 {
627+ module_assert_mutex();
624628 return find_module_all(name, strlen(name), false);
625629 }
626630 EXPORT_SYMBOL_GPL(find_module);
kernel/signal.c+8−5
@@ -2748,12 +2748,15 @@ int copy_siginfo_to_user(siginfo_t __user *to, const siginfo_t *from) · 2747 unmodified lines
27482748 * Other callers might not initialize the si_lsb field,
27492749 * so check explicitly for the right codes here.
27502750 */
2751− if (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO)
2751+ if (from->si_signo == SIGBUS &&
2752+ (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO))
27522753 err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb);
27532754 #endif
27542755 #ifdef SEGV_BNDERR
2755− err |= __put_user(from->si_lower, &to->si_lower);
2756− err |= __put_user(from->si_upper, &to->si_upper);
2756+ if (from->si_signo == SIGSEGV && from->si_code == SEGV_BNDERR) {
2757+ err |= __put_user(from->si_lower, &to->si_lower);
2758+ err |= __put_user(from->si_upper, &to->si_upper);
2759+ }
27572760 #endif
27582761 break;
27592762 case __SI_CHLD:
@@ -3017,7 +3020,7 @@ COMPAT_SYSCALL_DEFINE3(rt_sigqueueinfo, · 257 unmodified lines
30173020 int, sig,
30183021 struct compat_siginfo __user *, uinfo)
30193022 {
3020− siginfo_t info;
3023+ siginfo_t info = {};
30213024 int ret = copy_siginfo_from_user32(&info, uinfo);
30223025 if (unlikely(ret))
30233026 return ret;
@@ -3061,7 +3064,7 @@ COMPAT_SYSCALL_DEFINE4(rt_tgsigqueueinfo, · 37 unmodified lines
30613064 int, sig,
30623065 struct compat_siginfo __user *, uinfo)
30633066 {
3064− siginfo_t info;
3067+ siginfo_t info = {};
30653068
30663069 if (copy_siginfo_from_user32(&info, uinfo))
30673070 return -EFAULT;
lib/iommu-common.c+1−1
@@ -119,7 +119,7 @@ unsigned long iommu_tbl_range_alloc(struct device *dev, · 118 unmodified lines
119119 unsigned long align_mask = 0;
120120
121121 if (align_order > 0)
122− align_mask = 0xffffffffffffffffl >> (64 - align_order);
122+ align_mask = ~0ul >> (BITS_PER_LONG - align_order);
123123
124124 /* Sanity check */
125125 if (unlikely(npages == 0)) {
mm/huge_memory.c+1−6
@@ -1676,12 +1676,7 @@ static void __split_huge_page_refcount(struct page *page, · 1675 unmodified lines
16761676 /* after clearing PageTail the gup refcount can be released */
16771677 smp_mb__after_atomic();
16781678
1679− /*
1680− * retain hwpoison flag of the poisoned tail page:
1681− * fix for the unsuitable process killed on Guest Machine(KVM)
1682− * by the memory-failure.
1683− */
1684− page_tail->flags &= ~PAGE_FLAGS_CHECK_AT_PREP | __PG_HWPOISON;
1679+ page_tail->flags &= ~PAGE_FLAGS_CHECK_AT_PREP;
16851680 page_tail->flags |= (page->flags &
16861681 ((1L << PG_referenced) |
16871682 (1L << PG_swapbacked) |
mm/memory-failure.c+18−14
@@ -909,6 +909,18 @@ int get_hwpoison_page(struct page *page) · 908 unmodified lines
909909 * directly for tail pages.
910910 */
911911 if (PageTransHuge(head)) {
912+ /*
913+ * Non anonymous thp exists only in allocation/free time. We
914+ * can't handle such a case correctly, so let's give it up.
915+ * This should be better than triggering BUG_ON when kernel
916+ * tries to touch the "partially handled" page.
917+ */
918+ if (!PageAnon(head)) {
919+ pr_err("MCE: %#lx: non anonymous thp\n",
920+ page_to_pfn(page));
921+ return 0;
922+ }
923+
912924 if (get_page_unless_zero(head)) {
913925 if (PageTail(page))
914926 get_page(page);
@@ -1134,15 +1146,6 @@ int memory_failure(unsigned long pfn, int trapno, int flags) · 219 unmodified lines
11341146 }
11351147
11361148 if (!PageHuge(p) && PageTransHuge(hpage)) {
1137− if (!PageAnon(hpage)) {
1138− pr_err("MCE: %#lx: non anonymous thp\n", pfn);
1139− if (TestClearPageHWPoison(p))
1140− atomic_long_sub(nr_pages, &num_poisoned_pages);
1141− put_page(p);
1142− if (p != hpage)
1143− put_page(hpage);
1144− return -EBUSY;
1145− }
11461149 if (unlikely(split_huge_page(hpage))) {
11471150 pr_err("MCE: %#lx: thp split failed\n", pfn);
11481151 if (TestClearPageHWPoison(p))
@@ -1209,9 +1212,9 @@ int memory_failure(unsigned long pfn, int trapno, int flags) · 60 unmodified lines
12091212 if (!PageHWPoison(p)) {
12101213 printk(KERN_ERR "MCE %#lx: just unpoisoned\n", pfn);
12111214 atomic_long_sub(nr_pages, &num_poisoned_pages);
1215+ unlock_page(hpage);
12121216 put_page(hpage);
1213− res = 0;
1214− goto out;
1217+ return 0;
12151218 }
12161219 if (hwpoison_filter(p)) {
12171220 if (TestClearPageHWPoison(p))
@@ -1656,6 +1659,8 @@ static int __soft_offline_page(struct page *page, int flags) · 438 unmodified lines
16561659 inc_zone_page_state(page, NR_ISOLATED_ANON +
16571660 page_is_file_cache(page));
16581661 list_add(&page->lru, &pagelist);
1662+ if (!TestSetPageHWPoison(page))
1663+ atomic_long_inc(&num_poisoned_pages);
16591664 ret = migrate_pages(&pagelist, new_page, NULL, MPOL_MF_MOVE_ALL,
16601665 MIGRATE_SYNC, MR_MEMORY_FAILURE);
16611666 if (ret) {
@@ -1670,9 +1675,8 @@ static int __soft_offline_page(struct page *page, int flags) · 8 unmodified lines
16701675 pfn, ret, page->flags);
16711676 if (ret > 0)
16721677 ret = -EIO;
1673− } else {
1674− SetPageHWPoison(page);
1675− atomic_long_inc(&num_poisoned_pages);
1678+ if (TestClearPageHWPoison(page))
1679+ atomic_long_dec(&num_poisoned_pages);
16761680 }
16771681 } else {
16781682 pr_info("soft offline: %#lx: isolation failed: %d, page count %d, type %lx\n",
mm/memory_hotplug.c+9−1
@@ -446,7 +446,7 @@ static int __meminit __add_zone(struct zone *zone, unsigned long phys_start_pfn) · 445 unmodified lines
446446 int nr_pages = PAGES_PER_SECTION;
447447 int nid = pgdat->node_id;
448448 int zone_type;
449− unsigned long flags;
449+ unsigned long flags, pfn;
450450 int ret;
451451
452452 zone_type = zone - pgdat->node_zones;
@@ -461,6 +461,14 @@ static int __meminit __add_zone(struct zone *zone, unsigned long phys_start_pfn) · 8 unmodified lines
461461 pgdat_resize_unlock(zone->zone_pgdat, &flags);
462462 memmap_init_zone(nr_pages, nid, zone_type,
463463 phys_start_pfn, MEMMAP_HOTPLUG);
464+
465+ /* online_page_range is called later and expects pages reserved */
466+ for (pfn = phys_start_pfn; pfn < phys_start_pfn + nr_pages; pfn++) {
467+ if (!pfn_valid(pfn))
468+ continue;
469+
470+ SetPageReserved(pfn_to_page(pfn));
471+ }
464472 return 0;
465473 }
466474
mm/migrate.c+6−2
@@ -880,7 +880,8 @@ static int __unmap_and_move(struct page *page, struct page *newpage, · 879 unmodified lines
880880 /* Establish migration ptes or remove ptes */
881881 if (page_mapped(page)) {
882882 try_to_unmap(page,
883− TTU_MIGRATION|TTU_IGNORE_MLOCK|TTU_IGNORE_ACCESS);
883+ TTU_MIGRATION|TTU_IGNORE_MLOCK|TTU_IGNORE_ACCESS|
884+ TTU_IGNORE_HWPOISON);
884885 page_was_mapped = 1;
885886 }
886887
@@ -950,7 +951,10 @@ out: · 63 unmodified lines
950951 list_del(&page->lru);
951952 dec_zone_page_state(page, NR_ISOLATED_ANON +
952953 page_is_file_cache(page));
953− if (reason != MR_MEMORY_FAILURE)
954+ /* Soft-offlined page shouldn't go through lru cache list */
955+ if (reason == MR_MEMORY_FAILURE)
956+ put_page(page);
957+ else
954958 putback_lru_page(page);
955959 }
956960
mm/page-writeback.c+2−2
@@ -2063,10 +2063,10 @@ static struct notifier_block ratelimit_nb = { · 2062 unmodified lines
20632063 */
20642064 void __init page_writeback_init(void)
20652065 {
2066+ BUG_ON(wb_domain_init(&global_wb_domain, GFP_KERNEL));
2067+
20662068 writeback_set_ratelimit();
20672069 register_cpu_notifier(&ratelimit_nb);
2068−
2069− BUG_ON(wb_domain_init(&global_wb_domain, GFP_KERNEL));
20702070 }
20712071
20722072 /**
mm/page_alloc.c+30−15
@@ -18,7 +18,6 @@ · 17 unmodified lines
1818 #include <linux/mm.h>
1919 #include <linux/swap.h>
2020 #include <linux/interrupt.h>
21−#include <linux/rwsem.h>
2221 #include <linux/pagemap.h>
2322 #include <linux/jiffies.h>
2423 #include <linux/bootmem.h>
@@ -981,21 +980,21 @@ static void __init __free_pages_boot_core(struct page *page, · 956 unmodified lines
981980
982981 #if defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) || \
983982 defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP)
984−/* Only safe to use early in boot when initialisation is single-threaded */
983+
985984 static struct mminit_pfnnid_cache early_pfnnid_cache __meminitdata;
986985
987986 int __meminit early_pfn_to_nid(unsigned long pfn)
988987 {
988+ static DEFINE_SPINLOCK(early_pfn_lock);
989989 int nid;
990990
991− /* The system will behave unpredictably otherwise */
992− BUG_ON(system_state != SYSTEM_BOOTING);
993−
991+ spin_lock(&early_pfn_lock);
994992 nid = __early_pfn_to_nid(pfn, &early_pfnnid_cache);
995− if (nid >= 0)
996− return nid;
997− /* just returns 0 */
998− return 0;
993+ if (nid < 0)
994+ nid = 0;
995+ spin_unlock(&early_pfn_lock);
996+
997+ return nid;
999998 }
1000999 #endif
10011000
@@ -1060,7 +1059,15 @@ static void __init deferred_free_range(struct page *page, · 58 unmodified lines
10601059 __free_pages_boot_core(page, pfn, 0);
10611060 }
10621061
1063−static __initdata DECLARE_RWSEM(pgdat_init_rwsem);
1062+/* Completion tracking for deferred_init_memmap() threads */
1063+static atomic_t pgdat_init_n_undone __initdata;
1064+static __initdata DECLARE_COMPLETION(pgdat_init_all_done_comp);
1065+
1066+static inline void __init pgdat_init_report_one_done(void)
1067+{
1068+ if (atomic_dec_and_test(&pgdat_init_n_undone))
1069+ complete(&pgdat_init_all_done_comp);
1070+}
10641071
10651072 /* Initialise remaining memory on a node */
10661073 static int __init deferred_init_memmap(void *data)
@@ -1077,7 +1084,7 @@ static int __init deferred_init_memmap(void *data) · 10 unmodified lines
10771084 const struct cpumask *cpumask = cpumask_of_node(pgdat->node_id);
10781085
10791086 if (first_init_pfn == ULONG_MAX) {
1080− up_read(&pgdat_init_rwsem);
1087+ pgdat_init_report_one_done();
10811088 return 0;
10821089 }
10831090
@@ -1177,7 +1184,8 @@ free_range: · 93 unmodified lines
11771184
11781185 pr_info("node %d initialised, %lu pages in %ums\n", nid, nr_pages,
11791186 jiffies_to_msecs(jiffies - start));
1180− up_read(&pgdat_init_rwsem);
1187+
1188+ pgdat_init_report_one_done();
11811189 return 0;
11821190 }
11831191
@@ -1185,14 +1193,17 @@ void __init page_alloc_init_late(void) · 1 unmodified line
11851193 {
11861194 int nid;
11871195
1196+ /* There will be num_node_state(N_MEMORY) threads */
1197+ atomic_set(&pgdat_init_n_undone, num_node_state(N_MEMORY));
11881198 for_each_node_state(nid, N_MEMORY) {
1189− down_read(&pgdat_init_rwsem);
11901199 kthread_run(deferred_init_memmap, NODE_DATA(nid), "pgdatinit%d", nid);
11911200 }
11921201
11931202 /* Block until all are initialised */
1194− down_write(&pgdat_init_rwsem);
1195− up_write(&pgdat_init_rwsem);
1203+ wait_for_completion(&pgdat_init_all_done_comp);
1204+
1205+ /* Reinit limits that are based on free pages after the kernel is up */
1206+ files_maxfiles_init();
11961207 }
11971208 #endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */
11981209
@@ -1285,6 +1296,10 @@ static inline int check_new_page(struct page *page) · 86 unmodified lines
12851296 bad_reason = "non-NULL mapping";
12861297 if (unlikely(atomic_read(&page->_count) != 0))
12871298 bad_reason = "nonzero _count";
1299+ if (unlikely(page->flags & __PG_HWPOISON)) {
1300+ bad_reason = "HWPoisoned (hardware-corrupted)";
1301+ bad_flags = __PG_HWPOISON;
1302+ }
12881303 if (unlikely(page->flags & PAGE_FLAGS_CHECK_AT_PREP)) {
12891304 bad_reason = "PAGE_FLAGS_CHECK_AT_PREP flag set";
12901305 bad_flags = PAGE_FLAGS_CHECK_AT_PREP;
mm/shmem.c+2−2
@@ -3363,8 +3363,8 @@ put_path: · 3362 unmodified lines
33633363 * shmem_kernel_file_setup - get an unlinked file living in tmpfs which must be
33643364 * kernel internal. There will be NO LSM permission checks against the
33653365 * underlying inode. So users of this interface must do LSM checks at a
3366− * higher layer. The one user is the big_key implementation. LSM checks
3367− * are provided at the key level rather than the inode level.
3366+ * higher layer. The users are the big_key and shm implementations. LSM
3367+ * checks are provided at the key or shm level rather than the inode.
33683368 * @name: name for dentry (to be seen in /proc/<pid>/maps
33693369 * @size: size to be set for the file
33703370 * @flags: VM_NORESERVE suppresses pre-accounting of the entire object size
mm/slab_common.c+1−2
@@ -37,8 +37,7 @@ struct kmem_cache *kmem_cache; · 36 unmodified lines
3737 SLAB_TRACE | SLAB_DESTROY_BY_RCU | SLAB_NOLEAKTRACE | \
3838 SLAB_FAILSLAB)
3939
40−#define SLAB_MERGE_SAME (SLAB_DEBUG_FREE | SLAB_RECLAIM_ACCOUNT | \
41− SLAB_CACHE_DMA | SLAB_NOTRACK)
40+#define SLAB_MERGE_SAME (SLAB_RECLAIM_ACCOUNT | SLAB_CACHE_DMA | SLAB_NOTRACK)
4241
4342 /*
4443 * Merge control. If this is set then no merging of slab caches will occur.
mm/vmscan.c+6−10
@@ -973,22 +973,18 @@ static unsigned long shrink_page_list(struct list_head *page_list, · 972 unmodified lines
973973 * caller can stall after page list has been processed.
974974 *
975975 * 2) Global or new memcg reclaim encounters a page that is
976− * not marked for immediate reclaim or the caller does not
977− * have __GFP_IO. In this case mark the page for immediate
976+ * not marked for immediate reclaim, or the caller does not
977+ * have __GFP_FS (or __GFP_IO if it's simply going to swap,
978+ * not to fs). In this case mark the page for immediate
978979 * reclaim and continue scanning.
979980 *
980− * __GFP_IO is checked because a loop driver thread might
981+ * Require may_enter_fs because we would wait on fs, which
982+ * may not have submitted IO yet. And the loop driver might
981983 * enter reclaim, and deadlock if it waits on a page for
982984 * which it is needed to do the write (loop masks off
983985 * __GFP_IO|__GFP_FS for this reason); but more thought
984986 * would probably show more reasons.
985987 *
986− * Don't require __GFP_FS, since we're not going into the
987− * FS, just waiting on its writeback completion. Worryingly,
988− * ext4 gfs2 and xfs allocate pages with
989− * grab_cache_page_write_begin(,,AOP_FLAG_NOFS), so testing
990− * may_enter_fs here is liable to OOM on them.
991− *
992988 * 3) Legacy memcg encounters a page that is not already marked
993989 * PageReclaim. memcg does not have any dirty pages
994990 * throttling so we could easily OOM just because too many
@@ -1005,7 +1001,7 @@ static unsigned long shrink_page_list(struct list_head *page_list, · 10 unmodified lines
10051001
10061002 /* Case 2 above */
10071003 } else if (sane_reclaim(sc) ||
1008− !PageReclaim(page) || !(sc->gfp_mask & __GFP_IO)) {
1004+ !PageReclaim(page) || !may_enter_fs) {
10091005 /*
10101006 * This is slightly racy - end_page_writeback()
10111007 * might have just cleared PageReclaim, then
net/batman-adv/distributed-arp-table.c+13−5
@@ -1138,6 +1138,9 @@ void batadv_dat_snoop_outgoing_arp_reply(struct batadv_priv *bat_priv, · 1137 unmodified lines
11381138 * @bat_priv: the bat priv with all the soft interface information
11391139 * @skb: packet to check
11401140 * @hdr_size: size of the encapsulation header
1141+ *
1142+ * Returns true if the packet was snooped and consumed by DAT. False if the
1143+ * packet has to be delivered to the interface
11411144 */
11421145 bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv,
11431146 struct sk_buff *skb, int hdr_size)
@@ -1145,7 +1148,7 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv, · 1 unmodified line
11451148 uint16_t type;
11461149 __be32 ip_src, ip_dst;
11471150 uint8_t *hw_src, *hw_dst;
1148− bool ret = false;
1151+ bool dropped = false;
11491152 unsigned short vid;
11501153
11511154 if (!atomic_read(&bat_priv->distributed_arp_table))
@@ -1174,12 +1177,17 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv, · 22 unmodified lines
11741177 /* if this REPLY is directed to a client of mine, let's deliver the
11751178 * packet to the interface
11761179 */
1177− ret = !batadv_is_my_client(bat_priv, hw_dst, vid);
1180+ dropped = !batadv_is_my_client(bat_priv, hw_dst, vid);
1181+
1182+ /* if this REPLY is sent on behalf of a client of mine, let's drop the
1183+ * packet because the client will reply by itself
1184+ */
1185+ dropped |= batadv_is_my_client(bat_priv, hw_src, vid);
11781186 out:
1179− if (ret)
1187+ if (dropped)
11801188 kfree_skb(skb);
1181− /* if ret == false -> packet has to be delivered to the interface */
1182− return ret;
1189+ /* if dropped == false -> deliver to the interface */
1190+ return dropped;
11831191 }
11841192
11851193 /**
net/batman-adv/gateway_client.c+2−0
@@ -439,6 +439,8 @@ static void batadv_gw_node_add(struct batadv_priv *bat_priv, · 438 unmodified lines
439439
440440 INIT_HLIST_NODE(&gw_node->list);
441441 gw_node->orig_node = orig_node;
442+ gw_node->bandwidth_down = ntohl(gateway->bandwidth_down);
443+ gw_node->bandwidth_up = ntohl(gateway->bandwidth_up);
442444 atomic_set(&gw_node->refcount, 1);
443445
444446 spin_lock_bh(&bat_priv->gw.list_lock);
net/batman-adv/soft-interface.c+3−0
@@ -479,6 +479,9 @@ out: · 478 unmodified lines
479479 */
480480 void batadv_softif_vlan_free_ref(struct batadv_softif_vlan *vlan)
481481 {
482+ if (!vlan)
483+ return;
484+
482485 if (atomic_dec_and_test(&vlan->refcount)) {
483486 spin_lock_bh(&vlan->bat_priv->softif_vlan_list_lock);
484487 hlist_del_rcu(&vlan->list);
net/batman-adv/translation-table.c+24−5
@@ -594,6 +594,9 @@ bool batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, · 593 unmodified lines
594594
595595 /* increase the refcounter of the related vlan */
596596 vlan = batadv_softif_vlan_get(bat_priv, vid);
597+ if (WARN(!vlan, "adding TT local entry %pM to non-existent VLAN %d",
598+ addr, BATADV_PRINT_VID(vid)))
599+ goto out;
597600
598601 batadv_dbg(BATADV_DBG_TT, bat_priv,
599602 "Creating new local tt entry: %pM (vid: %d, ttvn: %d)\n",
@@ -1034,6 +1037,7 @@ uint16_t batadv_tt_local_remove(struct batadv_priv *bat_priv, · 434 unmodified lines
10341037 struct batadv_tt_local_entry *tt_local_entry;
10351038 uint16_t flags, curr_flags = BATADV_NO_FLAGS;
10361039 struct batadv_softif_vlan *vlan;
1040+ void *tt_entry_exists;
10371041
10381042 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid);
10391043 if (!tt_local_entry)
@@ -1061,11 +1065,22 @@ uint16_t batadv_tt_local_remove(struct batadv_priv *bat_priv, · 21 unmodified lines
10611065 * immediately purge it
10621066 */
10631067 batadv_tt_local_event(bat_priv, tt_local_entry, BATADV_TT_CLIENT_DEL);
1064− hlist_del_rcu(&tt_local_entry->common.hash_entry);
1068+
1069+ tt_entry_exists = batadv_hash_remove(bat_priv->tt.local_hash,
1070+ batadv_compare_tt,
1071+ batadv_choose_tt,
1072+ &tt_local_entry->common);
1073+ if (!tt_entry_exists)
1074+ goto out;
1075+
1076+ /* extra call to free the local tt entry */
10651077 batadv_tt_local_entry_free_ref(tt_local_entry);
10661078
10671079 /* decrease the reference held for this vlan */
10681080 vlan = batadv_softif_vlan_get(bat_priv, vid);
1081+ if (!vlan)
1082+ goto out;
1083+
10691084 batadv_softif_vlan_free_ref(vlan);
10701085 batadv_softif_vlan_free_ref(vlan);
10711086
@@ -1166,8 +1181,10 @@ static void batadv_tt_local_table_free(struct batadv_priv *bat_priv) · 94 unmodified lines
11661181 /* decrease the reference held for this vlan */
11671182 vlan = batadv_softif_vlan_get(bat_priv,
11681183 tt_common_entry->vid);
1169− batadv_softif_vlan_free_ref(vlan);
1170− batadv_softif_vlan_free_ref(vlan);
1184+ if (vlan) {
1185+ batadv_softif_vlan_free_ref(vlan);
1186+ batadv_softif_vlan_free_ref(vlan);
1187+ }
11711188
11721189 batadv_tt_local_entry_free_ref(tt_local);
11731190 }
@@ -3207,8 +3224,10 @@ static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv) · 2033 unmodified lines
32073224
32083225 /* decrease the reference held for this vlan */
32093226 vlan = batadv_softif_vlan_get(bat_priv, tt_common->vid);
3210− batadv_softif_vlan_free_ref(vlan);
3211− batadv_softif_vlan_free_ref(vlan);
3227+ if (vlan) {
3228+ batadv_softif_vlan_free_ref(vlan);
3229+ batadv_softif_vlan_free_ref(vlan);
3230+ }
32123231
32133232 batadv_tt_local_entry_free_ref(tt_local);
32143233 }
net/bluetooth/mgmt.c+1−1
@@ -7843,7 +7843,7 @@ void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, bool persistent) · 7842 unmodified lines
78437843 /* Make sure we copy only the significant bytes based on the
78447844 * encryption key size, and set the rest of the value to zeroes.
78457845 */
7846− memcpy(ev.key.val, key->val, sizeof(key->enc_size));
7846+ memcpy(ev.key.val, key->val, key->enc_size);
78477847 memset(ev.key.val + key->enc_size, 0,
78487848 sizeof(ev.key.val) - key->enc_size);
78497849
net/bridge/br_netlink.c+4−0
@@ -112,6 +112,8 @@ static inline size_t br_port_info_size(void) · 111 unmodified lines
112112 + nla_total_size(1) /* IFLA_BRPORT_FAST_LEAVE */
113113 + nla_total_size(1) /* IFLA_BRPORT_LEARNING */
114114 + nla_total_size(1) /* IFLA_BRPORT_UNICAST_FLOOD */
115+ + nla_total_size(1) /* IFLA_BRPORT_PROXYARP */
116+ + nla_total_size(1) /* IFLA_BRPORT_PROXYARP_WIFI */
115117 + 0;
116118 }
117119
@@ -504,6 +506,8 @@ static const struct nla_policy br_port_policy[IFLA_BRPORT_MAX + 1] = { · 386 unmodified lines
504506 [IFLA_BRPORT_FAST_LEAVE]= { .type = NLA_U8 },
505507 [IFLA_BRPORT_LEARNING] = { .type = NLA_U8 },
506508 [IFLA_BRPORT_UNICAST_FLOOD] = { .type = NLA_U8 },
509+ [IFLA_BRPORT_PROXYARP] = { .type = NLA_U8 },
510+ [IFLA_BRPORT_PROXYARP_WIFI] = { .type = NLA_U8 },
507511 };
508512
509513 /* Change the state of the port and notify spanning tree */
net/core/datagram.c+7−6
@@ -131,12 +131,12 @@ out_noerr: · 130 unmodified lines
131131 goto out;
132132 }
133133
134−static int skb_set_peeked(struct sk_buff *skb)
134+static struct sk_buff *skb_set_peeked(struct sk_buff *skb)
135135 {
136136 struct sk_buff *nskb;
137137
138138 if (skb->peeked)
139− return 0;
139+ return skb;
140140
141141 /* We have to unshare an skb before modifying it. */
142142 if (!skb_shared(skb))
@@ -144,7 +144,7 @@ static int skb_set_peeked(struct sk_buff *skb) · 1 unmodified line
144144
145145 nskb = skb_clone(skb, GFP_ATOMIC);
146146 if (!nskb)
147− return -ENOMEM;
147+ return ERR_PTR(-ENOMEM);
148148
149149 skb->prev->next = nskb;
150150 skb->next->prev = nskb;
@@ -157,7 +157,7 @@ static int skb_set_peeked(struct sk_buff *skb) · 6 unmodified lines
157157 done:
158158 skb->peeked = 1;
159159
160− return 0;
160+ return skb;
161161 }
162162
163163 /**
@@ -229,8 +229,9 @@ struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned int flags, · 65 unmodified lines
229229 continue;
230230 }
231231
232− error = skb_set_peeked(skb);
233− if (error)
232+ skb = skb_set_peeked(skb);
233+ error = PTR_ERR(skb);
234+ if (IS_ERR(skb))
234235 goto unlock_err;
235236
236237 atomic_inc(&skb->users);
net/core/pktgen.c+0−3
@@ -3513,8 +3513,6 @@ static int pktgen_thread_worker(void *arg) · 3512 unmodified lines
35133513
35143514 set_freezable();
35153515
3516− __set_current_state(TASK_RUNNING);
3517−
35183516 while (!kthread_should_stop()) {
35193517 pkt_dev = next_to_run(t);
35203518
@@ -3559,7 +3557,6 @@ static int pktgen_thread_worker(void *arg) · 38 unmodified lines
35593557
35603558 try_to_freeze();
35613559 }
3562− set_current_state(TASK_INTERRUPTIBLE);
35633560
35643561 pr_debug("%s stopping all device\n", t->tsk->comm);
35653562 pktgen_stop(t);
net/core/request_sock.c+7−1
@@ -103,10 +103,16 @@ void reqsk_queue_destroy(struct request_sock_queue *queue) · 102 unmodified lines
103103 spin_lock_bh(&queue->syn_wait_lock);
104104 while ((req = lopt->syn_table[i]) != NULL) {
105105 lopt->syn_table[i] = req->dl_next;
106+ /* Because of following del_timer_sync(),
107+ * we must release the spinlock here
108+ * or risk a dead lock.
109+ */
110+ spin_unlock_bh(&queue->syn_wait_lock);
106111 atomic_inc(&lopt->qlen_dec);
107− if (del_timer(&req->rsk_timer))
112+ if (del_timer_sync(&req->rsk_timer))
108113 reqsk_put(req);
109114 reqsk_put(req);
115+ spin_lock_bh(&queue->syn_wait_lock);
110116 }
111117 spin_unlock_bh(&queue->syn_wait_lock);
112118 }
net/dsa/slave.c+2−1
@@ -856,7 +856,8 @@ static int dsa_slave_phy_connect(struct dsa_slave_priv *p, · 855 unmodified lines
856856 return -ENODEV;
857857
858858 /* Use already configured phy mode */
859− p->phy_interface = p->phy->interface;
859+ if (p->phy_interface == PHY_INTERFACE_MODE_NA)
860+ p->phy_interface = p->phy->interface;
860861 phy_connect_direct(slave_dev, p->phy, dsa_slave_adjust_link,
861862 p->phy_interface);
862863
net/ipv4/inet_connection_sock.c+1−1
@@ -593,7 +593,7 @@ static bool reqsk_queue_unlink(struct request_sock_queue *queue, · 592 unmodified lines
593593 }
594594
595595 spin_unlock(&queue->syn_wait_lock);
596− if (del_timer(&req->rsk_timer))
596+ if (del_timer_sync(&req->rsk_timer))
597597 reqsk_put(req);
598598 return found;
599599 }
net/ipv4/netfilter/ipt_SYNPROXY.c+2−1
@@ -226,7 +226,8 @@ synproxy_send_client_ack(const struct synproxy_net *snet, · 225 unmodified lines
226226
227227 synproxy_build_options(nth, opts);
228228
229− synproxy_send_tcp(skb, nskb, NULL, 0, niph, nth, tcp_hdr_size);
229+ synproxy_send_tcp(skb, nskb, skb->nfct, IP_CT_ESTABLISHED_REPLY,
230+ niph, nth, tcp_hdr_size);
230231 }
231232
232233 static bool
net/ipv4/tcp_ipv4.c+1−1
@@ -1348,7 +1348,7 @@ static struct sock *tcp_v4_hnd_req(struct sock *sk, struct sk_buff *skb) · 1347 unmodified lines
13481348 req = inet_csk_search_req(sk, th->source, iph->saddr, iph->daddr);
13491349 if (req) {
13501350 nsk = tcp_check_req(sk, skb, req, false);
1351− if (!nsk)
1351+ if (!nsk || nsk == sk)
13521352 reqsk_put(req);
13531353 return nsk;
13541354 }
net/ipv4/udp.c+10−3
@@ -1995,12 +1995,19 @@ void udp_v4_early_demux(struct sk_buff *skb) · 1994 unmodified lines
19951995
19961996 skb->sk = sk;
19971997 skb->destructor = sock_efree;
1998− dst = sk->sk_rx_dst;
1998+ dst = READ_ONCE(sk->sk_rx_dst);
19991999
20002000 if (dst)
20012001 dst = dst_check(dst, 0);
2002− if (dst)
2003− skb_dst_set_noref(skb, dst);
2002+ if (dst) {
2003+ /* DST_NOCACHE can not be used without taking a reference */
2004+ if (dst->flags & DST_NOCACHE) {
2005+ if (likely(atomic_inc_not_zero(&dst->__refcnt)))
2006+ skb_dst_set(skb, dst);
2007+ } else {
2008+ skb_dst_set_noref(skb, dst);
2009+ }
2010+ }
20042011 }
20052012
20062013 int udp_rcv(struct sk_buff *skb)
net/ipv6/netfilter/ip6t_SYNPROXY.c+11−8
@@ -37,12 +37,13 @@ synproxy_build_ip(struct sk_buff *skb, const struct in6_addr *saddr, · 36 unmodified lines
3737 }
3838
3939 static void
40−synproxy_send_tcp(const struct sk_buff *skb, struct sk_buff *nskb,
40+synproxy_send_tcp(const struct synproxy_net *snet,
41+ const struct sk_buff *skb, struct sk_buff *nskb,
4142 struct nf_conntrack *nfct, enum ip_conntrack_info ctinfo,
4243 struct ipv6hdr *niph, struct tcphdr *nth,
4344 unsigned int tcp_hdr_size)
4445 {
45− struct net *net = nf_ct_net((struct nf_conn *)nfct);
46+ struct net *net = nf_ct_net(snet->tmpl);
4647 struct dst_entry *dst;
4748 struct flowi6 fl6;
4849
@@ -83,7 +84,8 @@ free_nskb: · 34 unmodified lines
8384 }
8485
8586 static void
86−synproxy_send_client_synack(const struct sk_buff *skb, const struct tcphdr *th,
87+synproxy_send_client_synack(const struct synproxy_net *snet,
88+ const struct sk_buff *skb, const struct tcphdr *th,
8789 const struct synproxy_options *opts)
8890 {
8991 struct sk_buff *nskb;
@@ -119,7 +121,7 @@ synproxy_send_client_synack(const struct sk_buff *skb, const struct tcphdr *th, · 29 unmodified lines
119121
120122 synproxy_build_options(nth, opts);
121123
122− synproxy_send_tcp(skb, nskb, skb->nfct, IP_CT_ESTABLISHED_REPLY,
124+ synproxy_send_tcp(snet, skb, nskb, skb->nfct, IP_CT_ESTABLISHED_REPLY,
123125 niph, nth, tcp_hdr_size);
124126 }
125127
@@ -163,7 +165,7 @@ synproxy_send_server_syn(const struct synproxy_net *snet, · 37 unmodified lines
163165
164166 synproxy_build_options(nth, opts);
165167
166− synproxy_send_tcp(skb, nskb, &snet->tmpl->ct_general, IP_CT_NEW,
168+ synproxy_send_tcp(snet, skb, nskb, &snet->tmpl->ct_general, IP_CT_NEW,
167169 niph, nth, tcp_hdr_size);
168170 }
169171
@@ -203,7 +205,7 @@ synproxy_send_server_ack(const struct synproxy_net *snet, · 33 unmodified lines
203205
204206 synproxy_build_options(nth, opts);
205207
206− synproxy_send_tcp(skb, nskb, NULL, 0, niph, nth, tcp_hdr_size);
208+ synproxy_send_tcp(snet, skb, nskb, NULL, 0, niph, nth, tcp_hdr_size);
207209 }
208210
209211 static void
@@ -241,7 +243,8 @@ synproxy_send_client_ack(const struct synproxy_net *snet, · 31 unmodified lines
241243
242244 synproxy_build_options(nth, opts);
243245
244− synproxy_send_tcp(skb, nskb, NULL, 0, niph, nth, tcp_hdr_size);
246+ synproxy_send_tcp(snet, skb, nskb, skb->nfct, IP_CT_ESTABLISHED_REPLY,
247+ niph, nth, tcp_hdr_size);
245248 }
246249
247250 static bool
@@ -301,7 +304,7 @@ synproxy_tg6(struct sk_buff *skb, const struct xt_action_param *par) · 53 unmodified lines
301304 XT_SYNPROXY_OPT_SACK_PERM |
302305 XT_SYNPROXY_OPT_ECN);
303306
304− synproxy_send_client_synack(skb, th, &opts);
307+ synproxy_send_client_synack(snet, skb, th, &opts);
305308 return NF_DROP;
306309
307310 } else if (th->ack && !(th->fin || th->rst || th->syn)) {
net/ipv6/route.c+4−2
@@ -1844,6 +1844,7 @@ int ip6_route_add(struct fib6_config *cfg) · 1843 unmodified lines
18441844 int gwa_type;
18451845
18461846 gw_addr = &cfg->fc_gateway;
1847+ gwa_type = ipv6_addr_type(gw_addr);
18471848
18481849 /* if gw_addr is local we will fail to detect this in case
18491850 * address is still TENTATIVE (DAD in progress). rt6_lookup()
@@ -1851,11 +1852,12 @@ int ip6_route_add(struct fib6_config *cfg) · 1 unmodified line
18511852 * prefix route was assigned to, which might be non-loopback.
18521853 */
18531854 err = -EINVAL;
1854− if (ipv6_chk_addr_and_flags(net, gw_addr, NULL, 0, 0))
1855+ if (ipv6_chk_addr_and_flags(net, gw_addr,
1856+ gwa_type & IPV6_ADDR_LINKLOCAL ?
1857+ dev : NULL, 0, 0))
18551858 goto out;
18561859
18571860 rt->rt6i_gateway = *gw_addr;
1858− gwa_type = ipv6_addr_type(gw_addr);
18591861
18601862 if (gwa_type != (IPV6_ADDR_LINKLOCAL|IPV6_ADDR_UNICAST)) {
18611863 struct rt6_info *grt;
net/ipv6/tcp_ipv6.c+1−1
@@ -943,7 +943,7 @@ static struct sock *tcp_v6_hnd_req(struct sock *sk, struct sk_buff *skb) · 942 unmodified lines
943943 &ipv6_hdr(skb)->daddr, tcp_v6_iif(skb));
944944 if (req) {
945945 nsk = tcp_check_req(sk, skb, req, false);
946− if (!nsk)
946+ if (!nsk || nsk == sk)
947947 reqsk_put(req);
948948 return nsk;
949949 }
net/netfilter/nf_conntrack_core.c+3−5
@@ -292,7 +292,7 @@ struct nf_conn *nf_ct_tmpl_alloc(struct net *net, u16 zone, gfp_t flags) · 291 unmodified lines
292292 {
293293 struct nf_conn *tmpl;
294294
295− tmpl = kzalloc(sizeof(struct nf_conn), GFP_KERNEL);
295+ tmpl = kzalloc(sizeof(*tmpl), flags);
296296 if (tmpl == NULL)
297297 return NULL;
298298
@@ -303,7 +303,7 @@ struct nf_conn *nf_ct_tmpl_alloc(struct net *net, u16 zone, gfp_t flags) · 4 unmodified lines
303303 if (zone) {
304304 struct nf_conntrack_zone *nf_ct_zone;
305305
306− nf_ct_zone = nf_ct_ext_add(tmpl, NF_CT_EXT_ZONE, GFP_ATOMIC);
306+ nf_ct_zone = nf_ct_ext_add(tmpl, NF_CT_EXT_ZONE, flags);
307307 if (!nf_ct_zone)
308308 goto out_free;
309309 nf_ct_zone->id = zone;
@@ -1544,10 +1544,8 @@ void *nf_ct_alloc_hashtable(unsigned int *sizep, int nulls) · 1234 unmodified lines
15441544 sz = nr_slots * sizeof(struct hlist_nulls_head);
15451545 hash = (void *)__get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO,
15461546 get_order(sz));
1547− if (!hash) {
1548− printk(KERN_WARNING "nf_conntrack: falling back to vmalloc.\n");
1547+ if (!hash)
15491548 hash = vzalloc(sz);
1550− }
15511549
15521550 if (hash && nulls)
15531551 for (i = 0; i < nr_slots; i++)
net/netfilter/nf_synproxy_core.c+1−3
@@ -353,10 +353,8 @@ static int __net_init synproxy_net_init(struct net *net) · 352 unmodified lines
353353 int err = -ENOMEM;
354354
355355 ct = nf_ct_tmpl_alloc(net, 0, GFP_KERNEL);
356− if (IS_ERR(ct)) {
357− err = PTR_ERR(ct);
356+ if (!ct)
358357 goto err1;
359− }
360358
361359 if (!nfct_seqadj_ext_add(ct))
362360 goto err2;
net/netfilter/xt_CT.c+3−2
@@ -202,9 +202,10 @@ static int xt_ct_tg_check(const struct xt_tgchk_param *par, · 201 unmodified lines
202202 goto err1;
203203
204204 ct = nf_ct_tmpl_alloc(par->net, info->zone, GFP_KERNEL);
205− ret = PTR_ERR(ct);
206− if (IS_ERR(ct))
205+ if (!ct) {
206+ ret = -ENOMEM;
207207 goto err2;
208+ }
208209
209210 ret = 0;
210211 if ((info->ct_events || info->exp_events) &&
net/netlink/af_netlink.c+5−0
@@ -1096,6 +1096,11 @@ static int netlink_insert(struct sock *sk, u32 portid) · 1095 unmodified lines
10961096
10971097 err = __netlink_insert(table, sk);
10981098 if (err) {
1099+ /* In case the hashtable backend returns with -EBUSY
1100+ * from here, it must not escape to the caller.
1101+ */
1102+ if (unlikely(err == -EBUSY))
1103+ err = -EOVERFLOW;
10991104 if (err == -EEXIST)
11001105 err = -EADDRINUSE;
11011106 nlk_sk(sk)->portid = 0;
net/openvswitch/actions.c+12−4
@@ -273,28 +273,36 @@ static int set_eth_addr(struct sk_buff *skb, struct sw_flow_key *flow_key, · 272 unmodified lines
273273 return 0;
274274 }
275275
276−static void set_ip_addr(struct sk_buff *skb, struct iphdr *nh,
277− __be32 *addr, __be32 new_addr)
276+static void update_ip_l4_checksum(struct sk_buff *skb, struct iphdr *nh,
277+ __be32 addr, __be32 new_addr)
278278 {
279279 int transport_len = skb->len - skb_transport_offset(skb);
280280
281+ if (nh->frag_off & htons(IP_OFFSET))
282+ return;
283+
281284 if (nh->protocol == IPPROTO_TCP) {
282285 if (likely(transport_len >= sizeof(struct tcphdr)))
283286 inet_proto_csum_replace4(&tcp_hdr(skb)->check, skb,
284− *addr, new_addr, 1);
287+ addr, new_addr, 1);
285288 } else if (nh->protocol == IPPROTO_UDP) {
286289 if (likely(transport_len >= sizeof(struct udphdr))) {
287290 struct udphdr *uh = udp_hdr(skb);
288291
289292 if (uh->check || skb->ip_summed == CHECKSUM_PARTIAL) {
290293 inet_proto_csum_replace4(&uh->check, skb,
291− *addr, new_addr, 1);
294+ addr, new_addr, 1);
292295 if (!uh->check)
293296 uh->check = CSUM_MANGLED_0;
294297 }
295298 }
296299 }
300+}
297301
302+static void set_ip_addr(struct sk_buff *skb, struct iphdr *nh,
303+ __be32 *addr, __be32 new_addr)
304+{
305+ update_ip_l4_checksum(skb, nh, *addr, new_addr);
298306 csum_replace4(&nh->check, *addr, new_addr);
299307 skb_clear_hash(skb);
300308 *addr = new_addr;
net/rds/info.c+1−1
@@ -176,7 +176,7 @@ int rds_info_getsockopt(struct socket *sock, int optname, char __user *optval, · 175 unmodified lines
176176
177177 /* check for all kinds of wrapping and the like */
178178 start = (unsigned long)optval;
179− if (len < 0 || len + PAGE_SIZE - 1 < len || start + len < start) {
179+ if (len < 0 || len > INT_MAX - PAGE_SIZE + 1 || start + len < start) {
180180 ret = -EINVAL;
181181 goto out;
182182 }
net/sched/act_mirred.c+2−0
@@ -101,6 +101,8 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla, · 100 unmodified lines
101101 return ret;
102102 ret = ACT_P_CREATED;
103103 } else {
104+ if (bind)
105+ return 0;
104106 if (!ovr) {
105107 tcf_hash_release(a, bind);
106108 return -EEXIST;
net/sched/sch_fq_codel.c+19−3
@@ -288,10 +288,26 @@ begin: · 287 unmodified lines
288288
289289 static void fq_codel_reset(struct Qdisc *sch)
290290 {
291− struct sk_buff *skb;
291+ struct fq_codel_sched_data *q = qdisc_priv(sch);
292+ int i;
292293
293− while ((skb = fq_codel_dequeue(sch)) != NULL)
294− kfree_skb(skb);
294+ INIT_LIST_HEAD(&q->new_flows);
295+ INIT_LIST_HEAD(&q->old_flows);
296+ for (i = 0; i < q->flows_cnt; i++) {
297+ struct fq_codel_flow *flow = q->flows + i;
298+
299+ while (flow->head) {
300+ struct sk_buff *skb = dequeue_head(flow);
301+
302+ qdisc_qstats_backlog_dec(sch, skb);
303+ kfree_skb(skb);
304+ }
305+
306+ INIT_LIST_HEAD(&flow->flowchain);
307+ codel_vars_init(&flow->cvars);
308+ }
309+ memset(q->backlogs, 0, q->flows_cnt * sizeof(u32));
310+ sch->q.qlen = 0;
295311 }
296312
297313 static const struct nla_policy fq_codel_policy[TCA_FQ_CODEL_MAX + 1] = {
scripts/kconfig/streamline_config.pl+1−1
@@ -137,7 +137,7 @@ my $ksource = ($ARGV[0] ? $ARGV[0] : '.'); · 136 unmodified lines
137137 my $kconfig = $ARGV[1];
138138 my $lsmod_file = $ENV{'LSMOD'};
139139
140−my @makefiles = `find $ksource -name Makefile 2>/dev/null`;
140+my @makefiles = `find $ksource -name Makefile -or -name Kbuild 2>/dev/null`;
141141 chomp @makefiles;
142142
143143 my %depends;
security/yama/yama_lsm.c+1−0
@@ -406,6 +406,7 @@ static __init int yama_init(void) · 405 unmodified lines
406406 */
407407 if (!security_module_enable("yama"))
408408 return 0;
409+ yama_add_hooks();
409410 #endif
410411 pr_info("Yama: becoming mindful.\n");
411412
sound/firewire/amdtp.c+3−2
@@ -740,8 +740,9 @@ static int handle_in_packet(struct amdtp_stream *s, · 739 unmodified lines
740740 s->data_block_counter != UINT_MAX)
741741 data_block_counter = s->data_block_counter;
742742
743− if (((s->flags & CIP_SKIP_DBC_ZERO_CHECK) && data_block_counter == 0) ||
744− (s->data_block_counter == UINT_MAX)) {
743+ if (((s->flags & CIP_SKIP_DBC_ZERO_CHECK) &&
744+ data_block_counter == s->tx_first_dbc) ||
745+ s->data_block_counter == UINT_MAX) {
745746 lost = false;
746747 } else if (!(s->flags & CIP_DBC_IS_END_EVENT)) {
747748 lost = data_block_counter != s->data_block_counter;
sound/firewire/amdtp.h+2−0
@@ -157,6 +157,8 @@ struct amdtp_stream { · 156 unmodified lines
157157
158158 /* quirk: fixed interval of dbc between previos/current packets. */
159159 unsigned int tx_dbc_interval;
160+ /* quirk: indicate the value of dbc field in a first packet. */
161+ unsigned int tx_first_dbc;
160162
161163 bool callbacked;
162164 wait_queue_head_t callback_wait;
sound/firewire/fireworks/fireworks.c+8−2
@@ -248,10 +248,16 @@ efw_probe(struct fw_unit *unit, · 247 unmodified lines
248248 err = get_hardware_info(efw);
249249 if (err < 0)
250250 goto error;
251− if (entry->model_id == MODEL_ECHO_AUDIOFIRE_2)
252− efw->is_af2 = true;
251+ /* AudioFire8 (since 2009) and AudioFirePre8 */
253252 if (entry->model_id == MODEL_ECHO_AUDIOFIRE_9)
254253 efw->is_af9 = true;
254+ /* These models uses the same firmware. */
255+ if (entry->model_id == MODEL_ECHO_AUDIOFIRE_2 ||
256+ entry->model_id == MODEL_ECHO_AUDIOFIRE_4 ||
257+ entry->model_id == MODEL_ECHO_AUDIOFIRE_9 ||
258+ entry->model_id == MODEL_GIBSON_RIP ||
259+ entry->model_id == MODEL_GIBSON_GOLDTOP)
260+ efw->is_fireworks3 = true;
255261
256262 snd_efw_proc_init(efw);
257263
sound/firewire/fireworks/fireworks.h+1−1
@@ -70,8 +70,8 @@ struct snd_efw { · 69 unmodified lines
7070 bool resp_addr_changable;
7171
7272 /* for quirks */
73− bool is_af2;
7473 bool is_af9;
74+ bool is_fireworks3;
7575 u32 firmware_version;
7676
7777 unsigned int midi_in_ports;
sound/firewire/fireworks/fireworks_stream.c+9−3
@@ -172,9 +172,15 @@ int snd_efw_stream_init_duplex(struct snd_efw *efw) · 171 unmodified lines
172172 efw->tx_stream.flags |= CIP_DBC_IS_END_EVENT;
173173 /* Fireworks reset dbc at bus reset. */
174174 efw->tx_stream.flags |= CIP_SKIP_DBC_ZERO_CHECK;
175− /* AudioFire2 starts packets with non-zero dbc. */
176− if (efw->is_af2)
177− efw->tx_stream.flags |= CIP_SKIP_INIT_DBC_CHECK;
175+ /*
176+ * But Recent firmwares starts packets with non-zero dbc.
177+ * Driver version 5.7.6 installs firmware version 5.7.3.
178+ */
179+ if (efw->is_fireworks3 &&
180+ (efw->firmware_version == 0x5070000 ||
181+ efw->firmware_version == 0x5070300 ||
182+ efw->firmware_version == 0x5080000))
183+ efw->tx_stream.tx_first_dbc = 0x02;
178184 /* AudioFire9 always reports wrong dbs. */
179185 if (efw->is_af9)
180186 efw->tx_stream.flags |= CIP_WRONG_DBS;
sound/hda/ext/hdac_ext_controller.c+0−6
@@ -44,16 +44,10 @@ int snd_hdac_ext_bus_parse_capabilities(struct hdac_ext_bus *ebus) · 43 unmodified lines
4444
4545 offset = snd_hdac_chip_readl(bus, LLCH);
4646
47− if (offset < 0)
48− return -EIO;
49−
5047 /* Lets walk the linked capabilities list */
5148 do {
5249 cur_cap = _snd_hdac_chip_read(l, bus, offset);
5350
54− if (cur_cap < 0)
55− return -EIO;
56−
5751 dev_dbg(bus->dev, "Capability version: 0x%x\n",
5852 ((cur_cap & AZX_CAP_HDR_VER_MASK) >> AZX_CAP_HDR_VER_OFF));
5953
sound/hda/ext/hdac_ext_stream.c+1−1
@@ -299,7 +299,7 @@ hdac_ext_host_stream_assign(struct hdac_ext_bus *ebus, · 298 unmodified lines
299299 if (stream->direction != substream->stream)
300300 continue;
301301
302− if (stream->opened) {
302+ if (!stream->opened) {
303303 if (!hstream->decoupled)
304304 snd_hdac_ext_stream_decouple(ebus, hstream, true);
305305 res = hstream;
sound/pci/hda/patch_realtek.c+1−0
@@ -5189,6 +5189,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 5188 unmodified lines
51895189 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
51905190 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
51915191 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5192+ SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC292_FIXUP_DISABLE_AAMIX),
51925193 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
51935194 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
51945195 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
sound/pci/oxygen/oxygen_mixer.c+1−1
@@ -88,7 +88,7 @@ static int dac_mute_put(struct snd_kcontrol *ctl, · 87 unmodified lines
8888 int changed;
8989
9090 mutex_lock(&chip->mutex);
91− changed = !value->value.integer.value[0] != chip->dac_mute;
91+ changed = (!value->value.integer.value[0]) != chip->dac_mute;
9292 if (changed) {
9393 chip->dac_mute = !value->value.integer.value[0];
9494 chip->model.update_dac_mute(chip);
sound/soc/codecs/cs4265.c+5−5
@@ -457,14 +457,14 @@ static int cs4265_pcm_hw_params(struct snd_pcm_substream *substream, · 456 unmodified lines
457457 case SND_SOC_DAIFMT_RIGHT_J:
458458 if (params_width(params) == 16) {
459459 snd_soc_update_bits(codec, CS4265_DAC_CTL,
460− CS4265_DAC_CTL_DIF, (1 << 5));
460+ CS4265_DAC_CTL_DIF, (2 << 4));
461461 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,
462− CS4265_SPDIF_CTL2_DIF, (1 << 7));
462+ CS4265_SPDIF_CTL2_DIF, (2 << 6));
463463 } else {
464464 snd_soc_update_bits(codec, CS4265_DAC_CTL,
465− CS4265_DAC_CTL_DIF, (3 << 5));
465+ CS4265_DAC_CTL_DIF, (3 << 4));
466466 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,
467− CS4265_SPDIF_CTL2_DIF, (1 << 7));
467+ CS4265_SPDIF_CTL2_DIF, (3 << 6));
468468 }
469469 break;
470470 case SND_SOC_DAIFMT_LEFT_J:
@@ -473,7 +473,7 @@ static int cs4265_pcm_hw_params(struct snd_pcm_substream *substream, · 2 unmodified lines
473473 snd_soc_update_bits(codec, CS4265_ADC_CTL,
474474 CS4265_ADC_DIF, 0);
475475 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,
476− CS4265_SPDIF_CTL2_DIF, (1 << 6));
476+ CS4265_SPDIF_CTL2_DIF, 0);
477477
478478 break;
479479 default:
sound/soc/codecs/rt5645.c+2−0
@@ -3341,6 +3341,8 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, · 3340 unmodified lines
33413341 break;
33423342
33433343 case RT5645_DMIC_DATA_GPIO5:
3344+ regmap_update_bits(rt5645->regmap, RT5645_GPIO_CTRL1,
3345+ RT5645_I2S2_DAC_PIN_MASK, RT5645_I2S2_DAC_PIN_GPIO);
33443346 regmap_update_bits(rt5645->regmap, RT5645_DMIC_CTRL1,
33453347 RT5645_DMIC_1_DP_MASK, RT5645_DMIC_1_DP_GPIO5);
33463348 regmap_update_bits(rt5645->regmap, RT5645_GPIO_CTRL1,
sound/soc/codecs/rt5645.h+4−0
@@ -1693,6 +1693,10 @@ · 1692 unmodified lines
16931693 #define RT5645_GP6_PIN_SFT 6
16941694 #define RT5645_GP6_PIN_GPIO6 (0x0 << 6)
16951695 #define RT5645_GP6_PIN_DMIC2_SDA (0x1 << 6)
1696+#define RT5645_I2S2_DAC_PIN_MASK (0x1 << 4)
1697+#define RT5645_I2S2_DAC_PIN_SFT 4
1698+#define RT5645_I2S2_DAC_PIN_I2S (0x0 << 4)
1699+#define RT5645_I2S2_DAC_PIN_GPIO (0x1 << 4)
16961700 #define RT5645_GP8_PIN_MASK (0x1 << 3)
16971701 #define RT5645_GP8_PIN_SFT 3
16981702 #define RT5645_GP8_PIN_GPIO8 (0x0 << 3)
sound/soc/intel/baytrail/sst-baytrail-ipc.c+2−0
@@ -701,6 +701,8 @@ int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata) · 700 unmodified lines
701701 if (byt == NULL)
702702 return -ENOMEM;
703703
704+ byt->dev = dev;
705+
704706 ipc = &byt->ipc;
705707 ipc->dev = dev;
706708 ipc->ops.tx_msg = byt_tx_msg;
sound/soc/intel/haswell/sst-haswell-ipc.c+2−0
@@ -2119,6 +2119,8 @@ int sst_hsw_dsp_init(struct device *dev, struct sst_pdata *pdata) · 2118 unmodified lines
21192119 if (hsw == NULL)
21202120 return -ENOMEM;
21212121
2122+ hsw->dev = dev;
2123+
21222124 ipc = &hsw->ipc;
21232125 ipc->dev = dev;
21242126 ipc->ops.tx_msg = hsw_tx_msg;
sound/soc/soc-topology.c+43−18
@@ -33,6 +33,7 @@ · 32 unmodified lines
3333 #include <sound/soc.h>
3434 #include <sound/soc-dapm.h>
3535 #include <sound/soc-topology.h>
36+#include <sound/tlv.h>
3637
3738 /*
3839 * We make several passes over the data (since it wont necessarily be ordered)
@@ -534,7 +535,7 @@ static int soc_tplg_kcontrol_bind_io(struct snd_soc_tplg_ctl_hdr *hdr, · 495 unmodified lines
534535 k->put = bops[i].put;
535536 if (k->get == NULL && bops[i].id == hdr->ops.get)
536537 k->get = bops[i].get;
537− if (k->info == NULL && ops[i].id == hdr->ops.info)
538+ if (k->info == NULL && bops[i].id == hdr->ops.info)
538539 k->info = bops[i].info;
539540 }
540541
@@ -579,28 +580,51 @@ static int soc_tplg_init_kcontrol(struct soc_tplg *tplg, · 38 unmodified lines
579580 return 0;
580581 }
581582
583+
584+static int soc_tplg_create_tlv_db_scale(struct soc_tplg *tplg,
585+ struct snd_kcontrol_new *kc, struct snd_soc_tplg_tlv_dbscale *scale)
586+{
587+ unsigned int item_len = 2 * sizeof(unsigned int);
588+ unsigned int *p;
589+
590+ p = kzalloc(item_len + 2 * sizeof(unsigned int), GFP_KERNEL);
591+ if (!p)
592+ return -ENOMEM;
593+
594+ p[0] = SNDRV_CTL_TLVT_DB_SCALE;
595+ p[1] = item_len;
596+ p[2] = scale->min;
597+ p[3] = (scale->step & TLV_DB_SCALE_MASK)
598+ | (scale->mute ? TLV_DB_SCALE_MUTE : 0);
599+
600+ kc->tlv.p = (void *)p;
601+ return 0;
602+}
603+
582604 static int soc_tplg_create_tlv(struct soc_tplg *tplg,
583− struct snd_kcontrol_new *kc, struct snd_soc_tplg_ctl_tlv *tplg_tlv)
605+ struct snd_kcontrol_new *kc, struct snd_soc_tplg_ctl_hdr *tc)
584606 {
585− struct snd_ctl_tlv *tlv;
586− int size;
607+ struct snd_soc_tplg_ctl_tlv *tplg_tlv;
587608
588− if (tplg_tlv->count == 0)
609+ if (!(tc->access & SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE))
589610 return 0;
590611
591− size = ((tplg_tlv->count + (sizeof(unsigned int) - 1)) &
592− ~(sizeof(unsigned int) - 1));
593− tlv = kzalloc(sizeof(*tlv) + size, GFP_KERNEL);
594− if (tlv == NULL)
595− return -ENOMEM;
596−
597− dev_dbg(tplg->dev, " created TLV type %d size %d bytes\n",
598− tplg_tlv->numid, size);
612+ if (tc->access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) {
613+ kc->tlv.c = snd_soc_bytes_tlv_callback;
614+ } else {
615+ tplg_tlv = &tc->tlv;
616+ switch (tplg_tlv->type) {
617+ case SNDRV_CTL_TLVT_DB_SCALE:
618+ return soc_tplg_create_tlv_db_scale(tplg, kc,
619+ &tplg_tlv->scale);
599620
600− tlv->numid = tplg_tlv->numid;
601− tlv->length = size;
602− memcpy(&tlv->tlv[0], tplg_tlv->data, size);
603− kc->tlv.p = (void *)tlv;
621+ /* TODO: add support for other TLV types */
622+ default:
623+ dev_dbg(tplg->dev, "Unsupported TLV type %d\n",
624+ tplg_tlv->type);
625+ return -EINVAL;
626+ }
627+ }
604628
605629 return 0;
606630 }
@@ -772,7 +796,7 @@ static int soc_tplg_dmixer_create(struct soc_tplg *tplg, unsigned int count, · 165 unmodified lines
772796 }
773797
774798 /* create any TLV data */
775− soc_tplg_create_tlv(tplg, &kc, &mc->tlv);
799+ soc_tplg_create_tlv(tplg, &kc, &mc->hdr);
776800
777801 /* register control here */
778802 err = soc_tplg_add_kcontrol(tplg, &kc,
@@ -1350,6 +1374,7 @@ static int soc_tplg_dapm_widget_create(struct soc_tplg *tplg, · 571 unmodified lines
13501374 template.reg = w->reg;
13511375 template.shift = w->shift;
13521376 template.mask = w->mask;
1377+ template.subseq = w->subseq;
13531378 template.on_val = w->invert ? 0 : 1;
13541379 template.off_val = w->invert ? 1 : 0;
13551380 template.ignore_suspend = w->ignore_suspend;