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
35 device_type = "dma";35 device_type = "dma";
36 reg = <0x0 0x1f270000 0x0 0x10000>,36 reg = <0x0 0x1f270000 0x0 0x10000>,
37 <0x0 0x1f200000 0x0 0x10000>,37 <0x0 0x1f200000 0x0 0x10000>,
38 <0x0 0x1b008000 0x0 0x2000>,38 <0x0 0x1b000000 0x0 0x400000>,
39 <0x0 0x1054a000 0x0 0x100>;39 <0x0 0x1054a000 0x0 0x100>;
40 interrupts = <0x0 0x82 0x4>,40 interrupts = <0x0 0x82 0x4>,
41 <0x0 0xb8 0x4>,41 <0x0 0xb8 0x4>,
Documentation/devicetree/bindings/phy/ti-phy.txt+16−0
@@ -82,6 +82,9 @@ Optional properties: · 81 unmodified lines
82 - id: If there are multiple instance of the same type, in order to82 - id: If there are multiple instance of the same type, in order to
83 differentiate between each instance "id" can be used (e.g., multi-lane PCIe83 differentiate between each instance "id" can be used (e.g., multi-lane PCIe
84 PHY). If "id" is not provided, it is set to default value of '1'.84 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.
85 88
86This is usually a subnode of ocp2scp to which it is connected.89This is usually a subnode of ocp2scp to which it is connected.
87 90
@@ -100,3 +103,16 @@ usb3phy@4a084400 { · 12 unmodified lines
100 "sysclk",103 "sysclk",
101 "refclk";104 "refclk";
102};105};
106
107sata_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
119 byte 5: 0 z6 z5 z4 z3 z2 z1 z0119 byte 5: 0 z6 z5 z4 z3 z2 z1 z0
120 120
121Protocol Version 2 DualPoint devices send standard PS/2 mouse packets for121Protocol Version 2 DualPoint devices send standard PS/2 mouse packets for
122the DualPoint Stick. For non interleaved dualpoint devices the pointingstick122the DualPoint Stick. The M, R and L bits signal the combined status of both
123buttons get reported separately in the PSM, PSR and PSL bits.123the pointingstick and touchpad buttons, except for Dell dualpoint devices
124where the pointingstick buttons get reported separately in the PSM, PSR
125and PSL bits.
124 126
125Dualpoint device -- interleaved packet format127Dualpoint device -- interleaved packet format
126---------------------------------------------128---------------------------------------------
MAINTAINERS+5−1
@@ -5600,6 +5600,7 @@ F: kernel/irq/ · 5599 unmodified lines
5600IRQCHIP DRIVERS5600IRQCHIP DRIVERS
5601M: Thomas Gleixner <tglx@linutronix.de>5601M: Thomas Gleixner <tglx@linutronix.de>
5602M: Jason Cooper <jason@lakedaemon.net>5602M: Jason Cooper <jason@lakedaemon.net>
5603M: Marc Zyngier <marc.zyngier@arm.com>
5603L: linux-kernel@vger.kernel.org5604L: linux-kernel@vger.kernel.org
5604S: Maintained5605S: Maintained
5605T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core5606T: 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
5608F: drivers/irqchip/5609F: drivers/irqchip/
5609 5610
5610IRQ DOMAINS (IRQ NUMBER MAPPING LIBRARY)5611IRQ DOMAINS (IRQ NUMBER MAPPING LIBRARY)
5611M: Benjamin Herrenschmidt <benh@kernel.crashing.org>5612M: Jiang Liu <jiang.liu@linux.intel.com>
5613M: Marc Zyngier <marc.zyngier@arm.com>
5612S: Maintained5614S: Maintained
5615T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core
5613F: Documentation/IRQ-domain.txt5616F: Documentation/IRQ-domain.txt
5614F: include/linux/irqdomain.h5617F: include/linux/irqdomain.h
5615F: kernel/irq/irqdomain.c5618F: kernel/irq/irqdomain.c
5619F: kernel/irq/msi.c
5616 5620
5617ISAPNP5621ISAPNP
5618M: Jaroslav Kysela <perex@perex.cz>5622M: Jaroslav Kysela <perex@perex.cz>
Makefile+8−3
@@ -1,7 +1,7 @@
1VERSION = 41VERSION = 4
2PATCHLEVEL = 22PATCHLEVEL = 2
3SUBLEVEL = 03SUBLEVEL = 0
4EXTRAVERSION = -rc44EXTRAVERSION = -rc6
5NAME = Hurr durr I'ma sheep5NAME = Hurr durr I'ma sheep
6 6
7# *DOCUMENTATION*7# *DOCUMENTATION*
@@ -597,6 +597,11 @@ endif # $(dot-config) · 589 unmodified lines
597# Defaults to vmlinux, but the arch makefile usually adds further targets597# Defaults to vmlinux, but the arch makefile usually adds further targets
598all: vmlinux598all: vmlinux
599 599
600# The arch Makefile can set ARCH_{CPP,A,C}FLAGS to override the default
601# values of the respective KBUILD_* variables
602ARCH_CPPFLAGS :=
603ARCH_AFLAGS :=
604ARCH_CFLAGS :=
600include arch/$(SRCARCH)/Makefile605include arch/$(SRCARCH)/Makefile
601 606
602KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)607KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
@@ -848,10 +853,10 @@ export mod_strip_cmd · 245 unmodified lines
848mod_compress_cmd = true853mod_compress_cmd = true
849ifdef CONFIG_MODULE_COMPRESS854ifdef CONFIG_MODULE_COMPRESS
850 ifdef CONFIG_MODULE_COMPRESS_GZIP855 ifdef CONFIG_MODULE_COMPRESS_GZIP
851 mod_compress_cmd = gzip -n856 mod_compress_cmd = gzip -n -f
852 endif # CONFIG_MODULE_COMPRESS_GZIP857 endif # CONFIG_MODULE_COMPRESS_GZIP
853 ifdef CONFIG_MODULE_COMPRESS_XZ858 ifdef CONFIG_MODULE_COMPRESS_XZ
854 mod_compress_cmd = xz859 mod_compress_cmd = xz -f
855 endif # CONFIG_MODULE_COMPRESS_XZ860 endif # CONFIG_MODULE_COMPRESS_XZ
856endif # CONFIG_MODULE_COMPRESS861endif # CONFIG_MODULE_COMPRESS
857export mod_compress_cmd862export mod_compress_cmd
arch/arc/Kconfig+11−2
@@ -313,11 +313,11 @@ config ARC_PAGE_SIZE_8K · 312 unmodified lines
313 313
314config ARC_PAGE_SIZE_16K314config ARC_PAGE_SIZE_16K
315 bool "16KB"315 bool "16KB"
316 depends on ARC_MMU_V3316 depends on ARC_MMU_V3 || ARC_MMU_V4
317 317
318config ARC_PAGE_SIZE_4K318config ARC_PAGE_SIZE_4K
319 bool "4KB"319 bool "4KB"
320 depends on ARC_MMU_V3320 depends on ARC_MMU_V3 || ARC_MMU_V4
321 321
322endchoice322endchoice
323 323
@@ -365,6 +365,11 @@ config ARC_HAS_LLSC · 41 unmodified lines
365 default y365 default y
366 depends on !ARC_CANT_LLSC366 depends on !ARC_CANT_LLSC
367 367
368config ARC_STAR_9000923308
369 bool "Workaround for llock/scond livelock"
370 default y
371 depends on ISA_ARCV2 && SMP && ARC_HAS_LLSC
372
368config ARC_HAS_SWAPE373config ARC_HAS_SWAPE
369 bool "Insn: SWAPE (endian-swap)"374 bool "Insn: SWAPE (endian-swap)"
370 default y375 default y
@@ -379,6 +384,10 @@ config ARC_HAS_LL64 · 8 unmodified lines
379 dest operands with 2 possible source operands.384 dest operands with 2 possible source operands.
380 default y385 default y
381 386
387config ARC_HAS_DIV_REM
388 bool "Insn: div, divu, rem, remu"
389 default y
390
382config ARC_HAS_RTC391config ARC_HAS_RTC
383 bool "Local 64-bit r/o cycle counter"392 bool "Local 64-bit r/o cycle counter"
384 default n393 default n
arch/arc/Makefile+9−1
@@ -36,8 +36,16 @@ cflags-$(atleast_gcc44) += -fsection-anchors · 35 unmodified lines
36cflags-$(CONFIG_ARC_HAS_LLSC) += -mlock36cflags-$(CONFIG_ARC_HAS_LLSC) += -mlock
37cflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape37cflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape
38 38
39ifdef CONFIG_ISA_ARCV2
40
39ifndef CONFIG_ARC_HAS_LL6441ifndef CONFIG_ARC_HAS_LL64
40cflags-$(CONFIG_ISA_ARCV2) += -mno-ll6442cflags-y += -mno-ll64
43endif
44
45ifndef CONFIG_ARC_HAS_DIV_REM
46cflags-y += -mno-div-rem
47endif
48
41endif49endif
42 50
43cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables51cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables
arch/arc/include/asm/arcregs.h+3−4
@@ -89,11 +89,10 @@ · 88 unmodified lines
89#define ECR_C_BIT_DTLB_LD_MISS 889#define ECR_C_BIT_DTLB_LD_MISS 8
90#define ECR_C_BIT_DTLB_ST_MISS 990#define ECR_C_BIT_DTLB_ST_MISS 9
91 91
92
93/* Auxiliary registers */92/* Auxiliary registers */
94#define AUX_IDENTITY 493#define AUX_IDENTITY 4
95#define AUX_INTR_VEC_BASE 0x2594#define AUX_INTR_VEC_BASE 0x25
96 95#define AUX_NON_VOL 0x5e
97 96
98/*97/*
99 * Floating Pt Registers98 * Floating Pt Registers
@@ -240,9 +239,9 @@ struct bcr_extn_xymem { · 140 unmodified lines
240 239
241struct bcr_perip {240struct bcr_perip {
242#ifdef CONFIG_CPU_BIG_ENDIAN241#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;
244#else243#else
245 unsigned int pad:8, sz:8, pad2:8, start:8;244 unsigned int ver:8, sz:8, pad2:8, start:8;
246#endif245#endif
247};246};
248 247
arch/arc/include/asm/atomic.h+55−23
@@ -23,33 +23,60 @@ · 22 unmodified lines
23 23
24#define atomic_set(v, i) (((v)->counter) = (i))24#define atomic_set(v, i) (((v)->counter) = (i))
25 25
26#ifdef CONFIG_ISA_ARCV226#ifdef CONFIG_ARC_STAR_9000923308
27#define PREFETCHW " prefetchw [%1] \n"27
28#else28#define SCOND_FAIL_RETRY_VAR_DEF \
29#define PREFETCHW29 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
30#endif53#endif
31 54
32#define ATOMIC_OP(op, c_op, asm_op) \55#define ATOMIC_OP(op, c_op, asm_op) \
33static inline void atomic_##op(int i, atomic_t *v) \56static inline void atomic_##op(int i, atomic_t *v) \
34{ \57{ \
35 unsigned int temp; \58 unsigned int val; \
59 SCOND_FAIL_RETRY_VAR_DEF \
36 \60 \
37 __asm__ __volatile__( \61 __asm__ __volatile__( \
38 "1: \n" \62 "1: llock %[val], [%[ctr]] \n" \
39 PREFETCHW \63 " " #asm_op " %[val], %[val], %[i] \n" \
40 " llock %0, [%1] \n" \64 " scond %[val], [%[ctr]] \n" \
41 " " #asm_op " %0, %0, %2 \n" \65 " \n" \
42 " scond %0, [%1] \n" \66 SCOND_FAIL_RETRY_ASM \
43 " bnz 1b \n" \67 \
44 : "=&r"(temp) /* Early clobber, to prevent reg reuse */ \68 : [val] "=&r" (val) /* Early clobber to prevent reg reuse */ \
45 : "r"(&v->counter), "ir"(i) \69 SCOND_FAIL_RETRY_VARS \
70 : [ctr] "r" (&v->counter), /* Not "m": llock only supports reg direct addr mode */ \
71 [i] "ir" (i) \
46 : "cc"); \72 : "cc"); \
47} \73} \
48 74
49#define ATOMIC_OP_RETURN(op, c_op, asm_op) \75#define ATOMIC_OP_RETURN(op, c_op, asm_op) \
50static inline int atomic_##op##_return(int i, atomic_t *v) \76static inline int atomic_##op##_return(int i, atomic_t *v) \
51{ \77{ \
52 unsigned int temp; \78 unsigned int val; \
79 SCOND_FAIL_RETRY_VAR_DEF \
53 \80 \
54 /* \81 /* \
55 * Explicit full memory barrier needed before/after as \82 * 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
58 smp_mb(); \85 smp_mb(); \
59 \86 \
60 __asm__ __volatile__( \87 __asm__ __volatile__( \
61 "1: \n" \88 "1: llock %[val], [%[ctr]] \n" \
62 PREFETCHW \89 " " #asm_op " %[val], %[val], %[i] \n" \
63 " llock %0, [%1] \n" \90 " scond %[val], [%[ctr]] \n" \
64 " " #asm_op " %0, %0, %2 \n" \91 " \n" \
65 " scond %0, [%1] \n" \92 SCOND_FAIL_RETRY_ASM \
66 " bnz 1b \n" \93 \
67 : "=&r"(temp) \94 : [val] "=&r" (val) \
68 : "r"(&v->counter), "ir"(i) \95 SCOND_FAIL_RETRY_VARS \
96 : [ctr] "r" (&v->counter), \
97 [i] "ir" (i) \
69 : "cc"); \98 : "cc"); \
70 \99 \
71 smp_mb(); \100 smp_mb(); \
72 \101 \
73 return temp; \102 return val; \
74}103}
75 104
76#else /* !CONFIG_ARC_HAS_LLSC */105#else /* !CONFIG_ARC_HAS_LLSC */
@@ -150,6 +179,9 @@ ATOMIC_OP(and, &=, and) · 73 unmodified lines
150#undef ATOMIC_OPS179#undef ATOMIC_OPS
151#undef ATOMIC_OP_RETURN180#undef ATOMIC_OP_RETURN
152#undef ATOMIC_OP181#undef ATOMIC_OP
182#undef SCOND_FAIL_RETRY_VAR_DEF
183#undef SCOND_FAIL_RETRY_ASM
184#undef SCOND_FAIL_RETRY_VARS
153 185
154/**186/**
155 * __atomic_add_unless - add unless the number is a given value187 * __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
20struct pt_regs {20struct pt_regs {
21 21
22 /* Real registers */22 /* Real registers */
23 long bta; /* bta_l1, bta_l2, erbta */23 unsigned long bta; /* bta_l1, bta_l2, erbta */
24 24
25 long lp_start, lp_end, lp_count;25 unsigned long lp_start, lp_end, lp_count;
26 26
27 long status32; /* status32_l1, status32_l2, erstatus */27 unsigned long status32; /* status32_l1, status32_l2, erstatus */
28 long ret; /* ilink1, ilink2 or eret */28 unsigned long ret; /* ilink1, ilink2 or eret */
29 long blink;29 unsigned long blink;
30 long fp;30 unsigned long fp;
31 long r26; /* gp */31 unsigned long r26; /* gp */
32 32
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;
34 34
35 long sp; /* user/kernel sp depending on where we came from */35 unsigned long sp; /* User/Kernel depending on where we came from */
36 long orig_r0;36 unsigned long orig_r0;
37 37
38 /*38 /*
39 * To distinguish bet excp, syscall, irq39 * To distinguish bet excp, syscall, irq
@@ -55,13 +55,13 @@ struct pt_regs { · 15 unmodified lines
55 unsigned long event;55 unsigned long event;
56 };56 };
57 57
58 long user_r25;58 unsigned long user_r25;
59};59};
60#else60#else
61 61
62struct pt_regs {62struct pt_regs {
63 63
64 long orig_r0;64 unsigned long orig_r0;
65 65
66 union {66 union {
67 struct {67 struct {
@@ -76,26 +76,26 @@ struct pt_regs { · 8 unmodified lines
76 unsigned long event;76 unsigned long event;
77 };77 };
78 78
79 long bta; /* bta_l1, bta_l2, erbta */79 unsigned long bta; /* bta_l1, bta_l2, erbta */
80 80
81 long user_r25;81 unsigned long user_r25;
82 82
83 long r26; /* gp */83 unsigned long r26; /* gp */
84 long fp;84 unsigned long fp;
85 long sp; /* user/kernel sp depending on where we came from */85 unsigned long sp; /* user/kernel sp depending on where we came from */
86 86
87 long r12;87 unsigned long r12;
88 88
89 /*------- Below list auto saved by h/w -----------*/89 /*------- 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;
91 91
92 long blink;92 unsigned long blink;
93 long lp_end, lp_start, lp_count;93 unsigned long lp_end, lp_start, lp_count;
94 94
95 long ei, ldi, jli;95 unsigned long ei, ldi, jli;
96 96
97 long ret;97 unsigned long ret;
98 long status32;98 unsigned long status32;
99};99};
100 100
101#endif101#endif
@@ -103,10 +103,10 @@ struct pt_regs { · 1 unmodified line
103/* Callee saved registers - need to be saved only when you are scheduled out */103/* Callee saved registers - need to be saved only when you are scheduled out */
104 104
105struct callee_regs {105struct 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;
107};107};
108 108
109#define instruction_pointer(regs) (unsigned long)((regs)->ret)109#define instruction_pointer(regs) ((regs)->ret)
110#define profile_pc(regs) instruction_pointer(regs)110#define profile_pc(regs) instruction_pointer(regs)
111 111
112/* return 1 if user mode or 0 if kernel mode */112/* return 1 if user mode or 0 if kernel mode */
@@ -142,7 +142,7 @@ struct callee_regs { · 29 unmodified lines
142 142
143static inline long regs_return_value(struct pt_regs *regs)143static inline long regs_return_value(struct pt_regs *regs)
144{144{
145 return regs->r0;145 return (long)regs->r0;
146}146}
147 147
148#endif /* !__ASSEMBLY__ */148#endif /* !__ASSEMBLY__ */
arch/arc/include/asm/spinlock.h+523−15
@@ -18,9 +18,518 @@ · 17 unmodified lines
18#define arch_spin_unlock_wait(x) \18#define arch_spin_unlock_wait(x) \
19 do { while (arch_spin_is_locked(x)) cpu_relax(); } while (0)19 do { while (arch_spin_is_locked(x)) cpu_relax(); } while (0)
20 20
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
21static inline void arch_spin_lock(arch_spinlock_t *lock)28static inline void arch_spin_lock(arch_spinlock_t *lock)
22{29{
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 */
49static 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
74static 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
88static 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 */
120static 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
147static 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 */
182static 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
210static 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
232static 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
271static 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 */
297static 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
326static 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
340static 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 */
377static 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
407static 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 */
447static 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
478static 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
500static 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
530static inline void arch_spin_lock(arch_spinlock_t *lock)
531{
532 unsigned int val = __ARCH_SPIN_LOCK_LOCKED__;
24 533
25 /*534 /*
26 * This smp_mb() is technically superfluous, we only need the one535 * 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
33 __asm__ __volatile__(542 __asm__ __volatile__(
34 "1: ex %0, [%1] \n"543 "1: ex %0, [%1] \n"
35 " breq %0, %2, 1b \n"544 " breq %0, %2, 1b \n"
36 : "+&r" (tmp)545 : "+&r" (val)
37 : "r"(&(lock->slock)), "ir"(__ARCH_SPIN_LOCK_LOCKED__)546 : "r"(&(lock->slock)), "ir"(__ARCH_SPIN_LOCK_LOCKED__)
38 : "memory");547 : "memory");
39 548
@@ -48,26 +557,27 @@ static inline void arch_spin_lock(arch_spinlock_t *lock) · 8 unmodified lines
48 smp_mb();557 smp_mb();
49}558}
50 559
560/* 1 - lock taken successfully */
51static inline int arch_spin_trylock(arch_spinlock_t *lock)561static inline int arch_spin_trylock(arch_spinlock_t *lock)
52{562{
53 unsigned int tmp = __ARCH_SPIN_LOCK_LOCKED__;563 unsigned int val = __ARCH_SPIN_LOCK_LOCKED__;
54 564
55 smp_mb();565 smp_mb();
56 566
57 __asm__ __volatile__(567 __asm__ __volatile__(
58 "1: ex %0, [%1] \n"568 "1: ex %0, [%1] \n"
59 : "+r" (tmp)569 : "+r" (val)
60 : "r"(&(lock->slock))570 : "r"(&(lock->slock))
61 : "memory");571 : "memory");
62 572
63 smp_mb();573 smp_mb();
64 574
65 return (tmp == __ARCH_SPIN_LOCK_UNLOCKED__);575 return (val == __ARCH_SPIN_LOCK_UNLOCKED__);
66}576}
67 577
68static inline void arch_spin_unlock(arch_spinlock_t *lock)578static inline void arch_spin_unlock(arch_spinlock_t *lock)
69{579{
70 unsigned int tmp = __ARCH_SPIN_LOCK_UNLOCKED__;580 unsigned int val = __ARCH_SPIN_LOCK_UNLOCKED__;
71 581
72 /*582 /*
73 * RELEASE barrier: given the instructions avail on ARCv2, full barrier583 * 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
77 587
78 __asm__ __volatile__(588 __asm__ __volatile__(
79 " ex %0, [%1] \n"589 " ex %0, [%1] \n"
80 : "+r" (tmp)590 : "+r" (val)
81 : "r"(&(lock->slock))591 : "r"(&(lock->slock))
82 : "memory");592 : "memory");
83 593
@@ -90,19 +600,12 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock) · 6 unmodified lines
90 600
91/*601/*
92 * Read-write spinlocks, allowing multiple readers but only one writer.602 * Read-write spinlocks, allowing multiple readers but only one writer.
603 * Unfair locking as Writers could be starved indefinitely by Reader(s)
93 *604 *
94 * The spinlock itself is contained in @counter and access to it is605 * The spinlock itself is contained in @counter and access to it is
95 * serialized with @lock_mutex.606 * serialized with @lock_mutex.
96 *
97 * Unfair locking as Writers could be starved indefinitely by Reader(s)
98 */607 */
99 608
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
106/* 1 - lock taken successfully */609/* 1 - lock taken successfully */
107static inline int arch_read_trylock(arch_rwlock_t *rw)610static inline int arch_read_trylock(arch_rwlock_t *rw)
108{611{
@@ -173,6 +676,11 @@ static inline void arch_write_unlock(arch_rwlock_t *rw) · 64 unmodified lines
173 arch_spin_unlock(&(rw->lock_mutex));676 arch_spin_unlock(&(rw->lock_mutex));
174}677}
175 678
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
176#define arch_read_lock_flags(lock, flags) arch_read_lock(lock)684#define arch_read_lock_flags(lock, flags) arch_read_lock(lock)
177#define arch_write_lock_flags(lock, flags) arch_write_lock(lock)685#define arch_write_lock_flags(lock, flags) arch_write_lock(lock)
178 686
arch/arc/include/asm/spinlock_types.h+2−0
@@ -26,7 +26,9 @@ typedef struct { · 25 unmodified lines
26 */26 */
27typedef struct {27typedef struct {
28 volatile unsigned int counter;28 volatile unsigned int counter;
29#ifndef CONFIG_ARC_HAS_LLSC
29 arch_spinlock_t lock_mutex;30 arch_spinlock_t lock_mutex;
31#endif
30} arch_rwlock_t;32} arch_rwlock_t;
31 33
32#define __ARCH_RW_LOCK_UNLOCKED__ 0x0100000034#define __ARCH_RW_LOCK_UNLOCKED__ 0x01000000
arch/arc/include/uapi/asm/ptrace.h+10−10
@@ -32,20 +32,20 @@ · 31 unmodified lines
32*/32*/
33struct user_regs_struct {33struct user_regs_struct {
34 34
35 long pad;35 unsigned long pad;
36 struct {36 struct {
37 long bta, lp_start, lp_end, lp_count;37 unsigned long bta, lp_start, lp_end, lp_count;
38 long status32, ret, blink, fp, gp;38 unsigned long status32, ret, blink, fp, gp;
39 long r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r1, r0;39 unsigned long r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r1, r0;
40 long sp;40 unsigned long sp;
41 } scratch;41 } scratch;
42 long pad2;42 unsigned long pad2;
43 struct {43 struct {
44 long r25, r24, r23, r22, r21, r20;44 unsigned long r25, r24, r23, r22, r21, r20;
45 long r19, r18, r17, r16, r15, r14, r13;45 unsigned long r19, r18, r17, r16, r15, r14, r13;
46 } callee;46 } callee;
47 long efa; /* break pt addr, for break points in delay slots */47 unsigned long efa; /* break pt addr, for break points in delay slots */
48 long stop_pc; /* give dbg stop_pc after ensuring brkpt trap */48 unsigned long stop_pc; /* give dbg stop_pc after ensuring brkpt trap */
49};49};
50#endif /* !__ASSEMBLY__ */50#endif /* !__ASSEMBLY__ */
51 51
arch/arc/kernel/setup.c+11−1
@@ -47,6 +47,7 @@ static void read_arc_build_cfg_regs(void) · 46 unmodified lines
47 struct bcr_perip uncached_space;47 struct bcr_perip uncached_space;
48 struct bcr_generic bcr;48 struct bcr_generic bcr;
49 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()];49 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()];
50 unsigned long perip_space;
50 FIX_PTR(cpu);51 FIX_PTR(cpu);
51 52
52 READ_BCR(AUX_IDENTITY, cpu->core);53 READ_BCR(AUX_IDENTITY, cpu->core);
@@ -56,7 +57,12 @@ static void read_arc_build_cfg_regs(void) · 3 unmodified lines
56 cpu->vec_base = read_aux_reg(AUX_INTR_VEC_BASE);57 cpu->vec_base = read_aux_reg(AUX_INTR_VEC_BASE);
57 58
58 READ_BCR(ARC_REG_D_UNCACH_BCR, uncached_space);59 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);
60 66
61 READ_BCR(ARC_REG_MUL_BCR, cpu->extn_mpy);67 READ_BCR(ARC_REG_MUL_BCR, cpu->extn_mpy);
62 68
@@ -330,6 +336,10 @@ static void arc_chk_core_config(void) · 267 unmodified lines
330 pr_warn("CONFIG_ARC_FPU_SAVE_RESTORE needed for working apps\n");336 pr_warn("CONFIG_ARC_FPU_SAVE_RESTORE needed for working apps\n");
331 else if (!cpu->extn.fpu_dp && fpu_enabled)337 else if (!cpu->extn.fpu_dp && fpu_enabled)
332 panic("FPU non-existent, disable CONFIG_ARC_FPU_SAVE_RESTORE\n");338 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");
333}343}
334 344
335/*345/*
arch/arc/kernel/time.c+15−25
@@ -203,34 +203,24 @@ static int arc_clkevent_set_next_event(unsigned long delta, · 202 unmodified lines
203 return 0;203 return 0;
204}204}
205 205
206static void arc_clkevent_set_mode(enum clock_event_mode mode,206static int arc_clkevent_set_periodic(struct clock_event_device *dev)
207 struct clock_event_device *dev)
208{207{
209 switch (mode) {208 /*
210 case CLOCK_EVT_MODE_PERIODIC:209 * At X Hz, 1 sec = 1000ms -> X cycles;
211 /*210 * 10ms -> X / 100 cycles
212 * At X Hz, 1 sec = 1000ms -> X cycles;211 */
213 * 10ms -> X / 100 cycles212 arc_timer_event_setup(arc_get_core_freq() / HZ);
214 */213 return 0;
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;
224}214}
225 215
226static DEFINE_PER_CPU(struct clock_event_device, arc_clockevent_device) = {216static DEFINE_PER_CPU(struct clock_event_device, arc_clockevent_device) = {
227 .name = "ARC Timer0",217 .name = "ARC Timer0",
228 .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC,218 .features = CLOCK_EVT_FEAT_ONESHOT |
229 .mode = CLOCK_EVT_MODE_UNUSED,219 CLOCK_EVT_FEAT_PERIODIC,
230 .rating = 300,220 .rating = 300,
231 .irq = TIMER0_IRQ, /* hardwired, no need for resources */221 .irq = TIMER0_IRQ, /* hardwired, no need for resources */
232 .set_next_event = arc_clkevent_set_next_event,222 .set_next_event = arc_clkevent_set_next_event,
233 .set_mode = arc_clkevent_set_mode,223 .set_state_periodic = arc_clkevent_set_periodic,
234};224};
235 225
236static irqreturn_t timer_irq_handler(int irq, void *dev_id)226static 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
240 * irq_set_chip_and_handler() asked for handle_percpu_devid_irq()230 * irq_set_chip_and_handler() asked for handle_percpu_devid_irq()
241 */231 */
242 struct clock_event_device *evt = this_cpu_ptr(&arc_clockevent_device);232 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);
244 234
245 /*235 /*
246 * Any write to CTRL reg ACks the interrupt, we rewrite the236 * 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
206 ld.ab r6, [r1, 4]206 ld.ab r6, [r1, 4]
207 prefetch [r1, 28] ;Prefetch the next read location207 prefetch [r1, 28] ;Prefetch the next read location
208 ld.ab r8, [r1,4]208 ld.ab r8, [r1,4]
209 prefetch [r3, 32] ;Prefetch the next write location209 prefetchw [r3, 32] ;Prefetch the next write location
210 210
211 SHIFT_1 (r7, r6, 8)211 SHIFT_1 (r7, r6, 8)
212 or r7, r7, r5212 or r7, r7, r5
arch/arc/lib/memset-archs.S+36−7
@@ -10,12 +10,6 @@ · 9 unmodified lines
10 10
11#undef PREALLOC_NOT_AVAIL11#undef PREALLOC_NOT_AVAIL
12 12
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
19ENTRY(memset)13ENTRY(memset)
20 prefetchw [r0] ; Prefetch the write location14 prefetchw [r0] ; Prefetch the write location
21 mov.f 0, r215 mov.f 0, r2
@@ -51,9 +45,15 @@ ENTRY(memset) · 29 unmodified lines
51 45
52;;; Convert len to Dwords, unfold x846;;; Convert len to Dwords, unfold x8
53 lsr.f lp_count, lp_count, 647 lsr.f lp_count, lp_count, 6
48
54 lpnz @.Lset64bytes49 lpnz @.Lset64bytes
55 ;; LOOP START50 ;; LOOP START
56 PREWRITE(r3, 64) ;Prefetch the next write location51#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
57 std.ab r4, [r3, 8]57 std.ab r4, [r3, 8]
58 std.ab r4, [r3, 8]58 std.ab r4, [r3, 8]
59 std.ab r4, [r3, 8]59 std.ab r4, [r3, 8]
@@ -62,16 +62,45 @@ ENTRY(memset) · 2 unmodified lines
62 std.ab r4, [r3, 8]62 std.ab r4, [r3, 8]
63 std.ab r4, [r3, 8]63 std.ab r4, [r3, 8]
64 std.ab r4, [r3, 8]64 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
65.Lset64bytes:83.Lset64bytes:
66 84
67 lsr.f lp_count, r2, 5 ;Last remaining max 124 bytes85 lsr.f lp_count, r2, 5 ;Last remaining max 124 bytes
68 lpnz .Lset32bytes86 lpnz .Lset32bytes
69 ;; LOOP START87 ;; LOOP START
70 prefetchw [r3, 32] ;Prefetch the next write location88 prefetchw [r3, 32] ;Prefetch the next write location
89#ifdef CONFIG_ARC_HAS_LL64
71 std.ab r4, [r3, 8]90 std.ab r4, [r3, 8]
72 std.ab r4, [r3, 8]91 std.ab r4, [r3, 8]
73 std.ab r4, [r3, 8]92 std.ab r4, [r3, 8]
74 std.ab r4, [r3, 8]93 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
75.Lset32bytes:104.Lset32bytes:
76 105
77 and.f lp_count, r2, 0x1F ;Last remaining 31 bytes106 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
389 389
390static void __init axs103_early_init(void)390static void __init axs103_early_init(void)
391{391{
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
392 switch (arc_get_core_freq()/1000000) {407 switch (arc_get_core_freq()/1000000) {
393 case 33:408 case 33:
394 axs103_set_freq(1, 1, 1);409 axs103_set_freq(1, 1, 1);
arch/arm/boot/dts/dra7.dtsi+1−0
@@ -1140,6 +1140,7 @@ · 1139 unmodified lines
1140 ctrl-module = <&omap_control_sata>;1140 ctrl-module = <&omap_control_sata>;
1141 clocks = <&sys_clkin1>, <&sata_ref_clk>;1141 clocks = <&sys_clkin1>, <&sata_ref_clk>;
1142 clock-names = "sysclk", "refclk";1142 clock-names = "sysclk", "refclk";
1143 syscon-pllreset = <&scm_conf 0x3fc>;
1143 #phy-cells = <0>;1144 #phy-cells = <0>;
1144 };1145 };
1145 1146
arch/arm/boot/dts/exynos3250.dtsi+1−1
@@ -138,8 +138,8 @@ · 137 unmodified lines
138 138
139 mipi_phy: video-phy@10020710 {139 mipi_phy: video-phy@10020710 {
140 compatible = "samsung,s5pv210-mipi-video-phy";140 compatible = "samsung,s5pv210-mipi-video-phy";
141 reg = <0x10020710 8>;
142 #phy-cells = <1>;141 #phy-cells = <1>;
142 syscon = <&pmu_system_controller>;
143 };143 };
144 144
145 pd_cam: cam-power-domain@10023C00 {145 pd_cam: cam-power-domain@10023C00 {
arch/arm/boot/dts/exynos4210-origen.dts+4−0
@@ -127,6 +127,10 @@ · 126 unmodified lines
127 };127 };
128};128};
129 129
130&cpu0 {
131 cpu0-supply = <&buck1_reg>;
132};
133
130&fimd {134&fimd {
131 pinctrl-0 = <&lcd_en &lcd_clk &lcd_data24 &pwm0_out>;135 pinctrl-0 = <&lcd_en &lcd_clk &lcd_data24 &pwm0_out>;
132 pinctrl-names = "default";136 pinctrl-names = "default";
arch/arm/boot/dts/exynos4210-trats.dts+4−0
@@ -188,6 +188,10 @@ · 187 unmodified lines
188 };188 };
189};189};
190 190
191&cpu0 {
192 cpu0-supply = <&varm_breg>;
193};
194
191&dsi_0 {195&dsi_0 {
192 vddcore-supply = <&vusb_reg>;196 vddcore-supply = <&vusb_reg>;
193 vddio-supply = <&vmipi_reg>;197 vddio-supply = <&vmipi_reg>;
arch/arm/boot/dts/exynos4210-universal_c210.dts+4−0
@@ -548,6 +548,10 @@ · 547 unmodified lines
548 };548 };
549};549};
550 550
551&cpu0 {
552 cpu0-supply = <&vdd_arm_reg>;
553};
554
551&pinctrl_1 {555&pinctrl_1 {
552 hdmi_hpd: hdmi-hpd {556 hdmi_hpd: hdmi-hpd {
553 samsung,pins = "gpx3-7";557 samsung,pins = "gpx3-7";
arch/arm/boot/dts/exynos4210.dtsi+12−0
@@ -40,6 +40,18 @@ · 39 unmodified lines
40 device_type = "cpu";40 device_type = "cpu";
41 compatible = "arm,cortex-a9";41 compatible = "arm,cortex-a9";
42 reg = <0x900>;42 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 >;
43 cooling-min-level = <4>;55 cooling-min-level = <4>;
44 cooling-max-level = <2>;56 cooling-max-level = <2>;
45 #cooling-cells = <2>; /* min followed by max */57 #cooling-cells = <2>; /* min followed by max */
arch/arm/boot/dts/imx35.dtsi+4−4
@@ -286,8 +286,8 @@ · 285 unmodified lines
286 can1: can@53fe4000 {286 can1: can@53fe4000 {
287 compatible = "fsl,imx35-flexcan", "fsl,p1010-flexcan";287 compatible = "fsl,imx35-flexcan", "fsl,p1010-flexcan";
288 reg = <0x53fe4000 0x1000>;288 reg = <0x53fe4000 0x1000>;
289 clocks = <&clks 33>;289 clocks = <&clks 33>, <&clks 33>;
290 clock-names = "ipg";290 clock-names = "ipg", "per";
291 interrupts = <43>;291 interrupts = <43>;
292 status = "disabled";292 status = "disabled";
293 };293 };
@@ -295,8 +295,8 @@ · 1 unmodified line
295 can2: can@53fe8000 {295 can2: can@53fe8000 {
296 compatible = "fsl,imx35-flexcan", "fsl,p1010-flexcan";296 compatible = "fsl,imx35-flexcan", "fsl,p1010-flexcan";
297 reg = <0x53fe8000 0x1000>;297 reg = <0x53fe8000 0x1000>;
298 clocks = <&clks 34>;298 clocks = <&clks 34>, <&clks 34>;
299 clock-names = "ipg";299 clock-names = "ipg", "per";
300 interrupts = <44>;300 interrupts = <44>;
301 status = "disabled";301 status = "disabled";
302 };302 };
arch/arm/boot/dts/k2e-clocks.dtsi+2−3
@@ -13,9 +13,8 @@ clocks { · 12 unmodified lines
13 #clock-cells = <0>;13 #clock-cells = <0>;
14 compatible = "ti,keystone,main-pll-clock";14 compatible = "ti,keystone,main-pll-clock";
15 clocks = <&refclksys>;15 clocks = <&refclksys>;
16 reg = <0x02620350 4>, <0x02310110 4>;16 reg = <0x02620350 4>, <0x02310110 4>, <0x02310108 4>;
17 reg-names = "control", "multiplier";17 reg-names = "control", "multiplier", "post-divider";
18 fixed-postdiv = <2>;
19 };18 };
20 19
21 papllclk: papllclk@2620358 {20 papllclk: papllclk@2620358 {
arch/arm/boot/dts/k2hk-clocks.dtsi+2−3
@@ -22,9 +22,8 @@ clocks { · 21 unmodified lines
22 #clock-cells = <0>;22 #clock-cells = <0>;
23 compatible = "ti,keystone,main-pll-clock";23 compatible = "ti,keystone,main-pll-clock";
24 clocks = <&refclksys>;24 clocks = <&refclksys>;
25 reg = <0x02620350 4>, <0x02310110 4>;25 reg = <0x02620350 4>, <0x02310110 4>, <0x02310108 4>;
26 reg-names = "control", "multiplier";26 reg-names = "control", "multiplier", "post-divider";
27 fixed-postdiv = <2>;
28 };27 };
29 28
30 papllclk: papllclk@2620358 {29 papllclk: papllclk@2620358 {
arch/arm/boot/dts/k2l-clocks.dtsi+2−3
@@ -22,9 +22,8 @@ clocks { · 21 unmodified lines
22 #clock-cells = <0>;22 #clock-cells = <0>;
23 compatible = "ti,keystone,main-pll-clock";23 compatible = "ti,keystone,main-pll-clock";
24 clocks = <&refclksys>;24 clocks = <&refclksys>;
25 reg = <0x02620350 4>, <0x02310110 4>;25 reg = <0x02620350 4>, <0x02310110 4>, <0x02310108 4>;
26 reg-names = "control", "multiplier";26 reg-names = "control", "multiplier", "post-divider";
27 fixed-postdiv = <2>;
28 };27 };
29 28
30 papllclk: papllclk@2620358 {29 papllclk: papllclk@2620358 {
arch/arm/boot/dts/ste-nomadik-nhk15.dts+1−0
@@ -17,6 +17,7 @@ · 16 unmodified lines
17 };17 };
18 18
19 aliases {19 aliases {
20 serial1 = &uart1;
20 stmpe-i2c0 = &stmpe0;21 stmpe-i2c0 = &stmpe0;
21 stmpe-i2c1 = &stmpe1;22 stmpe-i2c1 = &stmpe1;
22 };23 };
arch/arm/boot/dts/ste-nomadik-s8815.dts+4−0
@@ -15,6 +15,10 @@ · 14 unmodified lines
15 bootargs = "root=/dev/ram0 console=ttyAMA1,115200n8 earlyprintk";15 bootargs = "root=/dev/ram0 console=ttyAMA1,115200n8 earlyprintk";
16 };16 };
17 17
18 aliases {
19 serial1 = &uart1;
20 };
21
18 src@101e0000 {22 src@101e0000 {
19 /* These chrystal drivers are not used on this board */23 /* These chrystal drivers are not used on this board */
20 disable-sxtalo;24 disable-sxtalo;
arch/arm/boot/dts/ste-nomadik-stn8815.dtsi+1−0
@@ -757,6 +757,7 @@ · 756 unmodified lines
757 clock-names = "uartclk", "apb_pclk";757 clock-names = "uartclk", "apb_pclk";
758 pinctrl-names = "default";758 pinctrl-names = "default";
759 pinctrl-0 = <&uart0_default_mux>;759 pinctrl-0 = <&uart0_default_mux>;
760 status = "disabled";
760 };761 };
761 762
762 uart1: uart@101fb000 {763 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
2373 * registers. This address is needed early so the OCP registers that2373 * registers. This address is needed early so the OCP registers that
2374 * are part of the device's address space can be ioremapped properly.2374 * are part of the device's address space can be ioremapped properly.
2375 *2375 *
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 *
2376 * Returns 0 on success, -EINVAL if an invalid hwmod is passed, and2379 * Returns 0 on success, -EINVAL if an invalid hwmod is passed, and
2377 * -ENXIO on absent or invalid register target address space.2380 * -ENXIO on absent or invalid register target address space.
2378 */2381 */
@@ -2387,6 +2390,11 @@ static int __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data, · 8 unmodified lines
2387 2390
2388 _save_mpu_port_index(oh);2391 _save_mpu_port_index(oh);
2389 2392
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 */
2390 if (oh->_int_flags & _HWMOD_NO_MPU_PORT)2398 if (oh->_int_flags & _HWMOD_NO_MPU_PORT)
2391 return -ENXIO;2399 return -ENXIO;
2392 2400
@@ -2396,8 +2404,10 @@ static int __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data, · 3 unmodified lines
2396 oh->name);2404 oh->name);
2397 2405
2398 /* Extract the IO space from device tree blob */2406 /* 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);
2400 return -ENXIO;2409 return -ENXIO;
2410 }
2401 2411
2402 va_start = of_iomap(np, index + oh->mpu_rt_idx);2412 va_start = of_iomap(np, index + oh->mpu_rt_idx);
2403 } else {2413 } else {
@@ -2456,13 +2466,11 @@ static int __init _init(struct omap_hwmod *oh, void *data) · 52 unmodified lines
2456 oh->name, np->name);2466 oh->name, np->name);
2457 }2467 }
2458 2468
2459 if (oh->class->sysc) {2469 r = _init_mpu_rt_base(oh, NULL, index, np);
2460 r = _init_mpu_rt_base(oh, NULL, index, np);2470 if (r < 0) {
2461 if (r < 0) {2471 WARN(1, "omap_hwmod: %s: doesn't have mpu register target base\n",
2462 WARN(1, "omap_hwmod: %s: doesn't have mpu register target base\n",2472 oh->name);
2463 oh->name);2473 return 0;
2464 return 0;
2465 }
2466 }2474 }
2467 2475
2468 r = _init_clocks(oh, NULL);2476 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
827 .syss_offs = 0x0014,827 .syss_offs = 0x0014,
828 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_SIDLEMODE |828 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_SIDLEMODE |
829 SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),829 SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
830 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |830 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
831 SIDLE_SMART_WKUP),
832 .sysc_fields = &omap_hwmod_sysc_type1,831 .sysc_fields = &omap_hwmod_sysc_type1,
833};832};
834 833
@@ -844,7 +843,7 @@ static struct omap_hwmod dra7xx_gpmc_hwmod = { · 9 unmodified lines
844 .class = &dra7xx_gpmc_hwmod_class,843 .class = &dra7xx_gpmc_hwmod_class,
845 .clkdm_name = "l3main1_clkdm",844 .clkdm_name = "l3main1_clkdm",
846 /* Skip reset for CONFIG_OMAP_GPMC_DEBUG for bootloader timings */845 /* 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,
848 .main_clk = "l3_iclk_div",847 .main_clk = "l3_iclk_div",
849 .prcm = {848 .prcm = {
850 .omap4 = {849 .omap4 = {
arch/arm64/boot/dts/apm/apm-storm.dtsi+1−1
@@ -823,7 +823,7 @@ · 822 unmodified lines
823 device_type = "dma";823 device_type = "dma";
824 reg = <0x0 0x1f270000 0x0 0x10000>,824 reg = <0x0 0x1f270000 0x0 0x10000>,
825 <0x0 0x1f200000 0x0 0x10000>,825 <0x0 0x1f200000 0x0 0x10000>,
826 <0x0 0x1b008000 0x0 0x2000>,826 <0x0 0x1b000000 0x0 0x400000>,
827 <0x0 0x1054a000 0x0 0x100>;827 <0x0 0x1054a000 0x0 0x100>;
828 interrupts = <0x0 0x82 0x4>,828 interrupts = <0x0 0x82 0x4>,
829 <0x0 0xb8 0x4>,829 <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
168 * Other callers might not initialize the si_lsb field,168 * Other callers might not initialize the si_lsb field,
169 * so check explicitely for the right codes here.169 * so check explicitely for the right codes here.
170 */170 */
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))
172 err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb);173 err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb);
173#endif174#endif
174 break;175 break;
@@ -201,8 +202,6 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from) · 26 unmodified lines
201 202
202int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from)203int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from)
203{204{
204 memset(to, 0, sizeof *to);
205
206 if (copy_from_user(to, from, __ARCH_SI_PREAMBLE_SIZE) ||205 if (copy_from_user(to, from, __ARCH_SI_PREAMBLE_SIZE) ||
207 copy_from_user(to->_sifields._pad,206 copy_from_user(to->_sifields._pad,
208 from->_sifields._pad, SI_PAD_SIZE))207 from->_sifields._pad, SI_PAD_SIZE))
arch/arm64/kernel/vdso.c+3−4
@@ -199,16 +199,15 @@ up_fail: · 198 unmodified lines
199 */199 */
200void update_vsyscall(struct timekeeper *tk)200void update_vsyscall(struct timekeeper *tk)
201{201{
202 struct timespec xtime_coarse;
203 u32 use_syscall = strcmp(tk->tkr_mono.clock->name, "arch_sys_counter");202 u32 use_syscall = strcmp(tk->tkr_mono.clock->name, "arch_sys_counter");
204 203
205 ++vdso_data->tb_seq_count;204 ++vdso_data->tb_seq_count;
206 smp_wmb();205 smp_wmb();
207 206
208 xtime_coarse = __current_kernel_time();
209 vdso_data->use_syscall = use_syscall;207 vdso_data->use_syscall = use_syscall;
210 vdso_data->xtime_coarse_sec = xtime_coarse.tv_sec;208 vdso_data->xtime_coarse_sec = tk->xtime_sec;
211 vdso_data->xtime_coarse_nsec = xtime_coarse.tv_nsec;209 vdso_data->xtime_coarse_nsec = tk->tkr_mono.xtime_nsec >>
210 tk->tkr_mono.shift;
212 vdso_data->wtm_clock_sec = tk->wall_to_monotonic.tv_sec;211 vdso_data->wtm_clock_sec = tk->wall_to_monotonic.tv_sec;
213 vdso_data->wtm_clock_nsec = tk->wall_to_monotonic.tv_nsec;212 vdso_data->wtm_clock_nsec = tk->wall_to_monotonic.tv_nsec;
214 213
arch/mips/Kconfig+0−1
@@ -151,7 +151,6 @@ config BMIPS_GENERIC · 150 unmodified lines
151 select BCM7120_L2_IRQ151 select BCM7120_L2_IRQ
152 select BRCMSTB_L2_IRQ152 select BRCMSTB_L2_IRQ
153 select IRQ_MIPS_CPU153 select IRQ_MIPS_CPU
154 select RAW_IRQ_ACCESSORS
155 select DMA_NONCOHERENT154 select DMA_NONCOHERENT
156 select SYS_SUPPORTS_32BIT_KERNEL155 select SYS_SUPPORTS_32BIT_KERNEL
157 select SYS_SUPPORTS_LITTLE_ENDIAN156 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
190{190{
191 return ATH79_MISC_IRQ(5);191 return ATH79_MISC_IRQ(5);
192}192}
193EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
193 194
194unsigned int get_c0_compare_int(void)195unsigned int get_c0_compare_int(void)
195{196{
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
42 cvmx_write_csr(CVMX_CIU_MBOX_CLRX(coreid), action);42 cvmx_write_csr(CVMX_CIU_MBOX_CLRX(coreid), action);
43 43
44 if (action & SMP_CALL_FUNCTION)44 if (action & SMP_CALL_FUNCTION)
45 smp_call_function_interrupt();45 generic_smp_call_function_interrupt();
46 if (action & SMP_RESCHEDULE_YOURSELF)46 if (action & SMP_RESCHEDULE_YOURSELF)
47 scheduler_ipi();47 scheduler_ipi();
48 48
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
182 * Make sure the buddy is global too (if it's !none,182 * Make sure the buddy is global too (if it's !none,
183 * it better already be global)183 * it better already be global)
184 */184 */
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 */
185 if (pte_none(*buddy))215 if (pte_none(*buddy))
186 pte_val(*buddy) = pte_val(*buddy) | _PAGE_GLOBAL;216 pte_val(*buddy) = pte_val(*buddy) | _PAGE_GLOBAL;
217#endif /* CONFIG_SMP */
187 }218 }
188#endif219#endif
189}220}
arch/mips/include/asm/smp.h+0−2
@@ -83,8 +83,6 @@ static inline void __cpu_die(unsigned int cpu) · 82 unmodified lines
83extern void play_dead(void);83extern void play_dead(void);
84#endif84#endif
85 85
86extern asmlinkage void smp_call_function_interrupt(void);
87
88static inline void arch_send_call_function_single_ipi(int cpu)86static inline void arch_send_call_function_single_ipi(int cpu)
89{87{
90 extern struct plat_smp_ops *mp_ops; /* private */88 extern struct plat_smp_ops *mp_ops; /* private */
arch/mips/include/asm/stackframe.h+25−0
@@ -152,6 +152,31 @@ · 151 unmodified lines
152 .set noreorder152 .set noreorder
153 bltz k0, 8f153 bltz k0, 8f
154 move k1, sp154 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
155 .set reorder180 .set reorder
156 /* Called from user mode, new stack. */181 /* Called from user mode, new stack. */
157 get_saved_sp182 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
154 unsigned long __user *user_mask_ptr)154 unsigned long __user *user_mask_ptr)
155{155{
156 unsigned int real_len;156 unsigned int real_len;
157 cpumask_t mask;157 cpumask_t allowed, mask;
158 int retval;158 int retval;
159 struct task_struct *p;159 struct task_struct *p;
160 160
@@ -173,7 +173,8 @@ asmlinkage long mipsmt_sys_sched_getaffinity(pid_t pid, unsigned int len, · 12 unmodified lines
173 if (retval)173 if (retval)
174 goto out_unlock;174 goto out_unlock;
175 175
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);
177 178
178out_unlock:179out_unlock:
179 read_unlock(&tasklist_lock);180 read_unlock(&tasklist_lock);
arch/mips/kernel/prom.c+1−1
@@ -38,7 +38,7 @@ char *mips_get_machine_name(void) · 37 unmodified lines
38 return mips_machine_name;38 return mips_machine_name;
39}39}
40 40
41#ifdef CONFIG_OF41#ifdef CONFIG_USE_OF
42void __init early_init_dt_add_memory_arch(u64 base, u64 size)42void __init early_init_dt_add_memory_arch(u64 base, u64 size)
43{43{
44 return add_memory_region(base, size, BOOT_MEM_RAM);44 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
24 24
25process_entry:25process_entry:
26 PTR_L s2, (s0)26 PTR_L s2, (s0)
27 PTR_ADD s0, s0, SZREG27 PTR_ADDIU s0, s0, SZREG
28 28
29 /*29 /*
30 * In case of a kdump/crash kernel, the indirection page is not30 * In case of a kdump/crash kernel, the indirection page is not
@@ -61,9 +61,9 @@ copy_word: · 30 unmodified lines
61 /* copy page word by word */61 /* copy page word by word */
62 REG_L s5, (s2)62 REG_L s5, (s2)
63 REG_S s5, (s4)63 REG_S s5, (s4)
64 PTR_ADD s4, s4, SZREG64 PTR_ADDIU s4, s4, SZREG
65 PTR_ADD s2, s2, SZREG65 PTR_ADDIU s2, s2, SZREG
66 LONG_SUB s6, s6, 166 LONG_ADDIU s6, s6, -1
67 beq s6, zero, process_entry67 beq s6, zero, process_entry
68 b copy_word68 b copy_word
69 b process_entry69 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
409 409
410int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from)410int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from)
411{411{
412 memset(to, 0, sizeof *to);
413
414 if (copy_from_user(to, from, 3*sizeof(int)) ||412 if (copy_from_user(to, from, 3*sizeof(int)) ||
415 copy_from_user(to->_sifields._pad,413 copy_from_user(to->_sifields._pad,
416 from->_sifields._pad, SI_PAD_SIZE32))414 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
284 if (action == 0)284 if (action == 0)
285 scheduler_ipi();285 scheduler_ipi();
286 else286 else
287 smp_call_function_interrupt();287 generic_smp_call_function_interrupt();
288 288
289 return IRQ_HANDLED;289 return IRQ_HANDLED;
290}290}
@@ -336,7 +336,7 @@ static irqreturn_t bmips43xx_ipi_interrupt(int irq, void *dev_id) · 45 unmodified lines
336 if (action & SMP_RESCHEDULE_YOURSELF)336 if (action & SMP_RESCHEDULE_YOURSELF)
337 scheduler_ipi();337 scheduler_ipi();
338 if (action & SMP_CALL_FUNCTION)338 if (action & SMP_CALL_FUNCTION)
339 smp_call_function_interrupt();339 generic_smp_call_function_interrupt();
340 340
341 return IRQ_HANDLED;341 return IRQ_HANDLED;
342}342}
arch/mips/kernel/smp.c+0−10
@@ -192,16 +192,6 @@ asmlinkage void start_secondary(void) · 191 unmodified lines
192 cpu_startup_entry(CPUHP_ONLINE);192 cpu_startup_entry(CPUHP_ONLINE);
193}193}
194 194
195/*
196 * Call into both interrupt handlers, as we share the IPI for them
197 */
198void __irq_entry smp_call_function_interrupt(void)
199{
200 irq_enter();
201 generic_smp_call_function_interrupt();
202 irq_exit();
203}
204
205static void stop_this_cpu(void *dummy)195static void stop_this_cpu(void *dummy)
206{196{
207 /*197 /*
arch/mips/kernel/traps.c+13−0
@@ -192,6 +192,7 @@ static void show_stacktrace(struct task_struct *task, · 191 unmodified lines
192void show_stack(struct task_struct *task, unsigned long *sp)192void show_stack(struct task_struct *task, unsigned long *sp)
193{193{
194 struct pt_regs regs;194 struct pt_regs regs;
195 mm_segment_t old_fs = get_fs();
195 if (sp) {196 if (sp) {
196 regs.regs[29] = (unsigned long)sp;197 regs.regs[29] = (unsigned long)sp;
197 regs.regs[31] = 0;198 regs.regs[31] = 0;
@@ -210,7 +211,13 @@ void show_stack(struct task_struct *task, unsigned long *sp) · 12 unmodified lines
210 prepare_frametrace(&regs);211 prepare_frametrace(&regs);
211 }212 }
212 }213 }
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);
213 show_stacktrace(task, &regs);219 show_stacktrace(task, &regs);
220 set_fs(old_fs);
214}221}
215 222
216static void show_code(unsigned int __user *pc)223static void show_code(unsigned int __user *pc)
@@ -1519,6 +1526,7 @@ asmlinkage void do_mcheck(struct pt_regs *regs) · 1302 unmodified lines
1519 const int field = 2 * sizeof(unsigned long);1526 const int field = 2 * sizeof(unsigned long);
1520 int multi_match = regs->cp0_status & ST0_TS;1527 int multi_match = regs->cp0_status & ST0_TS;
1521 enum ctx_state prev_state;1528 enum ctx_state prev_state;
1529 mm_segment_t old_fs = get_fs();
1522 1530
1523 prev_state = exception_enter();1531 prev_state = exception_enter();
1524 show_regs(regs);1532 show_regs(regs);
@@ -1540,8 +1548,13 @@ asmlinkage void do_mcheck(struct pt_regs *regs) · 15 unmodified lines
1540 dump_tlb_all();1548 dump_tlb_all();
1541 }1549 }
1542 1550
1551 if (!user_mode(regs))
1552 set_fs(KERNEL_DS);
1553
1543 show_code((unsigned int __user *) regs->cp0_epc);1554 show_code((unsigned int __user *) regs->cp0_epc);
1544 1555
1556 set_fs(old_fs);
1557
1545 /*1558 /*
1546 * Some chips may have other causes of machine check (e.g. SB11559 * Some chips may have other causes of machine check (e.g. SB1
1547 * graduation timer)1560 * graduation timer)
arch/mips/kernel/unaligned.c+1−1
@@ -438,7 +438,7 @@ do { \ · 437 unmodified lines
438 : "memory"); \438 : "memory"); \
439} while(0)439} while(0)
440 440
441#define StoreDW(addr, value, res) \441#define _StoreDW(addr, value, res) \
442do { \442do { \
443 __asm__ __volatile__ ( \443 __asm__ __volatile__ ( \
444 ".set\tpush\n\t" \444 ".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
293 293
294static irqreturn_t ipi_call_interrupt(int irq, void *dev_id)294static irqreturn_t ipi_call_interrupt(int irq, void *dev_id)
295{295{
296 smp_call_function_interrupt();296 generic_smp_call_function_interrupt();
297 return IRQ_HANDLED;297 return IRQ_HANDLED;
298}298}
299 299
@@ -466,6 +466,7 @@ int get_c0_perfcount_int(void) · 166 unmodified lines
466{466{
467 return ltq_perfcount_irq;467 return ltq_perfcount_irq;
468}468}
469EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
469 470
470unsigned int get_c0_compare_int(void)471unsigned int get_c0_compare_int(void)
471{472{
arch/mips/loongson64/loongson-3/smp.c+5−2
@@ -266,8 +266,11 @@ void loongson3_ipi_interrupt(struct pt_regs *regs) · 265 unmodified lines
266 if (action & SMP_RESCHEDULE_YOURSELF)266 if (action & SMP_RESCHEDULE_YOURSELF)
267 scheduler_ipi();267 scheduler_ipi();
268 268
269 if (action & SMP_CALL_FUNCTION)269 if (action & SMP_CALL_FUNCTION) {
270 smp_call_function_interrupt();270 irq_enter();
271 generic_smp_call_function_interrupt();
272 irq_exit();
273 }
271 274
272 if (action & SMP_ASK_C0COUNT) {275 if (action & SMP_ASK_C0COUNT) {
273 BUG_ON(cpu != 0);276 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
160 protection_map[1] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC);160 protection_map[1] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC);
161 protection_map[2] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);161 protection_map[2] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
162 protection_map[3] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC);162 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);
164 protection_map[5] = __pgprot(_page_cachable_default | _PAGE_PRESENT);164 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);
166 protection_map[7] = __pgprot(_page_cachable_default | _PAGE_PRESENT);166 protection_map[7] = __pgprot(_page_cachable_default | _PAGE_PRESENT);
167 167
168 protection_map[8] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);168 protection_map[8] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
169 protection_map[9] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC);169 protection_map[9] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC);
170 protection_map[10] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE | _PAGE_NO_READ);170 protection_map[10] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE | _PAGE_NO_READ);
171 protection_map[11] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE);171 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);
173 protection_map[13] = __pgprot(_page_cachable_default | _PAGE_PRESENT);173 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);
175 protection_map[15] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_WRITE);175 protection_map[15] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_WRITE);
176 176
177 } else {177 } else {
arch/mips/mm/fault.c+2−1
@@ -133,7 +133,8 @@ good_area: · 132 unmodified lines
133#endif133#endif
134 goto bad_area;134 goto bad_area;
135 }135 }
136 if (!(vma->vm_flags & VM_READ)) {136 if (!(vma->vm_flags & VM_READ) &&
137 exception_epc(regs) != address) {
137#if 0138#if 0
138 pr_notice("Cpu%d[%s:%d:%0*lx:%ld:%0*lx] RI violation\n",139 pr_notice("Cpu%d[%s:%d:%0*lx:%ld:%0*lx] RI violation\n",
139 raw_smp_processor_id(),140 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
222 222
223static irqreturn_t ipi_call_interrupt(int irq, void *dev_id)223static irqreturn_t ipi_call_interrupt(int irq, void *dev_id)
224{224{
225 smp_call_function_interrupt();225 generic_smp_call_function_interrupt();
226 226
227 return IRQ_HANDLED;227 return IRQ_HANDLED;
228}228}
arch/mips/mti-malta/malta-time.c+10−6
@@ -154,6 +154,7 @@ int get_c0_perfcount_int(void) · 153 unmodified lines
154 154
155 return mips_cpu_perf_irq;155 return mips_cpu_perf_irq;
156}156}
157EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
157 158
158unsigned int get_c0_compare_int(void)159unsigned int get_c0_compare_int(void)
159{160{
@@ -171,14 +172,17 @@ unsigned int get_c0_compare_int(void) · 11 unmodified lines
171 172
172static void __init init_rtc(void)173static void __init init_rtc(void)
173{174{
174 /* stop the clock whilst setting it up */175 unsigned char freq, ctrl;
175 CMOS_WRITE(RTC_SET | RTC_24H, RTC_CONTROL);
176 176
177 /* 32KHz time base */177 /* Set 32KHz time base if not already set */
178 CMOS_WRITE(RTC_REF_CLCK_32KHZ, RTC_FREQ_SELECT);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);
179 181
180 /* start the clock */182 /* Ensure SET bit is clear so RTC can run */
181 CMOS_WRITE(RTC_24H, RTC_CONTROL);183 ctrl = CMOS_READ(RTC_CONTROL);
184 if (ctrl & RTC_SET)
185 CMOS_WRITE(ctrl & ~RTC_SET, RTC_CONTROL);
182}186}
183 187
184void __init plat_time_init(void)188void __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
77 return MIPS_CPU_IRQ_BASE + cp0_perfcount_irq;77 return MIPS_CPU_IRQ_BASE + cp0_perfcount_irq;
78 return -1;78 return -1;
79}79}
80EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
80 81
81unsigned int get_c0_compare_int(void)82unsigned int get_c0_compare_int(void)
82{83{
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
86{86{
87 clear_c0_eimr(irq);87 clear_c0_eimr(irq);
88 ack_c0_eirr(irq);88 ack_c0_eirr(irq);
89 smp_call_function_interrupt();89 generic_smp_call_function_interrupt();
90 set_c0_eimr(irq);90 set_c0_eimr(irq);
91}91}
92 92
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
114 114
115static irqreturn_t paravirt_function_interrupt(int irq, void *dev_id)115static irqreturn_t paravirt_function_interrupt(int irq, void *dev_id)
116{116{
117 smp_call_function_interrupt();117 generic_smp_call_function_interrupt();
118 return IRQ_HANDLED;118 return IRQ_HANDLED;
119}119}
120 120
arch/mips/pistachio/time.c+1−0
@@ -26,6 +26,7 @@ int get_c0_perfcount_int(void) · 25 unmodified lines
26{26{
27 return gic_get_c0_perfcount_int();27 return gic_get_c0_perfcount_int();
28}28}
29EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
29 30
30int get_c0_fdc_int(void)31int get_c0_fdc_int(void)
31{32{
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
44 44
45static irqreturn_t ipi_call_interrupt(int irq, void *dev_id)45static irqreturn_t ipi_call_interrupt(int irq, void *dev_id)
46{46{
47 smp_call_function_interrupt();47 generic_smp_call_function_interrupt();
48 48
49 return IRQ_HANDLED;49 return IRQ_HANDLED;
50}50}
arch/mips/ralink/irq.c+1−0
@@ -89,6 +89,7 @@ int get_c0_perfcount_int(void) · 88 unmodified lines
89{89{
90 return rt_perfcount_irq;90 return rt_perfcount_irq;
91}91}
92EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
92 93
93unsigned int get_c0_compare_int(void)94unsigned int get_c0_compare_int(void)
94{95{
arch/mips/sgi-ip27/ip27-irq.c+6−2
@@ -107,10 +107,14 @@ static void ip27_do_irq_mask0(void) · 106 unmodified lines
107 scheduler_ipi();107 scheduler_ipi();
108 } else if (pend0 & (1UL << CPU_CALL_A_IRQ)) {108 } else if (pend0 & (1UL << CPU_CALL_A_IRQ)) {
109 LOCAL_HUB_CLR_INTR(CPU_CALL_A_IRQ);109 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();
111 } else if (pend0 & (1UL << CPU_CALL_B_IRQ)) {113 } else if (pend0 & (1UL << CPU_CALL_B_IRQ)) {
112 LOCAL_HUB_CLR_INTR(CPU_CALL_B_IRQ);114 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();
114 } else118 } else
115#endif119#endif
116 {120 {
arch/mips/sibyte/bcm1480/smp.c+5−4
@@ -29,8 +29,6 @@ · 28 unmodified lines
29#include <asm/sibyte/bcm1480_regs.h>29#include <asm/sibyte/bcm1480_regs.h>
30#include <asm/sibyte/bcm1480_int.h>30#include <asm/sibyte/bcm1480_int.h>
31 31
32extern void smp_call_function_interrupt(void);
33
34/*32/*
35 * These are routines for dealing with the bcm1480 smp capabilities33 * These are routines for dealing with the bcm1480 smp capabilities
36 * independent of board/firmware34 * independent of board/firmware
@@ -184,6 +182,9 @@ void bcm1480_mailbox_interrupt(void) · 147 unmodified lines
184 if (action & SMP_RESCHEDULE_YOURSELF)182 if (action & SMP_RESCHEDULE_YOURSELF)
185 scheduler_ipi();183 scheduler_ipi();
186 184
187 if (action & SMP_CALL_FUNCTION)185 if (action & SMP_CALL_FUNCTION) {
188 smp_call_function_interrupt();186 irq_enter();
187 generic_smp_call_function_interrupt();
188 irq_exit();
189 }
189}190}
arch/mips/sibyte/sb1250/smp.c+5−2
@@ -172,6 +172,9 @@ void sb1250_mailbox_interrupt(void) · 171 unmodified lines
172 if (action & SMP_RESCHEDULE_YOURSELF)172 if (action & SMP_RESCHEDULE_YOURSELF)
173 scheduler_ipi();173 scheduler_ipi();
174 174
175 if (action & SMP_CALL_FUNCTION)175 if (action & SMP_CALL_FUNCTION) {
176 smp_call_function_interrupt();176 irq_enter();
177 generic_smp_call_function_interrupt();
178 irq_exit();
179 }
177}180}
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
966 966
967int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from)967int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from)
968{968{
969 memset(to, 0, sizeof *to);
970
971 if (copy_from_user(to, from, 3*sizeof(int)) ||969 if (copy_from_user(to, from, 3*sizeof(int)) ||
972 copy_from_user(to->_sifields._pad,970 copy_from_user(to->_sifields._pad,
973 from->_sifields._pad, SI_PAD_SIZE32))971 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
1478 }1478 }
1479 1479
1480 /* Unmask the event */1480 /* Unmask the event */
1481 if (eeh_enabled())1481 if (ret == EEH_NEXT_ERR_NONE && eeh_enabled())
1482 enable_irq(eeh_event_irq);1482 enable_irq(eeh_event_irq);
1483 1483
1484 return ret;1484 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
2220 2220
2221static __be64 *pnv_pci_ioda2_table_do_alloc_pages(int nid, unsigned shift,2221static __be64 *pnv_pci_ioda2_table_do_alloc_pages(int nid, unsigned shift,
2222 unsigned levels, unsigned long limit,2222 unsigned levels, unsigned long limit,
2223 unsigned long *current_offset)2223 unsigned long *current_offset, unsigned long *total_allocated)
2224{2224{
2225 struct page *tce_mem = NULL;2225 struct page *tce_mem = NULL;
2226 __be64 *addr, *tmp;2226 __be64 *addr, *tmp;
@@ -2236,6 +2236,7 @@ static __be64 *pnv_pci_ioda2_table_do_alloc_pages(int nid, unsigned shift, · 9 unmodified lines
2236 }2236 }
2237 addr = page_address(tce_mem);2237 addr = page_address(tce_mem);
2238 memset(addr, 0, allocated);2238 memset(addr, 0, allocated);
2239 *total_allocated += allocated;
2239 2240
2240 --levels;2241 --levels;
2241 if (!levels) {2242 if (!levels) {
@@ -2245,7 +2246,7 @@ static __be64 *pnv_pci_ioda2_table_do_alloc_pages(int nid, unsigned shift, · 3 unmodified lines
2245 2246
2246 for (i = 0; i < entries; ++i) {2247 for (i = 0; i < entries; ++i) {
2247 tmp = pnv_pci_ioda2_table_do_alloc_pages(nid, shift,2248 tmp = pnv_pci_ioda2_table_do_alloc_pages(nid, shift,
2248 levels, limit, current_offset);2249 levels, limit, current_offset, total_allocated);
2249 if (!tmp)2250 if (!tmp)
2250 break;2251 break;
2251 2252
@@ -2267,7 +2268,7 @@ static long pnv_pci_ioda2_table_alloc_pages(int nid, __u64 bus_offset, · 15 unmodified lines
2267 struct iommu_table *tbl)2268 struct iommu_table *tbl)
2268{2269{
2269 void *addr;2270 void *addr;
2270 unsigned long offset = 0, level_shift;2271 unsigned long offset = 0, level_shift, total_allocated = 0;
2271 const unsigned window_shift = ilog2(window_size);2272 const unsigned window_shift = ilog2(window_size);
2272 unsigned entries_shift = window_shift - page_shift;2273 unsigned entries_shift = window_shift - page_shift;
2273 unsigned table_shift = max_t(unsigned, entries_shift + 3, PAGE_SHIFT);2274 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
2286 2287
2287 /* Allocate TCE table */2288 /* Allocate TCE table */
2288 addr = pnv_pci_ioda2_table_do_alloc_pages(nid, level_shift,2289 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);
2290 2291
2291 /* addr==NULL means that the first level allocation failed */2292 /* addr==NULL means that the first level allocation failed */
2292 if (!addr)2293 if (!addr)
@@ -2308,7 +2309,7 @@ static long pnv_pci_ioda2_table_alloc_pages(int nid, __u64 bus_offset, · 15 unmodified lines
2308 page_shift);2309 page_shift);
2309 tbl->it_level_size = 1ULL << (level_shift - 3);2310 tbl->it_level_size = 1ULL << (level_shift - 3);
2310 tbl->it_indirect_levels = levels - 1;2311 tbl->it_indirect_levels = levels - 1;
2311 tbl->it_allocated_size = offset;2312 tbl->it_allocated_size = total_allocated;
2312 2313
2313 pr_devel("Created TCE table: ws=%08llx ts=%lx @%08llx\n",2314 pr_devel("Created TCE table: ws=%08llx ts=%lx @%08llx\n",
2314 window_size, tce_table_size, bus_offset);2315 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
1742 1742
1743static int kvm_s390_handle_requests(struct kvm_vcpu *vcpu)1743static int kvm_s390_handle_requests(struct kvm_vcpu *vcpu)
1744{1744{
1745 if (!vcpu->requests)
1746 return 0;
1747retry:1745retry:
1748 kvm_s390_vcpu_request_handled(vcpu);1746 kvm_s390_vcpu_request_handled(vcpu);
1747 if (!vcpu->requests)
1748 return 0;
1749 /*1749 /*
1750 * We use MMU_RELOAD just to re-arm the ipte notifier for the1750 * We use MMU_RELOAD just to re-arm the ipte notifier for the
1751 * guest prefix page. gmap_ipte_notify will wait on the ptl lock.1751 * 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
28 * Must preserve %o5 between VISEntryHalf and VISExitHalf */28 * Must preserve %o5 between VISEntryHalf and VISExitHalf */
29 29
30#define VISEntryHalf \30#define VISEntryHalf \
31 rd %fprs, %o5; \31 VISEntry
32 andcc %o5, FPRS_FEF, %g0; \32
33 be,pt %icc, 297f; \33#define VISExitHalf \
34 sethi %hi(298f), %g7; \34 VISExit
35 sethi %hi(VISenterhalf), %g1; \
36 jmpl %g1 + %lo(VISenterhalf), %g0; \
37 or %g7, %lo(298f), %g7; \
38 clr %o5; \
39297: wr %o5, FPRS_FEF, %fprs; \
40298:
41 35
42#define VISEntryHalfFast(fail_label) \36#define VISEntryHalfFast(fail_label) \
43 rd %fprs, %o5; \37 rd %fprs, %o5; \
@@ -47,7 +41,7 @@ · 3 unmodified lines
47 ba,a,pt %xcc, fail_label; \41 ba,a,pt %xcc, fail_label; \
48297: wr %o5, FPRS_FEF, %fprs;42297: wr %o5, FPRS_FEF, %fprs;
49 43
50#define VISExitHalf \44#define VISExitHalfFast \
51 wr %o5, 0, %fprs;45 wr %o5, 0, %fprs;
52 46
53#ifndef __ASSEMBLY__47#ifndef __ASSEMBLY__
arch/sparc/lib/NG4memcpy.S+4−1
@@ -240,8 +240,11 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */ · 239 unmodified lines
240 add %o0, 0x40, %o0240 add %o0, 0x40, %o0
241 bne,pt %icc, 1b241 bne,pt %icc, 1b
242 LOAD(prefetch, %g1 + 0x200, #n_reads_strong)242 LOAD(prefetch, %g1 + 0x200, #n_reads_strong)
243#ifdef NON_USER_COPY
244 VISExitHalfFast
245#else
243 VISExitHalf246 VISExitHalf
244 247#endif
245 brz,pn %o2, .Lexit248 brz,pn %o2, .Lexit
246 cmp %o2, 19249 cmp %o2, 19
247 ble,pn %icc, .Lsmall_unaligned250 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
44 44
45 stx %g3, [%g6 + TI_GSR]45 stx %g3, [%g6 + TI_GSR]
462: add %g6, %g1, %g3462: add %g6, %g1, %g3
47 cmp %o5, FPRS_DU47 mov FPRS_DU | FPRS_DL | FPRS_FEF, %o5
48 be,pn %icc, 6f48 sll %g1, 3, %g1
49 sll %g1, 3, %g1
50 stb %o5, [%g3 + TI_FPSAVED]49 stb %o5, [%g3 + TI_FPSAVED]
51 rd %gsr, %g250 rd %gsr, %g2
52 add %g6, %g1, %g351 add %g6, %g1, %g3
@@ -80,65 +79,3 @@ vis1: ldub [%g6 + TI_FPSAVED], %g3 · 27 unmodified lines
80 .align 3279 .align 32
8180: jmpl %g7 + %g0, %g08080: jmpl %g7 + %g0, %g0
82 nop81 nop
83
846: 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
10080: jmpl %g7 + %g0, %g0
101 nop
102
103 .align 32
104VISenterhalf:
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
1141: bne,pn %icc, 2f
115 srl %g1, 1, %g1
116 ba,pt %xcc, vis1
117 sub %g7, 8, %g7
1182: 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
1293: 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
1424: 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
135void VISenter(void);135void VISenter(void);
136EXPORT_SYMBOL(VISenter);136EXPORT_SYMBOL(VISenter);
137 137
138/* CRYPTO code needs this */
139void VISenterhalf(void);
140EXPORT_SYMBOL(VISenterhalf);
141
142extern void xor_vis_2(unsigned long, unsigned long *, unsigned long *);138extern void xor_vis_2(unsigned long, unsigned long *, unsigned long *);
143extern void xor_vis_3(unsigned long, unsigned long *, unsigned long *,139extern void xor_vis_3(unsigned long, unsigned long *, unsigned long *,
144 unsigned long *);140 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
113 if (!access_ok(VERIFY_READ, from, sizeof(struct compat_siginfo)))113 if (!access_ok(VERIFY_READ, from, sizeof(struct compat_siginfo)))
114 return -EFAULT;114 return -EFAULT;
115 115
116 memset(to, 0, sizeof(*to));
117
118 err = __get_user(to->si_signo, &from->si_signo);116 err = __get_user(to->si_signo, &from->si_signo);
119 err |= __get_user(to->si_errno, &from->si_errno);117 err |= __get_user(to->si_errno, &from->si_errno);
120 err |= __get_user(to->si_code, &from->si_code);118 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
1193 unsigned int e820_type = 0;1193 unsigned int e820_type = 0;
1194 unsigned long m = efi->efi_memmap;1194 unsigned long m = efi->efi_memmap;
1195 1195
1196#ifdef CONFIG_X86_64
1197 m |= (u64)efi->efi_memmap_hi << 32;
1198#endif
1199
1196 d = (efi_memory_desc_t *)(m + (i * efi->efi_memdesc_size));1200 d = (efi_memory_desc_t *)(m + (i * efi->efi_memdesc_size));
1197 switch (d->type) {1201 switch (d->type) {
1198 case EFI_RESERVED_TYPE:1202 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
280 set_ldt(NULL, 0);280 set_ldt(NULL, 0);
281}281}
282 282
283/*
284 * load one particular LDT into the current CPU
285 */
286static inline void load_LDT_nolock(mm_context_t *pc)
287{
288 set_ldt(pc->ldt, pc->size);
289}
290
291static inline void load_LDT(mm_context_t *pc)
292{
293 preempt_disable();
294 load_LDT_nolock(pc);
295 preempt_enable();
296}
297
298static inline unsigned long get_desc_base(const struct desc_struct *desc)283static inline unsigned long get_desc_base(const struct desc_struct *desc)
299{284{
300 return (unsigned)(desc->base0 | ((desc->base1) << 16) | ((desc->base2) << 24));285 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
9 * we put the segment information here.9 * we put the segment information here.
10 */10 */
11typedef struct {11typedef struct {
12 void *ldt;12 struct ldt_struct *ldt;
13 int size;
14 13
15#ifdef CONFIG_X86_6414#ifdef CONFIG_X86_64
16 /* True if mm supports a task running in 32 bit compatibility mode. */15 /* 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
33static inline void load_mm_cr4(struct mm_struct *mm) {}33static inline void load_mm_cr4(struct mm_struct *mm) {}
34#endif34#endif
35 35
36/*
37 * ldt_structs can be allocated, used, and freed, but they are never
38 * modified while live.
39 */
40struct 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
51static 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
36/*80/*
37 * Used for LDT copy/destruction.81 * Used for LDT copy/destruction.
38 */82 */
@@ -78,12 +122,12 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, · 39 unmodified lines
78 * was called and then modify_ldt changed122 * was called and then modify_ldt changed
79 * prev->context.ldt but suppressed an IPI to this CPU.123 * prev->context.ldt but suppressed an IPI to this CPU.
80 * In this case, prev->context.ldt != NULL, because we124 * In this case, prev->context.ldt != NULL, because we
81 * never free an LDT while the mm still exists. That125 * never set context.ldt to NULL while the mm still
82 * means that next->context.ldt != prev->context.ldt,126 * exists. That means that next->context.ldt !=
83 * because mms never share an LDT.127 * prev->context.ldt, because mms never share an LDT.
84 */128 */
85 if (unlikely(prev->context.ldt != next->context.ldt))129 if (unlikely(prev->context.ldt != next->context.ldt))
86 load_LDT_nolock(&next->context);130 load_mm_ldt(next);
87 }131 }
88#ifdef CONFIG_SMP132#ifdef CONFIG_SMP
89 else {133 else {
@@ -106,7 +150,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, · 16 unmodified lines
106 load_cr3(next->pgd);150 load_cr3(next->pgd);
107 trace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL);151 trace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL);
108 load_mm_cr4(next);152 load_mm_cr4(next);
109 load_LDT_nolock(&next->context);153 load_mm_ldt(next);
110 }154 }
111 }155 }
112#endif156#endif
arch/x86/include/asm/sigcontext.h+3−3
@@ -57,9 +57,9 @@ struct sigcontext { · 56 unmodified lines
57 unsigned long ip;57 unsigned long ip;
58 unsigned long flags;58 unsigned long flags;
59 unsigned short cs;59 unsigned short cs;
60 unsigned short __pad2; /* Was called gs, but was always zero. */60 unsigned short gs;
61 unsigned short __pad1; /* Was called fs, but was always zero. */61 unsigned short fs;
62 unsigned short ss;62 unsigned short __pad0;
63 unsigned long err;63 unsigned long err;
64 unsigned long trapno;64 unsigned long trapno;
65 unsigned long oldmask;65 unsigned long oldmask;
arch/x86/include/uapi/asm/sigcontext.h+3−18
@@ -177,24 +177,9 @@ struct sigcontext { · 176 unmodified lines
177 __u64 rip;177 __u64 rip;
178 __u64 eflags; /* RFLAGS */178 __u64 eflags; /* RFLAGS */
179 __u16 cs;179 __u16 cs;
180 180 __u16 gs;
181 /*181 __u16 fs;
182 * Prior to 2.5.64 ("[PATCH] x86-64 updates for 2.5.64-bk3"),182 __u16 __pad0;
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;
198 __u64 err;183 __u64 err;
199 __u64 trapno;184 __u64 trapno;
200 __u64 oldmask;185 __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
943 */943 */
944 if (irq < nr_legacy_irqs() && data->count == 1) {944 if (irq < nr_legacy_irqs() && data->count == 1) {
945 if (info->ioapic_trigger != data->trigger)945 if (info->ioapic_trigger != data->trigger)
946 mp_register_handler(irq, data->trigger);946 mp_register_handler(irq, info->ioapic_trigger);
947 data->entry.trigger = data->trigger = info->ioapic_trigger;947 data->entry.trigger = data->trigger = info->ioapic_trigger;
948 data->entry.polarity = data->polarity = info->ioapic_polarity;948 data->entry.polarity = data->polarity = info->ioapic_polarity;
949 }949 }
arch/x86/kernel/cpu/common.c+2−2
@@ -1410,7 +1410,7 @@ void cpu_init(void) · 1409 unmodified lines
1410 load_sp0(t, &current->thread);1410 load_sp0(t, &current->thread);
1411 set_tss_desc(cpu, t);1411 set_tss_desc(cpu, t);
1412 load_TR_desc();1412 load_TR_desc();
1413 load_LDT(&init_mm.context);1413 load_mm_ldt(&init_mm);
1414 1414
1415 clear_all_debug_regs();1415 clear_all_debug_regs();
1416 dbg_restore_debug_regs();1416 dbg_restore_debug_regs();
@@ -1459,7 +1459,7 @@ void cpu_init(void) · 42 unmodified lines
1459 load_sp0(t, thread);1459 load_sp0(t, thread);
1460 set_tss_desc(cpu, t);1460 set_tss_desc(cpu, t);
1461 load_TR_desc();1461 load_TR_desc();
1462 load_LDT(&init_mm.context);1462 load_mm_ldt(&init_mm);
1463 1463
1464 t->x86_tss.io_bitmap_base = offsetof(struct tss_struct, io_bitmap);1464 t->x86_tss.io_bitmap_base = offsetof(struct tss_struct, io_bitmap);
1465 1465
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
2179 int idx = segment >> 3;2179 int idx = segment >> 3;
2180 2180
2181 if ((segment & SEGMENT_TI_MASK) == SEGMENT_LDT) {2181 if ((segment & SEGMENT_TI_MASK) == SEGMENT_LDT) {
2182 struct ldt_struct *ldt;
2183
2182 if (idx > LDT_ENTRIES)2184 if (idx > LDT_ENTRIES)
2183 return 0;2185 return 0;
2184 2186
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)
2186 return 0;2190 return 0;
2187 2191
2188 desc = current->active_mm->context.ldt;2192 desc = &ldt->entries[idx];
2189 } else {2193 } else {
2190 if (idx > GDT_ENTRIES)2194 if (idx > GDT_ENTRIES)
2191 return 0;2195 return 0;
2192 2196
2193 desc = raw_cpu_ptr(gdt_page.gdt);2197 desc = raw_cpu_ptr(gdt_page.gdt) + idx;
2194 }2198 }
2195 2199
2196 return get_desc_base(desc + idx);2200 return get_desc_base(desc);
2197}2201}
2198 2202
2199#ifdef CONFIG_COMPAT2203#ifdef CONFIG_COMPAT
arch/x86/kernel/ldt.c+142−120
@@ -12,6 +12,7 @@ · 11 unmodified lines
12#include <linux/string.h>12#include <linux/string.h>
13#include <linux/mm.h>13#include <linux/mm.h>
14#include <linux/smp.h>14#include <linux/smp.h>
15#include <linux/slab.h>
15#include <linux/vmalloc.h>16#include <linux/vmalloc.h>
16#include <linux/uaccess.h>17#include <linux/uaccess.h>
17 18
@@ -20,82 +21,82 @@ · 2 unmodified lines
20#include <asm/mmu_context.h>21#include <asm/mmu_context.h>
21#include <asm/syscalls.h>22#include <asm/syscalls.h>
22 23
23#ifdef CONFIG_SMP24/* context.lock is held for us, so we don't need any locking. */
24static void flush_ldt(void *current_mm)25static void flush_ldt(void *current_mm)
25{26{
26 if (current->active_mm == current_mm)27 mm_context_t *pc;
27 load_LDT(&current->active_mm->context);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);
28}34}
29#endif
30 35
31static 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. */
37static struct ldt_struct *alloc_ldt_struct(int size)
32{38{
33 void *oldldt, *newldt;39 struct ldt_struct *new_ldt;
34 int oldsize;40 int alloc_size;
35 41
36 if (mincount <= pc->size)42 if (size > LDT_ENTRIES)
37 return 0;43 return NULL;
38 oldsize = pc->size;44
39 mincount = (mincount + (PAGE_SIZE / LDT_ENTRY_SIZE - 1)) &45 new_ldt = kmalloc(sizeof(struct ldt_struct), GFP_KERNEL);
40 (~(PAGE_SIZE / LDT_ENTRY_SIZE - 1));46 if (!new_ldt)
41 if (mincount * LDT_ENTRY_SIZE > PAGE_SIZE)47 return NULL;
42 newldt = vmalloc(mincount * LDT_ENTRY_SIZE);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);
43 else60 else
44 newldt = (void *)__get_free_page(GFP_KERNEL);61 new_ldt->entries = kzalloc(PAGE_SIZE, GFP_KERNEL);
45
46 if (!newldt)
47 return -ENOMEM;
48 62
49 if (oldsize)63 if (!new_ldt->entries) {
50 memcpy(newldt, pc->ldt, oldsize * LDT_ENTRY_SIZE);64 kfree(new_ldt);
51 oldldt = pc->ldt;65 return NULL;
52 memset(newldt + oldsize * LDT_ENTRY_SIZE, 0,66 }
53 (mincount - oldsize) * LDT_ENTRY_SIZE);
54 67
55 paravirt_alloc_ldt(newldt, mincount);68 new_ldt->size = size;
69 return new_ldt;
70}
56 71
57#ifdef CONFIG_X86_6472/* After calling this, the LDT is immutable. */
58 /* CHECKME: Do we really need this ? */73static void finalize_ldt_struct(struct ldt_struct *ldt)
59 wmb();74{
60#endif75 paravirt_alloc_ldt(ldt->entries, ldt->size);
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;
86}76}
87 77
88static inline int copy_ldt(mm_context_t *new, mm_context_t *old)78/* context.lock is held */
79static void install_ldt(struct mm_struct *current_mm,
80 struct ldt_struct *ldt)
89{81{
90 int err = alloc_ldt(new, old->size, 0);82 /* Synchronizes with lockless_dereference in load_mm_ldt. */
91 int i;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}
92 88
93 if (err < 0)89static void free_ldt_struct(struct ldt_struct *ldt)
94 return err;90{
91 if (likely(!ldt))
92 return;
95 93
96 for (i = 0; i < old->size; i++)94 paravirt_free_ldt(ldt->entries, ldt->size);
97 write_ldt_entry(new->ldt, i, old->ldt + i * LDT_ENTRY_SIZE);95 if (ldt->size * LDT_ENTRY_SIZE > PAGE_SIZE)
98 return 0;96 vfree(ldt->entries);
97 else
98 kfree(ldt->entries);
99 kfree(ldt);
99}100}
100 101
101/*102/*
@@ -104,17 +105,37 @@ static inline int copy_ldt(mm_context_t *new, mm_context_t *old) · 2 unmodified lines
104 */105 */
105int init_new_context(struct task_struct *tsk, struct mm_struct *mm)106int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
106{107{
108 struct ldt_struct *new_ldt;
107 struct mm_struct *old_mm;109 struct mm_struct *old_mm;
108 int retval = 0;110 int retval = 0;
109 111
110 mutex_init(&mm->context.lock);112 mutex_init(&mm->context.lock);
111 mm->context.size = 0;
112 old_mm = current->mm;113 old_mm = current->mm;
113 if (old_mm && old_mm->context.size > 0) {114 if (!old_mm) {
114 mutex_lock(&old_mm->context.lock);115 mm->context.ldt = NULL;
115 retval = copy_ldt(&mm->context, &old_mm->context);116 return 0;
116 mutex_unlock(&old_mm->context.lock);
117 }117 }
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
137out_unlock:
138 mutex_unlock(&old_mm->context.lock);
118 return retval;139 return retval;
119}140}
120 141
@@ -125,53 +146,47 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm) · 4 unmodified lines
125 */146 */
126void destroy_context(struct mm_struct *mm)147void destroy_context(struct mm_struct *mm)
127{148{
128 if (mm->context.size) {149 free_ldt_struct(mm->context.ldt);
129#ifdef CONFIG_X86_32150 mm->context.ldt = NULL;
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 }
141}151}
142 152
143static int read_ldt(void __user *ptr, unsigned long bytecount)153static int read_ldt(void __user *ptr, unsigned long bytecount)
144{154{
145 int err;155 int retval;
146 unsigned long size;156 unsigned long size;
147 struct mm_struct *mm = current->mm;157 struct mm_struct *mm = current->mm;
148 158
149 if (!mm->context.size)159 mutex_lock(&mm->context.lock);
150 return 0;160
161 if (!mm->context.ldt) {
162 retval = 0;
163 goto out_unlock;
164 }
165
151 if (bytecount > LDT_ENTRY_SIZE * LDT_ENTRIES)166 if (bytecount > LDT_ENTRY_SIZE * LDT_ENTRIES)
152 bytecount = LDT_ENTRY_SIZE * LDT_ENTRIES;167 bytecount = LDT_ENTRY_SIZE * LDT_ENTRIES;
153 168
154 mutex_lock(&mm->context.lock);169 size = mm->context.ldt->size * LDT_ENTRY_SIZE;
155 size = mm->context.size * LDT_ENTRY_SIZE;
156 if (size > bytecount)170 if (size > bytecount)
157 size = bytecount;171 size = bytecount;
158 172
159 err = 0;173 if (copy_to_user(ptr, mm->context.ldt->entries, size)) {
160 if (copy_to_user(ptr, mm->context.ldt, size))174 retval = -EFAULT;
161 err = -EFAULT;175 goto out_unlock;
162 mutex_unlock(&mm->context.lock);176 }
163 if (err < 0)177
164 goto error_return;
165 if (size != bytecount) {178 if (size != bytecount) {
166 /* zero-fill the rest */179 /* Zero-fill the rest and pretend we read bytecount bytes. */
167 if (clear_user(ptr + size, bytecount - size) != 0) {180 if (clear_user(ptr + size, bytecount - size)) {
168 err = -EFAULT;181 retval = -EFAULT;
169 goto error_return;182 goto out_unlock;
170 }183 }
171 }184 }
172 return bytecount;185 retval = bytecount;
173error_return:186
174 return err;187out_unlock:
188 mutex_unlock(&mm->context.lock);
189 return retval;
175}190}
176 191
177static int read_default_ldt(void __user *ptr, unsigned long bytecount)192static 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
195 struct desc_struct ldt;210 struct desc_struct ldt;
196 int error;211 int error;
197 struct user_desc ldt_info;212 struct user_desc ldt_info;
213 int oldsize, newsize;
214 struct ldt_struct *new_ldt, *old_ldt;
198 215
199 error = -EINVAL;216 error = -EINVAL;
200 if (bytecount != sizeof(ldt_info))217 if (bytecount != sizeof(ldt_info))
@@ -213,34 +230,39 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode) · 12 unmodified lines
213 goto out;230 goto out;
214 }231 }
215 232
216 mutex_lock(&mm->context.lock);233 if ((oldmode && !ldt_info.base_addr && !ldt_info.limit) ||
217 if (ldt_info.entry_number >= mm->context.size) {234 LDT_empty(&ldt_info)) {
218 error = alloc_ldt(&current->mm->context,235 /* The user wants to clear the entry. */
219 ldt_info.entry_number + 1, 1);236 memset(&ldt, 0, sizeof(ldt));
220 if (error < 0)237 } else {
221 goto out_unlock;238 if (!IS_ENABLED(CONFIG_X86_16BIT) && !ldt_info.seg_32bit) {
222 }239 error = -EINVAL;
223 240 goto out;
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;
229 }241 }
242
243 fill_ldt(&ldt, &ldt_info);
244 if (oldmode)
245 ldt.avl = 0;
230 }246 }
231 247
232 if (!IS_ENABLED(CONFIG_X86_16BIT) && !ldt_info.seg_32bit) {248 mutex_lock(&mm->context.lock);
233 error = -EINVAL;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)
234 goto out_unlock;257 goto out_unlock;
235 }
236 258
237 fill_ldt(&ldt, &ldt_info);259 if (old_ldt)
238 if (oldmode)260 memcpy(new_ldt->entries, old_ldt->entries, oldsize * LDT_ENTRY_SIZE);
239 ldt.avl = 0;261 new_ldt->entries[ldt_info.entry_number] = ldt;
262 finalize_ldt_struct(new_ldt);
240 263
241 /* Install the new entry ... */264 install_ldt(mm, new_ldt);
242install:265 free_ldt_struct(old_ldt);
243 write_ldt_entry(mm->context.ldt, ldt_info.entry_number, &ldt);
244 error = 0;266 error = 0;
245 267
246out_unlock:268out_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
121void release_thread(struct task_struct *dead_task)121void release_thread(struct task_struct *dead_task)
122{122{
123 if (dead_task->mm) {123 if (dead_task->mm) {
124 if (dead_task->mm->context.size) {124 if (dead_task->mm->context.ldt) {
125 pr_warn("WARNING: dead process %s still has LDT? <%p/%d>\n",125 pr_warn("WARNING: dead process %s still has LDT? <%p/%d>\n",
126 dead_task->comm,126 dead_task->comm,
127 dead_task->mm->context.ldt,127 dead_task->mm->context.ldt,
128 dead_task->mm->context.size);128 dead_task->mm->context.ldt->size);
129 BUG();129 BUG();
130 }130 }
131 }131 }
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
93 COPY(r15);93 COPY(r15);
94#endif /* CONFIG_X86_64 */94#endif /* CONFIG_X86_64 */
95 95
96#ifdef CONFIG_X86_32
96 COPY_SEG_CPL3(cs);97 COPY_SEG_CPL3(cs);
97 COPY_SEG_CPL3(ss);98 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 */
98 105
99 get_user_ex(tmpflags, &sc->flags);106 get_user_ex(tmpflags, &sc->flags);
100 regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS);107 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
154#else /* !CONFIG_X86_32 */161#else /* !CONFIG_X86_32 */
155 put_user_ex(regs->flags, &sc->flags);162 put_user_ex(regs->flags, &sc->flags);
156 put_user_ex(regs->cs, &sc->cs);163 put_user_ex(regs->cs, &sc->cs);
157 put_user_ex(0, &sc->__pad2);164 put_user_ex(0, &sc->gs);
158 put_user_ex(0, &sc->__pad1);165 put_user_ex(0, &sc->fs);
159 put_user_ex(regs->ss, &sc->ss);
160#endif /* CONFIG_X86_32 */166#endif /* CONFIG_X86_32 */
161 167
162 put_user_ex(fpstate, &sc->fpstate);168 put_user_ex(fpstate, &sc->fpstate);
@@ -451,19 +457,9 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig, · 288 unmodified lines
451 457
452 regs->sp = (unsigned long)frame;458 regs->sp = (unsigned long)frame;
453 459
454 /*460 /* Set up the CS register to run signal handlers in 64-bit mode,
455 * Set up the CS and SS registers to run signal handlers in461 even if the handler happens to be interrupting 32-bit code. */
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 */
465 regs->cs = __USER_CS;462 regs->cs = __USER_CS;
466 regs->ss = __USER_DS;
467 463
468 return 0;464 return 0;
469}465}
arch/x86/kernel/step.c+4−2
@@ -5,6 +5,7 @@ · 4 unmodified lines
5#include <linux/mm.h>5#include <linux/mm.h>
6#include <linux/ptrace.h>6#include <linux/ptrace.h>
7#include <asm/desc.h>7#include <asm/desc.h>
8#include <asm/mmu_context.h>
8 9
9unsigned long convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs)10unsigned long convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs)
10{11{
@@ -30,10 +31,11 @@ unsigned long convert_ip_to_linear(struct task_struct *child, struct pt_regs *re · 19 unmodified lines
30 seg &= ~7UL;31 seg &= ~7UL;
31 32
32 mutex_lock(&child->mm->context.lock);33 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))
34 addr = -1L; /* bogus selector, access would fault */36 addr = -1L; /* bogus selector, access would fault */
35 else {37 else {
36 desc = child->mm->context.ldt + seg;38 desc = &child->mm->context.ldt->entries[seg];
37 base = get_desc_base(desc);39 base = get_desc_base(desc);
38 40
39 /* 16-bit code segment? */41 /* 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
672 if (iter.mtrr_disabled)672 if (iter.mtrr_disabled)
673 return mtrr_disabled_type();673 return mtrr_disabled_type();
674 674
675 /* not contained in any MTRRs. */
676 if (type == -1)
677 return mtrr_default_type(mtrr_state);
678
675 /*679 /*
676 * We just check one page, partially covered by MTRRs is680 * We just check one page, partially covered by MTRRs is
677 * impossible.681 * impossible.
678 */682 */
679 WARN_ON(iter.partial_map);683 WARN_ON(iter.partial_map);
680 684
681 /* not contained in any MTRRs. */
682 if (type == -1)
683 return mtrr_default_type(mtrr_state);
684
685 return type;685 return type;
686}686}
687EXPORT_SYMBOL_GPL(kvm_mtrr_get_guest_memory_type);687EXPORT_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
972 972
973static int __init arch_parse_efi_cmdline(char *str)973static int __init arch_parse_efi_cmdline(char *str)
974{974{
975 if (!str) {
976 pr_warn("need at least one option\n");
977 return -EINVAL;
978 }
979
975 if (parse_option_str(str, "old_map"))980 if (parse_option_str(str, "old_map"))
976 set_bit(EFI_OLD_MEMMAP, &efi.flags);981 set_bit(EFI_OLD_MEMMAP, &efi.flags);
977 if (parse_option_str(str, "debug"))982 if (parse_option_str(str, "debug"))
arch/x86/power/cpu.c+2−1
@@ -22,6 +22,7 @@ · 21 unmodified lines
22#include <asm/fpu/internal.h>22#include <asm/fpu/internal.h>
23#include <asm/debugreg.h>23#include <asm/debugreg.h>
24#include <asm/cpu.h>24#include <asm/cpu.h>
25#include <asm/mmu_context.h>
25 26
26#ifdef CONFIG_X86_3227#ifdef CONFIG_X86_32
27__visible unsigned long saved_context_ebx;28__visible unsigned long saved_context_ebx;
@@ -153,7 +154,7 @@ static void fix_processor_context(void) · 125 unmodified lines
153 syscall_init(); /* This sets MSR_*STAR and related */154 syscall_init(); /* This sets MSR_*STAR and related */
154#endif155#endif
155 load_TR_desc(); /* This does ltr */156 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 */
157 158
158 fpu__resume_cpu();159 fpu__resume_cpu();
159}160}
arch/x86/xen/Makefile+2−2
@@ -13,13 +13,13 @@ CFLAGS_mmu.o := $(nostackp) · 12 unmodified lines
13obj-y := enlighten.o setup.o multicalls.o mmu.o irq.o \13obj-y := enlighten.o setup.o multicalls.o mmu.o irq.o \
14 time.o xen-asm.o xen-asm_$(BITS).o \14 time.o xen-asm.o xen-asm_$(BITS).o \
15 grant-table.o suspend.o platform-pci-unplug.o \15 grant-table.o suspend.o platform-pci-unplug.o \
16 p2m.o16 p2m.o apic.o
17 17
18obj-$(CONFIG_EVENT_TRACING) += trace.o18obj-$(CONFIG_EVENT_TRACING) += trace.o
19 19
20obj-$(CONFIG_SMP) += smp.o20obj-$(CONFIG_SMP) += smp.o
21obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o21obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o
22obj-$(CONFIG_XEN_DEBUG_FS) += debugfs.o22obj-$(CONFIG_XEN_DEBUG_FS) += debugfs.o
23obj-$(CONFIG_XEN_DOM0) += apic.o vga.o23obj-$(CONFIG_XEN_DOM0) += vga.o
24obj-$(CONFIG_SWIOTLB_XEN) += pci-swiotlb-xen.o24obj-$(CONFIG_SWIOTLB_XEN) += pci-swiotlb-xen.o
25obj-$(CONFIG_XEN_EFI) += efi.o25obj-$(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
483 pte_t pte;483 pte_t pte;
484 unsigned long pfn;484 unsigned long pfn;
485 struct page *page;485 struct page *page;
486 unsigned char dummy;
486 487
487 ptep = lookup_address((unsigned long)v, &level);488 ptep = lookup_address((unsigned long)v, &level);
488 BUG_ON(ptep == NULL);489 BUG_ON(ptep == NULL);
@@ -492,6 +493,32 @@ static void set_aliased_prot(void *v, pgprot_t prot) · 3 unmodified lines
492 493
493 pte = pfn_pte(pfn, prot);494 pte = pfn_pte(pfn, prot);
494 495
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
495 if (HYPERVISOR_update_va_mapping((unsigned long)v, pte, 0))522 if (HYPERVISOR_update_va_mapping((unsigned long)v, pte, 0))
496 BUG();523 BUG();
497 524
@@ -503,6 +530,8 @@ static void set_aliased_prot(void *v, pgprot_t prot) · 5 unmodified lines
503 BUG();530 BUG();
504 } else531 } else
505 kmap_flush_unused();532 kmap_flush_unused();
533
534 preempt_enable();
506}535}
507 536
508static void xen_alloc_ldt(struct desc_struct *ldt, unsigned entries)537static 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
510 const unsigned entries_per_page = PAGE_SIZE / LDT_ENTRY_SIZE;539 const unsigned entries_per_page = PAGE_SIZE / LDT_ENTRY_SIZE;
511 int i;540 int i;
512 541
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
513 for(i = 0; i < entries; i += entries_per_page)553 for(i = 0; i < entries; i += entries_per_page)
514 set_aliased_prot(ldt + i, PAGE_KERNEL_RO);554 set_aliased_prot(ldt + i, PAGE_KERNEL_RO);
515}555}
arch/x86/xen/xen-ops.h+2−4
@@ -101,17 +101,15 @@ struct dom0_vga_console_info; · 100 unmodified lines
101 101
102#ifdef CONFIG_XEN_DOM0102#ifdef CONFIG_XEN_DOM0
103void __init xen_init_vga(const struct dom0_vga_console_info *, size_t size);103void __init xen_init_vga(const struct dom0_vga_console_info *, size_t size);
104void __init xen_init_apic(void);
105#else104#else
106static inline void __init xen_init_vga(const struct dom0_vga_console_info *info,105static inline void __init xen_init_vga(const struct dom0_vga_console_info *info,
107 size_t size)106 size_t size)
108{107{
109}108}
110static inline void __init xen_init_apic(void)
111{
112}
113#endif109#endif
114 110
111void __init xen_init_apic(void);
112
115#ifdef CONFIG_XEN_EFI113#ifdef CONFIG_XEN_EFI
116extern void xen_efi_init(void);114extern void xen_efi_init(void);
117#else115#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
296 if (!blk)296 if (!blk)
297 return -ENOMEM;297 return -ENOMEM;
298 298
299 present = krealloc(rbnode->cache_present,299 if (BITS_TO_LONGS(blklen) > BITS_TO_LONGS(rbnode->blklen)) {
300 BITS_TO_LONGS(blklen) * sizeof(*present), GFP_KERNEL);300 present = krealloc(rbnode->cache_present,
301 if (!present) {301 BITS_TO_LONGS(blklen) * sizeof(*present),
302 kfree(blk);302 GFP_KERNEL);
303 return -ENOMEM;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;
304 }313 }
305 314
306 /* insert the register value in the correct place in the rbnode block */315 /* 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
523# define rbd_assert(expr) ((void) 0)523# define rbd_assert(expr) ((void) 0)
524#endif /* !RBD_DEBUG */524#endif /* !RBD_DEBUG */
525 525
526static void rbd_osd_copyup_callback(struct rbd_obj_request *obj_request);
526static int rbd_img_obj_request_submit(struct rbd_obj_request *obj_request);527static int rbd_img_obj_request_submit(struct rbd_obj_request *obj_request);
527static void rbd_img_parent_read(struct rbd_obj_request *obj_request);528static void rbd_img_parent_read(struct rbd_obj_request *obj_request);
528static void rbd_dev_remove_parent(struct rbd_device *rbd_dev);529static 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
1818 obj_request_done_set(obj_request);1819 obj_request_done_set(obj_request);
1819}1820}
1820 1821
1822static 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
1821static void rbd_osd_req_callback(struct ceph_osd_request *osd_req,1832static void rbd_osd_req_callback(struct ceph_osd_request *osd_req,
1822 struct ceph_msg *msg)1833 struct ceph_msg *msg)
1823{1834{
@@ -1866,6 +1877,8 @@ static void rbd_osd_req_callback(struct ceph_osd_request *osd_req, · 42 unmodified lines
1866 rbd_osd_discard_callback(obj_request);1877 rbd_osd_discard_callback(obj_request);
1867 break;1878 break;
1868 case CEPH_OSD_OP_CALL:1879 case CEPH_OSD_OP_CALL:
1880 rbd_osd_call_callback(obj_request);
1881 break;
1869 case CEPH_OSD_OP_NOTIFY_ACK:1882 case CEPH_OSD_OP_NOTIFY_ACK:
1870 case CEPH_OSD_OP_WATCH:1883 case CEPH_OSD_OP_WATCH:
1871 rbd_osd_trivial_callback(obj_request);1884 rbd_osd_trivial_callback(obj_request);
@@ -2530,13 +2543,15 @@ out_unwind: · 658 unmodified lines
2530}2543}
2531 2544
2532static void2545static void
2533rbd_img_obj_copyup_callback(struct rbd_obj_request *obj_request)2546rbd_osd_copyup_callback(struct rbd_obj_request *obj_request)
2534{2547{
2535 struct rbd_img_request *img_request;2548 struct rbd_img_request *img_request;
2536 struct rbd_device *rbd_dev;2549 struct rbd_device *rbd_dev;
2537 struct page **pages;2550 struct page **pages;
2538 u32 page_count;2551 u32 page_count;
2539 2552
2553 dout("%s: obj %p\n", __func__, obj_request);
2554
2540 rbd_assert(obj_request->type == OBJ_REQUEST_BIO ||2555 rbd_assert(obj_request->type == OBJ_REQUEST_BIO ||
2541 obj_request->type == OBJ_REQUEST_NODATA);2556 obj_request->type == OBJ_REQUEST_NODATA);
2542 rbd_assert(obj_request_img_data_test(obj_request));2557 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
2563 if (!obj_request->result)2578 if (!obj_request->result)
2564 obj_request->xferred = obj_request->length;2579 obj_request->xferred = obj_request->length;
2565 2580
2566 /* Finish up with the normal image object callback */2581 obj_request_done_set(obj_request);
2567
2568 rbd_img_obj_callback(obj_request);
2569}2582}
2570 2583
2571static void2584static void
@@ -2650,7 +2663,6 @@ rbd_img_obj_parent_read_full_callback(struct rbd_img_request *img_request) · 78 unmodified lines
2650 2663
2651 /* All set, send it off. */2664 /* All set, send it off. */
2652 2665
2653 orig_request->callback = rbd_img_obj_copyup_callback;
2654 osdc = &rbd_dev->rbd_client->client->osdc;2666 osdc = &rbd_dev->rbd_client->client->osdc;
2655 img_result = rbd_obj_request_submit(osdc, orig_request);2667 img_result = rbd_obj_request_submit(osdc, orig_request);
2656 if (!img_result)2668 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
369 return;369 return;
370 }370 }
371 371
372 if (work_pending(&blkif->persistent_purge_work)) {372 if (work_busy(&blkif->persistent_purge_work)) {
373 pr_alert_ratelimited("Scheduled work from previous purge is still pending, cannot purge list\n");373 pr_alert_ratelimited("Scheduled work from previous purge is still busy, cannot purge list\n");
374 return;374 return;
375 }375 }
376 376
drivers/block/xen-blkfront.c+72−56
@@ -179,6 +179,7 @@ static DEFINE_SPINLOCK(minor_lock); · 178 unmodified lines
179 ((_segs + SEGS_PER_INDIRECT_FRAME - 1)/SEGS_PER_INDIRECT_FRAME)179 ((_segs + SEGS_PER_INDIRECT_FRAME - 1)/SEGS_PER_INDIRECT_FRAME)
180 180
181static int blkfront_setup_indirect(struct blkfront_info *info);181static int blkfront_setup_indirect(struct blkfront_info *info);
182static int blkfront_gather_backend_features(struct blkfront_info *info);
182 183
183static int get_id_from_freelist(struct blkfront_info *info)184static int get_id_from_freelist(struct blkfront_info *info)
184{185{
@@ -1128,8 +1129,10 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, · 943 unmodified lines
1128 * Add the used indirect page back to the list of1129 * Add the used indirect page back to the list of
1129 * available pages for indirect grefs.1130 * available pages for indirect grefs.
1130 */1131 */
1131 indirect_page = pfn_to_page(s->indirect_grants[i]->pfn);1132 if (!info->feature_persistent) {
1132 list_add(&indirect_page->lru, &info->indirect_pages);1133 indirect_page = pfn_to_page(s->indirect_grants[i]->pfn);
1134 list_add(&indirect_page->lru, &info->indirect_pages);
1135 }
1133 s->indirect_grants[i]->gref = GRANT_INVALID_REF;1136 s->indirect_grants[i]->gref = GRANT_INVALID_REF;
1134 list_add_tail(&s->indirect_grants[i]->node, &info->grants);1137 list_add_tail(&s->indirect_grants[i]->node, &info->grants);
1135 }1138 }
@@ -1519,7 +1522,7 @@ static int blkif_recover(struct blkfront_info *info) · 383 unmodified lines
1519 info->shadow_free = info->ring.req_prod_pvt;1522 info->shadow_free = info->ring.req_prod_pvt;
1520 info->shadow[BLK_RING_SIZE(info)-1].req.u.rw.id = 0x0fffffff;1523 info->shadow[BLK_RING_SIZE(info)-1].req.u.rw.id = 0x0fffffff;
1521 1524
1522 rc = blkfront_setup_indirect(info);1525 rc = blkfront_gather_backend_features(info);
1523 if (rc) {1526 if (rc) {
1524 kfree(copy);1527 kfree(copy);
1525 return rc;1528 return rc;
@@ -1720,20 +1723,13 @@ static void blkfront_setup_discard(struct blkfront_info *info) · 194 unmodified lines
1720 1723
1721static int blkfront_setup_indirect(struct blkfront_info *info)1724static int blkfront_setup_indirect(struct blkfront_info *info)
1722{1725{
1723 unsigned int indirect_segments, segs;1726 unsigned int segs;
1724 int err, i;1727 int err, i;
1725 1728
1726 err = xenbus_gather(XBT_NIL, info->xbdev->otherend,1729 if (info->max_indirect_segments == 0)
1727 "feature-max-indirect-segments", "%u", &indirect_segments,
1728 NULL);
1729 if (err) {
1730 info->max_indirect_segments = 0;
1731 segs = BLKIF_MAX_SEGMENTS_PER_REQUEST;1730 segs = BLKIF_MAX_SEGMENTS_PER_REQUEST;
1732 } else {1731 else
1733 info->max_indirect_segments = min(indirect_segments,
1734 xen_blkif_max_segments);
1735 segs = info->max_indirect_segments;1732 segs = info->max_indirect_segments;
1736 }
1737 1733
1738 err = fill_grant_buffer(info, (segs + INDIRECT_GREFS(segs)) * BLK_RING_SIZE(info));1734 err = fill_grant_buffer(info, (segs + INDIRECT_GREFS(segs)) * BLK_RING_SIZE(info));
1739 if (err)1735 if (err)
@@ -1796,6 +1792,68 @@ out_of_memory: · 56 unmodified lines
1796 return -ENOMEM;1792 return -ENOMEM;
1797}1793}
1798 1794
1795/*
1796 * Gather all backend feature-*
1797 */
1798static 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
1799/*1857/*
1800 * Invoked when the backend is finally 'ready' (and has told produced1858 * Invoked when the backend is finally 'ready' (and has told produced
1801 * the details about the physical device - #sectors, size, etc).1859 * the details about the physical device - #sectors, size, etc).
@@ -1807,7 +1865,6 @@ static void blkfront_connect(struct blkfront_info *info) · 5 unmodified lines
1807 unsigned int physical_sector_size;1865 unsigned int physical_sector_size;
1808 unsigned int binfo;1866 unsigned int binfo;
1809 int err;1867 int err;
1810 int barrier, flush, discard, persistent;
1811 1868
1812 switch (info->connected) {1869 switch (info->connected) {
1813 case BLKIF_STATE_CONNECTED:1870 case BLKIF_STATE_CONNECTED:
@@ -1864,48 +1921,7 @@ static void blkfront_connect(struct blkfront_info *info) · 50 unmodified lines
1864 if (err != 1)1921 if (err != 1)
1865 physical_sector_size = sector_size;1922 physical_sector_size = sector_size;
1866 1923
1867 info->feature_flush = 0;1924 err = blkfront_gather_backend_features(info);
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);
1909 if (err) {1925 if (err) {
1910 xenbus_dev_fatal(info->xbdev, err, "setup_indirect at %s",1926 xenbus_dev_fatal(info->xbdev, err, "setup_indirect at %s",
1911 info->xbdev->otherend);1927 info->xbdev->otherend);
drivers/char/hw_random/core.c+1−1
@@ -429,7 +429,7 @@ static int hwrng_fillfn(void *unused) · 428 unmodified lines
429static void start_khwrngd(void)429static void start_khwrngd(void)
430{430{
431 hwrng_fill = kthread_run(hwrng_fillfn, NULL, "hwrng");431 hwrng_fill = kthread_run(hwrng_fillfn, NULL, "hwrng");
432 if (hwrng_fill == ERR_PTR(-ENOMEM)) {432 if (IS_ERR(hwrng_fill)) {
433 pr_err("hwrng_fill thread creation failed");433 pr_err("hwrng_fill thread creation failed");
434 hwrng_fill = NULL;434 hwrng_fill = NULL;
435 }435 }
drivers/cpufreq/loongson2_cpufreq.c+1−1
@@ -20,7 +20,7 @@ · 19 unmodified lines
20#include <asm/clock.h>20#include <asm/clock.h>
21#include <asm/idle.h>21#include <asm/idle.h>
22 22
23#include <asm/mach-loongson/loongson.h>23#include <asm/mach-loongson64/loongson.h>
24 24
25static uint nowait;25static uint nowait;
26 26
drivers/crypto/ixp4xx_crypto.c+0−1
@@ -905,7 +905,6 @@ static int ablk_perform(struct ablkcipher_request *req, int encrypt) · 904 unmodified lines
905 crypt->mode |= NPE_OP_NOT_IN_PLACE;905 crypt->mode |= NPE_OP_NOT_IN_PLACE;
906 /* This was never tested by Intel906 /* This was never tested by Intel
907 * for more than one dst buffer, I think. */907 * for more than one dst buffer, I think. */
908 BUG_ON(req->dst->length < nbytes);
909 req_ctx->dst = NULL;908 req_ctx->dst = NULL;
910 if (!chainup_buffers(dev, req->dst, nbytes, &dst_hook,909 if (!chainup_buffers(dev, req->dst, nbytes, &dst_hook,
911 flags, DMA_FROM_DEVICE))910 flags, DMA_FROM_DEVICE))
drivers/crypto/qat/qat_common/qat_algs.c+16−8
@@ -73,7 +73,8 @@ · 72 unmodified lines
73 ICP_QAT_HW_CIPHER_KEY_CONVERT, \73 ICP_QAT_HW_CIPHER_KEY_CONVERT, \
74 ICP_QAT_HW_CIPHER_DECRYPT)74 ICP_QAT_HW_CIPHER_DECRYPT)
75 75
76static atomic_t active_dev;76static DEFINE_MUTEX(algs_lock);
77static unsigned int active_devs;
77 78
78struct qat_alg_buf {79struct qat_alg_buf {
79 uint32_t len;80 uint32_t len;
@@ -1280,7 +1281,10 @@ static struct crypto_alg qat_algs[] = { { · 1200 unmodified lines
1280 1281
1281int qat_algs_register(void)1282int qat_algs_register(void)
1282{1283{
1283 if (atomic_add_return(1, &active_dev) == 1) {1284 int ret = 0;
1285
1286 mutex_lock(&algs_lock);
1287 if (++active_devs == 1) {
1284 int i;1288 int i;
1285 1289
1286 for (i = 0; i < ARRAY_SIZE(qat_algs); i++)1290 for (i = 0; i < ARRAY_SIZE(qat_algs); i++)
@@ -1289,21 +1293,25 @@ int qat_algs_register(void) · 2 unmodified lines
1289 CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC :1293 CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC :
1290 CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC;1294 CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC;
1291 1295
1292 return crypto_register_algs(qat_algs, ARRAY_SIZE(qat_algs));1296 ret = crypto_register_algs(qat_algs, ARRAY_SIZE(qat_algs));
1293 }1297 }
1294 return 0;1298 mutex_unlock(&algs_lock);
1299 return ret;
1295}1300}
1296 1301
1297int qat_algs_unregister(void)1302int qat_algs_unregister(void)
1298{1303{
1299 if (atomic_sub_return(1, &active_dev) == 0)1304 int ret = 0;
1300 return crypto_unregister_algs(qat_algs, ARRAY_SIZE(qat_algs));1305
1301 return 0;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;
1302}1311}
1303 1312
1304int qat_algs_init(void)1313int qat_algs_init(void)
1305{1314{
1306 atomic_set(&active_dev, 0);
1307 crypto_get_default_rng();1315 crypto_get_default_rng();
1308 return 0;1316 return 0;
1309}1317}
drivers/dma/at_hdmac.c+87−45
@@ -48,6 +48,8 @@ · 47 unmodified lines
48 BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) |\48 BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) |\
49 BIT(DMA_SLAVE_BUSWIDTH_4_BYTES))49 BIT(DMA_SLAVE_BUSWIDTH_4_BYTES))
50 50
51#define ATC_MAX_DSCR_TRIALS 10
52
51/*53/*
52 * Initial number of descriptors to allocate for each channel. This could54 * Initial number of descriptors to allocate for each channel. This could
53 * be increased during dma usage.55 * 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
285 *287 *
286 * @current_len: the number of bytes left before reading CTRLA288 * @current_len: the number of bytes left before reading CTRLA
287 * @ctrla: the value of CTRLA289 * @ctrla: the value of CTRLA
288 * @desc: the descriptor containing the transfer width
289 */290 */
290static inline int atc_calc_bytes_left(int current_len, u32 ctrla,291static inline int atc_calc_bytes_left(int current_len, u32 ctrla)
291 struct at_desc *desc)
292{292{
293 return current_len - ((ctrla & ATC_BTSIZE_MAX) << desc->tx_width);293 u32 btsize = (ctrla & ATC_BTSIZE_MAX);
294}294 u32 src_width = ATC_REG_TO_SRC_WIDTH(ctrla);
295 295
296/**296 /*
297 * atc_calc_bytes_left_from_reg - calculates the number of bytes left according297 * According to the datasheet, when reading the Control A Register
298 * to the current value of CTRLA.298 * (ctrla), the Buffer Transfer Size (btsize) bitfield refers to the
299 *299 * number of transfers completed on the Source Interface.
300 * @current_len: the number of bytes left before reading CTRLA300 * So btsize is always a number of source width transfers.
301 * @atchan: the channel to read CTRLA for301 */
302 * @desc: the descriptor containing the transfer width302 return current_len - (btsize << src_width);
303 */
304static 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);
310}303}
311 304
312/**305/**
@@ -320,7 +313,7 @@ static int atc_get_bytes_left(struct dma_chan *chan, dma_cookie_t cookie) · 7 unmodified lines
320 struct at_desc *desc_first = atc_first_active(atchan);313 struct at_desc *desc_first = atc_first_active(atchan);
321 struct at_desc *desc;314 struct at_desc *desc;
322 int ret;315 int ret;
323 u32 ctrla, dscr;316 u32 ctrla, dscr, trials;
324 317
325 /*318 /*
326 * If the cookie doesn't match to the currently running transfer then319 * 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
346 * the channel's DSCR register and compare it against the value339 * the channel's DSCR register and compare it against the value
347 * of the hardware linked list structure of each child340 * of the hardware linked list structure of each child
348 * descriptor.341 * 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.
349 */381 */
350 382
351 ctrla = channel_readl(atchan, CTRLA);
352 rmb(); /* ensure CTRLA is read before DSCR */
353 dscr = channel_readl(atchan, DSCR);383 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;
354 414
355 /* for the first descriptor we can be more accurate */415 /* for the first descriptor we can be more accurate */
356 if (desc_first->lli.dscr == dscr)416 if (desc_first->lli.dscr == dscr)
357 return atc_calc_bytes_left(ret, ctrla, desc_first);417 return atc_calc_bytes_left(ret, ctrla);
358 418
359 ret -= desc_first->len;419 ret -= desc_first->len;
360 list_for_each_entry(desc, &desc_first->tx_list, desc_node) {420 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
365 }425 }
366 426
367 /*427 /*
368 * For the last descriptor in the chain we can calculate428 * For the current descriptor in the chain we can calculate
369 * the remaining bytes using the channel's register.429 * the remaining bytes using the channel's register.
370 * Note that the transfer width of the first and last
371 * descriptor may differ.
372 */430 */
373 if (!desc->lli.dscr)431 ret = atc_calc_bytes_left(ret, ctrla);
374 ret = atc_calc_bytes_left_from_reg(ret, atchan, desc);
375 } else {432 } else {
376 /* single transfer */433 /* 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);
378 }436 }
379 437
380 return ret;438 return ret;
@@ -726,7 +784,6 @@ atc_prep_dma_interleaved(struct dma_chan *chan, · 345 unmodified lines
726 784
727 desc->txd.cookie = -EBUSY;785 desc->txd.cookie = -EBUSY;
728 desc->total_len = desc->len = len;786 desc->total_len = desc->len = len;
729 desc->tx_width = dwidth;
730 787
731 /* set end-of-link to the last link descriptor of list*/788 /* set end-of-link to the last link descriptor of list*/
732 set_desc_eol(desc);789 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
804 first->txd.cookie = -EBUSY;861 first->txd.cookie = -EBUSY;
805 first->total_len = len;862 first->total_len = len;
806 863
807 /* set transfer width for the calculation of the residue */
808 first->tx_width = src_width;
809 prev->tx_width = src_width;
810
811 /* set end-of-link to the last link descriptor of list*/864 /* set end-of-link to the last link descriptor of list*/
812 set_desc_eol(desc);865 set_desc_eol(desc);
813 866
@@ -956,10 +1009,6 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, · 142 unmodified lines
956 first->txd.cookie = -EBUSY;1009 first->txd.cookie = -EBUSY;
957 first->total_len = total_len;1010 first->total_len = total_len;
958 1011
959 /* set transfer width for the calculation of the residue */
960 first->tx_width = reg_width;
961 prev->tx_width = reg_width;
962
963 /* first link descriptor of list is responsible of flags */1012 /* first link descriptor of list is responsible of flags */
964 first->txd.flags = flags; /* client is in control of this ack */1013 first->txd.flags = flags; /* client is in control of this ack */
965 1014
@@ -1077,12 +1126,6 @@ atc_prep_dma_sg(struct dma_chan *chan, · 111 unmodified lines
1077 desc->txd.cookie = 0;1126 desc->txd.cookie = 0;
1078 desc->len = len;1127 desc->len = len;
1079 1128
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
1086 atc_desc_chain(&first, &prev, desc);1129 atc_desc_chain(&first, &prev, desc);
1087 1130
1088 /* update the lengths and addresses for the next loop cycle */1131 /* 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
1256 /* First descriptor of the chain embedds additional information */1299 /* First descriptor of the chain embedds additional information */
1257 first->txd.cookie = -EBUSY;1300 first->txd.cookie = -EBUSY;
1258 first->total_len = buf_len;1301 first->total_len = buf_len;
1259 first->tx_width = reg_width;
1260 1302
1261 return &first->txd;1303 return &first->txd;
1262 1304
drivers/dma/at_hdmac_regs.h+1−2
@@ -112,6 +112,7 @@ · 111 unmodified lines
112#define ATC_SRC_WIDTH_BYTE (0x0 << 24)112#define ATC_SRC_WIDTH_BYTE (0x0 << 24)
113#define ATC_SRC_WIDTH_HALFWORD (0x1 << 24)113#define ATC_SRC_WIDTH_HALFWORD (0x1 << 24)
114#define ATC_SRC_WIDTH_WORD (0x2 << 24)114#define ATC_SRC_WIDTH_WORD (0x2 << 24)
115#define ATC_REG_TO_SRC_WIDTH(r) (((r) >> 24) & 0x3)
115#define ATC_DST_WIDTH_MASK (0x3 << 28) /* Destination Single Transfer Size */116#define ATC_DST_WIDTH_MASK (0x3 << 28) /* Destination Single Transfer Size */
116#define ATC_DST_WIDTH(x) ((x) << 28)117#define ATC_DST_WIDTH(x) ((x) << 28)
117#define ATC_DST_WIDTH_BYTE (0x0 << 28)118#define ATC_DST_WIDTH_BYTE (0x0 << 28)
@@ -182,7 +183,6 @@ struct at_lli { · 64 unmodified lines
182 * @txd: support for the async_tx api183 * @txd: support for the async_tx api
183 * @desc_node: node on the channed descriptors list184 * @desc_node: node on the channed descriptors list
184 * @len: descriptor byte count185 * @len: descriptor byte count
185 * @tx_width: transfer width
186 * @total_len: total transaction byte count186 * @total_len: total transaction byte count
187 */187 */
188struct at_desc {188struct at_desc {
@@ -194,7 +194,6 @@ struct at_desc { · 5 unmodified lines
194 struct dma_async_tx_descriptor txd;194 struct dma_async_tx_descriptor txd;
195 struct list_head desc_node;195 struct list_head desc_node;
196 size_t len;196 size_t len;
197 u32 tx_width;
198 size_t total_len;197 size_t total_len;
199 198
200 /* Interleaved data */199 /* 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
359 * descriptor view 2 since some fields of the configuration register359 * descriptor view 2 since some fields of the configuration register
360 * depend on transfer size and src/dest addresses.360 * depend on transfer size and src/dest addresses.
361 */361 */
362 if (at_xdmac_chan_is_cyclic(atchan)) {362 if (at_xdmac_chan_is_cyclic(atchan))
363 reg = AT_XDMAC_CNDC_NDVIEW_NDV1;363 reg = AT_XDMAC_CNDC_NDVIEW_NDV1;
364 at_xdmac_chan_write(atchan, AT_XDMAC_CC, first->lld.mbr_cfg);364 else if (first->lld.mbr_ubc & AT_XDMAC_MBR_UBC_NDV3)
365 } else if (first->lld.mbr_ubc & AT_XDMAC_MBR_UBC_NDV3) {
366 reg = AT_XDMAC_CNDC_NDVIEW_NDV3;365 reg = AT_XDMAC_CNDC_NDVIEW_NDV3;
367 } else {366 else
368 /*
369 * No need to write AT_XDMAC_CC reg, it will be done when the
370 * descriptor is fecthed.
371 */
372 reg = AT_XDMAC_CNDC_NDVIEW_NDV2;367 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);
374 375
375 reg |= AT_XDMAC_CNDC_NDDUP376 reg |= AT_XDMAC_CNDC_NDDUP
376 | AT_XDMAC_CNDC_NDSUP377 | AT_XDMAC_CNDC_NDSUP
@@ -681,15 +682,16 @@ at_xdmac_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, · 304 unmodified lines
681 desc->lld.mbr_sa = mem;682 desc->lld.mbr_sa = mem;
682 desc->lld.mbr_da = atchan->sconfig.dst_addr;683 desc->lld.mbr_da = atchan->sconfig.dst_addr;
683 }684 }
684 desc->lld.mbr_cfg = atchan->cfg;685 dwidth = at_xdmac_get_dwidth(atchan->cfg);
685 dwidth = at_xdmac_get_dwidth(desc->lld.mbr_cfg);
686 fixed_dwidth = IS_ALIGNED(len, 1 << dwidth)686 fixed_dwidth = IS_ALIGNED(len, 1 << dwidth)
687 ? at_xdmac_get_dwidth(desc->lld.mbr_cfg)687 ? dwidth
688 : AT_XDMAC_CC_DWIDTH_BYTE;688 : AT_XDMAC_CC_DWIDTH_BYTE;
689 desc->lld.mbr_ubc = AT_XDMAC_MBR_UBC_NDV2 /* next descriptor view */689 desc->lld.mbr_ubc = AT_XDMAC_MBR_UBC_NDV2 /* next descriptor view */
690 | AT_XDMAC_MBR_UBC_NDEN /* next descriptor dst parameter update */690 | AT_XDMAC_MBR_UBC_NDEN /* next descriptor dst parameter update */
691 | AT_XDMAC_MBR_UBC_NSEN /* next descriptor src parameter update */691 | AT_XDMAC_MBR_UBC_NSEN /* next descriptor src parameter update */
692 | (len >> fixed_dwidth); /* microblock length */692 | (len >> fixed_dwidth); /* microblock length */
693 desc->lld.mbr_cfg = (atchan->cfg & ~AT_XDMAC_CC_DWIDTH_MASK) |
694 AT_XDMAC_CC_DWIDTH(fixed_dwidth);
693 dev_dbg(chan2dev(chan),695 dev_dbg(chan2dev(chan),
694 "%s: lld: mbr_sa=%pad, mbr_da=%pad, mbr_ubc=0x%08x\n",696 "%s: lld: mbr_sa=%pad, mbr_da=%pad, mbr_ubc=0x%08x\n",
695 __func__, &desc->lld.mbr_sa, &desc->lld.mbr_da, desc->lld.mbr_ubc);697 __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
162 config &= ~0x7;162 config &= ~0x7;
163 config |= op_mode;163 config |= op_mode;
164 164
165 if (IS_ENABLED(__BIG_ENDIAN))165#if defined(__BIG_ENDIAN)
166 config |= XOR_DESCRIPTOR_SWAP;166 config |= XOR_DESCRIPTOR_SWAP;
167 else167#else
168 config &= ~XOR_DESCRIPTOR_SWAP;168 config &= ~XOR_DESCRIPTOR_SWAP;
169#endif
169 170
170 writel_relaxed(config, XOR_CONFIG(chan));171 writel_relaxed(config, XOR_CONFIG(chan));
171 chan->current_type = type;172 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
2328 desc->txd.callback = last->txd.callback;2328 desc->txd.callback = last->txd.callback;
2329 desc->txd.callback_param = last->txd.callback_param;2329 desc->txd.callback_param = last->txd.callback_param;
2330 }2330 }
2331 last->last = false;2331 desc->last = false;
2332 2332
2333 dma_cookie_assign(&desc->txd);2333 dma_cookie_assign(&desc->txd);
2334 2334
@@ -2623,6 +2623,7 @@ pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst, · 288 unmodified lines
2623 desc->rqcfg.brst_len = 1;2623 desc->rqcfg.brst_len = 1;
2624 2624
2625 desc->rqcfg.brst_len = get_burst_len(desc, len);2625 desc->rqcfg.brst_len = get_burst_len(desc, len);
2626 desc->bytes_requested = len;
2626 2627
2627 desc->txd.flags = flags;2628 desc->txd.flags = flags;
2628 2629
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
29 spin_lock_irqsave(&vc->lock, flags);29 spin_lock_irqsave(&vc->lock, flags);
30 cookie = dma_cookie_assign(tx);30 cookie = dma_cookie_assign(tx);
31 31
32 list_move_tail(&vd->node, &vc->desc_submitted);32 list_add_tail(&vd->node, &vc->desc_submitted);
33 spin_unlock_irqrestore(&vc->lock, flags);33 spin_unlock_irqrestore(&vc->lock, flags);
34 34
35 dev_dbg(vc->chan.device->dev, "vchan %p: txd %p[%x]: submitted\n",35 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
83 cb_data = vd->tx.callback_param;83 cb_data = vd->tx.callback_param;
84 84
85 list_del(&vd->node);85 list_del(&vd->node);
86 if (async_tx_test_ack(&vd->tx))86
87 list_add(&vd->node, &vc->desc_allocated);87 vc->desc_free(vd);
88 else
89 vc->desc_free(vd);
90 88
91 if (cb)89 if (cb)
92 cb(cb_data);90 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
98 while (!list_empty(head)) {96 while (!list_empty(head)) {
99 struct virt_dma_desc *vd = list_first_entry(head,97 struct virt_dma_desc *vd = list_first_entry(head,
100 struct virt_dma_desc, node);98 struct virt_dma_desc, node);
101 if (async_tx_test_ack(&vd->tx)) {99 list_del(&vd->node);
102 list_move_tail(&vd->node, &vc->desc_allocated);100 dev_dbg(vc->chan.device->dev, "txd %p: freeing\n", vd);
103 } else {101 vc->desc_free(vd);
104 dev_dbg(vc->chan.device->dev, "txd %p: freeing\n", vd);
105 list_del(&vd->node);
106 vc->desc_free(vd);
107 }
108 }102 }
109}103}
110EXPORT_SYMBOL_GPL(vchan_dma_desc_free_list);104EXPORT_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
114 dma_cookie_init(&vc->chan);108 dma_cookie_init(&vc->chan);
115 109
116 spin_lock_init(&vc->lock);110 spin_lock_init(&vc->lock);
117 INIT_LIST_HEAD(&vc->desc_allocated);
118 INIT_LIST_HEAD(&vc->desc_submitted);111 INIT_LIST_HEAD(&vc->desc_submitted);
119 INIT_LIST_HEAD(&vc->desc_issued);112 INIT_LIST_HEAD(&vc->desc_issued);
120 INIT_LIST_HEAD(&vc->desc_completed);113 INIT_LIST_HEAD(&vc->desc_completed);
drivers/dma/virt-dma.h+1−12
@@ -29,7 +29,6 @@ struct virt_dma_chan { · 28 unmodified lines
29 spinlock_t lock;29 spinlock_t lock;
30 30
31 /* protected by vc.lock */31 /* protected by vc.lock */
32 struct list_head desc_allocated;
33 struct list_head desc_submitted;32 struct list_head desc_submitted;
34 struct list_head desc_issued;33 struct list_head desc_issued;
35 struct list_head desc_completed;34 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
56 struct virt_dma_desc *vd, unsigned long tx_flags)55 struct virt_dma_desc *vd, unsigned long tx_flags)
57{56{
58 extern dma_cookie_t vchan_tx_submit(struct dma_async_tx_descriptor *);57 extern dma_cookie_t vchan_tx_submit(struct dma_async_tx_descriptor *);
59 unsigned long flags;
60 58
61 dma_async_tx_descriptor_init(&vd->tx, &vc->chan);59 dma_async_tx_descriptor_init(&vd->tx, &vc->chan);
62 vd->tx.flags = tx_flags;60 vd->tx.flags = tx_flags;
63 vd->tx.tx_submit = vchan_tx_submit;61 vd->tx.tx_submit = vchan_tx_submit;
64 62
65 spin_lock_irqsave(&vc->lock, flags);
66 list_add_tail(&vd->node, &vc->desc_allocated);
67 spin_unlock_irqrestore(&vc->lock, flags);
68
69 return &vd->tx;63 return &vd->tx;
70}64}
71 65
@@ -128,8 +122,7 @@ static inline struct virt_dma_desc *vchan_next_desc(struct virt_dma_chan *vc) · 56 unmodified lines
128}122}
129 123
130/**124/**
131 * vchan_get_all_descriptors - obtain all allocated, submitted and issued125 * vchan_get_all_descriptors - obtain all submitted and issued descriptors
132 * descriptors
133 * vc: virtual channel to get descriptors from126 * vc: virtual channel to get descriptors from
134 * head: list of descriptors found127 * head: list of descriptors found
135 *128 *
@@ -141,7 +134,6 @@ static inline struct virt_dma_desc *vchan_next_desc(struct virt_dma_chan *vc) · 5 unmodified lines
141static inline void vchan_get_all_descriptors(struct virt_dma_chan *vc,134static inline void vchan_get_all_descriptors(struct virt_dma_chan *vc,
142 struct list_head *head)135 struct list_head *head)
143{136{
144 list_splice_tail_init(&vc->desc_allocated, head);
145 list_splice_tail_init(&vc->desc_submitted, head);137 list_splice_tail_init(&vc->desc_submitted, head);
146 list_splice_tail_init(&vc->desc_issued, head);138 list_splice_tail_init(&vc->desc_issued, head);
147 list_splice_tail_init(&vc->desc_completed, head);139 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
149 141
150static inline void vchan_free_chan_resources(struct virt_dma_chan *vc)142static inline void vchan_free_chan_resources(struct virt_dma_chan *vc)
151{143{
152 struct virt_dma_desc *vd;
153 unsigned long flags;144 unsigned long flags;
154 LIST_HEAD(head);145 LIST_HEAD(head);
155 146
156 spin_lock_irqsave(&vc->lock, flags);147 spin_lock_irqsave(&vc->lock, flags);
157 vchan_get_all_descriptors(vc, &head);148 vchan_get_all_descriptors(vc, &head);
158 list_for_each_entry(vd, &head, node)
159 async_tx_clear_ack(&vd->tx);
160 spin_unlock_irqrestore(&vc->lock, flags);149 spin_unlock_irqrestore(&vc->lock, flags);
161 150
162 vchan_dma_desc_free_list(vc, &head);151 vchan_dma_desc_free_list(vc, &head);
drivers/dma/xgene-dma.c+3−0
@@ -111,6 +111,7 @@ · 110 unmodified lines
111#define XGENE_DMA_MEM_RAM_SHUTDOWN 0xD070111#define XGENE_DMA_MEM_RAM_SHUTDOWN 0xD070
112#define XGENE_DMA_BLK_MEM_RDY 0xD074112#define XGENE_DMA_BLK_MEM_RDY 0xD074
113#define XGENE_DMA_BLK_MEM_RDY_VAL 0xFFFFFFFF113#define XGENE_DMA_BLK_MEM_RDY_VAL 0xFFFFFFFF
114#define XGENE_DMA_RING_CMD_SM_OFFSET 0x8000
114 115
115/* X-Gene SoC EFUSE csr register and bit defination */116/* X-Gene SoC EFUSE csr register and bit defination */
116#define XGENE_SOC_JTAG1_SHADOW 0x18117#define XGENE_SOC_JTAG1_SHADOW 0x18
@@ -1887,6 +1888,8 @@ static int xgene_dma_get_resources(struct platform_device *pdev, · 1770 unmodified lines
1887 return -ENOMEM;1888 return -ENOMEM;
1888 }1889 }
1889 1890
1891 pdma->csr_ring_cmd += XGENE_DMA_RING_CMD_SM_OFFSET;
1892
1890 /* Get efuse csr region */1893 /* Get efuse csr region */
1891 res = platform_get_resource(pdev, IORESOURCE_MEM, 3);1894 res = platform_get_resource(pdev, IORESOURCE_MEM, 3);
1892 if (!res) {1895 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
920 */920 */
921 921
922 for (row = 0; row < mci->nr_csrows; row++) {922 for (row = 0; row < mci->nr_csrows; row++) {
923 struct csrow_info *csi = &mci->csrows[row];923 struct csrow_info *csi = mci->csrows[row];
924 924
925 /*925 /*
926 * Get the configuration settings for this926 * 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
200 status = devm_extcon_dev_register(&pdev->dev, palmas_usb->edev);200 status = devm_extcon_dev_register(&pdev->dev, palmas_usb->edev);
201 if (status) {201 if (status) {
202 dev_err(&pdev->dev, "failed to register extcon device\n");202 dev_err(&pdev->dev, "failed to register extcon device\n");
203 kfree(palmas_usb->edev->name);
204 return status;203 return status;
205 }204 }
206 205
@@ -214,7 +213,6 @@ static int palmas_usb_probe(struct platform_device *pdev) · 7 unmodified lines
214 if (status < 0) {213 if (status < 0) {
215 dev_err(&pdev->dev, "can't get IRQ %d, err %d\n",214 dev_err(&pdev->dev, "can't get IRQ %d, err %d\n",
216 palmas_usb->id_irq, status);215 palmas_usb->id_irq, status);
217 kfree(palmas_usb->edev->name);
218 return status;216 return status;
219 }217 }
220 }218 }
@@ -229,7 +227,6 @@ static int palmas_usb_probe(struct platform_device *pdev) · 8 unmodified lines
229 if (status < 0) {227 if (status < 0) {
230 dev_err(&pdev->dev, "can't get IRQ %d, err %d\n",228 dev_err(&pdev->dev, "can't get IRQ %d, err %d\n",
231 palmas_usb->vbus_irq, status);229 palmas_usb->vbus_irq, status);
232 kfree(palmas_usb->edev->name);
233 return status;230 return status;
234 }231 }
235 }232 }
@@ -239,15 +236,6 @@ static int palmas_usb_probe(struct platform_device *pdev) · 3 unmodified lines
239 return 0;236 return 0;
240}237}
241 238
242static 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
251#ifdef CONFIG_PM_SLEEP239#ifdef CONFIG_PM_SLEEP
252static int palmas_usb_suspend(struct device *dev)240static int palmas_usb_suspend(struct device *dev)
253{241{
@@ -288,7 +276,6 @@ static const struct of_device_id of_palmas_match_tbl[] = { · 34 unmodified lines
288 276
289static struct platform_driver palmas_usb_driver = {277static struct platform_driver palmas_usb_driver = {
290 .probe = palmas_usb_probe,278 .probe = palmas_usb_probe,
291 .remove = palmas_usb_remove,
292 .driver = {279 .driver = {
293 .name = "palmas-usb",280 .name = "palmas-usb",
294 .of_match_table = of_palmas_match_tbl,281 .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
124 return -EINVAL;124 return -EINVAL;
125}125}
126 126
127static int find_cable_index_by_name(struct extcon_dev *edev, const char *name)127static int find_cable_id_by_name(struct extcon_dev *edev, const char *name)
128{128{
129 unsigned int id = EXTCON_NONE;129 unsigned int id = -EINVAL;
130 int i = 0;130 int i = 0;
131 131
132 if (edev->max_supported == 0)132 /* Find the id of extcon cable */
133 return -EINVAL;
134
135 /* Find the the number of extcon cable */
136 while (extcon_name[i]) {133 while (extcon_name[i]) {
137 if (!strncmp(extcon_name[i], name, CABLE_NAME_MAX)) {134 if (!strncmp(extcon_name[i], name, CABLE_NAME_MAX)) {
138 id = i;135 id = i;
139 break;136 break;
140 }137 }
138 i++;
141 }139 }
142 140
143 if (id == EXTCON_NONE)141 return id;
142}
143
144static 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)
144 return -EINVAL;149 return -EINVAL;
145 150
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
146 return find_cable_index_by_id(edev, id);156 return find_cable_index_by_id(edev, id);
147}157}
148 158
@@ -228,9 +238,11 @@ static ssize_t cable_state_show(struct device *dev, · 79 unmodified lines
228 struct extcon_cable *cable = container_of(attr, struct extcon_cable,238 struct extcon_cable *cable = container_of(attr, struct extcon_cable,
229 attr_state);239 attr_state);
230 240
241 int i = cable->cable_index;
242
231 return sprintf(buf, "%d\n",243 return sprintf(buf, "%d\n",
232 extcon_get_cable_state_(cable->edev,244 extcon_get_cable_state_(cable->edev,
233 cable->cable_index));245 cable->edev->supported_cable[i]));
234}246}
235 247
236/**248/**
@@ -263,20 +275,25 @@ int extcon_update_state(struct extcon_dev *edev, u32 mask, u32 state) · 26 unmodified lines
263 spin_lock_irqsave(&edev->lock, flags);275 spin_lock_irqsave(&edev->lock, flags);
264 276
265 if (edev->state != ((edev->state & ~mask) | (state & mask))) {277 if (edev->state != ((edev->state & ~mask) | (state & mask))) {
278 u32 old_state;
279
266 if (check_mutually_exclusive(edev, (edev->state & ~mask) |280 if (check_mutually_exclusive(edev, (edev->state & ~mask) |
267 (state & mask))) {281 (state & mask))) {
268 spin_unlock_irqrestore(&edev->lock, flags);282 spin_unlock_irqrestore(&edev->lock, flags);
269 return -EPERM;283 return -EPERM;
270 }284 }
271 285
272 for (index = 0; index < edev->max_supported; index++) {286 old_state = edev->state;
273 if (is_extcon_changed(edev->state, state, index, &attached))
274 raw_notifier_call_chain(&edev->nh[index], attached, edev);
275 }
276
277 edev->state &= ~mask;287 edev->state &= ~mask;
278 edev->state |= state & mask;288 edev->state |= state & mask;
279 289
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
280 /* This could be in interrupt handler */297 /* This could be in interrupt handler */
281 prop_buf = (char *)get_zeroed_page(GFP_ATOMIC);298 prop_buf = (char *)get_zeroed_page(GFP_ATOMIC);
282 if (prop_buf) {299 if (prop_buf) {
@@ -361,8 +378,13 @@ EXPORT_SYMBOL_GPL(extcon_get_cable_state_); · 78 unmodified lines
361 */378 */
362int extcon_get_cable_state(struct extcon_dev *edev, const char *cable_name)379int extcon_get_cable_state(struct extcon_dev *edev, const char *cable_name)
363{380{
364 return extcon_get_cable_state_(edev, find_cable_index_by_name381 unsigned int id;
365 (edev, cable_name));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);
366}388}
367EXPORT_SYMBOL_GPL(extcon_get_cable_state);389EXPORT_SYMBOL_GPL(extcon_get_cable_state);
368 390
@@ -404,8 +426,13 @@ EXPORT_SYMBOL_GPL(extcon_set_cable_state_); · 35 unmodified lines
404int extcon_set_cable_state(struct extcon_dev *edev,426int extcon_set_cable_state(struct extcon_dev *edev,
405 const char *cable_name, bool cable_state)427 const char *cable_name, bool cable_state)
406{428{
407 return extcon_set_cable_state_(edev, find_cable_index_by_name429 unsigned int id;
408 (edev, cable_name), cable_state);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);
409}436}
410EXPORT_SYMBOL_GPL(extcon_set_cable_state);437EXPORT_SYMBOL_GPL(extcon_set_cable_state);
411 438
drivers/firmware/efi/efi.c+5−0
@@ -58,6 +58,11 @@ bool efi_runtime_disabled(void) · 57 unmodified lines
58 58
59static int __init parse_efi_cmdline(char *str)59static int __init parse_efi_cmdline(char *str)
60{60{
61 if (!str) {
62 pr_warn("need at least one option\n");
63 return -EINVAL;
64 }
65
61 if (parse_option_str(str, "noruntime"))66 if (parse_option_str(str, "noruntime"))
62 disable_runtime = true;67 disable_runtime = true;
63 68
drivers/gpu/drm/amd/amdgpu/amdgpu.h+4−0
@@ -1130,6 +1130,9 @@ struct amdgpu_gfx { · 1129 unmodified lines
1130 uint32_t me_feature_version;1130 uint32_t me_feature_version;
1131 uint32_t ce_feature_version;1131 uint32_t ce_feature_version;
1132 uint32_t pfp_feature_version;1132 uint32_t pfp_feature_version;
1133 uint32_t rlc_feature_version;
1134 uint32_t mec_feature_version;
1135 uint32_t mec2_feature_version;
1133 struct amdgpu_ring gfx_ring[AMDGPU_MAX_GFX_RINGS];1136 struct amdgpu_ring gfx_ring[AMDGPU_MAX_GFX_RINGS];
1134 unsigned num_gfx_rings;1137 unsigned num_gfx_rings;
1135 struct amdgpu_ring compute_ring[AMDGPU_MAX_COMPUTE_RINGS];1138 struct amdgpu_ring compute_ring[AMDGPU_MAX_COMPUTE_RINGS];
@@ -1639,6 +1642,7 @@ struct amdgpu_sdma { · 503 unmodified lines
1639 /* SDMA firmware */1642 /* SDMA firmware */
1640 const struct firmware *fw;1643 const struct firmware *fw;
1641 uint32_t fw_version;1644 uint32_t fw_version;
1645 uint32_t feature_version;
1642 1646
1643 struct amdgpu_ring ring;1647 struct amdgpu_ring ring;
1644};1648};
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
317 break;317 break;
318 case AMDGPU_INFO_FW_GFX_RLC:318 case AMDGPU_INFO_FW_GFX_RLC:
319 fw_info.ver = adev->gfx.rlc_fw_version;319 fw_info.ver = adev->gfx.rlc_fw_version;
320 fw_info.feature = 0;320 fw_info.feature = adev->gfx.rlc_feature_version;
321 break;321 break;
322 case AMDGPU_INFO_FW_GFX_MEC:322 case AMDGPU_INFO_FW_GFX_MEC:
323 if (info->query_fw.index == 0)323 if (info->query_fw.index == 0) {
324 fw_info.ver = adev->gfx.mec_fw_version;324 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) {
326 fw_info.ver = adev->gfx.mec2_fw_version;327 fw_info.ver = adev->gfx.mec2_fw_version;
327 else328 fw_info.feature = adev->gfx.mec2_feature_version;
329 } else
328 return -EINVAL;330 return -EINVAL;
329 fw_info.feature = 0;
330 break;331 break;
331 case AMDGPU_INFO_FW_SMC:332 case AMDGPU_INFO_FW_SMC:
332 fw_info.ver = adev->pm.fw_version;333 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
336 if (info->query_fw.index >= 2)337 if (info->query_fw.index >= 2)
337 return -EINVAL;338 return -EINVAL;
338 fw_info.ver = adev->sdma[info->query_fw.index].fw_version;339 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;
340 break;341 break;
341 default:342 default:
342 return -EINVAL;343 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
374 unsigned height_in_mb = ALIGN(height / 16, 2);374 unsigned height_in_mb = ALIGN(height / 16, 2);
375 unsigned fs_in_mb = width_in_mb * height_in_mb;375 unsigned fs_in_mb = width_in_mb * height_in_mb;
376 376
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;
378 378
379 image_size = width * height;379 image_size = width * height;
380 image_size += image_size / 2;380 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
466 466
467 num_dpb_buffer = (le32_to_cpu(msg[59]) & 0xff) + 2;467 num_dpb_buffer = (le32_to_cpu(msg[59]) & 0xff) + 2;
468 min_dpb_size = image_size * num_dpb_buffer;468 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;
469 break;471 break;
470 472
471 default:473 default:
@@ -486,6 +488,7 @@ static int amdgpu_uvd_cs_msg_decode(uint32_t *msg, unsigned buf_sizes[]) · 14 unmodified lines
486 488
487 buf_sizes[0x1] = dpb_size;489 buf_sizes[0x1] = dpb_size;
488 buf_sizes[0x2] = image_size;490 buf_sizes[0x2] = image_size;
491 buf_sizes[0x4] = min_ctx_size;
489 return 0;492 return 0;
490}493}
491 494
@@ -628,6 +631,13 @@ static int amdgpu_uvd_cs_pass2(struct amdgpu_uvd_cs_ctx *ctx) · 136 unmodified lines
628 return -EINVAL;631 return -EINVAL;
629 }632 }
630 633
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 }
631 } else if ((cmd != 0x100) && (cmd != 0x204)) {641 } else if ((cmd != 0x100) && (cmd != 0x204)) {
632 DRM_ERROR("invalid UVD command %X!\n", cmd);642 DRM_ERROR("invalid UVD command %X!\n", cmd);
633 return -EINVAL;643 return -EINVAL;
@@ -755,9 +765,10 @@ int amdgpu_uvd_ring_parse_cs(struct amdgpu_cs_parser *parser, uint32_t ib_idx) · 121 unmodified lines
755 struct amdgpu_uvd_cs_ctx ctx = {};765 struct amdgpu_uvd_cs_ctx ctx = {};
756 unsigned buf_sizes[] = {766 unsigned buf_sizes[] = {
757 [0x00000000] = 2048,767 [0x00000000] = 2048,
758 [0x00000001] = 32 * 1024 * 1024,768 [0x00000001] = 0xFFFFFFFF,
759 [0x00000002] = 2048 * 1152 * 3,769 [0x00000002] = 0xFFFFFFFF,
760 [0x00000003] = 2048,770 [0x00000003] = 2048,
771 [0x00000004] = 0xFFFFFFFF,
761 };772 };
762 struct amdgpu_ib *ib = &parser->ibs[ib_idx];773 struct amdgpu_ib *ib = &parser->ibs[ib_idx];
763 int r;774 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
500 amdgpu_ucode_print_sdma_hdr(&hdr->header);500 amdgpu_ucode_print_sdma_hdr(&hdr->header);
501 fw_size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4;501 fw_size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4;
502 adev->sdma[i].fw_version = le32_to_cpu(hdr->header.ucode_version);502 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);
503 fw_data = (const __le32 *)504 fw_data = (const __le32 *)
504 (adev->sdma[i].fw->data + le32_to_cpu(hdr->header.ucode_array_offset_bytes));505 (adev->sdma[i].fw->data + le32_to_cpu(hdr->header.ucode_array_offset_bytes));
505 WREG32(mmSDMA0_UCODE_ADDR + sdma_offsets[i], 0);506 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
3080 mec_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec_fw->data;3080 mec_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec_fw->data;
3081 amdgpu_ucode_print_gfx_hdr(&mec_hdr->header);3081 amdgpu_ucode_print_gfx_hdr(&mec_hdr->header);
3082 adev->gfx.mec_fw_version = le32_to_cpu(mec_hdr->header.ucode_version);3082 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);
3083 3085
3084 gfx_v7_0_cp_compute_enable(adev, false);3086 gfx_v7_0_cp_compute_enable(adev, false);
3085 3087
@@ -3102,6 +3104,8 @@ static int gfx_v7_0_cp_compute_load_microcode(struct amdgpu_device *adev) · 16 unmodified lines
3102 mec2_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec2_fw->data;3104 mec2_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec2_fw->data;
3103 amdgpu_ucode_print_gfx_hdr(&mec2_hdr->header);3105 amdgpu_ucode_print_gfx_hdr(&mec2_hdr->header);
3104 adev->gfx.mec2_fw_version = le32_to_cpu(mec2_hdr->header.ucode_version);3106 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);
3105 3109
3106 /* MEC2 */3110 /* MEC2 */
3107 fw_data = (const __le32 *)3111 fw_data = (const __le32 *)
@@ -4066,6 +4070,8 @@ static int gfx_v7_0_rlc_resume(struct amdgpu_device *adev) · 958 unmodified lines
4066 hdr = (const struct rlc_firmware_header_v1_0 *)adev->gfx.rlc_fw->data;4070 hdr = (const struct rlc_firmware_header_v1_0 *)adev->gfx.rlc_fw->data;
4067 amdgpu_ucode_print_rlc_hdr(&hdr->header);4071 amdgpu_ucode_print_rlc_hdr(&hdr->header);
4068 adev->gfx.rlc_fw_version = le32_to_cpu(hdr->header.ucode_version);4072 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);
4069 4075
4070 gfx_v7_0_rlc_stop(adev);4076 gfx_v7_0_rlc_stop(adev);
4071 4077
@@ -5122,7 +5128,7 @@ static void gfx_v7_0_print_status(void *handle) · 1050 unmodified lines
5122 dev_info(adev->dev, " CP_HPD_EOP_CONTROL=0x%08X\n",5128 dev_info(adev->dev, " CP_HPD_EOP_CONTROL=0x%08X\n",
5123 RREG32(mmCP_HPD_EOP_CONTROL));5129 RREG32(mmCP_HPD_EOP_CONTROL));
5124 5130
5125 for (queue = 0; queue < 8; i++) {5131 for (queue = 0; queue < 8; queue++) {
5126 cik_srbm_select(adev, me, pipe, queue, 0);5132 cik_srbm_select(adev, me, pipe, queue, 0);
5127 dev_info(adev->dev, " queue: %d\n", queue);5133 dev_info(adev->dev, " queue: %d\n", queue);
5128 dev_info(adev->dev, " CP_PQ_WPTR_POLL_CNTL=0x%08X\n",5134 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
587 int err;587 int err;
588 struct amdgpu_firmware_info *info = NULL;588 struct amdgpu_firmware_info *info = NULL;
589 const struct common_firmware_header *header = NULL;589 const struct common_firmware_header *header = NULL;
590 const struct gfx_firmware_header_v1_0 *cp_hdr;
590 591
591 DRM_DEBUG("\n");592 DRM_DEBUG("\n");
592 593
@@ -611,6 +612,9 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) · 18 unmodified lines
611 err = amdgpu_ucode_validate(adev->gfx.pfp_fw);612 err = amdgpu_ucode_validate(adev->gfx.pfp_fw);
612 if (err)613 if (err)
613 goto out;614 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);
614 618
615 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name);619 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name);
616 err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);620 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
619 err = amdgpu_ucode_validate(adev->gfx.me_fw);623 err = amdgpu_ucode_validate(adev->gfx.me_fw);
620 if (err)624 if (err)
621 goto out;625 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);
622 629
623 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name);630 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name);
624 err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev);631 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
627 err = amdgpu_ucode_validate(adev->gfx.ce_fw);634 err = amdgpu_ucode_validate(adev->gfx.ce_fw);
628 if (err)635 if (err)
629 goto out;636 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);
630 640
631 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);641 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
632 err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);642 err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);
633 if (err)643 if (err)
634 goto out;644 goto out;
635 err = amdgpu_ucode_validate(adev->gfx.rlc_fw);645 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);
636 649
637 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);650 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
638 err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);651 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
641 err = amdgpu_ucode_validate(adev->gfx.mec_fw);654 err = amdgpu_ucode_validate(adev->gfx.mec_fw);
642 if (err)655 if (err)
643 goto out;656 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);
644 660
645 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name);661 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name);
646 err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev);662 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
648 err = amdgpu_ucode_validate(adev->gfx.mec2_fw);664 err = amdgpu_ucode_validate(adev->gfx.mec2_fw);
649 if (err)665 if (err)
650 goto out;666 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);
651 } else {673 } else {
652 err = 0;674 err = 0;
653 adev->gfx.mec2_fw = NULL;675 adev->gfx.mec2_fw = NULL;
@@ -1983,6 +2005,7 @@ static void gfx_v8_0_gpu_init(struct amdgpu_device *adev) · 1329 unmodified lines
1983 adev->gfx.config.max_shader_engines = 1;2005 adev->gfx.config.max_shader_engines = 1;
1984 adev->gfx.config.max_tile_pipes = 2;2006 adev->gfx.config.max_tile_pipes = 2;
1985 adev->gfx.config.max_sh_per_se = 1;2007 adev->gfx.config.max_sh_per_se = 1;
2008 adev->gfx.config.max_backends_per_se = 2;
1986 2009
1987 switch (adev->pdev->revision) {2010 switch (adev->pdev->revision) {
1988 case 0xc4:2011 case 0xc4:
@@ -1991,7 +2014,6 @@ static void gfx_v8_0_gpu_init(struct amdgpu_device *adev) · 2 unmodified lines
1991 case 0xcc:2014 case 0xcc:
1992 /* B10 */2015 /* B10 */
1993 adev->gfx.config.max_cu_per_sh = 8;2016 adev->gfx.config.max_cu_per_sh = 8;
1994 adev->gfx.config.max_backends_per_se = 2;
1995 break;2017 break;
1996 case 0xc5:2018 case 0xc5:
1997 case 0x81:2019 case 0x81:
@@ -2000,14 +2022,12 @@ static void gfx_v8_0_gpu_init(struct amdgpu_device *adev) · 2 unmodified lines
2000 case 0xcd:2022 case 0xcd:
2001 /* B8 */2023 /* B8 */
2002 adev->gfx.config.max_cu_per_sh = 6;2024 adev->gfx.config.max_cu_per_sh = 6;
2003 adev->gfx.config.max_backends_per_se = 2;
2004 break;2025 break;
2005 case 0xc6:2026 case 0xc6:
2006 case 0xca:2027 case 0xca:
2007 case 0xce:2028 case 0xce:
2008 /* B6 */2029 /* B6 */
2009 adev->gfx.config.max_cu_per_sh = 6;2030 adev->gfx.config.max_cu_per_sh = 6;
2010 adev->gfx.config.max_backends_per_se = 2;
2011 break;2031 break;
2012 case 0xc7:2032 case 0xc7:
2013 case 0x87:2033 case 0x87:
@@ -2015,7 +2035,6 @@ static void gfx_v8_0_gpu_init(struct amdgpu_device *adev) · 1 unmodified line
2015 default:2035 default:
2016 /* B4 */2036 /* B4 */
2017 adev->gfx.config.max_cu_per_sh = 4;2037 adev->gfx.config.max_cu_per_sh = 4;
2018 adev->gfx.config.max_backends_per_se = 1;
2019 break;2038 break;
2020 }2039 }
2021 2040
@@ -2275,7 +2294,6 @@ static int gfx_v8_0_rlc_load_microcode(struct amdgpu_device *adev) · 253 unmodified lines
2275 2294
2276 hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data;2295 hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data;
2277 amdgpu_ucode_print_rlc_hdr(&hdr->header);2296 amdgpu_ucode_print_rlc_hdr(&hdr->header);
2278 adev->gfx.rlc_fw_version = le32_to_cpu(hdr->header.ucode_version);
2279 2297
2280 fw_data = (const __le32 *)(adev->gfx.rlc_fw->data +2298 fw_data = (const __le32 *)(adev->gfx.rlc_fw->data +
2281 le32_to_cpu(hdr->header.ucode_array_offset_bytes));2299 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
2361 amdgpu_ucode_print_gfx_hdr(&pfp_hdr->header);2379 amdgpu_ucode_print_gfx_hdr(&pfp_hdr->header);
2362 amdgpu_ucode_print_gfx_hdr(&ce_hdr->header);2380 amdgpu_ucode_print_gfx_hdr(&ce_hdr->header);
2363 amdgpu_ucode_print_gfx_hdr(&me_hdr->header);2381 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);
2370 2382
2371 gfx_v8_0_cp_gfx_enable(adev, false);2383 gfx_v8_0_cp_gfx_enable(adev, false);
2372 2384
@@ -2622,7 +2634,6 @@ static int gfx_v8_0_cp_compute_load_microcode(struct amdgpu_device *adev) · 249 unmodified lines
2622 2634
2623 mec_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec_fw->data;2635 mec_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec_fw->data;
2624 amdgpu_ucode_print_gfx_hdr(&mec_hdr->header);2636 amdgpu_ucode_print_gfx_hdr(&mec_hdr->header);
2625 adev->gfx.mec_fw_version = le32_to_cpu(mec_hdr->header.ucode_version);
2626 2637
2627 fw_data = (const __le32 *)2638 fw_data = (const __le32 *)
2628 (adev->gfx.mec_fw->data +2639 (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
2641 2652
2642 mec2_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec2_fw->data;2653 mec2_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec2_fw->data;
2643 amdgpu_ucode_print_gfx_hdr(&mec2_hdr->header);2654 amdgpu_ucode_print_gfx_hdr(&mec2_hdr->header);
2644 adev->gfx.mec2_fw_version = le32_to_cpu(mec2_hdr->header.ucode_version);
2645 2655
2646 fw_data = (const __le32 *)2656 fw_data = (const __le32 *)
2647 (adev->gfx.mec2_fw->data +2657 (adev->gfx.mec2_fw->data +
@@ -3125,7 +3135,7 @@ static int gfx_v8_0_cp_compute_resume(struct amdgpu_device *adev) · 477 unmodified lines
3125 WREG32(mmCP_MEC_DOORBELL_RANGE_LOWER,3135 WREG32(mmCP_MEC_DOORBELL_RANGE_LOWER,
3126 AMDGPU_DOORBELL_KIQ << 2);3136 AMDGPU_DOORBELL_KIQ << 2);
3127 WREG32(mmCP_MEC_DOORBELL_RANGE_UPPER,3137 WREG32(mmCP_MEC_DOORBELL_RANGE_UPPER,
3128 0x7FFFF << 2);3138 AMDGPU_DOORBELL_MEC_RING7 << 2);
3129 }3139 }
3130 tmp = RREG32(mmCP_HQD_PQ_DOORBELL_CONTROL);3140 tmp = RREG32(mmCP_HQD_PQ_DOORBELL_CONTROL);
3131 tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_DOORBELL_CONTROL,3141 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
121 int err, i;121 int err, i;
122 struct amdgpu_firmware_info *info = NULL;122 struct amdgpu_firmware_info *info = NULL;
123 const struct common_firmware_header *header = NULL;123 const struct common_firmware_header *header = NULL;
124 const struct sdma_firmware_header_v1_0 *hdr;
124 125
125 DRM_DEBUG("\n");126 DRM_DEBUG("\n");
126 127
@@ -142,6 +143,9 @@ static int sdma_v2_4_init_microcode(struct amdgpu_device *adev) · 15 unmodified lines
142 err = amdgpu_ucode_validate(adev->sdma[i].fw);143 err = amdgpu_ucode_validate(adev->sdma[i].fw);
143 if (err)144 if (err)
144 goto out;145 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);
145 149
146 if (adev->firmware.smu_load) {150 if (adev->firmware.smu_load) {
147 info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SDMA0 + i];151 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
541 hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma[i].fw->data;545 hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma[i].fw->data;
542 amdgpu_ucode_print_sdma_hdr(&hdr->header);546 amdgpu_ucode_print_sdma_hdr(&hdr->header);
543 fw_size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4;547 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
546 fw_data = (const __le32 *)548 fw_data = (const __le32 *)
547 (adev->sdma[i].fw->data +549 (adev->sdma[i].fw->data +
548 le32_to_cpu(hdr->header.ucode_array_offset_bytes));550 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
159 int err, i;159 int err, i;
160 struct amdgpu_firmware_info *info = NULL;160 struct amdgpu_firmware_info *info = NULL;
161 const struct common_firmware_header *header = NULL;161 const struct common_firmware_header *header = NULL;
162 const struct sdma_firmware_header_v1_0 *hdr;
162 163
163 DRM_DEBUG("\n");164 DRM_DEBUG("\n");
164 165
@@ -183,6 +184,9 @@ static int sdma_v3_0_init_microcode(struct amdgpu_device *adev) · 18 unmodified lines
183 err = amdgpu_ucode_validate(adev->sdma[i].fw);184 err = amdgpu_ucode_validate(adev->sdma[i].fw);
184 if (err)185 if (err)
185 goto out;186 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);
186 190
187 if (adev->firmware.smu_load) {191 if (adev->firmware.smu_load) {
188 info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SDMA0 + i];192 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
630 hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma[i].fw->data;634 hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma[i].fw->data;
631 amdgpu_ucode_print_sdma_hdr(&hdr->header);635 amdgpu_ucode_print_sdma_hdr(&hdr->header);
632 fw_size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4;636 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
635 fw_data = (const __le32 *)637 fw_data = (const __le32 *)
636 (adev->sdma[i].fw->data +638 (adev->sdma[i].fw->data +
637 le32_to_cpu(hdr->header.ucode_array_offset_bytes));639 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
196 }196 }
197 197
198 funcs = connector->helper_private;198 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);
200 205
201 if (!new_encoder) {206 if (!new_encoder) {
202 DRM_DEBUG_ATOMIC("No suitable encoder found for [CONNECTOR:%d:%s]\n",207 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
229 }234 }
230 }235 }
231 236
237 if (WARN_ON(!connector_state->crtc))
238 return -EINVAL;
239
232 connector_state->best_encoder = new_encoder;240 connector_state->best_encoder = new_encoder;
233 idx = drm_crtc_index(connector_state->crtc);241 idx = drm_crtc_index(connector_state->crtc);
234 242
drivers/gpu/drm/drm_dp_mst_topology.c+0−1
@@ -1294,7 +1294,6 @@ retry: · 1293 unmodified lines
1294 goto retry;1294 goto retry;
1295 }1295 }
1296 DRM_DEBUG_KMS("failed to dpcd write %d %d\n", tosend, ret);1296 DRM_DEBUG_KMS("failed to dpcd write %d %d\n", tosend, ret);
1297 WARN(1, "fail\n");
1298 1297
1299 return -EIO;1298 return -EIO;
1300 }1299 }
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
75module_param_named(timestamp_monotonic, drm_timestamp_monotonic, int, 0600);75module_param_named(timestamp_monotonic, drm_timestamp_monotonic, int, 0600);
76 76
77static void store_vblank(struct drm_device *dev, int crtc,77static void store_vblank(struct drm_device *dev, int crtc,
78 unsigned vblank_count_inc,78 u32 vblank_count_inc,
79 struct timeval *t_vblank)79 struct timeval *t_vblank)
80{80{
81 struct drm_vblank_crtc *vblank = &dev->vblank[crtc];81 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
606tda998x_write_if(struct tda998x_priv *priv, uint8_t bit, uint16_t addr,606tda998x_write_if(struct tda998x_priv *priv, uint8_t bit, uint16_t addr,
607 uint8_t *buf, size_t size)607 uint8_t *buf, size_t size)
608{608{
609 buf[PB(0)] = tda998x_cksum(buf, size);
610
611 reg_clear(priv, REG_DIP_IF_FLAGS, bit);609 reg_clear(priv, REG_DIP_IF_FLAGS, bit);
612 reg_write_range(priv, addr, buf, size);610 reg_write_range(priv, addr, buf, size);
613 reg_set(priv, REG_DIP_IF_FLAGS, bit);611 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
627 buf[PB(4)] = p->audio_frame[4];625 buf[PB(4)] = p->audio_frame[4];
628 buf[PB(5)] = p->audio_frame[5] & 0xf8; /* DM_INH + LSV */626 buf[PB(5)] = p->audio_frame[5] & 0xf8; /* DM_INH + LSV */
629 627
628 buf[PB(0)] = tda998x_cksum(buf, sizeof(buf));
629
630 tda998x_write_if(priv, DIP_IF_FLAGS_IF4, REG_IF4_HB0, buf,630 tda998x_write_if(priv, DIP_IF_FLAGS_IF4, REG_IF4_HB0, buf,
631 sizeof(buf));631 sizeof(buf));
632}632}
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
1075 const union child_device_config *p_child;1075 const union child_device_config *p_child;
1076 union child_device_config *child_dev_ptr;1076 union child_device_config *child_dev_ptr;
1077 int i, child_device_num, count;1077 int i, child_device_num, count;
1078 u16 block_size;1078 u8 expected_size;
1079 u16 block_size;
1079 1080
1080 p_defs = find_section(bdb, BDB_GENERAL_DEFINITIONS);1081 p_defs = find_section(bdb, BDB_GENERAL_DEFINITIONS);
1081 if (!p_defs) {1082 if (!p_defs) {
1082 DRM_DEBUG_KMS("No general definition block is found, no devices defined.\n");1083 DRM_DEBUG_KMS("No general definition block is found, no devices defined.\n");
1083 return;1084 return;
1084 }1085 }
1085 if (p_defs->child_dev_size < sizeof(*p_child)) {1086 if (bdb->version < 195) {
1086 DRM_ERROR("General definiton block child device size is too small.\n");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);
1087 return;1106 return;
1088 }1107 }
1089 /* get the block size of general definitions */1108 /* get the block size of general definitions */
@@ -1130,7 +1149,7 @@ parse_device_mapping(struct drm_i915_private *dev_priv, · 40 unmodified lines
1130 1149
1131 child_dev_ptr = dev_priv->vbt.child_dev + count;1150 child_dev_ptr = dev_priv->vbt.child_dev + count;
1132 count++;1151 count++;
1133 memcpy(child_dev_ptr, p_child, sizeof(*p_child));1152 memcpy(child_dev_ptr, p_child, p_defs->child_dev_size);
1134 }1153 }
1135 return;1154 return;
1136}1155}
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
357 return MODE_OK;357 return MODE_OK;
358}358}
359 359
360static 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
360static struct drm_encoder *intel_mst_best_encoder(struct drm_connector *connector)370static struct drm_encoder *intel_mst_best_encoder(struct drm_connector *connector)
361{371{
362 struct intel_connector *intel_connector = to_intel_connector(connector);372 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
367static const struct drm_connector_helper_funcs intel_dp_mst_connector_helper_funcs = {377static const struct drm_connector_helper_funcs intel_dp_mst_connector_helper_funcs = {
368 .get_modes = intel_dp_mst_get_modes,378 .get_modes = intel_dp_mst_get_modes,
369 .mode_valid = intel_dp_mst_mode_valid,379 .mode_valid = intel_dp_mst_mode_valid,
380 .atomic_best_encoder = intel_mst_atomic_best_encoder,
370 .best_encoder = intel_mst_best_encoder,381 .best_encoder = intel_mst_best_encoder,
371};382};
372 383
drivers/hid/hid-input.c+5−2
@@ -462,12 +462,15 @@ out: · 461 unmodified lines
462 462
463static void hidinput_cleanup_battery(struct hid_device *dev)463static void hidinput_cleanup_battery(struct hid_device *dev)
464{464{
465 const struct power_supply_desc *psy_desc;
466
465 if (!dev->battery)467 if (!dev->battery)
466 return;468 return;
467 469
470 psy_desc = dev->battery->desc;
468 power_supply_unregister(dev->battery);471 power_supply_unregister(dev->battery);
469 kfree(dev->battery->desc->name);472 kfree(psy_desc->name);
470 kfree(dev->battery->desc);473 kfree(psy_desc);
471 dev->battery = NULL;474 dev->battery = NULL;
472}475}
473#else /* !CONFIG_HID_BATTERY_STRENGTH */476#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
858 for (p = drvdata->rdesc;858 for (p = drvdata->rdesc;
859 p <= drvdata->rdesc + drvdata->rsize - 4;) {859 p <= drvdata->rdesc + drvdata->rsize - 4;) {
860 if (p[0] == 0xFE && p[1] == 0xED && p[2] == 0x1D &&860 if (p[0] == 0xFE && p[1] == 0xED && p[2] == 0x1D &&
861 p[3] < sizeof(params)) {861 p[3] < ARRAY_SIZE(params)) {
862 v = params[p[3]];862 v = params[p[3]];
863 put_unaligned(cpu_to_le32(v), (s32 *)p);863 put_unaligned(cpu_to_le32(v), (s32 *)p);
864 p += 4;864 p += 4;
drivers/hid/wacom_sys.c+37−33
@@ -1284,6 +1284,39 @@ fail_register_pen_input: · 1283 unmodified lines
1284 return error;1284 return error;
1285}1285}
1286 1286
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 */
1292static 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
1302static 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
1287static void wacom_wireless_work(struct work_struct *work)1320static void wacom_wireless_work(struct work_struct *work)
1288{1321{
1289 struct wacom *wacom = container_of(work, struct wacom, work);1322 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
1341 if (wacom_wac1->features.type != INTUOSHT &&1374 if (wacom_wac1->features.type != INTUOSHT &&
1342 wacom_wac1->features.type != BAMBOO_PT)1375 wacom_wac1->features.type != BAMBOO_PT)
1343 wacom_wac1->features.device_type |= WACOM_DEVICETYPE_PAD;1376 wacom_wac1->features.device_type |= WACOM_DEVICETYPE_PAD;
1377 wacom_set_default_phy(&wacom_wac1->features);
1378 wacom_calculate_res(&wacom_wac1->features);
1344 snprintf(wacom_wac1->pen_name, WACOM_NAME_MAX, "%s (WL) Pen",1379 snprintf(wacom_wac1->pen_name, WACOM_NAME_MAX, "%s (WL) Pen",
1345 wacom_wac1->features.name);1380 wacom_wac1->features.name);
1346 snprintf(wacom_wac1->pad_name, WACOM_NAME_MAX, "%s (WL) Pad",1381 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
1359 wacom_wac2->features =1394 wacom_wac2->features =
1360 *((struct wacom_features *)id->driver_data);1395 *((struct wacom_features *)id->driver_data);
1361 wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3;1396 wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3;
1397 wacom_set_default_phy(&wacom_wac2->features);
1362 wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096;1398 wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096;
1399 wacom_calculate_res(&wacom_wac2->features);
1363 snprintf(wacom_wac2->touch_name, WACOM_NAME_MAX,1400 snprintf(wacom_wac2->touch_name, WACOM_NAME_MAX,
1364 "%s (WL) Finger",wacom_wac2->features.name);1401 "%s (WL) Finger",wacom_wac2->features.name);
1365 snprintf(wacom_wac2->pad_name, WACOM_NAME_MAX,1402 snprintf(wacom_wac2->pad_name, WACOM_NAME_MAX,
@@ -1407,39 +1444,6 @@ void wacom_battery_work(struct work_struct *work) · 41 unmodified lines
1407 }1444 }
1408}1445}
1409 1446
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 */
1415static 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
1425static 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
1443static size_t wacom_compute_pktlen(struct hid_device *hdev)1447static size_t wacom_compute_pktlen(struct hid_device *hdev)
1444{1448{
1445 struct hid_report_enum *report_enum;1449 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
929 929
930MODULE_DEVICE_TABLE(dmi, i8k_dmi_table);930MODULE_DEVICE_TABLE(dmi, i8k_dmi_table);
931 931
932static 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
932/*947/*
933 * Probe for the presence of a supported laptop.948 * Probe for the presence of a supported laptop.
934 */949 */
@@ -940,7 +955,8 @@ static int __init i8k_probe(void) · 5 unmodified lines
940 /*955 /*
941 * Get DMI information956 * Get DMI information
942 */957 */
943 if (!dmi_check_system(i8k_dmi_table)) {958 if (!dmi_check_system(i8k_dmi_table) ||
959 dmi_check_system(i8k_blacklist_dmi_table)) {
944 if (!ignore_dmi && !force)960 if (!ignore_dmi && !force)
945 return -ENODEV;961 return -ENODEV;
946 962
drivers/hwmon/g762.c+1−0
@@ -582,6 +582,7 @@ static const struct of_device_id g762_dt_match[] = { · 581 unmodified lines
582 { .compatible = "gmt,g763" },582 { .compatible = "gmt,g763" },
583 { },583 { },
584};584};
585MODULE_DEVICE_TABLE(of, g762_dt_match);
585 586
586/*587/*
587 * Grab clock (a required property), enable it, get (fixed) clock frequency588 * 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
575 {"nct7904", 0},575 {"nct7904", 0},
576 {}576 {}
577};577};
578MODULE_DEVICE_TABLE(i2c, nct7904_id);
578 579
579static struct i2c_driver nct7904_driver = {580static struct i2c_driver nct7904_driver = {
580 .class = I2C_CLASS_HWMON,581 .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
692 692
693 platform_set_drvdata(pdev, iface);693 platform_set_drvdata(pdev, iface);
694 694
695 dev_info(&pdev->dev, "Blackfin BF5xx on-chip I2C TWI Contoller, "695 dev_info(&pdev->dev, "Blackfin BF5xx on-chip I2C TWI Controller, "
696 "regs_base@%p\n", iface->regs_base);696 "regs_base@%p\n", iface->regs_base);
697 697
698 return 0;698 return 0;
@@ -735,6 +735,6 @@ subsys_initcall(i2c_bfin_twi_init); · 36 unmodified lines
735module_exit(i2c_bfin_twi_exit);735module_exit(i2c_bfin_twi_exit);
736 736
737MODULE_AUTHOR("Bryan Wu, Sonic Zhang");737MODULE_AUTHOR("Bryan Wu, Sonic Zhang");
738MODULE_DESCRIPTION("Blackfin BF5xx on-chip I2C TWI Contoller Driver");738MODULE_DESCRIPTION("Blackfin BF5xx on-chip I2C TWI Controller Driver");
739MODULE_LICENSE("GPL");739MODULE_LICENSE("GPL");
740MODULE_ALIAS("platform:i2c-bfin-twi");740MODULE_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
1247 u32 reg;1247 u32 reg;
1248 1248
1249 reg = omap_i2c_read_reg(dev, OMAP_I2C_SYSTEST_REG);1249 reg = omap_i2c_read_reg(dev, OMAP_I2C_SYSTEST_REG);
1250 /* enable test mode */
1250 reg |= OMAP_I2C_SYSTEST_ST_EN;1251 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;
1251 omap_i2c_write_reg(dev, OMAP_I2C_SYSTEST_REG, reg);1258 omap_i2c_write_reg(dev, OMAP_I2C_SYSTEST_REG, reg);
1252}1259}
1253 1260
@@ -1257,7 +1264,11 @@ static void omap_i2c_unprepare_recovery(struct i2c_adapter *adap) · 3 unmodified lines
1257 u32 reg;1264 u32 reg;
1258 1265
1259 reg = omap_i2c_read_reg(dev, OMAP_I2C_SYSTEST_REG);1266 reg = omap_i2c_read_reg(dev, OMAP_I2C_SYSTEST_REG);
1267 /* restore reset values */
1260 reg &= ~OMAP_I2C_SYSTEST_ST_EN;1268 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;
1261 omap_i2c_write_reg(dev, OMAP_I2C_SYSTEST_REG, reg);1272 omap_i2c_write_reg(dev, OMAP_I2C_SYSTEST_REG, reg);
1262}1273}
1263 1274
drivers/i2c/i2c-core.c+17−7
@@ -567,6 +567,9 @@ static int i2c_generic_recovery(struct i2c_adapter *adap) · 566 unmodified lines
567 if (bri->prepare_recovery)567 if (bri->prepare_recovery)
568 bri->prepare_recovery(adap);568 bri->prepare_recovery(adap);
569 569
570 bri->set_scl(adap, val);
571 ndelay(RECOVERY_NDELAY);
572
570 /*573 /*
571 * By this time SCL is high, as we need to give 9 falling-rising edges574 * By this time SCL is high, as we need to give 9 falling-rising edges
572 */575 */
@@ -597,7 +600,6 @@ static int i2c_generic_recovery(struct i2c_adapter *adap) · 24 unmodified lines
597 600
598int i2c_generic_scl_recovery(struct i2c_adapter *adap)601int i2c_generic_scl_recovery(struct i2c_adapter *adap)
599{602{
600 adap->bus_recovery_info->set_scl(adap, 1);
601 return i2c_generic_recovery(adap);603 return i2c_generic_recovery(adap);
602}604}
603EXPORT_SYMBOL_GPL(i2c_generic_scl_recovery);605EXPORT_SYMBOL_GPL(i2c_generic_scl_recovery);
@@ -1338,13 +1340,17 @@ static int of_dev_node_match(struct device *dev, void *data) · 734 unmodified lines
1338struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)1340struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
1339{1341{
1340 struct device *dev;1342 struct device *dev;
1343 struct i2c_client *client;
1341 1344
1342 dev = bus_find_device(&i2c_bus_type, NULL, node,1345 dev = bus_find_device(&i2c_bus_type, NULL, node, of_dev_node_match);
1343 of_dev_node_match);
1344 if (!dev)1346 if (!dev)
1345 return NULL;1347 return NULL;
1346 1348
1347 return i2c_verify_client(dev);1349 client = i2c_verify_client(dev);
1350 if (!client)
1351 put_device(dev);
1352
1353 return client;
1348}1354}
1349EXPORT_SYMBOL(of_find_i2c_device_by_node);1355EXPORT_SYMBOL(of_find_i2c_device_by_node);
1350 1356
@@ -1352,13 +1358,17 @@ EXPORT_SYMBOL(of_find_i2c_device_by_node); · 1 unmodified line
1352struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node)1358struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node)
1353{1359{
1354 struct device *dev;1360 struct device *dev;
1361 struct i2c_adapter *adapter;
1355 1362
1356 dev = bus_find_device(&i2c_bus_type, NULL, node,1363 dev = bus_find_device(&i2c_bus_type, NULL, node, of_dev_node_match);
1357 of_dev_node_match);
1358 if (!dev)1364 if (!dev)
1359 return NULL;1365 return NULL;
1360 1366
1361 return i2c_verify_adapter(dev);1367 adapter = i2c_verify_adapter(dev);
1368 if (!adapter)
1369 put_device(dev);
1370
1371 return adapter;
1362}1372}
1363EXPORT_SYMBOL(of_find_i2c_adapter_by_node);1373EXPORT_SYMBOL(of_find_i2c_adapter_by_node);
1364#else1374#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
80 struct eeprom_data *eeprom;80 struct eeprom_data *eeprom;
81 unsigned long flags;81 unsigned long flags;
82 82
83 if (off + count > attr->size)
84 return -EFBIG;
85
86 eeprom = dev_get_drvdata(container_of(kobj, struct device, kobj));83 eeprom = dev_get_drvdata(container_of(kobj, struct device, kobj));
87 84
88 spin_lock_irqsave(&eeprom->buffer_lock, flags);85 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
98 struct eeprom_data *eeprom;95 struct eeprom_data *eeprom;
99 unsigned long flags;96 unsigned long flags;
100 97
101 if (off + count > attr->size)
102 return -EFBIG;
103
104 eeprom = dev_get_drvdata(container_of(kobj, struct device, kobj));98 eeprom = dev_get_drvdata(container_of(kobj, struct device, kobj));
105 99
106 spin_lock_irqsave(&eeprom->buffer_lock, flags);100 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
196 if (n_buttons[i] < 1)196 if (n_buttons[i] < 1)
197 continue;197 continue;
198 198
199 if (n_buttons[i] > 6) {199 if (n_buttons[i] > ARRAY_SIZE(tgfx_buttons)) {
200 printk(KERN_ERR "turbografx.c: Invalid number of buttons %d\n", n_buttons[i]);200 printk(KERN_ERR "turbografx.c: Invalid number of buttons %d\n", n_buttons[i]);
201 err = -EINVAL;201 err = -EINVAL;
202 goto err_unreg_devs;202 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
292MODULE_DESCRIPTION("axp20x Power Button");292MODULE_DESCRIPTION("axp20x Power Button");
293MODULE_AUTHOR("Carlo Caione <carlo@caione.org>");293MODULE_AUTHOR("Carlo Caione <carlo@caione.org>");
294MODULE_LICENSE("GPL");294MODULE_LICENSE("GPL");
295MODULE_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
183 if (pdata && pdata->coexist)183 if (pdata && pdata->coexist)
184 return true;184 return true;
185 185
186 if (of_find_node_by_name(node, "codec")) {186 node = of_find_node_by_name(node, "codec");
187 if (node) {
187 of_node_put(node);188 of_node_put(node);
188 return true;189 return true;
189 }190 }
drivers/input/mouse/alps.c+6−2
@@ -20,6 +20,7 @@ · 19 unmodified lines
20#include <linux/input/mt.h>20#include <linux/input/mt.h>
21#include <linux/serio.h>21#include <linux/serio.h>
22#include <linux/libps2.h>22#include <linux/libps2.h>
23#include <linux/dmi.h>
23 24
24#include "psmouse.h"25#include "psmouse.h"
25#include "alps.h"26#include "alps.h"
@@ -99,6 +100,7 @@ static const struct alps_nibble_commands alps_v6_nibble_commands[] = { · 73 unmodified lines
99#define ALPS_FOUR_BUTTONS 0x40 /* 4 direction button present */100#define ALPS_FOUR_BUTTONS 0x40 /* 4 direction button present */
100#define ALPS_PS2_INTERLEAVED 0x80 /* 3-byte PS/2 packet interleaved with101#define ALPS_PS2_INTERLEAVED 0x80 /* 3-byte PS/2 packet interleaved with
101 6-byte ALPS packet */102 6-byte ALPS packet */
103#define ALPS_DELL 0x100 /* device is a Dell laptop */
102#define ALPS_BUTTONPAD 0x200 /* device is a clickpad */104#define ALPS_BUTTONPAD 0x200 /* device is a clickpad */
103 105
104static const struct alps_model_info alps_model_data[] = {106static 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
251 return;253 return;
252 }254 }
253 255
254 /* Non interleaved V2 dualpoint has separate stick button bits */256 /* Dell non interleaved V2 dualpoint has separate stick button bits */
255 if (priv->proto_version == ALPS_PROTO_V2 &&257 if (priv->proto_version == ALPS_PROTO_V2 &&
256 priv->flags == (ALPS_PASS | ALPS_DUALPOINT)) {258 priv->flags == (ALPS_DELL | ALPS_PASS | ALPS_DUALPOINT)) {
257 left |= packet[0] & 1;259 left |= packet[0] & 1;
258 right |= packet[0] & 2;260 right |= packet[0] & 2;
259 middle |= packet[0] & 4;261 middle |= packet[0] & 4;
@@ -2550,6 +2552,8 @@ static int alps_set_protocol(struct psmouse *psmouse, · 2290 unmodified lines
2550 priv->byte0 = protocol->byte0;2552 priv->byte0 = protocol->byte0;
2551 priv->mask0 = protocol->mask0;2553 priv->mask0 = protocol->mask0;
2552 priv->flags = protocol->flags;2554 priv->flags = protocol->flags;
2555 if (dmi_name_in_vendors("Dell"))
2556 priv->flags |= ALPS_DELL;
2553 2557
2554 priv->x_max = 2000;2558 priv->x_max = 2000;
2555 priv->y_max = 1400;2559 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
783 struct elantech_data *etd = psmouse->private;783 struct elantech_data *etd = psmouse->private;
784 unsigned char *packet = psmouse->packet;784 unsigned char *packet = psmouse->packet;
785 unsigned char packet_type = packet[3] & 0x03;785 unsigned char packet_type = packet[3] & 0x03;
786 unsigned int ic_version;
786 bool sanity_check;787 bool sanity_check;
787 788
788 if (etd->tp_dev && (packet[3] & 0x0f) == 0x06)789 if (etd->tp_dev && (packet[3] & 0x0f) == 0x06)
789 return PACKET_TRACKPOINT;790 return PACKET_TRACKPOINT;
790 791
792 /* This represents the version of IC body. */
793 ic_version = (etd->fw_version & 0x0f0000) >> 16;
794
791 /*795 /*
792 * Sanity check based on the constant bits of a packet.796 * Sanity check based on the constant bits of a packet.
793 * The constant bits change depending on the value of797 * The constant bits change depending on the value of
794 * the hardware flag 'crc_enabled' but are the same for798 * the hardware flag 'crc_enabled' and the version of
795 * every packet, regardless of the type.799 * the IC body, but are the same for every packet,
800 * regardless of the type.
796 */801 */
797 if (etd->crc_enabled)802 if (etd->crc_enabled)
798 sanity_check = ((packet[3] & 0x08) == 0x00);803 sanity_check = ((packet[3] & 0x08) == 0x00);
804 else if (ic_version == 7 && etd->samples[1] == 0x2A)
805 sanity_check = ((packet[3] & 0x1c) == 0x10);
799 else806 else
800 sanity_check = ((packet[0] & 0x0c) == 0x04 &&807 sanity_check = ((packet[0] & 0x0c) == 0x04 &&
801 (packet[3] & 0x1c) == 0x10);808 (packet[3] & 0x1c) == 0x10);
@@ -1116,6 +1123,7 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse, · 314 unmodified lines
1116 * Avatar AVIU-145A2 0x361f00 ? clickpad1123 * Avatar AVIU-145A2 0x361f00 ? clickpad
1117 * Fujitsu LIFEBOOK E544 0x470f00 d0, 12, 09 2 hw buttons1124 * Fujitsu LIFEBOOK E544 0x470f00 d0, 12, 09 2 hw buttons
1118 * Fujitsu LIFEBOOK E554 0x570f01 40, 14, 0c 2 hw buttons1125 * Fujitsu LIFEBOOK E554 0x570f01 40, 14, 0c 2 hw buttons
1126 * Fujitsu T725 0x470f01 05, 12, 09 2 hw buttons
1119 * Fujitsu H730 0x570f00 c0, 14, 0c 3 hw buttons (**)1127 * Fujitsu H730 0x570f00 c0, 14, 0c 3 hw buttons (**)
1120 * Gigabyte U2442 0x450f01 58, 17, 0c 2 hw buttons1128 * Gigabyte U2442 0x450f01 58, 17, 0c 2 hw buttons
1121 * Lenovo L430 0x350f02 b9, 15, 0c 2 hw buttons (*)1129 * Lenovo L430 0x350f02 b9, 15, 0c 2 hw buttons (*)
@@ -1651,6 +1659,16 @@ int elantech_init(struct psmouse *psmouse) · 529 unmodified lines
1651 etd->capabilities[0], etd->capabilities[1],1659 etd->capabilities[0], etd->capabilities[1],
1652 etd->capabilities[2]);1660 etd->capabilities[2]);
1653 1661
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
1654 if (elantech_set_absolute_mode(psmouse)) {1672 if (elantech_set_absolute_mode(psmouse)) {
1655 psmouse_err(psmouse,1673 psmouse_err(psmouse,
1656 "failed to put touchpad into absolute mode.\n");1674 "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
129 unsigned char reg_26;129 unsigned char reg_26;
130 unsigned char debug;130 unsigned char debug;
131 unsigned char capabilities[3];131 unsigned char capabilities[3];
132 unsigned char samples[3];
132 bool paritycheck;133 bool paritycheck;
133 bool jumpy_cursor;134 bool jumpy_cursor;
134 bool reports_pressure;135 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
538 538
539static irqreturn_t ipi_call_interrupt(int irq, void *dev_id)539static irqreturn_t ipi_call_interrupt(int irq, void *dev_id)
540{540{
541 smp_call_function_interrupt();541 generic_smp_call_function_interrupt();
542 542
543 return IRQ_HANDLED;543 return IRQ_HANDLED;
544}544}
drivers/macintosh/ans-lcd.c+1−1
@@ -7,7 +7,7 @@ · 6 unmodified lines
7#include <linux/kernel.h>7#include <linux/kernel.h>
8#include <linux/miscdevice.h>8#include <linux/miscdevice.h>
9#include <linux/fcntl.h>9#include <linux/fcntl.h>
10#include <linux/init.h>10#include <linux/module.h>
11#include <linux/delay.h>11#include <linux/delay.h>
12#include <linux/fs.h>12#include <linux/fs.h>
13 13
drivers/md/dm-cache-policy-mq.c+0−2
@@ -1471,5 +1471,3 @@ module_exit(mq_exit); · 1470 unmodified lines
1471MODULE_AUTHOR("Joe Thornber <dm-devel@redhat.com>");1471MODULE_AUTHOR("Joe Thornber <dm-devel@redhat.com>");
1472MODULE_LICENSE("GPL");1472MODULE_LICENSE("GPL");
1473MODULE_DESCRIPTION("mq cache policy");1473MODULE_DESCRIPTION("mq cache policy");
1474
1475MODULE_ALIAS("dm-cache-default");
drivers/md/dm-cache-policy-smq.c+2−0
@@ -1789,3 +1789,5 @@ module_exit(smq_exit); · 1788 unmodified lines
1789MODULE_AUTHOR("Joe Thornber <dm-devel@redhat.com>");1789MODULE_AUTHOR("Joe Thornber <dm-devel@redhat.com>");
1790MODULE_LICENSE("GPL");1790MODULE_LICENSE("GPL");
1791MODULE_DESCRIPTION("smq cache policy");1791MODULE_DESCRIPTION("smq cache policy");
1792
1793MODULE_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
1293 return r;1293 return r;
1294 1294
1295 disk_super = dm_block_data(copy);1295 disk_super = dm_block_data(copy);
1296 dm_sm_dec_block(pmd->metadata_sm, le64_to_cpu(disk_super->data_mapping_root));1296 dm_btree_del(&pmd->info, le64_to_cpu(disk_super->data_mapping_root));
1297 dm_sm_dec_block(pmd->metadata_sm, le64_to_cpu(disk_super->device_details_root));1297 dm_btree_del(&pmd->details_info, le64_to_cpu(disk_super->device_details_root));
1298 dm_sm_dec_block(pmd->metadata_sm, held_root);1298 dm_sm_dec_block(pmd->metadata_sm, held_root);
1299 1299
1300 return dm_tm_unlock(pmd->tm, copy);1300 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
1729 struct mapped_device *md = q->queuedata;1729 struct mapped_device *md = q->queuedata;
1730 struct dm_table *map = dm_get_live_table_fast(md);1730 struct dm_table *map = dm_get_live_table_fast(md);
1731 struct dm_target *ti;1731 struct dm_target *ti;
1732 sector_t max_sectors, max_size = 0;1732 sector_t max_sectors;
1733 int max_size = 0;
1733 1734
1734 if (unlikely(!map))1735 if (unlikely(!map))
1735 goto out;1736 goto out;
@@ -1742,18 +1743,10 @@ static int dm_merge_bvec(struct request_queue *q, · 6 unmodified lines
1742 * Find maximum amount of I/O that won't need splitting1743 * Find maximum amount of I/O that won't need splitting
1743 */1744 */
1744 max_sectors = min(max_io_len(bvm->bi_sector, ti),1745 max_sectors = min(max_io_len(bvm->bi_sector, ti),
1745 (sector_t) queue_max_sectors(q));1746 (sector_t) BIO_MAX_SECTORS);
1746 max_size = (max_sectors << SECTOR_SHIFT) - bvm->bi_size;1747 max_size = (max_sectors << SECTOR_SHIFT) - bvm->bi_size;
1747 1748 if (max_size < 0)
1748 /*1749 max_size = 0;
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;
1757 1750
1758 /*1751 /*
1759 * merge_bvec_fn() returns number of bytes1752 * merge_bvec_fn() returns number of bytes
@@ -1761,13 +1754,13 @@ static int dm_merge_bvec(struct request_queue *q, · 1 unmodified line
1761 * max is precomputed maximal io size1754 * max is precomputed maximal io size
1762 */1755 */
1763 if (max_size && ti->type->merge)1756 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);
1765 /*1758 /*
1766 * If the target doesn't support merge method and some of the devices1759 * 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 the1760 * provided their merge_bvec method (we know this by looking at
1768 * max_hw_sectors that dm_set_device_limits may set), then we can't1761 * queue_max_hw_sectors), then we can't allow bios with multiple vector
1769 * allow bios with multiple vector entries. So always set max_size1762 * entries. So always set max_size to 0, and the code below allows
1770 * to 0, and the code below allows just one page.1763 * just one page.
1771 */1764 */
1772 else if (queue_max_hw_sectors(q) <= PAGE_SIZE >> 9)1765 else if (queue_max_hw_sectors(q) <= PAGE_SIZE >> 9)
1773 max_size = 0;1766 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
5759 char *ptr;5759 char *ptr;
5760 int err;5760 int err;
5761 5761
5762 file = kmalloc(sizeof(*file), GFP_NOIO);5762 file = kzalloc(sizeof(*file), GFP_NOIO);
5763 if (!file)5763 if (!file)
5764 return -ENOMEM;5764 return -ENOMEM;
5765 5765
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
138 138
139extern struct dm_block_validator btree_node_validator;139extern struct dm_block_validator btree_node_validator;
140 140
141/*
142 * Value type for upper levels of multi-level btrees.
143 */
144extern void init_le64_type(struct dm_transaction_manager *tm,
145 struct dm_btree_value_type *vt);
146
141#endif /* DM_BTREE_INTERNAL_H */147#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
544 return r;544 return r;
545}545}
546 546
547static 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
555int dm_btree_remove(struct dm_btree_info *info, dm_block_t root,547int dm_btree_remove(struct dm_btree_info *info, dm_block_t root,
556 uint64_t *keys, dm_block_t *new_root)548 uint64_t *keys, dm_block_t *new_root)
557{549{
@@ -559,12 +551,14 @@ int dm_btree_remove(struct dm_btree_info *info, dm_block_t root, · 1 unmodified line
559 int index = 0, r = 0;551 int index = 0, r = 0;
560 struct shadow_spine spine;552 struct shadow_spine spine;
561 struct btree_node *n;553 struct btree_node *n;
554 struct dm_btree_value_type le64_vt;
562 555
556 init_le64_type(info->tm, &le64_vt);
563 init_shadow_spine(&spine, info);557 init_shadow_spine(&spine, info);
564 for (level = 0; level < info->levels; level++) {558 for (level = 0; level < info->levels; level++) {
565 r = remove_raw(&spine, info,559 r = remove_raw(&spine, info,
566 (level == last_level ?560 (level == last_level ?
567 &info->value_type : &le64_type),561 &info->value_type : &le64_vt),
568 root, keys[level], (unsigned *)&index);562 root, keys[level], (unsigned *)&index);
569 if (r < 0)563 if (r < 0)
570 break;564 break;
@@ -654,11 +648,13 @@ static int remove_one(struct dm_btree_info *info, dm_block_t root, · 83 unmodified lines
654 int index = 0, r = 0;648 int index = 0, r = 0;
655 struct shadow_spine spine;649 struct shadow_spine spine;
656 struct btree_node *n;650 struct btree_node *n;
651 struct dm_btree_value_type le64_vt;
657 uint64_t k;652 uint64_t k;
658 653
654 init_le64_type(info->tm, &le64_vt);
659 init_shadow_spine(&spine, info);655 init_shadow_spine(&spine, info);
660 for (level = 0; level < last_level; level++) {656 for (level = 0; level < last_level; level++) {
661 r = remove_raw(&spine, info, &le64_type,657 r = remove_raw(&spine, info, &le64_vt,
662 root, keys[level], (unsigned *) &index);658 root, keys[level], (unsigned *) &index);
663 if (r < 0)659 if (r < 0)
664 goto out;660 goto out;
@@ -689,6 +685,7 @@ static int remove_one(struct dm_btree_info *info, dm_block_t root, · 24 unmodified lines
689 value_ptr(n, index));685 value_ptr(n, index));
690 686
691 delete_at(n, index);687 delete_at(n, index);
688 keys[last_level] = k + 1ull;
692 689
693 } else690 } else
694 r = -ENODATA;691 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
249{249{
250 return s->root;250 return s->root;
251}251}
252
253static 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
262static 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
271static 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
280void 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
667 struct btree_node *n;667 struct btree_node *n;
668 struct dm_btree_value_type le64_type;668 struct dm_btree_value_type le64_type;
669 669
670 le64_type.context = NULL;670 init_le64_type(info->tm, &le64_type);
671 le64_type.size = sizeof(__le64);
672 le64_type.inc = NULL;
673 le64_type.dec = NULL;
674 le64_type.equal = NULL;
675
676 init_shadow_spine(&spine, info);671 init_shadow_spine(&spine, info);
677 672
678 for (level = 0; level < (info->levels - 1); level++) {673 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
1476{1476{
1477 char b[BDEVNAME_SIZE];1477 char b[BDEVNAME_SIZE];
1478 struct r1conf *conf = mddev->private;1478 struct r1conf *conf = mddev->private;
1479 unsigned long flags;
1479 1480
1480 /*1481 /*
1481 * If it is not operational, then we have already marked it as dead1482 * 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
1495 return;1496 return;
1496 }1497 }
1497 set_bit(Blocked, &rdev->flags);1498 set_bit(Blocked, &rdev->flags);
1499 spin_lock_irqsave(&conf->device_lock, flags);
1498 if (test_and_clear_bit(In_sync, &rdev->flags)) {1500 if (test_and_clear_bit(In_sync, &rdev->flags)) {
1499 unsigned long flags;
1500 spin_lock_irqsave(&conf->device_lock, flags);
1501 mddev->degraded++;1501 mddev->degraded++;
1502 set_bit(Faulty, &rdev->flags);1502 set_bit(Faulty, &rdev->flags);
1503 spin_unlock_irqrestore(&conf->device_lock, flags);
1504 } else1503 } else
1505 set_bit(Faulty, &rdev->flags);1504 set_bit(Faulty, &rdev->flags);
1505 spin_unlock_irqrestore(&conf->device_lock, flags);
1506 /*1506 /*
1507 * if recovery is running, make sure it aborts.1507 * if recovery is running, make sure it aborts.
1508 */1508 */
@@ -1568,7 +1568,10 @@ static int raid1_spare_active(struct mddev *mddev) · 59 unmodified lines
1568 * Find all failed disks within the RAID1 configuration1568 * Find all failed disks within the RAID1 configuration
1569 * and mark them readable.1569 * and mark them readable.
1570 * Called under mddev lock, so rcu protection not needed.1570 * 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.
1571 */1573 */
1574 spin_lock_irqsave(&conf->device_lock, flags);
1572 for (i = 0; i < conf->raid_disks; i++) {1575 for (i = 0; i < conf->raid_disks; i++) {
1573 struct md_rdev *rdev = conf->mirrors[i].rdev;1576 struct md_rdev *rdev = conf->mirrors[i].rdev;
1574 struct md_rdev *repl = conf->mirrors[conf->raid_disks + i].rdev;1577 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
1599 sysfs_notify_dirent_safe(rdev->sysfs_state);1602 sysfs_notify_dirent_safe(rdev->sysfs_state);
1600 }1603 }
1601 }1604 }
1602 spin_lock_irqsave(&conf->device_lock, flags);
1603 mddev->degraded -= count;1605 mddev->degraded -= count;
1604 spin_unlock_irqrestore(&conf->device_lock, flags);1606 spin_unlock_irqrestore(&conf->device_lock, flags);
1605 1607
drivers/md/raid5.c+3−2
@@ -2256,7 +2256,7 @@ static int resize_stripes(struct r5conf *conf, int newsize) · 2255 unmodified lines
2256static int drop_one_stripe(struct r5conf *conf)2256static int drop_one_stripe(struct r5conf *conf)
2257{2257{
2258 struct stripe_head *sh;2258 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;
2260 2260
2261 spin_lock_irq(conf->hash_locks + hash);2261 spin_lock_irq(conf->hash_locks + hash);
2262 sh = get_free_stripe(conf, hash);2262 sh = get_free_stripe(conf, hash);
@@ -6388,7 +6388,8 @@ static unsigned long raid5_cache_scan(struct shrinker *shrink, · 4125 unmodified lines
6388 6388
6389 if (mutex_trylock(&conf->cache_size_mutex)) {6389 if (mutex_trylock(&conf->cache_size_mutex)) {
6390 ret= 0;6390 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) {
6392 if (drop_one_stripe(conf) == 0) {6393 if (drop_one_stripe(conf) == 0) {
6393 ret = SHRINK_STOP;6394 ret = SHRINK_STOP;
6394 break;6395 break;
drivers/mfd/Kconfig+1−1
@@ -115,7 +115,7 @@ config MFD_CROS_EC_I2C · 114 unmodified lines
115 115
116config MFD_CROS_EC_SPI116config MFD_CROS_EC_SPI
117 tristate "ChromeOS Embedded Controller (SPI)"117 tristate "ChromeOS Embedded Controller (SPI)"
118 depends on MFD_CROS_EC && CROS_EC_PROTO && SPI && OF118 depends on MFD_CROS_EC && CROS_EC_PROTO && SPI
119 119
120 ---help---120 ---help---
121 If you say Y here, you get support for talking to the ChromeOS EC121 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
651 651
652 arizona->has_fully_powered_off = true;652 arizona->has_fully_powered_off = true;
653 653
654 disable_irq(arizona->irq);654 disable_irq_nosync(arizona->irq);
655 arizona_enable_reset(arizona);655 arizona_enable_reset(arizona);
656 regulator_bulk_disable(arizona->num_core_supplies,656 regulator_bulk_disable(arizona->num_core_supplies,
657 arizona->core_supplies);657 arizona->core_supplies);
@@ -1141,10 +1141,6 @@ int arizona_dev_init(struct arizona *arizona) · 483 unmodified lines
1141 arizona->pdata.gpio_defaults[i]);1141 arizona->pdata.gpio_defaults[i]);
1142 }1142 }
1143 1143
1144 pm_runtime_set_autosuspend_delay(arizona->dev, 100);
1145 pm_runtime_use_autosuspend(arizona->dev);
1146 pm_runtime_enable(arizona->dev);
1147
1148 /* Chip default */1144 /* Chip default */
1149 if (!arizona->pdata.clk32k_src)1145 if (!arizona->pdata.clk32k_src)
1150 arizona->pdata.clk32k_src = ARIZONA_32KZ_MCLK2;1146 arizona->pdata.clk32k_src = ARIZONA_32KZ_MCLK2;
@@ -1245,11 +1241,17 @@ int arizona_dev_init(struct arizona *arizona) · 94 unmodified lines
1245 arizona->pdata.spk_fmt[i]);1241 arizona->pdata.spk_fmt[i]);
1246 }1242 }
1247 1243
1244 pm_runtime_set_active(arizona->dev);
1245 pm_runtime_enable(arizona->dev);
1246
1248 /* Set up for interrupts */1247 /* Set up for interrupts */
1249 ret = arizona_irq_init(arizona);1248 ret = arizona_irq_init(arizona);
1250 if (ret != 0)1249 if (ret != 0)
1251 goto err_reset;1250 goto err_reset;
1252 1251
1252 pm_runtime_set_autosuspend_delay(arizona->dev, 100);
1253 pm_runtime_use_autosuspend(arizona->dev);
1254
1253 arizona_request_irq(arizona, ARIZONA_IRQ_CLKGEN_ERR, "CLKGEN error",1255 arizona_request_irq(arizona, ARIZONA_IRQ_CLKGEN_ERR, "CLKGEN error",
1254 arizona_clkgen_err, arizona);1256 arizona_clkgen_err, arizona);
1255 arizona_request_irq(arizona, ARIZONA_IRQ_OVERCLOCKED, "Overclocked",1257 arizona_request_irq(arizona, ARIZONA_IRQ_OVERCLOCKED, "Overclocked",
@@ -1278,10 +1280,6 @@ int arizona_dev_init(struct arizona *arizona) · 22 unmodified lines
1278 goto err_irq;1280 goto err_irq;
1279 }1281 }
1280 1282
1281#ifdef CONFIG_PM
1282 regulator_disable(arizona->dcvdd);
1283#endif
1284
1285 return 0;1283 return 0;
1286 1284
1287err_irq:1285err_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
438{438{
439 struct at24_data *at24;439 struct at24_data *at24;
440 440
441 if (unlikely(off >= attr->size))
442 return -EFBIG;
443
444 at24 = dev_get_drvdata(container_of(kobj, struct device, kobj));441 at24 = dev_get_drvdata(container_of(kobj, struct device, kobj));
445 return at24_write(at24, buf, off, count);442 return at24_write(at24, buf, off, count);
446}443}
drivers/net/bonding/bond_main.c+1−0
@@ -786,6 +786,7 @@ static bool bond_should_notify_peers(struct bonding *bond) · 785 unmodified lines
786 slave ? slave->dev->name : "NULL");786 slave ? slave->dev->name : "NULL");
787 787
788 if (!slave || !bond->send_peer_notif ||788 if (!slave || !bond->send_peer_notif ||
789 !netif_carrier_ok(bond->dev) ||
789 test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state))790 test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state))
790 return false;791 return false;
791 792
drivers/net/ethernet/3com/3c59x.c+8−9
@@ -1763,16 +1763,9 @@ vortex_open(struct net_device *dev) · 1762 unmodified lines
1763 vp->rx_ring[i].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, PKT_BUF_SZ, PCI_DMA_FROMDEVICE));1763 vp->rx_ring[i].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, PKT_BUF_SZ, PCI_DMA_FROMDEVICE));
1764 }1764 }
1765 if (i != RX_RING_SIZE) {1765 if (i != RX_RING_SIZE) {
1766 int j;
1767 pr_emerg("%s: no memory for rx ring\n", dev->name);1766 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 }
1774 retval = -ENOMEM;1767 retval = -ENOMEM;
1775 goto err_free_irq;1768 goto err_free_skb;
1776 }1769 }
1777 /* Wrap the ring. */1770 /* Wrap the ring. */
1778 vp->rx_ring[i-1].next = cpu_to_le32(vp->rx_ring_dma);1771 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
1782 if (!retval)1775 if (!retval)
1783 goto out;1776 goto out;
1784 1777
1785err_free_irq:1778err_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 }
1786 free_irq(dev->irq, dev);1785 free_irq(dev->irq, dev);
1787err:1786err:
1788 if (vortex_debug > 1)1787 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
264 if (likely(skb)) {264 if (likely(skb)) {
265 (*pkts_compl)++;265 (*pkts_compl)++;
266 (*bytes_compl) += skb->len;266 (*bytes_compl) += skb->len;
267 dev_kfree_skb_any(skb);
267 }268 }
268 269
269 dev_kfree_skb_any(skb);
270 tx_buf->first_bd = 0;270 tx_buf->first_bd = 0;
271 tx_buf->skb = NULL;271 tx_buf->skb = NULL;
272 272
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
1723 offset += sizeof(u32);1723 offset += sizeof(u32);
1724 data_buf += sizeof(u32);1724 data_buf += sizeof(u32);
1725 written_so_far += sizeof(u32);1725 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
1726 cmd_flags = 0;1742 cmd_flags = 0;
1727 }1743 }
1728 1744
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
676 if (!next_cmpl->valid)676 if (!next_cmpl->valid)
677 break;677 break;
678 }678 }
679 packets++;
679 680
680 /* TODO: BNA_CQ_EF_LOCAL ? */681 /* TODO: BNA_CQ_EF_LOCAL ? */
681 if (unlikely(flags & (BNA_CQ_EF_MAC_ERROR |682 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
692 else693 else
693 bnad_cq_setup_skb_frags(rcb, skb, sop_ci, nvecs, len);694 bnad_cq_setup_skb_frags(rcb, skb, sop_ci, nvecs, len);
694 695
695 packets++;
696 rcb->rxq->rx_packets++;696 rcb->rxq->rx_packets++;
697 rcb->rxq->rx_bytes += totlen;697 rcb->rxq->rx_bytes += totlen;
698 ccb->bytes_per_intr += totlen;698 ccb->bytes_per_intr += totlen;
drivers/net/ethernet/cavium/Kconfig+0−3
@@ -16,7 +16,6 @@ if NET_VENDOR_CAVIUM · 15 unmodified lines
16config THUNDER_NIC_PF16config THUNDER_NIC_PF
17 tristate "Thunder Physical function driver"17 tristate "Thunder Physical function driver"
18 depends on 64BIT18 depends on 64BIT
19 default ARCH_THUNDER
20 select THUNDER_NIC_BGX19 select THUNDER_NIC_BGX
21 ---help---20 ---help---
22 This driver supports Thunder's NIC physical function.21 This driver supports Thunder's NIC physical function.
@@ -29,14 +28,12 @@ config THUNDER_NIC_PF · 6 unmodified lines
29config THUNDER_NIC_VF28config THUNDER_NIC_VF
30 tristate "Thunder Virtual function driver"29 tristate "Thunder Virtual function driver"
31 depends on 64BIT30 depends on 64BIT
32 default ARCH_THUNDER
33 ---help---31 ---help---
34 This driver supports Thunder's NIC virtual function32 This driver supports Thunder's NIC virtual function
35 33
36config THUNDER_NIC_BGX34config THUNDER_NIC_BGX
37 tristate "Thunder MAC interface driver (BGX)"35 tristate "Thunder MAC interface driver (BGX)"
38 depends on 64BIT36 depends on 64BIT
39 default ARCH_THUNDER
40 select PHYLIB37 select PHYLIB
41 select MDIO_OCTEON38 select MDIO_OCTEON
42 ---help---39 ---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
2778 EXT_MEM1_SIZE_G(size));2778 EXT_MEM1_SIZE_G(size));
2779 }2779 }
2780 } else {2780 } else {
2781 if (i & EXT_MEM_ENABLE_F)2781 if (i & EXT_MEM_ENABLE_F) {
2782 size = t4_read_reg(adap, MA_EXT_MEMORY_BAR_A);2782 size = t4_read_reg(adap, MA_EXT_MEMORY_BAR_A);
2783 add_debugfs_mem(adap, "mc", MEM_MC,2783 add_debugfs_mem(adap, "mc", MEM_MC,
2784 EXT_MEM_SIZE_G(size));2784 EXT_MEM_SIZE_G(size));
2785 }
2785 }2786 }
2786 2787
2787 de = debugfs_create_file_size("flash", S_IRUSR, adap->debugfs_root, adap,2788 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
620 BE_IF_FLAGS_VLAN_PROMISCUOUS |\620 BE_IF_FLAGS_VLAN_PROMISCUOUS |\
621 BE_IF_FLAGS_MCAST_PROMISCUOUS)621 BE_IF_FLAGS_MCAST_PROMISCUOUS)
622 622
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
623/* An RX interface is an object with one or more MAC addresses and628/* An RX interface is an object with one or more MAC addresses and
624 * filtering capabilities. */629 * filtering capabilities. */
625struct be_cmd_req_if_create {630struct 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
273 if (ether_addr_equal(addr->sa_data, netdev->dev_addr))273 if (ether_addr_equal(addr->sa_data, netdev->dev_addr))
274 return 0;274 return 0;
275 275
276 /* if device is not running, copy MAC to netdev->dev_addr */
277 if (!netif_running(netdev))
278 goto done;
279
276 /* The PMAC_ADD cmd may fail if the VF doesn't have FILTMGMT280 /* The PMAC_ADD cmd may fail if the VF doesn't have FILTMGMT
277 * privilege or if PF did not provision the new MAC address.281 * privilege or if PF did not provision the new MAC address.
278 * On BE3, this cmd will always fail if the VF doesn't have the282 * 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
307 status = -EPERM;311 status = -EPERM;
308 goto err;312 goto err;
309 }313 }
310 314done:
311 memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);315 ether_addr_copy(netdev->dev_addr, addr->sa_data);
312 dev_info(dev, "MAC address changed to %pM\n", mac);316 dev_info(dev, "MAC address changed to %pM\n", addr->sa_data);
313 return 0;317 return 0;
314err:318err:
315 dev_warn(dev, "MAC address change to %pM failed\n", addr->sa_data);319 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
2452 be_eq_notify(eqo->adapter, eqo->q.id, false, true, num, 0);2456 be_eq_notify(eqo->adapter, eqo->q.id, false, true, num, 0);
2453}2457}
2454 2458
2455static void be_rx_cq_clean(struct be_rx_obj *rxo)2459/* Free posted rx buffers that were not used */
2460static void be_rxq_clean(struct be_rx_obj *rxo)
2456{2461{
2457 struct be_rx_page_info *page_info;
2458 struct be_queue_info *rxq = &rxo->q;2462 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
2475static void be_rx_cq_clean(struct be_rx_obj *rxo)
2476{
2459 struct be_queue_info *rx_cq = &rxo->cq;2477 struct be_queue_info *rx_cq = &rxo->cq;
2460 struct be_rx_compl_info *rxcp;2478 struct be_rx_compl_info *rxcp;
2461 struct be_adapter *adapter = rxo->adapter;2479 struct be_adapter *adapter = rxo->adapter;
@@ -2492,16 +2510,6 @@ static void be_rx_cq_clean(struct be_rx_obj *rxo) · 30 unmodified lines
2492 2510
2493 /* After cleanup, leave the CQ in unarmed state */2511 /* After cleanup, leave the CQ in unarmed state */
2494 be_cq_notify(adapter, rx_cq->id, false, 0);2512 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;
2505}2513}
2506 2514
2507static void be_tx_compl_clean(struct be_adapter *adapter)2515static 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
2581 be_cmd_q_destroy(adapter, &eqo->q, QTYPE_EQ);2589 be_cmd_q_destroy(adapter, &eqo->q, QTYPE_EQ);
2582 napi_hash_del(&eqo->napi);2590 napi_hash_del(&eqo->napi);
2583 netif_napi_del(&eqo->napi);2591 netif_napi_del(&eqo->napi);
2592 free_cpumask_var(eqo->affinity_mask);
2584 }2593 }
2585 free_cpumask_var(eqo->affinity_mask);
2586 be_queue_free(adapter, &eqo->q);2594 be_queue_free(adapter, &eqo->q);
2587 }2595 }
2588}2596}
@@ -2599,13 +2607,7 @@ static int be_evt_queues_create(struct be_adapter *adapter) · 10 unmodified lines
2599 2607
2600 for_all_evt_queues(adapter, eqo, i) {2608 for_all_evt_queues(adapter, eqo, i) {
2601 int numa_node = dev_to_node(&adapter->pdev->dev);2609 int numa_node = dev_to_node(&adapter->pdev->dev);
2602 if (!zalloc_cpumask_var(&eqo->affinity_mask, GFP_KERNEL))2610
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);
2609 aic = &adapter->aic_obj[i];2611 aic = &adapter->aic_obj[i];
2610 eqo->adapter = adapter;2612 eqo->adapter = adapter;
2611 eqo->idx = i;2613 eqo->idx = i;
@@ -2621,6 +2623,14 @@ static int be_evt_queues_create(struct be_adapter *adapter) · 9 unmodified lines
2621 rc = be_cmd_eq_create(adapter, eqo);2623 rc = be_cmd_eq_create(adapter, eqo);
2622 if (rc)2624 if (rc)
2623 return rc;2625 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);
2624 }2634 }
2625 return 0;2635 return 0;
2626}2636}
@@ -3359,13 +3369,54 @@ static void be_rx_qs_destroy(struct be_adapter *adapter) · 732 unmodified lines
3359 for_all_rx_queues(adapter, rxo, i) {3369 for_all_rx_queues(adapter, rxo, i) {
3360 q = &rxo->q;3370 q = &rxo->q;
3361 if (q->created) {3371 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
3362 be_cmd_rxq_destroy(adapter, q);3385 be_cmd_rxq_destroy(adapter, q);
3363 be_rx_cq_clean(rxo);3386 be_rx_cq_clean(rxo);
3387 be_rxq_clean(rxo);
3364 }3388 }
3365 be_queue_free(adapter, q);3389 be_queue_free(adapter, q);
3366 }3390 }
3367}3391}
3368 3392
3393static 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
3369static int be_close(struct net_device *netdev)3420static int be_close(struct net_device *netdev)
3370{3421{
3371 struct be_adapter *adapter = netdev_priv(netdev);3422 struct be_adapter *adapter = netdev_priv(netdev);
@@ -3378,6 +3429,8 @@ static int be_close(struct net_device *netdev) · 6 unmodified lines
3378 if (!(adapter->flags & BE_FLAGS_SETUP_DONE))3429 if (!(adapter->flags & BE_FLAGS_SETUP_DONE))
3379 return 0;3430 return 0;
3380 3431
3432 be_disable_if_filters(adapter);
3433
3381 be_roce_dev_close(adapter);3434 be_roce_dev_close(adapter);
3382 3435
3383 if (adapter->flags & BE_FLAGS_NAPI_ENABLED) {3436 if (adapter->flags & BE_FLAGS_NAPI_ENABLED) {
@@ -3397,7 +3450,6 @@ static int be_close(struct net_device *netdev) · 13 unmodified lines
3397 be_tx_compl_clean(adapter);3450 be_tx_compl_clean(adapter);
3398 3451
3399 be_rx_qs_destroy(adapter);3452 be_rx_qs_destroy(adapter);
3400 be_clear_uc_list(adapter);
3401 3453
3402 for_all_evt_queues(adapter, eqo, i) {3454 for_all_evt_queues(adapter, eqo, i) {
3403 if (msix_enabled(adapter))3455 if (msix_enabled(adapter))
@@ -3482,6 +3534,31 @@ static int be_rx_qs_create(struct be_adapter *adapter) · 78 unmodified lines
3482 return 0;3534 return 0;
3483}3535}
3484 3536
3537static 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
3485static int be_open(struct net_device *netdev)3562static int be_open(struct net_device *netdev)
3486{3563{
3487 struct be_adapter *adapter = netdev_priv(netdev);3564 struct be_adapter *adapter = netdev_priv(netdev);
@@ -3495,6 +3572,10 @@ static int be_open(struct net_device *netdev) · 7 unmodified lines
3495 if (status)3572 if (status)
3496 goto err;3573 goto err;
3497 3574
3575 status = be_enable_if_filters(adapter);
3576 if (status)
3577 goto err;
3578
3498 status = be_irq_register(adapter);3579 status = be_irq_register(adapter);
3499 if (status)3580 if (status)
3500 goto err;3581 goto err;
@@ -3685,16 +3766,6 @@ static void be_cancel_err_detection(struct be_adapter *adapter) · 184 unmodified lines
3685 }3766 }
3686}3767}
3687 3768
3688static 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
3698#ifdef CONFIG_BE2NET_VXLAN3769#ifdef CONFIG_BE2NET_VXLAN
3699static void be_disable_vxlan_offloads(struct be_adapter *adapter)3770static void be_disable_vxlan_offloads(struct be_adapter *adapter)
3700{3771{
@@ -3769,8 +3840,8 @@ static int be_clear(struct be_adapter *adapter) · 68 unmodified lines
3769#ifdef CONFIG_BE2NET_VXLAN3840#ifdef CONFIG_BE2NET_VXLAN
3770 be_disable_vxlan_offloads(adapter);3841 be_disable_vxlan_offloads(adapter);
3771#endif3842#endif
3772 /* delete the primary mac along with the uc-mac list */3843 kfree(adapter->pmac_id);
3773 be_mac_clear(adapter);3844 adapter->pmac_id = NULL;
3774 3845
3775 be_cmd_if_destroy(adapter, adapter->if_handle, 0);3846 be_cmd_if_destroy(adapter, adapter->if_handle, 0);
3776 3847
@@ -3781,25 +3852,11 @@ static int be_clear(struct be_adapter *adapter) · 4 unmodified lines
3781 return 0;3852 return 0;
3782}3853}
3783 3854
3784static 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
3798static int be_vfs_if_create(struct be_adapter *adapter)3855static int be_vfs_if_create(struct be_adapter *adapter)
3799{3856{
3800 struct be_resources res = {0};3857 struct be_resources res = {0};
3858 u32 cap_flags, en_flags, vf;
3801 struct be_vf_cfg *vf_cfg;3859 struct be_vf_cfg *vf_cfg;
3802 u32 cap_flags, vf;
3803 int status;3860 int status;
3804 3861
3805 /* If a FW profile exists, then cap_flags are updated */3862 /* 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
3820 }3877 }
3821 }3878 }
3822 3879
3823 status = be_if_create(adapter, &vf_cfg->if_handle,3880 en_flags = cap_flags & (BE_IF_FLAGS_UNTAGGED |
3824 cap_flags, vf + 1);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);
3825 if (status)3886 if (status)
3826 return status;3887 return status;
3827 }3888 }
@@ -4193,15 +4254,8 @@ static int be_mac_setup(struct be_adapter *adapter) · 365 unmodified lines
4193 4254
4194 memcpy(adapter->netdev->dev_addr, mac, ETH_ALEN);4255 memcpy(adapter->netdev->dev_addr, mac, ETH_ALEN);
4195 memcpy(adapter->netdev->perm_addr, mac, ETH_ALEN);4256 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);
4199 }4257 }
4200 4258
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);
4205 return 0;4259 return 0;
4206}4260}
4207 4261
@@ -4341,6 +4395,7 @@ static int be_func_init(struct be_adapter *adapter) · 133 unmodified lines
4341static int be_setup(struct be_adapter *adapter)4395static int be_setup(struct be_adapter *adapter)
4342{4396{
4343 struct device *dev = &adapter->pdev->dev;4397 struct device *dev = &adapter->pdev->dev;
4398 u32 en_flags;
4344 int status;4399 int status;
4345 4400
4346 status = be_func_init(adapter);4401 status = be_func_init(adapter);
@@ -4363,8 +4418,11 @@ static int be_setup(struct be_adapter *adapter) · 16 unmodified lines
4363 if (status)4418 if (status)
4364 goto err;4419 goto err;
4365 4420
4366 status = be_if_create(adapter, &adapter->if_handle,4421 /* will enable all the needed filter flags in be_open() */
4367 be_if_cap_flags(adapter), 0);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);
4368 if (status)4426 if (status)
4369 goto err;4427 goto err;
4370 4428
@@ -4390,11 +4448,6 @@ static int be_setup(struct be_adapter *adapter) · 19 unmodified lines
4390 dev_err(dev, "Please upgrade firmware to version >= 4.0\n");4448 dev_err(dev, "Please upgrade firmware to version >= 4.0\n");
4391 }4449 }
4392 4450
4393 if (adapter->vlans_added)
4394 be_vid_config(adapter);
4395
4396 be_set_rx_mode(adapter->netdev);
4397
4398 status = be_cmd_set_flow_control(adapter, adapter->tx_fc,4451 status = be_cmd_set_flow_control(adapter, adapter->tx_fc,
4399 adapter->rx_fc);4452 adapter->rx_fc);
4400 if (status)4453 if (status)
drivers/net/ethernet/freescale/fec_main.c+1−0
@@ -3438,6 +3438,7 @@ fec_probe(struct platform_device *pdev) · 3437 unmodified lines
3438 3438
3439 pm_runtime_set_autosuspend_delay(&pdev->dev, FEC_MDIO_PM_TIMEOUT);3439 pm_runtime_set_autosuspend_delay(&pdev->dev, FEC_MDIO_PM_TIMEOUT);
3440 pm_runtime_use_autosuspend(&pdev->dev);3440 pm_runtime_use_autosuspend(&pdev->dev);
3441 pm_runtime_get_noresume(&pdev->dev);
3441 pm_runtime_set_active(&pdev->dev);3442 pm_runtime_set_active(&pdev->dev);
3442 pm_runtime_enable(&pdev->dev);3443 pm_runtime_enable(&pdev->dev);
3443 3444
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
586 frag = skb_shinfo(skb)->frags;586 frag = skb_shinfo(skb)->frags;
587 while (nr_frags) {587 while (nr_frags) {
588 CBDC_SC(bdp,588 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);
590 CBDS_SC(bdp, BD_ENET_TX_READY);591 CBDS_SC(bdp, BD_ENET_TX_READY);
591 592
592 if ((CBDR_SC(bdp) & BD_ENET_TX_WRAP) == 0)593 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
110}110}
111 111
112#define FEC_NAPI_RX_EVENT_MSK (FEC_ENET_RXF | FEC_ENET_RXB)112#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)
114#define FEC_RX_EVENT (FEC_ENET_RXF)114#define FEC_RX_EVENT (FEC_ENET_RXF)
115#define FEC_TX_EVENT (FEC_ENET_TXF)115#define FEC_TX_EVENT (FEC_ENET_TXF)
116#define FEC_ERR_EVENT_MSK (FEC_ENET_HBERR | FEC_ENET_BABR | \116#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
902 return 0;902 return 0;
903}903}
904 904
905static int gfar_comp_asc(const void *a, const void *b)
906{
907 return memcmp(a, b, 4);
908}
909
910static int gfar_comp_desc(const void *a, const void *b)
911{
912 return -memcmp(a, b, 4);
913}
914
915static 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
926/* Write a mask to filer cache */905/* Write a mask to filer cache */
927static void gfar_set_mask(u32 mask, struct filer_table *tab)906static void gfar_set_mask(u32 mask, struct filer_table *tab)
928{907{
@@ -1272,310 +1251,6 @@ static int gfar_convert_to_filer(struct ethtool_rx_flow_spec *rule, · 343 unmodified lines
1272 return 0;1251 return 0;
1273}1252}
1274 1253
1275/* Copy size filer entries */
1276static 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 */
1289static 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 */
1317static 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
1331static 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
1342static 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 */
1356static 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 */
1402static 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 */
1428static 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 */
1464static 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 */
1515static 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);
1575end: kfree(temp_table);
1576 return ret;
1577}
1578
1579/* Write the bit-pattern from software's buffer to hardware registers */1254/* Write the bit-pattern from software's buffer to hardware registers */
1580static int gfar_write_filer_table(struct gfar_private *priv,1255static int gfar_write_filer_table(struct gfar_private *priv,
1581 struct filer_table *tab)1256 struct filer_table *tab)
@@ -1585,11 +1260,10 @@ static int gfar_write_filer_table(struct gfar_private *priv, · 3 unmodified lines
1585 return -EBUSY;1260 return -EBUSY;
1586 1261
1587 /* Fill regular entries */1262 /* Fill regular entries */
1588 for (; i < MAX_FILER_IDX - 1 && (tab->fe[i].ctrl | tab->fe[i].prop);1263 for (; i < MAX_FILER_IDX && (tab->fe[i].ctrl | tab->fe[i].prop); i++)
1589 i++)
1590 gfar_write_filer(priv, i, tab->fe[i].ctrl, tab->fe[i].prop);1264 gfar_write_filer(priv, i, tab->fe[i].ctrl, tab->fe[i].prop);
1591 /* Fill the rest with fall-troughs */1265 /* Fill the rest with fall-troughs */
1592 for (; i < MAX_FILER_IDX - 1; i++)1266 for (; i < MAX_FILER_IDX; i++)
1593 gfar_write_filer(priv, i, 0x60, 0xFFFFFFFF);1267 gfar_write_filer(priv, i, 0x60, 0xFFFFFFFF);
1594 /* Last entry must be default accept1268 /* Last entry must be default accept
1595 * because that's what people expect1269 * because that's what people expect
@@ -1623,7 +1297,6 @@ static int gfar_process_filer_changes(struct gfar_private *priv) · 27 unmodified lines
1623{1297{
1624 struct ethtool_flow_spec_container *j;1298 struct ethtool_flow_spec_container *j;
1625 struct filer_table *tab;1299 struct filer_table *tab;
1626 s32 i = 0;
1627 s32 ret = 0;1300 s32 ret = 0;
1628 1301
1629 /* So index is set to zero, too! */1302 /* So index is set to zero, too! */
@@ -1648,17 +1321,6 @@ static int gfar_process_filer_changes(struct gfar_private *priv) · 18 unmodified lines
1648 }1321 }
1649 }1322 }
1650 1323
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
1662 /* Write everything to hardware */1324 /* Write everything to hardware */
1663 ret = gfar_write_filer_table(priv, tab);1325 ret = gfar_write_filer_table(priv, tab);
1664 if (ret == -EBUSY) {1326 if (ret == -EBUSY) {
@@ -1724,13 +1386,14 @@ static int gfar_add_cls(struct gfar_private *priv, · 59 unmodified lines
1724 }1386 }
1725 1387
1726process:1388process:
1389 priv->rx_list.count++;
1727 ret = gfar_process_filer_changes(priv);1390 ret = gfar_process_filer_changes(priv);
1728 if (ret)1391 if (ret)
1729 goto clean_list;1392 goto clean_list;
1730 priv->rx_list.count++;
1731 return ret;1393 return ret;
1732 1394
1733clean_list:1395clean_list:
1396 priv->rx_list.count--;
1734 list_del(&temp->list);1397 list_del(&temp->list);
1735clean_mem:1398clean_mem:
1736 kfree(temp);1399 kfree(temp);
drivers/net/ethernet/marvell/mvpp2.c+167−77
@@ -27,6 +27,8 @@ · 26 unmodified lines
27#include <linux/of_address.h>27#include <linux/of_address.h>
28#include <linux/phy.h>28#include <linux/phy.h>
29#include <linux/clk.h>29#include <linux/clk.h>
30#include <linux/hrtimer.h>
31#include <linux/ktime.h>
30#include <uapi/linux/ppp_defs.h>32#include <uapi/linux/ppp_defs.h>
31#include <net/ip.h>33#include <net/ip.h>
32#include <net/ipv6.h>34#include <net/ipv6.h>
@@ -299,6 +301,7 @@ · 266 unmodified lines
299 301
300/* Coalescing */302/* Coalescing */
301#define MVPP2_TXDONE_COAL_PKTS_THRESH 15303#define MVPP2_TXDONE_COAL_PKTS_THRESH 15
304#define MVPP2_TXDONE_HRTIMER_PERIOD_NS 1000000UL
302#define MVPP2_RX_COAL_PKTS 32305#define MVPP2_RX_COAL_PKTS 32
303#define MVPP2_RX_COAL_USEC 100306#define MVPP2_RX_COAL_USEC 100
304 307
@@ -660,6 +663,14 @@ struct mvpp2_pcpu_stats { · 355 unmodified lines
660 u64 tx_bytes;663 u64 tx_bytes;
661};664};
662 665
666/* Per-CPU port control */
667struct 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
663struct mvpp2_port {674struct mvpp2_port {
664 u8 id;675 u8 id;
665 676
@@ -679,6 +690,9 @@ struct mvpp2_port { · 13 unmodified lines
679 u32 pending_cause_rx;690 u32 pending_cause_rx;
680 struct napi_struct napi;691 struct napi_struct napi;
681 692
693 /* Per-CPU port control */
694 struct mvpp2_port_pcpu __percpu *pcpu;
695
682 /* Flags */696 /* Flags */
683 unsigned long flags;697 unsigned long flags;
684 698
@@ -776,6 +790,9 @@ struct mvpp2_txq_pcpu { · 91 unmodified lines
776 /* Array of transmitted skb */790 /* Array of transmitted skb */
777 struct sk_buff **tx_skb;791 struct sk_buff **tx_skb;
778 792
793 /* Array of transmitted buffers' physical addresses */
794 dma_addr_t *tx_buffs;
795
779 /* Index of last TX DMA descriptor that was inserted */796 /* Index of last TX DMA descriptor that was inserted */
780 int txq_put_index;797 int txq_put_index;
781 798
@@ -913,8 +930,6 @@ struct mvpp2_bm_pool { · 131 unmodified lines
913 /* Occupied buffers indicator */930 /* Occupied buffers indicator */
914 atomic_t in_use;931 atomic_t in_use;
915 int in_use_thresh;932 int in_use_thresh;
916
917 spinlock_t lock;
918};933};
919 934
920struct mvpp2_buff_hdr {935struct mvpp2_buff_hdr {
@@ -963,9 +978,13 @@ static void mvpp2_txq_inc_get(struct mvpp2_txq_pcpu *txq_pcpu) · 42 unmodified lines
963}978}
964 979
965static void mvpp2_txq_inc_put(struct mvpp2_txq_pcpu *txq_pcpu,980static 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)
967{983{
968 txq_pcpu->tx_skb[txq_pcpu->txq_put_index] = skb;984 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;
969 txq_pcpu->txq_put_index++;988 txq_pcpu->txq_put_index++;
970 if (txq_pcpu->txq_put_index == txq_pcpu->size)989 if (txq_pcpu->txq_put_index == txq_pcpu->size)
971 txq_pcpu->txq_put_index = 0;990 txq_pcpu->txq_put_index = 0;
@@ -3376,7 +3395,6 @@ static int mvpp2_bm_pool_create(struct platform_device *pdev, · 2404 unmodified lines
3376 bm_pool->pkt_size = 0;3395 bm_pool->pkt_size = 0;
3377 bm_pool->buf_num = 0;3396 bm_pool->buf_num = 0;
3378 atomic_set(&bm_pool->in_use, 0);3397 atomic_set(&bm_pool->in_use, 0);
3379 spin_lock_init(&bm_pool->lock);
3380 3398
3381 return 0;3399 return 0;
3382}3400}
@@ -3647,7 +3665,6 @@ static struct mvpp2_bm_pool * · 264 unmodified lines
3647mvpp2_bm_pool_use(struct mvpp2_port *port, int pool, enum mvpp2_bm_type type,3665mvpp2_bm_pool_use(struct mvpp2_port *port, int pool, enum mvpp2_bm_type type,
3648 int pkt_size)3666 int pkt_size)
3649{3667{
3650 unsigned long flags = 0;
3651 struct mvpp2_bm_pool *new_pool = &port->priv->bm_pools[pool];3668 struct mvpp2_bm_pool *new_pool = &port->priv->bm_pools[pool];
3652 int num;3669 int num;
3653 3670
@@ -3656,8 +3673,6 @@ mvpp2_bm_pool_use(struct mvpp2_port *port, int pool, enum mvpp2_bm_type type, · 2 unmodified lines
3656 return NULL;3673 return NULL;
3657 }3674 }
3658 3675
3659 spin_lock_irqsave(&new_pool->lock, flags);
3660
3661 if (new_pool->type == MVPP2_BM_FREE)3676 if (new_pool->type == MVPP2_BM_FREE)
3662 new_pool->type = type;3677 new_pool->type = type;
3663 3678
@@ -3686,8 +3701,6 @@ mvpp2_bm_pool_use(struct mvpp2_port *port, int pool, enum mvpp2_bm_type type, · 22 unmodified lines
3686 if (num != pkts_num) {3701 if (num != pkts_num) {
3687 WARN(1, "pool %d: %d of %d allocated\n",3702 WARN(1, "pool %d: %d of %d allocated\n",
3688 new_pool->id, num, pkts_num);3703 new_pool->id, num, pkts_num);
3689 /* We need to undo the bufs_add() allocations */
3690 spin_unlock_irqrestore(&new_pool->lock, flags);
3691 return NULL;3704 return NULL;
3692 }3705 }
3693 }3706 }
@@ -3695,15 +3708,12 @@ mvpp2_bm_pool_use(struct mvpp2_port *port, int pool, enum mvpp2_bm_type type, · 1 unmodified line
3695 mvpp2_bm_pool_bufsize_set(port->priv, new_pool,3708 mvpp2_bm_pool_bufsize_set(port->priv, new_pool,
3696 MVPP2_RX_BUF_SIZE(new_pool->pkt_size));3709 MVPP2_RX_BUF_SIZE(new_pool->pkt_size));
3697 3710
3698 spin_unlock_irqrestore(&new_pool->lock, flags);
3699
3700 return new_pool;3711 return new_pool;
3701}3712}
3702 3713
3703/* Initialize pools for swf */3714/* Initialize pools for swf */
3704static int mvpp2_swf_bm_pool_init(struct mvpp2_port *port)3715static int mvpp2_swf_bm_pool_init(struct mvpp2_port *port)
3705{3716{
3706 unsigned long flags = 0;
3707 int rxq;3717 int rxq;
3708 3718
3709 if (!port->pool_long) {3719 if (!port->pool_long) {
@@ -3714,9 +3724,7 @@ static int mvpp2_swf_bm_pool_init(struct mvpp2_port *port) · 4 unmodified lines
3714 if (!port->pool_long)3724 if (!port->pool_long)
3715 return -ENOMEM;3725 return -ENOMEM;
3716 3726
3717 spin_lock_irqsave(&port->pool_long->lock, flags);
3718 port->pool_long->port_map |= (1 << port->id);3727 port->pool_long->port_map |= (1 << port->id);
3719 spin_unlock_irqrestore(&port->pool_long->lock, flags);
3720 3728
3721 for (rxq = 0; rxq < rxq_number; rxq++)3729 for (rxq = 0; rxq < rxq_number; rxq++)
3722 mvpp2_rxq_long_pool_set(port, rxq, port->pool_long->id);3730 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
3730 if (!port->pool_short)3738 if (!port->pool_short)
3731 return -ENOMEM;3739 return -ENOMEM;
3732 3740
3733 spin_lock_irqsave(&port->pool_short->lock, flags);
3734 port->pool_short->port_map |= (1 << port->id);3741 port->pool_short->port_map |= (1 << port->id);
3735 spin_unlock_irqrestore(&port->pool_short->lock, flags);
3736 3742
3737 for (rxq = 0; rxq < rxq_number; rxq++)3743 for (rxq = 0; rxq < rxq_number; rxq++)
3738 mvpp2_rxq_short_pool_set(port, rxq,3744 mvpp2_rxq_short_pool_set(port, rxq,
@@ -3806,7 +3812,6 @@ static void mvpp2_interrupts_unmask(void *arg) · 67 unmodified lines
3806 3812
3807 mvpp2_write(port->priv, MVPP2_ISR_RX_TX_MASK_REG(port->id),3813 mvpp2_write(port->priv, MVPP2_ISR_RX_TX_MASK_REG(port->id),
3808 (MVPP2_CAUSE_MISC_SUM_MASK |3814 (MVPP2_CAUSE_MISC_SUM_MASK |
3809 MVPP2_CAUSE_TXQ_OCCUP_DESC_ALL_MASK |
3810 MVPP2_CAUSE_RXQ_OCCUP_DESC_ALL_MASK));3815 MVPP2_CAUSE_RXQ_OCCUP_DESC_ALL_MASK));
3811}3816}
3812 3817
@@ -4382,23 +4387,6 @@ static void mvpp2_rx_time_coal_set(struct mvpp2_port *port, · 569 unmodified lines
4382 rxq->time_coal = usec;4387 rxq->time_coal = usec;
4383}4388}
4384 4389
4385/* Set threshold for TX_DONE pkts coalescing */
4386static 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
4402/* Free Tx queue skbuffs */4390/* Free Tx queue skbuffs */
4403static void mvpp2_txq_bufs_free(struct mvpp2_port *port,4391static void mvpp2_txq_bufs_free(struct mvpp2_port *port,
4404 struct mvpp2_tx_queue *txq,4392 struct mvpp2_tx_queue *txq,
@@ -4407,8 +4395,8 @@ static void mvpp2_txq_bufs_free(struct mvpp2_port *port, · 2 unmodified lines
4407 int i;4395 int i;
4408 4396
4409 for (i = 0; i < num; i++) {4397 for (i = 0; i < num; i++) {
4410 struct mvpp2_tx_desc *tx_desc = txq->descs +4398 dma_addr_t buf_phys_addr =
4411 txq_pcpu->txq_get_index;4399 txq_pcpu->tx_buffs[txq_pcpu->txq_get_index];
4412 struct sk_buff *skb = txq_pcpu->tx_skb[txq_pcpu->txq_get_index];4400 struct sk_buff *skb = txq_pcpu->tx_skb[txq_pcpu->txq_get_index];
4413 4401
4414 mvpp2_txq_inc_get(txq_pcpu);4402 mvpp2_txq_inc_get(txq_pcpu);
@@ -4416,8 +4404,8 @@ static void mvpp2_txq_bufs_free(struct mvpp2_port *port, · 1 unmodified line
4416 if (!skb)4404 if (!skb)
4417 continue;4405 continue;
4418 4406
4419 dma_unmap_single(port->dev->dev.parent, tx_desc->buf_phys_addr,4407 dma_unmap_single(port->dev->dev.parent, buf_phys_addr,
4420 tx_desc->data_size, DMA_TO_DEVICE);4408 skb_headlen(skb), DMA_TO_DEVICE);
4421 dev_kfree_skb_any(skb);4409 dev_kfree_skb_any(skb);
4422 }4410 }
4423}4411}
@@ -4433,7 +4421,7 @@ static inline struct mvpp2_rx_queue *mvpp2_get_rx_queue(struct mvpp2_port *port, · 9 unmodified lines
4433static inline struct mvpp2_tx_queue *mvpp2_get_tx_queue(struct mvpp2_port *port,4421static inline struct mvpp2_tx_queue *mvpp2_get_tx_queue(struct mvpp2_port *port,
4434 u32 cause)4422 u32 cause)
4435{4423{
4436 int queue = fls(cause >> 16) - 1;4424 int queue = fls(cause) - 1;
4437 4425
4438 return port->txqs[queue];4426 return port->txqs[queue];
4439}4427}
@@ -4460,6 +4448,29 @@ static void mvpp2_txq_done(struct mvpp2_port *port, struct mvpp2_tx_queue *txq, · 20 unmodified lines
4460 netif_tx_wake_queue(nq);4448 netif_tx_wake_queue(nq);
4461}4449}
4462 4450
4451static 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
4463/* Rx/Tx queue initialization/cleanup methods */4474/* Rx/Tx queue initialization/cleanup methods */
4464 4475
4465/* Allocate and initialize descriptors for aggr TXQ */4476/* Allocate and initialize descriptors for aggr TXQ */
@@ -4649,12 +4660,13 @@ static int mvpp2_txq_init(struct mvpp2_port *port, · 183 unmodified lines
4649 txq_pcpu->tx_skb = kmalloc(txq_pcpu->size *4660 txq_pcpu->tx_skb = kmalloc(txq_pcpu->size *
4650 sizeof(*txq_pcpu->tx_skb),4661 sizeof(*txq_pcpu->tx_skb),
4651 GFP_KERNEL);4662 GFP_KERNEL);
4652 if (!txq_pcpu->tx_skb) {4663 if (!txq_pcpu->tx_skb)
4653 dma_free_coherent(port->dev->dev.parent,4664 goto error;
4654 txq->size * MVPP2_DESC_ALIGNED_SIZE,4665
4655 txq->descs, txq->descs_phys);4666 txq_pcpu->tx_buffs = kmalloc(txq_pcpu->size *
4656 return -ENOMEM;4667 sizeof(dma_addr_t), GFP_KERNEL);
4657 }4668 if (!txq_pcpu->tx_buffs)
4669 goto error;
4658 4670
4659 txq_pcpu->count = 0;4671 txq_pcpu->count = 0;
4660 txq_pcpu->reserved_num = 0;4672 txq_pcpu->reserved_num = 0;
@@ -4663,6 +4675,19 @@ static int mvpp2_txq_init(struct mvpp2_port *port, · 2 unmodified lines
4663 }4675 }
4664 4676
4665 return 0;4677 return 0;
4678
4679error:
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;
4666}4691}
4667 4692
4668/* Free allocated TXQ resources */4693/* Free allocated TXQ resources */
@@ -4675,6 +4700,7 @@ static void mvpp2_txq_deinit(struct mvpp2_port *port, · 6 unmodified lines
4675 for_each_present_cpu(cpu) {4700 for_each_present_cpu(cpu) {
4676 txq_pcpu = per_cpu_ptr(txq->pcpu, cpu);4701 txq_pcpu = per_cpu_ptr(txq->pcpu, cpu);
4677 kfree(txq_pcpu->tx_skb);4702 kfree(txq_pcpu->tx_skb);
4703 kfree(txq_pcpu->tx_buffs);
4678 }4704 }
4679 4705
4680 if (txq->descs)4706 if (txq->descs)
@@ -4805,7 +4831,6 @@ static int mvpp2_setup_txqs(struct mvpp2_port *port) · 124 unmodified lines
4805 goto err_cleanup;4831 goto err_cleanup;
4806 }4832 }
4807 4833
4808 on_each_cpu(mvpp2_tx_done_pkts_coal_set, port, 1);
4809 on_each_cpu(mvpp2_txq_sent_counter_clear, port, 1);4834 on_each_cpu(mvpp2_txq_sent_counter_clear, port, 1);
4810 return 0;4835 return 0;
4811 4836
@@ -4887,6 +4912,49 @@ static void mvpp2_link_event(struct net_device *dev) · 75 unmodified lines
4887 }4912 }
4888}4913}
4889 4914
4915static 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
4927static 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
4947static 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
4890/* Main RX/TX processing routines */4958/* Main RX/TX processing routines */
4891 4959
4892/* Display more error info */4960/* 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
5144 if (i == (skb_shinfo(skb)->nr_frags - 1)) {5212 if (i == (skb_shinfo(skb)->nr_frags - 1)) {
5145 /* Last descriptor */5213 /* Last descriptor */
5146 tx_desc->command = MVPP2_TXD_L_DESC;5214 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);
5148 } else {5216 } else {
5149 /* Descriptor in the middle: Not First, Not Last */5217 /* Descriptor in the middle: Not First, Not Last */
5150 tx_desc->command = 0;5218 tx_desc->command = 0;
5151 mvpp2_txq_inc_put(txq_pcpu, NULL);5219 mvpp2_txq_inc_put(txq_pcpu, NULL, tx_desc);
5152 }5220 }
5153 }5221 }
5154 5222
@@ -5214,12 +5282,12 @@ static int mvpp2_tx(struct sk_buff *skb, struct net_device *dev) · 59 unmodified lines
5214 /* First and Last descriptor */5282 /* First and Last descriptor */
5215 tx_cmd |= MVPP2_TXD_F_DESC | MVPP2_TXD_L_DESC;5283 tx_cmd |= MVPP2_TXD_F_DESC | MVPP2_TXD_L_DESC;
5216 tx_desc->command = tx_cmd;5284 tx_desc->command = tx_cmd;
5217 mvpp2_txq_inc_put(txq_pcpu, skb);5285 mvpp2_txq_inc_put(txq_pcpu, skb, tx_desc);
5218 } else {5286 } else {
5219 /* First but not Last */5287 /* First but not Last */
5220 tx_cmd |= MVPP2_TXD_F_DESC | MVPP2_TXD_PADDING_DISABLE;5288 tx_cmd |= MVPP2_TXD_F_DESC | MVPP2_TXD_PADDING_DISABLE;
5221 tx_desc->command = tx_cmd;5289 tx_desc->command = tx_cmd;
5222 mvpp2_txq_inc_put(txq_pcpu, NULL);5290 mvpp2_txq_inc_put(txq_pcpu, NULL, tx_desc);
5223 5291
5224 /* Continue with other skb fragments */5292 /* Continue with other skb fragments */
5225 if (mvpp2_tx_frag_process(port, skb, aggr_txq, txq)) {5293 if (mvpp2_tx_frag_process(port, skb, aggr_txq, txq)) {
@@ -5255,6 +5323,17 @@ out: · 29 unmodified lines
5255 dev_kfree_skb_any(skb);5323 dev_kfree_skb_any(skb);
5256 }5324 }
5257 5325
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
5258 return NETDEV_TX_OK;5337 return NETDEV_TX_OK;
5259}5338}
5260 5339
@@ -5268,10 +5347,11 @@ static inline void mvpp2_cause_error(struct net_device *dev, int cause) · 7 unmodified lines
5268 netdev_err(dev, "tx fifo underrun error\n");5347 netdev_err(dev, "tx fifo underrun error\n");
5269}5348}
5270 5349
5271static void mvpp2_txq_done_percpu(void *arg)5350static int mvpp2_poll(struct napi_struct *napi, int budget)
5272{5351{
5273 struct mvpp2_port *port = arg;5352 u32 cause_rx_tx, cause_rx, cause_misc;
5274 u32 cause_rx_tx, cause_tx, cause_misc;5353 int rx_done = 0;
5354 struct mvpp2_port *port = netdev_priv(napi->dev);
5275 5355
5276 /* Rx/Tx cause register5356 /* Rx/Tx cause register
5277 *5357 *
@@ -5285,7 +5365,7 @@ static void mvpp2_txq_done_percpu(void *arg) · 7 unmodified lines
5285 */5365 */
5286 cause_rx_tx = mvpp2_read(port->priv,5366 cause_rx_tx = mvpp2_read(port->priv,
5287 MVPP2_ISR_RX_TX_CAUSE_REG(port->id));5367 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;
5289 cause_misc = cause_rx_tx & MVPP2_CAUSE_MISC_SUM_MASK;5369 cause_misc = cause_rx_tx & MVPP2_CAUSE_MISC_SUM_MASK;
5290 5370
5291 if (cause_misc) {5371 if (cause_misc) {
@@ -5297,26 +5377,6 @@ static void mvpp2_txq_done_percpu(void *arg) · 5 unmodified lines
5297 cause_rx_tx & ~MVPP2_CAUSE_MISC_SUM_MASK);5377 cause_rx_tx & ~MVPP2_CAUSE_MISC_SUM_MASK);
5298 }5378 }
5299 5379
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
5310static 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));
5320 cause_rx = cause_rx_tx & MVPP2_CAUSE_RXQ_OCCUP_DESC_ALL_MASK;5380 cause_rx = cause_rx_tx & MVPP2_CAUSE_RXQ_OCCUP_DESC_ALL_MASK;
5321 5381
5322 /* Process RX packets */5382 /* Process RX packets */
@@ -5561,6 +5621,8 @@ err_cleanup_rxqs: · 238 unmodified lines
5561static int mvpp2_stop(struct net_device *dev)5621static int mvpp2_stop(struct net_device *dev)
5562{5622{
5563 struct mvpp2_port *port = netdev_priv(dev);5623 struct mvpp2_port *port = netdev_priv(dev);
5624 struct mvpp2_port_pcpu *port_pcpu;
5625 int cpu;
5564 5626
5565 mvpp2_stop_dev(port);5627 mvpp2_stop_dev(port);
5566 mvpp2_phy_disconnect(port);5628 mvpp2_phy_disconnect(port);
@@ -5569,6 +5631,13 @@ static int mvpp2_stop(struct net_device *dev) · 2 unmodified lines
5569 on_each_cpu(mvpp2_interrupts_mask, port, 1);5631 on_each_cpu(mvpp2_interrupts_mask, port, 1);
5570 5632
5571 free_irq(port->irq, port);5633 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 }
5572 mvpp2_cleanup_rxqs(port);5641 mvpp2_cleanup_rxqs(port);
5573 mvpp2_cleanup_txqs(port);5642 mvpp2_cleanup_txqs(port);
5574 5643
@@ -5784,7 +5853,6 @@ static int mvpp2_ethtool_set_coalesce(struct net_device *dev, · 209 unmodified lines
5784 txq->done_pkts_coal = c->tx_max_coalesced_frames;5853 txq->done_pkts_coal = c->tx_max_coalesced_frames;
5785 }5854 }
5786 5855
5787 on_each_cpu(mvpp2_tx_done_pkts_coal_set, port, 1);
5788 return 0;5856 return 0;
5789}5857}
5790 5858
@@ -6035,6 +6103,7 @@ static int mvpp2_port_probe(struct platform_device *pdev, · 244 unmodified lines
6035{6103{
6036 struct device_node *phy_node;6104 struct device_node *phy_node;
6037 struct mvpp2_port *port;6105 struct mvpp2_port *port;
6106 struct mvpp2_port_pcpu *port_pcpu;
6038 struct net_device *dev;6107 struct net_device *dev;
6039 struct resource *res;6108 struct resource *res;
6040 const char *dt_mac_addr;6109 const char *dt_mac_addr;
@@ -6044,7 +6113,7 @@ static int mvpp2_port_probe(struct platform_device *pdev, · 3 unmodified lines
6044 int features;6113 int features;
6045 int phy_mode;6114 int phy_mode;
6046 int priv_common_regs_num = 2;6115 int priv_common_regs_num = 2;
6047 int err, i;6116 int err, i, cpu;
6048 6117
6049 dev = alloc_etherdev_mqs(sizeof(struct mvpp2_port), txq_number,6118 dev = alloc_etherdev_mqs(sizeof(struct mvpp2_port), txq_number,
6050 rxq_number);6119 rxq_number);
@@ -6135,6 +6204,24 @@ static int mvpp2_port_probe(struct platform_device *pdev, · 84 unmodified lines
6135 }6204 }
6136 mvpp2_port_power_up(port);6205 mvpp2_port_power_up(port);
6137 6206
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
6138 netif_napi_add(dev, &port->napi, mvpp2_poll, NAPI_POLL_WEIGHT);6225 netif_napi_add(dev, &port->napi, mvpp2_poll, NAPI_POLL_WEIGHT);
6139 features = NETIF_F_SG | NETIF_F_IP_CSUM;6226 features = NETIF_F_SG | NETIF_F_IP_CSUM;
6140 dev->features = features | NETIF_F_RXCSUM;6227 dev->features = features | NETIF_F_RXCSUM;
@@ -6144,7 +6231,7 @@ static int mvpp2_port_probe(struct platform_device *pdev, · 3 unmodified lines
6144 err = register_netdev(dev);6231 err = register_netdev(dev);
6145 if (err < 0) {6232 if (err < 0) {
6146 dev_err(&pdev->dev, "failed to register netdev\n");6233 dev_err(&pdev->dev, "failed to register netdev\n");
6147 goto err_free_txq_pcpu;6234 goto err_free_port_pcpu;
6148 }6235 }
6149 netdev_info(dev, "Using %s mac address %pM\n", mac_from, dev->dev_addr);6236 netdev_info(dev, "Using %s mac address %pM\n", mac_from, dev->dev_addr);
6150 6237
@@ -6153,6 +6240,8 @@ static int mvpp2_port_probe(struct platform_device *pdev, · 2 unmodified lines
6153 priv->port_list[id] = port;6240 priv->port_list[id] = port;
6154 return 0;6241 return 0;
6155 6242
6243err_free_port_pcpu:
6244 free_percpu(port->pcpu);
6156err_free_txq_pcpu:6245err_free_txq_pcpu:
6157 for (i = 0; i < txq_number; i++)6246 for (i = 0; i < txq_number; i++)
6158 free_percpu(port->txqs[i]->pcpu);6247 free_percpu(port->txqs[i]->pcpu);
@@ -6171,6 +6260,7 @@ static void mvpp2_port_remove(struct mvpp2_port *port) · 12 unmodified lines
6171 int i;6260 int i;
6172 6261
6173 unregister_netdev(port->dev);6262 unregister_netdev(port->dev);
6263 free_percpu(port->pcpu);
6174 free_percpu(port->stats);6264 free_percpu(port->stats);
6175 for (i = 0; i < txq_number; i++)6265 for (i = 0; i < txq_number; i++)
6176 free_percpu(port->txqs[i]->pcpu);6266 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
391 /* disable cmdif checksum */391 /* disable cmdif checksum */
392 MLX5_SET(cmd_hca_cap, set_hca_cap, cmdif_checksum, 0);392 MLX5_SET(cmd_hca_cap, set_hca_cap, cmdif_checksum, 0);
393 393
394 MLX5_SET(cmd_hca_cap, set_hca_cap, log_uar_page_sz, PAGE_SHIFT - 12);
395
394 err = set_caps(dev, set_ctx, set_sz);396 err = set_caps(dev, set_ctx, set_sz);
395 397
396query_ex:398query_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
4875 case RTL_GIGA_MAC_VER_46:4875 case RTL_GIGA_MAC_VER_46:
4876 case RTL_GIGA_MAC_VER_47:4876 case RTL_GIGA_MAC_VER_47:
4877 case RTL_GIGA_MAC_VER_48:4877 case RTL_GIGA_MAC_VER_48:
4878 RTL_W32(RxConfig, RX128_INT_EN | RX_DMA_BURST | RX_EARLY_OFF);
4879 break;
4878 case RTL_GIGA_MAC_VER_49:4880 case RTL_GIGA_MAC_VER_49:
4879 case RTL_GIGA_MAC_VER_50:4881 case RTL_GIGA_MAC_VER_50:
4880 case RTL_GIGA_MAC_VER_51:4882 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);
4882 break;4884 break;
4883 default:4885 default:
4884 RTL_W32(RxConfig, RX128_INT_EN | RX_DMA_BURST);4886 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
4927 rocker_port_ig_tbl(rocker_port, SWITCHDEV_TRANS_NONE,4927 rocker_port_ig_tbl(rocker_port, SWITCHDEV_TRANS_NONE,
4928 ROCKER_OP_FLAG_REMOVE);4928 ROCKER_OP_FLAG_REMOVE);
4929 unregister_netdev(rocker_port->dev);4929 unregister_netdev(rocker_port->dev);
4930 free_netdev(rocker_port->dev);
4930 }4931 }
4931 kfree(rocker->ports);4932 kfree(rocker->ports);
4932}4933}
drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c+2−2
@@ -42,7 +42,7 @@ · 41 unmodified lines
42#define NSS_COMMON_CLK_DIV_MASK 0x7f42#define NSS_COMMON_CLK_DIV_MASK 0x7f
43 43
44#define NSS_COMMON_CLK_SRC_CTRL 0x1444#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)
46/* Mode is coded on 1 bit but is different depending on the MAC ID:46/* Mode is coded on 1 bit but is different depending on the MAC ID:
47 * MAC0: QSGMII=0 RGMII=147 * MAC0: QSGMII=0 RGMII=1
48 * MAC1: QSGMII=0 SGMII=0 RGMII=148 * MAC1: QSGMII=0 SGMII=0 RGMII=1
@@ -308,7 +308,7 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) · 259 unmodified lines
308 308
309 /* Configure the clock src according to the mode */309 /* Configure the clock src according to the mode */
310 regmap_read(gmac->nss_common, NSS_COMMON_CLK_SRC_CTRL, &val);310 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));
312 switch (gmac->phy_mode) {312 switch (gmac->phy_mode) {
313 case PHY_INTERFACE_MODE_RGMII:313 case PHY_INTERFACE_MODE_RGMII:
314 val |= NSS_COMMON_CLK_SRC_CTRL_RGMII(gmac->id) <<314 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
85 struct list_head rxhook_list_head;85 struct list_head rxhook_list_head;
86 unsigned int rx_queue_id;86 unsigned int rx_queue_id;
87 void *rx_fdq[KNAV_DMA_FDQ_PER_CHAN];87 void *rx_fdq[KNAV_DMA_FDQ_PER_CHAN];
88 u32 rx_buffer_sizes[KNAV_DMA_FDQ_PER_CHAN];
89 struct napi_struct rx_napi;88 struct napi_struct rx_napi;
90 struct napi_struct tx_napi;89 struct napi_struct tx_napi;
91 90
drivers/net/ethernet/ti/netcp_core.c+13−22
@@ -34,6 +34,7 @@ · 33 unmodified lines
34#define NETCP_SOP_OFFSET (NET_IP_ALIGN + NET_SKB_PAD)34#define NETCP_SOP_OFFSET (NET_IP_ALIGN + NET_SKB_PAD)
35#define NETCP_NAPI_WEIGHT 6435#define NETCP_NAPI_WEIGHT 64
36#define NETCP_TX_TIMEOUT (5 * HZ)36#define NETCP_TX_TIMEOUT (5 * HZ)
37#define NETCP_PACKET_SIZE (ETH_FRAME_LEN + ETH_FCS_LEN)
37#define NETCP_MIN_PACKET_SIZE ETH_ZLEN38#define NETCP_MIN_PACKET_SIZE ETH_ZLEN
38#define NETCP_MAX_MCAST_ADDR 1639#define NETCP_MAX_MCAST_ADDR 16
39 40
@@ -815,30 +816,28 @@ static void netcp_allocate_rx_buf(struct netcp_intf *netcp, int fdq) · 775 unmodified lines
815 if (likely(fdq == 0)) {816 if (likely(fdq == 0)) {
816 unsigned int primary_buf_len;817 unsigned int primary_buf_len;
817 /* Allocate a primary receive queue entry */818 /* 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;
819 primary_buf_len = SKB_DATA_ALIGN(buf_len) +820 primary_buf_len = SKB_DATA_ALIGN(buf_len) +
820 SKB_DATA_ALIGN(sizeof(struct skb_shared_info));821 SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
821 822
822 if (primary_buf_len <= PAGE_SIZE) {823 bufptr = netdev_alloc_frag(primary_buf_len);
823 bufptr = netdev_alloc_frag(primary_buf_len);824 pad[1] = 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 }
830 825
831 if (unlikely(!bufptr)) {826 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");
833 goto fail;829 goto fail;
834 }830 }
835 dma = dma_map_single(netcp->dev, bufptr, buf_len,831 dma = dma_map_single(netcp->dev, bufptr, buf_len,
836 DMA_TO_DEVICE);832 DMA_TO_DEVICE);
833 if (unlikely(dma_mapping_error(netcp->dev, dma)))
834 goto fail;
835
837 pad[0] = (u32)bufptr;836 pad[0] = (u32)bufptr;
838 837
839 } else {838 } else {
840 /* Allocate a secondary receive queue entry */839 /* 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);
842 if (unlikely(!page)) {841 if (unlikely(!page)) {
843 dev_warn_ratelimited(netcp->ndev_dev, "Secondary page alloc failed\n");842 dev_warn_ratelimited(netcp->ndev_dev, "Secondary page alloc failed\n");
844 goto fail;843 goto fail;
@@ -1021,7 +1020,7 @@ netcp_tx_map_skb(struct sk_buff *skb, struct netcp_intf *netcp) · 176 unmodified lines
1021 1020
1022 /* Map the linear buffer */1021 /* Map the linear buffer */
1023 dma_addr = dma_map_single(dev, skb->data, pkt_len, DMA_TO_DEVICE);1022 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))) {
1025 dev_err(netcp->ndev_dev, "Failed to map skb buffer\n");1024 dev_err(netcp->ndev_dev, "Failed to map skb buffer\n");
1026 return NULL;1025 return NULL;
1027 }1026 }
@@ -1557,8 +1556,8 @@ static int netcp_setup_navigator_resources(struct net_device *ndev) · 529 unmodified lines
1557 knav_queue_disable_notify(netcp->rx_queue);1556 knav_queue_disable_notify(netcp->rx_queue);
1558 1557
1559 /* open Rx FDQs */1558 /* open Rx FDQs */
1560 for (i = 0; i < KNAV_DMA_FDQ_PER_CHAN &&1559 for (i = 0; i < KNAV_DMA_FDQ_PER_CHAN && netcp->rx_queue_depths[i];
1561 netcp->rx_queue_depths[i] && netcp->rx_buffer_sizes[i]; ++i) {1560 ++i) {
1562 snprintf(name, sizeof(name), "rx-fdq-%s-%d", ndev->name, i);1561 snprintf(name, sizeof(name), "rx-fdq-%s-%d", ndev->name, i);
1563 netcp->rx_fdq[i] = knav_queue_open(name, KNAV_QUEUE_GP, 0);1562 netcp->rx_fdq[i] = knav_queue_open(name, KNAV_QUEUE_GP, 0);
1564 if (IS_ERR_OR_NULL(netcp->rx_fdq[i])) {1563 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
1952 netcp->rx_queue_depths[0] = 128;1951 netcp->rx_queue_depths[0] = 128;
1953 }1952 }
1954 1953
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
1963 ret = of_property_read_u32_array(node_interface, "rx-pool", temp, 2);1954 ret = of_property_read_u32_array(node_interface, "rx-pool", temp, 2);
1964 if (ret < 0) {1955 if (ret < 0) {
1965 dev_err(dev, "missing \"rx-pool\" parameter\n");1956 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
728 dev->type = ARPHRD_AX25;728 dev->type = ARPHRD_AX25;
729 729
730 /* Perform the low-level AX25 initialization. */730 /* Perform the low-level AX25 initialization. */
731 if ((err = ax_open(ax->dev))) {731 err = ax_open(ax->dev);
732 if (err)
732 goto out_free_netdev;733 goto out_free_netdev;
733 }
734 734
735 if (register_netdev(dev))735 err = register_netdev(dev);
736 if (err)
736 goto out_free_buffers;737 goto out_free_buffers;
737 738
738 /* after register_netdev() - because else printk smashes the kernel */739 /* 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
102 102
103 netdev_dbg(ndev, "%s: %d byte payload received\n", __func__, len);103 netdev_dbg(ndev, "%s: %d byte payload received\n", __func__, len);
104 104
105 if (len < 0) {
106 ndev->stats.rx_errors++;
107 ndev->stats.rx_length_errors++;
108 goto enqueue_again;
109 }
110
105 skb_put(skb, len);111 skb_put(skb, len);
106 skb->protocol = eth_type_trans(skb, ndev);112 skb->protocol = eth_type_trans(skb, ndev);
107 skb->ip_summed = CHECKSUM_NONE;113 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
121 return;127 return;
122 }128 }
123 129
130enqueue_again:
124 rc = ntb_transport_rx_enqueue(qp, skb, skb->data, ndev->mtu + ETH_HLEN);131 rc = ntb_transport_rx_enqueue(qp, skb, skb->data, ndev->mtu + ETH_HLEN);
125 if (rc) {132 if (rc) {
126 dev_kfree_skb(skb);133 dev_kfree_skb(skb);
@@ -184,7 +191,7 @@ static int ntb_netdev_open(struct net_device *ndev) · 57 unmodified lines
184 191
185 rc = ntb_transport_rx_enqueue(dev->qp, skb, skb->data,192 rc = ntb_transport_rx_enqueue(dev->qp, skb, skb->data,
186 ndev->mtu + ETH_HLEN);193 ndev->mtu + ETH_HLEN);
187 if (rc == -EINVAL) {194 if (rc) {
188 dev_kfree_skb(skb);195 dev_kfree_skb(skb);
189 goto err;196 goto err;
190 }197 }
drivers/net/virtio_net.c+2−2
@@ -1756,9 +1756,9 @@ static int virtnet_probe(struct virtio_device *vdev) · 1755 unmodified lines
1756 /* Do we support "hardware" checksums? */1756 /* Do we support "hardware" checksums? */
1757 if (virtio_has_feature(vdev, VIRTIO_NET_F_CSUM)) {1757 if (virtio_has_feature(vdev, VIRTIO_NET_F_CSUM)) {
1758 /* This opens up the world of extra features. */1758 /* 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;
1760 if (csum)1760 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;
1762 1762
1763 if (virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) {1763 if (virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) {
1764 dev->hw_features |= NETIF_F_TSO | NETIF_F_UFO1764 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
589 chan->netdev->base_addr = chan->cosa->datareg;589 chan->netdev->base_addr = chan->cosa->datareg;
590 chan->netdev->irq = chan->cosa->irq;590 chan->netdev->irq = chan->cosa->irq;
591 chan->netdev->dma = chan->cosa->dma;591 chan->netdev->dma = chan->cosa->dma;
592 if (register_hdlc_device(chan->netdev)) {592 err = register_hdlc_device(chan->netdev);
593 if (err) {
593 netdev_warn(chan->netdev,594 netdev_warn(chan->netdev,
594 "register_hdlc_device() failed\n");595 "register_hdlc_device() failed\n");
595 free_netdev(chan->netdev);596 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
3728 switch (phy->rev) {3728 switch (phy->rev) {
3729 case 6:3729 case 6:
3730 case 5:3730 case 5:
3731 if (sprom->fem.ghz5.extpa_gain == 3)3731 if (sprom->fem.ghz2.extpa_gain == 3)
3732 return b43_ntab_tx_gain_epa_rev3_hi_pwr_2g;3732 return b43_ntab_tx_gain_epa_rev3_hi_pwr_2g;
3733 /* fall through */3733 /* fall through */
3734 case 4:3734 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
1023 cmd->scan_priority =1023 cmd->scan_priority =
1024 iwl_mvm_scan_priority(mvm, IWL_SCAN_PRIORITY_EXT_6);1024 iwl_mvm_scan_priority(mvm, IWL_SCAN_PRIORITY_EXT_6);
1025 1025
1026 if (iwl_mvm_scan_total_iterations(params) == 0)1026 if (iwl_mvm_scan_total_iterations(params) == 1)
1027 cmd->ooc_priority =1027 cmd->ooc_priority =
1028 iwl_mvm_scan_priority(mvm, IWL_SCAN_PRIORITY_EXT_6);1028 iwl_mvm_scan_priority(mvm, IWL_SCAN_PRIORITY_EXT_6);
1029 else1029 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
478 if (trans->cfg->device_family == IWL_DEVICE_FAMILY_7000)478 if (trans->cfg->device_family == IWL_DEVICE_FAMILY_7000)
479 iwl_set_bits_prph(trans, APMG_PCIDEV_STT_REG,479 iwl_set_bits_prph(trans, APMG_PCIDEV_STT_REG,
480 APMG_PCIDEV_STT_VAL_WAKE_ME);480 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);
482 iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG,484 iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG,
483 CSR_HW_IF_CONFIG_REG_PREPARE |485 CSR_HW_IF_CONFIG_REG_PREPARE |
484 CSR_HW_IF_CONFIG_REG_ENABLE_PME);486 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 }
485 mdelay(5);491 mdelay(5);
486 }492 }
487 493
@@ -575,6 +581,10 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans) · 87 unmodified lines
575 if (ret >= 0)581 if (ret >= 0)
576 return 0;582 return 0;
577 583
584 iwl_set_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG,
585 CSR_RESET_LINK_PWR_MGMT_DISABLED);
586 msleep(1);
587
578 for (iter = 0; iter < 10; iter++) {588 for (iter = 0; iter < 10; iter++) {
579 /* If HW is not ready, prepare the conditions to check again */589 /* If HW is not ready, prepare the conditions to check again */
580 iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG,590 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
582 592
583 do {593 do {
584 ret = iwl_pcie_set_hw_ready(trans);594 ret = iwl_pcie_set_hw_ready(trans);
585 if (ret >= 0)595 if (ret >= 0) {
586 return 0;596 ret = 0;
597 goto out;
598 }
587 599
588 usleep_range(200, 1000);600 usleep_range(200, 1000);
589 t += 200;601 t += 200;
@@ -593,6 +605,10 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans) · 3 unmodified lines
593 605
594 IWL_ERR(trans, "Couldn't prepare the card\n");606 IWL_ERR(trans, "Couldn't prepare the card\n");
595 607
608out:
609 iwl_clear_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG,
610 CSR_RESET_LINK_PWR_MGMT_DISABLED);
611
596 return ret;612 return ret;
597}613}
598 614
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
1875 1875
1876 /* start timer if queue currently empty */1876 /* start timer if queue currently empty */
1877 if (q->read_ptr == q->write_ptr) {1877 if (q->read_ptr == q->write_ptr) {
1878 if (txq->wd_timeout)1878 if (txq->wd_timeout) {
1879 mod_timer(&txq->stuck_timer, jiffies + 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 }
1880 IWL_DEBUG_RPM(trans, "Q: %d first tx - take ref\n", q->id);1891 IWL_DEBUG_RPM(trans, "Q: %d first tx - take ref\n", q->id);
1881 iwl_trans_pcie_ref(trans);1892 iwl_trans_pcie_ref(trans);
1882 }1893 }
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
172 (struct rsi_91x_sdiodev *)adapter->rsi_dev;172 (struct rsi_91x_sdiodev *)adapter->rsi_dev;
173 u32 len;173 u32 len;
174 u32 num_blocks;174 u32 num_blocks;
175 const u8 *fw;
175 const struct firmware *fw_entry = NULL;176 const struct firmware *fw_entry = NULL;
176 u32 block_size = dev->tx_blk_size;177 u32 block_size = dev->tx_blk_size;
177 int status = 0;178 int status = 0;
@@ -200,6 +201,10 @@ static int rsi_load_ta_instructions(struct rsi_common *common) · 22 unmodified lines
200 return status;201 return status;
201 }202 }
202 203
204 /* Copy firmware into DMA-accessible memory */
205 fw = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL);
206 if (!fw)
207 return -ENOMEM;
203 len = fw_entry->size;208 len = fw_entry->size;
204 209
205 if (len % 4)210 if (len % 4)
@@ -210,7 +215,8 @@ static int rsi_load_ta_instructions(struct rsi_common *common) · 4 unmodified lines
210 rsi_dbg(INIT_ZONE, "%s: Instruction size:%d\n", __func__, len);215 rsi_dbg(INIT_ZONE, "%s: Instruction size:%d\n", __func__, len);
211 rsi_dbg(INIT_ZONE, "%s: num blocks: %d\n", __func__, num_blocks);216 rsi_dbg(INIT_ZONE, "%s: num blocks: %d\n", __func__, num_blocks);
212 217
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);
214 release_firmware(fw_entry);220 release_firmware(fw_entry);
215 return status;221 return status;
216}222}
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
146 return status;146 return status;
147 }147 }
148 148
149 /* Copy firmware into DMA-accessible memory */
149 fw = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL);150 fw = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL);
151 if (!fw)
152 return -ENOMEM;
150 len = fw_entry->size;153 len = fw_entry->size;
151 154
152 if (len % 4)155 if (len % 4)
@@ -158,6 +161,7 @@ static int rsi_load_ta_instructions(struct rsi_common *common) · 5 unmodified lines
158 rsi_dbg(INIT_ZONE, "%s: num blocks: %d\n", __func__, num_blocks);161 rsi_dbg(INIT_ZONE, "%s: num blocks: %d\n", __func__, num_blocks);
159 162
160 status = rsi_copy_to_card(common, fw, len, num_blocks);163 status = rsi_copy_to_card(common, fw, len, num_blocks);
164 kfree(fw);
161 release_firmware(fw_entry);165 release_firmware(fw_entry);
162 return status;166 return status;
163}167}
drivers/net/wireless/rtlwifi/core.c+5−2
@@ -1015,9 +1015,12 @@ static void send_beacon_frame(struct ieee80211_hw *hw, · 1014 unmodified lines
1015{1015{
1016 struct rtl_priv *rtlpriv = rtl_priv(hw);1016 struct rtl_priv *rtlpriv = rtl_priv(hw);
1017 struct sk_buff *skb = ieee80211_beacon_get(hw, vif);1017 struct sk_buff *skb = ieee80211_beacon_get(hw, vif);
1018 struct rtl_tcb_desc tcb_desc;
1018 1019
1019 if (skb)1020 if (skb) {
1020 rtlpriv->intf_ops->adapter_tx(hw, NULL, skb, NULL);1021 memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc));
1022 rtlpriv->intf_ops->adapter_tx(hw, NULL, skb, &tcb_desc);
1023 }
1021}1024}
1022 1025
1023static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,1026static 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
385module_param_named(ips, rtl8723be_mod_params.inactiveps, bool, 0444);385module_param_named(ips, rtl8723be_mod_params.inactiveps, bool, 0444);
386module_param_named(swlps, rtl8723be_mod_params.swctrl_lps, bool, 0444);386module_param_named(swlps, rtl8723be_mod_params.swctrl_lps, bool, 0444);
387module_param_named(fwlps, rtl8723be_mod_params.fwctrl_lps, bool, 0444);387module_param_named(fwlps, rtl8723be_mod_params.fwctrl_lps, bool, 0444);
388module_param_named(msi, rtl8723be_mod_params.msi_support, bool, 0444);
388module_param_named(disable_watchdog, rtl8723be_mod_params.disable_watchdog,389module_param_named(disable_watchdog, rtl8723be_mod_params.disable_watchdog,
389 bool, 0444);390 bool, 0444);
390MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n");391MODULE_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
61void xenvif_skb_zerocopy_complete(struct xenvif_queue *queue)61void xenvif_skb_zerocopy_complete(struct xenvif_queue *queue)
62{62{
63 atomic_dec(&queue->inflight_packets);63 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);
64}70}
65 71
66int xenvif_schedulable(struct xenvif *vif)72int 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
810static struct gnttab_map_grant_ref *xenvif_get_requests(struct xenvif_queue *queue,810static struct gnttab_map_grant_ref *xenvif_get_requests(struct xenvif_queue *queue,
811 struct sk_buff *skb,811 struct sk_buff *skb,
812 struct xen_netif_tx_request *txp,812 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)
814{816{
815 struct skb_shared_info *shinfo = skb_shinfo(skb);817 struct skb_shared_info *shinfo = skb_shinfo(skb);
816 skb_frag_t *frags = shinfo->frags;818 skb_frag_t *frags = shinfo->frags;
817 u16 pending_idx = XENVIF_TX_CB(skb)->pending_idx;819 u16 pending_idx = XENVIF_TX_CB(skb)->pending_idx;
818 int start;820 int start;
819 pending_ring_idx_t index;821 pending_ring_idx_t index;
820 unsigned int nr_slots, frag_overflow = 0;822 unsigned int nr_slots;
821 823
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 }
830 nr_slots = shinfo->nr_frags;824 nr_slots = shinfo->nr_frags;
831 825
832 /* Skip first skb fragment if it is on same page as header fragment. */826 /* 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
841 }835 }
842 836
843 if (frag_overflow) {837 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 }
851 838
852 shinfo = skb_shinfo(nskb);839 shinfo = skb_shinfo(nskb);
853 frags = shinfo->frags;840 frags = shinfo->frags;
@@ -1175,9 +1162,10 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, · 321 unmodified lines
1175 unsigned *copy_ops,1162 unsigned *copy_ops,
1176 unsigned *map_ops)1163 unsigned *map_ops)
1177{1164{
1178 struct gnttab_map_grant_ref *gop = queue->tx_map_ops, *request_gop;1165 struct gnttab_map_grant_ref *gop = queue->tx_map_ops;
1179 struct sk_buff *skb;1166 struct sk_buff *skb, *nskb;
1180 int ret;1167 int ret;
1168 unsigned int frag_overflow;
1181 1169
1182 while (skb_queue_len(&queue->tx_queue) < budget) {1170 while (skb_queue_len(&queue->tx_queue) < budget) {
1183 struct xen_netif_tx_request txreq;1171 struct xen_netif_tx_request txreq;
@@ -1265,6 +1253,29 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, · 81 unmodified lines
1265 break;1253 break;
1266 }1254 }
1267 1255
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
1268 if (extras[XEN_NETIF_EXTRA_TYPE_GSO - 1].type) {1279 if (extras[XEN_NETIF_EXTRA_TYPE_GSO - 1].type) {
1269 struct xen_netif_extra_info *gso;1280 struct xen_netif_extra_info *gso;
1270 gso = &extras[XEN_NETIF_EXTRA_TYPE_GSO - 1];1281 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
1272 if (xenvif_set_skb_gso(queue->vif, skb, gso)) {1283 if (xenvif_set_skb_gso(queue->vif, skb, gso)) {
1273 /* Failure in xenvif_set_skb_gso is fatal. */1284 /* Failure in xenvif_set_skb_gso is fatal. */
1274 kfree_skb(skb);1285 kfree_skb(skb);
1286 kfree_skb(nskb);
1275 break;1287 break;
1276 }1288 }
1277 }1289 }
@@ -1294,9 +1306,7 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, · 16 unmodified lines
1294 1306
1295 (*copy_ops)++;1307 (*copy_ops)++;
1296 1308
1297 skb_shinfo(skb)->nr_frags = ret;
1298 if (data_len < txreq.size) {1309 if (data_len < txreq.size) {
1299 skb_shinfo(skb)->nr_frags++;
1300 frag_set_pending_idx(&skb_shinfo(skb)->frags[0],1310 frag_set_pending_idx(&skb_shinfo(skb)->frags[0],
1301 pending_idx);1311 pending_idx);
1302 xenvif_tx_create_map_op(queue, pending_idx, &txreq, gop);1312 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
1310 1320
1311 queue->pending_cons++;1321 queue->pending_cons++;
1312 1322
1313 request_gop = xenvif_get_requests(queue, skb, txfrags, gop);1323 gop = xenvif_get_requests(queue, skb, txfrags, gop,
1314 if (request_gop == NULL) {1324 frag_overflow, nskb);
1315 kfree_skb(skb);
1316 xenvif_tx_err(queue, &txreq, idx);
1317 break;
1318 }
1319 gop = request_gop;
1320 1325
1321 __skb_queue_tail(&queue->tx_queue, skb);1326 __skb_queue_tail(&queue->tx_queue, skb);
1322 1327
@@ -1536,7 +1541,6 @@ void xenvif_zerocopy_callback(struct ubuf_info *ubuf, bool zerocopy_success) · 213 unmodified lines
1536 smp_wmb();1541 smp_wmb();
1537 queue->dealloc_prod++;1542 queue->dealloc_prod++;
1538 } while (ubuf);1543 } while (ubuf);
1539 wake_up(&queue->dealloc_wq);
1540 spin_unlock_irqrestore(&queue->callback_lock, flags);1544 spin_unlock_irqrestore(&queue->callback_lock, flags);
1541 1545
1542 if (likely(zerocopy_success))1546 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
114 ntb->dev.bus = &ntb_bus;114 ntb->dev.bus = &ntb_bus;
115 ntb->dev.parent = &ntb->pdev->dev;115 ntb->dev.parent = &ntb->pdev->dev;
116 ntb->dev.release = ntb_dev_release;116 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));
118 118
119 ntb->ctx = NULL;119 ntb->ctx = NULL;
120 ntb->ctx_ops = NULL;120 ntb->ctx_ops = NULL;
drivers/ntb/ntb_transport.c+124−77
@@ -142,10 +142,11 @@ struct ntb_transport_qp { · 141 unmodified lines
142 142
143 void (*rx_handler)(struct ntb_transport_qp *qp, void *qp_data,143 void (*rx_handler)(struct ntb_transport_qp *qp, void *qp_data,
144 void *data, int len);144 void *data, int len);
145 struct list_head rx_post_q;
145 struct list_head rx_pend_q;146 struct list_head rx_pend_q;
146 struct list_head rx_free_q;147 struct list_head rx_free_q;
147 spinlock_t ntb_rx_pend_q_lock;148 /* ntb_rx_q_lock: synchronize access to rx_XXXX_q */
148 spinlock_t ntb_rx_free_q_lock;149 spinlock_t ntb_rx_q_lock;
149 void *rx_buff;150 void *rx_buff;
150 unsigned int rx_index;151 unsigned int rx_index;
151 unsigned int rx_max_entry;152 unsigned int rx_max_entry;
@@ -211,6 +212,8 @@ struct ntb_transport_ctx { · 59 unmodified lines
211 bool link_is_up;212 bool link_is_up;
212 struct delayed_work link_work;213 struct delayed_work link_work;
213 struct work_struct link_cleanup;214 struct work_struct link_cleanup;
215
216 struct dentry *debugfs_node_dir;
214};217};
215 218
216enum {219enum {
@@ -436,13 +439,17 @@ static ssize_t debugfs_read(struct file *filp, char __user *ubuf, size_t count, · 219 unmodified lines
436 char *buf;439 char *buf;
437 ssize_t ret, out_offset, out_count;440 ssize_t ret, out_offset, out_count;
438 441
442 qp = filp->private_data;
443
444 if (!qp || !qp->link_is_up)
445 return 0;
446
439 out_count = 1000;447 out_count = 1000;
440 448
441 buf = kmalloc(out_count, GFP_KERNEL);449 buf = kmalloc(out_count, GFP_KERNEL);
442 if (!buf)450 if (!buf)
443 return -ENOMEM;451 return -ENOMEM;
444 452
445 qp = filp->private_data;
446 out_offset = 0;453 out_offset = 0;
447 out_offset += snprintf(buf + out_offset, out_count - out_offset,454 out_offset += snprintf(buf + out_offset, out_count - out_offset,
448 "NTB QP stats\n");455 "NTB QP stats\n");
@@ -534,6 +541,27 @@ out: · 85 unmodified lines
534 return entry;541 return entry;
535}542}
536 543
544static 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
537static int ntb_transport_setup_qp_mw(struct ntb_transport_ctx *nt,565static int ntb_transport_setup_qp_mw(struct ntb_transport_ctx *nt,
538 unsigned int qp_num)566 unsigned int qp_num)
539{567{
@@ -601,13 +629,16 @@ static void ntb_free_mw(struct ntb_transport_ctx *nt, int num_mw) · 61 unmodified lines
601}629}
602 630
603static int ntb_set_mw(struct ntb_transport_ctx *nt, int num_mw,631static int ntb_set_mw(struct ntb_transport_ctx *nt, int num_mw,
604 unsigned int size)632 resource_size_t size)
605{633{
606 struct ntb_transport_mw *mw = &nt->mw_vec[num_mw];634 struct ntb_transport_mw *mw = &nt->mw_vec[num_mw];
607 struct pci_dev *pdev = nt->ndev->pdev;635 struct pci_dev *pdev = nt->ndev->pdev;
608 unsigned int xlat_size, buff_size;636 size_t xlat_size, buff_size;
609 int rc;637 int rc;
610 638
639 if (!size)
640 return -EINVAL;
641
611 xlat_size = round_up(size, mw->xlat_align_size);642 xlat_size = round_up(size, mw->xlat_align_size);
612 buff_size = round_up(size, mw->xlat_align);643 buff_size = round_up(size, mw->xlat_align);
613 644
@@ -627,7 +658,7 @@ static int ntb_set_mw(struct ntb_transport_ctx *nt, int num_mw, · 13 unmodified lines
627 if (!mw->virt_addr) {658 if (!mw->virt_addr) {
628 mw->xlat_size = 0;659 mw->xlat_size = 0;
629 mw->buff_size = 0;660 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",
631 buff_size);662 buff_size);
632 return -ENOMEM;663 return -ENOMEM;
633 }664 }
@@ -867,6 +898,8 @@ static void ntb_qp_link_work(struct work_struct *work) · 233 unmodified lines
867 898
868 if (qp->event_handler)899 if (qp->event_handler)
869 qp->event_handler(qp->cb_data, qp->link_is_up);900 qp->event_handler(qp->cb_data, qp->link_is_up);
901
902 tasklet_schedule(&qp->rxc_db_work);
870 } else if (nt->link_is_up)903 } else if (nt->link_is_up)
871 schedule_delayed_work(&qp->link_work,904 schedule_delayed_work(&qp->link_work,
872 msecs_to_jiffies(NTB_LINK_DOWN_TIMEOUT));905 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
923 qp->tx_max_frame = min(transport_mtu, tx_size / 2);956 qp->tx_max_frame = min(transport_mtu, tx_size / 2);
924 qp->tx_max_entry = tx_size / qp->tx_max_frame;957 qp->tx_max_entry = tx_size / qp->tx_max_frame;
925 958
926 if (nt_debugfs_dir) {959 if (nt->debugfs_node_dir) {
927 char debugfs_name[4];960 char debugfs_name[4];
928 961
929 snprintf(debugfs_name, 4, "qp%d", qp_num);962 snprintf(debugfs_name, 4, "qp%d", qp_num);
930 qp->debugfs_dir = debugfs_create_dir(debugfs_name,963 qp->debugfs_dir = debugfs_create_dir(debugfs_name,
931 nt_debugfs_dir);964 nt->debugfs_node_dir);
932 965
933 qp->debugfs_stats = debugfs_create_file("stats", S_IRUSR,966 qp->debugfs_stats = debugfs_create_file("stats", S_IRUSR,
934 qp->debugfs_dir, qp,967 qp->debugfs_dir, qp,
@@ -941,10 +974,10 @@ static int ntb_transport_init_queue(struct ntb_transport_ctx *nt, · 6 unmodified lines
941 INIT_DELAYED_WORK(&qp->link_work, ntb_qp_link_work);974 INIT_DELAYED_WORK(&qp->link_work, ntb_qp_link_work);
942 INIT_WORK(&qp->link_cleanup, ntb_qp_link_cleanup_work);975 INIT_WORK(&qp->link_cleanup, ntb_qp_link_cleanup_work);
943 976
944 spin_lock_init(&qp->ntb_rx_pend_q_lock);977 spin_lock_init(&qp->ntb_rx_q_lock);
945 spin_lock_init(&qp->ntb_rx_free_q_lock);
946 spin_lock_init(&qp->ntb_tx_free_q_lock);978 spin_lock_init(&qp->ntb_tx_free_q_lock);
947 979
980 INIT_LIST_HEAD(&qp->rx_post_q);
948 INIT_LIST_HEAD(&qp->rx_pend_q);981 INIT_LIST_HEAD(&qp->rx_pend_q);
949 INIT_LIST_HEAD(&qp->rx_free_q);982 INIT_LIST_HEAD(&qp->rx_free_q);
950 INIT_LIST_HEAD(&qp->tx_free_q);983 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
1031 goto err2;1064 goto err2;
1032 }1065 }
1033 1066
1067 if (nt_debugfs_dir) {
1068 nt->debugfs_node_dir =
1069 debugfs_create_dir(pci_name(ndev->pdev),
1070 nt_debugfs_dir);
1071 }
1072
1034 for (i = 0; i < qp_count; i++) {1073 for (i = 0; i < qp_count; i++) {
1035 rc = ntb_transport_init_queue(nt, i);1074 rc = ntb_transport_init_queue(nt, i);
1036 if (rc)1075 if (rc)
@@ -1107,22 +1146,47 @@ static void ntb_transport_free(struct ntb_client *self, struct ntb_dev *ndev) · 70 unmodified lines
1107 kfree(nt);1146 kfree(nt);
1108}1147}
1109 1148
1110static void ntb_rx_copy_callback(void *data)1149static void ntb_complete_rxc(struct ntb_transport_qp *qp)
1111{1150{
1112 struct ntb_queue_entry *entry = data;1151 struct ntb_queue_entry *entry;
1113 struct ntb_transport_qp *qp = entry->qp;1152 void *cb_data;
1114 void *cb_data = entry->cb_data;1153 unsigned int len;
1115 unsigned int len = entry->len;1154 unsigned long irqflags;
1116 struct ntb_payload_header *hdr = entry->rx_hdr;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);
1117 1166
1118 hdr->flags = 0;1167 cb_data = entry->cb_data;
1168 len = entry->len;
1119 1169
1120 iowrite32(entry->index, &qp->rx_info->entry);1170 list_move_tail(&entry->entry, &qp->rx_free_q);
1121 1171
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);
1123 1173
1124 if (qp->rx_handler && qp->client_ready)1174 if (qp->rx_handler && qp->client_ready)
1125 qp->rx_handler(qp, qp->cb_data, cb_data, len);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
1183static 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);
1126}1190}
1127 1191
1128static void ntb_memcpy_rx(struct ntb_queue_entry *entry, void *offset)1192static 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
1138 ntb_rx_copy_callback(entry);1202 ntb_rx_copy_callback(entry);
1139}1203}
1140 1204
1141static void ntb_async_rx(struct ntb_queue_entry *entry, void *offset,1205static void ntb_async_rx(struct ntb_queue_entry *entry, void *offset)
1142 size_t len)
1143{1206{
1144 struct dma_async_tx_descriptor *txd;1207 struct dma_async_tx_descriptor *txd;
1145 struct ntb_transport_qp *qp = entry->qp;1208 struct ntb_transport_qp *qp = entry->qp;
1146 struct dma_chan *chan = qp->dma_chan;1209 struct dma_chan *chan = qp->dma_chan;
1147 struct dma_device *device;1210 struct dma_device *device;
1148 size_t pay_off, buff_off;1211 size_t pay_off, buff_off, len;
1149 struct dmaengine_unmap_data *unmap;1212 struct dmaengine_unmap_data *unmap;
1150 dma_cookie_t cookie;1213 dma_cookie_t cookie;
1151 void *buf = entry->buf;1214 void *buf = entry->buf;
1152 1215
1153 entry->len = len;1216 len = entry->len;
1154 1217
1155 if (!chan)1218 if (!chan)
1156 goto err;1219 goto err;
@@ -1226,7 +1289,6 @@ static int ntb_process_rxc(struct ntb_transport_qp *qp) · 69 unmodified lines
1226 struct ntb_payload_header *hdr;1289 struct ntb_payload_header *hdr;
1227 struct ntb_queue_entry *entry;1290 struct ntb_queue_entry *entry;
1228 void *offset;1291 void *offset;
1229 int rc;
1230 1292
1231 offset = qp->rx_buff + qp->rx_max_frame * qp->rx_index;1293 offset = qp->rx_buff + qp->rx_max_frame * qp->rx_index;
1232 hdr = offset + qp->rx_max_frame - sizeof(struct ntb_payload_header);1294 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
1255 return -EIO;1317 return -EIO;
1256 }1318 }
1257 1319
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);
1259 if (!entry) {1321 if (!entry) {
1260 dev_dbg(&qp->ndev->pdev->dev, "no receive buffer\n");1322 dev_dbg(&qp->ndev->pdev->dev, "no receive buffer\n");
1261 qp->rx_err_no_buf++;1323 qp->rx_err_no_buf++;
1262 1324 return -EAGAIN;
1263 rc = -ENOMEM;
1264 goto err;
1265 }1325 }
1266 1326
1327 entry->rx_hdr = hdr;
1328 entry->index = qp->rx_index;
1329
1267 if (hdr->len > entry->len) {1330 if (hdr->len > entry->len) {
1268 dev_dbg(&qp->ndev->pdev->dev,1331 dev_dbg(&qp->ndev->pdev->dev,
1269 "receive buffer overflow! Wanted %d got %d\n",1332 "receive buffer overflow! Wanted %d got %d\n",
1270 hdr->len, entry->len);1333 hdr->len, entry->len);
1271 qp->rx_err_oflow++;1334 qp->rx_err_oflow++;
1272 1335
1273 rc = -EIO;1336 entry->len = -EIO;
1274 goto err;1337 entry->flags |= DESC_DONE_FLAG;
1275 }
1276 1338
1277 dev_dbg(&qp->ndev->pdev->dev,1339 ntb_complete_rxc(qp);
1278 "RX OK index %u ver %u size %d into buf size %d\n",1340 } else {
1279 qp->rx_index, hdr->ver, hdr->len, entry->len);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);
1280 1344
1281 qp->rx_bytes += hdr->len;1345 qp->rx_bytes += hdr->len;
1282 qp->rx_pkts++;1346 qp->rx_pkts++;
1283 1347
1284 entry->index = qp->rx_index;1348 entry->len = hdr->len;
1285 entry->rx_hdr = hdr;
1286 1349
1287 ntb_async_rx(entry, offset, hdr->len);1350 ntb_async_rx(entry, offset);
1351 }
1288 1352
1289 qp->rx_index++;1353 qp->rx_index++;
1290 qp->rx_index %= qp->rx_max_entry;1354 qp->rx_index %= qp->rx_max_entry;
1291 1355
1292 return 0;1356 return 0;
1293
1294err:
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;
1317}1357}
1318 1358
1319static void ntb_transport_rxc_db(unsigned long data)1359static void ntb_transport_rxc_db(unsigned long data)
@@ -1333,7 +1373,7 @@ static void ntb_transport_rxc_db(unsigned long data) · 13 unmodified lines
1333 break;1373 break;
1334 }1374 }
1335 1375
1336 if (qp->dma_chan)1376 if (i && qp->dma_chan)
1337 dma_async_issue_pending(qp->dma_chan);1377 dma_async_issue_pending(qp->dma_chan);
1338 1378
1339 if (i == qp->rx_max_entry) {1379 if (i == qp->rx_max_entry) {
@@ -1609,7 +1649,7 @@ ntb_transport_create_queue(void *data, struct device *client_dev, · 269 unmodified lines
1609 goto err1;1649 goto err1;
1610 1650
1611 entry->qp = qp;1651 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,
1613 &qp->rx_free_q);1653 &qp->rx_free_q);
1614 }1654 }
1615 1655
@@ -1634,7 +1674,7 @@ err2: · 18 unmodified lines
1634 while ((entry = ntb_list_rm(&qp->ntb_tx_free_q_lock, &qp->tx_free_q)))1674 while ((entry = ntb_list_rm(&qp->ntb_tx_free_q_lock, &qp->tx_free_q)))
1635 kfree(entry);1675 kfree(entry);
1636err1:1676err1:
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)))
1638 kfree(entry);1678 kfree(entry);
1639 if (qp->dma_chan)1679 if (qp->dma_chan)
1640 dma_release_channel(qp->dma_chan);1680 dma_release_channel(qp->dma_chan);
@@ -1652,7 +1692,6 @@ EXPORT_SYMBOL_GPL(ntb_transport_create_queue); · 11 unmodified lines
1652 */1692 */
1653void ntb_transport_free_queue(struct ntb_transport_qp *qp)1693void ntb_transport_free_queue(struct ntb_transport_qp *qp)
1654{1694{
1655 struct ntb_transport_ctx *nt = qp->transport;
1656 struct pci_dev *pdev;1695 struct pci_dev *pdev;
1657 struct ntb_queue_entry *entry;1696 struct ntb_queue_entry *entry;
1658 u64 qp_bit;1697 u64 qp_bit;
@@ -1689,18 +1728,23 @@ void ntb_transport_free_queue(struct ntb_transport_qp *qp) · 30 unmodified lines
1689 qp->tx_handler = NULL;1728 qp->tx_handler = NULL;
1690 qp->event_handler = NULL;1729 qp->event_handler = NULL;
1691 1730
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)))
1693 kfree(entry);1732 kfree(entry);
1694 1733
1695 while ((entry = ntb_list_rm(&qp->ntb_rx_pend_q_lock, &qp->rx_pend_q))) {1734 while ((entry = ntb_list_rm(&qp->ntb_rx_q_lock, &qp->rx_pend_q))) {
1696 dev_warn(&pdev->dev, "Freeing item from a non-empty queue\n");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");
1697 kfree(entry);1741 kfree(entry);
1698 }1742 }
1699 1743
1700 while ((entry = ntb_list_rm(&qp->ntb_tx_free_q_lock, &qp->tx_free_q)))1744 while ((entry = ntb_list_rm(&qp->ntb_tx_free_q_lock, &qp->tx_free_q)))
1701 kfree(entry);1745 kfree(entry);
1702 1746
1703 nt->qp_bitmap_free |= qp_bit;1747 qp->transport->qp_bitmap_free |= qp_bit;
1704 1748
1705 dev_info(&pdev->dev, "NTB Transport QP %d freed\n", qp->qp_num);1749 dev_info(&pdev->dev, "NTB Transport QP %d freed\n", qp->qp_num);
1706}1750}
@@ -1724,14 +1768,14 @@ void *ntb_transport_rx_remove(struct ntb_transport_qp *qp, unsigned int *len) · 17 unmodified lines
1724 if (!qp || qp->client_ready)1768 if (!qp || qp->client_ready)
1725 return NULL;1769 return NULL;
1726 1770
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);
1728 if (!entry)1772 if (!entry)
1729 return NULL;1773 return NULL;
1730 1774
1731 buf = entry->cb_data;1775 buf = entry->cb_data;
1732 *len = entry->len;1776 *len = entry->len;
1733 1777
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);
1735 1779
1736 return buf;1780 return buf;
1737}1781}
@@ -1757,15 +1801,18 @@ int ntb_transport_rx_enqueue(struct ntb_transport_qp *qp, void *cb, void *data, · 19 unmodified lines
1757 if (!qp)1801 if (!qp)
1758 return -EINVAL;1802 return -EINVAL;
1759 1803
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);
1761 if (!entry)1805 if (!entry)
1762 return -ENOMEM;1806 return -ENOMEM;
1763 1807
1764 entry->cb_data = cb;1808 entry->cb_data = cb;
1765 entry->buf = data;1809 entry->buf = data;
1766 entry->len = len;1810 entry->len = len;
1811 entry->flags = 0;
1812
1813 ntb_list_add(&qp->ntb_rx_q_lock, &entry->entry, &qp->rx_pend_q);
1767 1814
1768 ntb_list_add(&qp->ntb_rx_pend_q_lock, &entry->entry, &qp->rx_pend_q);1815 tasklet_schedule(&qp->rxc_db_work);
1769 1816
1770 return 0;1817 return 0;
1771}1818}
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
212 212
213 sun4i_usb_phy_write(phy, PHY_SQUELCH_DETECT, enabled ? 0 : 2, 2);213 sun4i_usb_phy_write(phy, PHY_SQUELCH_DETECT, enabled ? 0 : 2, 2);
214}214}
215EXPORT_SYMBOL_GPL(sun4i_usb_phy_set_squelch_detect);
215 216
216static struct phy_ops sun4i_usb_phy_ops = {217static struct phy_ops sun4i_usb_phy_ops = {
217 .init = sun4i_usb_phy_init,218 .init = sun4i_usb_phy_init,
drivers/phy/phy-ti-pipe3.c+55−6
@@ -28,6 +28,8 @@ · 27 unmodified lines
28#include <linux/delay.h>28#include <linux/delay.h>
29#include <linux/phy/omap_control_phy.h>29#include <linux/phy/omap_control_phy.h>
30#include <linux/of_platform.h>30#include <linux/of_platform.h>
31#include <linux/mfd/syscon.h>
32#include <linux/regmap.h>
31 33
32#define PLL_STATUS 0x0000000434#define PLL_STATUS 0x00000004
33#define PLL_GO 0x0000000835#define PLL_GO 0x00000008
@@ -52,6 +54,8 @@ · 18 unmodified lines
52#define PLL_LOCK 0x254#define PLL_LOCK 0x2
53#define PLL_IDLE 0x155#define PLL_IDLE 0x1
54 56
57#define SATA_PLL_SOFT_RESET BIT(18)
58
55/*59/*
56 * This is an Empirical value that works, need to confirm the actual60 * This is an Empirical value that works, need to confirm the actual
57 * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status61 * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status
@@ -82,6 +86,9 @@ struct ti_pipe3 { · 24 unmodified lines
82 struct clk *refclk;86 struct clk *refclk;
83 struct clk *div_clk;87 struct clk *div_clk;
84 struct pipe3_dpll_map *dpll_map;88 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;
85};92};
86 93
87static struct pipe3_dpll_map dpll_map_usb[] = {94static struct pipe3_dpll_map dpll_map_usb[] = {
@@ -249,8 +256,11 @@ static int ti_pipe3_exit(struct phy *x) · 161 unmodified lines
249 u32 val;256 u32 val;
250 unsigned long timeout;257 unsigned long timeout;
251 258
252 /* SATA DPLL can't be powered down due to Errata i783 */259 /* If dpll_reset_syscon is not present we wont power down SATA DPLL
253 if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata"))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)
254 return 0;264 return 0;
255 265
256 /* PCIe doesn't have internal DPLL */266 /* PCIe doesn't have internal DPLL */
@@ -276,6 +286,14 @@ static int ti_pipe3_exit(struct phy *x) · 19 unmodified lines
276 }286 }
277 }287 }
278 288
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
279 ti_pipe3_disable_clocks(phy);297 ti_pipe3_disable_clocks(phy);
280 298
281 return 0;299 return 0;
@@ -350,6 +368,21 @@ static int ti_pipe3_probe(struct platform_device *pdev) · 68 unmodified lines
350 }368 }
351 } else {369 } else {
352 phy->wkupclk = ERR_PTR(-ENODEV);370 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 }
353 }386 }
354 387
355 if (of_device_is_compatible(node, "ti,phy-pipe3-pcie")) {388 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
402 435
403 platform_set_drvdata(pdev, phy);436 platform_set_drvdata(pdev, phy);
404 pm_runtime_enable(phy->dev);437 pm_runtime_enable(phy->dev);
405 /* Prevent auto-disable of refclk for SATA PHY due to Errata i783 */438
406 if (of_device_is_compatible(node, "ti,phy-pipe3-sata"))439 /*
407 if (!IS_ERR(phy->refclk))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)) {
408 clk_prepare_enable(phy->refclk);444 clk_prepare_enable(phy->refclk);
445 phy->sata_refclk_enabled = true;
446 }
447 }
409 448
410 generic_phy = devm_phy_create(phy->dev, NULL, &ops);449 generic_phy = devm_phy_create(phy->dev, NULL, &ops);
411 if (IS_ERR(generic_phy))450 if (IS_ERR(generic_phy))
@@ -472,8 +511,18 @@ static void ti_pipe3_disable_clocks(struct ti_pipe3 *phy) · 60 unmodified lines
472{511{
473 if (!IS_ERR(phy->wkupclk))512 if (!IS_ERR(phy->wkupclk))
474 clk_disable_unprepare(phy->wkupclk);513 clk_disable_unprepare(phy->wkupclk);
475 if (!IS_ERR(phy->refclk))514 if (!IS_ERR(phy->refclk)) {
476 clk_disable_unprepare(phy->refclk);515 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
477 if (!IS_ERR(phy->div_clk))526 if (!IS_ERR(phy->div_clk))
478 clk_disable_unprepare(phy->div_clk);527 clk_disable_unprepare(phy->div_clk);
479}528}
drivers/platform/chrome/Kconfig+0−1
@@ -4,7 +4,6 @@ · 3 unmodified lines
4 4
5menuconfig CHROME_PLATFORMS5menuconfig CHROME_PLATFORMS
6 bool "Platform support for Chrome hardware"6 bool "Platform support for Chrome hardware"
7 depends on X86 || ARM
8 ---help---7 ---help---
9 Say Y here to get to see options for platform support for8 Say Y here to get to see options for platform support for
10 various Chromebooks and Chromeboxes. This option alone does9 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
599{599{
600 struct ipr_trace_entry *trace_entry;600 struct ipr_trace_entry *trace_entry;
601 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;601 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
602 unsigned int trace_index;
602 603
603 trace_entry = &ioa_cfg->trace[atomic_add_return604 trace_index = atomic_add_return(1, &ioa_cfg->trace_index) & IPR_TRACE_INDEX_MASK;
604 (1, &ioa_cfg->trace_index)%IPR_NUM_TRACE_ENTRIES];605 trace_entry = &ioa_cfg->trace[trace_index];
605 trace_entry->time = jiffies;606 trace_entry->time = jiffies;
606 trace_entry->op_code = ipr_cmd->ioarcb.cmd_pkt.cdb[0];607 trace_entry->op_code = ipr_cmd->ioarcb.cmd_pkt.cdb[0];
607 trace_entry->type = type;608 trace_entry->type = type;
@@ -1051,10 +1052,15 @@ static void ipr_send_blocking_cmd(struct ipr_cmnd *ipr_cmd, · 443 unmodified lines
1051 1052
1052static int ipr_get_hrrq_index(struct ipr_ioa_cfg *ioa_cfg)1053static int ipr_get_hrrq_index(struct ipr_ioa_cfg *ioa_cfg)
1053{1054{
1055 unsigned int hrrq;
1056
1054 if (ioa_cfg->hrrq_num == 1)1057 if (ioa_cfg->hrrq_num == 1)
1055 return 0;1058 hrrq = 0;
1056 else1059 else {
1057 return (atomic_add_return(1, &ioa_cfg->hrrq_index) % (ioa_cfg->hrrq_num - 1)) + 1;1060 hrrq = atomic_add_return(1, &ioa_cfg->hrrq_index);
1061 hrrq = (hrrq % (ioa_cfg->hrrq_num - 1)) + 1;
1062 }
1063 return hrrq;
1058}1064}
1059 1065
1060/**1066/**
@@ -6263,21 +6269,23 @@ static void ipr_scsi_done(struct ipr_cmnd *ipr_cmd) · 5202 unmodified lines
6263 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;6269 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg;
6264 struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd;6270 struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd;
6265 u32 ioasc = be32_to_cpu(ipr_cmd->s.ioasa.hdr.ioasc);6271 u32 ioasc = be32_to_cpu(ipr_cmd->s.ioasa.hdr.ioasc);
6266 unsigned long hrrq_flags;6272 unsigned long lock_flags;
6267 6273
6268 scsi_set_resid(scsi_cmd, be32_to_cpu(ipr_cmd->s.ioasa.hdr.residual_data_len));6274 scsi_set_resid(scsi_cmd, be32_to_cpu(ipr_cmd->s.ioasa.hdr.residual_data_len));
6269 6275
6270 if (likely(IPR_IOASC_SENSE_KEY(ioasc) == 0)) {6276 if (likely(IPR_IOASC_SENSE_KEY(ioasc) == 0)) {
6271 scsi_dma_unmap(scsi_cmd);6277 scsi_dma_unmap(scsi_cmd);
6272 6278
6273 spin_lock_irqsave(ipr_cmd->hrrq->lock, hrrq_flags);6279 spin_lock_irqsave(ipr_cmd->hrrq->lock, lock_flags);
6274 list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q);6280 list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q);
6275 scsi_cmd->scsi_done(scsi_cmd);6281 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);
6277 } else {6283 } 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);
6279 ipr_erp_start(ioa_cfg, ipr_cmd);6286 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);
6281 }6289 }
6282}6290}
6283 6291
drivers/scsi/ipr.h+1−0
@@ -1486,6 +1486,7 @@ struct ipr_ioa_cfg { · 1485 unmodified lines
1486 1486
1487#define IPR_NUM_TRACE_INDEX_BITS 81487#define IPR_NUM_TRACE_INDEX_BITS 8
1488#define IPR_NUM_TRACE_ENTRIES (1 << IPR_NUM_TRACE_INDEX_BITS)1488#define IPR_NUM_TRACE_ENTRIES (1 << IPR_NUM_TRACE_INDEX_BITS)
1489#define IPR_TRACE_INDEX_MASK (IPR_NUM_TRACE_ENTRIES - 1)
1489#define IPR_TRACE_SIZE (sizeof(struct ipr_trace_entry) * IPR_NUM_TRACE_ENTRIES)1490#define IPR_TRACE_SIZE (sizeof(struct ipr_trace_entry) * IPR_NUM_TRACE_ENTRIES)
1490 char trace_start[8];1491 char trace_start[8];
1491#define IPR_TRACE_START_LABEL "trace"1492#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
944 scmd->sdb.length);944 scmd->sdb.length);
945 scmd->sdb.table.sgl = &ses->sense_sgl;945 scmd->sdb.table.sgl = &ses->sense_sgl;
946 scmd->sc_data_direction = DMA_FROM_DEVICE;946 scmd->sc_data_direction = DMA_FROM_DEVICE;
947 scmd->sdb.table.nents = 1;947 scmd->sdb.table.nents = scmd->sdb.table.orig_nents = 1;
948 scmd->cmnd[0] = REQUEST_SENSE;948 scmd->cmnd[0] = REQUEST_SENSE;
949 scmd->cmnd[4] = scmd->sdb.length;949 scmd->cmnd[4] = scmd->sdb.length;
950 scmd->cmd_len = COMMAND_SIZE(scmd->cmnd[0]);950 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
583 583
584static void scsi_free_sgtable(struct scsi_data_buffer *sdb, bool mq)584static void scsi_free_sgtable(struct scsi_data_buffer *sdb, bool mq)
585{585{
586 if (mq && sdb->table.nents <= SCSI_MAX_SG_SEGMENTS)586 if (mq && sdb->table.orig_nents <= SCSI_MAX_SG_SEGMENTS)
587 return;587 return;
588 __sg_free_table(&sdb->table, SCSI_MAX_SG_SEGMENTS, mq, scsi_sg_free);588 __sg_free_table(&sdb->table, SCSI_MAX_SG_SEGMENTS, mq, scsi_sg_free);
589}589}
@@ -597,8 +597,8 @@ static int scsi_alloc_sgtable(struct scsi_data_buffer *sdb, int nents, bool mq) · 7 unmodified lines
597 597
598 if (mq) {598 if (mq) {
599 if (nents <= SCSI_MAX_SG_SEGMENTS) {599 if (nents <= SCSI_MAX_SG_SEGMENTS) {
600 sdb->table.nents = nents;600 sdb->table.nents = sdb->table.orig_nents = nents;
601 sg_init_table(sdb->table.sgl, sdb->table.nents);601 sg_init_table(sdb->table.sgl, nents);
602 return 0;602 return 0;
603 }603 }
604 first_chunk = sdb->table.sgl;604 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
1266 if (index == das1801hc || index == das1802hc)1266 if (index == das1801hc || index == das1802hc)
1267 return board;1267 return board;
1268 index = das1801hc;1268 index = das1801hc;
1269 break;
1269 default:1270 default:
1270 dev_err(dev->class_dev,1271 dev_err(dev->class_dev,
1271 "Board model: probe returned 0x%x (unknown, please report)\n",1272 "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
40 40
41#define DEBUG_SUBSYSTEM D_OTHER41#define DEBUG_SUBSYSTEM D_OTHER
42 42
43#include <linux/unaligned/access_ok.h>43#include <asm/unaligned.h>
44 44
45#include "../include/obd_support.h"45#include "../include/obd_support.h"
46#include "../include/lustre_debug.h"46#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
1483 }1483 }
1484 }1484 }
1485 1485
1486 if (changed & BSS_CHANGED_ASSOC && priv->op_mode != NL80211_IFTYPE_AP) {1486 if (changed & (BSS_CHANGED_ASSOC | BSS_CHANGED_BEACON_INFO) &&
1487 if (conf->assoc) {1487 priv->op_mode != NL80211_IFTYPE_AP) {
1488 if (conf->assoc && conf->beacon_rate) {
1488 CARDbUpdateTSF(priv, conf->beacon_rate->hw_value,1489 CARDbUpdateTSF(priv, conf->beacon_rate->hw_value,
1489 conf->sync_tsf);1490 conf->sync_tsf);
1490 1491
drivers/thermal/hisi_thermal.c+0−1
@@ -405,7 +405,6 @@ static SIMPLE_DEV_PM_OPS(hisi_thermal_pm_ops, · 404 unmodified lines
405static struct platform_driver hisi_thermal_driver = {405static struct platform_driver hisi_thermal_driver = {
406 .driver = {406 .driver = {
407 .name = "hisi_thermal",407 .name = "hisi_thermal",
408 .owner = THIS_MODULE,
409 .pm = &hisi_thermal_pm_ops,408 .pm = &hisi_thermal_pm_ops,
410 .of_match_table = of_hisi_thermal_match,409 .of_match_table = of_hisi_thermal_match,
411 },410 },
drivers/thermal/power_allocator.c+16−10
@@ -229,7 +229,8 @@ static int allocate_power(struct thermal_zone_device *tz, · 228 unmodified lines
229 struct thermal_instance *instance;229 struct thermal_instance *instance;
230 struct power_allocator_params *params = tz->governor_data;230 struct power_allocator_params *params = tz->governor_data;
231 u32 *req_power, *max_power, *granted_power, *extra_actor_power;231 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;
233 u32 total_granted_power, power_range;234 u32 total_granted_power, power_range;
234 int i, num_actors, total_weight, ret = 0;235 int i, num_actors, total_weight, ret = 0;
235 int trip_max_desired_temperature = params->trip_max_desired_temperature;236 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
247 }248 }
248 249
249 /*250 /*
250 * We need to allocate three arrays of the same size:251 * We need to allocate five arrays of the same size:
251 * req_power, max_power and granted_power. They are going to252 * req_power, max_power, granted_power, extra_actor_power and
252 * be needed until this function returns. Allocate them all253 * weighted_req_power. They are going to be needed until this
253 * in one go to simplify the allocation and deallocation254 * function returns. Allocate them all in one go to simplify
254 * logic.255 * the allocation and deallocation logic.
255 */256 */
256 BUILD_BUG_ON(sizeof(*req_power) != sizeof(*max_power));257 BUILD_BUG_ON(sizeof(*req_power) != sizeof(*max_power));
257 BUILD_BUG_ON(sizeof(*req_power) != sizeof(*granted_power));258 BUILD_BUG_ON(sizeof(*req_power) != sizeof(*granted_power));
258 BUILD_BUG_ON(sizeof(*req_power) != sizeof(*extra_actor_power));259 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,
260 sizeof(*req_power), GFP_KERNEL);262 sizeof(*req_power), GFP_KERNEL);
261 if (!req_power) {263 if (!req_power) {
262 ret = -ENOMEM;264 ret = -ENOMEM;
@@ -266,8 +268,10 @@ static int allocate_power(struct thermal_zone_device *tz, · 3 unmodified lines
266 max_power = &req_power[num_actors];268 max_power = &req_power[num_actors];
267 granted_power = &req_power[2 * num_actors];269 granted_power = &req_power[2 * num_actors];
268 extra_actor_power = &req_power[3 * num_actors];270 extra_actor_power = &req_power[3 * num_actors];
271 weighted_req_power = &req_power[4 * num_actors];
269 272
270 i = 0;273 i = 0;
274 total_weighted_req_power = 0;
271 total_req_power = 0;275 total_req_power = 0;
272 max_allocatable_power = 0;276 max_allocatable_power = 0;
273 277
@@ -289,13 +293,14 @@ static int allocate_power(struct thermal_zone_device *tz, · 15 unmodified lines
289 else293 else
290 weight = instance->weight;294 weight = instance->weight;
291 295
292 req_power[i] = frac_to_int(weight * req_power[i]);296 weighted_req_power[i] = frac_to_int(weight * req_power[i]);
293 297
294 if (power_actor_get_max_power(cdev, tz, &max_power[i]))298 if (power_actor_get_max_power(cdev, tz, &max_power[i]))
295 continue;299 continue;
296 300
297 total_req_power += req_power[i];301 total_req_power += req_power[i];
298 max_allocatable_power += max_power[i];302 max_allocatable_power += max_power[i];
303 total_weighted_req_power += weighted_req_power[i];
299 304
300 i++;305 i++;
301 }306 }
@@ -303,8 +308,9 @@ static int allocate_power(struct thermal_zone_device *tz, · 1 unmodified line
303 power_range = pid_controller(tz, current_temp, control_temp,308 power_range = pid_controller(tz, current_temp, control_temp,
304 max_allocatable_power);309 max_allocatable_power);
305 310
306 divvy_up_power(req_power, max_power, num_actors, total_req_power,311 divvy_up_power(weighted_req_power, max_power, num_actors,
307 power_range, granted_power, extra_actor_power);312 total_weighted_req_power, power_range, granted_power,
313 extra_actor_power);
308 314
309 total_granted_power = 0;315 total_granted_power = 0;
310 i = 0;316 i = 0;
drivers/thermal/samsung/Kconfig+1−1
@@ -1,6 +1,6 @@
1config EXYNOS_THERMAL1config EXYNOS_THERMAL
2 tristate "Exynos thermal management unit driver"2 tristate "Exynos thermal management unit driver"
3 depends on OF3 depends on THERMAL_OF
4 help4 help
5 If you say yes here you get support for the TMU (Thermal Management5 If you say yes here you get support for the TMU (Thermal Management
6 Unit) driver for SAMSUNG EXYNOS series of SoCs. This driver initialises6 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
1296 1296
1297static int exynos_tmu_probe(struct platform_device *pdev)1297static int exynos_tmu_probe(struct platform_device *pdev)
1298{1298{
1299 struct exynos_tmu_platform_data *pdata;
1300 struct exynos_tmu_data *data;1299 struct exynos_tmu_data *data;
1301 int ret;1300 int ret;
1302 1301
@@ -1318,8 +1317,6 @@ static int exynos_tmu_probe(struct platform_device *pdev) · 15 unmodified lines
1318 if (ret)1317 if (ret)
1319 goto err_sensor;1318 goto err_sensor;
1320 1319
1321 pdata = data->pdata;
1322
1323 INIT_WORK(&data->irq_work, exynos_tmu_work);1320 INIT_WORK(&data->irq_work, exynos_tmu_work);
1324 1321
1325 data->clk = devm_clk_get(&pdev->dev, "tmu_apbif");1322 data->clk = devm_clk_get(&pdev->dev, "tmu_apbif");
@@ -1392,6 +1389,8 @@ err_clk_sec: · 66 unmodified lines
1392 if (!IS_ERR(data->clk_sec))1389 if (!IS_ERR(data->clk_sec))
1393 clk_unprepare(data->clk_sec);1390 clk_unprepare(data->clk_sec);
1394err_sensor:1391err_sensor:
1392 if (!IS_ERR_OR_NULL(data->regulator))
1393 regulator_disable(data->regulator);
1395 thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd);1394 thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd);
1396 1395
1397 return ret;1396 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
1333 return -ENODEV;1333 return -ENODEV;
1334 1334
1335unbind:1335unbind:
1336 device_remove_file(&tz->device, &pos->weight_attr);
1336 device_remove_file(&tz->device, &pos->attr);1337 device_remove_file(&tz->device, &pos->attr);
1337 sysfs_remove_link(&tz->device.kobj, pos->name);1338 sysfs_remove_link(&tz->device.kobj, pos->name);
1338 release_idr(&tz->idr, &tz->lock, pos->id);1339 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
1024 },1024 },
1025};1025};
1026 1026
1027module_platform_driver(ci_hdrc_driver);1027static int __init ci_hdrc_platform_register(void)
1028{
1029 ci_hdrc_host_driver_init();
1030 return platform_driver_register(&ci_hdrc_driver);
1031}
1032module_init(ci_hdrc_platform_register);
1033
1034static void __exit ci_hdrc_platform_unregister(void)
1035{
1036 platform_driver_unregister(&ci_hdrc_driver);
1037}
1038module_exit(ci_hdrc_platform_unregister);
1028 1039
1029MODULE_ALIAS("platform:ci_hdrc");1040MODULE_ALIAS("platform:ci_hdrc");
1030MODULE_LICENSE("GPL v2");1041MODULE_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
249 rdrv->name = "host";249 rdrv->name = "host";
250 ci->roles[CI_ROLE_HOST] = rdrv;250 ci->roles[CI_ROLE_HOST] = rdrv;
251 251
252 return 0;
253}
254
255void ci_hdrc_host_driver_init(void)
256{
252 ehci_init_driver(&ci_ehci_hc_driver, &ehci_ci_overrides);257 ehci_init_driver(&ci_ehci_hc_driver, &ehci_ci_overrides);
253 orig_bus_suspend = ci_ehci_hc_driver.bus_suspend;258 orig_bus_suspend = ci_ehci_hc_driver.bus_suspend;
254 ci_ehci_hc_driver.bus_suspend = ci_ehci_bus_suspend;259 ci_ehci_hc_driver.bus_suspend = ci_ehci_bus_suspend;
255
256 return 0;
257}260}
drivers/usb/chipidea/host.h+6−0
@@ -5,6 +5,7 @@ · 4 unmodified lines
5 5
6int ci_hdrc_host_init(struct ci_hdrc *ci);6int ci_hdrc_host_init(struct ci_hdrc *ci);
7void ci_hdrc_host_destroy(struct ci_hdrc *ci);7void ci_hdrc_host_destroy(struct ci_hdrc *ci);
8void ci_hdrc_host_driver_init(void);
8 9
9#else10#else
10 11
@@ -18,6 +19,11 @@ static inline void ci_hdrc_host_destroy(struct ci_hdrc *ci) · 7 unmodified lines
18 19
19}20}
20 21
22static void ci_hdrc_host_driver_init(void)
23{
24
25}
26
21#endif27#endif
22 28
23#endif /* __DRIVERS_USB_CHIPIDEA_HOST_H */29#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
699 int ret;699 int ret;
700 700
701 ret = ida_simple_get(&hidg_ida, 0, 0, GFP_KERNEL);701 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 }
702 706
703 return ret;707 return ret;
704}708}
drivers/usb/gadget/function/f_printer.c+9−1
@@ -1248,7 +1248,15 @@ static struct config_item_type printer_func_type = { · 1247 unmodified lines
1248 1248
1249static inline int gprinter_get_minor(void)1249static inline int gprinter_get_minor(void)
1250{1250{
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;
1252}1260}
1253 1261
1254static inline void gprinter_put_minor(int minor)1262static 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
1162 factor = 1000;1162 factor = 1000;
1163 } else {1163 } else {
1164 ep_desc = &hs_epin_desc;1164 ep_desc = &hs_epin_desc;
1165 factor = 125;1165 factor = 8000;
1166 }1166 }
1167 1167
1168 /* pre-compute some values for iso_complete() */1168 /* pre-compute some values for iso_complete() */
1169 uac2->p_framesize = opts->p_ssize *1169 uac2->p_framesize = opts->p_ssize *
1170 num_channels(opts->p_chmask);1170 num_channels(opts->p_chmask);
1171 rate = opts->p_srate * uac2->p_framesize;1171 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));
1173 uac2->p_pktsize = min_t(unsigned int, rate / uac2->p_interval,1173 uac2->p_pktsize = min_t(unsigned int, rate / uac2->p_interval,
1174 prm->max_psize);1174 prm->max_psize);
1175 1175
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
779 /* The current hw dequeue pointer */779 /* The current hw dequeue pointer */
780 tmp_32 = bdc_readl(bdc->regs, BDC_EPSTS0(0));780 tmp_32 = bdc_readl(bdc->regs, BDC_EPSTS0(0));
781 deq_ptr_64 = tmp_32;781 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));
783 deq_ptr_64 |= ((u64)tmp_32 << 32);783 deq_ptr_64 |= ((u64)tmp_32 << 32);
784 784
785 /* we have the dma addr of next bd that will be fetched by hardware */785 /* 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
323 323
324err3:324err3:
325 put_device(&udc->dev);325 put_device(&udc->dev);
326 device_del(&gadget->dev);
326 327
327err2:328err2:
328 put_device(&gadget->dev);329 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
1792 int size;1792 int size;
1793 int i, j, num_ports;1793 int i, j, num_ports;
1794 1794
1795 del_timer_sync(&xhci->cmd_timer);1795 if (timer_pending(&xhci->cmd_timer))
1796 del_timer_sync(&xhci->cmd_timer);
1796 1797
1797 /* Free the Event Ring Segment Table and the actual Event Ring */1798 /* Free the Event Ring Segment Table and the actual Event Ring */
1798 size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries);1799 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
82 return 0;82 return 0;
83 /* offset in TRBs */83 /* offset in TRBs */
84 segment_offset = trb - seg->trbs;84 segment_offset = trb - seg->trbs;
85 if (segment_offset > TRBS_PER_SEGMENT)85 if (segment_offset >= TRBS_PER_SEGMENT)
86 return 0;86 return 0;
87 return seg->dma + (segment_offset * sizeof(*trb));87 return seg->dma + (segment_offset * sizeof(*trb));
88}88}
drivers/usb/serial/option.c+2−0
@@ -1099,6 +1099,8 @@ static const struct usb_device_id option_ids[] = { · 1098 unmodified lines
1099 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */1099 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */
1100 { USB_DEVICE_INTERFACE_CLASS(SIERRA_VENDOR_ID, 0x68c0, 0xff),1100 { USB_DEVICE_INTERFACE_CLASS(SIERRA_VENDOR_ID, 0x68c0, 0xff),
1101 .driver_info = (kernel_ulong_t)&sierra_mc73xx_blacklist }, /* MC73xx */1101 .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 */
1102 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) },1104 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) },
1103 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },1105 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },
1104 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003),1106 { 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
145 {DEVICE_SWI(0x1199, 0x901c)}, /* Sierra Wireless EM7700 */145 {DEVICE_SWI(0x1199, 0x901c)}, /* Sierra Wireless EM7700 */
146 {DEVICE_SWI(0x1199, 0x901f)}, /* Sierra Wireless EM7355 */146 {DEVICE_SWI(0x1199, 0x901f)}, /* Sierra Wireless EM7355 */
147 {DEVICE_SWI(0x1199, 0x9040)}, /* Sierra Wireless Modem */147 {DEVICE_SWI(0x1199, 0x9040)}, /* Sierra Wireless Modem */
148 {DEVICE_SWI(0x1199, 0x9041)}, /* Sierra Wireless MC7305/MC7355 */
149 {DEVICE_SWI(0x1199, 0x9051)}, /* Netgear AirCard 340U */148 {DEVICE_SWI(0x1199, 0x9051)}, /* Netgear AirCard 340U */
150 {DEVICE_SWI(0x1199, 0x9053)}, /* Sierra Wireless Modem */149 {DEVICE_SWI(0x1199, 0x9053)}, /* Sierra Wireless Modem */
151 {DEVICE_SWI(0x1199, 0x9054)}, /* Sierra Wireless Modem */150 {DEVICE_SWI(0x1199, 0x9054)}, /* Sierra Wireless Modem */
@@ -158,6 +157,7 @@ static const struct usb_device_id id_table[] = { · 6 unmodified lines
158 {DEVICE_SWI(0x413c, 0x81a4)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */157 {DEVICE_SWI(0x413c, 0x81a4)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */
159 {DEVICE_SWI(0x413c, 0x81a8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */158 {DEVICE_SWI(0x413c, 0x81a8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */
160 {DEVICE_SWI(0x413c, 0x81a9)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */159 {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 */
161 161
162 /* Huawei devices */162 /* Huawei devices */
163 {DEVICE_HWI(0x03f0, 0x581d)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Modem (Huawei me906e) */163 {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
289 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x68AA, 0xFF, 0xFF, 0xFF),289 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x68AA, 0xFF, 0xFF, 0xFF),
290 .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist290 .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist
291 },291 },
292 { USB_DEVICE(0x1199, 0x68AB) }, /* Sierra Wireless AR8550 */
292 /* AT&T Direct IP LTE modems */293 /* AT&T Direct IP LTE modems */
293 { USB_DEVICE_AND_INTERFACE_INFO(0x0F3D, 0x68AA, 0xFF, 0xFF, 0xFF),294 { USB_DEVICE_AND_INTERFACE_INFO(0x0F3D, 0x68AA, 0xFF, 0xFF, 0xFF),
294 .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist295 .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
1306 int y;1306 int y;
1307 int c = scr_readw((u16 *) vc->vc_pos);1307 int c = scr_readw((u16 *) vc->vc_pos);
1308 1308
1309 ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms);
1310
1309 if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1)1311 if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1)
1310 return;1312 return;
1311 1313
1312 ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms);
1313 if (vc->vc_cursor_type & 0x10)1314 if (vc->vc_cursor_type & 0x10)
1314 fbcon_del_cursor_timer(info);1315 fbcon_del_cursor_timer(info);
1315 else1316 else
drivers/video/fbdev/Kconfig+1−1
@@ -298,7 +298,7 @@ config FB_ARMCLCD · 297 unmodified lines
298 298
299# Helper logic selected only by the ARM Versatile platform family.299# Helper logic selected only by the ARM Versatile platform family.
300config PLAT_VERSATILE_CLCD300config PLAT_VERSATILE_CLCD
301 def_bool ARCH_VERSATILE || ARCH_REALVIEW || ARCH_VEXPRESS301 def_bool ARCH_VERSATILE || ARCH_REALVIEW || ARCH_VEXPRESS || ARCH_INTEGRATOR
302 depends on ARM302 depends on ARM
303 depends on FB_ARMCLCD && FB=y303 depends on FB_ARMCLCD && FB=y
304 304
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
60 }60 }
61 prev = port;61 prev = port;
62 } while (of_node_cmp(port->name, "port") != 0);62 } while (of_node_cmp(port->name, "port") != 0);
63
64 of_node_put(ports);
63 }65 }
64 66
65 return port;67 return port;
@@ -94,7 +96,7 @@ struct device_node *dss_of_port_get_parent_device(struct device_node *port) · 28 unmodified lines
94 if (!port)96 if (!port)
95 return NULL;97 return NULL;
96 98
97 np = of_get_next_parent(port);99 np = of_get_parent(port);
98 100
99 for (i = 0; i < 2 && np; ++i) {101 for (i = 0; i < 2 && np; ++i) {
100 struct property *prop;102 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
653 goto err_free_dma;653 goto err_free_dma;
654 }654 }
655 655
656 ret = clk_enable(priv->clk);656 ret = clk_prepare_enable(priv->clk);
657 if (ret < 0) {657 if (ret < 0) {
658 dev_err(dev, "failed to enable clock\n");658 dev_err(dev, "failed to enable clock\n");
659 goto err_misc_deregister;659 goto err_misc_deregister;
@@ -685,7 +685,7 @@ err_misc_deregister: · 25 unmodified lines
685 misc_deregister(&priv->misc_dev);685 misc_deregister(&priv->misc_dev);
686 686
687err_disable_clk:687err_disable_clk:
688 clk_disable(priv->clk);688 clk_disable_unprepare(priv->clk);
689 689
690 return ret;690 return ret;
691}691}
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
44 index = disp->native_mode;44 index = disp->native_mode;
45 45
46 ret = videomode_from_timings(disp, vm, index);46 ret = videomode_from_timings(disp, vm, index);
47 if (ret)
48 return ret;
49 47
50 display_timings_release(disp);48 display_timings_release(disp);
51 49
52 return 0;50 return ret;
53}51}
54EXPORT_SYMBOL_GPL(of_get_videomode);52EXPORT_SYMBOL_GPL(of_get_videomode);
drivers/virtio/virtio_input.c+4−0
@@ -313,6 +313,7 @@ err_init_vq: · 312 unmodified lines
313static void virtinput_remove(struct virtio_device *vdev)313static void virtinput_remove(struct virtio_device *vdev)
314{314{
315 struct virtio_input *vi = vdev->priv;315 struct virtio_input *vi = vdev->priv;
316 void *buf;
316 unsigned long flags;317 unsigned long flags;
317 318
318 spin_lock_irqsave(&vi->lock, flags);319 spin_lock_irqsave(&vi->lock, flags);
@@ -320,6 +321,9 @@ static void virtinput_remove(struct virtio_device *vdev) · 1 unmodified line
320 spin_unlock_irqrestore(&vi->lock, flags);321 spin_unlock_irqrestore(&vi->lock, flags);
321 322
322 input_unregister_device(vi->idev);323 input_unregister_device(vi->idev);
324 vdev->config->reset(vdev);
325 while ((buf = virtqueue_detach_unused_buf(vi->sts)) != NULL)
326 kfree(buf);
323 vdev->config->del_vqs(vdev);327 vdev->config->del_vqs(vdev);
324 kfree(vi);328 kfree(vi);
325}329}
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
472}472}
473 473
474/*474/*
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.
476 * We may of course race updates of the target counts (which are protected476 * We may of course race updates of the target counts (which are protected
477 * by the balloon lock), or with changes to the Xen hard limit, but we will477 * by the balloon lock), or with changes to the Xen hard limit, but we will
478 * recover from these in time.478 * recover from these in time.
@@ -482,9 +482,10 @@ static void balloon_process(struct work_struct *work) · 3 unmodified lines
482 enum bp_state state = BP_DONE;482 enum bp_state state = BP_DONE;
483 long credit;483 long credit;
484 484
485 mutex_lock(&balloon_mutex);
486 485
487 do {486 do {
487 mutex_lock(&balloon_mutex);
488
488 credit = current_credit();489 credit = current_credit();
489 490
490 if (credit > 0) {491 if (credit > 0) {
@@ -499,17 +500,15 @@ static void balloon_process(struct work_struct *work) · 8 unmodified lines
499 500
500 state = update_schedule(state);501 state = update_schedule(state);
501 502
502#ifndef CONFIG_PREEMPT503 mutex_unlock(&balloon_mutex);
503 if (need_resched())504
504 schedule();505 cond_resched();
505#endif506
506 } while (credit && state == BP_DONE);507 } while (credit && state == BP_DONE);
507 508
508 /* Schedule more work if there is some still to be done. */509 /* Schedule more work if there is some still to be done. */
509 if (state == BP_EAGAIN)510 if (state == BP_EAGAIN)
510 schedule_delayed_work(&balloon_worker, balloon_stats.schedule_delay * HZ);511 schedule_delayed_work(&balloon_worker, balloon_stats.schedule_delay * HZ);
511
512 mutex_unlock(&balloon_mutex);
513}512}
514 513
515/* Resets the Xen limit, sets new target, and kicks off processing. */514/* 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
568 568
569 pr_debug("priv %p\n", priv);569 pr_debug("priv %p\n", priv);
570 570
571 mutex_lock(&priv->lock);
571 while (!list_empty(&priv->maps)) {572 while (!list_empty(&priv->maps)) {
572 map = list_entry(priv->maps.next, struct grant_map, next);573 map = list_entry(priv->maps.next, struct grant_map, next);
573 list_del(&map->next);574 list_del(&map->next);
574 gntdev_put_map(NULL /* already removed */, map);575 gntdev_put_map(NULL /* already removed */, map);
575 }576 }
576 WARN_ON(!list_empty(&priv->freeable_maps));577 WARN_ON(!list_empty(&priv->freeable_maps));
578 mutex_unlock(&priv->lock);
577 579
578 if (use_ptemod)580 if (use_ptemod)
579 mmu_notifier_unregister(&priv->mn, priv->mm);581 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
814 814
815 rv = xenbus_unmap_ring(dev, node->handles, node->nr_handles,815 rv = xenbus_unmap_ring(dev, node->handles, node->nr_handles,
816 addrs);816 addrs);
817 if (!rv)817 if (!rv) {
818 vunmap(vaddr);818 vunmap(vaddr);
819 free_xenballooned_pages(node->nr_handles, node->hvm.pages);
820 }
819 else821 else
820 WARN(1, "Leaking %p, size %u page(s)\n", vaddr,822 WARN(1, "Leaking %p, size %u page(s)\n", vaddr,
821 node->nr_handles);823 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
1651 /* Exclusive -> exclusive, nothing changed */1651 /* Exclusive -> exclusive, nothing changed */
1652 }1652 }
1653 }1653 }
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;
1654 if (dirty)1659 if (dirty)
1655 qgroup_dirty(fs_info, qg);1660 qgroup_dirty(fs_info, qg);
1656 }1661 }
fs/ceph/caps.c+5−17
@@ -1506,7 +1506,6 @@ static int __mark_caps_flushing(struct inode *inode, · 1505 unmodified lines
1506 1506
1507 swap(cf, ci->i_prealloc_cap_flush);1507 swap(cf, ci->i_prealloc_cap_flush);
1508 cf->caps = flushing;1508 cf->caps = flushing;
1509 cf->kick = false;
1510 1509
1511 spin_lock(&mdsc->cap_dirty_lock);1510 spin_lock(&mdsc->cap_dirty_lock);
1512 list_del_init(&ci->i_dirty_item);1511 list_del_init(&ci->i_dirty_item);
@@ -2123,8 +2122,7 @@ static void kick_flushing_capsnaps(struct ceph_mds_client *mdsc, · 610 unmodified lines
2123 2122
2124static int __kick_flushing_caps(struct ceph_mds_client *mdsc,2123static int __kick_flushing_caps(struct ceph_mds_client *mdsc,
2125 struct ceph_mds_session *session,2124 struct ceph_mds_session *session,
2126 struct ceph_inode_info *ci,2125 struct ceph_inode_info *ci)
2127 bool kick_all)
2128{2126{
2129 struct inode *inode = &ci->vfs_inode;2127 struct inode *inode = &ci->vfs_inode;
2130 struct ceph_cap *cap;2128 struct ceph_cap *cap;
@@ -2150,9 +2148,7 @@ static int __kick_flushing_caps(struct ceph_mds_client *mdsc, · 19 unmodified lines
2150 2148
2151 for (n = rb_first(&ci->i_cap_flush_tree); n; n = rb_next(n)) {2149 for (n = rb_first(&ci->i_cap_flush_tree); n; n = rb_next(n)) {
2152 cf = rb_entry(n, struct ceph_cap_flush, i_node);2150 cf = rb_entry(n, struct ceph_cap_flush, i_node);
2153 if (cf->tid < first_tid)2151 if (cf->tid >= first_tid)
2154 continue;
2155 if (kick_all || cf->kick)
2156 break;2152 break;
2157 }2153 }
2158 if (!n) {2154 if (!n) {
@@ -2161,7 +2157,6 @@ static int __kick_flushing_caps(struct ceph_mds_client *mdsc, · 2 unmodified lines
2161 }2157 }
2162 2158
2163 cf = rb_entry(n, struct ceph_cap_flush, i_node);2159 cf = rb_entry(n, struct ceph_cap_flush, i_node);
2164 cf->kick = false;
2165 2160
2166 first_tid = cf->tid + 1;2161 first_tid = cf->tid + 1;
2167 2162
@@ -2181,8 +2176,6 @@ void ceph_early_kick_flushing_caps(struct ceph_mds_client *mdsc, · 13 unmodified lines
2181{2176{
2182 struct ceph_inode_info *ci;2177 struct ceph_inode_info *ci;
2183 struct ceph_cap *cap;2178 struct ceph_cap *cap;
2184 struct ceph_cap_flush *cf;
2185 struct rb_node *n;
2186 2179
2187 dout("early_kick_flushing_caps mds%d\n", session->s_mds);2180 dout("early_kick_flushing_caps mds%d\n", session->s_mds);
2188 list_for_each_entry(ci, &session->s_cap_flushing, i_flushing_item) {2181 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
2205 if ((cap->issued & ci->i_flushing_caps) !=2198 if ((cap->issued & ci->i_flushing_caps) !=
2206 ci->i_flushing_caps) {2199 ci->i_flushing_caps) {
2207 spin_unlock(&ci->i_ceph_lock);2200 spin_unlock(&ci->i_ceph_lock);
2208 if (!__kick_flushing_caps(mdsc, session, ci, true))2201 if (!__kick_flushing_caps(mdsc, session, ci))
2209 continue;2202 continue;
2210 spin_lock(&ci->i_ceph_lock);2203 spin_lock(&ci->i_ceph_lock);
2211 }2204 }
2212 2205
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
2218 spin_unlock(&ci->i_ceph_lock);2206 spin_unlock(&ci->i_ceph_lock);
2219 }2207 }
2220}2208}
@@ -2228,7 +2216,7 @@ void ceph_kick_flushing_caps(struct ceph_mds_client *mdsc, · 7 unmodified lines
2228 2216
2229 dout("kick_flushing_caps mds%d\n", session->s_mds);2217 dout("kick_flushing_caps mds%d\n", session->s_mds);
2230 list_for_each_entry(ci, &session->s_cap_flushing, i_flushing_item) {2218 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);
2232 if (delayed) {2220 if (delayed) {
2233 spin_lock(&ci->i_ceph_lock);2221 spin_lock(&ci->i_ceph_lock);
2234 __cap_delay_requeue(mdsc, ci);2222 __cap_delay_requeue(mdsc, ci);
@@ -2261,7 +2249,7 @@ static void kick_flushing_inode_caps(struct ceph_mds_client *mdsc, · 26 unmodified lines
2261 2249
2262 spin_unlock(&ci->i_ceph_lock);2250 spin_unlock(&ci->i_ceph_lock);
2263 2251
2264 delayed = __kick_flushing_caps(mdsc, session, ci, true);2252 delayed = __kick_flushing_caps(mdsc, session, ci);
2265 if (delayed) {2253 if (delayed) {
2266 spin_lock(&ci->i_ceph_lock);2254 spin_lock(&ci->i_ceph_lock);
2267 __cap_delay_requeue(mdsc, ci);2255 __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
287 return 0;287 return 0;
288 288
289 spin_lock(&ctx->flc_lock);289 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) {
291 ++seen_fcntl;291 ++seen_fcntl;
292 if (seen_fcntl > num_fcntl_locks) {292 if (seen_fcntl > num_fcntl_locks) {
293 err = -ENOSPC;293 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
189struct ceph_cap_flush {189struct ceph_cap_flush {
190 u64 tid;190 u64 tid;
191 int caps;191 int caps;
192 bool kick;
193 struct rb_node g_node; // global192 struct rb_node g_node; // global
194 union {193 union {
195 struct rb_node i_node; // inode194 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
3442 inode_init_early();3442 inode_init_early();
3443}3443}
3444 3444
3445void __init vfs_caches_init(unsigned long mempages)3445void __init vfs_caches_init(void)
3446{3446{
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
3455 names_cachep = kmem_cache_create("names_cache", PATH_MAX, 0,3447 names_cachep = kmem_cache_create("names_cache", PATH_MAX, 0,
3456 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);3448 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
3457 3449
3458 dcache_init();3450 dcache_init();
3459 inode_init();3451 inode_init();
3460 files_init(mempages);3452 files_init();
3453 files_maxfiles_init();
3461 mnt_init();3454 mnt_init();
3462 bdev_cache_init();3455 bdev_cache_init();
3463 chrdev_init();3456 chrdev_init();
fs/file_table.c+15−9
@@ -25,6 +25,7 @@ · 24 unmodified lines
25#include <linux/hardirq.h>25#include <linux/hardirq.h>
26#include <linux/task_work.h>26#include <linux/task_work.h>
27#include <linux/ima.h>27#include <linux/ima.h>
28#include <linux/swap.h>
28 29
29#include <linux/atomic.h>30#include <linux/atomic.h>
30 31
@@ -308,19 +309,24 @@ void put_filp(struct file *file) · 277 unmodified lines
308 }309 }
309}310}
310 311
311void __init files_init(unsigned long mempages)312void __init files_init(void)
312{ 313{
313 unsigned long n;
314
315 filp_cachep = kmem_cache_create("filp", sizeof(struct file), 0,314 filp_cachep = kmem_cache_create("filp", sizeof(struct file), 0,
316 SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL);315 SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL);
316 percpu_counter_init(&nr_files, 0, GFP_KERNEL);
317}
317 318
318 /*319/*
319 * One file with associated inode and dcache is very roughly 1K.320 * One file with associated inode and dcache is very roughly 1K. Per default
320 * Per default don't use more than 10% of our memory for files. 321 * do not use more than 10% of our memory for files.
321 */ 322 */
323void __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;
322 330
323 n = (mempages * (PAGE_SIZE / 1024)) / 10;
324 files_stat.max_files = max_t(unsigned long, n, NR_FILE);331 files_stat.max_files = max_t(unsigned long, n, NR_FILE);
325 percpu_counter_init(&nr_files, 0, GFP_KERNEL);
326} 332}
fs/hugetlbfs/inode.c+2−0
@@ -1010,6 +1010,8 @@ struct file *hugetlb_file_setup(const char *name, size_t size, · 1009 unmodified lines
1010 inode = hugetlbfs_get_inode(sb, NULL, S_IFREG | S_IRWXUGO, 0);1010 inode = hugetlbfs_get_inode(sb, NULL, S_IFREG | S_IRWXUGO, 0);
1011 if (!inode)1011 if (!inode)
1012 goto out_dentry;1012 goto out_dentry;
1013 if (creat_flags == HUGETLB_SHMFS_INODE)
1014 inode->i_flags |= S_PRIVATE;
1013 1015
1014 file = ERR_PTR(-ENOMEM);1016 file = ERR_PTR(-ENOMEM);
1015 if (hugetlb_reserve_pages(inode, 0,1017 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
879 return 0;879 return 0;
880 880
881 /* Allowed if parent directory not sticky and world-writable. */881 /* Allowed if parent directory not sticky and world-writable. */
882 parent = nd->path.dentry->d_inode;882 parent = nd->inode;
883 if ((parent->i_mode & (S_ISVTX|S_IWOTH)) != (S_ISVTX|S_IWOTH))883 if ((parent->i_mode & (S_ISVTX|S_IWOTH)) != (S_ISVTX|S_IWOTH))
884 return 0;884 return 0;
885 885
@@ -1954,8 +1954,13 @@ OK: · 1068 unmodified lines
1954 continue;1954 continue;
1955 }1955 }
1956 }1956 }
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 }
1958 return -ENOTDIR;1962 return -ENOTDIR;
1963 }
1959 }1964 }
1960}1965}
1961 1966
fs/nfsd/nfs4layouts.c+1−0
@@ -212,6 +212,7 @@ nfsd4_alloc_layout_stateid(struct nfsd4_compound_state *cstate, · 211 unmodified lines
212 BUG_ON(!ls->ls_file);212 BUG_ON(!ls->ls_file);
213 213
214 if (nfsd4_layout_setlease(ls)) {214 if (nfsd4_layout_setlease(ls)) {
215 fput(ls->ls_file);
215 put_nfs4_file(fp);216 put_nfs4_file(fp);
216 kmem_cache_free(nfs4_layout_stateid_cache, ls);217 kmem_cache_free(nfs4_layout_stateid_cache, ls);
217 return NULL;218 return NULL;
fs/nfsd/nfs4state.c+6−6
@@ -4396,9 +4396,9 @@ laundromat_main(struct work_struct *laundry) · 4395 unmodified lines
4396 queue_delayed_work(laundry_wq, &nn->laundromat_work, t*HZ);4396 queue_delayed_work(laundry_wq, &nn->laundromat_work, t*HZ);
4397}4397}
4398 4398
4399static inline __be32 nfs4_check_fh(struct svc_fh *fhp, struct nfs4_ol_stateid *stp)4399static inline __be32 nfs4_check_fh(struct svc_fh *fhp, struct nfs4_stid *stp)
4400{4400{
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))
4402 return nfserr_bad_stateid;4402 return nfserr_bad_stateid;
4403 return nfs_ok;4403 return nfs_ok;
4404}4404}
@@ -4601,9 +4601,6 @@ nfs4_check_olstateid(struct svc_fh *fhp, struct nfs4_ol_stateid *ols, int flags) · 196 unmodified lines
4601{4601{
4602 __be32 status;4602 __be32 status;
4603 4603
4604 status = nfs4_check_fh(fhp, ols);
4605 if (status)
4606 return status;
4607 status = nfsd4_check_openowner_confirmed(ols);4604 status = nfsd4_check_openowner_confirmed(ols);
4608 if (status)4605 if (status)
4609 return status;4606 return status;
@@ -4690,6 +4687,9 @@ nfs4_preprocess_stateid_op(struct svc_rqst *rqstp, · 80 unmodified lines
4690 status = nfserr_bad_stateid;4687 status = nfserr_bad_stateid;
4691 break;4688 break;
4692 }4689 }
4690 if (status)
4691 goto out;
4692 status = nfs4_check_fh(fhp, s);
4693 4693
4694done:4694done:
4695 if (!status && filpp)4695 if (!status && filpp)
@@ -4798,7 +4798,7 @@ static __be32 nfs4_seqid_op_checks(struct nfsd4_compound_state *cstate, stateid_ · 102 unmodified lines
4798 status = check_stateid_generation(stateid, &stp->st_stid.sc_stateid, nfsd4_has_session(cstate));4798 status = check_stateid_generation(stateid, &stp->st_stid.sc_stateid, nfsd4_has_session(cstate));
4799 if (status)4799 if (status)
4800 return status;4800 return status;
4801 return nfs4_check_fh(current_fh, stp);4801 return nfs4_check_fh(current_fh, &stp->st_stid);
4802}4802}
4803 4803
4804/* 4804/*
fs/nfsd/nfs4xdr.c+6−5
@@ -2143,6 +2143,7 @@ nfsd4_encode_aclname(struct xdr_stream *xdr, struct svc_rqst *rqstp, · 2142 unmodified lines
2143#define WORD0_ABSENT_FS_ATTRS (FATTR4_WORD0_FS_LOCATIONS | FATTR4_WORD0_FSID | \2143#define WORD0_ABSENT_FS_ATTRS (FATTR4_WORD0_FS_LOCATIONS | FATTR4_WORD0_FSID | \
2144 FATTR4_WORD0_RDATTR_ERROR)2144 FATTR4_WORD0_RDATTR_ERROR)
2145#define WORD1_ABSENT_FS_ATTRS FATTR4_WORD1_MOUNTED_ON_FILEID2145#define WORD1_ABSENT_FS_ATTRS FATTR4_WORD1_MOUNTED_ON_FILEID
2146#define WORD2_ABSENT_FS_ATTRS 0
2146 2147
2147#ifdef CONFIG_NFSD_V4_SECURITY_LABEL2148#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
2148static inline __be322149static inline __be32
@@ -2171,7 +2172,7 @@ nfsd4_encode_security_label(struct xdr_stream *xdr, struct svc_rqst *rqstp, · 22 unmodified lines
2171{ return 0; }2172{ return 0; }
2172#endif2173#endif
2173 2174
2174static __be32 fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *rdattr_err)2175static __be32 fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *bmval2, u32 *rdattr_err)
2175{2176{
2176 /* As per referral draft: */2177 /* As per referral draft: */
2177 if (*bmval0 & ~WORD0_ABSENT_FS_ATTRS ||2178 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
2184 }2185 }
2185 *bmval0 &= WORD0_ABSENT_FS_ATTRS;2186 *bmval0 &= WORD0_ABSENT_FS_ATTRS;
2186 *bmval1 &= WORD1_ABSENT_FS_ATTRS;2187 *bmval1 &= WORD1_ABSENT_FS_ATTRS;
2188 *bmval2 &= WORD2_ABSENT_FS_ATTRS;
2187 return 0;2189 return 0;
2188}2190}
2189 2191
@@ -2246,8 +2248,7 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp, · 56 unmodified lines
2246 BUG_ON(bmval2 & ~nfsd_suppattrs2(minorversion));2248 BUG_ON(bmval2 & ~nfsd_suppattrs2(minorversion));
2247 2249
2248 if (exp->ex_fslocs.migrated) {2250 if (exp->ex_fslocs.migrated) {
2249 BUG_ON(bmval[2]);2251 status = fattr_handle_absent_fs(&bmval0, &bmval1, &bmval2, &rdattr_err);
2250 status = fattr_handle_absent_fs(&bmval0, &bmval1, &rdattr_err);
2251 if (status)2252 if (status)
2252 goto out;2253 goto out;
2253 }2254 }
@@ -2286,8 +2287,8 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp, · 32 unmodified lines
2286 }2287 }
2287 2288
2288#ifdef CONFIG_NFSD_V4_SECURITY_LABEL2289#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
2289 if ((bmval[2] & FATTR4_WORD2_SECURITY_LABEL) ||2290 if ((bmval2 & FATTR4_WORD2_SECURITY_LABEL) ||
2290 bmval[0] & FATTR4_WORD0_SUPPORTED_ATTRS) {2291 bmval0 & FATTR4_WORD0_SUPPORTED_ATTRS) {
2291 err = security_inode_getsecctx(d_inode(dentry),2292 err = security_inode_getsecctx(d_inode(dentry),
2292 &context, &contextlen);2293 &context, &contextlen);
2293 contextsupport = (err == 0);2294 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
412 unsigned int flags)412 unsigned int flags)
413{413{
414 struct fsnotify_mark *lmark, *mark;414 struct fsnotify_mark *lmark, *mark;
415 LIST_HEAD(to_free);
415 416
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 */
416 mutex_lock_nested(&group->mark_mutex, SINGLE_DEPTH_NESTING);426 mutex_lock_nested(&group->mark_mutex, SINGLE_DEPTH_NESTING);
417 list_for_each_entry_safe(mark, lmark, &group->marks_list, g_list) {427 list_for_each_entry_safe(mark, lmark, &group->marks_list, g_list) {
418 if (mark->flags & flags) {428 if (mark->flags & flags)
419 fsnotify_get_mark(mark);429 list_move(&mark->g_list, &to_free);
420 fsnotify_destroy_mark_locked(mark, group);
421 fsnotify_put_mark(mark);
422 }
423 }430 }
424 mutex_unlock(&group->mark_mutex);431 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 }
425}445}
426 446
427/*447/*
fs/ocfs2/aops.c+2−2
@@ -685,7 +685,7 @@ static int ocfs2_direct_IO_zero_extend(struct ocfs2_super *osb, · 684 unmodified lines
685 685
686 if (p_cpos && !(ext_flags & OCFS2_EXT_UNWRITTEN)) {686 if (p_cpos && !(ext_flags & OCFS2_EXT_UNWRITTEN)) {
687 u64 s = i_size_read(inode);687 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)) +
689 (do_div(s, osb->s_clustersize) >> 9);689 (do_div(s, osb->s_clustersize) >> 9);
690 690
691 ret = blkdev_issue_zeroout(osb->sb->s_bdev, sector,691 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
910 BUG_ON(!p_cpos || (ext_flags & OCFS2_EXT_UNWRITTEN));910 BUG_ON(!p_cpos || (ext_flags & OCFS2_EXT_UNWRITTEN));
911 911
912 ret = blkdev_issue_zeroout(osb->sb->s_bdev,912 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),
914 zero_len_head >> 9, GFP_NOFS, false);914 zero_len_head >> 9, GFP_NOFS, false);
915 if (ret < 0)915 if (ret < 0)
916 mlog_errno(ret);916 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
4025 osb->dc_work_sequence = osb->dc_wake_sequence;4025 osb->dc_work_sequence = osb->dc_wake_sequence;
4026 4026
4027 processed = osb->blocked_lock_count;4027 processed = osb->blocked_lock_count;
4028 while (processed) {4028 /*
4029 BUG_ON(list_empty(&osb->blocked_lock_list));4029 * blocked lock processing in this loop might call iput which can
4030 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)) {
4031 lockres = list_entry(osb->blocked_lock_list.next,4035 lockres = list_entry(osb->blocked_lock_list.next,
4032 struct ocfs2_lock_res, l_blocked_list);4036 struct ocfs2_lock_res, l_blocked_list);
4033 list_del_init(&lockres->l_blocked_list);4037 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
121 * Other callers might not initialize the si_lsb field,121 * Other callers might not initialize the si_lsb field,
122 * so check explicitly for the right codes here.122 * so check explicitly for the right codes here.
123 */123 */
124 if (kinfo->si_code == BUS_MCEERR_AR ||124 if (kinfo->si_signo == SIGBUS &&
125 kinfo->si_code == BUS_MCEERR_AO)125 (kinfo->si_code == BUS_MCEERR_AR ||
126 kinfo->si_code == BUS_MCEERR_AO))
126 err |= __put_user((short) kinfo->si_addr_lsb,127 err |= __put_user((short) kinfo->si_addr_lsb,
127 &uinfo->ssi_addr_lsb);128 &uinfo->ssi_addr_lsb);
128#endif129#endif
include/drm/drmP.h+1−1
@@ -691,7 +691,7 @@ struct drm_vblank_crtc { · 690 unmodified lines
691 struct timer_list disable_timer; /* delayed disable timer */691 struct timer_list disable_timer; /* delayed disable timer */
692 692
693 /* vblank counter, protected by dev->vblank_time_lock for writes */693 /* vblank counter, protected by dev->vblank_time_lock for writes */
694 unsigned long count;694 u32 count;
695 /* vblank timestamps, protected by dev->vblank_time_lock for writes */695 /* vblank timestamps, protected by dev->vblank_time_lock for writes */
696 struct timeval time[DRM_VBLANKTIME_RBSIZE];696 struct timeval time[DRM_VBLANKTIME_RBSIZE];
697 697
include/drm/drm_crtc_helper.h+3−0
@@ -168,6 +168,7 @@ struct drm_encoder_helper_funcs { · 167 unmodified lines
168 * @get_modes: get mode list for this connector168 * @get_modes: get mode list for this connector
169 * @mode_valid: is this mode valid on the given connector? (optional)169 * @mode_valid: is this mode valid on the given connector? (optional)
170 * @best_encoder: return the preferred encoder for this connector170 * @best_encoder: return the preferred encoder for this connector
171 * @atomic_best_encoder: atomic version of @best_encoder
171 *172 *
172 * The helper operations are called by the mid-layer CRTC helper.173 * The helper operations are called by the mid-layer CRTC helper.
173 */174 */
@@ -176,6 +177,8 @@ struct drm_connector_helper_funcs { · 2 unmodified lines
176 enum drm_mode_status (*mode_valid)(struct drm_connector *connector,177 enum drm_mode_status (*mode_valid)(struct drm_connector *connector,
177 struct drm_display_mode *mode);178 struct drm_display_mode *mode);
178 struct drm_encoder *(*best_encoder)(struct drm_connector *connector);179 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);
179};182};
180 183
181extern void drm_helper_disable_unused_functions(struct drm_device *dev);184extern void drm_helper_disable_unused_functions(struct drm_device *dev);
include/drm/drm_pciids.h+1−0
@@ -172,6 +172,7 @@ · 171 unmodified lines
172 {0x1002, 0x6610, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \172 {0x1002, 0x6610, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
173 {0x1002, 0x6611, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \173 {0x1002, 0x6611, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \
174 {0x1002, 0x6613, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \174 {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}, \
175 {0x1002, 0x6620, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \176 {0x1002, 0x6620, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
176 {0x1002, 0x6621, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \177 {0x1002, 0x6621, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
177 {0x1002, 0x6623, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \178 {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
55 55
56extern void __init inode_init(void);56extern void __init inode_init(void);
57extern void __init inode_init_early(void);57extern void __init inode_init_early(void);
58extern void __init files_init(unsigned long);58extern void __init files_init(void);
59extern void __init files_maxfiles_init(void);
59 60
60extern struct files_stat_struct files_stat;61extern struct files_stat_struct files_stat;
61extern unsigned long get_max_files(void);62extern unsigned long get_max_files(void);
@@ -2245,7 +2246,7 @@ extern int ioctl_preallocate(struct file *filp, void __user *argp); · 2183 unmodified lines
2245 2246
2246/* fs/dcache.c */2247/* fs/dcache.c */
2247extern void __init vfs_caches_init_early(void);2248extern void __init vfs_caches_init_early(void);
2248extern void __init vfs_caches_init(unsigned long);2249extern void __init vfs_caches_init(void);
2249 2250
2250extern struct kmem_cache *names_cachep;2251extern struct kmem_cache *names_cachep;
2251 2252
include/linux/page-flags.h+7−3
@@ -631,15 +631,19 @@ static inline void ClearPageSlabPfmemalloc(struct page *page) · 630 unmodified lines
631 1 << PG_private | 1 << PG_private_2 | \631 1 << PG_private | 1 << PG_private_2 | \
632 1 << PG_writeback | 1 << PG_reserved | \632 1 << PG_writeback | 1 << PG_reserved | \
633 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \633 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \
634 1 << PG_unevictable | __PG_MLOCKED | __PG_HWPOISON | \634 1 << PG_unevictable | __PG_MLOCKED | \
635 __PG_COMPOUND_LOCK)635 __PG_COMPOUND_LOCK)
636 636
637/*637/*
638 * Flags checked when a page is prepped for return by the page allocator.638 * 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,
640 * there has been a kernel bug or struct page corruption.640 * 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.
641 */644 */
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)
643 647
644#define PAGE_FLAGS_PRIVATE \648#define PAGE_FLAGS_PRIVATE \
645 (1 << PG_private | 1 << PG_private_2)649 (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
2913 *2913 *
2914 * PHY drivers may accept clones of transmitted packets for2914 * PHY drivers may accept clones of transmitted packets for
2915 * timestamping via their phy_driver.txtstamp method. These drivers2915 * timestamping via their phy_driver.txtstamp method. These drivers
2916 * must call this function to return the skb back to the stack, with2916 * must call this function to return the skb back to the stack with a
2917 * or without a timestamp.2917 * timestamp.
2918 *2918 *
2919 * @skb: clone of the the original outgoing packet2919 * @skb: clone of the the original outgoing packet
2920 * @hwtstamps: hardware time stamps, may be NULL if not available2920 * @hwtstamps: hardware time stamps
2921 *2921 *
2922 */2922 */
2923void skb_complete_tx_timestamp(struct sk_buff *skb,2923void skb_complete_tx_timestamp(struct sk_buff *skb,
include/uapi/linux/pci_regs.h+1−0
@@ -319,6 +319,7 @@ · 318 unmodified lines
319#define PCI_MSIX_PBA 8 /* Pending Bit Array offset */319#define PCI_MSIX_PBA 8 /* Pending Bit Array offset */
320#define PCI_MSIX_PBA_BIR 0x00000007 /* BAR index */320#define PCI_MSIX_PBA_BIR 0x00000007 /* BAR index */
321#define PCI_MSIX_PBA_OFFSET 0xfffffff8 /* Offset into specified BAR */321#define PCI_MSIX_PBA_OFFSET 0xfffffff8 /* Offset into specified BAR */
322#define PCI_MSIX_FLAGS_BIRMASK PCI_MSIX_PBA_BIR /* deprecated */
322#define PCI_CAP_MSIX_SIZEOF 12 /* size of MSIX registers */323#define PCI_CAP_MSIX_SIZEOF 12 /* size of MSIX registers */
323 324
324/* MSI-X Table entry format */325/* MSI-X Table entry format */
include/uapi/sound/asoc.h+24−11
@@ -77,7 +77,7 @@ · 76 unmodified lines
77#define SND_SOC_TPLG_NUM_TEXTS 1677#define SND_SOC_TPLG_NUM_TEXTS 16
78 78
79/* ABI version */79/* ABI version */
80#define SND_SOC_TPLG_ABI_VERSION 0x280#define SND_SOC_TPLG_ABI_VERSION 0x3
81 81
82/* Max size of TLV data */82/* Max size of TLV data */
83#define SND_SOC_TPLG_TLV_SIZE 3283#define SND_SOC_TPLG_TLV_SIZE 32
@@ -97,7 +97,8 @@ · 13 unmodified lines
97#define SND_SOC_TPLG_TYPE_PCM 797#define SND_SOC_TPLG_TYPE_PCM 7
98#define SND_SOC_TPLG_TYPE_MANIFEST 898#define SND_SOC_TPLG_TYPE_MANIFEST 8
99#define SND_SOC_TPLG_TYPE_CODEC_LINK 999#define SND_SOC_TPLG_TYPE_CODEC_LINK 9
100#define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_CODEC_LINK100#define SND_SOC_TPLG_TYPE_PDATA 10
101#define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_PDATA
101 102
102/* vendor block IDs - please add new vendor types to end */103/* vendor block IDs - please add new vendor types to end */
103#define SND_SOC_TPLG_TYPE_VENDOR_FW 1000104#define SND_SOC_TPLG_TYPE_VENDOR_FW 1000
@@ -137,11 +138,19 @@ struct snd_soc_tplg_private { · 33 unmodified lines
137/*138/*
138 * Kcontrol TLV data.139 * Kcontrol TLV data.
139 */140 */
141struct snd_soc_tplg_tlv_dbscale {
142 __le32 min;
143 __le32 step;
144 __le32 mute;
145} __attribute__((packed));
146
140struct snd_soc_tplg_ctl_tlv {147struct snd_soc_tplg_ctl_tlv {
141 __le32 size; /* in bytes aligned to 4 */148 __le32 size; /* in bytes of this structure */
142 __le32 numid; /* control element numeric identification */149 __le32 type; /* SNDRV_CTL_TLVT_*, type of TLV */
143 __le32 count; /* number of elem in data array */150 union {
144 __le32 data[SND_SOC_TPLG_TLV_SIZE];151 __le32 data[SND_SOC_TPLG_TLV_SIZE];
152 struct snd_soc_tplg_tlv_dbscale scale;
153 };
145} __attribute__((packed));154} __attribute__((packed));
146 155
147/*156/*
@@ -155,9 +164,11 @@ struct snd_soc_tplg_channel { · 7 unmodified lines
155} __attribute__((packed));164} __attribute__((packed));
156 165
157/*166/*
158 * Kcontrol Operations IDs167 * Genericl Operations IDs, for binding Kcontrol or Bytes ext ops
168 * Kcontrol ops need get/put/info.
169 * Bytes ext ops need get/put.
159 */170 */
160struct snd_soc_tplg_kcontrol_ops_id {171struct snd_soc_tplg_io_ops {
161 __le32 get;172 __le32 get;
162 __le32 put;173 __le32 put;
163 __le32 info;174 __le32 info;
@@ -171,8 +182,8 @@ struct snd_soc_tplg_ctl_hdr { · 7 unmodified lines
171 __le32 type;182 __le32 type;
172 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];183 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
173 __le32 access;184 __le32 access;
174 struct snd_soc_tplg_kcontrol_ops_id ops;185 struct snd_soc_tplg_io_ops ops;
175 __le32 tlv_size; /* non zero means control has TLV data */186 struct snd_soc_tplg_ctl_tlv tlv;
176} __attribute__((packed));187} __attribute__((packed));
177 188
178/*189/*
@@ -238,6 +249,7 @@ struct snd_soc_tplg_manifest { · 59 unmodified lines
238 __le32 graph_elems; /* number of graph elements */249 __le32 graph_elems; /* number of graph elements */
239 __le32 dai_elems; /* number of DAI elements */250 __le32 dai_elems; /* number of DAI elements */
240 __le32 dai_link_elems; /* number of DAI link elements */251 __le32 dai_link_elems; /* number of DAI link elements */
252 struct snd_soc_tplg_private priv;
241} __attribute__((packed));253} __attribute__((packed));
242 254
243/*255/*
@@ -259,7 +271,6 @@ struct snd_soc_tplg_mixer_control { · 15 unmodified lines
259 __le32 invert;271 __le32 invert;
260 __le32 num_channels;272 __le32 num_channels;
261 struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];273 struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];
262 struct snd_soc_tplg_ctl_tlv tlv;
263 struct snd_soc_tplg_private priv;274 struct snd_soc_tplg_private priv;
264} __attribute__((packed));275} __attribute__((packed));
265 276
@@ -303,6 +314,7 @@ struct snd_soc_tplg_bytes_control { · 37 unmodified lines
303 __le32 mask;314 __le32 mask;
304 __le32 base;315 __le32 base;
305 __le32 num_regs;316 __le32 num_regs;
317 struct snd_soc_tplg_io_ops ext_ops;
306 struct snd_soc_tplg_private priv;318 struct snd_soc_tplg_private priv;
307} __attribute__((packed));319} __attribute__((packed));
308 320
@@ -347,6 +359,7 @@ struct snd_soc_tplg_dapm_widget { · 38 unmodified lines
347 __le32 reg; /* negative reg = no direct dapm */359 __le32 reg; /* negative reg = no direct dapm */
348 __le32 shift; /* bits to shift */360 __le32 shift; /* bits to shift */
349 __le32 mask; /* non-shifted mask */361 __le32 mask; /* non-shifted mask */
362 __le32 subseq; /* sort within widget type */
350 __u32 invert; /* invert the power bit */363 __u32 invert; /* invert the power bit */
351 __u32 ignore_suspend; /* kept enabled over suspend */364 __u32 ignore_suspend; /* kept enabled over suspend */
352 __u16 event_flags;365 __u16 event_flags;
init/main.c+1−1
@@ -656,7 +656,7 @@ asmlinkage __visible void __init start_kernel(void) · 655 unmodified lines
656 key_init();656 key_init();
657 security_init();657 security_init();
658 dbg_late_init();658 dbg_late_init();
659 vfs_caches_init(totalram_pages);659 vfs_caches_init();
660 signals_init();660 signals_init();
661 /* rootfs populating might need page-writeback */661 /* rootfs populating might need page-writeback */
662 page_writeback_init();662 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
142 if (!leaf)142 if (!leaf)
143 return -ENOMEM;143 return -ENOMEM;
144 INIT_LIST_HEAD(&leaf->msg_list);144 INIT_LIST_HEAD(&leaf->msg_list);
145 info->qsize += sizeof(*leaf);
146 }145 }
147 leaf->priority = msg->m_type;146 leaf->priority = msg->m_type;
148 rb_link_node(&leaf->rb_node, parent, p);147 rb_link_node(&leaf->rb_node, parent, p);
@@ -187,7 +186,6 @@ try_again: · 38 unmodified lines
187 "lazy leaf delete!\n");186 "lazy leaf delete!\n");
188 rb_erase(&leaf->rb_node, &info->msg_tree);187 rb_erase(&leaf->rb_node, &info->msg_tree);
189 if (info->node_cache) {188 if (info->node_cache) {
190 info->qsize -= sizeof(*leaf);
191 kfree(leaf);189 kfree(leaf);
192 } else {190 } else {
193 info->node_cache = leaf;191 info->node_cache = leaf;
@@ -200,7 +198,6 @@ try_again: · 6 unmodified lines
200 if (list_empty(&leaf->msg_list)) {198 if (list_empty(&leaf->msg_list)) {
201 rb_erase(&leaf->rb_node, &info->msg_tree);199 rb_erase(&leaf->rb_node, &info->msg_tree);
202 if (info->node_cache) {200 if (info->node_cache) {
203 info->qsize -= sizeof(*leaf);
204 kfree(leaf);201 kfree(leaf);
205 } else {202 } else {
206 info->node_cache = leaf;203 info->node_cache = leaf;
@@ -1034,7 +1031,6 @@ SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr, · 827 unmodified lines
1034 /* Save our speculative allocation into the cache */1031 /* Save our speculative allocation into the cache */
1035 INIT_LIST_HEAD(&new_leaf->msg_list);1032 INIT_LIST_HEAD(&new_leaf->msg_list);
1036 info->node_cache = new_leaf;1033 info->node_cache = new_leaf;
1037 info->qsize += sizeof(*new_leaf);
1038 new_leaf = NULL;1034 new_leaf = NULL;
1039 } else {1035 } else {
1040 kfree(new_leaf);1036 kfree(new_leaf);
@@ -1142,7 +1138,6 @@ SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr, · 101 unmodified lines
1142 /* Save our speculative allocation into the cache */1138 /* Save our speculative allocation into the cache */
1143 INIT_LIST_HEAD(&new_leaf->msg_list);1139 INIT_LIST_HEAD(&new_leaf->msg_list);
1144 info->node_cache = new_leaf;1140 info->node_cache = new_leaf;
1145 info->qsize += sizeof(*new_leaf);
1146 } else {1141 } else {
1147 kfree(new_leaf);1142 kfree(new_leaf);
1148 }1143 }
ipc/shm.c+1−1
@@ -545,7 +545,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params) · 544 unmodified lines
545 if ((shmflg & SHM_NORESERVE) &&545 if ((shmflg & SHM_NORESERVE) &&
546 sysctl_overcommit_memory != OVERCOMMIT_NEVER)546 sysctl_overcommit_memory != OVERCOMMIT_NEVER)
547 acctflag = VM_NORESERVE;547 acctflag = VM_NORESERVE;
548 file = shmem_file_setup(name, size, acctflag);548 file = shmem_kernel_file_setup(name, size, acctflag);
549 }549 }
550 error = PTR_ERR(file);550 error = PTR_ERR(file);
551 if (IS_ERR(file))551 if (IS_ERR(file))
kernel/kthread.c+4−0
@@ -97,6 +97,7 @@ bool kthread_should_park(void) · 96 unmodified lines
97{97{
98 return test_bit(KTHREAD_SHOULD_PARK, &to_kthread(current)->flags);98 return test_bit(KTHREAD_SHOULD_PARK, &to_kthread(current)->flags);
99}99}
100EXPORT_SYMBOL_GPL(kthread_should_park);
100 101
101/**102/**
102 * kthread_freezable_should_stop - should this freezable kthread return now?103 * kthread_freezable_should_stop - should this freezable kthread return now?
@@ -171,6 +172,7 @@ void kthread_parkme(void) · 68 unmodified lines
171{172{
172 __kthread_parkme(to_kthread(current));173 __kthread_parkme(to_kthread(current));
173}174}
175EXPORT_SYMBOL_GPL(kthread_parkme);
174 176
175static int kthread(void *_create)177static int kthread(void *_create)
176{178{
@@ -411,6 +413,7 @@ void kthread_unpark(struct task_struct *k) · 234 unmodified lines
411 if (kthread)413 if (kthread)
412 __kthread_unpark(k, kthread);414 __kthread_unpark(k, kthread);
413}415}
416EXPORT_SYMBOL_GPL(kthread_unpark);
414 417
415/**418/**
416 * kthread_park - park a thread created by kthread_create().419 * kthread_park - park a thread created by kthread_create().
@@ -441,6 +444,7 @@ int kthread_park(struct task_struct *k) · 24 unmodified lines
441 }444 }
442 return ret;445 return ret;
443}446}
447EXPORT_SYMBOL_GPL(kthread_park);
444 448
445/**449/**
446 * kthread_stop - stop a thread created by kthread_create().450 * 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
602}602}
603EXPORT_SYMBOL_GPL(find_symbol);603EXPORT_SYMBOL_GPL(find_symbol);
604 604
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 */
606static struct module *find_module_all(const char *name, size_t len,609static struct module *find_module_all(const char *name, size_t len,
607 bool even_unformed)610 bool even_unformed)
608{611{
609 struct module *mod;612 struct module *mod;
610 613
611 module_assert_mutex();614 module_assert_mutex_or_preempt();
612 615
613 list_for_each_entry(mod, &modules, list) {616 list_for_each_entry(mod, &modules, list) {
614 if (!even_unformed && mod->state == MODULE_STATE_UNFORMED)617 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
621 624
622struct module *find_module(const char *name)625struct module *find_module(const char *name)
623{626{
627 module_assert_mutex();
624 return find_module_all(name, strlen(name), false);628 return find_module_all(name, strlen(name), false);
625}629}
626EXPORT_SYMBOL_GPL(find_module);630EXPORT_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
2748 * Other callers might not initialize the si_lsb field,2748 * Other callers might not initialize the si_lsb field,
2749 * so check explicitly for the right codes here.2749 * so check explicitly for the right codes here.
2750 */2750 */
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))
2752 err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb);2753 err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb);
2753#endif2754#endif
2754#ifdef SEGV_BNDERR2755#ifdef SEGV_BNDERR
2755 err |= __put_user(from->si_lower, &to->si_lower);2756 if (from->si_signo == SIGSEGV && from->si_code == SEGV_BNDERR) {
2756 err |= __put_user(from->si_upper, &to->si_upper);2757 err |= __put_user(from->si_lower, &to->si_lower);
2758 err |= __put_user(from->si_upper, &to->si_upper);
2759 }
2757#endif2760#endif
2758 break;2761 break;
2759 case __SI_CHLD:2762 case __SI_CHLD:
@@ -3017,7 +3020,7 @@ COMPAT_SYSCALL_DEFINE3(rt_sigqueueinfo, · 257 unmodified lines
3017 int, sig,3020 int, sig,
3018 struct compat_siginfo __user *, uinfo)3021 struct compat_siginfo __user *, uinfo)
3019{3022{
3020 siginfo_t info;3023 siginfo_t info = {};
3021 int ret = copy_siginfo_from_user32(&info, uinfo);3024 int ret = copy_siginfo_from_user32(&info, uinfo);
3022 if (unlikely(ret))3025 if (unlikely(ret))
3023 return ret;3026 return ret;
@@ -3061,7 +3064,7 @@ COMPAT_SYSCALL_DEFINE4(rt_tgsigqueueinfo, · 37 unmodified lines
3061 int, sig,3064 int, sig,
3062 struct compat_siginfo __user *, uinfo)3065 struct compat_siginfo __user *, uinfo)
3063{3066{
3064 siginfo_t info;3067 siginfo_t info = {};
3065 3068
3066 if (copy_siginfo_from_user32(&info, uinfo))3069 if (copy_siginfo_from_user32(&info, uinfo))
3067 return -EFAULT;3070 return -EFAULT;
lib/iommu-common.c+1−1
@@ -119,7 +119,7 @@ unsigned long iommu_tbl_range_alloc(struct device *dev, · 118 unmodified lines
119 unsigned long align_mask = 0;119 unsigned long align_mask = 0;
120 120
121 if (align_order > 0)121 if (align_order > 0)
122 align_mask = 0xffffffffffffffffl >> (64 - align_order);122 align_mask = ~0ul >> (BITS_PER_LONG - align_order);
123 123
124 /* Sanity check */124 /* Sanity check */
125 if (unlikely(npages == 0)) {125 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
1676 /* after clearing PageTail the gup refcount can be released */1676 /* after clearing PageTail the gup refcount can be released */
1677 smp_mb__after_atomic();1677 smp_mb__after_atomic();
1678 1678
1679 /*1679 page_tail->flags &= ~PAGE_FLAGS_CHECK_AT_PREP;
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;
1685 page_tail->flags |= (page->flags &1680 page_tail->flags |= (page->flags &
1686 ((1L << PG_referenced) |1681 ((1L << PG_referenced) |
1687 (1L << PG_swapbacked) |1682 (1L << PG_swapbacked) |
mm/memory-failure.c+18−14
@@ -909,6 +909,18 @@ int get_hwpoison_page(struct page *page) · 908 unmodified lines
909 * directly for tail pages.909 * directly for tail pages.
910 */910 */
911 if (PageTransHuge(head)) {911 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
912 if (get_page_unless_zero(head)) {924 if (get_page_unless_zero(head)) {
913 if (PageTail(page))925 if (PageTail(page))
914 get_page(page);926 get_page(page);
@@ -1134,15 +1146,6 @@ int memory_failure(unsigned long pfn, int trapno, int flags) · 219 unmodified lines
1134 }1146 }
1135 1147
1136 if (!PageHuge(p) && PageTransHuge(hpage)) {1148 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 }
1146 if (unlikely(split_huge_page(hpage))) {1149 if (unlikely(split_huge_page(hpage))) {
1147 pr_err("MCE: %#lx: thp split failed\n", pfn);1150 pr_err("MCE: %#lx: thp split failed\n", pfn);
1148 if (TestClearPageHWPoison(p))1151 if (TestClearPageHWPoison(p))
@@ -1209,9 +1212,9 @@ int memory_failure(unsigned long pfn, int trapno, int flags) · 60 unmodified lines
1209 if (!PageHWPoison(p)) {1212 if (!PageHWPoison(p)) {
1210 printk(KERN_ERR "MCE %#lx: just unpoisoned\n", pfn);1213 printk(KERN_ERR "MCE %#lx: just unpoisoned\n", pfn);
1211 atomic_long_sub(nr_pages, &num_poisoned_pages);1214 atomic_long_sub(nr_pages, &num_poisoned_pages);
1215 unlock_page(hpage);
1212 put_page(hpage);1216 put_page(hpage);
1213 res = 0;1217 return 0;
1214 goto out;
1215 }1218 }
1216 if (hwpoison_filter(p)) {1219 if (hwpoison_filter(p)) {
1217 if (TestClearPageHWPoison(p))1220 if (TestClearPageHWPoison(p))
@@ -1656,6 +1659,8 @@ static int __soft_offline_page(struct page *page, int flags) · 438 unmodified lines
1656 inc_zone_page_state(page, NR_ISOLATED_ANON +1659 inc_zone_page_state(page, NR_ISOLATED_ANON +
1657 page_is_file_cache(page));1660 page_is_file_cache(page));
1658 list_add(&page->lru, &pagelist);1661 list_add(&page->lru, &pagelist);
1662 if (!TestSetPageHWPoison(page))
1663 atomic_long_inc(&num_poisoned_pages);
1659 ret = migrate_pages(&pagelist, new_page, NULL, MPOL_MF_MOVE_ALL,1664 ret = migrate_pages(&pagelist, new_page, NULL, MPOL_MF_MOVE_ALL,
1660 MIGRATE_SYNC, MR_MEMORY_FAILURE);1665 MIGRATE_SYNC, MR_MEMORY_FAILURE);
1661 if (ret) {1666 if (ret) {
@@ -1670,9 +1675,8 @@ static int __soft_offline_page(struct page *page, int flags) · 8 unmodified lines
1670 pfn, ret, page->flags);1675 pfn, ret, page->flags);
1671 if (ret > 0)1676 if (ret > 0)
1672 ret = -EIO;1677 ret = -EIO;
1673 } else {1678 if (TestClearPageHWPoison(page))
1674 SetPageHWPoison(page);1679 atomic_long_dec(&num_poisoned_pages);
1675 atomic_long_inc(&num_poisoned_pages);
1676 }1680 }
1677 } else {1681 } else {
1678 pr_info("soft offline: %#lx: isolation failed: %d, page count %d, type %lx\n",1682 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
446 int nr_pages = PAGES_PER_SECTION;446 int nr_pages = PAGES_PER_SECTION;
447 int nid = pgdat->node_id;447 int nid = pgdat->node_id;
448 int zone_type;448 int zone_type;
449 unsigned long flags;449 unsigned long flags, pfn;
450 int ret;450 int ret;
451 451
452 zone_type = zone - pgdat->node_zones;452 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
461 pgdat_resize_unlock(zone->zone_pgdat, &flags);461 pgdat_resize_unlock(zone->zone_pgdat, &flags);
462 memmap_init_zone(nr_pages, nid, zone_type,462 memmap_init_zone(nr_pages, nid, zone_type,
463 phys_start_pfn, MEMMAP_HOTPLUG);463 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 }
464 return 0;472 return 0;
465}473}
466 474
mm/migrate.c+6−2
@@ -880,7 +880,8 @@ static int __unmap_and_move(struct page *page, struct page *newpage, · 879 unmodified lines
880 /* Establish migration ptes or remove ptes */880 /* Establish migration ptes or remove ptes */
881 if (page_mapped(page)) {881 if (page_mapped(page)) {
882 try_to_unmap(page,882 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);
884 page_was_mapped = 1;885 page_was_mapped = 1;
885 }886 }
886 887
@@ -950,7 +951,10 @@ out: · 63 unmodified lines
950 list_del(&page->lru);951 list_del(&page->lru);
951 dec_zone_page_state(page, NR_ISOLATED_ANON +952 dec_zone_page_state(page, NR_ISOLATED_ANON +
952 page_is_file_cache(page));953 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
954 putback_lru_page(page);958 putback_lru_page(page);
955 }959 }
956 960
mm/page-writeback.c+2−2
@@ -2063,10 +2063,10 @@ static struct notifier_block ratelimit_nb = { · 2062 unmodified lines
2063 */2063 */
2064void __init page_writeback_init(void)2064void __init page_writeback_init(void)
2065{2065{
2066 BUG_ON(wb_domain_init(&global_wb_domain, GFP_KERNEL));
2067
2066 writeback_set_ratelimit();2068 writeback_set_ratelimit();
2067 register_cpu_notifier(&ratelimit_nb);2069 register_cpu_notifier(&ratelimit_nb);
2068
2069 BUG_ON(wb_domain_init(&global_wb_domain, GFP_KERNEL));
2070}2070}
2071 2071
2072/**2072/**
mm/page_alloc.c+30−15
@@ -18,7 +18,6 @@ · 17 unmodified lines
18#include <linux/mm.h>18#include <linux/mm.h>
19#include <linux/swap.h>19#include <linux/swap.h>
20#include <linux/interrupt.h>20#include <linux/interrupt.h>
21#include <linux/rwsem.h>
22#include <linux/pagemap.h>21#include <linux/pagemap.h>
23#include <linux/jiffies.h>22#include <linux/jiffies.h>
24#include <linux/bootmem.h>23#include <linux/bootmem.h>
@@ -981,21 +980,21 @@ static void __init __free_pages_boot_core(struct page *page, · 956 unmodified lines
981 980
982#if defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) || \981#if defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) || \
983 defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP)982 defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP)
984/* Only safe to use early in boot when initialisation is single-threaded */983
985static struct mminit_pfnnid_cache early_pfnnid_cache __meminitdata;984static struct mminit_pfnnid_cache early_pfnnid_cache __meminitdata;
986 985
987int __meminit early_pfn_to_nid(unsigned long pfn)986int __meminit early_pfn_to_nid(unsigned long pfn)
988{987{
988 static DEFINE_SPINLOCK(early_pfn_lock);
989 int nid;989 int nid;
990 990
991 /* The system will behave unpredictably otherwise */991 spin_lock(&early_pfn_lock);
992 BUG_ON(system_state != SYSTEM_BOOTING);
993
994 nid = __early_pfn_to_nid(pfn, &early_pfnnid_cache);992 nid = __early_pfn_to_nid(pfn, &early_pfnnid_cache);
995 if (nid >= 0)993 if (nid < 0)
996 return nid;994 nid = 0;
997 /* just returns 0 */995 spin_unlock(&early_pfn_lock);
998 return 0;996
997 return nid;
999}998}
1000#endif999#endif
1001 1000
@@ -1060,7 +1059,15 @@ static void __init deferred_free_range(struct page *page, · 58 unmodified lines
1060 __free_pages_boot_core(page, pfn, 0);1059 __free_pages_boot_core(page, pfn, 0);
1061}1060}
1062 1061
1063static __initdata DECLARE_RWSEM(pgdat_init_rwsem);1062/* Completion tracking for deferred_init_memmap() threads */
1063static atomic_t pgdat_init_n_undone __initdata;
1064static __initdata DECLARE_COMPLETION(pgdat_init_all_done_comp);
1065
1066static 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}
1064 1071
1065/* Initialise remaining memory on a node */1072/* Initialise remaining memory on a node */
1066static int __init deferred_init_memmap(void *data)1073static int __init deferred_init_memmap(void *data)
@@ -1077,7 +1084,7 @@ static int __init deferred_init_memmap(void *data) · 10 unmodified lines
1077 const struct cpumask *cpumask = cpumask_of_node(pgdat->node_id);1084 const struct cpumask *cpumask = cpumask_of_node(pgdat->node_id);
1078 1085
1079 if (first_init_pfn == ULONG_MAX) {1086 if (first_init_pfn == ULONG_MAX) {
1080 up_read(&pgdat_init_rwsem);1087 pgdat_init_report_one_done();
1081 return 0;1088 return 0;
1082 }1089 }
1083 1090
@@ -1177,7 +1184,8 @@ free_range: · 93 unmodified lines
1177 1184
1178 pr_info("node %d initialised, %lu pages in %ums\n", nid, nr_pages,1185 pr_info("node %d initialised, %lu pages in %ums\n", nid, nr_pages,
1179 jiffies_to_msecs(jiffies - start));1186 jiffies_to_msecs(jiffies - start));
1180 up_read(&pgdat_init_rwsem);1187
1188 pgdat_init_report_one_done();
1181 return 0;1189 return 0;
1182}1190}
1183 1191
@@ -1185,14 +1193,17 @@ void __init page_alloc_init_late(void) · 1 unmodified line
1185{1193{
1186 int nid;1194 int nid;
1187 1195
1196 /* There will be num_node_state(N_MEMORY) threads */
1197 atomic_set(&pgdat_init_n_undone, num_node_state(N_MEMORY));
1188 for_each_node_state(nid, N_MEMORY) {1198 for_each_node_state(nid, N_MEMORY) {
1189 down_read(&pgdat_init_rwsem);
1190 kthread_run(deferred_init_memmap, NODE_DATA(nid), "pgdatinit%d", nid);1199 kthread_run(deferred_init_memmap, NODE_DATA(nid), "pgdatinit%d", nid);
1191 }1200 }
1192 1201
1193 /* Block until all are initialised */1202 /* Block until all are initialised */
1194 down_write(&pgdat_init_rwsem);1203 wait_for_completion(&pgdat_init_all_done_comp);
1195 up_write(&pgdat_init_rwsem);1204
1205 /* Reinit limits that are based on free pages after the kernel is up */
1206 files_maxfiles_init();
1196}1207}
1197#endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */1208#endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */
1198 1209
@@ -1285,6 +1296,10 @@ static inline int check_new_page(struct page *page) · 86 unmodified lines
1285 bad_reason = "non-NULL mapping";1296 bad_reason = "non-NULL mapping";
1286 if (unlikely(atomic_read(&page->_count) != 0))1297 if (unlikely(atomic_read(&page->_count) != 0))
1287 bad_reason = "nonzero _count";1298 bad_reason = "nonzero _count";
1299 if (unlikely(page->flags & __PG_HWPOISON)) {
1300 bad_reason = "HWPoisoned (hardware-corrupted)";
1301 bad_flags = __PG_HWPOISON;
1302 }
1288 if (unlikely(page->flags & PAGE_FLAGS_CHECK_AT_PREP)) {1303 if (unlikely(page->flags & PAGE_FLAGS_CHECK_AT_PREP)) {
1289 bad_reason = "PAGE_FLAGS_CHECK_AT_PREP flag set";1304 bad_reason = "PAGE_FLAGS_CHECK_AT_PREP flag set";
1290 bad_flags = PAGE_FLAGS_CHECK_AT_PREP;1305 bad_flags = PAGE_FLAGS_CHECK_AT_PREP;
mm/shmem.c+2−2
@@ -3363,8 +3363,8 @@ put_path: · 3362 unmodified lines
3363 * shmem_kernel_file_setup - get an unlinked file living in tmpfs which must be3363 * shmem_kernel_file_setup - get an unlinked file living in tmpfs which must be
3364 * kernel internal. There will be NO LSM permission checks against the3364 * kernel internal. There will be NO LSM permission checks against the
3365 * underlying inode. So users of this interface must do LSM checks at a3365 * 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 checks3366 * higher layer. The users are the big_key and shm implementations. LSM
3367 * are provided at the key level rather than the inode level.3367 * checks are provided at the key or shm level rather than the inode.
3368 * @name: name for dentry (to be seen in /proc/<pid>/maps3368 * @name: name for dentry (to be seen in /proc/<pid>/maps
3369 * @size: size to be set for the file3369 * @size: size to be set for the file
3370 * @flags: VM_NORESERVE suppresses pre-accounting of the entire object size3370 * @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
37 SLAB_TRACE | SLAB_DESTROY_BY_RCU | SLAB_NOLEAKTRACE | \37 SLAB_TRACE | SLAB_DESTROY_BY_RCU | SLAB_NOLEAKTRACE | \
38 SLAB_FAILSLAB)38 SLAB_FAILSLAB)
39 39
40#define SLAB_MERGE_SAME (SLAB_DEBUG_FREE | SLAB_RECLAIM_ACCOUNT | \40#define SLAB_MERGE_SAME (SLAB_RECLAIM_ACCOUNT | SLAB_CACHE_DMA | SLAB_NOTRACK)
41 SLAB_CACHE_DMA | SLAB_NOTRACK)
42 41
43/*42/*
44 * Merge control. If this is set then no merging of slab caches will occur.43 * 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
973 * caller can stall after page list has been processed.973 * caller can stall after page list has been processed.
974 *974 *
975 * 2) Global or new memcg reclaim encounters a page that is975 * 2) Global or new memcg reclaim encounters a page that is
976 * not marked for immediate reclaim or the caller does not976 * not marked for immediate reclaim, or the caller does not
977 * have __GFP_IO. In this case mark the page for immediate977 * 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
978 * reclaim and continue scanning.979 * reclaim and continue scanning.
979 *980 *
980 * __GFP_IO is checked because a loop driver thread might981 * Require may_enter_fs because we would wait on fs, which
982 * may not have submitted IO yet. And the loop driver might
981 * enter reclaim, and deadlock if it waits on a page for983 * enter reclaim, and deadlock if it waits on a page for
982 * which it is needed to do the write (loop masks off984 * which it is needed to do the write (loop masks off
983 * __GFP_IO|__GFP_FS for this reason); but more thought985 * __GFP_IO|__GFP_FS for this reason); but more thought
984 * would probably show more reasons.986 * would probably show more reasons.
985 *987 *
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 *
992 * 3) Legacy memcg encounters a page that is not already marked988 * 3) Legacy memcg encounters a page that is not already marked
993 * PageReclaim. memcg does not have any dirty pages989 * PageReclaim. memcg does not have any dirty pages
994 * throttling so we could easily OOM just because too many990 * 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
1005 1001
1006 /* Case 2 above */1002 /* Case 2 above */
1007 } else if (sane_reclaim(sc) ||1003 } else if (sane_reclaim(sc) ||
1008 !PageReclaim(page) || !(sc->gfp_mask & __GFP_IO)) {1004 !PageReclaim(page) || !may_enter_fs) {
1009 /*1005 /*
1010 * This is slightly racy - end_page_writeback()1006 * This is slightly racy - end_page_writeback()
1011 * might have just cleared PageReclaim, then1007 * 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
1138 * @bat_priv: the bat priv with all the soft interface information1138 * @bat_priv: the bat priv with all the soft interface information
1139 * @skb: packet to check1139 * @skb: packet to check
1140 * @hdr_size: size of the encapsulation header1140 * @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
1141 */1144 */
1142bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv,1145bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv,
1143 struct sk_buff *skb, int hdr_size)1146 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
1145 uint16_t type;1148 uint16_t type;
1146 __be32 ip_src, ip_dst;1149 __be32 ip_src, ip_dst;
1147 uint8_t *hw_src, *hw_dst;1150 uint8_t *hw_src, *hw_dst;
1148 bool ret = false;1151 bool dropped = false;
1149 unsigned short vid;1152 unsigned short vid;
1150 1153
1151 if (!atomic_read(&bat_priv->distributed_arp_table))1154 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
1174 /* if this REPLY is directed to a client of mine, let's deliver the1177 /* if this REPLY is directed to a client of mine, let's deliver the
1175 * packet to the interface1178 * packet to the interface
1176 */1179 */
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);
1178out:1186out:
1179 if (ret)1187 if (dropped)
1180 kfree_skb(skb);1188 kfree_skb(skb);
1181 /* if ret == false -> packet has to be delivered to the interface */1189 /* if dropped == false -> deliver to the interface */
1182 return ret;1190 return dropped;
1183}1191}
1184 1192
1185/**1193/**
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
439 439
440 INIT_HLIST_NODE(&gw_node->list);440 INIT_HLIST_NODE(&gw_node->list);
441 gw_node->orig_node = orig_node;441 gw_node->orig_node = orig_node;
442 gw_node->bandwidth_down = ntohl(gateway->bandwidth_down);
443 gw_node->bandwidth_up = ntohl(gateway->bandwidth_up);
442 atomic_set(&gw_node->refcount, 1);444 atomic_set(&gw_node->refcount, 1);
443 445
444 spin_lock_bh(&bat_priv->gw.list_lock);446 spin_lock_bh(&bat_priv->gw.list_lock);
net/batman-adv/soft-interface.c+3−0
@@ -479,6 +479,9 @@ out: · 478 unmodified lines
479 */479 */
480void batadv_softif_vlan_free_ref(struct batadv_softif_vlan *vlan)480void batadv_softif_vlan_free_ref(struct batadv_softif_vlan *vlan)
481{481{
482 if (!vlan)
483 return;
484
482 if (atomic_dec_and_test(&vlan->refcount)) {485 if (atomic_dec_and_test(&vlan->refcount)) {
483 spin_lock_bh(&vlan->bat_priv->softif_vlan_list_lock);486 spin_lock_bh(&vlan->bat_priv->softif_vlan_list_lock);
484 hlist_del_rcu(&vlan->list);487 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
594 594
595 /* increase the refcounter of the related vlan */595 /* increase the refcounter of the related vlan */
596 vlan = batadv_softif_vlan_get(bat_priv, vid);596 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;
597 600
598 batadv_dbg(BATADV_DBG_TT, bat_priv,601 batadv_dbg(BATADV_DBG_TT, bat_priv,
599 "Creating new local tt entry: %pM (vid: %d, ttvn: %d)\n",602 "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
1034 struct batadv_tt_local_entry *tt_local_entry;1037 struct batadv_tt_local_entry *tt_local_entry;
1035 uint16_t flags, curr_flags = BATADV_NO_FLAGS;1038 uint16_t flags, curr_flags = BATADV_NO_FLAGS;
1036 struct batadv_softif_vlan *vlan;1039 struct batadv_softif_vlan *vlan;
1040 void *tt_entry_exists;
1037 1041
1038 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid);1042 tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid);
1039 if (!tt_local_entry)1043 if (!tt_local_entry)
@@ -1061,11 +1065,22 @@ uint16_t batadv_tt_local_remove(struct batadv_priv *bat_priv, · 21 unmodified lines
1061 * immediately purge it1065 * immediately purge it
1062 */1066 */
1063 batadv_tt_local_event(bat_priv, tt_local_entry, BATADV_TT_CLIENT_DEL);1067 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 */
1065 batadv_tt_local_entry_free_ref(tt_local_entry);1077 batadv_tt_local_entry_free_ref(tt_local_entry);
1066 1078
1067 /* decrease the reference held for this vlan */1079 /* decrease the reference held for this vlan */
1068 vlan = batadv_softif_vlan_get(bat_priv, vid);1080 vlan = batadv_softif_vlan_get(bat_priv, vid);
1081 if (!vlan)
1082 goto out;
1083
1069 batadv_softif_vlan_free_ref(vlan);1084 batadv_softif_vlan_free_ref(vlan);
1070 batadv_softif_vlan_free_ref(vlan);1085 batadv_softif_vlan_free_ref(vlan);
1071 1086
@@ -1166,8 +1181,10 @@ static void batadv_tt_local_table_free(struct batadv_priv *bat_priv) · 94 unmodified lines
1166 /* decrease the reference held for this vlan */1181 /* decrease the reference held for this vlan */
1167 vlan = batadv_softif_vlan_get(bat_priv,1182 vlan = batadv_softif_vlan_get(bat_priv,
1168 tt_common_entry->vid);1183 tt_common_entry->vid);
1169 batadv_softif_vlan_free_ref(vlan);1184 if (vlan) {
1170 batadv_softif_vlan_free_ref(vlan);1185 batadv_softif_vlan_free_ref(vlan);
1186 batadv_softif_vlan_free_ref(vlan);
1187 }
1171 1188
1172 batadv_tt_local_entry_free_ref(tt_local);1189 batadv_tt_local_entry_free_ref(tt_local);
1173 }1190 }
@@ -3207,8 +3224,10 @@ static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv) · 2033 unmodified lines
3207 3224
3208 /* decrease the reference held for this vlan */3225 /* decrease the reference held for this vlan */
3209 vlan = batadv_softif_vlan_get(bat_priv, tt_common->vid);3226 vlan = batadv_softif_vlan_get(bat_priv, tt_common->vid);
3210 batadv_softif_vlan_free_ref(vlan);3227 if (vlan) {
3211 batadv_softif_vlan_free_ref(vlan);3228 batadv_softif_vlan_free_ref(vlan);
3229 batadv_softif_vlan_free_ref(vlan);
3230 }
3212 3231
3213 batadv_tt_local_entry_free_ref(tt_local);3232 batadv_tt_local_entry_free_ref(tt_local);
3214 }3233 }
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
7843 /* Make sure we copy only the significant bytes based on the7843 /* Make sure we copy only the significant bytes based on the
7844 * encryption key size, and set the rest of the value to zeroes.7844 * encryption key size, and set the rest of the value to zeroes.
7845 */7845 */
7846 memcpy(ev.key.val, key->val, sizeof(key->enc_size));7846 memcpy(ev.key.val, key->val, key->enc_size);
7847 memset(ev.key.val + key->enc_size, 0,7847 memset(ev.key.val + key->enc_size, 0,
7848 sizeof(ev.key.val) - key->enc_size);7848 sizeof(ev.key.val) - key->enc_size);
7849 7849
net/bridge/br_netlink.c+4−0
@@ -112,6 +112,8 @@ static inline size_t br_port_info_size(void) · 111 unmodified lines
112 + nla_total_size(1) /* IFLA_BRPORT_FAST_LEAVE */112 + nla_total_size(1) /* IFLA_BRPORT_FAST_LEAVE */
113 + nla_total_size(1) /* IFLA_BRPORT_LEARNING */113 + nla_total_size(1) /* IFLA_BRPORT_LEARNING */
114 + nla_total_size(1) /* IFLA_BRPORT_UNICAST_FLOOD */114 + 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 */
115 + 0;117 + 0;
116}118}
117 119
@@ -504,6 +506,8 @@ static const struct nla_policy br_port_policy[IFLA_BRPORT_MAX + 1] = { · 386 unmodified lines
504 [IFLA_BRPORT_FAST_LEAVE]= { .type = NLA_U8 },506 [IFLA_BRPORT_FAST_LEAVE]= { .type = NLA_U8 },
505 [IFLA_BRPORT_LEARNING] = { .type = NLA_U8 },507 [IFLA_BRPORT_LEARNING] = { .type = NLA_U8 },
506 [IFLA_BRPORT_UNICAST_FLOOD] = { .type = NLA_U8 },508 [IFLA_BRPORT_UNICAST_FLOOD] = { .type = NLA_U8 },
509 [IFLA_BRPORT_PROXYARP] = { .type = NLA_U8 },
510 [IFLA_BRPORT_PROXYARP_WIFI] = { .type = NLA_U8 },
507};511};
508 512
509/* Change the state of the port and notify spanning tree */513/* 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
131 goto out;131 goto out;
132}132}
133 133
134static int skb_set_peeked(struct sk_buff *skb)134static struct sk_buff *skb_set_peeked(struct sk_buff *skb)
135{135{
136 struct sk_buff *nskb;136 struct sk_buff *nskb;
137 137
138 if (skb->peeked)138 if (skb->peeked)
139 return 0;139 return skb;
140 140
141 /* We have to unshare an skb before modifying it. */141 /* We have to unshare an skb before modifying it. */
142 if (!skb_shared(skb))142 if (!skb_shared(skb))
@@ -144,7 +144,7 @@ static int skb_set_peeked(struct sk_buff *skb) · 1 unmodified line
144 144
145 nskb = skb_clone(skb, GFP_ATOMIC);145 nskb = skb_clone(skb, GFP_ATOMIC);
146 if (!nskb)146 if (!nskb)
147 return -ENOMEM;147 return ERR_PTR(-ENOMEM);
148 148
149 skb->prev->next = nskb;149 skb->prev->next = nskb;
150 skb->next->prev = nskb;150 skb->next->prev = nskb;
@@ -157,7 +157,7 @@ static int skb_set_peeked(struct sk_buff *skb) · 6 unmodified lines
157done:157done:
158 skb->peeked = 1;158 skb->peeked = 1;
159 159
160 return 0;160 return skb;
161}161}
162 162
163/**163/**
@@ -229,8 +229,9 @@ struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned int flags, · 65 unmodified lines
229 continue;229 continue;
230 }230 }
231 231
232 error = skb_set_peeked(skb);232 skb = skb_set_peeked(skb);
233 if (error)233 error = PTR_ERR(skb);
234 if (IS_ERR(skb))
234 goto unlock_err;235 goto unlock_err;
235 236
236 atomic_inc(&skb->users);237 atomic_inc(&skb->users);
net/core/pktgen.c+0−3
@@ -3513,8 +3513,6 @@ static int pktgen_thread_worker(void *arg) · 3512 unmodified lines
3513 3513
3514 set_freezable();3514 set_freezable();
3515 3515
3516 __set_current_state(TASK_RUNNING);
3517
3518 while (!kthread_should_stop()) {3516 while (!kthread_should_stop()) {
3519 pkt_dev = next_to_run(t);3517 pkt_dev = next_to_run(t);
3520 3518
@@ -3559,7 +3557,6 @@ static int pktgen_thread_worker(void *arg) · 38 unmodified lines
3559 3557
3560 try_to_freeze();3558 try_to_freeze();
3561 }3559 }
3562 set_current_state(TASK_INTERRUPTIBLE);
3563 3560
3564 pr_debug("%s stopping all device\n", t->tsk->comm);3561 pr_debug("%s stopping all device\n", t->tsk->comm);
3565 pktgen_stop(t);3562 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
103 spin_lock_bh(&queue->syn_wait_lock);103 spin_lock_bh(&queue->syn_wait_lock);
104 while ((req = lopt->syn_table[i]) != NULL) {104 while ((req = lopt->syn_table[i]) != NULL) {
105 lopt->syn_table[i] = req->dl_next;105 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);
106 atomic_inc(&lopt->qlen_dec);111 atomic_inc(&lopt->qlen_dec);
107 if (del_timer(&req->rsk_timer))112 if (del_timer_sync(&req->rsk_timer))
108 reqsk_put(req);113 reqsk_put(req);
109 reqsk_put(req);114 reqsk_put(req);
115 spin_lock_bh(&queue->syn_wait_lock);
110 }116 }
111 spin_unlock_bh(&queue->syn_wait_lock);117 spin_unlock_bh(&queue->syn_wait_lock);
112 }118 }
net/dsa/slave.c+2−1
@@ -856,7 +856,8 @@ static int dsa_slave_phy_connect(struct dsa_slave_priv *p, · 855 unmodified lines
856 return -ENODEV;856 return -ENODEV;
857 857
858 /* Use already configured phy mode */858 /* 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;
860 phy_connect_direct(slave_dev, p->phy, dsa_slave_adjust_link,861 phy_connect_direct(slave_dev, p->phy, dsa_slave_adjust_link,
861 p->phy_interface);862 p->phy_interface);
862 863
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
593 }593 }
594 594
595 spin_unlock(&queue->syn_wait_lock);595 spin_unlock(&queue->syn_wait_lock);
596 if (del_timer(&req->rsk_timer))596 if (del_timer_sync(&req->rsk_timer))
597 reqsk_put(req);597 reqsk_put(req);
598 return found;598 return found;
599}599}
net/ipv4/netfilter/ipt_SYNPROXY.c+2−1
@@ -226,7 +226,8 @@ synproxy_send_client_ack(const struct synproxy_net *snet, · 225 unmodified lines
226 226
227 synproxy_build_options(nth, opts);227 synproxy_build_options(nth, opts);
228 228
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);
230}231}
231 232
232static bool233static 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
1348 req = inet_csk_search_req(sk, th->source, iph->saddr, iph->daddr);1348 req = inet_csk_search_req(sk, th->source, iph->saddr, iph->daddr);
1349 if (req) {1349 if (req) {
1350 nsk = tcp_check_req(sk, skb, req, false);1350 nsk = tcp_check_req(sk, skb, req, false);
1351 if (!nsk)1351 if (!nsk || nsk == sk)
1352 reqsk_put(req);1352 reqsk_put(req);
1353 return nsk;1353 return nsk;
1354 }1354 }
net/ipv4/udp.c+10−3
@@ -1995,12 +1995,19 @@ void udp_v4_early_demux(struct sk_buff *skb) · 1994 unmodified lines
1995 1995
1996 skb->sk = sk;1996 skb->sk = sk;
1997 skb->destructor = sock_efree;1997 skb->destructor = sock_efree;
1998 dst = sk->sk_rx_dst;1998 dst = READ_ONCE(sk->sk_rx_dst);
1999 1999
2000 if (dst)2000 if (dst)
2001 dst = dst_check(dst, 0);2001 dst = dst_check(dst, 0);
2002 if (dst)2002 if (dst) {
2003 skb_dst_set_noref(skb, 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 }
2004}2011}
2005 2012
2006int udp_rcv(struct sk_buff *skb)2013int 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
37}37}
38 38
39static void39static void
40synproxy_send_tcp(const struct sk_buff *skb, struct sk_buff *nskb,40synproxy_send_tcp(const struct synproxy_net *snet,
41 const struct sk_buff *skb, struct sk_buff *nskb,
41 struct nf_conntrack *nfct, enum ip_conntrack_info ctinfo,42 struct nf_conntrack *nfct, enum ip_conntrack_info ctinfo,
42 struct ipv6hdr *niph, struct tcphdr *nth,43 struct ipv6hdr *niph, struct tcphdr *nth,
43 unsigned int tcp_hdr_size)44 unsigned int tcp_hdr_size)
44{45{
45 struct net *net = nf_ct_net((struct nf_conn *)nfct);46 struct net *net = nf_ct_net(snet->tmpl);
46 struct dst_entry *dst;47 struct dst_entry *dst;
47 struct flowi6 fl6;48 struct flowi6 fl6;
48 49
@@ -83,7 +84,8 @@ free_nskb: · 34 unmodified lines
83}84}
84 85
85static void86static void
86synproxy_send_client_synack(const struct sk_buff *skb, const struct tcphdr *th,87synproxy_send_client_synack(const struct synproxy_net *snet,
88 const struct sk_buff *skb, const struct tcphdr *th,
87 const struct synproxy_options *opts)89 const struct synproxy_options *opts)
88{90{
89 struct sk_buff *nskb;91 struct sk_buff *nskb;
@@ -119,7 +121,7 @@ synproxy_send_client_synack(const struct sk_buff *skb, const struct tcphdr *th, · 29 unmodified lines
119 121
120 synproxy_build_options(nth, opts);122 synproxy_build_options(nth, opts);
121 123
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,
123 niph, nth, tcp_hdr_size);125 niph, nth, tcp_hdr_size);
124}126}
125 127
@@ -163,7 +165,7 @@ synproxy_send_server_syn(const struct synproxy_net *snet, · 37 unmodified lines
163 165
164 synproxy_build_options(nth, opts);166 synproxy_build_options(nth, opts);
165 167
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,
167 niph, nth, tcp_hdr_size);169 niph, nth, tcp_hdr_size);
168}170}
169 171
@@ -203,7 +205,7 @@ synproxy_send_server_ack(const struct synproxy_net *snet, · 33 unmodified lines
203 205
204 synproxy_build_options(nth, opts);206 synproxy_build_options(nth, opts);
205 207
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);
207}209}
208 210
209static void211static void
@@ -241,7 +243,8 @@ synproxy_send_client_ack(const struct synproxy_net *snet, · 31 unmodified lines
241 243
242 synproxy_build_options(nth, opts);244 synproxy_build_options(nth, opts);
243 245
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);
245}248}
246 249
247static bool250static bool
@@ -301,7 +304,7 @@ synproxy_tg6(struct sk_buff *skb, const struct xt_action_param *par) · 53 unmodified lines
301 XT_SYNPROXY_OPT_SACK_PERM |304 XT_SYNPROXY_OPT_SACK_PERM |
302 XT_SYNPROXY_OPT_ECN);305 XT_SYNPROXY_OPT_ECN);
303 306
304 synproxy_send_client_synack(skb, th, &opts);307 synproxy_send_client_synack(snet, skb, th, &opts);
305 return NF_DROP;308 return NF_DROP;
306 309
307 } else if (th->ack && !(th->fin || th->rst || th->syn)) {310 } 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
1844 int gwa_type;1844 int gwa_type;
1845 1845
1846 gw_addr = &cfg->fc_gateway;1846 gw_addr = &cfg->fc_gateway;
1847 gwa_type = ipv6_addr_type(gw_addr);
1847 1848
1848 /* if gw_addr is local we will fail to detect this in case1849 /* if gw_addr is local we will fail to detect this in case
1849 * address is still TENTATIVE (DAD in progress). rt6_lookup()1850 * address is still TENTATIVE (DAD in progress). rt6_lookup()
@@ -1851,11 +1852,12 @@ int ip6_route_add(struct fib6_config *cfg) · 1 unmodified line
1851 * prefix route was assigned to, which might be non-loopback.1852 * prefix route was assigned to, which might be non-loopback.
1852 */1853 */
1853 err = -EINVAL;1854 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))
1855 goto out;1858 goto out;
1856 1859
1857 rt->rt6i_gateway = *gw_addr;1860 rt->rt6i_gateway = *gw_addr;
1858 gwa_type = ipv6_addr_type(gw_addr);
1859 1861
1860 if (gwa_type != (IPV6_ADDR_LINKLOCAL|IPV6_ADDR_UNICAST)) {1862 if (gwa_type != (IPV6_ADDR_LINKLOCAL|IPV6_ADDR_UNICAST)) {
1861 struct rt6_info *grt;1863 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
943 &ipv6_hdr(skb)->daddr, tcp_v6_iif(skb));943 &ipv6_hdr(skb)->daddr, tcp_v6_iif(skb));
944 if (req) {944 if (req) {
945 nsk = tcp_check_req(sk, skb, req, false);945 nsk = tcp_check_req(sk, skb, req, false);
946 if (!nsk)946 if (!nsk || nsk == sk)
947 reqsk_put(req);947 reqsk_put(req);
948 return nsk;948 return nsk;
949 }949 }
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
292{292{
293 struct nf_conn *tmpl;293 struct nf_conn *tmpl;
294 294
295 tmpl = kzalloc(sizeof(struct nf_conn), GFP_KERNEL);295 tmpl = kzalloc(sizeof(*tmpl), flags);
296 if (tmpl == NULL)296 if (tmpl == NULL)
297 return NULL;297 return NULL;
298 298
@@ -303,7 +303,7 @@ struct nf_conn *nf_ct_tmpl_alloc(struct net *net, u16 zone, gfp_t flags) · 4 unmodified lines
303 if (zone) {303 if (zone) {
304 struct nf_conntrack_zone *nf_ct_zone;304 struct nf_conntrack_zone *nf_ct_zone;
305 305
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);
307 if (!nf_ct_zone)307 if (!nf_ct_zone)
308 goto out_free;308 goto out_free;
309 nf_ct_zone->id = zone;309 nf_ct_zone->id = zone;
@@ -1544,10 +1544,8 @@ void *nf_ct_alloc_hashtable(unsigned int *sizep, int nulls) · 1234 unmodified lines
1544 sz = nr_slots * sizeof(struct hlist_nulls_head);1544 sz = nr_slots * sizeof(struct hlist_nulls_head);
1545 hash = (void *)__get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO,1545 hash = (void *)__get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO,
1546 get_order(sz));1546 get_order(sz));
1547 if (!hash) {1547 if (!hash)
1548 printk(KERN_WARNING "nf_conntrack: falling back to vmalloc.\n");
1549 hash = vzalloc(sz);1548 hash = vzalloc(sz);
1550 }
1551 1549
1552 if (hash && nulls)1550 if (hash && nulls)
1553 for (i = 0; i < nr_slots; i++)1551 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
353 int err = -ENOMEM;353 int err = -ENOMEM;
354 354
355 ct = nf_ct_tmpl_alloc(net, 0, GFP_KERNEL);355 ct = nf_ct_tmpl_alloc(net, 0, GFP_KERNEL);
356 if (IS_ERR(ct)) {356 if (!ct)
357 err = PTR_ERR(ct);
358 goto err1;357 goto err1;
359 }
360 358
361 if (!nfct_seqadj_ext_add(ct))359 if (!nfct_seqadj_ext_add(ct))
362 goto err2;360 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
202 goto err1;202 goto err1;
203 203
204 ct = nf_ct_tmpl_alloc(par->net, info->zone, GFP_KERNEL);204 ct = nf_ct_tmpl_alloc(par->net, info->zone, GFP_KERNEL);
205 ret = PTR_ERR(ct);205 if (!ct) {
206 if (IS_ERR(ct))206 ret = -ENOMEM;
207 goto err2;207 goto err2;
208 }
208 209
209 ret = 0;210 ret = 0;
210 if ((info->ct_events || info->exp_events) &&211 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
1096 1096
1097 err = __netlink_insert(table, sk);1097 err = __netlink_insert(table, sk);
1098 if (err) {1098 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;
1099 if (err == -EEXIST)1104 if (err == -EEXIST)
1100 err = -EADDRINUSE;1105 err = -EADDRINUSE;
1101 nlk_sk(sk)->portid = 0;1106 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
273 return 0;273 return 0;
274}274}
275 275
276static void set_ip_addr(struct sk_buff *skb, struct iphdr *nh,276static void update_ip_l4_checksum(struct sk_buff *skb, struct iphdr *nh,
277 __be32 *addr, __be32 new_addr)277 __be32 addr, __be32 new_addr)
278{278{
279 int transport_len = skb->len - skb_transport_offset(skb);279 int transport_len = skb->len - skb_transport_offset(skb);
280 280
281 if (nh->frag_off & htons(IP_OFFSET))
282 return;
283
281 if (nh->protocol == IPPROTO_TCP) {284 if (nh->protocol == IPPROTO_TCP) {
282 if (likely(transport_len >= sizeof(struct tcphdr)))285 if (likely(transport_len >= sizeof(struct tcphdr)))
283 inet_proto_csum_replace4(&tcp_hdr(skb)->check, skb,286 inet_proto_csum_replace4(&tcp_hdr(skb)->check, skb,
284 *addr, new_addr, 1);287 addr, new_addr, 1);
285 } else if (nh->protocol == IPPROTO_UDP) {288 } else if (nh->protocol == IPPROTO_UDP) {
286 if (likely(transport_len >= sizeof(struct udphdr))) {289 if (likely(transport_len >= sizeof(struct udphdr))) {
287 struct udphdr *uh = udp_hdr(skb);290 struct udphdr *uh = udp_hdr(skb);
288 291
289 if (uh->check || skb->ip_summed == CHECKSUM_PARTIAL) {292 if (uh->check || skb->ip_summed == CHECKSUM_PARTIAL) {
290 inet_proto_csum_replace4(&uh->check, skb,293 inet_proto_csum_replace4(&uh->check, skb,
291 *addr, new_addr, 1);294 addr, new_addr, 1);
292 if (!uh->check)295 if (!uh->check)
293 uh->check = CSUM_MANGLED_0;296 uh->check = CSUM_MANGLED_0;
294 }297 }
295 }298 }
296 }299 }
300}
297 301
302static 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);
298 csum_replace4(&nh->check, *addr, new_addr);306 csum_replace4(&nh->check, *addr, new_addr);
299 skb_clear_hash(skb);307 skb_clear_hash(skb);
300 *addr = new_addr;308 *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
176 176
177 /* check for all kinds of wrapping and the like */177 /* check for all kinds of wrapping and the like */
178 start = (unsigned long)optval;178 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) {
180 ret = -EINVAL;180 ret = -EINVAL;
181 goto out;181 goto out;
182 }182 }
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
101 return ret;101 return ret;
102 ret = ACT_P_CREATED;102 ret = ACT_P_CREATED;
103 } else {103 } else {
104 if (bind)
105 return 0;
104 if (!ovr) {106 if (!ovr) {
105 tcf_hash_release(a, bind);107 tcf_hash_release(a, bind);
106 return -EEXIST;108 return -EEXIST;
net/sched/sch_fq_codel.c+19−3
@@ -288,10 +288,26 @@ begin: · 287 unmodified lines
288 288
289static void fq_codel_reset(struct Qdisc *sch)289static void fq_codel_reset(struct Qdisc *sch)
290{290{
291 struct sk_buff *skb;291 struct fq_codel_sched_data *q = qdisc_priv(sch);
292 int i;
292 293
293 while ((skb = fq_codel_dequeue(sch)) != NULL)294 INIT_LIST_HEAD(&q->new_flows);
294 kfree_skb(skb);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;
295}311}
296 312
297static const struct nla_policy fq_codel_policy[TCA_FQ_CODEL_MAX + 1] = {313static 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
137my $kconfig = $ARGV[1];137my $kconfig = $ARGV[1];
138my $lsmod_file = $ENV{'LSMOD'};138my $lsmod_file = $ENV{'LSMOD'};
139 139
140my @makefiles = `find $ksource -name Makefile 2>/dev/null`;140my @makefiles = `find $ksource -name Makefile -or -name Kbuild 2>/dev/null`;
141chomp @makefiles;141chomp @makefiles;
142 142
143my %depends;143my %depends;
security/yama/yama_lsm.c+1−0
@@ -406,6 +406,7 @@ static __init int yama_init(void) · 405 unmodified lines
406 */406 */
407 if (!security_module_enable("yama"))407 if (!security_module_enable("yama"))
408 return 0;408 return 0;
409 yama_add_hooks();
409#endif410#endif
410 pr_info("Yama: becoming mindful.\n");411 pr_info("Yama: becoming mindful.\n");
411 412
sound/firewire/amdtp.c+3−2
@@ -740,8 +740,9 @@ static int handle_in_packet(struct amdtp_stream *s, · 739 unmodified lines
740 s->data_block_counter != UINT_MAX)740 s->data_block_counter != UINT_MAX)
741 data_block_counter = s->data_block_counter;741 data_block_counter = s->data_block_counter;
742 742
743 if (((s->flags & CIP_SKIP_DBC_ZERO_CHECK) && data_block_counter == 0) ||743 if (((s->flags & CIP_SKIP_DBC_ZERO_CHECK) &&
744 (s->data_block_counter == UINT_MAX)) {744 data_block_counter == s->tx_first_dbc) ||
745 s->data_block_counter == UINT_MAX) {
745 lost = false;746 lost = false;
746 } else if (!(s->flags & CIP_DBC_IS_END_EVENT)) {747 } else if (!(s->flags & CIP_DBC_IS_END_EVENT)) {
747 lost = data_block_counter != s->data_block_counter;748 lost = data_block_counter != s->data_block_counter;
sound/firewire/amdtp.h+2−0
@@ -157,6 +157,8 @@ struct amdtp_stream { · 156 unmodified lines
157 157
158 /* quirk: fixed interval of dbc between previos/current packets. */158 /* quirk: fixed interval of dbc between previos/current packets. */
159 unsigned int tx_dbc_interval;159 unsigned int tx_dbc_interval;
160 /* quirk: indicate the value of dbc field in a first packet. */
161 unsigned int tx_first_dbc;
160 162
161 bool callbacked;163 bool callbacked;
162 wait_queue_head_t callback_wait;164 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
248 err = get_hardware_info(efw);248 err = get_hardware_info(efw);
249 if (err < 0)249 if (err < 0)
250 goto error;250 goto error;
251 if (entry->model_id == MODEL_ECHO_AUDIOFIRE_2)251 /* AudioFire8 (since 2009) and AudioFirePre8 */
252 efw->is_af2 = true;
253 if (entry->model_id == MODEL_ECHO_AUDIOFIRE_9)252 if (entry->model_id == MODEL_ECHO_AUDIOFIRE_9)
254 efw->is_af9 = true;253 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;
255 261
256 snd_efw_proc_init(efw);262 snd_efw_proc_init(efw);
257 263
sound/firewire/fireworks/fireworks.h+1−1
@@ -70,8 +70,8 @@ struct snd_efw { · 69 unmodified lines
70 bool resp_addr_changable;70 bool resp_addr_changable;
71 71
72 /* for quirks */72 /* for quirks */
73 bool is_af2;
74 bool is_af9;73 bool is_af9;
74 bool is_fireworks3;
75 u32 firmware_version;75 u32 firmware_version;
76 76
77 unsigned int midi_in_ports;77 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
172 efw->tx_stream.flags |= CIP_DBC_IS_END_EVENT;172 efw->tx_stream.flags |= CIP_DBC_IS_END_EVENT;
173 /* Fireworks reset dbc at bus reset. */173 /* Fireworks reset dbc at bus reset. */
174 efw->tx_stream.flags |= CIP_SKIP_DBC_ZERO_CHECK;174 efw->tx_stream.flags |= CIP_SKIP_DBC_ZERO_CHECK;
175 /* AudioFire2 starts packets with non-zero dbc. */175 /*
176 if (efw->is_af2)176 * But Recent firmwares starts packets with non-zero dbc.
177 efw->tx_stream.flags |= CIP_SKIP_INIT_DBC_CHECK;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;
178 /* AudioFire9 always reports wrong dbs. */184 /* AudioFire9 always reports wrong dbs. */
179 if (efw->is_af9)185 if (efw->is_af9)
180 efw->tx_stream.flags |= CIP_WRONG_DBS;186 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
44 44
45 offset = snd_hdac_chip_readl(bus, LLCH);45 offset = snd_hdac_chip_readl(bus, LLCH);
46 46
47 if (offset < 0)
48 return -EIO;
49
50 /* Lets walk the linked capabilities list */47 /* Lets walk the linked capabilities list */
51 do {48 do {
52 cur_cap = _snd_hdac_chip_read(l, bus, offset);49 cur_cap = _snd_hdac_chip_read(l, bus, offset);
53 50
54 if (cur_cap < 0)
55 return -EIO;
56
57 dev_dbg(bus->dev, "Capability version: 0x%x\n",51 dev_dbg(bus->dev, "Capability version: 0x%x\n",
58 ((cur_cap & AZX_CAP_HDR_VER_MASK) >> AZX_CAP_HDR_VER_OFF));52 ((cur_cap & AZX_CAP_HDR_VER_MASK) >> AZX_CAP_HDR_VER_OFF));
59 53
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
299 if (stream->direction != substream->stream)299 if (stream->direction != substream->stream)
300 continue;300 continue;
301 301
302 if (stream->opened) {302 if (!stream->opened) {
303 if (!hstream->decoupled)303 if (!hstream->decoupled)
304 snd_hdac_ext_stream_decouple(ebus, hstream, true);304 snd_hdac_ext_stream_decouple(ebus, hstream, true);
305 res = hstream;305 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
5189 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),5189 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
5190 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),5190 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5191 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),5191 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5192 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC292_FIXUP_DISABLE_AAMIX),
5192 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),5193 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5193 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),5194 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
5194 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),5195 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
88 int changed;88 int changed;
89 89
90 mutex_lock(&chip->mutex);90 mutex_lock(&chip->mutex);
91 changed = !value->value.integer.value[0] != chip->dac_mute;91 changed = (!value->value.integer.value[0]) != chip->dac_mute;
92 if (changed) {92 if (changed) {
93 chip->dac_mute = !value->value.integer.value[0];93 chip->dac_mute = !value->value.integer.value[0];
94 chip->model.update_dac_mute(chip);94 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
457 case SND_SOC_DAIFMT_RIGHT_J:457 case SND_SOC_DAIFMT_RIGHT_J:
458 if (params_width(params) == 16) {458 if (params_width(params) == 16) {
459 snd_soc_update_bits(codec, CS4265_DAC_CTL,459 snd_soc_update_bits(codec, CS4265_DAC_CTL,
460 CS4265_DAC_CTL_DIF, (1 << 5));460 CS4265_DAC_CTL_DIF, (2 << 4));
461 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,461 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,
462 CS4265_SPDIF_CTL2_DIF, (1 << 7));462 CS4265_SPDIF_CTL2_DIF, (2 << 6));
463 } else {463 } else {
464 snd_soc_update_bits(codec, CS4265_DAC_CTL,464 snd_soc_update_bits(codec, CS4265_DAC_CTL,
465 CS4265_DAC_CTL_DIF, (3 << 5));465 CS4265_DAC_CTL_DIF, (3 << 4));
466 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,466 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,
467 CS4265_SPDIF_CTL2_DIF, (1 << 7));467 CS4265_SPDIF_CTL2_DIF, (3 << 6));
468 }468 }
469 break;469 break;
470 case SND_SOC_DAIFMT_LEFT_J:470 case SND_SOC_DAIFMT_LEFT_J:
@@ -473,7 +473,7 @@ static int cs4265_pcm_hw_params(struct snd_pcm_substream *substream, · 2 unmodified lines
473 snd_soc_update_bits(codec, CS4265_ADC_CTL,473 snd_soc_update_bits(codec, CS4265_ADC_CTL,
474 CS4265_ADC_DIF, 0);474 CS4265_ADC_DIF, 0);
475 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,475 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,
476 CS4265_SPDIF_CTL2_DIF, (1 << 6));476 CS4265_SPDIF_CTL2_DIF, 0);
477 477
478 break;478 break;
479 default:479 default:
sound/soc/codecs/rt5645.c+2−0
@@ -3341,6 +3341,8 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, · 3340 unmodified lines
3341 break;3341 break;
3342 3342
3343 case RT5645_DMIC_DATA_GPIO5:3343 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);
3344 regmap_update_bits(rt5645->regmap, RT5645_DMIC_CTRL1,3346 regmap_update_bits(rt5645->regmap, RT5645_DMIC_CTRL1,
3345 RT5645_DMIC_1_DP_MASK, RT5645_DMIC_1_DP_GPIO5);3347 RT5645_DMIC_1_DP_MASK, RT5645_DMIC_1_DP_GPIO5);
3346 regmap_update_bits(rt5645->regmap, RT5645_GPIO_CTRL1,3348 regmap_update_bits(rt5645->regmap, RT5645_GPIO_CTRL1,
sound/soc/codecs/rt5645.h+4−0
@@ -1693,6 +1693,10 @@ · 1692 unmodified lines
1693#define RT5645_GP6_PIN_SFT 61693#define RT5645_GP6_PIN_SFT 6
1694#define RT5645_GP6_PIN_GPIO6 (0x0 << 6)1694#define RT5645_GP6_PIN_GPIO6 (0x0 << 6)
1695#define RT5645_GP6_PIN_DMIC2_SDA (0x1 << 6)1695#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)
1696#define RT5645_GP8_PIN_MASK (0x1 << 3)1700#define RT5645_GP8_PIN_MASK (0x1 << 3)
1697#define RT5645_GP8_PIN_SFT 31701#define RT5645_GP8_PIN_SFT 3
1698#define RT5645_GP8_PIN_GPIO8 (0x0 << 3)1702#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
701 if (byt == NULL)701 if (byt == NULL)
702 return -ENOMEM;702 return -ENOMEM;
703 703
704 byt->dev = dev;
705
704 ipc = &byt->ipc;706 ipc = &byt->ipc;
705 ipc->dev = dev;707 ipc->dev = dev;
706 ipc->ops.tx_msg = byt_tx_msg;708 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
2119 if (hsw == NULL)2119 if (hsw == NULL)
2120 return -ENOMEM;2120 return -ENOMEM;
2121 2121
2122 hsw->dev = dev;
2123
2122 ipc = &hsw->ipc;2124 ipc = &hsw->ipc;
2123 ipc->dev = dev;2125 ipc->dev = dev;
2124 ipc->ops.tx_msg = hsw_tx_msg;2126 ipc->ops.tx_msg = hsw_tx_msg;
sound/soc/soc-topology.c+43−18
@@ -33,6 +33,7 @@ · 32 unmodified lines
33#include <sound/soc.h>33#include <sound/soc.h>
34#include <sound/soc-dapm.h>34#include <sound/soc-dapm.h>
35#include <sound/soc-topology.h>35#include <sound/soc-topology.h>
36#include <sound/tlv.h>
36 37
37/*38/*
38 * We make several passes over the data (since it wont necessarily be ordered)39 * 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
534 k->put = bops[i].put;535 k->put = bops[i].put;
535 if (k->get == NULL && bops[i].id == hdr->ops.get)536 if (k->get == NULL && bops[i].id == hdr->ops.get)
536 k->get = bops[i].get;537 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)
538 k->info = bops[i].info;539 k->info = bops[i].info;
539 }540 }
540 541
@@ -579,28 +580,51 @@ static int soc_tplg_init_kcontrol(struct soc_tplg *tplg, · 38 unmodified lines
579 return 0;580 return 0;
580}581}
581 582
583
584static 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
582static int soc_tplg_create_tlv(struct soc_tplg *tplg,604static 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)
584{606{
585 struct snd_ctl_tlv *tlv;607 struct snd_soc_tplg_ctl_tlv *tplg_tlv;
586 int size;
587 608
588 if (tplg_tlv->count == 0)609 if (!(tc->access & SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE))
589 return 0;610 return 0;
590 611
591 size = ((tplg_tlv->count + (sizeof(unsigned int) - 1)) &612 if (tc->access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) {
592 ~(sizeof(unsigned int) - 1));613 kc->tlv.c = snd_soc_bytes_tlv_callback;
593 tlv = kzalloc(sizeof(*tlv) + size, GFP_KERNEL);614 } else {
594 if (tlv == NULL)615 tplg_tlv = &tc->tlv;
595 return -ENOMEM;616 switch (tplg_tlv->type) {
596 617 case SNDRV_CTL_TLVT_DB_SCALE:
597 dev_dbg(tplg->dev, " created TLV type %d size %d bytes\n",618 return soc_tplg_create_tlv_db_scale(tplg, kc,
598 tplg_tlv->numid, size);619 &tplg_tlv->scale);
599 620
600 tlv->numid = tplg_tlv->numid;621 /* TODO: add support for other TLV types */
601 tlv->length = size;622 default:
602 memcpy(&tlv->tlv[0], tplg_tlv->data, size);623 dev_dbg(tplg->dev, "Unsupported TLV type %d\n",
603 kc->tlv.p = (void *)tlv;624 tplg_tlv->type);
625 return -EINVAL;
626 }
627 }
604 628
605 return 0;629 return 0;
606}630}
@@ -772,7 +796,7 @@ static int soc_tplg_dmixer_create(struct soc_tplg *tplg, unsigned int count, · 165 unmodified lines
772 }796 }
773 797
774 /* create any TLV data */798 /* create any TLV data */
775 soc_tplg_create_tlv(tplg, &kc, &mc->tlv);799 soc_tplg_create_tlv(tplg, &kc, &mc->hdr);
776 800
777 /* register control here */801 /* register control here */
778 err = soc_tplg_add_kcontrol(tplg, &kc,802 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
1350 template.reg = w->reg;1374 template.reg = w->reg;
1351 template.shift = w->shift;1375 template.shift = w->shift;
1352 template.mask = w->mask;1376 template.mask = w->mask;
1377 template.subseq = w->subseq;
1353 template.on_val = w->invert ? 0 : 1;1378 template.on_val = w->invert ? 0 : 1;
1354 template.off_val = w->invert ? 1 : 0;1379 template.off_val = w->invert ? 1 : 0;
1355 template.ignore_suspend = w->ignore_suspend;1380 template.ignore_suspend = w->ignore_suspend;