History

Merge branch 'perf/urgent' into perf/core

Pick up the latest fixes, refresh the development tree.

Ingo Molnar committed 12 years ago

Commit 860fc2f2 parents 1977499 bee09ed565 files · +5338 −2771Browse files

Unified · Split

565 files
  1. Documentation/block/null_blk.txt +72 −0
  2. Documentation/devicetree/bindings/clock/exynos5250-clock.txt +2 −0
  3. Documentation/kernel-parameters.txt +2 −0
  4. Documentation/module-signing.txt +240 −0
  5. Documentation/networking/ip-sysctl.txt +6 −2
  6. MAINTAINERS +31 −7
  7. Makefile +10 −14
  8. arch/arc/include/uapi/asm/unistd.h +7 −1
  9. arch/arm/boot/dts/exynos5250.dtsi +1 −1
  10. arch/arm/boot/dts/r8a7790.dtsi +14 −14
  11. arch/arm/crypto/aesbs-core.S_shipped +1 −1
  12. arch/arm/crypto/bsaes-armv7.pl +1 −1
  13. arch/arm/include/asm/io.h +1 −1
  14. arch/arm/include/asm/memory.h +2 −1
  15. arch/arm/include/asm/xen/page.h +1 −1
  16. arch/arm/kernel/devtree.c +1 −1
  17. arch/arm/kernel/perf_event_cpu.c +1 −1
  18. arch/arm/kernel/traps.c +10 −3
  19. arch/arm/mach-footbridge/dc21285-timer.c +3 −2
  20. arch/arm/mach-highbank/highbank.c +1 −0
  21. arch/arm/mach-omap2/board-ldp.c +6 −1
  22. arch/arm/mach-omap2/display.c +38 −0
  23. arch/arm/mach-omap2/omap4-common.c +1 −0
  24. arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c +2 −2
  25. arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +3 −3
  26. arch/arm/mach-omap2/omap_hwmod_7xx_data.c +1 −1
  27. arch/arm/mach-pxa/include/mach/lubbock.h +2 −0
  28. arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c +1 −10
  29. arch/arm/mach-shmobile/board-armadillo800eva.c +9 −2
  30. arch/arm/mach-shmobile/board-bockw.c +1 −1
  31. arch/arm/mach-shmobile/board-kzm9g.c +1 −1
  32. arch/arm/mach-shmobile/board-lager.c +3 −1
  33. arch/arm/mach-shmobile/board-mackerel.c +2 −2
  34. arch/arm/mm/flush.c +3 −3
  35. arch/arm/mm/init.c +1 −1
  36. arch/arm/xen/enlighten.c +3 −3
  37. arch/arm64/include/asm/xen/page-coherent.h +0 −4
  38. arch/arm64/kernel/ptrace.c +18 −20
  39. arch/mips/include/asm/cacheops.h +1 −1
  40. arch/mips/include/asm/r4kcache.h +26 −25
  41. arch/mips/mm/c-r4k.c +9 −2
  42. arch/parisc/include/asm/cacheflush.h +4 −8
  43. arch/parisc/include/asm/page.h +2 −3
  44. arch/parisc/kernel/cache.c +0 −35
  45. arch/powerpc/boot/dts/mpc5125twr.dts +5 −1
  46. arch/powerpc/include/asm/exception-64s.h +1 −1
  47. arch/powerpc/include/asm/kvm_book3s.h +4 −0
  48. arch/powerpc/include/asm/kvm_book3s_asm.h +2 −0
  49. arch/powerpc/include/asm/opal.h +2 −2
  50. arch/powerpc/include/asm/switch_to.h +1 −1
  51. arch/powerpc/include/asm/unaligned.h +6 −1
  52. arch/powerpc/kernel/asm-offsets.c +1 −0
  53. arch/powerpc/kernel/crash_dump.c +3 −3
  54. arch/powerpc/kernel/head_64.S +2 −0
  55. arch/powerpc/kernel/process.c +16 −16
  56. arch/powerpc/kernel/prom_init.c +13 −9
  57. arch/powerpc/kernel/ptrace.c +2 −2
  58. arch/powerpc/kernel/setup-common.c +2 −2
  59. arch/powerpc/kernel/smp.c +2 −2
  60. arch/powerpc/kvm/book3s_64_mmu_hv.c +14 −4
  61. arch/powerpc/kvm/book3s_hv.c +14 −10
  62. arch/powerpc/kvm/book3s_hv_rm_mmu.c +7 −2
  63. arch/powerpc/kvm/book3s_hv_rmhandlers.S +13 −10
  64. arch/powerpc/kvm/book3s_interrupts.S +11 −8
  65. arch/powerpc/kvm/book3s_pr.c +22 −0
  66. arch/powerpc/kvm/book3s_rmhandlers.S +1 −5
  67. arch/powerpc/kvm/booke.c +6 −6
  68. arch/powerpc/lib/copyuser_64.S +38 −15
  69. arch/powerpc/platforms/powernv/eeh-ioda.c +5 −15
  70. arch/powerpc/platforms/powernv/opal-lpc.c +6 −6
  71. arch/powerpc/platforms/powernv/opal-xscom.c +3 −1
  72. arch/powerpc/platforms/powernv/pci.h +3 −1
  73. arch/powerpc/platforms/pseries/lparcfg.c +6 −6
  74. arch/powerpc/platforms/pseries/msi.c +15 −13
  75. arch/powerpc/platforms/pseries/nvram.c +23 −23
  76. arch/powerpc/platforms/pseries/pci.c +4 −4
  77. arch/s390/Kconfig +0 −1
  78. arch/s390/include/asm/smp.h +2 −0
  79. arch/s390/kernel/setup.c +1 −0
  80. arch/s390/kernel/smp.c +16 −9
  81. arch/s390/pci/pci_event.c +2 −0
  82. arch/sh/kernel/sh_ksyms_32.c +5 −0
  83. arch/sh/lib/Makefile +1 −1
  84. arch/sparc/include/asm/pgtable_64.h +2 −2
  85. arch/sparc/include/asm/uaccess_64.h +2 −2
  86. arch/sparc/kernel/iommu.c +1 −1
  87. arch/sparc/kernel/ioport.c +2 −3
  88. arch/sparc/kernel/kgdb_64.c +1 −0
  89. arch/sparc/kernel/smp_64.c +2 −1
  90. arch/x86/Kconfig +1 −0
  91. arch/x86/include/asm/fpu-internal.h +7 −6
  92. arch/x86/include/asm/pgtable.h +9 −2
  93. arch/x86/include/asm/preempt.h +11 −0
  94. arch/x86/kernel/cpu/intel.c +2 −1
  95. arch/x86/kernel/cpu/perf_event.h +12 −3
  96. arch/x86/kernel/cpu/perf_event_amd_ibs.c +45 −8
  97. arch/x86/kernel/entry_32.S +2 −2
  98. arch/x86/kernel/entry_64.S +1 −1
  99. arch/x86/kvm/lapic.c +4 −4
  100. arch/x86/kvm/vmx.c +1 −2
  101. arch/x86/mm/fault.c +18 −0
  102. arch/x86/mm/gup.c +13 −0
  103. arch/x86/vdso/vclock_gettime.c +4 −4
  104. block/blk-mq-sysfs.c +13 −0
  105. drivers/acpi/Kconfig +0 −1
  106. drivers/acpi/ac.c +2 −2
  107. drivers/acpi/acpi_lpss.c +1 −0
  108. drivers/acpi/apei/Kconfig +0 −1
  109. drivers/acpi/apei/erst.c +1 −0
  110. drivers/acpi/battery.c +21 −1
  111. drivers/acpi/bus.c +10 −0
  112. drivers/ata/ahci.c +12 −9
  113. drivers/ata/ahci_imx.c +2 −1
  114. drivers/ata/libata-core.c +17 −2
  115. drivers/ata/libata-scsi.c +21 −0
  116. drivers/ata/sata_sis.c +4 −0
  117. drivers/block/null_blk.c +78 −34
  118. drivers/block/skd_main.c +2 −2
  119. drivers/bluetooth/ath3k.c +2 −0
  120. drivers/bluetooth/btusb.c +1 −0
  121. drivers/char/tpm/tpm_ppi.c +9 −6
  122. drivers/clk/clk-divider.c +1 −1
  123. drivers/clk/clk-s2mps11.c +3 −3
  124. drivers/clk/samsung/clk-exynos-audss.c +5 −5
  125. drivers/clk/samsung/clk-exynos4.c +1 −1
  126. drivers/clk/samsung/clk-exynos5250.c +9 −5
  127. drivers/clocksource/Kconfig +1 −0
  128. drivers/clocksource/cadence_ttc_timer.c +13 −8
  129. drivers/clocksource/clksrc-of.c +0 −1
  130. drivers/clocksource/dw_apb_timer_of.c +4 −3
  131. drivers/clocksource/sun4i_timer.c +3 −0
  132. drivers/clocksource/time-armada-370-xp.c +5 −5
  133. drivers/cpufreq/cpufreq.c +59 −45
  134. drivers/cpufreq/intel_pstate.c +7 −1
  135. drivers/cpuidle/cpuidle-calxeda.c +1 −1
  136. drivers/crypto/ixp4xx_crypto.c +1 −3
  137. drivers/dma/Kconfig +7 −0
  138. drivers/dma/at_hdmac_regs.h +0 −4
  139. drivers/dma/dmaengine.c +2 −2
  140. drivers/dma/dmatest.c +4 −4
  141. drivers/dma/fsldma.c +1 −30
  142. drivers/dma/ioat/dma.c +10 −1
  143. drivers/dma/mv_xor.c +63 −38
  144. drivers/dma/pl330.c +1 −4
  145. drivers/dma/ppc4xx/adma.c +1 −26
  146. drivers/dma/txx9dmac.c +0 −1
  147. drivers/firewire/sbp2.c +0 −1
  148. drivers/firmware/Makefile +1 −0
  149. drivers/firmware/efi/Kconfig +3 −3
  150. drivers/firmware/efi/Makefile +1 −1
  151. drivers/firmware/efi/efi-pstore.c +1 −0
  152. drivers/gpio/gpio-msm-v2.c +2 −2
  153. drivers/gpio/gpio-rcar.c +2 −1
  154. drivers/gpio/gpio-twl4030.c +12 −3
  155. drivers/gpu/drm/armada/armada_drm.h +1 −0
  156. drivers/gpu/drm/armada/armada_drv.c +6 −1
  157. drivers/gpu/drm/armada/armada_fbdev.c +15 −5
  158. drivers/gpu/drm/armada/armada_gem.c +4 −3
  159. drivers/gpu/drm/drm_edid.c +8 −0
  160. drivers/gpu/drm/drm_modes.c +1 −1
  161. drivers/gpu/drm/drm_stub.c +3 −3
  162. drivers/gpu/drm/i915/i915_dma.c +11 −9
  163. drivers/gpu/drm/i915/i915_drv.c +1 −0
  164. drivers/gpu/drm/i915/i915_drv.h +6 −3
  165. drivers/gpu/drm/i915/i915_gem.c +24 −10
  166. drivers/gpu/drm/i915/i915_gem_context.c +12 −4
  167. drivers/gpu/drm/i915/i915_gem_evict.c +11 −3
  168. drivers/gpu/drm/i915/i915_gem_execbuffer.c +20 −8
  169. drivers/gpu/drm/i915/i915_gem_gtt.c +7 −4
  170. drivers/gpu/drm/i915/i915_irq.c +2 −0
  171. drivers/gpu/drm/i915/intel_ddi.c +7 −1
  172. drivers/gpu/drm/i915/intel_display.c +22 −11
  173. drivers/gpu/drm/i915/intel_drv.h +1 −0
  174. drivers/gpu/drm/i915/intel_panel.c +23 −3
  175. drivers/gpu/drm/i915/intel_pm.c +39 −4
  176. drivers/gpu/drm/i915/intel_ringbuffer.c +1 −0
  177. drivers/gpu/drm/i915/intel_uncore.c +1 −0
  178. drivers/gpu/drm/nouveau/core/core/subdev.c +0 −3
  179. drivers/gpu/drm/nouveau/core/engine/device/base.c +2 −0
  180. drivers/gpu/drm/nouveau/core/engine/device/nvc0.c +1 −1
  181. drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c +1 −1
  182. drivers/gpu/drm/nouveau/core/include/subdev/fb.h +5 −0
  183. drivers/gpu/drm/nouveau/core/include/subdev/i2c.h +1 −1
  184. drivers/gpu/drm/nouveau/core/include/subdev/instmem.h +7 −0
  185. drivers/gpu/drm/nouveau/core/subdev/bios/init.c +9 −5
  186. drivers/gpu/drm/nouveau/core/subdev/i2c/base.c +2 −2
  187. drivers/gpu/drm/nouveau/core/subdev/therm/ic.c +5 −5
  188. drivers/gpu/drm/nouveau/dispnv04/dfp.c +1 −1
  189. drivers/gpu/drm/nouveau/dispnv04/tvnv04.c +1 −1
  190. drivers/gpu/drm/nouveau/nouveau_abi16.c +2 −0
  191. drivers/gpu/drm/nouveau/nouveau_acpi.c +14 −2
  192. drivers/gpu/drm/nouveau/nouveau_display.c +1 −1
  193. drivers/gpu/drm/nouveau/nouveau_drm.c +6 −0
  194. drivers/gpu/drm/qxl/Kconfig +1 −0
  195. drivers/gpu/drm/qxl/qxl_display.c +1 −1
  196. drivers/gpu/drm/radeon/atombios_crtc.c +52 −35
  197. drivers/gpu/drm/radeon/cik.c +7 −5
  198. drivers/gpu/drm/radeon/cik_sdma.c +1 −1
  199. drivers/gpu/drm/radeon/dce6_afmt.c +5 −3
  200. drivers/gpu/drm/radeon/evergreen_hdmi.c +2 −2
  201. drivers/gpu/drm/radeon/ni.c +16 −4
  202. drivers/gpu/drm/radeon/radeon.h +2 −2
  203. drivers/gpu/drm/radeon/radeon_asic.c +2 −2
  204. drivers/gpu/drm/radeon/radeon_atpx_handler.c +14 −2
  205. drivers/gpu/drm/radeon/radeon_drv.c +2 −11
  206. drivers/gpu/drm/radeon/radeon_kms.c +9 −0
  207. drivers/gpu/drm/radeon/radeon_uvd.c +1 −1
  208. drivers/gpu/drm/radeon/rs690.c +10 −0
  209. drivers/gpu/drm/radeon/rv770_dpm.c +6 −0
  210. drivers/gpu/drm/radeon/si.c +7 −5
  211. drivers/gpu/drm/ttm/ttm_bo_util.c +2 −1
  212. drivers/gpu/drm/ttm/ttm_bo_vm.c +3 −3
  213. drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c +3 −0
  214. drivers/hwmon/coretemp.c +1 −1
  215. drivers/idle/intel_idle.c +11 −6
  216. drivers/iio/adc/ad7887.c +14 −2
  217. drivers/iio/imu/adis16400_core.c +6 −1
  218. drivers/iio/light/cm36651.c +1 −1
  219. drivers/infiniband/core/iwcm.c +9 −2
  220. drivers/infiniband/core/uverbs.h +9 −1
  221. drivers/infiniband/core/uverbs_cmd.c +17 −0
  222. drivers/infiniband/core/uverbs_main.c +16 −11
  223. drivers/infiniband/hw/cxgb4/cm.c +20 −58
  224. drivers/infiniband/hw/cxgb4/mem.c +1 −1
  225. drivers/infiniband/ulp/ipoib/ipoib_netlink.c +2 −1
  226. drivers/infiniband/ulp/isert/ib_isert.c +16 −6
  227. drivers/input/input.c +4 −0
  228. drivers/input/touchscreen/zforce_ts.c +15 −6
  229. drivers/irqchip/irq-renesas-intc-irqpin.c +5 −3
  230. drivers/isdn/hisax/hfc_pci.c +0 −4
  231. drivers/isdn/hisax/telespci.c +0 −4
  232. drivers/leds/leds-lp5521.c +4 −8
  233. drivers/leds/leds-lp5523.c +4 −8
  234. drivers/md/bcache/alloc.c +2 −0
  235. drivers/md/bcache/bcache.h +6 −6
  236. drivers/md/bcache/btree.c +25 −2
  237. drivers/md/bcache/movinggc.c +15 −6
  238. drivers/md/bcache/super.c +1 −1
  239. drivers/md/bcache/sysfs.c +29 −21
  240. drivers/md/bcache/util.c +7 −1
  241. drivers/md/bcache/util.h +1 −1
  242. drivers/md/bcache/writeback.c +25 −28
  243. drivers/md/md.c +15 −3
  244. drivers/md/md.h +3 −0
  245. drivers/md/raid1.c +1 −2
  246. drivers/md/raid10.c +6 −6
  247. drivers/md/raid5.c +4 −3
  248. drivers/mfd/rtsx_pcr.c +8 −2
  249. drivers/mtd/maps/pxa2xx-flash.c +1 −1
  250. drivers/net/bonding/bond_3ad.c +33 −12
  251. drivers/net/bonding/bond_main.c +2 −1
  252. drivers/net/can/usb/ems_usb.c +2 −1
  253. drivers/net/can/usb/peak_usb/pcan_usb_pro.c +3 −0
  254. drivers/net/ethernet/arc/emac_main.c +2 −2
  255. drivers/net/ethernet/atheros/atl1c/atl1c_main.c +5 −3
  256. drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +40 −11
  257. drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +15 −13
  258. drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +2 −1
  259. drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +58 −36
  260. drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +3 −3
  261. drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h +1 −0
  262. drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c +11 −4
  263. drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h +7 −0
  264. drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +144 −110
  265. drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h +1 −0
  266. drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c +25 −3
  267. drivers/net/ethernet/broadcom/tg3.c +1 −1
  268. drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +21 −0
  269. drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +39 −20
  270. drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h +8 −1
  271. drivers/net/ethernet/chelsio/cxgb4/l2t.c +35 −0
  272. drivers/net/ethernet/chelsio/cxgb4/l2t.h +2 −1
  273. drivers/net/ethernet/chelsio/cxgb4/sge.c +1 −1
  274. drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +103 −0
  275. drivers/net/ethernet/chelsio/cxgb4/t4_regs.h +73 −0
  276. drivers/net/ethernet/emulex/benet/be.h +2 −1
  277. drivers/net/ethernet/emulex/benet/be_cmds.c +23 −10
  278. drivers/net/ethernet/emulex/benet/be_main.c +18 −11
  279. drivers/net/ethernet/freescale/fec_main.c +2 −2
  280. drivers/net/ethernet/intel/e1000e/80003es2lan.c +5 −2
  281. drivers/net/ethernet/intel/e1000e/netdev.c +2 −2
  282. drivers/net/ethernet/intel/e1000e/phy.c +7 −3
  283. drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +13 −20
  284. drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +2 −0
  285. drivers/net/ethernet/lantiq_etop.c +2 −1
  286. drivers/net/ethernet/marvell/mvmdio.c +6 −0
  287. drivers/net/ethernet/mellanox/mlx4/en_tx.c +2 −1
  288. drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +2 −1
  289. drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c +2 −2
  290. drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +5 −1
  291. drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +22 −32
  292. drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h +1 −0
  293. drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c +40 −25
  294. drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +30 −30
  295. drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c +4 −0
  296. drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +11 −11
  297. drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +5 −4
  298. drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c +2 −1
  299. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +9 −11
  300. drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c +2 −2
  301. drivers/net/ethernet/ti/cpsw.c +3 −1
  302. drivers/net/ethernet/tile/tilegx.c +2 −1
  303. drivers/net/hamradio/hdlcdrv.c +2 −0
  304. drivers/net/hamradio/yam.c +1 −0
  305. drivers/net/hyperv/netvsc_drv.c +8 −13
  306. drivers/net/macvlan.c +18 −8
  307. drivers/net/phy/phy.c +2 −4
  308. drivers/net/team/team.c +2 −1
  309. drivers/net/tun.c +2 −1
  310. drivers/net/usb/Kconfig +3 −3
  311. drivers/net/usb/dm9601.c +32 −12
  312. drivers/net/usb/hso.c +11 −2
  313. drivers/net/usb/mcs7830.c +4 −15
  314. drivers/net/virtio_net.c +6 −5
  315. drivers/net/vxlan.c +2 −1
  316. drivers/net/wireless/ath/ath9k/ar9002_mac.c +43 −9
  317. drivers/net/wireless/ath/ath9k/htc_drv_main.c +17 −8
  318. drivers/net/wireless/ath/ath9k/main.c +3 −2
  319. drivers/net/wireless/iwlwifi/pcie/drv.c +8 −2
  320. drivers/net/wireless/mac80211_hwsim.c +1 −1
  321. drivers/net/wireless/mwifiex/main.c +2 −1
  322. drivers/net/wireless/rtlwifi/pci.c +3 −1
  323. drivers/net/xen-netback/common.h +13 −6
  324. drivers/net/xen-netback/interface.c +11 −0
  325. drivers/net/xen-netback/netback.c +16 −5
  326. drivers/of/Kconfig +1 −1
  327. drivers/of/address.c +0 −8
  328. drivers/of/fdt.c +10 −2
  329. drivers/of/irq.c +1 −4
  330. drivers/pci/hotplug/acpiphp_glue.c +26 −4
  331. drivers/pci/pci-acpi.c +12 −9
  332. drivers/phy/Kconfig +2 −2
  333. drivers/phy/phy-core.c +10 −16
  334. drivers/pinctrl/pinctrl-baytrail.c +1 −0
  335. drivers/pinctrl/sh-pfc/sh_pfc.h +1 −1
  336. drivers/power/Kconfig +1 −0
  337. drivers/power/power_supply_core.c +6 −6
  338. drivers/powercap/intel_rapl.c +11 −2
  339. drivers/regulator/s2mps11.c +1 −1
  340. drivers/s390/char/tty3270.c +1 −1
  341. drivers/scsi/qla2xxx/qla_target.c +6 −4
  342. drivers/staging/bcm/Bcmnet.c +2 −1
  343. drivers/staging/comedi/drivers.c +1 −1
  344. drivers/staging/comedi/drivers/8255_pci.c +12 −3
  345. drivers/staging/iio/magnetometer/hmc5843.c +6 −1
  346. drivers/staging/imx-drm/imx-drm-core.c +29 −10
  347. drivers/staging/imx-drm/imx-tve.c +0 −9
  348. drivers/staging/imx-drm/ipu-v3/ipu-common.c +16 −16
  349. drivers/staging/netlogic/xlr_net.c +2 −1
  350. drivers/staging/rtl8188eu/os_dep/os_intfs.c +2 −1
  351. drivers/target/iscsi/iscsi_target.c +13 −14
  352. drivers/target/iscsi/iscsi_target_configfs.c +2 −1
  353. drivers/target/iscsi/iscsi_target_login.c +0 −6
  354. drivers/target/target_core_device.c +5 −0
  355. drivers/target/target_core_file.c +4 −4
  356. drivers/target/target_core_file.h +4 −1
  357. drivers/target/target_core_tpg.c +1 −9
  358. drivers/tty/n_tty.c +6 −1
  359. drivers/tty/serial/8250/8250_dw.c +6 −2
  360. drivers/tty/serial/xilinx_uartps.c +2 −0
  361. drivers/tty/tty_ldsem.c +13 −3
  362. drivers/usb/chipidea/core.c +4 −0
  363. drivers/usb/chipidea/host.c +2 −1
  364. drivers/usb/chipidea/udc.c +0 −3
  365. drivers/usb/class/cdc-wdm.c +3 −5
  366. drivers/usb/dwc3/core.c +5 −3
  367. drivers/usb/host/ohci-at91.c +15 −11
  368. drivers/usb/host/xhci-pci.c +6 −1
  369. drivers/usb/phy/Kconfig +3 −1
  370. drivers/usb/phy/phy-tegra-usb.c +1 −1
  371. drivers/usb/phy/phy-twl6030-usb.c +2 −1
  372. drivers/usb/serial/option.c +2 −0
  373. drivers/usb/serial/zte_ev.c +1 −2
  374. drivers/virtio/virtio_balloon.c +1 −1
  375. drivers/xen/balloon.c +34 −29
  376. drivers/xen/grant-table.c +2 −1
  377. drivers/xen/privcmd.c +7 −2
  378. fs/aio.c +69 −44
  379. fs/ceph/addr.c +6 −2
  380. fs/ceph/inode.c +58 −78
  381. fs/cifs/cifsproto.h +4 −3
  382. fs/cifs/cifssmb.c +3 −3
  383. fs/cifs/dir.c +6 −5
  384. fs/cifs/inode.c +4 −2
  385. fs/cifs/link.c +11 −15
  386. fs/eventpoll.c +0 −4
  387. fs/ext2/super.c +1 −0
  388. fs/ext4/ext4.h +10 −0
  389. fs/ext4/ext4_jbd2.c +9 −0
  390. fs/ext4/extents.c +30 −15
  391. fs/ext4/inode.c +0 −12
  392. fs/ext4/mballoc.c +11 −6
  393. fs/ext4/super.c +15 −6
  394. fs/fs-writeback.c +9 −6
  395. fs/gfs2/aops.c +30 −0
  396. fs/gfs2/glock.c +2 −0
  397. fs/gfs2/glops.c +8 −2
  398. fs/gfs2/log.c +2 −2
  399. fs/gfs2/meta_io.c +5 −0
  400. fs/gfs2/ops_fstype.c +11 −1
  401. fs/jbd2/journal.c +8 −10
  402. fs/jbd2/recovery.c +1 −1
  403. fs/jbd2/transaction.c +9 −7
  404. fs/nilfs2/segment.c +6 −4
  405. fs/pstore/platform.c +5 −2
  406. fs/sysfs/file.c +3 −5
  407. fs/xfs/xfs_attr_remote.c +1 −1
  408. fs/xfs/xfs_bmap.c +24 −8
  409. fs/xfs/xfs_bmap_util.c +13 −2
  410. fs/xfs/xfs_buf.c +14 −23
  411. fs/xfs/xfs_buf.h +7 −4
  412. fs/xfs/xfs_buf_item.c +19 −2
  413. fs/xfs/xfs_dir2_node.c +13 −13
  414. fs/xfs/xfs_iops.c +2 −1
  415. fs/xfs/xfs_log_recover.c +11 −2
  416. fs/xfs/xfs_qm.c +53 −27
  417. fs/xfs/xfs_trans_buf.c +12 −1
  418. include/acpi/acpi_bus.h +3 −1
  419. include/asm-generic/pgtable.h +3 −4
  420. include/asm-generic/preempt.h +11 −24
  421. include/drm/drm_pciids.h +1 −1
  422. include/linux/auxvec.h +1 −1
  423. include/linux/crash_dump.h +2 −0
  424. include/linux/i2c.h +1 −1
  425. include/linux/libata.h +1 −0
  426. include/linux/lockref.h +1 −1
  427. include/linux/math64.h +30 −0
  428. include/linux/migrate.h +11 −1
  429. include/linux/mm.h +3 −3
  430. include/linux/mm_types.h +51 −1
  431. include/linux/netdevice.h +30 −4
  432. include/linux/percpu-defs.h +1 −0
  433. include/linux/pstore.h +3 −0
  434. include/linux/reboot.h +1 −0
  435. include/linux/rtnetlink.h +5 −0
  436. include/linux/sched.h +2 −3
  437. include/linux/seqlock.h +19 −8
  438. include/linux/skbuff.h +9 −0
  439. include/net/llc_pdu.h +1 −1
  440. include/net/sctp/structs.h +0 −3
  441. include/rdma/ib_verbs.h +1 −1
  442. include/target/target_core_base.h +1 −4
  443. include/uapi/drm/radeon_drm.h +2 −0
  444. include/uapi/drm/vmwgfx_drm.h +1 −0
  445. include/uapi/linux/input.h +2 −1
  446. include/uapi/linux/perf_event.h +1 −0
  447. include/xen/interface/io/blkif.h +5 −5
  448. init/Kconfig +6 −0
  449. kernel/Makefile +4 −3
  450. kernel/bounds.c +1 −1
  451. kernel/cgroup.c +32 −18
  452. kernel/events/core.c +18 −3
  453. kernel/fork.c +1 −0
  454. kernel/freezer.c +6 −0
  455. kernel/kexec.c +1 −0
  456. kernel/power/console.c +1 −0
  457. kernel/reboot.c +1 −1
  458. kernel/sched/core.c +4 −2
  459. kernel/sched/fair.c +72 −81
  460. kernel/sched/rt.c +14 −0
  461. kernel/time/sched_clock.c +3 −3
  462. kernel/trace/ftrace.c +1 −1
  463. kernel/user.c +3 −3
  464. lib/percpu_counter.c +2 −2
  465. mm/Kconfig +1 −1
  466. mm/compaction.c +4 −0
  467. mm/fremap.c +5 −3
  468. mm/huge_memory.c +36 −12
  469. mm/memcontrol.c +1 −1
  470. mm/memory-failure.c +20 −4
  471. mm/memory.c +1 −1
  472. mm/mempolicy.c +9 −7
  473. mm/migrate.c +65 −17
  474. mm/mlock.c +32 −12
  475. mm/mprotect.c +11 −2
  476. mm/page_alloc.c +9 −10
  477. mm/pgtable-generic.c +6 −2
  478. mm/rmap.c +4 −0
  479. mm/util.c +4 −1
  480. net/8021q/vlan_dev.c +18 −1
  481. net/batman-adv/bat_iv_ogm.c +18 −18
  482. net/batman-adv/distributed-arp-table.c +3 −3
  483. net/batman-adv/fragmentation.c +4 −4
  484. net/batman-adv/icmp_socket.c +3 −3
  485. net/batman-adv/main.c +8 −8
  486. net/batman-adv/network-coding.c +11 −11
  487. net/batman-adv/packet.h +94 −30
  488. net/batman-adv/routing.c +15 −15
  489. net/batman-adv/send.c +5 −5
  490. net/batman-adv/soft-interface.c +12 −6
  491. net/batman-adv/translation-table.c +4 −2
  492. net/bluetooth/hci_sock.c +16 −10
  493. net/bridge/br_multicast.c +2 −2
  494. net/core/dev.c +18 −13
  495. net/core/flow_dissector.c +7 −3
  496. net/core/neighbour.c +2 −1
  497. net/core/netpoll.c +10 −3
  498. net/dccp/probe.c +7 −12
  499. net/ieee802154/6lowpan.c +1 −1
  500. net/ipv4/gre_offload.c +7 −4
  501. net/ipv4/inet_diag.c +16 −0
  502. net/ipv4/ip_gre.c +1 −0
  503. net/ipv4/ip_output.c +3 −2
  504. net/ipv4/netfilter/ipt_SYNPROXY.c +1 −0
  505. net/ipv4/netfilter/nft_reject_ipv4.c +1 −1
  506. net/ipv4/udp.c +9 −10
  507. net/ipv4/udp_offload.c +19 −18
  508. net/ipv6/addrconf.c +16 −7
  509. net/ipv6/ip6_output.c +27 −9
  510. net/ipv6/ip6_tunnel.c +16 −5
  511. net/ipv6/ip6_vti.c +9 −21
  512. net/ipv6/netfilter/ip6t_SYNPROXY.c +1 −0
  513. net/ipv6/route.c +1 −3
  514. net/ipv6/sit.c +6 −2
  515. net/llc/af_llc.c +3 −2
  516. net/mac80211/iface.c +4 −2
  517. net/mac80211/tx.c +13 −10
  518. net/netfilter/ipvs/ip_vs_nfct.c +6 −0
  519. net/netfilter/nf_conntrack_seqadj.c +5 −0
  520. net/netfilter/nf_conntrack_timestamp.c +0 −1
  521. net/netfilter/nf_nat_irc.c +27 −5
  522. net/netfilter/nf_tables_api.c +20 −6
  523. net/netfilter/nfnetlink_log.c +1 −0
  524. net/netfilter/nft_exthdr.c +1 −1
  525. net/nfc/core.c +1 −1
  526. net/rds/ib.c +2 −1
  527. net/rose/af_rose.c +4 −12
  528. net/sched/act_csum.c +5 −5
  529. net/sched/act_gact.c +4 −3
  530. net/sched/act_ipt.c +5 −3
  531. net/sched/act_nat.c +5 −5
  532. net/sched/act_pedit.c +5 −3
  533. net/sched/act_police.c +3 −1
  534. net/sched/act_simple.c +6 −3
  535. net/sched/act_skbedit.c +4 −3
  536. net/sched/sch_generic.c +1 −1
  537. net/sctp/outqueue.c +7 −25
  538. net/sctp/probe.c +16 −1
  539. net/tipc/link.c +1 −0
  540. net/tipc/port.c +15 −30
  541. net/tipc/port.h +3 −3
  542. net/tipc/socket.c +31 −15
  543. net/unix/af_unix.c +6 −2
  544. net/wireless/radiotap.c +4 −0
  545. net/wireless/sme.c +12 −10
  546. scripts/link-vmlinux.sh +3 −1
  547. security/selinux/hooks.c +23 −5
  548. security/selinux/include/objsec.h +4 −1
  549. sound/core/pcm_lib.c +2 −0
  550. sound/pci/hda/hda_intel.c +4 −0
  551. sound/pci/hda/patch_realtek.c +4 −0
  552. sound/soc/atmel/atmel_ssc_dai.c +29 −1
  553. sound/soc/atmel/sam9x5_wm8731.c +1 −1
  554. sound/soc/codecs/wm5110.c +1 −1
  555. sound/soc/codecs/wm8904.c +1 −1
  556. sound/soc/codecs/wm8962.c +13 −0
  557. sound/soc/codecs/wm_adsp.c +7 −3
  558. sound/soc/fsl/imx-wm8962.c +0 −2
  559. sound/soc/kirkwood/kirkwood-i2s.c +12 −12
  560. sound/soc/soc-generic-dmaengine-pcm.c +27 −11
  561. sound/soc/soc-pcm.c +3 −2
  562. sound/soc/tegra/tegra20_i2s.c +3 −3
  563. sound/soc/tegra/tegra20_spdif.c +5 −5
  564. sound/soc/tegra/tegra30_i2s.c +3 −3
  565. tools/power/cpupower/utils/cpupower-set.c +3 −3
Documentation/block/null_blk.txt+72−0
@@ -0,0 +1,72 @@
1+Null block device driver
2+================================================================================
3+
4+I. Overview
5+
6+The null block device (/dev/nullb*) is used for benchmarking the various
7+block-layer implementations. It emulates a block device of X gigabytes in size.
8+The following instances are possible:
9+
10+ Single-queue block-layer
11+ - Request-based.
12+ - Single submission queue per device.
13+ - Implements IO scheduling algorithms (CFQ, Deadline, noop).
14+ Multi-queue block-layer
15+ - Request-based.
16+ - Configurable submission queues per device.
17+ No block-layer (Known as bio-based)
18+ - Bio-based. IO requests are submitted directly to the device driver.
19+ - Directly accepts bio data structure and returns them.
20+
21+All of them have a completion queue for each core in the system.
22+
23+II. Module parameters applicable for all instances:
24+
25+queue_mode=[0-2]: Default: 2-Multi-queue
26+ Selects which block-layer the module should instantiate with.
27+
28+ 0: Bio-based.
29+ 1: Single-queue.
30+ 2: Multi-queue.
31+
32+home_node=[0--nr_nodes]: Default: NUMA_NO_NODE
33+ Selects what CPU node the data structures are allocated from.
34+
35+gb=[Size in GB]: Default: 250GB
36+ The size of the device reported to the system.
37+
38+bs=[Block size (in bytes)]: Default: 512 bytes
39+ The block size reported to the system.
40+
41+nr_devices=[Number of devices]: Default: 2
42+ Number of block devices instantiated. They are instantiated as /dev/nullb0,
43+ etc.
44+
45+irq_mode=[0-2]: Default: 1-Soft-irq
46+ The completion mode used for completing IOs to the block-layer.
47+
48+ 0: None.
49+ 1: Soft-irq. Uses IPI to complete IOs across CPU nodes. Simulates the overhead
50+ when IOs are issued from another CPU node than the home the device is
51+ connected to.
52+ 2: Timer: Waits a specific period (completion_nsec) for each IO before
53+ completion.
54+
55+completion_nsec=[ns]: Default: 10.000ns
56+ Combined with irq_mode=2 (timer). The time each completion event must wait.
57+
58+submit_queues=[0..nr_cpus]:
59+ The number of submission queues attached to the device driver. If unset, it
60+ defaults to 1 on single-queue and bio-based instances. For multi-queue,
61+ it is ignored when use_per_node_hctx module parameter is 1.
62+
63+hw_queue_depth=[0..qdepth]: Default: 64
64+ The hardware queue depth of the device.
65+
66+III: Multi-queue specific parameters
67+
68+use_per_node_hctx=[0/1]: Default: 0
69+ 0: The number of submit queues are set to the value of the submit_queues
70+ parameter.
71+ 1: The multi-queue block layer is instantiated with a hardware dispatch
72+ queue for each CPU node in the system.
Documentation/devicetree/bindings/clock/exynos5250-clock.txt+2−0
@@ -159,6 +159,8 @@ clock which they consume. · 158 unmodified lines
159159 mixer 343
160160 hdmi 344
161161 g2d 345
162+ mdma0 346
163+ smmu_mdma0 347
162164
163165
164166 [Clock Muxes]
Documentation/kernel-parameters.txt+2−0
@@ -1529,6 +1529,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted. · 1528 unmodified lines
15291529
15301530 * atapi_dmadir: Enable ATAPI DMADIR bridge support
15311531
1532+ * disable: Disable this device.
1533+
15321534 If there are multiple matching configurations changing
15331535 the same attribute, the last one is used.
15341536
Documentation/module-signing.txt+240−0
@@ -0,0 +1,240 @@
1+ ==============================
2+ KERNEL MODULE SIGNING FACILITY
3+ ==============================
4+
5+CONTENTS
6+
7+ - Overview.
8+ - Configuring module signing.
9+ - Generating signing keys.
10+ - Public keys in the kernel.
11+ - Manually signing modules.
12+ - Signed modules and stripping.
13+ - Loading signed modules.
14+ - Non-valid signatures and unsigned modules.
15+ - Administering/protecting the private key.
16+
17+
18+========
19+OVERVIEW
20+========
21+
22+The kernel module signing facility cryptographically signs modules during
23+installation and then checks the signature upon loading the module. This
24+allows increased kernel security by disallowing the loading of unsigned modules
25+or modules signed with an invalid key. Module signing increases security by
26+making it harder to load a malicious module into the kernel. The module
27+signature checking is done by the kernel so that it is not necessary to have
28+trusted userspace bits.
29+
30+This facility uses X.509 ITU-T standard certificates to encode the public keys
31+involved. The signatures are not themselves encoded in any industrial standard
32+type. The facility currently only supports the RSA public key encryption
33+standard (though it is pluggable and permits others to be used). The possible
34+hash algorithms that can be used are SHA-1, SHA-224, SHA-256, SHA-384, and
35+SHA-512 (the algorithm is selected by data in the signature).
36+
37+
38+==========================
39+CONFIGURING MODULE SIGNING
40+==========================
41+
42+The module signing facility is enabled by going to the "Enable Loadable Module
43+Support" section of the kernel configuration and turning on
44+
45+ CONFIG_MODULE_SIG "Module signature verification"
46+
47+This has a number of options available:
48+
49+ (1) "Require modules to be validly signed" (CONFIG_MODULE_SIG_FORCE)
50+
51+ This specifies how the kernel should deal with a module that has a
52+ signature for which the key is not known or a module that is unsigned.
53+
54+ If this is off (ie. "permissive"), then modules for which the key is not
55+ available and modules that are unsigned are permitted, but the kernel will
56+ be marked as being tainted.
57+
58+ If this is on (ie. "restrictive"), only modules that have a valid
59+ signature that can be verified by a public key in the kernel's possession
60+ will be loaded. All other modules will generate an error.
61+
62+ Irrespective of the setting here, if the module has a signature block that
63+ cannot be parsed, it will be rejected out of hand.
64+
65+
66+ (2) "Automatically sign all modules" (CONFIG_MODULE_SIG_ALL)
67+
68+ If this is on then modules will be automatically signed during the
69+ modules_install phase of a build. If this is off, then the modules must
70+ be signed manually using:
71+
72+ scripts/sign-file
73+
74+
75+ (3) "Which hash algorithm should modules be signed with?"
76+
77+ This presents a choice of which hash algorithm the installation phase will
78+ sign the modules with:
79+
80+ CONFIG_SIG_SHA1 "Sign modules with SHA-1"
81+ CONFIG_SIG_SHA224 "Sign modules with SHA-224"
82+ CONFIG_SIG_SHA256 "Sign modules with SHA-256"
83+ CONFIG_SIG_SHA384 "Sign modules with SHA-384"
84+ CONFIG_SIG_SHA512 "Sign modules with SHA-512"
85+
86+ The algorithm selected here will also be built into the kernel (rather
87+ than being a module) so that modules signed with that algorithm can have
88+ their signatures checked without causing a dependency loop.
89+
90+
91+=======================
92+GENERATING SIGNING KEYS
93+=======================
94+
95+Cryptographic keypairs are required to generate and check signatures. A
96+private key is used to generate a signature and the corresponding public key is
97+used to check it. The private key is only needed during the build, after which
98+it can be deleted or stored securely. The public key gets built into the
99+kernel so that it can be used to check the signatures as the modules are
100+loaded.
101+
102+Under normal conditions, the kernel build will automatically generate a new
103+keypair using openssl if one does not exist in the files:
104+
105+ signing_key.priv
106+ signing_key.x509
107+
108+during the building of vmlinux (the public part of the key needs to be built
109+into vmlinux) using parameters in the:
110+
111+ x509.genkey
112+
113+file (which is also generated if it does not already exist).
114+
115+It is strongly recommended that you provide your own x509.genkey file.
116+
117+Most notably, in the x509.genkey file, the req_distinguished_name section
118+should be altered from the default:
119+
120+ [ req_distinguished_name ]
121+ O = Magrathea
122+ CN = Glacier signing key
123+ emailAddress = slartibartfast@magrathea.h2g2
124+
125+The generated RSA key size can also be set with:
126+
127+ [ req ]
128+ default_bits = 4096
129+
130+
131+It is also possible to manually generate the key private/public files using the
132+x509.genkey key generation configuration file in the root node of the Linux
133+kernel sources tree and the openssl command. The following is an example to
134+generate the public/private key files:
135+
136+ openssl req -new -nodes -utf8 -sha256 -days 36500 -batch -x509 \
137+ -config x509.genkey -outform DER -out signing_key.x509 \
138+ -keyout signing_key.priv
139+
140+
141+=========================
142+PUBLIC KEYS IN THE KERNEL
143+=========================
144+
145+The kernel contains a ring of public keys that can be viewed by root. They're
146+in a keyring called ".system_keyring" that can be seen by:
147+
148+ [root@deneb ~]# cat /proc/keys
149+ ...
150+ 223c7853 I------ 1 perm 1f030000 0 0 keyring .system_keyring: 1
151+ 302d2d52 I------ 1 perm 1f010000 0 0 asymmetri Fedora kernel signing key: d69a84e6bce3d216b979e9505b3e3ef9a7118079: X509.RSA a7118079 []
152+ ...
153+
154+Beyond the public key generated specifically for module signing, any file
155+placed in the kernel source root directory or the kernel build root directory
156+whose name is suffixed with ".x509" will be assumed to be an X.509 public key
157+and will be added to the keyring.
158+
159+Further, the architecture code may take public keys from a hardware store and
160+add those in also (e.g. from the UEFI key database).
161+
162+Finally, it is possible to add additional public keys by doing:
163+
164+ keyctl padd asymmetric "" [.system_keyring-ID] <[key-file]
165+
166+e.g.:
167+
168+ keyctl padd asymmetric "" 0x223c7853 <my_public_key.x509
169+
170+Note, however, that the kernel will only permit keys to be added to
171+.system_keyring _if_ the new key's X.509 wrapper is validly signed by a key
172+that is already resident in the .system_keyring at the time the key was added.
173+
174+
175+=========================
176+MANUALLY SIGNING MODULES
177+=========================
178+
179+To manually sign a module, use the scripts/sign-file tool available in
180+the Linux kernel source tree. The script requires 4 arguments:
181+
182+ 1. The hash algorithm (e.g., sha256)
183+ 2. The private key filename
184+ 3. The public key filename
185+ 4. The kernel module to be signed
186+
187+The following is an example to sign a kernel module:
188+
189+ scripts/sign-file sha512 kernel-signkey.priv \
190+ kernel-signkey.x509 module.ko
191+
192+The hash algorithm used does not have to match the one configured, but if it
193+doesn't, you should make sure that hash algorithm is either built into the
194+kernel or can be loaded without requiring itself.
195+
196+
197+============================
198+SIGNED MODULES AND STRIPPING
199+============================
200+
201+A signed module has a digital signature simply appended at the end. The string
202+"~Module signature appended~." at the end of the module's file confirms that a
203+signature is present but it does not confirm that the signature is valid!
204+
205+Signed modules are BRITTLE as the signature is outside of the defined ELF
206+container. Thus they MAY NOT be stripped once the signature is computed and
207+attached. Note the entire module is the signed payload, including any and all
208+debug information present at the time of signing.
209+
210+
211+======================
212+LOADING SIGNED MODULES
213+======================
214+
215+Modules are loaded with insmod, modprobe, init_module() or finit_module(),
216+exactly as for unsigned modules as no processing is done in userspace. The
217+signature checking is all done within the kernel.
218+
219+
220+=========================================
221+NON-VALID SIGNATURES AND UNSIGNED MODULES
222+=========================================
223+
224+If CONFIG_MODULE_SIG_FORCE is enabled or enforcemodulesig=1 is supplied on
225+the kernel command line, the kernel will only load validly signed modules
226+for which it has a public key. Otherwise, it will also load modules that are
227+unsigned. Any module for which the kernel has a key, but which proves to have
228+a signature mismatch will not be permitted to load.
229+
230+Any module that has an unparseable signature will be rejected.
231+
232+
233+=========================================
234+ADMINISTERING/PROTECTING THE PRIVATE KEY
235+=========================================
236+
237+Since the private key is used to sign modules, viruses and malware could use
238+the private key to sign modules and compromise the operating system. The
239+private key must be either destroyed or moved to a secure location and not kept
240+in the root node of the kernel source tree.
Documentation/networking/ip-sysctl.txt+6−2
@@ -16,8 +16,12 @@ ip_default_ttl - INTEGER · 15 unmodified lines
1616 Default: 64 (as recommended by RFC1700)
1717
1818 ip_no_pmtu_disc - BOOLEAN
19− Disable Path MTU Discovery.
20− default FALSE
19+ Disable Path MTU Discovery. If enabled and a
20+ fragmentation-required ICMP is received, the PMTU to this
21+ destination will be set to min_pmtu (see below). You will need
22+ to raise min_pmtu to the smallest interface MTU on your system
23+ manually if you want to avoid locally generated fragments.
24+ Default: FALSE
2125
2226 min_pmtu - INTEGER
2327 default 552 - minimum discovered Path MTU
MAINTAINERS+31−7
@@ -783,7 +783,7 @@ F: arch/arm/boot/dts/sama*.dts · 782 unmodified lines
783783 F: arch/arm/boot/dts/sama*.dtsi
784784
785785 ARM/CALXEDA HIGHBANK ARCHITECTURE
786−M: Rob Herring <rob.herring@calxeda.com>
786+M: Rob Herring <robh@kernel.org>
787787 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
788788 S: Maintained
789789 F: arch/arm/mach-highbank/
@@ -1008,6 +1008,8 @@ M: Santosh Shilimkar <santosh.shilimkar@ti.com> · 218 unmodified lines
10081008 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
10091009 S: Maintained
10101010 F: arch/arm/mach-keystone/
1011+F: drivers/clk/keystone/
1012+T: git git://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux-keystone.git
10111013
10121014 ARM/LOGICPD PXA270 MACHINE SUPPORT
10131015 M: Lennert Buytenhek <kernel@wantstofly.org>
@@ -1366,6 +1368,9 @@ T: git git://git.xilinx.com/linux-xlnx.git · 352 unmodified lines
13661368 S: Supported
13671369 F: arch/arm/mach-zynq/
13681370 F: drivers/cpuidle/cpuidle-zynq.c
1371+N: zynq
1372+N: xilinx
1373+F: drivers/clocksource/cadence_ttc_timer.c
13691374
13701375 ARM SMMU DRIVER
13711376 M: Will Deacon <will.deacon@arm.com>
@@ -2823,8 +2828,10 @@ F: include/uapi/drm/ · 1451 unmodified lines
28232828
28242829 INTEL DRM DRIVERS (excluding Poulsbo, Moorestown and derivative chipsets)
28252830 M: Daniel Vetter <daniel.vetter@ffwll.ch>
2831+M: Jani Nikula <jani.nikula@linux.intel.com>
28262832 L: intel-gfx@lists.freedesktop.org
28272833 L: dri-devel@lists.freedesktop.org
2834+Q: http://patchwork.freedesktop.org/project/intel-gfx/
28282835 T: git git://people.freedesktop.org/~danvet/drm-intel
28292836 S: Supported
28302837 F: drivers/gpu/drm/i915/
@@ -3761,9 +3768,11 @@ F: include/uapi/linux/gigaset_dev.h · 930 unmodified lines
37613768
37623769 GPIO SUBSYSTEM
37633770 M: Linus Walleij <linus.walleij@linaro.org>
3764−S: Maintained
3771+M: Alexandre Courbot <gnurou@gmail.com>
37653772 L: linux-gpio@vger.kernel.org
3766−F: Documentation/gpio.txt
3773+T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git
3774+S: Maintained
3775+F: Documentation/gpio/
37673776 F: drivers/gpio/
37683777 F: include/linux/gpio*
37693778 F: include/asm-generic/gpio.h
@@ -3831,6 +3840,12 @@ T: git git://linuxtv.org/media_tree.git · 61 unmodified lines
38313840 S: Maintained
38323841 F: drivers/media/usb/gspca/
38333842
3843+GUID PARTITION TABLE (GPT)
3844+M: Davidlohr Bueso <davidlohr@hp.com>
3845+L: linux-efi@vger.kernel.org
3846+S: Maintained
3847+F: block/partitions/efi.*
3848+
38343849 STK1160 USB VIDEO CAPTURE DRIVER
38353850 M: Ezequiel Garcia <elezegarcia@gmail.com>
38363851 L: linux-media@vger.kernel.org
@@ -5911,12 +5926,21 @@ M: Steffen Klassert <steffen.klassert@secunet.com> · 2074 unmodified lines
59115926 M: Herbert Xu <herbert@gondor.apana.org.au>
59125927 M: "David S. Miller" <davem@davemloft.net>
59135928 L: netdev@vger.kernel.org
5914−T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git
5929+T: git git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec.git
5930+T: git git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next.git
59155931 S: Maintained
59165932 F: net/xfrm/
59175933 F: net/key/
59185934 F: net/ipv4/xfrm*
5935+F: net/ipv4/esp4.c
5936+F: net/ipv4/ah4.c
5937+F: net/ipv4/ipcomp.c
5938+F: net/ipv4/ip_vti.c
59195939 F: net/ipv6/xfrm*
5940+F: net/ipv6/esp6.c
5941+F: net/ipv6/ah6.c
5942+F: net/ipv6/ipcomp6.c
5943+F: net/ipv6/ip6_vti.c
59205944 F: include/uapi/linux/xfrm.h
59215945 F: include/net/xfrm.h
59225946
@@ -6237,7 +6261,7 @@ F: drivers/i2c/busses/i2c-ocores.c · 314 unmodified lines
62376261
62386262 OPEN FIRMWARE AND FLATTENED DEVICE TREE
62396263 M: Grant Likely <grant.likely@linaro.org>
6240−M: Rob Herring <rob.herring@calxeda.com>
6264+M: Rob Herring <robh+dt@kernel.org>
62416265 L: devicetree@vger.kernel.org
62426266 W: http://fdt.secretlab.ca
62436267 T: git git://git.secretlab.ca/git/linux-2.6.git
@@ -6249,7 +6273,7 @@ K: of_get_property · 5 unmodified lines
62496273 K: of_match_table
62506274
62516275 OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS
6252−M: Rob Herring <rob.herring@calxeda.com>
6276+M: Rob Herring <robh+dt@kernel.org>
62536277 M: Pawel Moll <pawel.moll@arm.com>
62546278 M: Mark Rutland <mark.rutland@arm.com>
62556279 M: Ian Campbell <ijc+devicetree@hellion.org.uk>
@@ -9571,7 +9595,7 @@ F: drivers/xen/*swiotlb* · 3315 unmodified lines
95719595
95729596 XFS FILESYSTEM
95739597 P: Silicon Graphics Inc
9574−M: Dave Chinner <dchinner@fromorbit.com>
9598+M: Dave Chinner <david@fromorbit.com>
95759599 M: Ben Myers <bpm@sgi.com>
95769600 M: xfs@oss.sgi.com
95779601 L: xfs@oss.sgi.com
Makefile+10−14
@@ -1,7 +1,7 @@
11 VERSION = 3
22 PATCHLEVEL = 13
33 SUBLEVEL = 0
4−EXTRAVERSION = -rc4
4+EXTRAVERSION = -rc8
55 NAME = One Giant Leap for Frogkind
66
77 # *DOCUMENTATION*
@@ -732,19 +732,15 @@ export mod_strip_cmd · 724 unmodified lines
732732 # Select initial ramdisk compression format, default is gzip(1).
733733 # This shall be used by the dracut(8) tool while creating an initramfs image.
734734 #
735−INITRD_COMPRESS=gzip
736−ifeq ($(CONFIG_RD_BZIP2), y)
737− INITRD_COMPRESS=bzip2
738−else ifeq ($(CONFIG_RD_LZMA), y)
739− INITRD_COMPRESS=lzma
740−else ifeq ($(CONFIG_RD_XZ), y)
741− INITRD_COMPRESS=xz
742−else ifeq ($(CONFIG_RD_LZO), y)
743− INITRD_COMPRESS=lzo
744−else ifeq ($(CONFIG_RD_LZ4), y)
745− INITRD_COMPRESS=lz4
746−endif
747−export INITRD_COMPRESS
735+INITRD_COMPRESS-y := gzip
736+INITRD_COMPRESS-$(CONFIG_RD_BZIP2) := bzip2
737+INITRD_COMPRESS-$(CONFIG_RD_LZMA) := lzma
738+INITRD_COMPRESS-$(CONFIG_RD_XZ) := xz
739+INITRD_COMPRESS-$(CONFIG_RD_LZO) := lzo
740+INITRD_COMPRESS-$(CONFIG_RD_LZ4) := lz4
741+# do not export INITRD_COMPRESS, since we didn't actually
742+# choose a sane default compression above.
743+# export INITRD_COMPRESS := $(INITRD_COMPRESS-y)
748744
749745 ifdef CONFIG_MODULE_SIG_ALL
750746 MODSECKEY = ./signing_key.priv
arch/arc/include/uapi/asm/unistd.h+7−1
@@ -8,7 +8,11 @@ · 7 unmodified lines
88
99 /******** no-legacy-syscalls-ABI *******/
1010
11−#ifndef _UAPI_ASM_ARC_UNISTD_H
11+/*
12+ * Non-typical guard macro to enable inclusion twice in ARCH sys.c
13+ * That is how the Generic syscall wrapper generator works
14+ */
15+#if !defined(_UAPI_ASM_ARC_UNISTD_H) || defined(__SYSCALL)
1216 #define _UAPI_ASM_ARC_UNISTD_H
1317
1418 #define __ARCH_WANT_SYS_EXECVE
@@ -36,4 +40,6 @@ __SYSCALL(__NR_arc_gettls, sys_arc_gettls) · 21 unmodified lines
3640 #define __NR_sysfs (__NR_arch_specific_syscall + 3)
3741 __SYSCALL(__NR_sysfs, sys_sysfs)
3842
43+#undef __SYSCALL
44+
3945 #endif
arch/arm/boot/dts/exynos5250.dtsi+1−1
@@ -559,7 +559,7 @@ · 558 unmodified lines
559559 compatible = "arm,pl330", "arm,primecell";
560560 reg = <0x10800000 0x1000>;
561561 interrupts = <0 33 0>;
562− clocks = <&clock 271>;
562+ clocks = <&clock 346>;
563563 clock-names = "apb_pclk";
564564 #dma-cells = <1>;
565565 #dma-channels = <8>;
arch/arm/boot/dts/r8a7790.dtsi+14−14
@@ -87,9 +87,9 @@ · 86 unmodified lines
8787 interrupts = <1 9 0xf04>;
8888 };
8989
90− gpio0: gpio@ffc40000 {
90+ gpio0: gpio@e6050000 {
9191 compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
92− reg = <0 0xffc40000 0 0x2c>;
92+ reg = <0 0xe6050000 0 0x50>;
9393 interrupt-parent = <&gic>;
9494 interrupts = <0 4 0x4>;
9595 #gpio-cells = <2>;
@@ -99,9 +99,9 @@ · 3 unmodified lines
9999 interrupt-controller;
100100 };
101101
102− gpio1: gpio@ffc41000 {
102+ gpio1: gpio@e6051000 {
103103 compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
104− reg = <0 0xffc41000 0 0x2c>;
104+ reg = <0 0xe6051000 0 0x50>;
105105 interrupt-parent = <&gic>;
106106 interrupts = <0 5 0x4>;
107107 #gpio-cells = <2>;
@@ -111,9 +111,9 @@ · 3 unmodified lines
111111 interrupt-controller;
112112 };
113113
114− gpio2: gpio@ffc42000 {
114+ gpio2: gpio@e6052000 {
115115 compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
116− reg = <0 0xffc42000 0 0x2c>;
116+ reg = <0 0xe6052000 0 0x50>;
117117 interrupt-parent = <&gic>;
118118 interrupts = <0 6 0x4>;
119119 #gpio-cells = <2>;
@@ -123,9 +123,9 @@ · 3 unmodified lines
123123 interrupt-controller;
124124 };
125125
126− gpio3: gpio@ffc43000 {
126+ gpio3: gpio@e6053000 {
127127 compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
128− reg = <0 0xffc43000 0 0x2c>;
128+ reg = <0 0xe6053000 0 0x50>;
129129 interrupt-parent = <&gic>;
130130 interrupts = <0 7 0x4>;
131131 #gpio-cells = <2>;
@@ -135,9 +135,9 @@ · 3 unmodified lines
135135 interrupt-controller;
136136 };
137137
138− gpio4: gpio@ffc44000 {
138+ gpio4: gpio@e6054000 {
139139 compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
140− reg = <0 0xffc44000 0 0x2c>;
140+ reg = <0 0xe6054000 0 0x50>;
141141 interrupt-parent = <&gic>;
142142 interrupts = <0 8 0x4>;
143143 #gpio-cells = <2>;
@@ -147,9 +147,9 @@ · 3 unmodified lines
147147 interrupt-controller;
148148 };
149149
150− gpio5: gpio@ffc45000 {
150+ gpio5: gpio@e6055000 {
151151 compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar";
152− reg = <0 0xffc45000 0 0x2c>;
152+ reg = <0 0xe6055000 0 0x50>;
153153 interrupt-parent = <&gic>;
154154 interrupts = <0 9 0x4>;
155155 #gpio-cells = <2>;
@@ -241,7 +241,7 @@ · 85 unmodified lines
241241
242242 sdhi0: sdhi@ee100000 {
243243 compatible = "renesas,sdhi-r8a7790";
244− reg = <0 0xee100000 0 0x100>;
244+ reg = <0 0xee100000 0 0x200>;
245245 interrupt-parent = <&gic>;
246246 interrupts = <0 165 4>;
247247 cap-sd-highspeed;
@@ -250,7 +250,7 @@ · 2 unmodified lines
250250
251251 sdhi1: sdhi@ee120000 {
252252 compatible = "renesas,sdhi-r8a7790";
253− reg = <0 0xee120000 0 0x100>;
253+ reg = <0 0xee120000 0 0x200>;
254254 interrupt-parent = <&gic>;
255255 interrupts = <0 166 4>;
256256 cap-sd-highspeed;
arch/arm/crypto/aesbs-core.S_shipped+1−1
@@ -58,7 +58,7 @@ · 57 unmodified lines
5858 # define VFP_ABI_FRAME 0
5959 # define BSAES_ASM_EXTENDED_KEY
6060 # define XTS_CHAIN_TWEAK
61−# define __ARM_ARCH__ __LINUX_ARM_ARCH__
61+# define __ARM_ARCH__ 7
6262 #endif
6363
6464 #ifdef __thumb__
arch/arm/crypto/bsaes-armv7.pl+1−1
@@ -701,7 +701,7 @@ $code.=<<___; · 700 unmodified lines
701701 # define VFP_ABI_FRAME 0
702702 # define BSAES_ASM_EXTENDED_KEY
703703 # define XTS_CHAIN_TWEAK
704−# define __ARM_ARCH__ __LINUX_ARM_ARCH__
704+# define __ARM_ARCH__ 7
705705 #endif
706706
707707 #ifdef __thumb__
arch/arm/include/asm/io.h+1−1
@@ -329,7 +329,7 @@ extern void _memset_io(volatile void __iomem *, int, size_t); · 328 unmodified lines
329329 */
330330 #define ioremap(cookie,size) __arm_ioremap((cookie), (size), MT_DEVICE)
331331 #define ioremap_nocache(cookie,size) __arm_ioremap((cookie), (size), MT_DEVICE)
332−#define ioremap_cached(cookie,size) __arm_ioremap((cookie), (size), MT_DEVICE_CACHED)
332+#define ioremap_cache(cookie,size) __arm_ioremap((cookie), (size), MT_DEVICE_CACHED)
333333 #define ioremap_wc(cookie,size) __arm_ioremap((cookie), (size), MT_DEVICE_WC)
334334 #define iounmap __arm_iounmap
335335
arch/arm/include/asm/memory.h+2−1
@@ -347,7 +347,8 @@ static inline __deprecated void *bus_to_virt(unsigned long x) · 346 unmodified lines
347347 #define ARCH_PFN_OFFSET PHYS_PFN_OFFSET
348348
349349 #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
350−#define virt_addr_valid(kaddr) ((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory)
350+#define virt_addr_valid(kaddr) (((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory) \
351+ && pfn_valid(__pa(kaddr) >> PAGE_SHIFT) )
351352
352353 #endif
353354
arch/arm/include/asm/xen/page.h+1−1
@@ -117,6 +117,6 @@ static inline bool set_phys_to_machine(unsigned long pfn, unsigned long mfn) · 116 unmodified lines
117117 return __set_phys_to_machine(pfn, mfn);
118118 }
119119
120−#define xen_remap(cookie, size) ioremap_cached((cookie), (size));
120+#define xen_remap(cookie, size) ioremap_cache((cookie), (size));
121121
122122 #endif /* _ASM_ARM_XEN_PAGE_H */
arch/arm/kernel/devtree.c+1−1
@@ -171,7 +171,7 @@ void __init arm_dt_init_cpu_maps(void) · 170 unmodified lines
171171
172172 bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
173173 {
174− return (phys_id & MPIDR_HWID_BITMASK) == cpu_logical_map(cpu);
174+ return phys_id == cpu_logical_map(cpu);
175175 }
176176
177177 static const void * __init arch_get_next_mach(const char *const **match)
arch/arm/kernel/perf_event_cpu.c+1−1
@@ -254,7 +254,7 @@ static int probe_current_pmu(struct arm_pmu *pmu) · 253 unmodified lines
254254 static int cpu_pmu_device_probe(struct platform_device *pdev)
255255 {
256256 const struct of_device_id *of_id;
257− int (*init_fn)(struct arm_pmu *);
257+ const int (*init_fn)(struct arm_pmu *);
258258 struct device_node *node = pdev->dev.of_node;
259259 struct arm_pmu *pmu;
260260 int ret = -ENODEV;
arch/arm/kernel/traps.c+10−3
@@ -36,7 +36,13 @@ · 35 unmodified lines
3636 #include <asm/system_misc.h>
3737 #include <asm/opcodes.h>
3838
39−static const char *handler[]= { "prefetch abort", "data abort", "address exception", "interrupt" };
39+static const char *handler[]= {
40+ "prefetch abort",
41+ "data abort",
42+ "address exception",
43+ "interrupt",
44+ "undefined instruction",
45+};
4046
4147 void *vectors_page;
4248
@@ -425,9 +431,10 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs) · 382 unmodified lines
425431 instr2 = __mem_to_opcode_thumb16(instr2);
426432 instr = __opcode_thumb32_compose(instr, instr2);
427433 }
428− } else if (get_user(instr, (u32 __user *)pc)) {
434+ } else {
435+ if (get_user(instr, (u32 __user *)pc))
436+ goto die_sig;
429437 instr = __mem_to_opcode_arm(instr);
430− goto die_sig;
431438 }
432439
433440 if (call_undef_hook(regs, instr) == 0)
arch/arm/mach-footbridge/dc21285-timer.c+3−2
@@ -96,11 +96,12 @@ static struct irqaction footbridge_timer_irq = { · 95 unmodified lines
9696 void __init footbridge_timer_init(void)
9797 {
9898 struct clock_event_device *ce = &ckevt_dc21285;
99+ unsigned rate = DIV_ROUND_CLOSEST(mem_fclk_21285, 16);
99100
100− clocksource_register_hz(&cksrc_dc21285, (mem_fclk_21285 + 8) / 16);
101+ clocksource_register_hz(&cksrc_dc21285, rate);
101102
102103 setup_irq(ce->irq, &footbridge_timer_irq);
103104
104105 ce->cpumask = cpumask_of(smp_processor_id());
105− clockevents_config_and_register(ce, mem_fclk_21285, 0x4, 0xffffff);
106+ clockevents_config_and_register(ce, rate, 0x4, 0xffffff);
106107 }
arch/arm/mach-highbank/highbank.c+1−0
@@ -53,6 +53,7 @@ static void __init highbank_scu_map_io(void) · 52 unmodified lines
5353
5454 static void highbank_l2x0_disable(void)
5555 {
56+ outer_flush_all();
5657 /* Disable PL310 L2 Cache controller */
5758 highbank_smc1(0x102, 0x0);
5859 }
arch/arm/mach-omap2/board-ldp.c+6−1
@@ -242,12 +242,18 @@ static void __init ldp_display_init(void) · 241 unmodified lines
242242
243243 static int ldp_twl_gpio_setup(struct device *dev, unsigned gpio, unsigned ngpio)
244244 {
245+ int res;
246+
245247 /* LCD enable GPIO */
246248 ldp_lcd_pdata.enable_gpio = gpio + 7;
247249
248250 /* Backlight enable GPIO */
249251 ldp_lcd_pdata.backlight_gpio = gpio + 15;
250252
253+ res = platform_device_register(&ldp_lcd_device);
254+ if (res)
255+ pr_err("Unable to register LCD: %d\n", res);
256+
251257 return 0;
252258 }
253259
@@ -346,7 +352,6 @@ static struct omap2_hsmmc_info mmc[] __initdata = { · 92 unmodified lines
346352
347353 static struct platform_device *ldp_devices[] __initdata = {
348354 &ldp_gpio_keys_device,
349− &ldp_lcd_device,
350355 };
351356
352357 #ifdef CONFIG_OMAP_MUX
arch/arm/mach-omap2/display.c+38−0
@@ -101,13 +101,51 @@ static const struct omap_dss_hwmod_data omap4_dss_hwmod_data[] __initconst = { · 100 unmodified lines
101101 { "dss_hdmi", "omapdss_hdmi", -1 },
102102 };
103103
104+static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
105+{
106+ u32 enable_mask, enable_shift;
107+ u32 pipd_mask, pipd_shift;
108+ u32 reg;
109+
110+ if (dsi_id == 0) {
111+ enable_mask = OMAP4_DSI1_LANEENABLE_MASK;
112+ enable_shift = OMAP4_DSI1_LANEENABLE_SHIFT;
113+ pipd_mask = OMAP4_DSI1_PIPD_MASK;
114+ pipd_shift = OMAP4_DSI1_PIPD_SHIFT;
115+ } else if (dsi_id == 1) {
116+ enable_mask = OMAP4_DSI2_LANEENABLE_MASK;
117+ enable_shift = OMAP4_DSI2_LANEENABLE_SHIFT;
118+ pipd_mask = OMAP4_DSI2_PIPD_MASK;
119+ pipd_shift = OMAP4_DSI2_PIPD_SHIFT;
120+ } else {
121+ return -ENODEV;
122+ }
123+
124+ reg = omap4_ctrl_pad_readl(OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_DSIPHY);
125+
126+ reg &= ~enable_mask;
127+ reg &= ~pipd_mask;
128+
129+ reg |= (lanes << enable_shift) & enable_mask;
130+ reg |= (lanes << pipd_shift) & pipd_mask;
131+
132+ omap4_ctrl_pad_writel(reg, OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_DSIPHY);
133+
134+ return 0;
135+}
136+
104137 static int omap_dsi_enable_pads(int dsi_id, unsigned lane_mask)
105138 {
139+ if (cpu_is_omap44xx())
140+ return omap4_dsi_mux_pads(dsi_id, lane_mask);
141+
106142 return 0;
107143 }
108144
109145 static void omap_dsi_disable_pads(int dsi_id, unsigned lane_mask)
110146 {
147+ if (cpu_is_omap44xx())
148+ omap4_dsi_mux_pads(dsi_id, 0);
111149 }
112150
113151 static int omap_dss_set_min_bus_tput(struct device *dev, unsigned long tput)
arch/arm/mach-omap2/omap4-common.c+1−0
@@ -162,6 +162,7 @@ void __iomem *omap4_get_l2cache_base(void) · 161 unmodified lines
162162
163163 static void omap4_l2x0_disable(void)
164164 {
165+ outer_flush_all();
165166 /* Disable PL310 L2 Cache controller */
166167 omap_smc1(0x102, 0x0);
167168 }
arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c+2−2
@@ -796,7 +796,7 @@ struct omap_hwmod omap2xxx_counter_32k_hwmod = { · 795 unmodified lines
796796
797797 /* gpmc */
798798 static struct omap_hwmod_irq_info omap2xxx_gpmc_irqs[] = {
799− { .irq = 20 },
799+ { .irq = 20 + OMAP_INTC_START, },
800800 { .irq = -1 }
801801 };
802802
@@ -841,7 +841,7 @@ static struct omap_hwmod_class omap2_rng_hwmod_class = { · 38 unmodified lines
841841 };
842842
843843 static struct omap_hwmod_irq_info omap2_rng_mpu_irqs[] = {
844− { .irq = 52 },
844+ { .irq = 52 + OMAP_INTC_START, },
845845 { .irq = -1 }
846846 };
847847
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c+3−3
@@ -2165,7 +2165,7 @@ static struct omap_hwmod_class omap3xxx_gpmc_hwmod_class = { · 2164 unmodified lines
21652165 };
21662166
21672167 static struct omap_hwmod_irq_info omap3xxx_gpmc_irqs[] = {
2168− { .irq = 20 },
2168+ { .irq = 20 + OMAP_INTC_START, },
21692169 { .irq = -1 }
21702170 };
21712171
@@ -2999,7 +2999,7 @@ static struct omap_mmu_dev_attr mmu_isp_dev_attr = { · 827 unmodified lines
29992999
30003000 static struct omap_hwmod omap3xxx_mmu_isp_hwmod;
30013001 static struct omap_hwmod_irq_info omap3xxx_mmu_isp_irqs[] = {
3002− { .irq = 24 },
3002+ { .irq = 24 + OMAP_INTC_START, },
30033003 { .irq = -1 }
30043004 };
30053005
@@ -3041,7 +3041,7 @@ static struct omap_mmu_dev_attr mmu_iva_dev_attr = { · 35 unmodified lines
30413041
30423042 static struct omap_hwmod omap3xxx_mmu_iva_hwmod;
30433043 static struct omap_hwmod_irq_info omap3xxx_mmu_iva_irqs[] = {
3044− { .irq = 28 },
3044+ { .irq = 28 + OMAP_INTC_START, },
30453045 { .irq = -1 }
30463046 };
30473047
arch/arm/mach-omap2/omap_hwmod_7xx_data.c+1−1
@@ -1637,7 +1637,7 @@ static struct omap_hwmod dra7xx_uart1_hwmod = { · 1636 unmodified lines
16371637 .class = &dra7xx_uart_hwmod_class,
16381638 .clkdm_name = "l4per_clkdm",
16391639 .main_clk = "uart1_gfclk_mux",
1640− .flags = HWMOD_SWSUP_SIDLE_ACT,
1640+ .flags = HWMOD_SWSUP_SIDLE_ACT | DEBUG_OMAP2UART1_FLAGS,
16411641 .prcm = {
16421642 .omap4 = {
16431643 .clkctrl_offs = DRA7XX_CM_L4PER_UART1_CLKCTRL_OFFSET,
arch/arm/mach-pxa/include/mach/lubbock.h+2−0
@@ -10,6 +10,8 @@ · 9 unmodified lines
1010 * published by the Free Software Foundation.
1111 */
1212
13+#include <mach/irqs.h>
14+
1315 #define LUBBOCK_ETH_PHYS PXA_CS3_PHYS
1416
1517 #define LUBBOCK_FPGA_PHYS PXA_CS2_PHYS
arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c+1−10
@@ -8,8 +8,6 @@ · 7 unmodified lines
88 * published by the Free Software Foundation.
99 */
1010
11−#include <linux/clk-provider.h>
12−#include <linux/irqchip.h>
1311 #include <linux/of_platform.h>
1412
1513 #include <asm/mach/arch.h>
@@ -48,15 +46,9 @@ static void __init s3c64xx_dt_map_io(void) · 32 unmodified lines
4846 panic("SoC is not S3C64xx!");
4947 }
5048
51−static void __init s3c64xx_dt_init_irq(void)
52−{
53− of_clk_init(NULL);
54− samsung_wdt_reset_of_init();
55− irqchip_init();
56−};
57−
5849 static void __init s3c64xx_dt_init_machine(void)
5950 {
51+ samsung_wdt_reset_of_init();
6052 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
6153 }
6254
@@ -79,7 +71,6 @@ DT_MACHINE_START(S3C6400_DT, "Samsung S3C64xx (Flattened Device Tree)") · 16 unmodified lines
7971 /* Maintainer: Tomasz Figa <tomasz.figa@gmail.com> */
8072 .dt_compat = s3c64xx_dt_compat,
8173 .map_io = s3c64xx_dt_map_io,
82− .init_irq = s3c64xx_dt_init_irq,
8374 .init_machine = s3c64xx_dt_init_machine,
8475 .restart = s3c64xx_dt_restart,
8576 MACHINE_END
arch/arm/mach-shmobile/board-armadillo800eva.c+9−2
@@ -483,7 +483,7 @@ static struct platform_device lcdc0_device = { · 482 unmodified lines
483483 .id = 0,
484484 .dev = {
485485 .platform_data = &lcdc0_info,
486− .coherent_dma_mask = ~0,
486+ .coherent_dma_mask = DMA_BIT_MASK(32),
487487 },
488488 };
489489
@@ -580,7 +580,7 @@ static struct platform_device hdmi_lcdc_device = { · 90 unmodified lines
580580 .id = 1,
581581 .dev = {
582582 .platform_data = &hdmi_lcdc_info,
583− .coherent_dma_mask = ~0,
583+ .coherent_dma_mask = DMA_BIT_MASK(32),
584584 },
585585 };
586586
@@ -614,6 +614,11 @@ static struct regulator_consumer_supply fixed3v3_power_consumers[] = { · 27 unmodified lines
614614 REGULATOR_SUPPLY("vqmmc", "sh_mmcif"),
615615 };
616616
617+/* Fixed 3.3V regulator used by LCD backlight */
618+static struct regulator_consumer_supply fixed5v0_power_consumers[] = {
619+ REGULATOR_SUPPLY("power", "pwm-backlight.0"),
620+};
621+
617622 /* Fixed 3.3V regulator to be used by SDHI0 */
618623 static struct regulator_consumer_supply vcc_sdhi0_consumers[] = {
619624 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
@@ -1196,6 +1201,8 @@ static void __init eva_init(void) · 576 unmodified lines
11961201
11971202 regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
11981203 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
1204+ regulator_register_always_on(3, "fixed-5.0V", fixed5v0_power_consumers,
1205+ ARRAY_SIZE(fixed5v0_power_consumers), 5000000);
11991206
12001207 pinctrl_register_mappings(eva_pinctrl_map, ARRAY_SIZE(eva_pinctrl_map));
12011208 pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));
arch/arm/mach-shmobile/board-bockw.c+1−1
@@ -679,7 +679,7 @@ static void __init bockw_init(void) · 678 unmodified lines
679679 .id = i,
680680 .data = &rsnd_card_info[i],
681681 .size_data = sizeof(struct asoc_simple_card_info),
682− .dma_mask = ~0,
682+ .dma_mask = DMA_BIT_MASK(32),
683683 };
684684
685685 platform_device_register_full(&cardinfo);
arch/arm/mach-shmobile/board-kzm9g.c+1−1
@@ -334,7 +334,7 @@ static struct platform_device lcdc_device = { · 333 unmodified lines
334334 .resource = lcdc_resources,
335335 .dev = {
336336 .platform_data = &lcdc_info,
337− .coherent_dma_mask = ~0,
337+ .coherent_dma_mask = DMA_BIT_MASK(32),
338338 },
339339 };
340340
arch/arm/mach-shmobile/board-lager.c+3−1
@@ -245,7 +245,9 @@ static void __init lager_init(void) · 244 unmodified lines
245245 {
246246 lager_add_standard_devices();
247247
248− phy_register_fixup_for_id("r8a7790-ether-ff:01", lager_ksz8041_fixup);
248+ if (IS_ENABLED(CONFIG_PHYLIB))
249+ phy_register_fixup_for_id("r8a7790-ether-ff:01",
250+ lager_ksz8041_fixup);
249251 }
250252
251253 static const char * const lager_boards_compat_dt[] __initconst = {
arch/arm/mach-shmobile/board-mackerel.c+2−2
@@ -409,7 +409,7 @@ static struct platform_device lcdc_device = { · 408 unmodified lines
409409 .resource = lcdc_resources,
410410 .dev = {
411411 .platform_data = &lcdc_info,
412− .coherent_dma_mask = ~0,
412+ .coherent_dma_mask = DMA_BIT_MASK(32),
413413 },
414414 };
415415
@@ -499,7 +499,7 @@ static struct platform_device hdmi_lcdc_device = { · 83 unmodified lines
499499 .id = 1,
500500 .dev = {
501501 .platform_data = &hdmi_lcdc_info,
502− .coherent_dma_mask = ~0,
502+ .coherent_dma_mask = DMA_BIT_MASK(32),
503503 },
504504 };
505505
arch/arm/mm/flush.c+3−3
@@ -175,16 +175,16 @@ void __flush_dcache_page(struct address_space *mapping, struct page *page) · 174 unmodified lines
175175 unsigned long i;
176176 if (cache_is_vipt_nonaliasing()) {
177177 for (i = 0; i < (1 << compound_order(page)); i++) {
178− void *addr = kmap_atomic(page);
178+ void *addr = kmap_atomic(page + i);
179179 __cpuc_flush_dcache_area(addr, PAGE_SIZE);
180180 kunmap_atomic(addr);
181181 }
182182 } else {
183183 for (i = 0; i < (1 << compound_order(page)); i++) {
184− void *addr = kmap_high_get(page);
184+ void *addr = kmap_high_get(page + i);
185185 if (addr) {
186186 __cpuc_flush_dcache_area(addr, PAGE_SIZE);
187− kunmap_high(page);
187+ kunmap_high(page + i);
188188 }
189189 }
190190 }
arch/arm/mm/init.c+1−1
@@ -229,7 +229,7 @@ void __init setup_dma_zone(const struct machine_desc *mdesc) · 228 unmodified lines
229229 #ifdef CONFIG_ZONE_DMA
230230 if (mdesc->dma_zone_size) {
231231 arm_dma_zone_size = mdesc->dma_zone_size;
232− arm_dma_limit = __pv_phys_offset + arm_dma_zone_size - 1;
232+ arm_dma_limit = PHYS_OFFSET + arm_dma_zone_size - 1;
233233 } else
234234 arm_dma_limit = 0xffffffff;
235235 arm_dma_pfn_limit = arm_dma_limit >> PAGE_SHIFT;
arch/arm/xen/enlighten.c+3−3
@@ -96,7 +96,7 @@ static int remap_pte_fn(pte_t *ptep, pgtable_t token, unsigned long addr, · 95 unmodified lines
9696 struct remap_data *info = data;
9797 struct page *page = info->pages[info->index++];
9898 unsigned long pfn = page_to_pfn(page);
99− pte_t pte = pfn_pte(pfn, info->prot);
99+ pte_t pte = pte_mkspecial(pfn_pte(pfn, info->prot));
100100
101101 if (map_foreign_page(pfn, info->fgmfn, info->domid))
102102 return -EFAULT;
@@ -224,10 +224,10 @@ static int __init xen_guest_init(void) · 121 unmodified lines
224224 }
225225 if (of_address_to_resource(node, GRANT_TABLE_PHYSADDR, &res))
226226 return 0;
227− xen_hvm_resume_frames = res.start >> PAGE_SHIFT;
227+ xen_hvm_resume_frames = res.start;
228228 xen_events_irq = irq_of_parse_and_map(node, 0);
229229 pr_info("Xen %s support found, events_irq=%d gnttab_frame_pfn=%lx\n",
230− version, xen_events_irq, xen_hvm_resume_frames);
230+ version, xen_events_irq, (xen_hvm_resume_frames >> PAGE_SHIFT));
231231 xen_domain_type = XEN_HVM_DOMAIN;
232232
233233 xen_setup_features();
arch/arm64/include/asm/xen/page-coherent.h+0−4
@@ -23,25 +23,21 @@ static inline void xen_dma_map_page(struct device *hwdev, struct page *page, · 22 unmodified lines
2323 unsigned long offset, size_t size, enum dma_data_direction dir,
2424 struct dma_attrs *attrs)
2525 {
26− __generic_dma_ops(hwdev)->map_page(hwdev, page, offset, size, dir, attrs);
2726 }
2827
2928 static inline void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle,
3029 size_t size, enum dma_data_direction dir,
3130 struct dma_attrs *attrs)
3231 {
33− __generic_dma_ops(hwdev)->unmap_page(hwdev, handle, size, dir, attrs);
3432 }
3533
3634 static inline void xen_dma_sync_single_for_cpu(struct device *hwdev,
3735 dma_addr_t handle, size_t size, enum dma_data_direction dir)
3836 {
39− __generic_dma_ops(hwdev)->sync_single_for_cpu(hwdev, handle, size, dir);
4037 }
4138
4239 static inline void xen_dma_sync_single_for_device(struct device *hwdev,
4340 dma_addr_t handle, size_t size, enum dma_data_direction dir)
4441 {
45− __generic_dma_ops(hwdev)->sync_single_for_device(hwdev, handle, size, dir);
4642 }
4743 #endif /* _ASM_ARM64_XEN_PAGE_COHERENT_H */
arch/arm64/kernel/ptrace.c+18−20
@@ -214,31 +214,29 @@ static int ptrace_hbp_fill_attr_ctrl(unsigned int note_type, · 213 unmodified lines
214214 {
215215 int err, len, type, disabled = !ctrl.enabled;
216216
217− if (disabled) {
218− len = 0;
219− type = HW_BREAKPOINT_EMPTY;
220− } else {
221− err = arch_bp_generic_fields(ctrl, &len, &type);
222− if (err)
223− return err;
224−
225− switch (note_type) {
226− case NT_ARM_HW_BREAK:
227− if ((type & HW_BREAKPOINT_X) != type)
228− return -EINVAL;
229− break;
230− case NT_ARM_HW_WATCH:
231− if ((type & HW_BREAKPOINT_RW) != type)
232− return -EINVAL;
233− break;
234− default:
217+ attr->disabled = disabled;
218+ if (disabled)
219+ return 0;
220+
221+ err = arch_bp_generic_fields(ctrl, &len, &type);
222+ if (err)
223+ return err;
224+
225+ switch (note_type) {
226+ case NT_ARM_HW_BREAK:
227+ if ((type & HW_BREAKPOINT_X) != type)
235228 return -EINVAL;
236− }
229+ break;
230+ case NT_ARM_HW_WATCH:
231+ if ((type & HW_BREAKPOINT_RW) != type)
232+ return -EINVAL;
233+ break;
234+ default:
235+ return -EINVAL;
237236 }
238237
239238 attr->bp_len = len;
240239 attr->bp_type = type;
241− attr->disabled = disabled;
242240
243241 return 0;
244242 }
arch/mips/include/asm/cacheops.h+1−1
@@ -83,6 +83,6 @@ · 82 unmodified lines
8383 /*
8484 * Loongson2-specific cacheops
8585 */
86−#define Hit_Invalidate_I_Loongson23 0x00
86+#define Hit_Invalidate_I_Loongson2 0x00
8787
8888 #endif /* __ASM_CACHEOPS_H */
arch/mips/include/asm/r4kcache.h+26−25
@@ -165,7 +165,7 @@ static inline void flush_icache_line(unsigned long addr) · 164 unmodified lines
165165 __iflush_prologue
166166 switch (boot_cpu_type()) {
167167 case CPU_LOONGSON2:
168− cache_op(Hit_Invalidate_I_Loongson23, addr);
168+ cache_op(Hit_Invalidate_I_Loongson2, addr);
169169 break;
170170
171171 default:
@@ -219,7 +219,7 @@ static inline void protected_flush_icache_line(unsigned long addr) · 47 unmodified lines
219219 {
220220 switch (boot_cpu_type()) {
221221 case CPU_LOONGSON2:
222− protected_cache_op(Hit_Invalidate_I_Loongson23, addr);
222+ protected_cache_op(Hit_Invalidate_I_Loongson2, addr);
223223 break;
224224
225225 default:
@@ -357,8 +357,8 @@ static inline void invalidate_tcache_page(unsigned long addr) · 131 unmodified lines
357357 "i" (op));
358358
359359 /* build blast_xxx, blast_xxx_page, blast_xxx_page_indexed */
360−#define __BUILD_BLAST_CACHE(pfx, desc, indexop, hitop, lsize) \
361−static inline void blast_##pfx##cache##lsize(void) \
360+#define __BUILD_BLAST_CACHE(pfx, desc, indexop, hitop, lsize, extra) \
361+static inline void extra##blast_##pfx##cache##lsize(void) \
362362 { \
363363 unsigned long start = INDEX_BASE; \
364364 unsigned long end = start + current_cpu_data.desc.waysize; \
@@ -376,7 +376,7 @@ static inline void blast_##pfx##cache##lsize(void) \ · 11 unmodified lines
376376 __##pfx##flush_epilogue \
377377 } \
378378 \
379−static inline void blast_##pfx##cache##lsize##_page(unsigned long page) \
379+static inline void extra##blast_##pfx##cache##lsize##_page(unsigned long page) \
380380 { \
381381 unsigned long start = page; \
382382 unsigned long end = page + PAGE_SIZE; \
@@ -391,7 +391,7 @@ static inline void blast_##pfx##cache##lsize##_page(unsigned long page) \ · 8 unmodified lines
391391 __##pfx##flush_epilogue \
392392 } \
393393 \
394−static inline void blast_##pfx##cache##lsize##_page_indexed(unsigned long page) \
394+static inline void extra##blast_##pfx##cache##lsize##_page_indexed(unsigned long page) \
395395 { \
396396 unsigned long indexmask = current_cpu_data.desc.waysize - 1; \
397397 unsigned long start = INDEX_BASE + (page & indexmask); \
@@ -410,23 +410,24 @@ static inline void blast_##pfx##cache##lsize##_page_indexed(unsigned long page) · 12 unmodified lines
410410 __##pfx##flush_epilogue \
411411 }
412412
413−__BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 16)
414−__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 16)
415−__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 16)
416−__BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 32)
417−__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 32)
418−__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 32)
419−__BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 64)
420−__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 64)
421−__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 64)
422−__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 128)
423−
424−__BUILD_BLAST_CACHE(inv_d, dcache, Index_Writeback_Inv_D, Hit_Invalidate_D, 16)
425−__BUILD_BLAST_CACHE(inv_d, dcache, Index_Writeback_Inv_D, Hit_Invalidate_D, 32)
426−__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 16)
427−__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 32)
428−__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 64)
429−__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 128)
413+__BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 16, )
414+__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 16, )
415+__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 16, )
416+__BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 32, )
417+__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 32, )
418+__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I_Loongson2, 32, loongson2_)
419+__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 32, )
420+__BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 64, )
421+__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 64, )
422+__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 64, )
423+__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 128, )
424+
425+__BUILD_BLAST_CACHE(inv_d, dcache, Index_Writeback_Inv_D, Hit_Invalidate_D, 16, )
426+__BUILD_BLAST_CACHE(inv_d, dcache, Index_Writeback_Inv_D, Hit_Invalidate_D, 32, )
427+__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 16, )
428+__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 32, )
429+__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 64, )
430+__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 128, )
430431
431432 /* build blast_xxx_range, protected_blast_xxx_range */
432433 #define __BUILD_BLAST_CACHE_RANGE(pfx, desc, hitop, prot, extra) \
@@ -452,8 +453,8 @@ static inline void prot##extra##blast_##pfx##cache##_range(unsigned long start, · 19 unmodified lines
452453 __BUILD_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D, protected_, )
453454 __BUILD_BLAST_CACHE_RANGE(s, scache, Hit_Writeback_Inv_SD, protected_, )
454455 __BUILD_BLAST_CACHE_RANGE(i, icache, Hit_Invalidate_I, protected_, )
455−__BUILD_BLAST_CACHE_RANGE(i, icache, Hit_Invalidate_I_Loongson23, \
456− protected_, loongson23_)
456+__BUILD_BLAST_CACHE_RANGE(i, icache, Hit_Invalidate_I_Loongson2, \
457+ protected_, loongson2_)
457458 __BUILD_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D, , )
458459 __BUILD_BLAST_CACHE_RANGE(s, scache, Hit_Writeback_Inv_SD, , )
459460 /* blast_inv_dcache_range */
arch/mips/mm/c-r4k.c+9−2
@@ -237,6 +237,8 @@ static void r4k_blast_icache_page_setup(void) · 236 unmodified lines
237237 r4k_blast_icache_page = (void *)cache_noop;
238238 else if (ic_lsize == 16)
239239 r4k_blast_icache_page = blast_icache16_page;
240+ else if (ic_lsize == 32 && current_cpu_type() == CPU_LOONGSON2)
241+ r4k_blast_icache_page = loongson2_blast_icache32_page;
240242 else if (ic_lsize == 32)
241243 r4k_blast_icache_page = blast_icache32_page;
242244 else if (ic_lsize == 64)
@@ -261,6 +263,9 @@ static void r4k_blast_icache_page_indexed_setup(void) · 18 unmodified lines
261263 else if (TX49XX_ICACHE_INDEX_INV_WAR)
262264 r4k_blast_icache_page_indexed =
263265 tx49_blast_icache32_page_indexed;
266+ else if (current_cpu_type() == CPU_LOONGSON2)
267+ r4k_blast_icache_page_indexed =
268+ loongson2_blast_icache32_page_indexed;
264269 else
265270 r4k_blast_icache_page_indexed =
266271 blast_icache32_page_indexed;
@@ -284,6 +289,8 @@ static void r4k_blast_icache_setup(void) · 17 unmodified lines
284289 r4k_blast_icache = blast_r4600_v1_icache32;
285290 else if (TX49XX_ICACHE_INDEX_INV_WAR)
286291 r4k_blast_icache = tx49_blast_icache32;
292+ else if (current_cpu_type() == CPU_LOONGSON2)
293+ r4k_blast_icache = loongson2_blast_icache32;
287294 else
288295 r4k_blast_icache = blast_icache32;
289296 } else if (ic_lsize == 64)
@@ -580,11 +587,11 @@ static inline void local_r4k_flush_icache_range(unsigned long start, unsigned lo · 290 unmodified lines
580587 else {
581588 switch (boot_cpu_type()) {
582589 case CPU_LOONGSON2:
583− protected_blast_icache_range(start, end);
590+ protected_loongson2_blast_icache_range(start, end);
584591 break;
585592
586593 default:
587− protected_loongson23_blast_icache_range(start, end);
594+ protected_blast_icache_range(start, end);
588595 break;
589596 }
590597 }
arch/parisc/include/asm/cacheflush.h+4−8
@@ -125,42 +125,38 @@ flush_anon_page(struct vm_area_struct *vma, struct page *page, unsigned long vma · 124 unmodified lines
125125 void mark_rodata_ro(void);
126126 #endif
127127
128−#ifdef CONFIG_PA8X00
129−/* Only pa8800, pa8900 needs this */
130−
131128 #include <asm/kmap_types.h>
132129
133130 #define ARCH_HAS_KMAP
134131
135−void kunmap_parisc(void *addr);
136−
137132 static inline void *kmap(struct page *page)
138133 {
139134 might_sleep();
135+ flush_dcache_page(page);
140136 return page_address(page);
141137 }
142138
143139 static inline void kunmap(struct page *page)
144140 {
145− kunmap_parisc(page_address(page));
141+ flush_kernel_dcache_page_addr(page_address(page));
146142 }
147143
148144 static inline void *kmap_atomic(struct page *page)
149145 {
150146 pagefault_disable();
147+ flush_dcache_page(page);
151148 return page_address(page);
152149 }
153150
154151 static inline void __kunmap_atomic(void *addr)
155152 {
156− kunmap_parisc(addr);
153+ flush_kernel_dcache_page_addr(addr);
157154 pagefault_enable();
158155 }
159156
160157 #define kmap_atomic_prot(page, prot) kmap_atomic(page)
161158 #define kmap_atomic_pfn(pfn) kmap_atomic(pfn_to_page(pfn))
162159 #define kmap_atomic_to_page(ptr) virt_to_page(ptr)
163−#endif
164160
165161 #endif /* _PARISC_CACHEFLUSH_H */
166162
arch/parisc/include/asm/page.h+2−3
@@ -28,9 +28,8 @@ struct page; · 27 unmodified lines
2828
2929 void clear_page_asm(void *page);
3030 void copy_page_asm(void *to, void *from);
31−void clear_user_page(void *vto, unsigned long vaddr, struct page *pg);
32−void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
33− struct page *pg);
31+#define clear_user_page(vto, vaddr, page) clear_page_asm(vto)
32+#define copy_user_page(vto, vfrom, vaddr, page) copy_page_asm(vto, vfrom)
3433
3534 /* #define CONFIG_PARISC_TMPALIAS */
3635
arch/parisc/kernel/cache.c+0−35
@@ -388,41 +388,6 @@ void flush_kernel_dcache_page_addr(void *addr) · 387 unmodified lines
388388 }
389389 EXPORT_SYMBOL(flush_kernel_dcache_page_addr);
390390
391−void clear_user_page(void *vto, unsigned long vaddr, struct page *page)
392−{
393− clear_page_asm(vto);
394− if (!parisc_requires_coherency())
395− flush_kernel_dcache_page_asm(vto);
396−}
397−EXPORT_SYMBOL(clear_user_page);
398−
399−void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
400− struct page *pg)
401−{
402− /* Copy using kernel mapping. No coherency is needed
403− (all in kmap/kunmap) on machines that don't support
404− non-equivalent aliasing. However, the `from' page
405− needs to be flushed before it can be accessed through
406− the kernel mapping. */
407− preempt_disable();
408− flush_dcache_page_asm(__pa(vfrom), vaddr);
409− preempt_enable();
410− copy_page_asm(vto, vfrom);
411− if (!parisc_requires_coherency())
412− flush_kernel_dcache_page_asm(vto);
413−}
414−EXPORT_SYMBOL(copy_user_page);
415−
416−#ifdef CONFIG_PA8X00
417−
418−void kunmap_parisc(void *addr)
419−{
420− if (parisc_requires_coherency())
421− flush_kernel_dcache_page_addr(addr);
422−}
423−EXPORT_SYMBOL(kunmap_parisc);
424−#endif
425−
426391 void purge_tlb_entries(struct mm_struct *mm, unsigned long addr)
427392 {
428393 unsigned long flags;
arch/powerpc/boot/dts/mpc5125twr.dts+5−1
@@ -58,7 +58,6 @@ · 57 unmodified lines
5858 compatible = "fsl,mpc5121-immr";
5959 #address-cells = <1>;
6060 #size-cells = <1>;
61− #interrupt-cells = <2>;
6261 ranges = <0x0 0x80000000 0x400000>;
6362 reg = <0x80000000 0x400000>;
6463 bus-frequency = <66000000>; // 66 MHz ips bus
@@ -189,6 +188,10 @@ · 124 unmodified lines
189188 reg = <0xA000 0x1000>;
190189 };
191190
191+ // disable USB1 port
192+ // TODO:
193+ // correct pinmux config and fix USB3320 ulpi dependency
194+ // before re-enabling it
192195 usb@3000 {
193196 compatible = "fsl,mpc5121-usb2-dr";
194197 reg = <0x3000 0x400>;
@@ -197,6 +200,7 @@ · 2 unmodified lines
197200 interrupts = <43 0x8>;
198201 dr_mode = "host";
199202 phy_type = "ulpi";
203+ status = "disabled";
200204 };
201205
202206 // 5125 PSCs are not 52xx or 5121 PSC compatible
arch/powerpc/include/asm/exception-64s.h+1−1
@@ -284,7 +284,7 @@ do_kvm_##n: \ · 283 unmodified lines
284284 subi r1,r1,INT_FRAME_SIZE; /* alloc frame on kernel stack */ \
285285 beq- 1f; \
286286 ld r1,PACAKSAVE(r13); /* kernel stack to use */ \
287−1: cmpdi cr1,r1,0; /* check if r1 is in userspace */ \
287+1: cmpdi cr1,r1,-INT_FRAME_SIZE; /* check if r1 is in userspace */ \
288288 blt+ cr1,3f; /* abort if it is */ \
289289 li r1,(n); /* will be reloaded later */ \
290290 sth r1,PACA_TRAP_SAVE(r13); \
arch/powerpc/include/asm/kvm_book3s.h+4−0
@@ -192,6 +192,10 @@ extern void kvmppc_load_up_vsx(void); · 191 unmodified lines
192192 extern u32 kvmppc_alignment_dsisr(struct kvm_vcpu *vcpu, unsigned int inst);
193193 extern ulong kvmppc_alignment_dar(struct kvm_vcpu *vcpu, unsigned int inst);
194194 extern int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd);
195+extern void kvmppc_copy_to_svcpu(struct kvmppc_book3s_shadow_vcpu *svcpu,
196+ struct kvm_vcpu *vcpu);
197+extern void kvmppc_copy_from_svcpu(struct kvm_vcpu *vcpu,
198+ struct kvmppc_book3s_shadow_vcpu *svcpu);
195199
196200 static inline struct kvmppc_vcpu_book3s *to_book3s(struct kvm_vcpu *vcpu)
197201 {
arch/powerpc/include/asm/kvm_book3s_asm.h+2−0
@@ -79,6 +79,7 @@ struct kvmppc_host_state { · 78 unmodified lines
7979 ulong vmhandler;
8080 ulong scratch0;
8181 ulong scratch1;
82+ ulong scratch2;
8283 u8 in_guest;
8384 u8 restore_hid5;
8485 u8 napping;
@@ -106,6 +107,7 @@ struct kvmppc_host_state { · 21 unmodified lines
106107 };
107108
108109 struct kvmppc_book3s_shadow_vcpu {
110+ bool in_use;
109111 ulong gpr[14];
110112 u32 cr;
111113 u32 xer;
arch/powerpc/include/asm/opal.h+2−2
@@ -720,13 +720,13 @@ int64_t opal_pci_next_error(uint64_t phb_id, uint64_t *first_frozen_pe, · 719 unmodified lines
720720 int64_t opal_pci_poll(uint64_t phb_id);
721721 int64_t opal_return_cpu(void);
722722
723−int64_t opal_xscom_read(uint32_t gcid, uint32_t pcb_addr, uint64_t *val);
723+int64_t opal_xscom_read(uint32_t gcid, uint32_t pcb_addr, __be64 *val);
724724 int64_t opal_xscom_write(uint32_t gcid, uint32_t pcb_addr, uint64_t val);
725725
726726 int64_t opal_lpc_write(uint32_t chip_id, enum OpalLPCAddressType addr_type,
727727 uint32_t addr, uint32_t data, uint32_t sz);
728728 int64_t opal_lpc_read(uint32_t chip_id, enum OpalLPCAddressType addr_type,
729− uint32_t addr, uint32_t *data, uint32_t sz);
729+ uint32_t addr, __be32 *data, uint32_t sz);
730730 int64_t opal_validate_flash(uint64_t buffer, uint32_t *size, uint32_t *result);
731731 int64_t opal_manage_flash(uint8_t op);
732732 int64_t opal_update_flash(uint64_t blk_list);
arch/powerpc/include/asm/switch_to.h+1−1
@@ -35,7 +35,7 @@ extern void giveup_vsx(struct task_struct *); · 34 unmodified lines
3535 extern void enable_kernel_spe(void);
3636 extern void giveup_spe(struct task_struct *);
3737 extern void load_up_spe(struct task_struct *);
38−extern void switch_booke_debug_regs(struct thread_struct *new_thread);
38+extern void switch_booke_debug_regs(struct debug_reg *new_debug);
3939
4040 #ifndef CONFIG_SMP
4141 extern void discard_lazy_cpu_state(void);
arch/powerpc/include/asm/unaligned.h+6−1
@@ -4,13 +4,18 @@ · 3 unmodified lines
44 #ifdef __KERNEL__
55
66 /*
7− * The PowerPC can do unaligned accesses itself in big endian mode.
7+ * The PowerPC can do unaligned accesses itself based on its endian mode.
88 */
99 #include <linux/unaligned/access_ok.h>
1010 #include <linux/unaligned/generic.h>
1111
12+#ifdef __LITTLE_ENDIAN__
13+#define get_unaligned __get_unaligned_le
14+#define put_unaligned __put_unaligned_le
15+#else
1216 #define get_unaligned __get_unaligned_be
1317 #define put_unaligned __put_unaligned_be
18+#endif
1419
1520 #endif /* __KERNEL__ */
1621 #endif /* _ASM_POWERPC_UNALIGNED_H */
arch/powerpc/kernel/asm-offsets.c+1−0
@@ -576,6 +576,7 @@ int main(void) · 575 unmodified lines
576576 HSTATE_FIELD(HSTATE_VMHANDLER, vmhandler);
577577 HSTATE_FIELD(HSTATE_SCRATCH0, scratch0);
578578 HSTATE_FIELD(HSTATE_SCRATCH1, scratch1);
579+ HSTATE_FIELD(HSTATE_SCRATCH2, scratch2);
579580 HSTATE_FIELD(HSTATE_IN_GUEST, in_guest);
580581 HSTATE_FIELD(HSTATE_RESTORE_HID5, restore_hid5);
581582 HSTATE_FIELD(HSTATE_NAPPING, napping);
arch/powerpc/kernel/crash_dump.c+3−3
@@ -124,15 +124,15 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf, · 123 unmodified lines
124124 void crash_free_reserved_phys_range(unsigned long begin, unsigned long end)
125125 {
126126 unsigned long addr;
127− const u32 *basep, *sizep;
127+ const __be32 *basep, *sizep;
128128 unsigned int rtas_start = 0, rtas_end = 0;
129129
130130 basep = of_get_property(rtas.dev, "linux,rtas-base", NULL);
131131 sizep = of_get_property(rtas.dev, "rtas-size", NULL);
132132
133133 if (basep && sizep) {
134− rtas_start = *basep;
135− rtas_end = *basep + *sizep;
134+ rtas_start = be32_to_cpup(basep);
135+ rtas_end = rtas_start + be32_to_cpup(sizep);
136136 }
137137
138138 for (addr = begin; addr < end; addr += PAGE_SIZE) {
arch/powerpc/kernel/head_64.S+2−0
@@ -80,6 +80,7 @@ END_FTR_SECTION(0, 1) · 79 unmodified lines
8080 * of the function that the cpu should jump to to continue
8181 * initialization.
8282 */
83+ .balign 8
8384 .globl __secondary_hold_spinloop
8485 __secondary_hold_spinloop:
8586 .llong 0x0
@@ -470,6 +471,7 @@ _STATIC(__after_prom_start) · 384 unmodified lines
470471 mtctr r8
471472 bctr
472473
474+.balign 8
473475 p_end: .llong _end - _stext
474476
475477 4: /* Now copy the rest of the kernel up to _end */
arch/powerpc/kernel/process.c+16−16
@@ -339,7 +339,7 @@ static void set_debug_reg_defaults(struct thread_struct *thread) · 338 unmodified lines
339339 #endif
340340 }
341341
342−static void prime_debug_regs(struct thread_struct *thread)
342+static void prime_debug_regs(struct debug_reg *debug)
343343 {
344344 /*
345345 * We could have inherited MSR_DE from userspace, since
@@ -348,22 +348,22 @@ static void prime_debug_regs(struct thread_struct *thread) · 2 unmodified lines
348348 */
349349 mtmsr(mfmsr() & ~MSR_DE);
350350
351− mtspr(SPRN_IAC1, thread->debug.iac1);
352− mtspr(SPRN_IAC2, thread->debug.iac2);
351+ mtspr(SPRN_IAC1, debug->iac1);
352+ mtspr(SPRN_IAC2, debug->iac2);
353353 #if CONFIG_PPC_ADV_DEBUG_IACS > 2
354− mtspr(SPRN_IAC3, thread->debug.iac3);
355− mtspr(SPRN_IAC4, thread->debug.iac4);
354+ mtspr(SPRN_IAC3, debug->iac3);
355+ mtspr(SPRN_IAC4, debug->iac4);
356356 #endif
357− mtspr(SPRN_DAC1, thread->debug.dac1);
358− mtspr(SPRN_DAC2, thread->debug.dac2);
357+ mtspr(SPRN_DAC1, debug->dac1);
358+ mtspr(SPRN_DAC2, debug->dac2);
359359 #if CONFIG_PPC_ADV_DEBUG_DVCS > 0
360− mtspr(SPRN_DVC1, thread->debug.dvc1);
361− mtspr(SPRN_DVC2, thread->debug.dvc2);
360+ mtspr(SPRN_DVC1, debug->dvc1);
361+ mtspr(SPRN_DVC2, debug->dvc2);
362362 #endif
363− mtspr(SPRN_DBCR0, thread->debug.dbcr0);
364− mtspr(SPRN_DBCR1, thread->debug.dbcr1);
363+ mtspr(SPRN_DBCR0, debug->dbcr0);
364+ mtspr(SPRN_DBCR1, debug->dbcr1);
365365 #ifdef CONFIG_BOOKE
366− mtspr(SPRN_DBCR2, thread->debug.dbcr2);
366+ mtspr(SPRN_DBCR2, debug->dbcr2);
367367 #endif
368368 }
369369 /*
@@ -371,11 +371,11 @@ static void prime_debug_regs(struct thread_struct *thread) · 1 unmodified line
371371 * debug registers, set the debug registers from the values
372372 * stored in the new thread.
373373 */
374−void switch_booke_debug_regs(struct thread_struct *new_thread)
374+void switch_booke_debug_regs(struct debug_reg *new_debug)
375375 {
376376 if ((current->thread.debug.dbcr0 & DBCR0_IDM)
377− || (new_thread->debug.dbcr0 & DBCR0_IDM))
378− prime_debug_regs(new_thread);
377+ || (new_debug->dbcr0 & DBCR0_IDM))
378+ prime_debug_regs(new_debug);
379379 }
380380 EXPORT_SYMBOL_GPL(switch_booke_debug_regs);
381381 #else /* !CONFIG_PPC_ADV_DEBUG_REGS */
@@ -683,7 +683,7 @@ struct task_struct *__switch_to(struct task_struct *prev, · 301 unmodified lines
683683 #endif /* CONFIG_SMP */
684684
685685 #ifdef CONFIG_PPC_ADV_DEBUG_REGS
686− switch_booke_debug_regs(&new->thread);
686+ switch_booke_debug_regs(&new->thread.debug);
687687 #else
688688 /*
689689 * For PPC_BOOK3S_64, we use the hw-breakpoint interfaces that would
arch/powerpc/kernel/prom_init.c+13−9
@@ -1986,19 +1986,23 @@ static void __init prom_init_stdout(void) · 1985 unmodified lines
19861986 /* Get the full OF pathname of the stdout device */
19871987 memset(path, 0, 256);
19881988 call_prom("instance-to-path", 3, 1, prom.stdout, path, 255);
1989− stdout_node = call_prom("instance-to-package", 1, 1, prom.stdout);
1990− val = cpu_to_be32(stdout_node);
1991− prom_setprop(prom.chosen, "/chosen", "linux,stdout-package",
1992− &val, sizeof(val));
19931989 prom_printf("OF stdout device is: %s\n", of_stdout_device);
19941990 prom_setprop(prom.chosen, "/chosen", "linux,stdout-path",
19951991 path, strlen(path) + 1);
19961992
1997− /* If it's a display, note it */
1998− memset(type, 0, sizeof(type));
1999− prom_getprop(stdout_node, "device_type", type, sizeof(type));
2000− if (strcmp(type, "display") == 0)
2001− prom_setprop(stdout_node, path, "linux,boot-display", NULL, 0);
1993+ /* instance-to-package fails on PA-Semi */
1994+ stdout_node = call_prom("instance-to-package", 1, 1, prom.stdout);
1995+ if (stdout_node != PROM_ERROR) {
1996+ val = cpu_to_be32(stdout_node);
1997+ prom_setprop(prom.chosen, "/chosen", "linux,stdout-package",
1998+ &val, sizeof(val));
1999+
2000+ /* If it's a display, note it */
2001+ memset(type, 0, sizeof(type));
2002+ prom_getprop(stdout_node, "device_type", type, sizeof(type));
2003+ if (strcmp(type, "display") == 0)
2004+ prom_setprop(stdout_node, path, "linux,boot-display", NULL, 0);
2005+ }
20022006 }
20032007
20042008 static int __init prom_find_machine_type(void)
arch/powerpc/kernel/ptrace.c+2−2
@@ -1555,7 +1555,7 @@ long arch_ptrace(struct task_struct *child, long request, · 1554 unmodified lines
15551555
15561556 flush_fp_to_thread(child);
15571557 if (fpidx < (PT_FPSCR - PT_FPR0))
1558− memcpy(&tmp, &child->thread.fp_state.fpr,
1558+ memcpy(&tmp, &child->thread.TS_FPR(fpidx),
15591559 sizeof(long));
15601560 else
15611561 tmp = child->thread.fp_state.fpscr;
@@ -1588,7 +1588,7 @@ long arch_ptrace(struct task_struct *child, long request, · 26 unmodified lines
15881588
15891589 flush_fp_to_thread(child);
15901590 if (fpidx < (PT_FPSCR - PT_FPR0))
1591− memcpy(&child->thread.fp_state.fpr, &data,
1591+ memcpy(&child->thread.TS_FPR(fpidx), &data,
15921592 sizeof(long));
15931593 else
15941594 child->thread.fp_state.fpscr = data;
arch/powerpc/kernel/setup-common.c+2−2
@@ -479,7 +479,7 @@ void __init smp_setup_cpu_maps(void) · 478 unmodified lines
479479 if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR) &&
480480 (dn = of_find_node_by_path("/rtas"))) {
481481 int num_addr_cell, num_size_cell, maxcpus;
482− const unsigned int *ireg;
482+ const __be32 *ireg;
483483
484484 num_addr_cell = of_n_addr_cells(dn);
485485 num_size_cell = of_n_size_cells(dn);
@@ -489,7 +489,7 @@ void __init smp_setup_cpu_maps(void) · 3 unmodified lines
489489 if (!ireg)
490490 goto out;
491491
492− maxcpus = ireg[num_addr_cell + num_size_cell];
492+ maxcpus = be32_to_cpup(ireg + num_addr_cell + num_size_cell);
493493
494494 /* Double maxcpus for processors which have SMT capability */
495495 if (cpu_has_feature(CPU_FTR_SMT))
arch/powerpc/kernel/smp.c+2−2
@@ -580,7 +580,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle) · 579 unmodified lines
580580 int cpu_to_core_id(int cpu)
581581 {
582582 struct device_node *np;
583− const int *reg;
583+ const __be32 *reg;
584584 int id = -1;
585585
586586 np = of_get_cpu_node(cpu, NULL);
@@ -591,7 +591,7 @@ int cpu_to_core_id(int cpu) · 4 unmodified lines
591591 if (!reg)
592592 goto out;
593593
594− id = *reg;
594+ id = be32_to_cpup(reg);
595595 out:
596596 of_node_put(np);
597597 return id;
arch/powerpc/kvm/book3s_64_mmu_hv.c+14−4
@@ -469,11 +469,14 @@ static int kvmppc_mmu_book3s_64_hv_xlate(struct kvm_vcpu *vcpu, gva_t eaddr, · 468 unmodified lines
469469 slb_v = vcpu->kvm->arch.vrma_slb_v;
470470 }
471471
472+ preempt_disable();
472473 /* Find the HPTE in the hash table */
473474 index = kvmppc_hv_find_lock_hpte(kvm, eaddr, slb_v,
474475 HPTE_V_VALID | HPTE_V_ABSENT);
475− if (index < 0)
476+ if (index < 0) {
477+ preempt_enable();
476478 return -ENOENT;
479+ }
477480 hptep = (unsigned long *)(kvm->arch.hpt_virt + (index << 4));
478481 v = hptep[0] & ~HPTE_V_HVLOCK;
479482 gr = kvm->arch.revmap[index].guest_rpte;
@@ -481,6 +484,7 @@ static int kvmppc_mmu_book3s_64_hv_xlate(struct kvm_vcpu *vcpu, gva_t eaddr, · 1 unmodified line
481484 /* Unlock the HPTE */
482485 asm volatile("lwsync" : : : "memory");
483486 hptep[0] = v;
487+ preempt_enable();
484488
485489 gpte->eaddr = eaddr;
486490 gpte->vpage = ((v & HPTE_V_AVPN) << 4) | ((eaddr >> 12) & 0xfff);
@@ -665,6 +669,7 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu, · 178 unmodified lines
665669 return -EFAULT;
666670 } else {
667671 page = pages[0];
672+ pfn = page_to_pfn(page);
668673 if (PageHuge(page)) {
669674 page = compound_head(page);
670675 pte_size <<= compound_order(page);
@@ -689,7 +694,6 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu, · 18 unmodified lines
689694 }
690695 rcu_read_unlock_sched();
691696 }
692− pfn = page_to_pfn(page);
693697 }
694698
695699 ret = -EFAULT;
@@ -707,8 +711,14 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu, · 11 unmodified lines
707711 r = (r & ~(HPTE_R_W|HPTE_R_I|HPTE_R_G)) | HPTE_R_M;
708712 }
709713
710− /* Set the HPTE to point to pfn */
711− r = (r & ~(HPTE_R_PP0 - pte_size)) | (pfn << PAGE_SHIFT);
714+ /*
715+ * Set the HPTE to point to pfn.
716+ * Since the pfn is at PAGE_SIZE granularity, make sure we
717+ * don't mask out lower-order bits if psize < PAGE_SIZE.
718+ */
719+ if (psize < PAGE_SIZE)
720+ psize = PAGE_SIZE;
721+ r = (r & ~(HPTE_R_PP0 - psize)) | ((pfn << PAGE_SHIFT) & ~(psize - 1));
712722 if (hpte_is_writable(r) && !write_ok)
713723 r = hpte_make_readonly(r);
714724 ret = RESUME_GUEST;
arch/powerpc/kvm/book3s_hv.c+14−10
@@ -131,8 +131,9 @@ static void kvmppc_fast_vcpu_kick_hv(struct kvm_vcpu *vcpu) · 130 unmodified lines
131131 static void kvmppc_core_vcpu_load_hv(struct kvm_vcpu *vcpu, int cpu)
132132 {
133133 struct kvmppc_vcore *vc = vcpu->arch.vcore;
134+ unsigned long flags;
134135
135− spin_lock(&vcpu->arch.tbacct_lock);
136+ spin_lock_irqsave(&vcpu->arch.tbacct_lock, flags);
136137 if (vc->runner == vcpu && vc->vcore_state != VCORE_INACTIVE &&
137138 vc->preempt_tb != TB_NIL) {
138139 vc->stolen_tb += mftb() - vc->preempt_tb;
@@ -143,19 +144,20 @@ static void kvmppc_core_vcpu_load_hv(struct kvm_vcpu *vcpu, int cpu) · 4 unmodified lines
143144 vcpu->arch.busy_stolen += mftb() - vcpu->arch.busy_preempt;
144145 vcpu->arch.busy_preempt = TB_NIL;
145146 }
146− spin_unlock(&vcpu->arch.tbacct_lock);
147+ spin_unlock_irqrestore(&vcpu->arch.tbacct_lock, flags);
147148 }
148149
149150 static void kvmppc_core_vcpu_put_hv(struct kvm_vcpu *vcpu)
150151 {
151152 struct kvmppc_vcore *vc = vcpu->arch.vcore;
153+ unsigned long flags;
152154
153− spin_lock(&vcpu->arch.tbacct_lock);
155+ spin_lock_irqsave(&vcpu->arch.tbacct_lock, flags);
154156 if (vc->runner == vcpu && vc->vcore_state != VCORE_INACTIVE)
155157 vc->preempt_tb = mftb();
156158 if (vcpu->arch.state == KVMPPC_VCPU_BUSY_IN_HOST)
157159 vcpu->arch.busy_preempt = mftb();
158− spin_unlock(&vcpu->arch.tbacct_lock);
160+ spin_unlock_irqrestore(&vcpu->arch.tbacct_lock, flags);
159161 }
160162
161163 static void kvmppc_set_msr_hv(struct kvm_vcpu *vcpu, u64 msr)
@@ -486,11 +488,11 @@ static u64 vcore_stolen_time(struct kvmppc_vcore *vc, u64 now) · 324 unmodified lines
486488 */
487489 if (vc->vcore_state != VCORE_INACTIVE &&
488490 vc->runner->arch.run_task != current) {
489− spin_lock(&vc->runner->arch.tbacct_lock);
491+ spin_lock_irq(&vc->runner->arch.tbacct_lock);
490492 p = vc->stolen_tb;
491493 if (vc->preempt_tb != TB_NIL)
492494 p += now - vc->preempt_tb;
493− spin_unlock(&vc->runner->arch.tbacct_lock);
495+ spin_unlock_irq(&vc->runner->arch.tbacct_lock);
494496 } else {
495497 p = vc->stolen_tb;
496498 }
@@ -512,10 +514,10 @@ static void kvmppc_create_dtl_entry(struct kvm_vcpu *vcpu, · 15 unmodified lines
512514 core_stolen = vcore_stolen_time(vc, now);
513515 stolen = core_stolen - vcpu->arch.stolen_logged;
514516 vcpu->arch.stolen_logged = core_stolen;
515− spin_lock(&vcpu->arch.tbacct_lock);
517+ spin_lock_irq(&vcpu->arch.tbacct_lock);
516518 stolen += vcpu->arch.busy_stolen;
517519 vcpu->arch.busy_stolen = 0;
518− spin_unlock(&vcpu->arch.tbacct_lock);
520+ spin_unlock_irq(&vcpu->arch.tbacct_lock);
519521 if (!dt || !vpa)
520522 return;
521523 memset(dt, 0, sizeof(struct dtl_entry));
@@ -589,7 +591,9 @@ int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu) · 67 unmodified lines
589591 if (list_empty(&vcpu->kvm->arch.rtas_tokens))
590592 return RESUME_HOST;
591593
594+ idx = srcu_read_lock(&vcpu->kvm->srcu);
592595 rc = kvmppc_rtas_hcall(vcpu);
596+ srcu_read_unlock(&vcpu->kvm->srcu, idx);
593597
594598 if (rc == -ENOENT)
595599 return RESUME_HOST;
@@ -1115,13 +1119,13 @@ static void kvmppc_remove_runnable(struct kvmppc_vcore *vc, · 519 unmodified lines
11151119
11161120 if (vcpu->arch.state != KVMPPC_VCPU_RUNNABLE)
11171121 return;
1118− spin_lock(&vcpu->arch.tbacct_lock);
1122+ spin_lock_irq(&vcpu->arch.tbacct_lock);
11191123 now = mftb();
11201124 vcpu->arch.busy_stolen += vcore_stolen_time(vc, now) -
11211125 vcpu->arch.stolen_logged;
11221126 vcpu->arch.busy_preempt = now;
11231127 vcpu->arch.state = KVMPPC_VCPU_BUSY_IN_HOST;
1124− spin_unlock(&vcpu->arch.tbacct_lock);
1128+ spin_unlock_irq(&vcpu->arch.tbacct_lock);
11251129 --vc->n_runnable;
11261130 list_del(&vcpu->arch.run_list);
11271131 }
arch/powerpc/kvm/book3s_hv_rm_mmu.c+7−2
@@ -225,6 +225,7 @@ long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags, · 224 unmodified lines
225225 is_io = pa & (HPTE_R_I | HPTE_R_W);
226226 pte_size = PAGE_SIZE << (pa & KVMPPC_PAGE_ORDER_MASK);
227227 pa &= PAGE_MASK;
228+ pa |= gpa & ~PAGE_MASK;
228229 } else {
229230 /* Translate to host virtual address */
230231 hva = __gfn_to_hva_memslot(memslot, gfn);
@@ -238,13 +239,13 @@ long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags, · 7 unmodified lines
238239 ptel = hpte_make_readonly(ptel);
239240 is_io = hpte_cache_bits(pte_val(pte));
240241 pa = pte_pfn(pte) << PAGE_SHIFT;
242+ pa |= hva & (pte_size - 1);
243+ pa |= gpa & ~PAGE_MASK;
241244 }
242245 }
243246
244247 if (pte_size < psize)
245248 return H_PARAMETER;
246− if (pa && pte_size > psize)
247− pa |= gpa & (pte_size - 1);
248249
249250 ptel &= ~(HPTE_R_PP0 - psize);
250251 ptel |= pa;
@@ -749,6 +750,10 @@ static int slb_base_page_shift[4] = { · 498 unmodified lines
749750 20, /* 1M, unsupported */
750751 };
751752
753+/* When called from virtmode, this func should be protected by
754+ * preempt_disable(), otherwise, the holding of HPTE_V_HVLOCK
755+ * can trigger deadlock issue.
756+ */
752757 long kvmppc_hv_find_lock_hpte(struct kvm *kvm, gva_t eaddr, unsigned long slb_v,
753758 unsigned long valid)
754759 {
arch/powerpc/kvm/book3s_hv_rmhandlers.S+13−10
@@ -153,7 +153,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206) · 152 unmodified lines
153153
154154 13: b machine_check_fwnmi
155155
156−
157156 /*
158157 * We come in here when wakened from nap mode on a secondary hw thread.
159158 * Relocation is off and most register values are lost.
@@ -224,6 +223,11 @@ kvm_start_guest: · 64 unmodified lines
224223 /* Clear our vcpu pointer so we don't come back in early */
225224 li r0, 0
226225 std r0, HSTATE_KVM_VCPU(r13)
226+ /*
227+ * Make sure we clear HSTATE_KVM_VCPU(r13) before incrementing
228+ * the nap_count, because once the increment to nap_count is
229+ * visible we could be given another vcpu.
230+ */
227231 lwsync
228232 /* Clear any pending IPI - we're an offline thread */
229233 ld r5, HSTATE_XICS_PHYS(r13)
@@ -241,7 +245,6 @@ kvm_start_guest: · 11 unmodified lines
241245 /* increment the nap count and then go to nap mode */
242246 ld r4, HSTATE_KVM_VCORE(r13)
243247 addi r4, r4, VCORE_NAP_COUNT
244− lwsync /* make previous updates visible */
245248 51: lwarx r3, 0, r4
246249 addi r3, r3, 1
247250 stwcx. r3, 0, r4
@@ -751,15 +754,14 @@ kvmppc_interrupt_hv: · 503 unmodified lines
751754 * guest CR, R12 saved in shadow VCPU SCRATCH1/0
752755 * guest R13 saved in SPRN_SCRATCH0
753756 */
754− /* abuse host_r2 as third scratch area; we get r2 from PACATOC(r13) */
755− std r9, HSTATE_HOST_R2(r13)
757+ std r9, HSTATE_SCRATCH2(r13)
756758
757759 lbz r9, HSTATE_IN_GUEST(r13)
758760 cmpwi r9, KVM_GUEST_MODE_HOST_HV
759761 beq kvmppc_bad_host_intr
760762 #ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
761763 cmpwi r9, KVM_GUEST_MODE_GUEST
762− ld r9, HSTATE_HOST_R2(r13)
764+ ld r9, HSTATE_SCRATCH2(r13)
763765 beq kvmppc_interrupt_pr
764766 #endif
765767 /* We're now back in the host but in guest MMU context */
@@ -779,7 +781,7 @@ kvmppc_interrupt_hv: · 13 unmodified lines
779781 std r6, VCPU_GPR(R6)(r9)
780782 std r7, VCPU_GPR(R7)(r9)
781783 std r8, VCPU_GPR(R8)(r9)
782− ld r0, HSTATE_HOST_R2(r13)
784+ ld r0, HSTATE_SCRATCH2(r13)
783785 std r0, VCPU_GPR(R9)(r9)
784786 std r10, VCPU_GPR(R10)(r9)
785787 std r11, VCPU_GPR(R11)(r9)
@@ -990,14 +992,13 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201) · 204 unmodified lines
990992 */
991993 /* Increment the threads-exiting-guest count in the 0xff00
992994 bits of vcore->entry_exit_count */
993− lwsync
994995 ld r5,HSTATE_KVM_VCORE(r13)
995996 addi r6,r5,VCORE_ENTRY_EXIT
996997 41: lwarx r3,0,r6
997998 addi r0,r3,0x100
998999 stwcx. r0,0,r6
9991000 bne 41b
1000− lwsync
1001+ isync /* order stwcx. vs. reading napping_threads */
10011002
10021003 /*
10031004 * At this point we have an interrupt that we have to pass
@@ -1030,6 +1031,8 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201) · 26 unmodified lines
10301031 sld r0,r0,r4
10311032 andc. r3,r3,r0 /* no sense IPI'ing ourselves */
10321033 beq 43f
1034+ /* Order entry/exit update vs. IPIs */
1035+ sync
10331036 mulli r4,r4,PACA_SIZE /* get paca for thread 0 */
10341037 subf r6,r4,r13
10351038 42: andi. r0,r3,1
@@ -1638,10 +1641,10 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206) · 602 unmodified lines
16381641 bge kvm_cede_exit
16391642 stwcx. r4,0,r6
16401643 bne 31b
1644+ /* order napping_threads update vs testing entry_exit_count */
1645+ isync
16411646 li r0,1
16421647 stb r0,HSTATE_NAPPING(r13)
1643− /* order napping_threads update vs testing entry_exit_count */
1644− lwsync
16451648 mr r4,r3
16461649 lwz r7,VCORE_ENTRY_EXIT(r5)
16471650 cmpwi r7,0x100
arch/powerpc/kvm/book3s_interrupts.S+11−8
@@ -129,29 +129,32 @@ kvm_start_lightweight: · 128 unmodified lines
129129 * R12 = exit handler id
130130 * R13 = PACA
131131 * SVCPU.* = guest *
132+ * MSR.EE = 1
132133 *
133134 */
134135
136+ PPC_LL r3, GPR4(r1) /* vcpu pointer */
137+
138+ /*
139+ * kvmppc_copy_from_svcpu can clobber volatile registers, save
140+ * the exit handler id to the vcpu and restore it from there later.
141+ */
142+ stw r12, VCPU_TRAP(r3)
143+
135144 /* Transfer reg values from shadow vcpu back to vcpu struct */
136145 /* On 64-bit, interrupts are still off at this point */
137− PPC_LL r3, GPR4(r1) /* vcpu pointer */
146+
138147 GET_SHADOW_VCPU(r4)
139148 bl FUNC(kvmppc_copy_from_svcpu)
140149 nop
141150
142151 #ifdef CONFIG_PPC_BOOK3S_64
143− /* Re-enable interrupts */
144− ld r3, HSTATE_HOST_MSR(r13)
145− ori r3, r3, MSR_EE
146− MTMSR_EERI(r3)
147−
148152 /*
149153 * Reload kernel SPRG3 value.
150154 * No need to save guest value as usermode can't modify SPRG3.
151155 */
152156 ld r3, PACA_SPRG3(r13)
153157 mtspr SPRN_SPRG3, r3
154−
155158 #endif /* CONFIG_PPC_BOOK3S_64 */
156159
157160 /* R7 = vcpu */
@@ -177,7 +180,7 @@ kvm_start_lightweight: · 19 unmodified lines
177180 PPC_STL r31, VCPU_GPR(R31)(r7)
178181
179182 /* Pass the exit number as 3rd argument to kvmppc_handle_exit */
180− mr r5, r12
183+ lwz r5, VCPU_TRAP(r7)
181184
182185 /* Restore r3 (kvm_run) and r4 (vcpu) */
183186 REST_2GPRS(3, r1)
arch/powerpc/kvm/book3s_pr.c+22−0
@@ -66,6 +66,7 @@ static void kvmppc_core_vcpu_load_pr(struct kvm_vcpu *vcpu, int cpu) · 65 unmodified lines
6666 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu);
6767 memcpy(svcpu->slb, to_book3s(vcpu)->slb_shadow, sizeof(svcpu->slb));
6868 svcpu->slb_max = to_book3s(vcpu)->slb_shadow_max;
69+ svcpu->in_use = 0;
6970 svcpu_put(svcpu);
7071 #endif
7172 vcpu->cpu = smp_processor_id();
@@ -78,6 +79,9 @@ static void kvmppc_core_vcpu_put_pr(struct kvm_vcpu *vcpu) · 6 unmodified lines
7879 {
7980 #ifdef CONFIG_PPC_BOOK3S_64
8081 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu);
82+ if (svcpu->in_use) {
83+ kvmppc_copy_from_svcpu(vcpu, svcpu);
84+ }
8185 memcpy(to_book3s(vcpu)->slb_shadow, svcpu->slb, sizeof(svcpu->slb));
8286 to_book3s(vcpu)->slb_shadow_max = svcpu->slb_max;
8387 svcpu_put(svcpu);
@@ -110,12 +114,26 @@ void kvmppc_copy_to_svcpu(struct kvmppc_book3s_shadow_vcpu *svcpu, · 26 unmodified lines
110114 svcpu->ctr = vcpu->arch.ctr;
111115 svcpu->lr = vcpu->arch.lr;
112116 svcpu->pc = vcpu->arch.pc;
117+ svcpu->in_use = true;
113118 }
114119
115120 /* Copy data touched by real-mode code from shadow vcpu back to vcpu */
116121 void kvmppc_copy_from_svcpu(struct kvm_vcpu *vcpu,
117122 struct kvmppc_book3s_shadow_vcpu *svcpu)
118123 {
124+ /*
125+ * vcpu_put would just call us again because in_use hasn't
126+ * been updated yet.
127+ */
128+ preempt_disable();
129+
130+ /*
131+ * Maybe we were already preempted and synced the svcpu from
132+ * our preempt notifiers. Don't bother touching this svcpu then.
133+ */
134+ if (!svcpu->in_use)
135+ goto out;
136+
119137 vcpu->arch.gpr[0] = svcpu->gpr[0];
120138 vcpu->arch.gpr[1] = svcpu->gpr[1];
121139 vcpu->arch.gpr[2] = svcpu->gpr[2];
@@ -139,6 +157,10 @@ void kvmppc_copy_from_svcpu(struct kvm_vcpu *vcpu, · 17 unmodified lines
139157 vcpu->arch.fault_dar = svcpu->fault_dar;
140158 vcpu->arch.fault_dsisr = svcpu->fault_dsisr;
141159 vcpu->arch.last_inst = svcpu->last_inst;
160+ svcpu->in_use = false;
161+
162+out:
163+ preempt_enable();
142164 }
143165
144166 static int kvmppc_core_check_requests_pr(struct kvm_vcpu *vcpu)
arch/powerpc/kvm/book3s_rmhandlers.S+1−5
@@ -153,15 +153,11 @@ _GLOBAL(kvmppc_entry_trampoline) · 152 unmodified lines
153153
154154 li r6, MSR_IR | MSR_DR
155155 andc r6, r5, r6 /* Clear DR and IR in MSR value */
156−#ifdef CONFIG_PPC_BOOK3S_32
157156 /*
158157 * Set EE in HOST_MSR so that it's enabled when we get into our
159− * C exit handler function. On 64-bit we delay enabling
160− * interrupts until we have finished transferring stuff
161− * to or from the PACA.
158+ * C exit handler function.
162159 */
163160 ori r5, r5, MSR_EE
164−#endif
165161 mtsrr0 r7
166162 mtsrr1 r6
167163 RFI
arch/powerpc/kvm/booke.c+6−6
@@ -681,7 +681,7 @@ int kvmppc_core_check_requests(struct kvm_vcpu *vcpu) · 680 unmodified lines
681681 int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
682682 {
683683 int ret, s;
684− struct thread_struct thread;
684+ struct debug_reg debug;
685685 #ifdef CONFIG_PPC_FPU
686686 struct thread_fp_state fp;
687687 int fpexc_mode;
@@ -723,9 +723,9 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) · 35 unmodified lines
723723 #endif
724724
725725 /* Switch to guest debug context */
726− thread.debug = vcpu->arch.shadow_dbg_reg;
727− switch_booke_debug_regs(&thread);
728− thread.debug = current->thread.debug;
726+ debug = vcpu->arch.shadow_dbg_reg;
727+ switch_booke_debug_regs(&debug);
728+ debug = current->thread.debug;
729729 current->thread.debug = vcpu->arch.shadow_dbg_reg;
730730
731731 kvmppc_fix_ee_before_entry();
@@ -736,8 +736,8 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) · 4 unmodified lines
736736 We also get here with interrupts enabled. */
737737
738738 /* Switch back to user space debug context */
739− switch_booke_debug_regs(&thread);
740− current->thread.debug = thread.debug;
739+ switch_booke_debug_regs(&debug);
740+ current->thread.debug = debug;
741741
742742 #ifdef CONFIG_PPC_FPU
743743 kvmppc_save_guest_fp(vcpu);
arch/powerpc/lib/copyuser_64.S+38−15
@@ -9,6 +9,14 @@ · 8 unmodified lines
99 #include <asm/processor.h>
1010 #include <asm/ppc_asm.h>
1111
12+#ifdef __BIG_ENDIAN__
13+#define sLd sld /* Shift towards low-numbered address. */
14+#define sHd srd /* Shift towards high-numbered address. */
15+#else
16+#define sLd srd /* Shift towards low-numbered address. */
17+#define sHd sld /* Shift towards high-numbered address. */
18+#endif
19+
1220 .align 7
1321 _GLOBAL(__copy_tofrom_user)
1422 BEGIN_FTR_SECTION
@@ -118,10 +126,10 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD) · 103 unmodified lines
118126
119127 24: ld r9,0(r4) /* 3+2n loads, 2+2n stores */
120128 25: ld r0,8(r4)
121− sld r6,r9,r10
129+ sLd r6,r9,r10
122130 26: ldu r9,16(r4)
123− srd r7,r0,r11
124− sld r8,r0,r10
131+ sHd r7,r0,r11
132+ sLd r8,r0,r10
125133 or r7,r7,r6
126134 blt cr6,79f
127135 27: ld r0,8(r4)
@@ -129,35 +137,35 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD) · 1 unmodified line
129137
130138 28: ld r0,0(r4) /* 4+2n loads, 3+2n stores */
131139 29: ldu r9,8(r4)
132− sld r8,r0,r10
140+ sLd r8,r0,r10
133141 addi r3,r3,-8
134142 blt cr6,5f
135143 30: ld r0,8(r4)
136− srd r12,r9,r11
137− sld r6,r9,r10
144+ sHd r12,r9,r11
145+ sLd r6,r9,r10
138146 31: ldu r9,16(r4)
139147 or r12,r8,r12
140− srd r7,r0,r11
141− sld r8,r0,r10
148+ sHd r7,r0,r11
149+ sLd r8,r0,r10
142150 addi r3,r3,16
143151 beq cr6,78f
144152
145153 1: or r7,r7,r6
146154 32: ld r0,8(r4)
147155 76: std r12,8(r3)
148−2: srd r12,r9,r11
149− sld r6,r9,r10
156+2: sHd r12,r9,r11
157+ sLd r6,r9,r10
150158 33: ldu r9,16(r4)
151159 or r12,r8,r12
152160 77: stdu r7,16(r3)
153− srd r7,r0,r11
154− sld r8,r0,r10
161+ sHd r7,r0,r11
162+ sLd r8,r0,r10
155163 bdnz 1b
156164
157165 78: std r12,8(r3)
158166 or r7,r7,r6
159167 79: std r7,16(r3)
160−5: srd r12,r9,r11
168+5: sHd r12,r9,r11
161169 or r12,r8,r12
162170 80: std r12,24(r3)
163171 bne 6f
@@ -165,23 +173,38 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD) · 1 unmodified line
165173 blr
166174 6: cmpwi cr1,r5,8
167175 addi r3,r3,32
168− sld r9,r9,r10
176+ sLd r9,r9,r10
169177 ble cr1,7f
170178 34: ld r0,8(r4)
171− srd r7,r0,r11
179+ sHd r7,r0,r11
172180 or r9,r7,r9
173181 7:
174182 bf cr7*4+1,1f
183+#ifdef __BIG_ENDIAN__
175184 rotldi r9,r9,32
185+#endif
176186 94: stw r9,0(r3)
187+#ifdef __LITTLE_ENDIAN__
188+ rotrdi r9,r9,32
189+#endif
177190 addi r3,r3,4
178191 1: bf cr7*4+2,2f
192+#ifdef __BIG_ENDIAN__
179193 rotldi r9,r9,16
194+#endif
180195 95: sth r9,0(r3)
196+#ifdef __LITTLE_ENDIAN__
197+ rotrdi r9,r9,16
198+#endif
181199 addi r3,r3,2
182200 2: bf cr7*4+3,3f
201+#ifdef __BIG_ENDIAN__
183202 rotldi r9,r9,8
203+#endif
184204 96: stb r9,0(r3)
205+#ifdef __LITTLE_ENDIAN__
206+ rotrdi r9,r9,8
207+#endif
185208 3: li r3,0
186209 blr
187210
arch/powerpc/platforms/powernv/eeh-ioda.c+5−15
@@ -36,7 +36,6 @@ · 35 unmodified lines
3636 #include "powernv.h"
3737 #include "pci.h"
3838
39−static char *hub_diag = NULL;
4039 static int ioda_eeh_nb_init = 0;
4140
4241 static int ioda_eeh_event(struct notifier_block *nb,
@@ -140,15 +139,6 @@ static int ioda_eeh_post_init(struct pci_controller *hose) · 97 unmodified lines
140139 ioda_eeh_nb_init = 1;
141140 }
142141
143− /* We needn't HUB diag-data on PHB3 */
144− if (phb->type == PNV_PHB_IODA1 && !hub_diag) {
145− hub_diag = (char *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
146− if (!hub_diag) {
147− pr_err("%s: Out of memory !\n", __func__);
148− return -ENOMEM;
149− }
150− }
151−
152142 #ifdef CONFIG_DEBUG_FS
153143 if (phb->dbgfs) {
154144 debugfs_create_file("err_injct_outbound", 0600,
@@ -633,11 +623,10 @@ static void ioda_eeh_hub_diag_common(struct OpalIoP7IOCErrorData *data) · 478 unmodified lines
633623 static void ioda_eeh_hub_diag(struct pci_controller *hose)
634624 {
635625 struct pnv_phb *phb = hose->private_data;
636− struct OpalIoP7IOCErrorData *data;
626+ struct OpalIoP7IOCErrorData *data = &phb->diag.hub_diag;
637627 long rc;
638628
639− data = (struct OpalIoP7IOCErrorData *)ioda_eeh_hub_diag;
640− rc = opal_pci_get_hub_diag_data(phb->hub_id, data, PAGE_SIZE);
629+ rc = opal_pci_get_hub_diag_data(phb->hub_id, data, sizeof(*data));
641630 if (rc != OPAL_SUCCESS) {
642631 pr_warning("%s: Failed to get HUB#%llx diag-data (%ld)\n",
643632 __func__, phb->hub_id, rc);
@@ -820,14 +809,15 @@ static void ioda_eeh_phb_diag(struct pci_controller *hose) · 176 unmodified lines
820809 struct OpalIoPhbErrorCommon *common;
821810 long rc;
822811
823− common = (struct OpalIoPhbErrorCommon *)phb->diag.blob;
824− rc = opal_pci_get_phb_diag_data2(phb->opal_id, common, PAGE_SIZE);
812+ rc = opal_pci_get_phb_diag_data2(phb->opal_id, phb->diag.blob,
813+ PNV_PCI_DIAG_BUF_SIZE);
825814 if (rc != OPAL_SUCCESS) {
826815 pr_warning("%s: Failed to get diag-data for PHB#%x (%ld)\n",
827816 __func__, hose->global_number, rc);
828817 return;
829818 }
830819
820+ common = (struct OpalIoPhbErrorCommon *)phb->diag.blob;
831821 switch (common->ioType) {
832822 case OPAL_PHB_ERROR_DATA_TYPE_P7IOC:
833823 ioda_eeh_p7ioc_phb_diag(hose, common);
arch/powerpc/platforms/powernv/opal-lpc.c+6−6
@@ -24,25 +24,25 @@ static int opal_lpc_chip_id = -1; · 23 unmodified lines
2424 static u8 opal_lpc_inb(unsigned long port)
2525 {
2626 int64_t rc;
27− uint32_t data;
27+ __be32 data;
2828
2929 if (opal_lpc_chip_id < 0 || port > 0xffff)
3030 return 0xff;
3131 rc = opal_lpc_read(opal_lpc_chip_id, OPAL_LPC_IO, port, &data, 1);
32− return rc ? 0xff : data;
32+ return rc ? 0xff : be32_to_cpu(data);
3333 }
3434
3535 static __le16 __opal_lpc_inw(unsigned long port)
3636 {
3737 int64_t rc;
38− uint32_t data;
38+ __be32 data;
3939
4040 if (opal_lpc_chip_id < 0 || port > 0xfffe)
4141 return 0xffff;
4242 if (port & 1)
4343 return (__le16)opal_lpc_inb(port) << 8 | opal_lpc_inb(port + 1);
4444 rc = opal_lpc_read(opal_lpc_chip_id, OPAL_LPC_IO, port, &data, 2);
45− return rc ? 0xffff : data;
45+ return rc ? 0xffff : be32_to_cpu(data);
4646 }
4747 static u16 opal_lpc_inw(unsigned long port)
4848 {
@@ -52,7 +52,7 @@ static u16 opal_lpc_inw(unsigned long port) · 3 unmodified lines
5252 static __le32 __opal_lpc_inl(unsigned long port)
5353 {
5454 int64_t rc;
55− uint32_t data;
55+ __be32 data;
5656
5757 if (opal_lpc_chip_id < 0 || port > 0xfffc)
5858 return 0xffffffff;
@@ -62,7 +62,7 @@ static __le32 __opal_lpc_inl(unsigned long port) · 3 unmodified lines
6262 (__le32)opal_lpc_inb(port + 2) << 8 |
6363 opal_lpc_inb(port + 3);
6464 rc = opal_lpc_read(opal_lpc_chip_id, OPAL_LPC_IO, port, &data, 4);
65− return rc ? 0xffffffff : data;
65+ return rc ? 0xffffffff : be32_to_cpu(data);
6666 }
6767
6868 static u32 opal_lpc_inl(unsigned long port)
arch/powerpc/platforms/powernv/opal-xscom.c+3−1
@@ -96,9 +96,11 @@ static int opal_scom_read(scom_map_t map, u64 reg, u64 *value) · 95 unmodified lines
9696 {
9797 struct opal_scom_map *m = map;
9898 int64_t rc;
99+ __be64 v;
99100
100101 reg = opal_scom_unmangle(reg);
101− rc = opal_xscom_read(m->chip, m->addr + reg, (uint64_t *)__pa(value));
102+ rc = opal_xscom_read(m->chip, m->addr + reg, (__be64 *)__pa(&v));
103+ *value = be64_to_cpu(v);
102104 return opal_xscom_err_xlate(rc);
103105 }
104106
arch/powerpc/platforms/powernv/pci.h+3−1
@@ -172,11 +172,13 @@ struct pnv_phb { · 171 unmodified lines
172172 } ioda;
173173 };
174174
175− /* PHB status structure */
175+ /* PHB and hub status structure */
176176 union {
177177 unsigned char blob[PNV_PCI_DIAG_BUF_SIZE];
178178 struct OpalIoP7IOCPhbErrorData p7ioc;
179+ struct OpalIoP7IOCErrorData hub_diag;
179180 } diag;
181+
180182 };
181183
182184 extern struct pci_ops pnv_pci_ops;
arch/powerpc/platforms/pseries/lparcfg.c+6−6
@@ -157,7 +157,7 @@ static void parse_ppp_data(struct seq_file *m) · 156 unmodified lines
157157 {
158158 struct hvcall_ppp_data ppp_data;
159159 struct device_node *root;
160− const int *perf_level;
160+ const __be32 *perf_level;
161161 int rc;
162162
163163 rc = h_get_ppp(&ppp_data);
@@ -201,7 +201,7 @@ static void parse_ppp_data(struct seq_file *m) · 37 unmodified lines
201201 perf_level = of_get_property(root,
202202 "ibm,partition-performance-parameters-level",
203203 NULL);
204− if (perf_level && (*perf_level >= 1)) {
204+ if (perf_level && (be32_to_cpup(perf_level) >= 1)) {
205205 seq_printf(m,
206206 "physical_procs_allocated_to_virtualization=%d\n",
207207 ppp_data.phys_platform_procs);
@@ -435,7 +435,7 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v) · 227 unmodified lines
435435 int partition_potential_processors;
436436 int partition_active_processors;
437437 struct device_node *rtas_node;
438− const int *lrdrp = NULL;
438+ const __be32 *lrdrp = NULL;
439439
440440 rtas_node = of_find_node_by_path("/rtas");
441441 if (rtas_node)
@@ -444,7 +444,7 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v) · 2 unmodified lines
444444 if (lrdrp == NULL) {
445445 partition_potential_processors = vdso_data->processorCount;
446446 } else {
447− partition_potential_processors = *(lrdrp + 4);
447+ partition_potential_processors = be32_to_cpup(lrdrp + 4);
448448 }
449449 of_node_put(rtas_node);
450450
@@ -654,7 +654,7 @@ static int lparcfg_data(struct seq_file *m, void *v) · 203 unmodified lines
654654 const char *model = "";
655655 const char *system_id = "";
656656 const char *tmp;
657− const unsigned int *lp_index_ptr;
657+ const __be32 *lp_index_ptr;
658658 unsigned int lp_index = 0;
659659
660660 seq_printf(m, "%s %s\n", MODULE_NAME, MODULE_VERS);
@@ -670,7 +670,7 @@ static int lparcfg_data(struct seq_file *m, void *v) · 9 unmodified lines
670670 lp_index_ptr = of_get_property(rootdn, "ibm,partition-no",
671671 NULL);
672672 if (lp_index_ptr)
673− lp_index = *lp_index_ptr;
673+ lp_index = be32_to_cpup(lp_index_ptr);
674674 of_node_put(rootdn);
675675 }
676676 seq_printf(m, "serial_number=%s\n", system_id);
arch/powerpc/platforms/pseries/msi.c+15−13
@@ -130,7 +130,8 @@ static int check_req(struct pci_dev *pdev, int nvec, char *prop_name) · 129 unmodified lines
130130 {
131131 struct device_node *dn;
132132 struct pci_dn *pdn;
133− const u32 *req_msi;
133+ const __be32 *p;
134+ u32 req_msi;
134135
135136 pdn = pci_get_pdn(pdev);
136137 if (!pdn)
@@ -138,19 +139,20 @@ static int check_req(struct pci_dev *pdev, int nvec, char *prop_name) · 1 unmodified line
138139
139140 dn = pdn->node;
140141
141− req_msi = of_get_property(dn, prop_name, NULL);
142− if (!req_msi) {
142+ p = of_get_property(dn, prop_name, NULL);
143+ if (!p) {
143144 pr_debug("rtas_msi: No %s on %s\n", prop_name, dn->full_name);
144145 return -ENOENT;
145146 }
146147
147− if (*req_msi < nvec) {
148+ req_msi = be32_to_cpup(p);
149+ if (req_msi < nvec) {
148150 pr_debug("rtas_msi: %s requests < %d MSIs\n", prop_name, nvec);
149151
150− if (*req_msi == 0) /* Be paranoid */
152+ if (req_msi == 0) /* Be paranoid */
151153 return -ENOSPC;
152154
153− return *req_msi;
155+ return req_msi;
154156 }
155157
156158 return 0;
@@ -171,7 +173,7 @@ static int check_req_msix(struct pci_dev *pdev, int nvec) · 14 unmodified lines
171173 static struct device_node *find_pe_total_msi(struct pci_dev *dev, int *total)
172174 {
173175 struct device_node *dn;
174− const u32 *p;
176+ const __be32 *p;
175177
176178 dn = of_node_get(pci_device_to_OF_node(dev));
177179 while (dn) {
@@ -179,7 +181,7 @@ static struct device_node *find_pe_total_msi(struct pci_dev *dev, int *total) · 1 unmodified line
179181 if (p) {
180182 pr_debug("rtas_msi: found prop on dn %s\n",
181183 dn->full_name);
182− *total = *p;
184+ *total = be32_to_cpup(p);
183185 return dn;
184186 }
185187
@@ -232,13 +234,13 @@ struct msi_counts { · 46 unmodified lines
232234 static void *count_non_bridge_devices(struct device_node *dn, void *data)
233235 {
234236 struct msi_counts *counts = data;
235− const u32 *p;
237+ const __be32 *p;
236238 u32 class;
237239
238240 pr_debug("rtas_msi: counting %s\n", dn->full_name);
239241
240242 p = of_get_property(dn, "class-code", NULL);
241− class = p ? *p : 0;
243+ class = p ? be32_to_cpup(p) : 0;
242244
243245 if ((class >> 8) != PCI_CLASS_BRIDGE_PCI)
244246 counts->num_devices++;
@@ -249,7 +251,7 @@ static void *count_non_bridge_devices(struct device_node *dn, void *data) · 4 unmodified lines
249251 static void *count_spare_msis(struct device_node *dn, void *data)
250252 {
251253 struct msi_counts *counts = data;
252− const u32 *p;
254+ const __be32 *p;
253255 int req;
254256
255257 if (dn == counts->requestor)
@@ -260,11 +262,11 @@ static void *count_spare_msis(struct device_node *dn, void *data) · 4 unmodified lines
260262 req = 0;
261263 p = of_get_property(dn, "ibm,req#msi", NULL);
262264 if (p)
263− req = *p;
265+ req = be32_to_cpup(p);
264266
265267 p = of_get_property(dn, "ibm,req#msi-x", NULL);
266268 if (p)
267− req = max(req, (int)*p);
269+ req = max(req, (int)be32_to_cpup(p));
268270 }
269271
270272 if (req < counts->quota)
arch/powerpc/platforms/pseries/nvram.c+23−23
@@ -43,8 +43,8 @@ static char nvram_buf[NVRW_CNT]; /* assume this is in the first 4GB */ · 42 unmodified lines
4343 static DEFINE_SPINLOCK(nvram_lock);
4444
4545 struct err_log_info {
46− int error_type;
47− unsigned int seq_num;
46+ __be32 error_type;
47+ __be32 seq_num;
4848 };
4949
5050 struct nvram_os_partition {
@@ -79,9 +79,9 @@ static const char *pseries_nvram_os_partitions[] = { · 28 unmodified lines
7979 };
8080
8181 struct oops_log_info {
82− u16 version;
83− u16 report_length;
84− u64 timestamp;
82+ __be16 version;
83+ __be16 report_length;
84+ __be64 timestamp;
8585 } __attribute__((packed));
8686
8787 static void oops_to_nvram(struct kmsg_dumper *dumper,
@@ -291,8 +291,8 @@ int nvram_write_os_partition(struct nvram_os_partition *part, char * buff, · 203 unmodified lines
291291 length = part->size;
292292 }
293293
294− info.error_type = err_type;
295− info.seq_num = error_log_cnt;
294+ info.error_type = cpu_to_be32(err_type);
295+ info.seq_num = cpu_to_be32(error_log_cnt);
296296
297297 tmp_index = part->index;
298298
@@ -364,8 +364,8 @@ int nvram_read_partition(struct nvram_os_partition *part, char *buff, · 65 unmodified lines
364364 }
365365
366366 if (part->os_partition) {
367− *error_log_cnt = info.seq_num;
368− *err_type = info.error_type;
367+ *error_log_cnt = be32_to_cpu(info.seq_num);
368+ *err_type = be32_to_cpu(info.error_type);
369369 }
370370
371371 return 0;
@@ -529,9 +529,9 @@ static int zip_oops(size_t text_len) · 157 unmodified lines
529529 pr_err("nvram: logging uncompressed oops/panic report\n");
530530 return -1;
531531 }
532− oops_hdr->version = OOPS_HDR_VERSION;
533− oops_hdr->report_length = (u16) zipped_len;
534− oops_hdr->timestamp = get_seconds();
532+ oops_hdr->version = cpu_to_be16(OOPS_HDR_VERSION);
533+ oops_hdr->report_length = cpu_to_be16(zipped_len);
534+ oops_hdr->timestamp = cpu_to_be64(get_seconds());
535535 return 0;
536536 }
537537
@@ -574,9 +574,9 @@ static int nvram_pstore_write(enum pstore_type_id type, · 36 unmodified lines
574574 clobbering_unread_rtas_event())
575575 return -1;
576576
577− oops_hdr->version = OOPS_HDR_VERSION;
578− oops_hdr->report_length = (u16) size;
579− oops_hdr->timestamp = get_seconds();
577+ oops_hdr->version = cpu_to_be16(OOPS_HDR_VERSION);
578+ oops_hdr->report_length = cpu_to_be16(size);
579+ oops_hdr->timestamp = cpu_to_be64(get_seconds());
580580
581581 if (compressed)
582582 err_type = ERR_TYPE_KERNEL_PANIC_GZ;
@@ -670,16 +670,16 @@ static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type, · 87 unmodified lines
670670 size_t length, hdr_size;
671671
672672 oops_hdr = (struct oops_log_info *)buff;
673− if (oops_hdr->version < OOPS_HDR_VERSION) {
673+ if (be16_to_cpu(oops_hdr->version) < OOPS_HDR_VERSION) {
674674 /* Old format oops header had 2-byte record size */
675675 hdr_size = sizeof(u16);
676− length = oops_hdr->version;
676+ length = be16_to_cpu(oops_hdr->version);
677677 time->tv_sec = 0;
678678 time->tv_nsec = 0;
679679 } else {
680680 hdr_size = sizeof(*oops_hdr);
681− length = oops_hdr->report_length;
682− time->tv_sec = oops_hdr->timestamp;
681+ length = be16_to_cpu(oops_hdr->report_length);
682+ time->tv_sec = be64_to_cpu(oops_hdr->timestamp);
683683 time->tv_nsec = 0;
684684 }
685685 *buf = kmalloc(length, GFP_KERNEL);
@@ -889,13 +889,13 @@ static void oops_to_nvram(struct kmsg_dumper *dumper, · 203 unmodified lines
889889 kmsg_dump_get_buffer(dumper, false,
890890 oops_data, oops_data_sz, &text_len);
891891 err_type = ERR_TYPE_KERNEL_PANIC;
892− oops_hdr->version = OOPS_HDR_VERSION;
893− oops_hdr->report_length = (u16) text_len;
894− oops_hdr->timestamp = get_seconds();
892+ oops_hdr->version = cpu_to_be16(OOPS_HDR_VERSION);
893+ oops_hdr->report_length = cpu_to_be16(text_len);
894+ oops_hdr->timestamp = cpu_to_be64(get_seconds());
895895 }
896896
897897 (void) nvram_write_os_partition(&oops_log_partition, oops_buf,
898− (int) (sizeof(*oops_hdr) + oops_hdr->report_length), err_type,
898+ (int) (sizeof(*oops_hdr) + text_len), err_type,
899899 ++oops_count);
900900
901901 spin_unlock_irqrestore(&lock, flags);
arch/powerpc/platforms/pseries/pci.c+4−4
@@ -113,7 +113,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge) · 112 unmodified lines
113113 {
114114 struct device_node *dn, *pdn;
115115 struct pci_bus *bus;
116− const uint32_t *pcie_link_speed_stats;
116+ const __be32 *pcie_link_speed_stats;
117117
118118 bus = bridge->bus;
119119
@@ -122,7 +122,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge) · 2 unmodified lines
122122 return 0;
123123
124124 for (pdn = dn; pdn != NULL; pdn = of_get_next_parent(pdn)) {
125− pcie_link_speed_stats = (const uint32_t *) of_get_property(pdn,
125+ pcie_link_speed_stats = of_get_property(pdn,
126126 "ibm,pcie-link-speed-stats", NULL);
127127 if (pcie_link_speed_stats)
128128 break;
@@ -135,7 +135,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge) · 6 unmodified lines
135135 return 0;
136136 }
137137
138− switch (pcie_link_speed_stats[0]) {
138+ switch (be32_to_cpup(pcie_link_speed_stats)) {
139139 case 0x01:
140140 bus->max_bus_speed = PCIE_SPEED_2_5GT;
141141 break;
@@ -147,7 +147,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge) · 5 unmodified lines
147147 break;
148148 }
149149
150− switch (pcie_link_speed_stats[1]) {
150+ switch (be32_to_cpup(pcie_link_speed_stats)) {
151151 case 0x01:
152152 bus->cur_bus_speed = PCIE_SPEED_2_5GT;
153153 break;
arch/s390/Kconfig+0−1
@@ -135,7 +135,6 @@ config S390 · 134 unmodified lines
135135 select HAVE_SYSCALL_TRACEPOINTS
136136 select HAVE_UID16 if 32BIT
137137 select HAVE_VIRT_CPU_ACCOUNTING
138− select INIT_ALL_POSSIBLE
139138 select KTIME_SCALAR if 32BIT
140139 select MODULES_USE_ELF_RELA
141140 select OLD_SIGACTION
arch/s390/include/asm/smp.h+2−0
@@ -31,6 +31,7 @@ extern void smp_yield(void); · 30 unmodified lines
3131 extern void smp_stop_cpu(void);
3232 extern void smp_cpu_set_polarization(int cpu, int val);
3333 extern int smp_cpu_get_polarization(int cpu);
34+extern void smp_fill_possible_mask(void);
3435
3536 #else /* CONFIG_SMP */
3637
@@ -50,6 +51,7 @@ static inline int smp_vcpu_scheduled(int cpu) { return 1; } · 13 unmodified lines
5051 static inline void smp_yield_cpu(int cpu) { }
5152 static inline void smp_yield(void) { }
5253 static inline void smp_stop_cpu(void) { }
54+static inline void smp_fill_possible_mask(void) { }
5355
5456 #endif /* CONFIG_SMP */
5557
arch/s390/kernel/setup.c+1−0
@@ -1023,6 +1023,7 @@ void __init setup_arch(char **cmdline_p) · 1022 unmodified lines
10231023 setup_vmcoreinfo();
10241024 setup_lowcore();
10251025
1026+ smp_fill_possible_mask();
10261027 cpu_init();
10271028 s390_init_cpu_topology();
10281029
arch/s390/kernel/smp.c+16−9
@@ -721,18 +721,14 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle) · 720 unmodified lines
721721 return 0;
722722 }
723723
724−static int __init setup_possible_cpus(char *s)
725−{
726− int max, cpu;
724+static unsigned int setup_possible_cpus __initdata;
727725
728− if (kstrtoint(s, 0, &max) < 0)
729− return 0;
730− init_cpu_possible(cpumask_of(0));
731− for (cpu = 1; cpu < max && cpu < nr_cpu_ids; cpu++)
732− set_cpu_possible(cpu, true);
726+static int __init _setup_possible_cpus(char *s)
727+{
728+ get_option(&s, &setup_possible_cpus);
733729 return 0;
734730 }
735−early_param("possible_cpus", setup_possible_cpus);
731+early_param("possible_cpus", _setup_possible_cpus);
736732
737733 #ifdef CONFIG_HOTPLUG_CPU
738734
@@ -775,6 +771,17 @@ void __noreturn cpu_die(void) · 36 unmodified lines
775771
776772 #endif /* CONFIG_HOTPLUG_CPU */
777773
774+void __init smp_fill_possible_mask(void)
775+{
776+ unsigned int possible, cpu;
777+
778+ possible = setup_possible_cpus;
779+ if (!possible)
780+ possible = MACHINE_IS_VM ? 64 : nr_cpu_ids;
781+ for (cpu = 0; cpu < possible && cpu < nr_cpu_ids; cpu++)
782+ set_cpu_possible(cpu, true);
783+}
784+
778785 void __init smp_prepare_cpus(unsigned int max_cpus)
779786 {
780787 /* request the 0x1201 emergency signal external interrupt */
arch/s390/pci/pci_event.c+2−0
@@ -75,6 +75,7 @@ void zpci_event_availability(void *data) · 74 unmodified lines
7575 if (!zdev || zdev->state == ZPCI_FN_STATE_CONFIGURED)
7676 break;
7777 zdev->state = ZPCI_FN_STATE_CONFIGURED;
78+ zdev->fh = ccdf->fh;
7879 ret = zpci_enable_device(zdev);
7980 if (ret)
8081 break;
@@ -101,6 +102,7 @@ void zpci_event_availability(void *data) · 20 unmodified lines
101102 if (pdev)
102103 pci_stop_and_remove_bus_device(pdev);
103104
105+ zdev->fh = ccdf->fh;
104106 zpci_disable_device(zdev);
105107 zdev->state = ZPCI_FN_STATE_STANDBY;
106108 break;
arch/sh/kernel/sh_ksyms_32.c+5−0
@@ -20,6 +20,11 @@ EXPORT_SYMBOL(csum_partial_copy_generic); · 19 unmodified lines
2020 EXPORT_SYMBOL(copy_page);
2121 EXPORT_SYMBOL(__clear_user);
2222 EXPORT_SYMBOL(empty_zero_page);
23+#ifdef CONFIG_FLATMEM
24+/* need in pfn_valid macro */
25+EXPORT_SYMBOL(min_low_pfn);
26+EXPORT_SYMBOL(max_low_pfn);
27+#endif
2328
2429 #define DECLARE_EXPORT(name) \
2530 extern void name(void);EXPORT_SYMBOL(name)
arch/sh/lib/Makefile+1−1
@@ -6,7 +6,7 @@ lib-y = delay.o memmove.o memchr.o \ · 5 unmodified lines
66 checksum.o strlen.o div64.o div64-generic.o
77
88 # Extracted from libgcc
9−lib-y += movmem.o ashldi3.o ashrdi3.o lshrdi3.o \
9+obj-y += movmem.o ashldi3.o ashrdi3.o lshrdi3.o \
1010 ashlsi3.o ashrsi3.o ashiftrt.o lshrsi3.o \
1111 udiv_qrnnd.o
1212
arch/sparc/include/asm/pgtable_64.h+2−2
@@ -619,7 +619,7 @@ static inline unsigned long pte_present(pte_t pte) · 618 unmodified lines
619619 }
620620
621621 #define pte_accessible pte_accessible
622−static inline unsigned long pte_accessible(pte_t a)
622+static inline unsigned long pte_accessible(struct mm_struct *mm, pte_t a)
623623 {
624624 return pte_val(a) & _PAGE_VALID;
625625 }
@@ -847,7 +847,7 @@ static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr, · 221 unmodified lines
847847 * SUN4V NOTE: _PAGE_VALID is the same value in both the SUN4U
848848 * and SUN4V pte layout, so this inline test is fine.
849849 */
850− if (likely(mm != &init_mm) && pte_accessible(orig))
850+ if (likely(mm != &init_mm) && pte_accessible(mm, orig))
851851 tlb_batch_add(mm, addr, ptep, orig, fullmm);
852852 }
853853
arch/sparc/include/asm/uaccess_64.h+2−2
@@ -262,8 +262,8 @@ extern unsigned long __must_check __clear_user(void __user *, unsigned long); · 261 unmodified lines
262262 extern __must_check long strlen_user(const char __user *str);
263263 extern __must_check long strnlen_user(const char __user *str, long n);
264264
265−#define __copy_to_user_inatomic ___copy_to_user
266−#define __copy_from_user_inatomic ___copy_from_user
265+#define __copy_to_user_inatomic __copy_to_user
266+#define __copy_from_user_inatomic __copy_from_user
267267
268268 struct pt_regs;
269269 extern unsigned long compute_effective_address(struct pt_regs *,
arch/sparc/kernel/iommu.c+1−1
@@ -854,7 +854,7 @@ int dma_supported(struct device *dev, u64 device_mask) · 853 unmodified lines
854854 return 1;
855855
856856 #ifdef CONFIG_PCI
857− if (dev->bus == &pci_bus_type)
857+ if (dev_is_pci(dev))
858858 return pci64_dma_supported(to_pci_dev(dev), device_mask);
859859 #endif
860860
arch/sparc/kernel/ioport.c+2−3
@@ -666,10 +666,9 @@ EXPORT_SYMBOL(dma_ops); · 665 unmodified lines
666666 */
667667 int dma_supported(struct device *dev, u64 mask)
668668 {
669−#ifdef CONFIG_PCI
670− if (dev->bus == &pci_bus_type)
669+ if (dev_is_pci(dev))
671670 return 1;
672−#endif
671+
673672 return 0;
674673 }
675674 EXPORT_SYMBOL(dma_supported);
arch/sparc/kernel/kgdb_64.c+1−0
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 #include <linux/kgdb.h>
77 #include <linux/kdebug.h>
88 #include <linux/ftrace.h>
9+#include <linux/context_tracking.h>
910
1011 #include <asm/cacheflush.h>
1112 #include <asm/kdebug.h>
arch/sparc/kernel/smp_64.c+2−1
@@ -123,11 +123,12 @@ void smp_callin(void) · 122 unmodified lines
123123 rmb();
124124
125125 set_cpu_online(cpuid, true);
126− local_irq_enable();
127126
128127 /* idle thread is expected to have preempt disabled */
129128 preempt_disable();
130129
130+ local_irq_enable();
131+
131132 cpu_startup_entry(CPUHP_ONLINE);
132133 }
133134
arch/x86/Kconfig+1−0
@@ -26,6 +26,7 @@ config X86 · 25 unmodified lines
2626 select HAVE_AOUT if X86_32
2727 select HAVE_UNSTABLE_SCHED_CLOCK
2828 select ARCH_SUPPORTS_NUMA_BALANCING
29+ select ARCH_SUPPORTS_INT128 if X86_64
2930 select ARCH_WANTS_PROT_NUMA_PROT_NONE
3031 select HAVE_IDE
3132 select HAVE_OPROFILE
arch/x86/include/asm/fpu-internal.h+7−6
@@ -293,12 +293,13 @@ static inline int restore_fpu_checking(struct task_struct *tsk) · 292 unmodified lines
293293 /* AMD K7/K8 CPUs don't save/restore FDP/FIP/FOP unless an exception
294294 is pending. Clear the x87 state here by setting it to fixed
295295 values. "m" is a random variable that should be in L1 */
296− alternative_input(
297− ASM_NOP8 ASM_NOP2,
298− "emms\n\t" /* clear stack tags */
299− "fildl %P[addr]", /* set F?P to defined value */
300− X86_FEATURE_FXSAVE_LEAK,
301− [addr] "m" (tsk->thread.fpu.has_fpu));
296+ if (unlikely(static_cpu_has(X86_FEATURE_FXSAVE_LEAK))) {
297+ asm volatile(
298+ "fnclex\n\t"
299+ "emms\n\t"
300+ "fildl %P[addr]" /* set F?P to defined value */
301+ : : [addr] "m" (tsk->thread.fpu.has_fpu));
302+ }
302303
303304 return fpu_restore_checking(&tsk->thread.fpu);
304305 }
arch/x86/include/asm/pgtable.h+9−2
@@ -452,9 +452,16 @@ static inline int pte_present(pte_t a) · 451 unmodified lines
452452 }
453453
454454 #define pte_accessible pte_accessible
455−static inline int pte_accessible(pte_t a)
455+static inline bool pte_accessible(struct mm_struct *mm, pte_t a)
456456 {
457− return pte_flags(a) & _PAGE_PRESENT;
457+ if (pte_flags(a) & _PAGE_PRESENT)
458+ return true;
459+
460+ if ((pte_flags(a) & (_PAGE_PROTNONE | _PAGE_NUMA)) &&
461+ mm_tlb_flush_pending(mm))
462+ return true;
463+
464+ return false;
458465 }
459466
460467 static inline int pte_hidden(pte_t pte)
arch/x86/include/asm/preempt.h+11−0
@@ -7,6 +7,12 @@ · 6 unmodified lines
77
88 DECLARE_PER_CPU(int, __preempt_count);
99
10+/*
11+ * We use the PREEMPT_NEED_RESCHED bit as an inverted NEED_RESCHED such
12+ * that a decrement hitting 0 means we can and should reschedule.
13+ */
14+#define PREEMPT_ENABLED (0 + PREEMPT_NEED_RESCHED)
15+
1016 /*
1117 * We mask the PREEMPT_NEED_RESCHED bit so as not to confuse all current users
1218 * that think a non-zero value indicates we cannot preempt.
@@ -74,6 +80,11 @@ static __always_inline void __preempt_count_sub(int val) · 61 unmodified lines
7480 __this_cpu_add_4(__preempt_count, -val);
7581 }
7682
83+/*
84+ * Because we keep PREEMPT_NEED_RESCHED set when we do _not_ need to reschedule
85+ * a decrement which hits zero means we have no preempt_count and should
86+ * reschedule.
87+ */
7788 static __always_inline bool __preempt_count_dec_and_test(void)
7889 {
7990 GEN_UNARY_RMWcc("decl", __preempt_count, __percpu_arg(0), "e");
arch/x86/kernel/cpu/intel.c+2−1
@@ -387,7 +387,8 @@ static void init_intel(struct cpuinfo_x86 *c) · 386 unmodified lines
387387 set_cpu_cap(c, X86_FEATURE_PEBS);
388388 }
389389
390− if (c->x86 == 6 && c->x86_model == 29 && cpu_has_clflush)
390+ if (c->x86 == 6 && cpu_has_clflush &&
391+ (c->x86_model == 29 || c->x86_model == 46 || c->x86_model == 47))
391392 set_cpu_cap(c, X86_FEATURE_CLFLUSH_MONITOR);
392393
393394 #ifdef CONFIG_X86_64
arch/x86/kernel/cpu/perf_event.h+12−3
@@ -262,11 +262,20 @@ struct cpu_hw_events { · 261 unmodified lines
262262 __EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK, \
263263 HWEIGHT(n), 0, PERF_X86_EVENT_PEBS_ST_HSW)
264264
265−#define EVENT_CONSTRAINT_END \
266− EVENT_CONSTRAINT(0, 0, 0)
265+/*
266+ * We define the end marker as having a weight of -1
267+ * to enable blacklisting of events using a counter bitmask
268+ * of zero and thus a weight of zero.
269+ * The end marker has a weight that cannot possibly be
270+ * obtained from counting the bits in the bitmask.
271+ */
272+#define EVENT_CONSTRAINT_END { .weight = -1 }
267273
274+/*
275+ * Check for end marker with weight == -1
276+ */
268277 #define for_each_event_constraint(e, c) \
269− for ((e) = (c); (e)->weight; (e)++)
278+ for ((e) = (c); (e)->weight != -1; (e)++)
270279
271280 /*
272281 * Extra registers for specific events.
arch/x86/kernel/cpu/perf_event_amd_ibs.c+45−8
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010 #include <linux/module.h>
1111 #include <linux/pci.h>
1212 #include <linux/ptrace.h>
13+#include <linux/syscore_ops.h>
1314
1415 #include <asm/apic.h>
1516
@@ -816,6 +817,18 @@ out: · 800 unmodified lines
816817 return ret;
817818 }
818819
820+static void ibs_eilvt_setup(void)
821+{
822+ /*
823+ * Force LVT offset assignment for family 10h: The offsets are
824+ * not assigned by the BIOS for this family, so the OS is
825+ * responsible for doing it. If the OS assignment fails, fall
826+ * back to BIOS settings and try to setup this.
827+ */
828+ if (boot_cpu_data.x86 == 0x10)
829+ force_ibs_eilvt_setup();
830+}
831+
819832 static inline int get_ibs_lvt_offset(void)
820833 {
821834 u64 val;
@@ -851,6 +864,36 @@ static void clear_APIC_ibs(void *dummy) · 29 unmodified lines
851864 setup_APIC_eilvt(offset, 0, APIC_EILVT_MSG_FIX, 1);
852865 }
853866
867+#ifdef CONFIG_PM
868+
869+static int perf_ibs_suspend(void)
870+{
871+ clear_APIC_ibs(NULL);
872+ return 0;
873+}
874+
875+static void perf_ibs_resume(void)
876+{
877+ ibs_eilvt_setup();
878+ setup_APIC_ibs(NULL);
879+}
880+
881+static struct syscore_ops perf_ibs_syscore_ops = {
882+ .resume = perf_ibs_resume,
883+ .suspend = perf_ibs_suspend,
884+};
885+
886+static void perf_ibs_pm_init(void)
887+{
888+ register_syscore_ops(&perf_ibs_syscore_ops);
889+}
890+
891+#else
892+
893+static inline void perf_ibs_pm_init(void) { }
894+
895+#endif
896+
854897 static int
855898 perf_ibs_cpu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)
856899 {
@@ -877,18 +920,12 @@ static __init int amd_ibs_init(void) · 20 unmodified lines
877920 if (!caps)
878921 return -ENODEV; /* ibs not supported by the cpu */
879922
880− /*
881− * Force LVT offset assignment for family 10h: The offsets are
882− * not assigned by the BIOS for this family, so the OS is
883− * responsible for doing it. If the OS assignment fails, fall
884− * back to BIOS settings and try to setup this.
885− */
886− if (boot_cpu_data.x86 == 0x10)
887− force_ibs_eilvt_setup();
923+ ibs_eilvt_setup();
888924
889925 if (!ibs_eilvt_valid())
890926 goto out;
891927
928+ perf_ibs_pm_init();
892929 get_online_cpus();
893930 ibs_caps = caps;
894931 /* make ibs_caps visible to other cpus: */
arch/x86/kernel/entry_32.S+2−2
@@ -1082,7 +1082,7 @@ ENTRY(ftrace_caller) · 1081 unmodified lines
10821082 pushl $0 /* Pass NULL as regs pointer */
10831083 movl 4*4(%esp), %eax
10841084 movl 0x4(%ebp), %edx
1085− leal function_trace_op, %ecx
1085+ movl function_trace_op, %ecx
10861086 subl $MCOUNT_INSN_SIZE, %eax
10871087
10881088 .globl ftrace_call
@@ -1140,7 +1140,7 @@ ENTRY(ftrace_regs_caller) · 51 unmodified lines
11401140 movl 12*4(%esp), %eax /* Load ip (1st parameter) */
11411141 subl $MCOUNT_INSN_SIZE, %eax /* Adjust ip */
11421142 movl 0x4(%ebp), %edx /* Load parent ip (2nd parameter) */
1143− leal function_trace_op, %ecx /* Save ftrace_pos in 3rd parameter */
1143+ movl function_trace_op, %ecx /* Save ftrace_pos in 3rd parameter */
11441144 pushl %esp /* Save pt_regs as 4th parameter */
11451145
11461146 GLOBAL(ftrace_regs_call)
arch/x86/kernel/entry_64.S+1−1
@@ -88,7 +88,7 @@ END(function_hook) · 87 unmodified lines
8888 MCOUNT_SAVE_FRAME \skip
8989
9090 /* Load the ftrace_ops into the 3rd parameter */
91− leaq function_trace_op, %rdx
91+ movq function_trace_op(%rip), %rdx
9292
9393 /* Load ip into the first parameter */
9494 movq RIP(%rsp), %rdi
arch/x86/kvm/lapic.c+4−4
@@ -1350,6 +1350,10 @@ void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value) · 1349 unmodified lines
13501350 return;
13511351 }
13521352
1353+ if (!kvm_vcpu_is_bsp(apic->vcpu))
1354+ value &= ~MSR_IA32_APICBASE_BSP;
1355+ vcpu->arch.apic_base = value;
1356+
13531357 /* update jump label if enable bit changes */
13541358 if ((vcpu->arch.apic_base ^ value) & MSR_IA32_APICBASE_ENABLE) {
13551359 if (value & MSR_IA32_APICBASE_ENABLE)
@@ -1359,10 +1363,6 @@ void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value) · 3 unmodified lines
13591363 recalculate_apic_map(vcpu->kvm);
13601364 }
13611365
1362− if (!kvm_vcpu_is_bsp(apic->vcpu))
1363− value &= ~MSR_IA32_APICBASE_BSP;
1364−
1365− vcpu->arch.apic_base = value;
13661366 if ((old_value ^ value) & X2APIC_ENABLE) {
13671367 if (value & X2APIC_ENABLE) {
13681368 u32 id = kvm_apic_id(apic);
arch/x86/kvm/vmx.c+1−2
@@ -8283,8 +8283,7 @@ static void load_vmcs12_host_state(struct kvm_vcpu *vcpu, · 8282 unmodified lines
82838283 vcpu->arch.cr4_guest_owned_bits = ~vmcs_readl(CR4_GUEST_HOST_MASK);
82848284 kvm_set_cr4(vcpu, vmcs12->host_cr4);
82858285
8286− if (nested_cpu_has_ept(vmcs12))
8287− nested_ept_uninit_mmu_context(vcpu);
8286+ nested_ept_uninit_mmu_context(vcpu);
82888287
82898288 kvm_set_cr3(vcpu, vmcs12->host_cr3);
82908289 kvm_mmu_reset_context(vcpu);
arch/x86/mm/fault.c+18−0
@@ -641,6 +641,20 @@ no_context(struct pt_regs *regs, unsigned long error_code, · 640 unmodified lines
641641
642642 /* Are we prepared to handle this kernel fault? */
643643 if (fixup_exception(regs)) {
644+ /*
645+ * Any interrupt that takes a fault gets the fixup. This makes
646+ * the below recursive fault logic only apply to a faults from
647+ * task context.
648+ */
649+ if (in_interrupt())
650+ return;
651+
652+ /*
653+ * Per the above we're !in_interrupt(), aka. task context.
654+ *
655+ * In this case we need to make sure we're not recursively
656+ * faulting through the emulate_vsyscall() logic.
657+ */
644658 if (current_thread_info()->sig_on_uaccess_error && signal) {
645659 tsk->thread.trap_nr = X86_TRAP_PF;
646660 tsk->thread.error_code = error_code | PF_USER;
@@ -649,6 +663,10 @@ no_context(struct pt_regs *regs, unsigned long error_code, · 2 unmodified lines
649663 /* XXX: hwpoison faults will set the wrong code. */
650664 force_sig_info_fault(signal, si_code, address, tsk, 0);
651665 }
666+
667+ /*
668+ * Barring that, we can do the fixup and be happy.
669+ */
652670 return;
653671 }
654672
arch/x86/mm/gup.c+13−0
@@ -83,6 +83,12 @@ static noinline int gup_pte_range(pmd_t pmd, unsigned long addr, · 82 unmodified lines
8383 pte_t pte = gup_get_pte(ptep);
8484 struct page *page;
8585
86+ /* Similar to the PMD case, NUMA hinting must take slow path */
87+ if (pte_numa(pte)) {
88+ pte_unmap(ptep);
89+ return 0;
90+ }
91+
8692 if ((pte_flags(pte) & (mask | _PAGE_SPECIAL)) != mask) {
8793 pte_unmap(ptep);
8894 return 0;
@@ -167,6 +173,13 @@ static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end, · 78 unmodified lines
167173 if (pmd_none(pmd) || pmd_trans_splitting(pmd))
168174 return 0;
169175 if (unlikely(pmd_large(pmd))) {
176+ /*
177+ * NUMA hinting faults need to be handled in the GUP
178+ * slowpath for accounting purposes and so that they
179+ * can be serialised against THP migration.
180+ */
181+ if (pmd_numa(pmd))
182+ return 0;
170183 if (!gup_huge_pmd(pmd, addr, next, write, pages, nr))
171184 return 0;
172185 } else {
arch/x86/vdso/vclock_gettime.c+4−4
@@ -178,7 +178,7 @@ notrace static int __always_inline do_realtime(struct timespec *ts) · 177 unmodified lines
178178
179179 ts->tv_nsec = 0;
180180 do {
181− seq = read_seqcount_begin_no_lockdep(&gtod->seq);
181+ seq = raw_read_seqcount_begin(&gtod->seq);
182182 mode = gtod->clock.vclock_mode;
183183 ts->tv_sec = gtod->wall_time_sec;
184184 ns = gtod->wall_time_snsec;
@@ -198,7 +198,7 @@ notrace static int do_monotonic(struct timespec *ts) · 13 unmodified lines
198198
199199 ts->tv_nsec = 0;
200200 do {
201− seq = read_seqcount_begin_no_lockdep(&gtod->seq);
201+ seq = raw_read_seqcount_begin(&gtod->seq);
202202 mode = gtod->clock.vclock_mode;
203203 ts->tv_sec = gtod->monotonic_time_sec;
204204 ns = gtod->monotonic_time_snsec;
@@ -214,7 +214,7 @@ notrace static int do_realtime_coarse(struct timespec *ts) · 9 unmodified lines
214214 {
215215 unsigned long seq;
216216 do {
217− seq = read_seqcount_begin_no_lockdep(&gtod->seq);
217+ seq = raw_read_seqcount_begin(&gtod->seq);
218218 ts->tv_sec = gtod->wall_time_coarse.tv_sec;
219219 ts->tv_nsec = gtod->wall_time_coarse.tv_nsec;
220220 } while (unlikely(read_seqcount_retry(&gtod->seq, seq)));
@@ -225,7 +225,7 @@ notrace static int do_monotonic_coarse(struct timespec *ts) · 4 unmodified lines
225225 {
226226 unsigned long seq;
227227 do {
228− seq = read_seqcount_begin_no_lockdep(&gtod->seq);
228+ seq = raw_read_seqcount_begin(&gtod->seq);
229229 ts->tv_sec = gtod->monotonic_time_coarse.tv_sec;
230230 ts->tv_nsec = gtod->monotonic_time_coarse.tv_nsec;
231231 } while (unlikely(read_seqcount_retry(&gtod->seq, seq)));
block/blk-mq-sysfs.c+13−0
@@ -335,9 +335,22 @@ static struct kobj_type blk_mq_hw_ktype = { · 334 unmodified lines
335335 void blk_mq_unregister_disk(struct gendisk *disk)
336336 {
337337 struct request_queue *q = disk->queue;
338+ struct blk_mq_hw_ctx *hctx;
339+ struct blk_mq_ctx *ctx;
340+ int i, j;
341+
342+ queue_for_each_hw_ctx(q, hctx, i) {
343+ hctx_for_each_ctx(hctx, ctx, j) {
344+ kobject_del(&ctx->kobj);
345+ kobject_put(&ctx->kobj);
346+ }
347+ kobject_del(&hctx->kobj);
348+ kobject_put(&hctx->kobj);
349+ }
338350
339351 kobject_uevent(&q->mq_kobj, KOBJ_REMOVE);
340352 kobject_del(&q->mq_kobj);
353+ kobject_put(&q->mq_kobj);
341354
342355 kobject_put(&disk_to_dev(disk)->kobj);
343356 }
drivers/acpi/Kconfig+0−1
@@ -348,7 +348,6 @@ source "drivers/acpi/apei/Kconfig" · 347 unmodified lines
348348 config ACPI_EXTLOG
349349 tristate "Extended Error Log support"
350350 depends on X86_MCE && X86_LOCAL_APIC
351− select EFI
352351 select UEFI_CPER
353352 default n
354353 help
drivers/acpi/ac.c+2−2
@@ -207,7 +207,7 @@ static int acpi_ac_probe(struct platform_device *pdev) · 206 unmodified lines
207207 goto end;
208208
209209 result = acpi_install_notify_handler(ACPI_HANDLE(&pdev->dev),
210− ACPI_DEVICE_NOTIFY, acpi_ac_notify_handler, ac);
210+ ACPI_ALL_NOTIFY, acpi_ac_notify_handler, ac);
211211 if (result) {
212212 power_supply_unregister(&ac->charger);
213213 goto end;
@@ -255,7 +255,7 @@ static int acpi_ac_remove(struct platform_device *pdev) · 41 unmodified lines
255255 return -EINVAL;
256256
257257 acpi_remove_notify_handler(ACPI_HANDLE(&pdev->dev),
258− ACPI_DEVICE_NOTIFY, acpi_ac_notify_handler);
258+ ACPI_ALL_NOTIFY, acpi_ac_notify_handler);
259259
260260 ac = platform_get_drvdata(pdev);
261261 if (ac->charger.dev)
drivers/acpi/acpi_lpss.c+1−0
@@ -162,6 +162,7 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = { · 161 unmodified lines
162162 { "80860F14", (unsigned long)&byt_sdio_dev_desc },
163163 { "80860F41", (unsigned long)&byt_i2c_dev_desc },
164164 { "INT33B2", },
165+ { "INT33FC", },
165166
166167 { "INT3430", (unsigned long)&lpt_dev_desc },
167168 { "INT3431", (unsigned long)&lpt_dev_desc },
drivers/acpi/apei/Kconfig+0−1
@@ -2,7 +2,6 @@ config ACPI_APEI · 1 unmodified line
22 bool "ACPI Platform Error Interface (APEI)"
33 select MISC_FILESYSTEMS
44 select PSTORE
5− select EFI
65 select UEFI_CPER
76 depends on X86
87 help
drivers/acpi/apei/erst.c+1−0
@@ -942,6 +942,7 @@ static int erst_clearer(enum pstore_type_id type, u64 id, int count, · 941 unmodified lines
942942 static struct pstore_info erst_info = {
943943 .owner = THIS_MODULE,
944944 .name = "erst",
945+ .flags = PSTORE_FLAGS_FRAGILE,
945946 .open = erst_open_pstore,
946947 .close = erst_close_pstore,
947948 .read = erst_reader,
drivers/acpi/battery.c+21−1
@@ -62,6 +62,7 @@ MODULE_AUTHOR("Alexey Starikovskiy <astarikovskiy@suse.de>"); · 61 unmodified lines
6262 MODULE_DESCRIPTION("ACPI Battery Driver");
6363 MODULE_LICENSE("GPL");
6464
65+static int battery_bix_broken_package;
6566 static unsigned int cache_time = 1000;
6667 module_param(cache_time, uint, 0644);
6768 MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
@@ -416,7 +417,12 @@ static int acpi_battery_get_info(struct acpi_battery *battery) · 348 unmodified lines
416417 ACPI_EXCEPTION((AE_INFO, status, "Evaluating %s", name));
417418 return -ENODEV;
418419 }
419− if (test_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags))
420+
421+ if (battery_bix_broken_package)
422+ result = extract_package(battery, buffer.pointer,
423+ extended_info_offsets + 1,
424+ ARRAY_SIZE(extended_info_offsets) - 1);
425+ else if (test_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags))
420426 result = extract_package(battery, buffer.pointer,
421427 extended_info_offsets,
422428 ARRAY_SIZE(extended_info_offsets));
@@ -754,6 +760,17 @@ static int battery_notify(struct notifier_block *nb, · 331 unmodified lines
754760 return 0;
755761 }
756762
763+static struct dmi_system_id bat_dmi_table[] = {
764+ {
765+ .ident = "NEC LZ750/LS",
766+ .matches = {
767+ DMI_MATCH(DMI_SYS_VENDOR, "NEC"),
768+ DMI_MATCH(DMI_PRODUCT_NAME, "PC-LZ750LS"),
769+ },
770+ },
771+ {},
772+};
773+
757774 static int acpi_battery_add(struct acpi_device *device)
758775 {
759776 int result = 0;
@@ -846,6 +863,9 @@ static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie) · 86 unmodified lines
846863 {
847864 if (acpi_disabled)
848865 return;
866+
867+ if (dmi_check_system(bat_dmi_table))
868+ battery_bix_broken_package = 1;
849869 acpi_bus_register_driver(&acpi_battery_driver);
850870 }
851871
drivers/acpi/bus.c+10−0
@@ -156,6 +156,16 @@ int acpi_bus_get_private_data(acpi_handle handle, void **data) · 155 unmodified lines
156156 }
157157 EXPORT_SYMBOL(acpi_bus_get_private_data);
158158
159+void acpi_bus_no_hotplug(acpi_handle handle)
160+{
161+ struct acpi_device *adev = NULL;
162+
163+ acpi_bus_get_device(handle, &adev);
164+ if (adev)
165+ adev->flags.no_hotplug = true;
166+}
167+EXPORT_SYMBOL_GPL(acpi_bus_no_hotplug);
168+
159169 static void acpi_print_osc_error(acpi_handle handle,
160170 struct acpi_osc_context *context, char *error)
161171 {
drivers/ata/ahci.c+12−9
@@ -427,6 +427,9 @@ static const struct pci_device_id ahci_pci_tbl[] = { · 426 unmodified lines
427427 .driver_data = board_ahci_yes_fbs }, /* 88se9128 */
428428 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9125),
429429 .driver_data = board_ahci_yes_fbs }, /* 88se9125 */
430+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_MARVELL_EXT, 0x9178,
431+ PCI_VENDOR_ID_MARVELL_EXT, 0x9170),
432+ .driver_data = board_ahci_yes_fbs }, /* 88se9170 */
430433 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x917a),
431434 .driver_data = board_ahci_yes_fbs }, /* 88se9172 */
432435 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9172),
@@ -1238,15 +1241,6 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 805 unmodified lines
12381241 if (rc)
12391242 return rc;
12401243
1241− /* AHCI controllers often implement SFF compatible interface.
1242− * Grab all PCI BARs just in case.
1243− */
1244− rc = pcim_iomap_regions_request_all(pdev, 1 << ahci_pci_bar, DRV_NAME);
1245− if (rc == -EBUSY)
1246− pcim_pin_device(pdev);
1247− if (rc)
1248− return rc;
1249−
12501244 if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
12511245 (pdev->device == 0x2652 || pdev->device == 0x2653)) {
12521246 u8 map;
@@ -1263,6 +1257,15 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 10 unmodified lines
12631257 }
12641258 }
12651259
1260+ /* AHCI controllers often implement SFF compatible interface.
1261+ * Grab all PCI BARs just in case.
1262+ */
1263+ rc = pcim_iomap_regions_request_all(pdev, 1 << ahci_pci_bar, DRV_NAME);
1264+ if (rc == -EBUSY)
1265+ pcim_pin_device(pdev);
1266+ if (rc)
1267+ return rc;
1268+
12661269 hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL);
12671270 if (!hpriv)
12681271 return -ENOMEM;
drivers/ata/ahci_imx.c+2−1
@@ -113,7 +113,7 @@ static int imx6q_sata_init(struct device *dev, void __iomem *mmio) · 112 unmodified lines
113113 /*
114114 * set PHY Paremeters, two steps to configure the GPR13,
115115 * one write for rest of parameters, mask of first write
116− * is 0x07fffffd, and the other one write for setting
116+ * is 0x07ffffff, and the other one write for setting
117117 * the mpll_clk_en.
118118 */
119119 regmap_update_bits(imxpriv->gpr, 0x34, IMX6Q_GPR13_SATA_RX_EQ_VAL_MASK
@@ -124,6 +124,7 @@ static int imx6q_sata_init(struct device *dev, void __iomem *mmio) · 4 unmodified lines
124124 | IMX6Q_GPR13_SATA_TX_ATTEN_MASK
125125 | IMX6Q_GPR13_SATA_TX_BOOST_MASK
126126 | IMX6Q_GPR13_SATA_TX_LVL_MASK
127+ | IMX6Q_GPR13_SATA_MPLL_CLK_EN
127128 | IMX6Q_GPR13_SATA_TX_EDGE_RATE
128129 , IMX6Q_GPR13_SATA_RX_EQ_VAL_3_0_DB
129130 | IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA2M
drivers/ata/libata-core.c+17−2
@@ -2149,9 +2149,16 @@ static int ata_dev_config_ncq(struct ata_device *dev, · 2148 unmodified lines
21492149 "failed to get NCQ Send/Recv Log Emask 0x%x\n",
21502150 err_mask);
21512151 } else {
2152+ u8 *cmds = dev->ncq_send_recv_cmds;
2153+
21522154 dev->flags |= ATA_DFLAG_NCQ_SEND_RECV;
2153− memcpy(dev->ncq_send_recv_cmds, ap->sector_buf,
2154− ATA_LOG_NCQ_SEND_RECV_SIZE);
2155+ memcpy(cmds, ap->sector_buf, ATA_LOG_NCQ_SEND_RECV_SIZE);
2156+
2157+ if (dev->horkage & ATA_HORKAGE_NO_NCQ_TRIM) {
2158+ ata_dev_dbg(dev, "disabling queued TRIM support\n");
2159+ cmds[ATA_LOG_NCQ_SEND_RECV_DSM_OFFSET] &=
2160+ ~ATA_LOG_NCQ_SEND_RECV_DSM_TRIM;
2161+ }
21552162 }
21562163 }
21572164
@@ -4156,6 +4163,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { · 1998 unmodified lines
41564163 { "ST3320[68]13AS", "SD1[5-9]", ATA_HORKAGE_NONCQ |
41574164 ATA_HORKAGE_FIRMWARE_WARN },
41584165
4166+ /* Seagate Momentus SpinPoint M8 seem to have FPMDA_AA issues */
4167+ { "ST1000LM024 HN-M101MBB", "2AR10001", ATA_HORKAGE_BROKEN_FPDMA_AA },
4168+
41594169 /* Blacklist entries taken from Silicon Image 3124/3132
41604170 Windows driver .inf file - also several Linux problem reports */
41614171 { "HTS541060G9SA00", "MB3OC60D", ATA_HORKAGE_NONCQ, },
@@ -4202,6 +4212,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { · 40 unmodified lines
42024212 { "PIONEER DVD-RW DVR-212D", NULL, ATA_HORKAGE_NOSETXFER },
42034213 { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER },
42044214
4215+ /* devices that don't properly handle queued TRIM commands */
4216+ { "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, },
4217+ { "Crucial_CT???M500SSD1", NULL, ATA_HORKAGE_NO_NCQ_TRIM, },
4218+
42054219 /* End Marker */
42064220 { }
42074221 };
@@ -6519,6 +6533,7 @@ static int __init ata_parse_force_one(char **cur, · 2311 unmodified lines
65196533 { "norst", .lflags = ATA_LFLAG_NO_HRST | ATA_LFLAG_NO_SRST },
65206534 { "rstonce", .lflags = ATA_LFLAG_RST_ONCE },
65216535 { "atapi_dmadir", .horkage_on = ATA_HORKAGE_ATAPI_DMADIR },
6536+ { "disable", .horkage_on = ATA_HORKAGE_DISABLE },
65226537 };
65236538 char *start = *cur, *p = *cur;
65246539 char *id, *val, *endp;
drivers/ata/libata-scsi.c+21−0
@@ -3872,6 +3872,27 @@ void ata_scsi_hotplug(struct work_struct *work) · 3871 unmodified lines
38723872 return;
38733873 }
38743874
3875+ /*
3876+ * XXX - UGLY HACK
3877+ *
3878+ * The block layer suspend/resume path is fundamentally broken due
3879+ * to freezable kthreads and workqueue and may deadlock if a block
3880+ * device gets removed while resume is in progress. I don't know
3881+ * what the solution is short of removing freezable kthreads and
3882+ * workqueues altogether.
3883+ *
3884+ * The following is an ugly hack to avoid kicking off device
3885+ * removal while freezer is active. This is a joke but does avoid
3886+ * this particular deadlock scenario.
3887+ *
3888+ * https://bugzilla.kernel.org/show_bug.cgi?id=62801
3889+ * http://marc.info/?l=linux-kernel&m=138695698516487
3890+ */
3891+#ifdef CONFIG_FREEZER
3892+ while (pm_freezing)
3893+ msleep(10);
3894+#endif
3895+
38753896 DPRINTK("ENTER\n");
38763897 mutex_lock(&ap->scsi_scan_mutex);
38773898
drivers/ata/sata_sis.c+4−0
@@ -83,6 +83,10 @@ static struct pci_driver sis_pci_driver = { · 82 unmodified lines
8383 .id_table = sis_pci_tbl,
8484 .probe = sis_init_one,
8585 .remove = ata_pci_remove_one,
86+#ifdef CONFIG_PM
87+ .suspend = ata_pci_device_suspend,
88+ .resume = ata_pci_device_resume,
89+#endif
8690 };
8791
8892 static struct scsi_host_template sis_sht = {
drivers/block/null_blk.c+78−34
@@ -1,4 +1,5 @@
11 #include <linux/module.h>
2+
23 #include <linux/moduleparam.h>
34 #include <linux/sched.h>
45 #include <linux/fs.h>
@@ -65,7 +66,7 @@ enum { · 60 unmodified lines
6566 NULL_Q_MQ = 2,
6667 };
6768
68−static int submit_queues = 1;
69+static int submit_queues;
6970 module_param(submit_queues, int, S_IRUGO);
7071 MODULE_PARM_DESC(submit_queues, "Number of submission queues");
7172
@@ -101,9 +102,9 @@ static int hw_queue_depth = 64; · 29 unmodified lines
101102 module_param(hw_queue_depth, int, S_IRUGO);
102103 MODULE_PARM_DESC(hw_queue_depth, "Queue depth for each hardware queue. Default: 64");
103104
104−static bool use_per_node_hctx = true;
105+static bool use_per_node_hctx = false;
105106 module_param(use_per_node_hctx, bool, S_IRUGO);
106−MODULE_PARM_DESC(use_per_node_hctx, "Use per-node allocation for hardware context queues. Default: true");
107+MODULE_PARM_DESC(use_per_node_hctx, "Use per-node allocation for hardware context queues. Default: false");
107108
108109 static void put_tag(struct nullb_queue *nq, unsigned int tag)
109110 {
@@ -346,8 +347,37 @@ static int null_queue_rq(struct blk_mq_hw_ctx *hctx, struct request *rq) · 236 unmodified lines
346347
347348 static struct blk_mq_hw_ctx *null_alloc_hctx(struct blk_mq_reg *reg, unsigned int hctx_index)
348349 {
349− return kzalloc_node(sizeof(struct blk_mq_hw_ctx), GFP_KERNEL,
350− hctx_index);
350+ int b_size = DIV_ROUND_UP(reg->nr_hw_queues, nr_online_nodes);
351+ int tip = (reg->nr_hw_queues % nr_online_nodes);
352+ int node = 0, i, n;
353+
354+ /*
355+ * Split submit queues evenly wrt to the number of nodes. If uneven,
356+ * fill the first buckets with one extra, until the rest is filled with
357+ * no extra.
358+ */
359+ for (i = 0, n = 1; i < hctx_index; i++, n++) {
360+ if (n % b_size == 0) {
361+ n = 0;
362+ node++;
363+
364+ tip--;
365+ if (!tip)
366+ b_size = reg->nr_hw_queues / nr_online_nodes;
367+ }
368+ }
369+
370+ /*
371+ * A node might not be online, therefore map the relative node id to the
372+ * real node id.
373+ */
374+ for_each_online_node(n) {
375+ if (!node)
376+ break;
377+ node--;
378+ }
379+
380+ return kzalloc_node(sizeof(struct blk_mq_hw_ctx), GFP_KERNEL, n);
351381 }
352382
353383 static void null_free_hctx(struct blk_mq_hw_ctx *hctx, unsigned int hctx_index)
@@ -355,16 +385,24 @@ static void null_free_hctx(struct blk_mq_hw_ctx *hctx, unsigned int hctx_index) · 1 unmodified line
355385 kfree(hctx);
356386 }
357387
388+static void null_init_queue(struct nullb *nullb, struct nullb_queue *nq)
389+{
390+ BUG_ON(!nullb);
391+ BUG_ON(!nq);
392+
393+ init_waitqueue_head(&nq->wait);
394+ nq->queue_depth = nullb->queue_depth;
395+}
396+
358397 static int null_init_hctx(struct blk_mq_hw_ctx *hctx, void *data,
359398 unsigned int index)
360399 {
361400 struct nullb *nullb = data;
362401 struct nullb_queue *nq = &nullb->queues[index];
363402
364− init_waitqueue_head(&nq->wait);
365− nq->queue_depth = nullb->queue_depth;
366− nullb->nr_queues++;
367403 hctx->driver_data = nq;
404+ null_init_queue(nullb, nq);
405+ nullb->nr_queues++;
368406
369407 return 0;
370408 }
@@ -387,10 +425,7 @@ static void null_del_dev(struct nullb *nullb) · 16 unmodified lines
387425 list_del_init(&nullb->list);
388426
389427 del_gendisk(nullb->disk);
390− if (queue_mode == NULL_Q_MQ)
391− blk_mq_free_queue(nullb->q);
392− else
393− blk_cleanup_queue(nullb->q);
428+ blk_cleanup_queue(nullb->q);
394429 put_disk(nullb->disk);
395430 kfree(nullb);
396431 }
@@ -417,13 +452,13 @@ static int setup_commands(struct nullb_queue *nq) · 20 unmodified lines
417452
418453 nq->cmds = kzalloc(nq->queue_depth * sizeof(*cmd), GFP_KERNEL);
419454 if (!nq->cmds)
420− return 1;
455+ return -ENOMEM;
421456
422457 tag_size = ALIGN(nq->queue_depth, BITS_PER_LONG) / BITS_PER_LONG;
423458 nq->tag_map = kzalloc(tag_size * sizeof(unsigned long), GFP_KERNEL);
424459 if (!nq->tag_map) {
425460 kfree(nq->cmds);
426− return 1;
461+ return -ENOMEM;
427462 }
428463
429464 for (i = 0; i < nq->queue_depth; i++) {
@@ -454,33 +489,37 @@ static void cleanup_queues(struct nullb *nullb) · 24 unmodified lines
454489
455490 static int setup_queues(struct nullb *nullb)
456491 {
457− struct nullb_queue *nq;
458− int i;
459−
460− nullb->queues = kzalloc(submit_queues * sizeof(*nq), GFP_KERNEL);
492+ nullb->queues = kzalloc(submit_queues * sizeof(struct nullb_queue),
493+ GFP_KERNEL);
461494 if (!nullb->queues)
462− return 1;
495+ return -ENOMEM;
463496
464497 nullb->nr_queues = 0;
465498 nullb->queue_depth = hw_queue_depth;
466499
467− if (queue_mode == NULL_Q_MQ)
468− return 0;
500+ return 0;
501+}
502+
503+static int init_driver_queues(struct nullb *nullb)
504+{
505+ struct nullb_queue *nq;
506+ int i, ret = 0;
469507
470508 for (i = 0; i < submit_queues; i++) {
471509 nq = &nullb->queues[i];
472− init_waitqueue_head(&nq->wait);
473− nq->queue_depth = hw_queue_depth;
474− if (setup_commands(nq))
475− break;
510+
511+ null_init_queue(nullb, nq);
512+
513+ ret = setup_commands(nq);
514+ if (ret)
515+ goto err_queue;
476516 nullb->nr_queues++;
477517 }
478518
479− if (i == submit_queues)
480− return 0;
481−
519+ return 0;
520+err_queue:
482521 cleanup_queues(nullb);
483− return 1;
522+ return ret;
484523 }
485524
486525 static int null_add_dev(void)
@@ -518,11 +557,13 @@ static int null_add_dev(void) · 31 unmodified lines
518557 } else if (queue_mode == NULL_Q_BIO) {
519558 nullb->q = blk_alloc_queue_node(GFP_KERNEL, home_node);
520559 blk_queue_make_request(nullb->q, null_queue_bio);
560+ init_driver_queues(nullb);
521561 } else {
522562 nullb->q = blk_init_queue_node(null_request_fn, &nullb->lock, home_node);
523563 blk_queue_prep_rq(nullb->q, null_rq_prep_fn);
524564 if (nullb->q)
525565 blk_queue_softirq_done(nullb->q, null_softirq_done_fn);
566+ init_driver_queues(nullb);
526567 }
527568
528569 if (!nullb->q)
@@ -534,10 +575,7 @@ static int null_add_dev(void) · 5 unmodified lines
534575 disk = nullb->disk = alloc_disk_node(1, home_node);
535576 if (!disk) {
536577 queue_fail:
537− if (queue_mode == NULL_Q_MQ)
538− blk_mq_free_queue(nullb->q);
539− else
540− blk_cleanup_queue(nullb->q);
578+ blk_cleanup_queue(nullb->q);
541579 cleanup_queues(nullb);
542580 err:
543581 kfree(nullb);
@@ -579,7 +617,13 @@ static int __init null_init(void) · 35 unmodified lines
579617 }
580618 #endif
581619
582− if (submit_queues > nr_cpu_ids)
620+ if (queue_mode == NULL_Q_MQ && use_per_node_hctx) {
621+ if (submit_queues < nr_online_nodes) {
622+ pr_warn("null_blk: submit_queues param is set to %u.",
623+ nr_online_nodes);
624+ submit_queues = nr_online_nodes;
625+ }
626+ } else if (submit_queues > nr_cpu_ids)
583627 submit_queues = nr_cpu_ids;
584628 else if (!submit_queues)
585629 submit_queues = 1;
drivers/block/skd_main.c+2−2
@@ -5269,7 +5269,7 @@ const char *skd_skdev_state_to_str(enum skd_drvr_state state) · 5268 unmodified lines
52695269 }
52705270 }
52715271
5272−const char *skd_skmsg_state_to_str(enum skd_fit_msg_state state)
5272+static const char *skd_skmsg_state_to_str(enum skd_fit_msg_state state)
52735273 {
52745274 switch (state) {
52755275 case SKD_MSG_STATE_IDLE:
@@ -5281,7 +5281,7 @@ const char *skd_skmsg_state_to_str(enum skd_fit_msg_state state) · 5 unmodified lines
52815281 }
52825282 }
52835283
5284−const char *skd_skreq_state_to_str(enum skd_req_state state)
5284+static const char *skd_skreq_state_to_str(enum skd_req_state state)
52855285 {
52865286 switch (state) {
52875287 case SKD_REQ_STATE_IDLE:
drivers/bluetooth/ath3k.c+2−0
@@ -87,6 +87,7 @@ static const struct usb_device_id ath3k_table[] = { · 86 unmodified lines
8787 { USB_DEVICE(0x0CF3, 0xE004) },
8888 { USB_DEVICE(0x0CF3, 0xE005) },
8989 { USB_DEVICE(0x0930, 0x0219) },
90+ { USB_DEVICE(0x0930, 0x0220) },
9091 { USB_DEVICE(0x0489, 0xe057) },
9192 { USB_DEVICE(0x13d3, 0x3393) },
9293 { USB_DEVICE(0x0489, 0xe04e) },
@@ -129,6 +130,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = { · 36 unmodified lines
129130 { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 },
130131 { USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 },
131132 { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 },
133+ { USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 },
132134 { USB_DEVICE(0x0489, 0xe057), .driver_info = BTUSB_ATH3012 },
133135 { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 },
134136 { USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 },
drivers/bluetooth/btusb.c+1−0
@@ -154,6 +154,7 @@ static const struct usb_device_id blacklist_table[] = { · 153 unmodified lines
154154 { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 },
155155 { USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 },
156156 { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 },
157+ { USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 },
157158 { USB_DEVICE(0x0489, 0xe057), .driver_info = BTUSB_ATH3012 },
158159 { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 },
159160 { USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 },
drivers/char/tpm/tpm_ppi.c+9−6
@@ -27,15 +27,18 @@ static char *tpm_device_name = "TPM"; · 26 unmodified lines
2727 static acpi_status ppi_callback(acpi_handle handle, u32 level, void *context,
2828 void **return_value)
2929 {
30− acpi_status status;
30+ acpi_status status = AE_OK;
3131 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
32− status = acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
33− if (strstr(buffer.pointer, context) != NULL) {
34− *return_value = handle;
32+
33+ if (ACPI_SUCCESS(acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer))) {
34+ if (strstr(buffer.pointer, context) != NULL) {
35+ *return_value = handle;
36+ status = AE_CTRL_TERMINATE;
37+ }
3538 kfree(buffer.pointer);
36− return AE_CTRL_TERMINATE;
3739 }
38− return AE_OK;
40+
41+ return status;
3942 }
4043
4144 static inline void ppi_assign_params(union acpi_object params[4],
drivers/clk/clk-divider.c+1−1
@@ -87,7 +87,7 @@ static unsigned int _get_table_val(const struct clk_div_table *table, · 86 unmodified lines
8787 return 0;
8888 }
8989
90−static unsigned int _get_val(struct clk_divider *divider, u8 div)
90+static unsigned int _get_val(struct clk_divider *divider, unsigned int div)
9191 {
9292 if (divider->flags & CLK_DIVIDER_ONE_BASED)
9393 return div;
drivers/clk/clk-s2mps11.c+3−3
@@ -60,7 +60,7 @@ static int s2mps11_clk_prepare(struct clk_hw *hw) · 59 unmodified lines
6060 struct s2mps11_clk *s2mps11 = to_s2mps11_clk(hw);
6161 int ret;
6262
63− ret = regmap_update_bits(s2mps11->iodev->regmap,
63+ ret = regmap_update_bits(s2mps11->iodev->regmap_pmic,
6464 S2MPS11_REG_RTC_CTRL,
6565 s2mps11->mask, s2mps11->mask);
6666 if (!ret)
@@ -74,7 +74,7 @@ static void s2mps11_clk_unprepare(struct clk_hw *hw) · 7 unmodified lines
7474 struct s2mps11_clk *s2mps11 = to_s2mps11_clk(hw);
7575 int ret;
7676
77− ret = regmap_update_bits(s2mps11->iodev->regmap, S2MPS11_REG_RTC_CTRL,
77+ ret = regmap_update_bits(s2mps11->iodev->regmap_pmic, S2MPS11_REG_RTC_CTRL,
7878 s2mps11->mask, ~s2mps11->mask);
7979
8080 if (!ret)
@@ -174,7 +174,7 @@ static int s2mps11_clk_probe(struct platform_device *pdev) · 93 unmodified lines
174174 s2mps11_clk->hw.init = &s2mps11_clks_init[i];
175175 s2mps11_clk->mask = 1 << i;
176176
177− ret = regmap_read(s2mps11_clk->iodev->regmap,
177+ ret = regmap_read(s2mps11_clk->iodev->regmap_pmic,
178178 S2MPS11_REG_RTC_CTRL, &val);
179179 if (ret < 0)
180180 goto err_reg;
drivers/clk/samsung/clk-exynos-audss.c+5−5
@@ -26,17 +26,17 @@ static struct clk_onecell_data clk_data; · 25 unmodified lines
2626 #define ASS_CLK_DIV 0x4
2727 #define ASS_CLK_GATE 0x8
2828
29+/* list of all parent clock list */
30+static const char *mout_audss_p[] = { "fin_pll", "fout_epll" };
31+static const char *mout_i2s_p[] = { "mout_audss", "cdclk0", "sclk_audio0" };
32+
33+#ifdef CONFIG_PM_SLEEP
2934 static unsigned long reg_save[][2] = {
3035 {ASS_CLK_SRC, 0},
3136 {ASS_CLK_DIV, 0},
3237 {ASS_CLK_GATE, 0},
3338 };
3439
35−/* list of all parent clock list */
36−static const char *mout_audss_p[] = { "fin_pll", "fout_epll" };
37−static const char *mout_i2s_p[] = { "mout_audss", "cdclk0", "sclk_audio0" };
38−
39−#ifdef CONFIG_PM_SLEEP
4040 static int exynos_audss_clk_suspend(void)
4141 {
4242 int i;
drivers/clk/samsung/clk-exynos4.c+1−1
@@ -39,7 +39,7 @@ · 38 unmodified lines
3939 #define SRC_TOP1 0xc214
4040 #define SRC_CAM 0xc220
4141 #define SRC_TV 0xc224
42−#define SRC_MFC 0xcc28
42+#define SRC_MFC 0xc228
4343 #define SRC_G3D 0xc22c
4444 #define E4210_SRC_IMAGE 0xc230
4545 #define SRC_LCD0 0xc234
drivers/clk/samsung/clk-exynos5250.c+9−5
@@ -25,6 +25,7 @@ · 24 unmodified lines
2525 #define MPLL_LOCK 0x4000
2626 #define MPLL_CON0 0x4100
2727 #define SRC_CORE1 0x4204
28+#define GATE_IP_ACP 0x8800
2829 #define CPLL_LOCK 0x10020
2930 #define EPLL_LOCK 0x10030
3031 #define VPLL_LOCK 0x10040
@@ -75,7 +76,6 @@ · 44 unmodified lines
7576 #define SRC_CDREX 0x20200
7677 #define PLL_DIV2_SEL 0x20a24
7778 #define GATE_IP_DISP1 0x10928
78−#define GATE_IP_ACP 0x10000
7979
8080 /* list of PLLs to be registered */
8181 enum exynos5250_plls {
@@ -120,7 +120,8 @@ enum exynos5250_clks { · 38 unmodified lines
120120 spi2, i2s1, i2s2, pcm1, pcm2, pwm, spdif, ac97, hsi2c0, hsi2c1, hsi2c2,
121121 hsi2c3, chipid, sysreg, pmu, cmu_top, cmu_core, cmu_mem, tzpc0, tzpc1,
122122 tzpc2, tzpc3, tzpc4, tzpc5, tzpc6, tzpc7, tzpc8, tzpc9, hdmi_cec, mct,
123− wdt, rtc, tmu, fimd1, mie1, dsim0, dp, mixer, hdmi, g2d,
123+ wdt, rtc, tmu, fimd1, mie1, dsim0, dp, mixer, hdmi, g2d, mdma0,
124+ smmu_mdma0,
124125
125126 /* mux clocks */
126127 mout_hdmi = 1024,
@@ -354,8 +355,8 @@ static struct samsung_gate_clock exynos5250_gate_clks[] __initdata = { · 227 unmodified lines
354355 GATE(smmu_gscl2, "smmu_gscl2", "aclk266", GATE_IP_GSCL, 9, 0, 0),
355356 GATE(smmu_gscl3, "smmu_gscl3", "aclk266", GATE_IP_GSCL, 10, 0, 0),
356357 GATE(mfc, "mfc", "aclk333", GATE_IP_MFC, 0, 0, 0),
357− GATE(smmu_mfcl, "smmu_mfcl", "aclk333", GATE_IP_MFC, 1, 0, 0),
358− GATE(smmu_mfcr, "smmu_mfcr", "aclk333", GATE_IP_MFC, 2, 0, 0),
358+ GATE(smmu_mfcl, "smmu_mfcl", "aclk333", GATE_IP_MFC, 2, 0, 0),
359+ GATE(smmu_mfcr, "smmu_mfcr", "aclk333", GATE_IP_MFC, 1, 0, 0),
359360 GATE(rotator, "rotator", "aclk266", GATE_IP_GEN, 1, 0, 0),
360361 GATE(jpeg, "jpeg", "aclk166", GATE_IP_GEN, 2, 0, 0),
361362 GATE(mdma1, "mdma1", "aclk266", GATE_IP_GEN, 4, 0, 0),
@@ -406,7 +407,8 @@ static struct samsung_gate_clock exynos5250_gate_clks[] __initdata = { · 44 unmodified lines
406407 GATE(hsi2c2, "hsi2c2", "aclk66", GATE_IP_PERIC, 30, 0, 0),
407408 GATE(hsi2c3, "hsi2c3", "aclk66", GATE_IP_PERIC, 31, 0, 0),
408409 GATE(chipid, "chipid", "aclk66", GATE_IP_PERIS, 0, 0, 0),
409− GATE(sysreg, "sysreg", "aclk66", GATE_IP_PERIS, 1, 0, 0),
410+ GATE(sysreg, "sysreg", "aclk66",
411+ GATE_IP_PERIS, 1, CLK_IGNORE_UNUSED, 0),
410412 GATE(pmu, "pmu", "aclk66", GATE_IP_PERIS, 2, CLK_IGNORE_UNUSED, 0),
411413 GATE(tzpc0, "tzpc0", "aclk66", GATE_IP_PERIS, 6, 0, 0),
412414 GATE(tzpc1, "tzpc1", "aclk66", GATE_IP_PERIS, 7, 0, 0),
@@ -492,6 +494,8 @@ static struct samsung_gate_clock exynos5250_gate_clks[] __initdata = { · 79 unmodified lines
492494 GATE(mixer, "mixer", "mout_aclk200_disp1", GATE_IP_DISP1, 5, 0, 0),
493495 GATE(hdmi, "hdmi", "mout_aclk200_disp1", GATE_IP_DISP1, 6, 0, 0),
494496 GATE(g2d, "g2d", "aclk200", GATE_IP_ACP, 3, 0, 0),
497+ GATE(mdma0, "mdma0", "aclk266", GATE_IP_ACP, 1, 0, 0),
498+ GATE(smmu_mdma0, "smmu_mdma0", "aclk266", GATE_IP_ACP, 5, 0, 0),
495499 };
496500
497501 static struct samsung_pll_rate_table vpll_24mhz_tbl[] __initdata = {
drivers/clocksource/Kconfig+1−0
@@ -75,6 +75,7 @@ config CLKSRC_DBX500_PRCMU_SCHED_CLOCK · 74 unmodified lines
7575 config CLKSRC_EFM32
7676 bool "Clocksource for Energy Micro's EFM32 SoCs" if !ARCH_EFM32
7777 depends on OF && ARM && (ARCH_EFM32 || COMPILE_TEST)
78+ select CLKSRC_MMIO
7879 default ARCH_EFM32
7980 help
8081 Support to use the timers of EFM32 SoCs as clock source and clock
drivers/clocksource/cadence_ttc_timer.c+13−8
@@ -67,11 +67,13 @@ · 66 unmodified lines
6767 * struct ttc_timer - This definition defines local timer structure
6868 *
6969 * @base_addr: Base address of timer
70+ * @freq: Timer input clock frequency
7071 * @clk: Associated clock source
7172 * @clk_rate_change_nb Notifier block for clock rate changes
7273 */
7374 struct ttc_timer {
7475 void __iomem *base_addr;
76+ unsigned long freq;
7577 struct clk *clk;
7678 struct notifier_block clk_rate_change_nb;
7779 };
@@ -196,9 +198,8 @@ static void ttc_set_mode(enum clock_event_mode mode, · 118 unmodified lines
196198
197199 switch (mode) {
198200 case CLOCK_EVT_MODE_PERIODIC:
199− ttc_set_interval(timer,
200− DIV_ROUND_CLOSEST(clk_get_rate(ttce->ttc.clk),
201− PRESCALE * HZ));
201+ ttc_set_interval(timer, DIV_ROUND_CLOSEST(ttce->ttc.freq,
202+ PRESCALE * HZ));
202203 break;
203204 case CLOCK_EVT_MODE_ONESHOT:
204205 case CLOCK_EVT_MODE_UNUSED:
@@ -273,6 +274,8 @@ static void __init ttc_setup_clocksource(struct clk *clk, void __iomem *base) · 68 unmodified lines
273274 return;
274275 }
275276
277+ ttccs->ttc.freq = clk_get_rate(ttccs->ttc.clk);
278+
276279 ttccs->ttc.clk_rate_change_nb.notifier_call =
277280 ttc_rate_change_clocksource_cb;
278281 ttccs->ttc.clk_rate_change_nb.next = NULL;
@@ -298,16 +301,14 @@ static void __init ttc_setup_clocksource(struct clk *clk, void __iomem *base) · 19 unmodified lines
298301 __raw_writel(CNT_CNTRL_RESET,
299302 ttccs->ttc.base_addr + TTC_CNT_CNTRL_OFFSET);
300303
301− err = clocksource_register_hz(&ttccs->cs,
302− clk_get_rate(ttccs->ttc.clk) / PRESCALE);
304+ err = clocksource_register_hz(&ttccs->cs, ttccs->ttc.freq / PRESCALE);
303305 if (WARN_ON(err)) {
304306 kfree(ttccs);
305307 return;
306308 }
307309
308310 ttc_sched_clock_val_reg = base + TTC_COUNT_VAL_OFFSET;
309− setup_sched_clock(ttc_sched_clock_read, 16,
310− clk_get_rate(ttccs->ttc.clk) / PRESCALE);
311+ setup_sched_clock(ttc_sched_clock_read, 16, ttccs->ttc.freq / PRESCALE);
311312 }
312313
313314 static int ttc_rate_change_clockevent_cb(struct notifier_block *nb,
@@ -334,6 +335,9 @@ static int ttc_rate_change_clockevent_cb(struct notifier_block *nb, · 20 unmodified lines
334335 ndata->new_rate / PRESCALE);
335336 local_irq_restore(flags);
336337
338+ /* update cached frequency */
339+ ttc->freq = ndata->new_rate;
340+
337341 /* fall through */
338342 }
339343 case PRE_RATE_CHANGE:
@@ -367,6 +371,7 @@ static void __init ttc_setup_clockevent(struct clk *clk, · 27 unmodified lines
367371 if (clk_notifier_register(ttcce->ttc.clk,
368372 &ttcce->ttc.clk_rate_change_nb))
369373 pr_warn("Unable to register clock notifier.\n");
374+ ttcce->ttc.freq = clk_get_rate(ttcce->ttc.clk);
370375
371376 ttcce->ttc.base_addr = base;
372377 ttcce->ce.name = "ttc_clockevent";
@@ -396,7 +401,7 @@ static void __init ttc_setup_clockevent(struct clk *clk, · 23 unmodified lines
396401 }
397402
398403 clockevents_config_and_register(&ttcce->ce,
399− clk_get_rate(ttcce->ttc.clk) / PRESCALE, 1, 0xfffe);
404+ ttcce->ttc.freq / PRESCALE, 1, 0xfffe);
400405 }
401406
402407 /**
drivers/clocksource/clksrc-of.c+0−1
@@ -35,6 +35,5 @@ void __init clocksource_of_init(void) · 34 unmodified lines
3535
3636 init_func = match->data;
3737 init_func(np);
38− of_node_put(np);
3938 }
4039 }
drivers/clocksource/dw_apb_timer_of.c+4−3
@@ -108,12 +108,11 @@ static void __init add_clocksource(struct device_node *source_timer) · 107 unmodified lines
108108
109109 static u64 read_sched_clock(void)
110110 {
111− return __raw_readl(sched_io_base);
111+ return ~__raw_readl(sched_io_base);
112112 }
113113
114114 static const struct of_device_id sptimer_ids[] __initconst = {
115115 { .compatible = "picochip,pc3x2-rtc" },
116− { .compatible = "snps,dw-apb-timer-sp" },
117116 { /* Sentinel */ },
118117 };
119118
@@ -151,4 +150,6 @@ static void __init dw_apb_timer_init(struct device_node *timer) · 31 unmodified lines
151150 num_called++;
152151 }
153152 CLOCKSOURCE_OF_DECLARE(pc3x2_timer, "picochip,pc3x2-timer", dw_apb_timer_init);
154−CLOCKSOURCE_OF_DECLARE(apb_timer, "snps,dw-apb-timer-osc", dw_apb_timer_init);
153+CLOCKSOURCE_OF_DECLARE(apb_timer_osc, "snps,dw-apb-timer-osc", dw_apb_timer_init);
154+CLOCKSOURCE_OF_DECLARE(apb_timer_sp, "snps,dw-apb-timer-sp", dw_apb_timer_init);
155+CLOCKSOURCE_OF_DECLARE(apb_timer, "snps,dw-apb-timer", dw_apb_timer_init);
drivers/clocksource/sun4i_timer.c+3−0
@@ -179,6 +179,9 @@ static void __init sun4i_timer_init(struct device_node *node) · 178 unmodified lines
179179 writel(TIMER_CTL_CLK_SRC(TIMER_CTL_CLK_SRC_OSC24M),
180180 timer_base + TIMER_CTL_REG(0));
181181
182+ /* Make sure timer is stopped before playing with interrupts */
183+ sun4i_clkevt_time_stop(0);
184+
182185 ret = setup_irq(irq, &sun4i_timer_irq);
183186 if (ret)
184187 pr_warn("failed to setup irq %d\n", irq);
drivers/clocksource/time-armada-370-xp.c+5−5
@@ -255,11 +255,6 @@ static void __init armada_370_xp_timer_common_init(struct device_node *np) · 254 unmodified lines
255255
256256 ticks_per_jiffy = (timer_clk + HZ / 2) / HZ;
257257
258− /*
259− * Set scale and timer for sched_clock.
260− */
261− sched_clock_register(armada_370_xp_read_sched_clock, 32, timer_clk);
262−
263258 /*
264259 * Setup free-running clocksource timer (interrupts
265260 * disabled).
@@ -270,6 +265,11 @@ static void __init armada_370_xp_timer_common_init(struct device_node *np) · 4 unmodified lines
270265 timer_ctrl_clrset(0, TIMER0_EN | TIMER0_RELOAD_EN |
271266 TIMER0_DIV(TIMER_DIVIDER_SHIFT));
272267
268+ /*
269+ * Set scale and timer for sched_clock.
270+ */
271+ sched_clock_register(armada_370_xp_read_sched_clock, 32, timer_clk);
272+
273273 clocksource_mmio_init(timer_base + TIMER0_VAL_OFF,
274274 "armada_370_xp_clocksource",
275275 timer_clk, 300, 32, clocksource_mmio_readl_down);
drivers/cpufreq/cpufreq.c+59−45
@@ -828,14 +828,17 @@ static void cpufreq_init_policy(struct cpufreq_policy *policy) · 827 unmodified lines
828828 int ret = 0;
829829
830830 memcpy(&new_policy, policy, sizeof(*policy));
831+
832+ /* Use the default policy if its valid. */
833+ if (cpufreq_driver->setpolicy)
834+ cpufreq_parse_governor(policy->governor->name,
835+ &new_policy.policy, NULL);
836+
831837 /* assure that the starting sequence is run in cpufreq_set_policy */
832838 policy->governor = NULL;
833839
834840 /* set default policy */
835841 ret = cpufreq_set_policy(policy, &new_policy);
836− policy->user_policy.policy = policy->policy;
837− policy->user_policy.governor = policy->governor;
838−
839842 if (ret) {
840843 pr_debug("setting policy failed\n");
841844 if (cpufreq_driver->exit)
@@ -845,8 +848,7 @@ static void cpufreq_init_policy(struct cpufreq_policy *policy) · 3 unmodified lines
845848
846849 #ifdef CONFIG_HOTPLUG_CPU
847850 static int cpufreq_add_policy_cpu(struct cpufreq_policy *policy,
848− unsigned int cpu, struct device *dev,
849− bool frozen)
851+ unsigned int cpu, struct device *dev)
850852 {
851853 int ret = 0;
852854 unsigned long flags;
@@ -877,11 +879,7 @@ static int cpufreq_add_policy_cpu(struct cpufreq_policy *policy, · 24 unmodified lines
877879 }
878880 }
879881
880− /* Don't touch sysfs links during light-weight init */
881− if (!frozen)
882− ret = sysfs_create_link(&dev->kobj, &policy->kobj, "cpufreq");
883−
884− return ret;
882+ return sysfs_create_link(&dev->kobj, &policy->kobj, "cpufreq");
885883 }
886884 #endif
887885
@@ -926,6 +924,27 @@ err_free_policy: · 38 unmodified lines
926924 return NULL;
927925 }
928926
927+static void cpufreq_policy_put_kobj(struct cpufreq_policy *policy)
928+{
929+ struct kobject *kobj;
930+ struct completion *cmp;
931+
932+ down_read(&policy->rwsem);
933+ kobj = &policy->kobj;
934+ cmp = &policy->kobj_unregister;
935+ up_read(&policy->rwsem);
936+ kobject_put(kobj);
937+
938+ /*
939+ * We need to make sure that the underlying kobj is
940+ * actually not referenced anymore by anybody before we
941+ * proceed with unloading.
942+ */
943+ pr_debug("waiting for dropping of refcount\n");
944+ wait_for_completion(cmp);
945+ pr_debug("wait complete\n");
946+}
947+
929948 static void cpufreq_policy_free(struct cpufreq_policy *policy)
930949 {
931950 free_cpumask_var(policy->related_cpus);
@@ -986,7 +1005,7 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, · 54 unmodified lines
9861005 list_for_each_entry(tpolicy, &cpufreq_policy_list, policy_list) {
9871006 if (cpumask_test_cpu(cpu, tpolicy->related_cpus)) {
9881007 read_unlock_irqrestore(&cpufreq_driver_lock, flags);
989− ret = cpufreq_add_policy_cpu(tpolicy, cpu, dev, frozen);
1008+ ret = cpufreq_add_policy_cpu(tpolicy, cpu, dev);
9901009 up_read(&cpufreq_rwsem);
9911010 return ret;
9921011 }
@@ -994,15 +1013,17 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, · 1 unmodified line
9941013 read_unlock_irqrestore(&cpufreq_driver_lock, flags);
9951014 #endif
9961015
997− if (frozen)
998− /* Restore the saved policy when doing light-weight init */
999− policy = cpufreq_policy_restore(cpu);
1000− else
1016+ /*
1017+ * Restore the saved policy when doing light-weight init and fall back
1018+ * to the full init if that fails.
1019+ */
1020+ policy = frozen ? cpufreq_policy_restore(cpu) : NULL;
1021+ if (!policy) {
1022+ frozen = false;
10011023 policy = cpufreq_policy_alloc();
1002−
1003− if (!policy)
1004− goto nomem_out;
1005−
1024+ if (!policy)
1025+ goto nomem_out;
1026+ }
10061027
10071028 /*
10081029 * In the resume path, since we restore a saved policy, the assignment
@@ -1047,8 +1068,10 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, · 38 unmodified lines
10471068 */
10481069 cpumask_and(policy->cpus, policy->cpus, cpu_online_mask);
10491070
1050− policy->user_policy.min = policy->min;
1051− policy->user_policy.max = policy->max;
1071+ if (!frozen) {
1072+ policy->user_policy.min = policy->min;
1073+ policy->user_policy.max = policy->max;
1074+ }
10521075
10531076 blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
10541077 CPUFREQ_START, policy);
@@ -1079,6 +1102,11 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, · 24 unmodified lines
10791102
10801103 cpufreq_init_policy(policy);
10811104
1105+ if (!frozen) {
1106+ policy->user_policy.policy = policy->policy;
1107+ policy->user_policy.governor = policy->governor;
1108+ }
1109+
10821110 kobject_uevent(&policy->kobj, KOBJ_ADD);
10831111 up_read(&cpufreq_rwsem);
10841112
@@ -1096,7 +1124,13 @@ err_get_freq: · 11 unmodified lines
10961124 if (cpufreq_driver->exit)
10971125 cpufreq_driver->exit(policy);
10981126 err_set_policy_cpu:
1127+ if (frozen) {
1128+ /* Do not leave stale fallback data behind. */
1129+ per_cpu(cpufreq_cpu_data_fallback, cpu) = NULL;
1130+ cpufreq_policy_put_kobj(policy);
1131+ }
10991132 cpufreq_policy_free(policy);
1133+
11001134 nomem_out:
11011135 up_read(&cpufreq_rwsem);
11021136
@@ -1118,7 +1152,7 @@ static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif) · 15 unmodified lines
11181152 }
11191153
11201154 static int cpufreq_nominate_new_policy_cpu(struct cpufreq_policy *policy,
1121− unsigned int old_cpu, bool frozen)
1155+ unsigned int old_cpu)
11221156 {
11231157 struct device *cpu_dev;
11241158 int ret;
@@ -1126,10 +1160,6 @@ static int cpufreq_nominate_new_policy_cpu(struct cpufreq_policy *policy, · 1 unmodified line
11261160 /* first sibling now owns the new sysfs dir */
11271161 cpu_dev = get_cpu_device(cpumask_any_but(policy->cpus, old_cpu));
11281162
1129− /* Don't touch sysfs files during light-weight tear-down */
1130− if (frozen)
1131− return cpu_dev->id;
1132−
11331163 sysfs_remove_link(&cpu_dev->kobj, "cpufreq");
11341164 ret = kobject_move(&policy->kobj, &cpu_dev->kobj);
11351165 if (ret) {
@@ -1196,7 +1226,7 @@ static int __cpufreq_remove_dev_prepare(struct device *dev, · 60 unmodified lines
11961226 if (!frozen)
11971227 sysfs_remove_link(&dev->kobj, "cpufreq");
11981228 } else if (cpus > 1) {
1199− new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu, frozen);
1229+ new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu);
12001230 if (new_cpu >= 0) {
12011231 update_policy_cpu(policy, new_cpu);
12021232
@@ -1218,8 +1248,6 @@ static int __cpufreq_remove_dev_finish(struct device *dev, · 15 unmodified lines
12181248 int ret;
12191249 unsigned long flags;
12201250 struct cpufreq_policy *policy;
1221− struct kobject *kobj;
1222− struct completion *cmp;
12231251
12241252 read_lock_irqsave(&cpufreq_driver_lock, flags);
12251253 policy = per_cpu(cpufreq_cpu_data, cpu);
@@ -1249,22 +1277,8 @@ static int __cpufreq_remove_dev_finish(struct device *dev, · 23 unmodified lines
12491277 }
12501278 }
12511279
1252− if (!frozen) {
1253− down_read(&policy->rwsem);
1254− kobj = &policy->kobj;
1255− cmp = &policy->kobj_unregister;
1256− up_read(&policy->rwsem);
1257− kobject_put(kobj);
1258−
1259− /*
1260− * We need to make sure that the underlying kobj is
1261− * actually not referenced anymore by anybody before we
1262− * proceed with unloading.
1263− */
1264− pr_debug("waiting for dropping of refcount\n");
1265− wait_for_completion(cmp);
1266− pr_debug("wait complete\n");
1267− }
1280+ if (!frozen)
1281+ cpufreq_policy_put_kobj(policy);
12681282
12691283 /*
12701284 * Perform the ->exit() even during light-weight tear-down,
drivers/cpufreq/intel_pstate.c+7−1
@@ -581,7 +581,8 @@ static void intel_pstate_timer_func(unsigned long __data) · 580 unmodified lines
581581 }
582582
583583 #define ICPU(model, policy) \
584− { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, (unsigned long)&policy }
584+ { X86_VENDOR_INTEL, 6, model, X86_FEATURE_APERFMPERF,\
585+ (unsigned long)&policy }
585586
586587 static const struct x86_cpu_id intel_pstate_cpu_ids[] = {
587588 ICPU(0x2a, core_params),
@@ -614,6 +615,11 @@ static int intel_pstate_init_cpu(unsigned int cpunum) · 26 unmodified lines
614615 cpu = all_cpu_data[cpunum];
615616
616617 intel_pstate_get_cpu_pstates(cpu);
618+ if (!cpu->pstate.current_pstate) {
619+ all_cpu_data[cpunum] = NULL;
620+ kfree(cpu);
621+ return -ENODATA;
622+ }
617623
618624 cpu->cpu = cpunum;
619625
drivers/cpuidle/cpuidle-calxeda.c+1−1
@@ -65,7 +65,7 @@ static struct cpuidle_driver calxeda_idle_driver = { · 64 unmodified lines
6565 .state_count = 2,
6666 };
6767
68−static int __init calxeda_cpuidle_probe(struct platform_device *pdev)
68+static int calxeda_cpuidle_probe(struct platform_device *pdev)
6969 {
7070 return cpuidle_register(&calxeda_idle_driver, NULL);
7171 }
drivers/crypto/ixp4xx_crypto.c+1−3
@@ -1410,14 +1410,12 @@ static const struct platform_device_info ixp_dev_info __initdata = { · 1409 unmodified lines
14101410 static int __init ixp_module_init(void)
14111411 {
14121412 int num = ARRAY_SIZE(ixp4xx_algos);
1413− int i, err ;
1413+ int i, err;
14141414
14151415 pdev = platform_device_register_full(&ixp_dev_info);
14161416 if (IS_ERR(pdev))
14171417 return PTR_ERR(pdev);
14181418
1419− dev = &pdev->dev;
1420−
14211419 spin_lock_init(&desc_lock);
14221420 spin_lock_init(&emerg_lock);
14231421
drivers/dma/Kconfig+7−0
@@ -62,6 +62,7 @@ config INTEL_IOATDMA · 61 unmodified lines
6262 tristate "Intel I/OAT DMA support"
6363 depends on PCI && X86
6464 select DMA_ENGINE
65+ select DMA_ENGINE_RAID
6566 select DCA
6667 help
6768 Enable support for the Intel(R) I/OAT DMA engine present
@@ -112,6 +113,7 @@ config MV_XOR · 44 unmodified lines
112113 bool "Marvell XOR engine support"
113114 depends on PLAT_ORION
114115 select DMA_ENGINE
116+ select DMA_ENGINE_RAID
115117 select ASYNC_TX_ENABLE_CHANNEL_SWITCH
116118 ---help---
117119 Enable support for the Marvell XOR engine.
@@ -187,6 +189,7 @@ config AMCC_PPC440SPE_ADMA · 69 unmodified lines
187189 tristate "AMCC PPC440SPe ADMA support"
188190 depends on 440SPe || 440SP
189191 select DMA_ENGINE
192+ select DMA_ENGINE_RAID
190193 select ARCH_HAS_ASYNC_TX_FIND_CHANNEL
191194 select ASYNC_TX_ENABLE_CHANNEL_SWITCH
192195 help
@@ -352,6 +355,7 @@ config NET_DMA · 159 unmodified lines
352355 bool "Network: TCP receive copy offload"
353356 depends on DMA_ENGINE && NET
354357 default (INTEL_IOATDMA || FSL_DMA)
358+ depends on BROKEN
355359 help
356360 This enables the use of DMA engines in the network stack to
357361 offload receive copy-to-user operations, freeing CPU cycles.
@@ -377,4 +381,7 @@ config DMATEST · 19 unmodified lines
377381 Simple DMA test client. Say N unless you're debugging a
378382 DMA Device driver.
379383
384+config DMA_ENGINE_RAID
385+ bool
386+
380387 endif
drivers/dma/at_hdmac_regs.h+0−4
@@ -347,10 +347,6 @@ static struct device *chan2dev(struct dma_chan *chan) · 346 unmodified lines
347347 {
348348 return &chan->dev->device;
349349 }
350−static struct device *chan2parent(struct dma_chan *chan)
351−{
352− return chan->dev->device.parent;
353−}
354350
355351 #if defined(VERBOSE_DEBUG)
356352 static void vdbg_dump_regs(struct at_dma_chan *atchan)
drivers/dma/dmaengine.c+2−2
@@ -912,7 +912,7 @@ struct dmaengine_unmap_pool { · 911 unmodified lines
912912 #define __UNMAP_POOL(x) { .size = x, .name = "dmaengine-unmap-" __stringify(x) }
913913 static struct dmaengine_unmap_pool unmap_pool[] = {
914914 __UNMAP_POOL(2),
915− #if IS_ENABLED(CONFIG_ASYNC_TX_DMA)
915+ #if IS_ENABLED(CONFIG_DMA_ENGINE_RAID)
916916 __UNMAP_POOL(16),
917917 __UNMAP_POOL(128),
918918 __UNMAP_POOL(256),
@@ -1054,7 +1054,7 @@ dma_async_memcpy_pg_to_pg(struct dma_chan *chan, struct page *dest_pg, · 135 unmodified lines
10541054 dma_cookie_t cookie;
10551055 unsigned long flags;
10561056
1057− unmap = dmaengine_get_unmap_data(dev->dev, 2, GFP_NOIO);
1057+ unmap = dmaengine_get_unmap_data(dev->dev, 2, GFP_NOWAIT);
10581058 if (!unmap)
10591059 return -ENOMEM;
10601060
drivers/dma/dmatest.c+4−4
@@ -539,9 +539,9 @@ static int dmatest_func(void *data) · 538 unmodified lines
539539
540540 um->len = params->buf_size;
541541 for (i = 0; i < src_cnt; i++) {
542− unsigned long buf = (unsigned long) thread->srcs[i];
542+ void *buf = thread->srcs[i];
543543 struct page *pg = virt_to_page(buf);
544− unsigned pg_off = buf & ~PAGE_MASK;
544+ unsigned pg_off = (unsigned long) buf & ~PAGE_MASK;
545545
546546 um->addr[i] = dma_map_page(dev->dev, pg, pg_off,
547547 um->len, DMA_TO_DEVICE);
@@ -559,9 +559,9 @@ static int dmatest_func(void *data) · 11 unmodified lines
559559 /* map with DMA_BIDIRECTIONAL to force writeback/invalidate */
560560 dsts = &um->addr[src_cnt];
561561 for (i = 0; i < dst_cnt; i++) {
562− unsigned long buf = (unsigned long) thread->dsts[i];
562+ void *buf = thread->dsts[i];
563563 struct page *pg = virt_to_page(buf);
564− unsigned pg_off = buf & ~PAGE_MASK;
564+ unsigned pg_off = (unsigned long) buf & ~PAGE_MASK;
565565
566566 dsts[i] = dma_map_page(dev->dev, pg, pg_off, um->len,
567567 DMA_BIDIRECTIONAL);
drivers/dma/fsldma.c+1−30
@@ -86,11 +86,6 @@ static void set_desc_cnt(struct fsldma_chan *chan, · 85 unmodified lines
8686 hw->count = CPU_TO_DMA(chan, count, 32);
8787 }
8888
89−static u32 get_desc_cnt(struct fsldma_chan *chan, struct fsl_desc_sw *desc)
90−{
91− return DMA_TO_CPU(chan, desc->hw.count, 32);
92−}
93−
9489 static void set_desc_src(struct fsldma_chan *chan,
9590 struct fsl_dma_ld_hw *hw, dma_addr_t src)
9691 {
@@ -101,16 +96,6 @@ static void set_desc_src(struct fsldma_chan *chan, · 4 unmodified lines
10196 hw->src_addr = CPU_TO_DMA(chan, snoop_bits | src, 64);
10297 }
10398
104−static dma_addr_t get_desc_src(struct fsldma_chan *chan,
105− struct fsl_desc_sw *desc)
106−{
107− u64 snoop_bits;
108−
109− snoop_bits = ((chan->feature & FSL_DMA_IP_MASK) == FSL_DMA_IP_85XX)
110− ? ((u64)FSL_DMA_SATR_SREADTYPE_SNOOP_READ << 32) : 0;
111− return DMA_TO_CPU(chan, desc->hw.src_addr, 64) & ~snoop_bits;
112−}
113−
11499 static void set_desc_dst(struct fsldma_chan *chan,
115100 struct fsl_dma_ld_hw *hw, dma_addr_t dst)
116101 {
@@ -121,16 +106,6 @@ static void set_desc_dst(struct fsldma_chan *chan, · 4 unmodified lines
121106 hw->dst_addr = CPU_TO_DMA(chan, snoop_bits | dst, 64);
122107 }
123108
124−static dma_addr_t get_desc_dst(struct fsldma_chan *chan,
125− struct fsl_desc_sw *desc)
126−{
127− u64 snoop_bits;
128−
129− snoop_bits = ((chan->feature & FSL_DMA_IP_MASK) == FSL_DMA_IP_85XX)
130− ? ((u64)FSL_DMA_DATR_DWRITETYPE_SNOOP_WRITE << 32) : 0;
131− return DMA_TO_CPU(chan, desc->hw.dst_addr, 64) & ~snoop_bits;
132−}
133−
134109 static void set_desc_next(struct fsldma_chan *chan,
135110 struct fsl_dma_ld_hw *hw, dma_addr_t next)
136111 {
@@ -408,7 +383,7 @@ static dma_cookie_t fsl_dma_tx_submit(struct dma_async_tx_descriptor *tx) · 271 unmodified lines
408383 struct fsl_desc_sw *desc = tx_to_fsl_desc(tx);
409384 struct fsl_desc_sw *child;
410385 unsigned long flags;
411− dma_cookie_t cookie;
386+ dma_cookie_t cookie = -EINVAL;
412387
413388 spin_lock_irqsave(&chan->desc_lock, flags);
414389
@@ -854,10 +829,6 @@ static void fsldma_cleanup_descriptor(struct fsldma_chan *chan, · 439 unmodified lines
854829 struct fsl_desc_sw *desc)
855830 {
856831 struct dma_async_tx_descriptor *txd = &desc->async_tx;
857− struct device *dev = chan->common.device->dev;
858− dma_addr_t src = get_desc_src(chan, desc);
859− dma_addr_t dst = get_desc_dst(chan, desc);
860− u32 len = get_desc_cnt(chan, desc);
861832
862833 /* Run the link descriptor callback function */
863834 if (txd->callback) {
drivers/dma/ioat/dma.c+10−1
@@ -817,7 +817,15 @@ int ioat_dma_self_test(struct ioatdma_device *device) · 816 unmodified lines
817817 }
818818
819819 dma_src = dma_map_single(dev, src, IOAT_TEST_SIZE, DMA_TO_DEVICE);
820+ if (dma_mapping_error(dev, dma_src)) {
821+ dev_err(dev, "mapping src buffer failed\n");
822+ goto free_resources;
823+ }
820824 dma_dest = dma_map_single(dev, dest, IOAT_TEST_SIZE, DMA_FROM_DEVICE);
825+ if (dma_mapping_error(dev, dma_dest)) {
826+ dev_err(dev, "mapping dest buffer failed\n");
827+ goto unmap_src;
828+ }
821829 flags = DMA_PREP_INTERRUPT;
822830 tx = device->common.device_prep_dma_memcpy(dma_chan, dma_dest, dma_src,
823831 IOAT_TEST_SIZE, flags);
@@ -855,8 +863,9 @@ int ioat_dma_self_test(struct ioatdma_device *device) · 31 unmodified lines
855863 }
856864
857865 unmap_dma:
858− dma_unmap_single(dev, dma_src, IOAT_TEST_SIZE, DMA_TO_DEVICE);
859866 dma_unmap_single(dev, dma_dest, IOAT_TEST_SIZE, DMA_FROM_DEVICE);
867+unmap_src:
868+ dma_unmap_single(dev, dma_src, IOAT_TEST_SIZE, DMA_TO_DEVICE);
860869 free_resources:
861870 dma->device_free_chan_resources(dma_chan);
862871 out:
drivers/dma/mv_xor.c+63−38
@@ -54,12 +54,6 @@ static void mv_desc_init(struct mv_xor_desc_slot *desc, unsigned long flags) · 53 unmodified lines
5454 hw_desc->desc_command = (1 << 31);
5555 }
5656
57−static u32 mv_desc_get_dest_addr(struct mv_xor_desc_slot *desc)
58−{
59− struct mv_xor_desc *hw_desc = desc->hw_desc;
60− return hw_desc->phy_dest_addr;
61−}
62−
6357 static void mv_desc_set_byte_count(struct mv_xor_desc_slot *desc,
6458 u32 byte_count)
6559 {
@@ -787,7 +781,6 @@ static void mv_xor_issue_pending(struct dma_chan *chan) · 721 unmodified lines
787781 /*
788782 * Perform a transaction to verify the HW works.
789783 */
790−#define MV_XOR_TEST_SIZE 2000
791784
792785 static int mv_xor_memcpy_self_test(struct mv_xor_chan *mv_chan)
793786 {
@@ -797,20 +790,21 @@ static int mv_xor_memcpy_self_test(struct mv_xor_chan *mv_chan) · 3 unmodified lines
797790 struct dma_chan *dma_chan;
798791 dma_cookie_t cookie;
799792 struct dma_async_tx_descriptor *tx;
793+ struct dmaengine_unmap_data *unmap;
800794 int err = 0;
801795
802− src = kmalloc(sizeof(u8) * MV_XOR_TEST_SIZE, GFP_KERNEL);
796+ src = kmalloc(sizeof(u8) * PAGE_SIZE, GFP_KERNEL);
803797 if (!src)
804798 return -ENOMEM;
805799
806− dest = kzalloc(sizeof(u8) * MV_XOR_TEST_SIZE, GFP_KERNEL);
800+ dest = kzalloc(sizeof(u8) * PAGE_SIZE, GFP_KERNEL);
807801 if (!dest) {
808802 kfree(src);
809803 return -ENOMEM;
810804 }
811805
812806 /* Fill in src buffer */
813− for (i = 0; i < MV_XOR_TEST_SIZE; i++)
807+ for (i = 0; i < PAGE_SIZE; i++)
814808 ((u8 *) src)[i] = (u8)i;
815809
816810 dma_chan = &mv_chan->dmachan;
@@ -819,14 +813,26 @@ static int mv_xor_memcpy_self_test(struct mv_xor_chan *mv_chan) · 2 unmodified lines
819813 goto out;
820814 }
821815
822− dest_dma = dma_map_single(dma_chan->device->dev, dest,
823− MV_XOR_TEST_SIZE, DMA_FROM_DEVICE);
816+ unmap = dmaengine_get_unmap_data(dma_chan->device->dev, 2, GFP_KERNEL);
817+ if (!unmap) {
818+ err = -ENOMEM;
819+ goto free_resources;
820+ }
821+
822+ src_dma = dma_map_page(dma_chan->device->dev, virt_to_page(src), 0,
823+ PAGE_SIZE, DMA_TO_DEVICE);
824+ unmap->to_cnt = 1;
825+ unmap->addr[0] = src_dma;
824826
825− src_dma = dma_map_single(dma_chan->device->dev, src,
826− MV_XOR_TEST_SIZE, DMA_TO_DEVICE);
827+ dest_dma = dma_map_page(dma_chan->device->dev, virt_to_page(dest), 0,
828+ PAGE_SIZE, DMA_FROM_DEVICE);
829+ unmap->from_cnt = 1;
830+ unmap->addr[1] = dest_dma;
831+
832+ unmap->len = PAGE_SIZE;
827833
828834 tx = mv_xor_prep_dma_memcpy(dma_chan, dest_dma, src_dma,
829− MV_XOR_TEST_SIZE, 0);
835+ PAGE_SIZE, 0);
830836 cookie = mv_xor_tx_submit(tx);
831837 mv_xor_issue_pending(dma_chan);
832838 async_tx_ack(tx);
@@ -841,8 +847,8 @@ static int mv_xor_memcpy_self_test(struct mv_xor_chan *mv_chan) · 8 unmodified lines
841847 }
842848
843849 dma_sync_single_for_cpu(dma_chan->device->dev, dest_dma,
844− MV_XOR_TEST_SIZE, DMA_FROM_DEVICE);
845− if (memcmp(src, dest, MV_XOR_TEST_SIZE)) {
850+ PAGE_SIZE, DMA_FROM_DEVICE);
851+ if (memcmp(src, dest, PAGE_SIZE)) {
846852 dev_err(dma_chan->device->dev,
847853 "Self-test copy failed compare, disabling\n");
848854 err = -ENODEV;
@@ -850,6 +856,7 @@ static int mv_xor_memcpy_self_test(struct mv_xor_chan *mv_chan) · 1 unmodified line
850856 }
851857
852858 free_resources:
859+ dmaengine_unmap_put(unmap);
853860 mv_xor_free_chan_resources(dma_chan);
854861 out:
855862 kfree(src);
@@ -867,13 +874,15 @@ mv_xor_xor_self_test(struct mv_xor_chan *mv_chan) · 11 unmodified lines
867874 dma_addr_t dma_srcs[MV_XOR_NUM_SRC_TEST];
868875 dma_addr_t dest_dma;
869876 struct dma_async_tx_descriptor *tx;
877+ struct dmaengine_unmap_data *unmap;
870878 struct dma_chan *dma_chan;
871879 dma_cookie_t cookie;
872880 u8 cmp_byte = 0;
873881 u32 cmp_word;
874882 int err = 0;
883+ int src_count = MV_XOR_NUM_SRC_TEST;
875884
876− for (src_idx = 0; src_idx < MV_XOR_NUM_SRC_TEST; src_idx++) {
885+ for (src_idx = 0; src_idx < src_count; src_idx++) {
877886 xor_srcs[src_idx] = alloc_page(GFP_KERNEL);
878887 if (!xor_srcs[src_idx]) {
879888 while (src_idx--)
@@ -890,13 +899,13 @@ mv_xor_xor_self_test(struct mv_xor_chan *mv_chan) · 10 unmodified lines
890899 }
891900
892901 /* Fill in src buffers */
893− for (src_idx = 0; src_idx < MV_XOR_NUM_SRC_TEST; src_idx++) {
902+ for (src_idx = 0; src_idx < src_count; src_idx++) {
894903 u8 *ptr = page_address(xor_srcs[src_idx]);
895904 for (i = 0; i < PAGE_SIZE; i++)
896905 ptr[i] = (1 << src_idx);
897906 }
898907
899− for (src_idx = 0; src_idx < MV_XOR_NUM_SRC_TEST; src_idx++)
908+ for (src_idx = 0; src_idx < src_count; src_idx++)
900909 cmp_byte ^= (u8) (1 << src_idx);
901910
902911 cmp_word = (cmp_byte << 24) | (cmp_byte << 16) |
@@ -910,16 +919,29 @@ mv_xor_xor_self_test(struct mv_xor_chan *mv_chan) · 7 unmodified lines
910919 goto out;
911920 }
912921
922+ unmap = dmaengine_get_unmap_data(dma_chan->device->dev, src_count + 1,
923+ GFP_KERNEL);
924+ if (!unmap) {
925+ err = -ENOMEM;
926+ goto free_resources;
927+ }
928+
913929 /* test xor */
914− dest_dma = dma_map_page(dma_chan->device->dev, dest, 0, PAGE_SIZE,
915− DMA_FROM_DEVICE);
930+ for (i = 0; i < src_count; i++) {
931+ unmap->addr[i] = dma_map_page(dma_chan->device->dev, xor_srcs[i],
932+ 0, PAGE_SIZE, DMA_TO_DEVICE);
933+ dma_srcs[i] = unmap->addr[i];
934+ unmap->to_cnt++;
935+ }
916936
917− for (i = 0; i < MV_XOR_NUM_SRC_TEST; i++)
918− dma_srcs[i] = dma_map_page(dma_chan->device->dev, xor_srcs[i],
919− 0, PAGE_SIZE, DMA_TO_DEVICE);
937+ unmap->addr[src_count] = dma_map_page(dma_chan->device->dev, dest, 0, PAGE_SIZE,
938+ DMA_FROM_DEVICE);
939+ dest_dma = unmap->addr[src_count];
940+ unmap->from_cnt = 1;
941+ unmap->len = PAGE_SIZE;
920942
921943 tx = mv_xor_prep_dma_xor(dma_chan, dest_dma, dma_srcs,
922− MV_XOR_NUM_SRC_TEST, PAGE_SIZE, 0);
944+ src_count, PAGE_SIZE, 0);
923945
924946 cookie = mv_xor_tx_submit(tx);
925947 mv_xor_issue_pending(dma_chan);
@@ -948,9 +970,10 @@ mv_xor_xor_self_test(struct mv_xor_chan *mv_chan) · 22 unmodified lines
948970 }
949971
950972 free_resources:
973+ dmaengine_unmap_put(unmap);
951974 mv_xor_free_chan_resources(dma_chan);
952975 out:
953− src_idx = MV_XOR_NUM_SRC_TEST;
976+ src_idx = src_count;
954977 while (src_idx--)
955978 __free_page(xor_srcs[src_idx]);
956979 __free_page(dest);
@@ -1176,6 +1199,7 @@ static int mv_xor_probe(struct platform_device *pdev) · 219 unmodified lines
11761199 int i = 0;
11771200
11781201 for_each_child_of_node(pdev->dev.of_node, np) {
1202+ struct mv_xor_chan *chan;
11791203 dma_cap_mask_t cap_mask;
11801204 int irq;
11811205
@@ -1193,21 +1217,21 @@ static int mv_xor_probe(struct platform_device *pdev) · 11 unmodified lines
11931217 goto err_channel_add;
11941218 }
11951219
1196− xordev->channels[i] =
1197− mv_xor_channel_add(xordev, pdev, i,
1198− cap_mask, irq);
1199− if (IS_ERR(xordev->channels[i])) {
1200− ret = PTR_ERR(xordev->channels[i]);
1201− xordev->channels[i] = NULL;
1220+ chan = mv_xor_channel_add(xordev, pdev, i,
1221+ cap_mask, irq);
1222+ if (IS_ERR(chan)) {
1223+ ret = PTR_ERR(chan);
12021224 irq_dispose_mapping(irq);
12031225 goto err_channel_add;
12041226 }
12051227
1228+ xordev->channels[i] = chan;
12061229 i++;
12071230 }
12081231 } else if (pdata && pdata->channels) {
12091232 for (i = 0; i < MV_XOR_MAX_CHANNELS; i++) {
12101233 struct mv_xor_channel_data *cd;
1234+ struct mv_xor_chan *chan;
12111235 int irq;
12121236
12131237 cd = &pdata->channels[i];
@@ -1222,13 +1246,14 @@ static int mv_xor_probe(struct platform_device *pdev) · 8 unmodified lines
12221246 goto err_channel_add;
12231247 }
12241248
1225− xordev->channels[i] =
1226− mv_xor_channel_add(xordev, pdev, i,
1227− cd->cap_mask, irq);
1228− if (IS_ERR(xordev->channels[i])) {
1229− ret = PTR_ERR(xordev->channels[i]);
1249+ chan = mv_xor_channel_add(xordev, pdev, i,
1250+ cd->cap_mask, irq);
1251+ if (IS_ERR(chan)) {
1252+ ret = PTR_ERR(chan);
12301253 goto err_channel_add;
12311254 }
1255+
1256+ xordev->channels[i] = chan;
12321257 }
12331258 }
12341259
drivers/dma/pl330.c+1−4
@@ -2492,12 +2492,9 @@ static dma_cookie_t pl330_tx_submit(struct dma_async_tx_descriptor *tx) · 2491 unmodified lines
24922492
24932493 static inline void _init_desc(struct dma_pl330_desc *desc)
24942494 {
2495− desc->pchan = NULL;
24962495 desc->req.x = &desc->px;
24972496 desc->req.token = desc;
24982497 desc->rqcfg.swap = SWAP_NO;
2499− desc->rqcfg.privileged = 0;
2500− desc->rqcfg.insnaccess = 0;
25012498 desc->rqcfg.scctl = SCCTRL0;
25022499 desc->rqcfg.dcctl = DCCTRL0;
25032500 desc->req.cfg = &desc->rqcfg;
@@ -2517,7 +2514,7 @@ static int add_desc(struct dma_pl330_dmac *pdmac, gfp_t flg, int count) · 13 unmodified lines
25172514 if (!pdmac)
25182515 return 0;
25192516
2520− desc = kmalloc(count * sizeof(*desc), flg);
2517+ desc = kcalloc(count, sizeof(*desc), flg);
25212518 if (!desc)
25222519 return 0;
25232520
drivers/dma/ppc4xx/adma.c+1−26
@@ -532,29 +532,6 @@ static void ppc440spe_desc_init_memcpy(struct ppc440spe_adma_desc_slot *desc, · 531 unmodified lines
532532 hw_desc->opc = DMA_CDB_OPC_MV_SG1_SG2;
533533 }
534534
535−/**
536− * ppc440spe_desc_init_memset - initialize the descriptor for MEMSET operation
537− */
538−static void ppc440spe_desc_init_memset(struct ppc440spe_adma_desc_slot *desc,
539− int value, unsigned long flags)
540−{
541− struct dma_cdb *hw_desc = desc->hw_desc;
542−
543− memset(desc->hw_desc, 0, sizeof(struct dma_cdb));
544− desc->hw_next = NULL;
545− desc->src_cnt = 1;
546− desc->dst_cnt = 1;
547−
548− if (flags & DMA_PREP_INTERRUPT)
549− set_bit(PPC440SPE_DESC_INT, &desc->flags);
550− else
551− clear_bit(PPC440SPE_DESC_INT, &desc->flags);
552−
553− hw_desc->sg1u = hw_desc->sg1l = cpu_to_le32((u32)value);
554− hw_desc->sg3u = hw_desc->sg3l = cpu_to_le32((u32)value);
555− hw_desc->opc = DMA_CDB_OPC_DFILL128;
556−}
557−
558535 /**
559536 * ppc440spe_desc_set_src_addr - set source address into the descriptor
560537 */
@@ -1504,8 +1481,6 @@ static dma_cookie_t ppc440spe_adma_run_tx_complete_actions( · 943 unmodified lines
15041481 struct ppc440spe_adma_chan *chan,
15051482 dma_cookie_t cookie)
15061483 {
1507− int i;
1508−
15091484 BUG_ON(desc->async_tx.cookie < 0);
15101485 if (desc->async_tx.cookie > 0) {
15111486 cookie = desc->async_tx.cookie;
@@ -3898,7 +3873,7 @@ static void ppc440spe_adma_init_capabilities(struct ppc440spe_adma_device *adev) · 2386 unmodified lines
38983873 ppc440spe_adma_prep_dma_interrupt;
38993874 }
39003875 pr_info("%s: AMCC(R) PPC440SP(E) ADMA Engine: "
3901− "( %s%s%s%s%s%s%s)\n",
3876+ "( %s%s%s%s%s%s)\n",
39023877 dev_name(adev->dev),
39033878 dma_has_cap(DMA_PQ, adev->common.cap_mask) ? "pq " : "",
39043879 dma_has_cap(DMA_PQ_VAL, adev->common.cap_mask) ? "pq_val " : "",
drivers/dma/txx9dmac.c+0−1
@@ -406,7 +406,6 @@ txx9dmac_descriptor_complete(struct txx9dmac_chan *dc, · 405 unmodified lines
406406 dma_async_tx_callback callback;
407407 void *param;
408408 struct dma_async_tx_descriptor *txd = &desc->txd;
409− struct txx9dmac_slave *ds = dc->chan.private;
410409
411410 dev_vdbg(chan2dev(&dc->chan), "descriptor %u %p complete\n",
412411 txd->cookie, desc);
drivers/firewire/sbp2.c+0−1
@@ -1623,7 +1623,6 @@ static struct scsi_host_template scsi_driver_template = { · 1622 unmodified lines
16231623 .cmd_per_lun = 1,
16241624 .can_queue = 1,
16251625 .sdev_attrs = sbp2_scsi_sysfs_attrs,
1626− .no_write_same = 1,
16271626 };
16281627
16291628 MODULE_AUTHOR("Kristian Hoegsberg <krh@bitplanet.net>");
drivers/firmware/Makefile+1−0
@@ -14,3 +14,4 @@ obj-$(CONFIG_FIRMWARE_MEMMAP) += memmap.o · 13 unmodified lines
1414
1515 obj-$(CONFIG_GOOGLE_FIRMWARE) += google/
1616 obj-$(CONFIG_EFI) += efi/
17+obj-$(CONFIG_UEFI_CPER) += efi/
drivers/firmware/efi/Kconfig+3−3
@@ -36,7 +36,7 @@ config EFI_VARS_PSTORE_DEFAULT_DISABLE · 35 unmodified lines
3636 backend for pstore by default. This setting can be overridden
3737 using the efivars module's pstore_disable parameter.
3838
39−config UEFI_CPER
40− def_bool n
41−
4239 endmenu
40+
41+config UEFI_CPER
42+ bool
drivers/firmware/efi/Makefile+1−1
@@ -1,7 +1,7 @@
11 #
22 # Makefile for linux kernel
33 #
4−obj-y += efi.o vars.o
4+obj-$(CONFIG_EFI) += efi.o vars.o
55 obj-$(CONFIG_EFI_VARS) += efivars.o
66 obj-$(CONFIG_EFI_VARS_PSTORE) += efi-pstore.o
77 obj-$(CONFIG_UEFI_CPER) += cper.o
drivers/firmware/efi/efi-pstore.c+1−0
@@ -356,6 +356,7 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count, · 355 unmodified lines
356356 static struct pstore_info efi_pstore_info = {
357357 .owner = THIS_MODULE,
358358 .name = "efi",
359+ .flags = PSTORE_FLAGS_FRAGILE,
359360 .open = efi_pstore_open,
360361 .close = efi_pstore_close,
361362 .read = efi_pstore_read,
drivers/gpio/gpio-msm-v2.c+2−2
@@ -252,7 +252,7 @@ static void msm_gpio_irq_mask(struct irq_data *d) · 251 unmodified lines
252252
253253 spin_lock_irqsave(&tlmm_lock, irq_flags);
254254 writel(TARGET_PROC_NONE, GPIO_INTR_CFG_SU(gpio));
255− clear_gpio_bits(INTR_RAW_STATUS_EN | INTR_ENABLE, GPIO_INTR_CFG(gpio));
255+ clear_gpio_bits(BIT(INTR_RAW_STATUS_EN) | BIT(INTR_ENABLE), GPIO_INTR_CFG(gpio));
256256 __clear_bit(gpio, msm_gpio.enabled_irqs);
257257 spin_unlock_irqrestore(&tlmm_lock, irq_flags);
258258 }
@@ -264,7 +264,7 @@ static void msm_gpio_irq_unmask(struct irq_data *d) · 5 unmodified lines
264264
265265 spin_lock_irqsave(&tlmm_lock, irq_flags);
266266 __set_bit(gpio, msm_gpio.enabled_irqs);
267− set_gpio_bits(INTR_RAW_STATUS_EN | INTR_ENABLE, GPIO_INTR_CFG(gpio));
267+ set_gpio_bits(BIT(INTR_RAW_STATUS_EN) | BIT(INTR_ENABLE), GPIO_INTR_CFG(gpio));
268268 writel(TARGET_PROC_SCORPION, GPIO_INTR_CFG_SU(gpio));
269269 spin_unlock_irqrestore(&tlmm_lock, irq_flags);
270270 }
drivers/gpio/gpio-rcar.c+2−1
@@ -169,7 +169,8 @@ static irqreturn_t gpio_rcar_irq_handler(int irq, void *dev_id) · 168 unmodified lines
169169 u32 pending;
170170 unsigned int offset, irqs_handled = 0;
171171
172− while ((pending = gpio_rcar_read(p, INTDT))) {
172+ while ((pending = gpio_rcar_read(p, INTDT) &
173+ gpio_rcar_read(p, INTMSK))) {
173174 offset = __ffs(pending);
174175 gpio_rcar_write(p, INTCLR, BIT(offset));
175176 generic_handle_irq(irq_find_mapping(p->irq_domain, offset));
drivers/gpio/gpio-twl4030.c+12−3
@@ -300,7 +300,7 @@ static int twl_direction_in(struct gpio_chip *chip, unsigned offset) · 299 unmodified lines
300300 if (offset < TWL4030_GPIO_MAX)
301301 ret = twl4030_set_gpio_direction(offset, 1);
302302 else
303− ret = -EINVAL;
303+ ret = -EINVAL; /* LED outputs can't be set as input */
304304
305305 if (!ret)
306306 priv->direction &= ~BIT(offset);
@@ -354,11 +354,20 @@ static void twl_set(struct gpio_chip *chip, unsigned offset, int value) · 47 unmodified lines
354354 static int twl_direction_out(struct gpio_chip *chip, unsigned offset, int value)
355355 {
356356 struct gpio_twl4030_priv *priv = to_gpio_twl4030(chip);
357− int ret = -EINVAL;
357+ int ret = 0;
358358
359359 mutex_lock(&priv->mutex);
360− if (offset < TWL4030_GPIO_MAX)
360+ if (offset < TWL4030_GPIO_MAX) {
361361 ret = twl4030_set_gpio_direction(offset, 0);
362+ if (ret) {
363+ mutex_unlock(&priv->mutex);
364+ return ret;
365+ }
366+ }
367+
368+ /*
369+ * LED gpios i.e. offset >= TWL4030_GPIO_MAX are always output
370+ */
362371
363372 priv->direction |= BIT(offset);
364373 mutex_unlock(&priv->mutex);
drivers/gpu/drm/armada/armada_drm.h+1−0
@@ -103,6 +103,7 @@ void armada_drm_queue_unref_work(struct drm_device *, · 102 unmodified lines
103103 extern const struct drm_mode_config_funcs armada_drm_mode_config_funcs;
104104
105105 int armada_fbdev_init(struct drm_device *);
106+void armada_fbdev_lastclose(struct drm_device *);
106107 void armada_fbdev_fini(struct drm_device *);
107108
108109 int armada_overlay_plane_create(struct drm_device *, unsigned long);
drivers/gpu/drm/armada/armada_drv.c+6−1
@@ -321,6 +321,11 @@ static struct drm_ioctl_desc armada_ioctls[] = { · 320 unmodified lines
321321 DRM_UNLOCKED),
322322 };
323323
324+static void armada_drm_lastclose(struct drm_device *dev)
325+{
326+ armada_fbdev_lastclose(dev);
327+}
328+
324329 static const struct file_operations armada_drm_fops = {
325330 .owner = THIS_MODULE,
326331 .llseek = no_llseek,
@@ -337,7 +342,7 @@ static struct drm_driver armada_drm_driver = { · 10 unmodified lines
337342 .open = NULL,
338343 .preclose = NULL,
339344 .postclose = NULL,
340− .lastclose = NULL,
345+ .lastclose = armada_drm_lastclose,
341346 .unload = armada_drm_unload,
342347 .get_vblank_counter = drm_vblank_count,
343348 .enable_vblank = armada_drm_enable_vblank,
drivers/gpu/drm/armada/armada_fbdev.c+15−5
@@ -105,9 +105,9 @@ static int armada_fb_create(struct drm_fb_helper *fbh, · 104 unmodified lines
105105 drm_fb_helper_fill_fix(info, dfb->fb.pitches[0], dfb->fb.depth);
106106 drm_fb_helper_fill_var(info, fbh, sizes->fb_width, sizes->fb_height);
107107
108− DRM_DEBUG_KMS("allocated %dx%d %dbpp fb: 0x%08x\n",
109− dfb->fb.width, dfb->fb.height,
110− dfb->fb.bits_per_pixel, obj->phys_addr);
108+ DRM_DEBUG_KMS("allocated %dx%d %dbpp fb: 0x%08llx\n",
109+ dfb->fb.width, dfb->fb.height, dfb->fb.bits_per_pixel,
110+ (unsigned long long)obj->phys_addr);
111111
112112 return 0;
113113
@@ -177,6 +177,16 @@ int armada_fbdev_init(struct drm_device *dev) · 63 unmodified lines
177177 return ret;
178178 }
179179
180+void armada_fbdev_lastclose(struct drm_device *dev)
181+{
182+ struct armada_private *priv = dev->dev_private;
183+
184+ drm_modeset_lock_all(dev);
185+ if (priv->fbdev)
186+ drm_fb_helper_restore_fbdev_mode(priv->fbdev);
187+ drm_modeset_unlock_all(dev);
188+}
189+
180190 void armada_fbdev_fini(struct drm_device *dev)
181191 {
182192 struct armada_private *priv = dev->dev_private;
@@ -192,11 +202,11 @@ void armada_fbdev_fini(struct drm_device *dev) · 9 unmodified lines
192202 framebuffer_release(info);
193203 }
194204
205+ drm_fb_helper_fini(fbh);
206+
195207 if (fbh->fb)
196208 fbh->fb->funcs->destroy(fbh->fb);
197209
198− drm_fb_helper_fini(fbh);
199−
200210 priv->fbdev = NULL;
201211 }
202212 }
drivers/gpu/drm/armada/armada_gem.c+4−3
@@ -172,8 +172,9 @@ armada_gem_linear_back(struct drm_device *dev, struct armada_gem_object *obj) · 171 unmodified lines
172172 obj->dev_addr = obj->linear->start;
173173 }
174174
175− DRM_DEBUG_DRIVER("obj %p phys %#x dev %#x\n",
176− obj, obj->phys_addr, obj->dev_addr);
175+ DRM_DEBUG_DRIVER("obj %p phys %#llx dev %#llx\n", obj,
176+ (unsigned long long)obj->phys_addr,
177+ (unsigned long long)obj->dev_addr);
177178
178179 return 0;
179180 }
@@ -557,7 +558,6 @@ armada_gem_prime_import(struct drm_device *dev, struct dma_buf *buf) · 377 unmodified lines
557558 * refcount on the gem object itself.
558559 */
559560 drm_gem_object_reference(obj);
560− dma_buf_put(buf);
561561 return obj;
562562 }
563563 }
@@ -573,6 +573,7 @@ armada_gem_prime_import(struct drm_device *dev, struct dma_buf *buf) · 9 unmodified lines
573573 }
574574
575575 dobj->obj.import_attach = attach;
576+ get_dma_buf(buf);
576577
577578 /*
578579 * Don't call dma_buf_map_attachment() here - it maps the
drivers/gpu/drm/drm_edid.c+8−0
@@ -68,6 +68,8 @@ · 67 unmodified lines
6868 #define EDID_QUIRK_DETAILED_SYNC_PP (1 << 6)
6969 /* Force reduced-blanking timings for detailed modes */
7070 #define EDID_QUIRK_FORCE_REDUCED_BLANKING (1 << 7)
71+/* Force 8bpc */
72+#define EDID_QUIRK_FORCE_8BPC (1 << 8)
7173
7274 struct detailed_mode_closure {
7375 struct drm_connector *connector;
@@ -128,6 +130,9 @@ static struct edid_quirk { · 54 unmodified lines
128130
129131 /* Medion MD 30217 PG */
130132 { "MED", 0x7b8, EDID_QUIRK_PREFER_LARGE_75 },
133+
134+ /* Panel in Samsung NP700G7A-S01PL notebook reports 6bpc */
135+ { "SEC", 0xd033, EDID_QUIRK_FORCE_8BPC },
131136 };
132137
133138 /*
@@ -3435,6 +3440,9 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid) · 3301 unmodified lines
34353440
34363441 drm_add_display_info(edid, &connector->display_info);
34373442
3443+ if (quirks & EDID_QUIRK_FORCE_8BPC)
3444+ connector->display_info.bpc = 8;
3445+
34383446 return num_modes;
34393447 }
34403448 EXPORT_SYMBOL(drm_add_edid_modes);
drivers/gpu/drm/drm_modes.c+1−1
@@ -1041,7 +1041,7 @@ void drm_mode_connector_list_update(struct drm_connector *connector) · 1040 unmodified lines
10411041 /* if equal delete the probed mode */
10421042 mode->status = pmode->status;
10431043 /* Merge type bits together */
1044− mode->type = pmode->type;
1044+ mode->type |= pmode->type;
10451045 list_del(&pmode->head);
10461046 drm_mode_destroy(connector->dev, pmode);
10471047 break;
drivers/gpu/drm/drm_stub.c+3−3
@@ -566,11 +566,11 @@ err_unload: · 565 unmodified lines
566566 if (dev->driver->unload)
567567 dev->driver->unload(dev);
568568 err_primary_node:
569− drm_put_minor(dev->primary);
569+ drm_unplug_minor(dev->primary);
570570 err_render_node:
571− drm_put_minor(dev->render);
571+ drm_unplug_minor(dev->render);
572572 err_control_node:
573− drm_put_minor(dev->control);
573+ drm_unplug_minor(dev->control);
574574 err_agp:
575575 if (dev->driver->bus->agp_destroy)
576576 dev->driver->bus->agp_destroy(dev);
drivers/gpu/drm/i915/i915_dma.c+11−9
@@ -83,6 +83,14 @@ void i915_update_dri1_breadcrumb(struct drm_device *dev) · 82 unmodified lines
8383 drm_i915_private_t *dev_priv = dev->dev_private;
8484 struct drm_i915_master_private *master_priv;
8585
86+ /*
87+ * The dri breadcrumb update races against the drm master disappearing.
88+ * Instead of trying to fix this (this is by far not the only ums issue)
89+ * just don't do the update in kms mode.
90+ */
91+ if (drm_core_check_feature(dev, DRIVER_MODESET))
92+ return;
93+
8694 if (dev->primary->master) {
8795 master_priv = dev->primary->master->driver_priv;
8896 if (master_priv->sarea_priv)
@@ -1490,16 +1498,9 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) · 1401 unmodified lines
14901498 spin_lock_init(&dev_priv->uncore.lock);
14911499 spin_lock_init(&dev_priv->mm.object_stat_lock);
14921500 mutex_init(&dev_priv->dpio_lock);
1493− mutex_init(&dev_priv->rps.hw_lock);
14941501 mutex_init(&dev_priv->modeset_restore_lock);
14951502
1496− mutex_init(&dev_priv->pc8.lock);
1497− dev_priv->pc8.requirements_met = false;
1498− dev_priv->pc8.gpu_idle = false;
1499− dev_priv->pc8.irqs_disabled = false;
1500− dev_priv->pc8.enabled = false;
1501− dev_priv->pc8.disable_count = 2; /* requirements_met + gpu_idle */
1502− INIT_DELAYED_WORK(&dev_priv->pc8.enable_work, hsw_enable_pc8_work);
1503+ intel_pm_setup(dev);
15031504
15041505 intel_display_crc_init(dev);
15051506
@@ -1603,7 +1604,6 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) · 97 unmodified lines
16031604 }
16041605
16051606 intel_irq_init(dev);
1606− intel_pm_init(dev);
16071607 intel_uncore_sanitize(dev);
16081608
16091609 /* Try to make sure MCHBAR is enabled before poking at it */
@@ -1848,8 +1848,10 @@ void i915_driver_lastclose(struct drm_device * dev) · 238 unmodified lines
18481848
18491849 void i915_driver_preclose(struct drm_device * dev, struct drm_file *file_priv)
18501850 {
1851+ mutex_lock(&dev->struct_mutex);
18511852 i915_gem_context_close(dev, file_priv);
18521853 i915_gem_release(dev, file_priv);
1854+ mutex_unlock(&dev->struct_mutex);
18531855 }
18541856
18551857 void i915_driver_postclose(struct drm_device *dev, struct drm_file *file)
drivers/gpu/drm/i915/i915_drv.c+1−0
@@ -651,6 +651,7 @@ static int __i915_drm_thaw(struct drm_device *dev, bool restore_gtt_mappings) · 650 unmodified lines
651651 intel_modeset_init_hw(dev);
652652
653653 drm_modeset_lock_all(dev);
654+ drm_mode_config_reset(dev);
654655 intel_modeset_setup_hw_state(dev, true);
655656 drm_modeset_unlock_all(dev);
656657
drivers/gpu/drm/i915/i915_drv.h+6−3
@@ -1755,8 +1755,13 @@ struct drm_i915_file_private { · 1754 unmodified lines
17551755 #define IS_MOBILE(dev) (INTEL_INFO(dev)->is_mobile)
17561756 #define IS_HSW_EARLY_SDV(dev) (IS_HASWELL(dev) && \
17571757 ((dev)->pdev->device & 0xFF00) == 0x0C00)
1758−#define IS_ULT(dev) (IS_HASWELL(dev) && \
1758+#define IS_BDW_ULT(dev) (IS_BROADWELL(dev) && \
1759+ (((dev)->pdev->device & 0xf) == 0x2 || \
1760+ ((dev)->pdev->device & 0xf) == 0x6 || \
1761+ ((dev)->pdev->device & 0xf) == 0xe))
1762+#define IS_HSW_ULT(dev) (IS_HASWELL(dev) && \
17591763 ((dev)->pdev->device & 0xFF00) == 0x0A00)
1764+#define IS_ULT(dev) (IS_HSW_ULT(dev) || IS_BDW_ULT(dev))
17601765 #define IS_HSW_GT3(dev) (IS_HASWELL(dev) && \
17611766 ((dev)->pdev->device & 0x00F0) == 0x0020)
17621767 #define IS_PRELIMINARY_HW(intel_info) ((intel_info)->is_preliminary)
@@ -1901,9 +1906,7 @@ void i915_queue_hangcheck(struct drm_device *dev); · 138 unmodified lines
19011906 void i915_handle_error(struct drm_device *dev, bool wedged);
19021907
19031908 extern void intel_irq_init(struct drm_device *dev);
1904−extern void intel_pm_init(struct drm_device *dev);
19051909 extern void intel_hpd_init(struct drm_device *dev);
1906−extern void intel_pm_init(struct drm_device *dev);
19071910
19081911 extern void intel_uncore_sanitize(struct drm_device *dev);
19091912 extern void intel_uncore_early_sanitize(struct drm_device *dev);
drivers/gpu/drm/i915/i915_gem.c+24−10
@@ -2343,15 +2343,24 @@ static void i915_gem_free_request(struct drm_i915_gem_request *request) · 2342 unmodified lines
23432343 kfree(request);
23442344 }
23452345
2346−static void i915_gem_reset_ring_lists(struct drm_i915_private *dev_priv,
2347− struct intel_ring_buffer *ring)
2346+static void i915_gem_reset_ring_status(struct drm_i915_private *dev_priv,
2347+ struct intel_ring_buffer *ring)
23482348 {
2349− u32 completed_seqno;
2350− u32 acthd;
2349+ u32 completed_seqno = ring->get_seqno(ring, false);
2350+ u32 acthd = intel_ring_get_active_head(ring);
2351+ struct drm_i915_gem_request *request;
2352+
2353+ list_for_each_entry(request, &ring->request_list, list) {
2354+ if (i915_seqno_passed(completed_seqno, request->seqno))
2355+ continue;
23512356
2352− acthd = intel_ring_get_active_head(ring);
2353− completed_seqno = ring->get_seqno(ring, false);
2357+ i915_set_reset_status(ring, request, acthd);
2358+ }
2359+}
23542360
2361+static void i915_gem_reset_ring_cleanup(struct drm_i915_private *dev_priv,
2362+ struct intel_ring_buffer *ring)
2363+{
23552364 while (!list_empty(&ring->request_list)) {
23562365 struct drm_i915_gem_request *request;
23572366
@@ -2359,9 +2368,6 @@ static void i915_gem_reset_ring_lists(struct drm_i915_private *dev_priv, · 1 unmodified line
23592368 struct drm_i915_gem_request,
23602369 list);
23612370
2362− if (request->seqno > completed_seqno)
2363− i915_set_reset_status(ring, request, acthd);
2364−
23652371 i915_gem_free_request(request);
23662372 }
23672373
@@ -2403,8 +2409,16 @@ void i915_gem_reset(struct drm_device *dev) · 35 unmodified lines
24032409 struct intel_ring_buffer *ring;
24042410 int i;
24052411
2412+ /*
2413+ * Before we free the objects from the requests, we need to inspect
2414+ * them for finding the guilty party. As the requests only borrow
2415+ * their reference to the objects, the inspection must be done first.
2416+ */
2417+ for_each_ring(ring, dev_priv, i)
2418+ i915_gem_reset_ring_status(dev_priv, ring);
2419+
24062420 for_each_ring(ring, dev_priv, i)
2407− i915_gem_reset_ring_lists(dev_priv, ring);
2421+ i915_gem_reset_ring_cleanup(dev_priv, ring);
24082422
24092423 i915_gem_cleanup_ringbuffer(dev);
24102424
drivers/gpu/drm/i915/i915_gem_context.c+12−4
@@ -347,10 +347,8 @@ void i915_gem_context_close(struct drm_device *dev, struct drm_file *file) · 346 unmodified lines
347347 {
348348 struct drm_i915_file_private *file_priv = file->driver_priv;
349349
350− mutex_lock(&dev->struct_mutex);
351350 idr_for_each(&file_priv->context_idr, context_idr_cleanup, NULL);
352351 idr_destroy(&file_priv->context_idr);
353− mutex_unlock(&dev->struct_mutex);
354352 }
355353
356354 static struct i915_hw_context *
@@ -423,11 +421,21 @@ static int do_switch(struct i915_hw_context *to) · 66 unmodified lines
423421 if (ret)
424422 return ret;
425423
426− /* Clear this page out of any CPU caches for coherent swap-in/out. Note
424+ /*
425+ * Pin can switch back to the default context if we end up calling into
426+ * evict_everything - as a last ditch gtt defrag effort that also
427+ * switches to the default context. Hence we need to reload from here.
428+ */
429+ from = ring->last_context;
430+
431+ /*
432+ * Clear this page out of any CPU caches for coherent swap-in/out. Note
427433 * that thanks to write = false in this call and us not setting any gpu
428434 * write domains when putting a context object onto the active list
429435 * (when switching away from it), this won't block.
430− * XXX: We need a real interface to do this instead of trickery. */
436+ *
437+ * XXX: We need a real interface to do this instead of trickery.
438+ */
431439 ret = i915_gem_object_set_to_gtt_domain(to->obj, false);
432440 if (ret) {
433441 i915_gem_object_unpin(to->obj);
drivers/gpu/drm/i915/i915_gem_evict.c+11−3
@@ -88,6 +88,7 @@ i915_gem_evict_something(struct drm_device *dev, struct i915_address_space *vm, · 87 unmodified lines
8888 } else
8989 drm_mm_init_scan(&vm->mm, min_size, alignment, cache_level);
9090
91+search_again:
9192 /* First see if there is a large enough contiguous idle region... */
9293 list_for_each_entry(vma, &vm->inactive_list, mm_list) {
9394 if (mark_free(vma, &unwind_list))
@@ -115,10 +116,17 @@ none: · 21 unmodified lines
115116 list_del_init(&vma->exec_list);
116117 }
117118
118− /* We expect the caller to unpin, evict all and try again, or give up.
119− * So calling i915_gem_evict_vm() is unnecessary.
119+ /* Can we unpin some objects such as idle hw contents,
120+ * or pending flips?
120121 */
121− return -ENOSPC;
122+ ret = nonblocking ? -ENOSPC : i915_gpu_idle(dev);
123+ if (ret)
124+ return ret;
125+
126+ /* Only idle the GPU and repeat the search once */
127+ i915_gem_retire_requests(dev);
128+ nonblocking = true;
129+ goto search_again;
122130
123131 found:
124132 /* drm_mm doesn't allow any other other operations while
drivers/gpu/drm/i915/i915_gem_execbuffer.c+20−8
@@ -93,7 +93,7 @@ eb_lookup_vmas(struct eb_vmas *eb, · 92 unmodified lines
9393 {
9494 struct drm_i915_gem_object *obj;
9595 struct list_head objects;
96− int i, ret = 0;
96+ int i, ret;
9797
9898 INIT_LIST_HEAD(&objects);
9999 spin_lock(&file->table_lock);
@@ -106,7 +106,7 @@ eb_lookup_vmas(struct eb_vmas *eb, · 6 unmodified lines
106106 DRM_DEBUG("Invalid object handle %d at index %d\n",
107107 exec[i].handle, i);
108108 ret = -ENOENT;
109− goto out;
109+ goto err;
110110 }
111111
112112 if (!list_empty(&obj->obj_exec_link)) {
@@ -114,7 +114,7 @@ eb_lookup_vmas(struct eb_vmas *eb, · 1 unmodified line
114114 DRM_DEBUG("Object %p [handle %d, index %d] appears more than once in object list\n",
115115 obj, exec[i].handle, i);
116116 ret = -EINVAL;
117− goto out;
117+ goto err;
118118 }
119119
120120 drm_gem_object_reference(&obj->base);
@@ -123,9 +123,13 @@ eb_lookup_vmas(struct eb_vmas *eb, · 2 unmodified lines
123123 spin_unlock(&file->table_lock);
124124
125125 i = 0;
126− list_for_each_entry(obj, &objects, obj_exec_link) {
126+ while (!list_empty(&objects)) {
127127 struct i915_vma *vma;
128128
129+ obj = list_first_entry(&objects,
130+ struct drm_i915_gem_object,
131+ obj_exec_link);
132+
129133 /*
130134 * NOTE: We can leak any vmas created here when something fails
131135 * later on. But that's no issue since vma_unbind can deal with
@@ -138,10 +142,12 @@ eb_lookup_vmas(struct eb_vmas *eb, · 6 unmodified lines
138142 if (IS_ERR(vma)) {
139143 DRM_DEBUG("Failed to lookup VMA\n");
140144 ret = PTR_ERR(vma);
141− goto out;
145+ goto err;
142146 }
143147
148+ /* Transfer ownership from the objects list to the vmas list. */
144149 list_add_tail(&vma->exec_list, &eb->vmas);
150+ list_del_init(&obj->obj_exec_link);
145151
146152 vma->exec_entry = &exec[i];
147153 if (eb->and < 0) {
@@ -155,16 +161,22 @@ eb_lookup_vmas(struct eb_vmas *eb, · 7 unmodified lines
155161 ++i;
156162 }
157163
164+ return 0;
165+
158166
159−out:
167+err:
160168 while (!list_empty(&objects)) {
161169 obj = list_first_entry(&objects,
162170 struct drm_i915_gem_object,
163171 obj_exec_link);
164172 list_del_init(&obj->obj_exec_link);
165− if (ret)
166− drm_gem_object_unreference(&obj->base);
173+ drm_gem_object_unreference(&obj->base);
167174 }
175+ /*
176+ * Objects already transfered to the vmas list will be unreferenced by
177+ * eb_destroy.
178+ */
179+
168180 return ret;
169181 }
170182
drivers/gpu/drm/i915/i915_gem_gtt.c+7−4
@@ -337,8 +337,8 @@ static void gen8_ppgtt_cleanup(struct i915_address_space *vm) · 336 unmodified lines
337337 kfree(ppgtt->gen8_pt_dma_addr[i]);
338338 }
339339
340− __free_pages(ppgtt->gen8_pt_pages, ppgtt->num_pt_pages << PAGE_SHIFT);
341− __free_pages(ppgtt->pd_pages, ppgtt->num_pd_pages << PAGE_SHIFT);
340+ __free_pages(ppgtt->gen8_pt_pages, get_order(ppgtt->num_pt_pages << PAGE_SHIFT));
341+ __free_pages(ppgtt->pd_pages, get_order(ppgtt->num_pd_pages << PAGE_SHIFT));
342342 }
343343
344344 /**
@@ -906,14 +906,12 @@ static void gen8_ggtt_insert_entries(struct i915_address_space *vm, · 561 unmodified lines
906906 WARN_ON(readq(&gtt_entries[i-1])
907907 != gen8_pte_encode(addr, level, true));
908908
909−#if 0 /* TODO: Still needed on GEN8? */
910909 /* This next bit makes the above posting read even more important. We
911910 * want to flush the TLBs only after we're certain all the PTE updates
912911 * have finished.
913912 */
914913 I915_WRITE(GFX_FLSH_CNTL_GEN6, GFX_FLSH_CNTL_EN);
915914 POSTING_READ(GFX_FLSH_CNTL_GEN6);
916−#endif
917915 }
918916
919917 /*
@@ -1241,6 +1239,11 @@ static inline unsigned int gen8_get_total_gtt_size(u16 bdw_gmch_ctl) · 321 unmodified lines
12411239 bdw_gmch_ctl &= BDW_GMCH_GGMS_MASK;
12421240 if (bdw_gmch_ctl)
12431241 bdw_gmch_ctl = 1 << bdw_gmch_ctl;
1242+ if (bdw_gmch_ctl > 4) {
1243+ WARN_ON(!i915_preliminary_hw_support);
1244+ return 4<<20;
1245+ }
1246+
12441247 return bdw_gmch_ctl << 20;
12451248 }
12461249
drivers/gpu/drm/i915/i915_irq.c+2−0
@@ -2713,6 +2713,8 @@ static void gen8_irq_preinstall(struct drm_device *dev) · 2712 unmodified lines
27132713 #undef GEN8_IRQ_INIT_NDX
27142714
27152715 POSTING_READ(GEN8_PCU_IIR);
2716+
2717+ ibx_irq_preinstall(dev);
27162718 }
27172719
27182720 static void ibx_hpd_irq_setup(struct drm_device *dev)
drivers/gpu/drm/i915/intel_ddi.c+7−1
@@ -1057,12 +1057,18 @@ void intel_ddi_setup_hw_pll_state(struct drm_device *dev) · 1056 unmodified lines
10571057 enum pipe pipe;
10581058 struct intel_crtc *intel_crtc;
10591059
1060+ dev_priv->ddi_plls.spll_refcount = 0;
1061+ dev_priv->ddi_plls.wrpll1_refcount = 0;
1062+ dev_priv->ddi_plls.wrpll2_refcount = 0;
1063+
10601064 for_each_pipe(pipe) {
10611065 intel_crtc =
10621066 to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]);
10631067
1064− if (!intel_crtc->active)
1068+ if (!intel_crtc->active) {
1069+ intel_crtc->ddi_pll_sel = PORT_CLK_SEL_NONE;
10651070 continue;
1071+ }
10661072
10671073 intel_crtc->ddi_pll_sel = intel_ddi_get_crtc_pll(dev_priv,
10681074 pipe);
drivers/gpu/drm/i915/intel_display.c+22−11
@@ -6303,7 +6303,7 @@ static void assert_can_disable_lcpll(struct drm_i915_private *dev_priv) · 6302 unmodified lines
63036303 uint32_t val;
63046304
63056305 list_for_each_entry(crtc, &dev->mode_config.crtc_list, base.head)
6306− WARN(crtc->base.enabled, "CRTC for pipe %c enabled\n",
6306+ WARN(crtc->active, "CRTC for pipe %c enabled\n",
63076307 pipe_name(crtc->pipe));
63086308
63096309 WARN(I915_READ(HSW_PWR_WELL_DRIVER), "Power well on\n");
@@ -9135,7 +9135,7 @@ intel_pipe_config_compare(struct drm_device *dev, · 2825 unmodified lines
91359135 if (IS_G4X(dev) || INTEL_INFO(dev)->gen >= 5)
91369136 PIPE_CONF_CHECK_I(pipe_bpp);
91379137
9138− if (!IS_HASWELL(dev)) {
9138+ if (!HAS_DDI(dev)) {
91399139 PIPE_CONF_CHECK_CLOCK_FUZZY(adjusted_mode.crtc_clock);
91409140 PIPE_CONF_CHECK_CLOCK_FUZZY(port_clock);
91419141 }
@@ -10541,11 +10541,20 @@ static struct intel_quirk intel_quirks[] = { · 1399 unmodified lines
1054110541 /* Sony Vaio Y cannot use SSC on LVDS */
1054210542 { 0x0046, 0x104d, 0x9076, quirk_ssc_force_disable },
1054310543
10544− /*
10545− * All GM45 Acer (and its brands eMachines and Packard Bell) laptops
10546− * seem to use inverted backlight PWM.
10547− */
10548− { 0x2a42, 0x1025, PCI_ANY_ID, quirk_invert_brightness },
10544+ /* Acer Aspire 5734Z must invert backlight brightness */
10545+ { 0x2a42, 0x1025, 0x0459, quirk_invert_brightness },
10546+
10547+ /* Acer/eMachines G725 */
10548+ { 0x2a42, 0x1025, 0x0210, quirk_invert_brightness },
10549+
10550+ /* Acer/eMachines e725 */
10551+ { 0x2a42, 0x1025, 0x0212, quirk_invert_brightness },
10552+
10553+ /* Acer/Packard Bell NCL20 */
10554+ { 0x2a42, 0x1025, 0x034b, quirk_invert_brightness },
10555+
10556+ /* Acer Aspire 4736Z */
10557+ { 0x2a42, 0x1025, 0x0260, quirk_invert_brightness },
1054910558
1055010559 /* Dell XPS13 HD Sandy Bridge */
1055110560 { 0x0116, 0x1028, 0x052e, quirk_no_pcm_pwm_enable },
@@ -11036,8 +11045,6 @@ void intel_modeset_setup_hw_state(struct drm_device *dev, · 484 unmodified lines
1103611045 }
1103711046
1103811047 intel_modeset_check_state(dev);
11039−
11040− drm_mode_config_reset(dev);
1104111048 }
1104211049
1104311050 void intel_modeset_gem_init(struct drm_device *dev)
@@ -11046,7 +11053,10 @@ void intel_modeset_gem_init(struct drm_device *dev) · 2 unmodified lines
1104611053
1104711054 intel_setup_overlay(dev);
1104811055
11056+ mutex_lock(&dev->mode_config.mutex);
11057+ drm_mode_config_reset(dev);
1104911058 intel_modeset_setup_hw_state(dev, false);
11059+ mutex_unlock(&dev->mode_config.mutex);
1105011060 }
1105111061
1105211062 void intel_modeset_cleanup(struct drm_device *dev)
@@ -11125,14 +11135,15 @@ void intel_connector_attach_encoder(struct intel_connector *connector, · 72 unmodified lines
1112511135 int intel_modeset_vga_set_state(struct drm_device *dev, bool state)
1112611136 {
1112711137 struct drm_i915_private *dev_priv = dev->dev_private;
11138+ unsigned reg = INTEL_INFO(dev)->gen >= 6 ? SNB_GMCH_CTRL : INTEL_GMCH_CTRL;
1112811139 u16 gmch_ctrl;
1112911140
11130− pci_read_config_word(dev_priv->bridge_dev, INTEL_GMCH_CTRL, &gmch_ctrl);
11141+ pci_read_config_word(dev_priv->bridge_dev, reg, &gmch_ctrl);
1113111142 if (state)
1113211143 gmch_ctrl &= ~INTEL_GMCH_VGA_DISABLE;
1113311144 else
1113411145 gmch_ctrl |= INTEL_GMCH_VGA_DISABLE;
11135− pci_write_config_word(dev_priv->bridge_dev, INTEL_GMCH_CTRL, gmch_ctrl);
11146+ pci_write_config_word(dev_priv->bridge_dev, reg, gmch_ctrl);
1113611147 return 0;
1113711148 }
1113811149
drivers/gpu/drm/i915/intel_drv.h+1−0
@@ -821,6 +821,7 @@ void intel_update_sprite_watermarks(struct drm_plane *plane, · 820 unmodified lines
821821 uint32_t sprite_width, int pixel_size,
822822 bool enabled, bool scaled);
823823 void intel_init_pm(struct drm_device *dev);
824+void intel_pm_setup(struct drm_device *dev);
824825 bool intel_fbc_enabled(struct drm_device *dev);
825826 void intel_update_fbc(struct drm_device *dev);
826827 void intel_gpu_ips_init(struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/intel_panel.c+23−3
@@ -451,7 +451,9 @@ static u32 intel_panel_get_backlight(struct drm_device *dev, · 450 unmodified lines
451451
452452 spin_lock_irqsave(&dev_priv->backlight.lock, flags);
453453
454− if (HAS_PCH_SPLIT(dev)) {
454+ if (IS_BROADWELL(dev)) {
455+ val = I915_READ(BLC_PWM_PCH_CTL2) & BACKLIGHT_DUTY_CYCLE_MASK;
456+ } else if (HAS_PCH_SPLIT(dev)) {
455457 val = I915_READ(BLC_PWM_CPU_CTL) & BACKLIGHT_DUTY_CYCLE_MASK;
456458 } else {
457459 if (IS_VALLEYVIEW(dev))
@@ -479,6 +481,13 @@ static u32 intel_panel_get_backlight(struct drm_device *dev, · 21 unmodified lines
479481 return val;
480482 }
481483
484+static void intel_bdw_panel_set_backlight(struct drm_device *dev, u32 level)
485+{
486+ struct drm_i915_private *dev_priv = dev->dev_private;
487+ u32 val = I915_READ(BLC_PWM_PCH_CTL2) & ~BACKLIGHT_DUTY_CYCLE_MASK;
488+ I915_WRITE(BLC_PWM_PCH_CTL2, val | level);
489+}
490+
482491 static void intel_pch_panel_set_backlight(struct drm_device *dev, u32 level)
483492 {
484493 struct drm_i915_private *dev_priv = dev->dev_private;
@@ -496,7 +505,9 @@ static void intel_panel_actually_set_backlight(struct drm_device *dev, · 11 unmodified lines
496505 DRM_DEBUG_DRIVER("set backlight PWM = %d\n", level);
497506 level = intel_panel_compute_brightness(dev, pipe, level);
498507
499− if (HAS_PCH_SPLIT(dev))
508+ if (IS_BROADWELL(dev))
509+ return intel_bdw_panel_set_backlight(dev, level);
510+ else if (HAS_PCH_SPLIT(dev))
500511 return intel_pch_panel_set_backlight(dev, level);
501512
502513 if (is_backlight_combination_mode(dev)) {
@@ -666,7 +677,16 @@ void intel_panel_enable_backlight(struct intel_connector *connector) · 163 unmodified lines
666677 POSTING_READ(reg);
667678 I915_WRITE(reg, tmp | BLM_PWM_ENABLE);
668679
669− if (HAS_PCH_SPLIT(dev) &&
680+ if (IS_BROADWELL(dev)) {
681+ /*
682+ * Broadwell requires PCH override to drive the PCH
683+ * backlight pin. The above will configure the CPU
684+ * backlight pin, which we don't plan to use.
685+ */
686+ tmp = I915_READ(BLC_PWM_PCH_CTL1);
687+ tmp |= BLM_PCH_OVERRIDE_ENABLE | BLM_PCH_PWM_ENABLE;
688+ I915_WRITE(BLC_PWM_PCH_CTL1, tmp);
689+ } else if (HAS_PCH_SPLIT(dev) &&
670690 !(dev_priv->quirks & QUIRK_NO_PCH_PWM_ENABLE)) {
671691 tmp = I915_READ(BLC_PWM_PCH_CTL1);
672692 tmp |= BLM_PCH_PWM_ENABLE;
drivers/gpu/drm/i915/intel_pm.c+39−4
@@ -5685,8 +5685,11 @@ static void __intel_set_power_well(struct drm_device *dev, bool enable) · 5684 unmodified lines
56855685 {
56865686 struct drm_i915_private *dev_priv = dev->dev_private;
56875687 bool is_enabled, enable_requested;
5688+ unsigned long irqflags;
56885689 uint32_t tmp;
56895690
5691+ WARN_ON(dev_priv->pc8.enabled);
5692+
56905693 tmp = I915_READ(HSW_PWR_WELL_DRIVER);
56915694 is_enabled = tmp & HSW_PWR_WELL_STATE_ENABLED;
56925695 enable_requested = tmp & HSW_PWR_WELL_ENABLE_REQUEST;
@@ -5702,9 +5705,24 @@ static void __intel_set_power_well(struct drm_device *dev, bool enable) · 9 unmodified lines
57025705 HSW_PWR_WELL_STATE_ENABLED), 20))
57035706 DRM_ERROR("Timeout enabling power well\n");
57045707 }
5708+
5709+ if (IS_BROADWELL(dev)) {
5710+ spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
5711+ I915_WRITE(GEN8_DE_PIPE_IMR(PIPE_B),
5712+ dev_priv->de_irq_mask[PIPE_B]);
5713+ I915_WRITE(GEN8_DE_PIPE_IER(PIPE_B),
5714+ ~dev_priv->de_irq_mask[PIPE_B] |
5715+ GEN8_PIPE_VBLANK);
5716+ I915_WRITE(GEN8_DE_PIPE_IMR(PIPE_C),
5717+ dev_priv->de_irq_mask[PIPE_C]);
5718+ I915_WRITE(GEN8_DE_PIPE_IER(PIPE_C),
5719+ ~dev_priv->de_irq_mask[PIPE_C] |
5720+ GEN8_PIPE_VBLANK);
5721+ POSTING_READ(GEN8_DE_PIPE_IER(PIPE_C));
5722+ spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
5723+ }
57055724 } else {
57065725 if (enable_requested) {
5707− unsigned long irqflags;
57085726 enum pipe p;
57095727
57105728 I915_WRITE(HSW_PWR_WELL_DRIVER, 0);
@@ -5731,16 +5749,24 @@ static void __intel_set_power_well(struct drm_device *dev, bool enable) · 20 unmodified lines
57315749 static void __intel_power_well_get(struct drm_device *dev,
57325750 struct i915_power_well *power_well)
57335751 {
5734− if (!power_well->count++)
5752+ struct drm_i915_private *dev_priv = dev->dev_private;
5753+
5754+ if (!power_well->count++) {
5755+ hsw_disable_package_c8(dev_priv);
57355756 __intel_set_power_well(dev, true);
5757+ }
57365758 }
57375759
57385760 static void __intel_power_well_put(struct drm_device *dev,
57395761 struct i915_power_well *power_well)
57405762 {
5763+ struct drm_i915_private *dev_priv = dev->dev_private;
5764+
57415765 WARN_ON(!power_well->count);
5742− if (!--power_well->count && i915_disable_power_well)
5766+ if (!--power_well->count && i915_disable_power_well) {
57435767 __intel_set_power_well(dev, false);
5768+ hsw_enable_package_c8(dev_priv);
5769+ }
57445770 }
57455771
57465772 void intel_display_power_get(struct drm_device *dev,
@@ -6130,10 +6156,19 @@ int vlv_freq_opcode(int ddr_freq, int val) · 383 unmodified lines
61306156 return val;
61316157 }
61326158
6133−void intel_pm_init(struct drm_device *dev)
6159+void intel_pm_setup(struct drm_device *dev)
61346160 {
61356161 struct drm_i915_private *dev_priv = dev->dev_private;
61366162
6163+ mutex_init(&dev_priv->rps.hw_lock);
6164+
6165+ mutex_init(&dev_priv->pc8.lock);
6166+ dev_priv->pc8.requirements_met = false;
6167+ dev_priv->pc8.gpu_idle = false;
6168+ dev_priv->pc8.irqs_disabled = false;
6169+ dev_priv->pc8.enabled = false;
6170+ dev_priv->pc8.disable_count = 2; /* requirements_met + gpu_idle */
6171+ INIT_DELAYED_WORK(&dev_priv->pc8.enable_work, hsw_enable_pc8_work);
61376172 INIT_DELAYED_WORK(&dev_priv->rps.delayed_resume_work,
61386173 intel_gen6_powersave_work);
61396174 }
drivers/gpu/drm/i915/intel_ringbuffer.c+1−0
@@ -965,6 +965,7 @@ void intel_ring_setup_status_page(struct intel_ring_buffer *ring) · 964 unmodified lines
965965 } else if (IS_GEN6(ring->dev)) {
966966 mmio = RING_HWS_PGA_GEN6(ring->mmio_base);
967967 } else {
968+ /* XXX: gen8 returns to sanity */
968969 mmio = RING_HWS_PGA(ring->mmio_base);
969970 }
970971
drivers/gpu/drm/i915/intel_uncore.c+1−0
@@ -784,6 +784,7 @@ static int gen6_do_reset(struct drm_device *dev) · 783 unmodified lines
784784 int intel_gpu_reset(struct drm_device *dev)
785785 {
786786 switch (INTEL_INFO(dev)->gen) {
787+ case 8:
787788 case 7:
788789 case 6: return gen6_do_reset(dev);
789790 case 5: return ironlake_do_reset(dev);
drivers/gpu/drm/nouveau/core/core/subdev.c+0−3
@@ -104,11 +104,8 @@ nouveau_subdev_create_(struct nouveau_object *parent, · 103 unmodified lines
104104
105105 if (parent) {
106106 struct nouveau_device *device = nv_device(parent);
107− int subidx = nv_hclass(subdev) & 0xff;
108−
109107 subdev->debug = nouveau_dbgopt(device->dbgopt, subname);
110108 subdev->mmio = nv_subdev(device)->mmio;
111− device->subdev[subidx] = *pobject;
112109 }
113110
114111 return 0;
drivers/gpu/drm/nouveau/core/engine/device/base.c+2−0
@@ -268,6 +268,8 @@ nouveau_devobj_ctor(struct nouveau_object *parent, · 267 unmodified lines
268268 if (ret)
269269 return ret;
270270
271+ device->subdev[i] = devobj->subdev[i];
272+
271273 /* note: can't init *any* subdevs until devinit has been run
272274 * due to not knowing exactly what the vbios init tables will
273275 * mess with. devinit also can't be run until all of its
drivers/gpu/drm/nouveau/core/engine/device/nvc0.c+1−1
@@ -161,7 +161,7 @@ nvc0_identify(struct nouveau_device *device) · 160 unmodified lines
161161 device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
162162 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
163163 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nvc0_devinit_oclass;
164− device->oclass[NVDEV_SUBDEV_MC ] = nvc3_mc_oclass;
164+ device->oclass[NVDEV_SUBDEV_MC ] = nvc0_mc_oclass;
165165 device->oclass[NVDEV_SUBDEV_BUS ] = nvc0_bus_oclass;
166166 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
167167 device->oclass[NVDEV_SUBDEV_FB ] = nvc0_fb_oclass;
drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c+1−1
@@ -334,7 +334,7 @@ nvc0_graph_mthd(struct nvc0_graph_priv *priv, struct nvc0_graph_mthd *mthds) · 333 unmodified lines
334334 while ((mthd = &mthds[i++]) && (init = mthd->init)) {
335335 u32 addr = 0x80000000 | mthd->oclass;
336336 for (data = 0; init->count; init++) {
337− if (data != init->data) {
337+ if (init == mthd->init || data != init->data) {
338338 nv_wr32(priv, 0x40448c, init->data);
339339 data = init->data;
340340 }
drivers/gpu/drm/nouveau/core/include/subdev/fb.h+5−0
@@ -75,6 +75,11 @@ struct nouveau_fb { · 74 unmodified lines
7575 static inline struct nouveau_fb *
7676 nouveau_fb(void *obj)
7777 {
78+ /* fbram uses this before device subdev pointer is valid */
79+ if (nv_iclass(obj, NV_SUBDEV_CLASS) &&
80+ nv_subidx(obj) == NVDEV_SUBDEV_FB)
81+ return obj;
82+
7883 return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_FB];
7984 }
8085
drivers/gpu/drm/nouveau/core/include/subdev/i2c.h+1−1
@@ -73,7 +73,7 @@ struct nouveau_i2c { · 72 unmodified lines
7373 int (*identify)(struct nouveau_i2c *, int index,
7474 const char *what, struct nouveau_i2c_board_info *,
7575 bool (*match)(struct nouveau_i2c_port *,
76− struct i2c_board_info *));
76+ struct i2c_board_info *, void *), void *);
7777 struct list_head ports;
7878 };
7979
drivers/gpu/drm/nouveau/core/include/subdev/instmem.h+7−0
@@ -50,6 +50,13 @@ struct nouveau_instmem { · 49 unmodified lines
5050 static inline struct nouveau_instmem *
5151 nouveau_instmem(void *obj)
5252 {
53+ /* nv04/nv40 impls need to create objects in their constructor,
54+ * which is before the subdev pointer is valid
55+ */
56+ if (nv_iclass(obj, NV_SUBDEV_CLASS) &&
57+ nv_subidx(obj) == NVDEV_SUBDEV_INSTMEM)
58+ return obj;
59+
5360 return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_INSTMEM];
5461 }
5562
drivers/gpu/drm/nouveau/core/subdev/bios/init.c+9−5
@@ -365,13 +365,13 @@ static u16 · 364 unmodified lines
365365 init_script(struct nouveau_bios *bios, int index)
366366 {
367367 struct nvbios_init init = { .bios = bios };
368− u16 data;
368+ u16 bmp_ver = bmp_version(bios), data;
369369
370− if (bmp_version(bios) && bmp_version(bios) < 0x0510) {
371− if (index > 1)
370+ if (bmp_ver && bmp_ver < 0x0510) {
371+ if (index > 1 || bmp_ver < 0x0100)
372372 return 0x0000;
373373
374− data = bios->bmp_offset + (bios->version.major < 2 ? 14 : 18);
374+ data = bios->bmp_offset + (bmp_ver < 0x0200 ? 14 : 18);
375375 return nv_ro16(bios, data + (index * 2));
376376 }
377377
@@ -1294,7 +1294,11 @@ init_jump(struct nvbios_init *init) · 916 unmodified lines
12941294 u16 offset = nv_ro16(bios, init->offset + 1);
12951295
12961296 trace("JUMP\t0x%04x\n", offset);
1297− init->offset = offset;
1297+
1298+ if (init_exec(init))
1299+ init->offset = offset;
1300+ else
1301+ init->offset += 3;
12981302 }
12991303
13001304 /**
drivers/gpu/drm/nouveau/core/subdev/i2c/base.c+2−2
@@ -197,7 +197,7 @@ static int · 196 unmodified lines
197197 nouveau_i2c_identify(struct nouveau_i2c *i2c, int index, const char *what,
198198 struct nouveau_i2c_board_info *info,
199199 bool (*match)(struct nouveau_i2c_port *,
200− struct i2c_board_info *))
200+ struct i2c_board_info *, void *), void *data)
201201 {
202202 struct nouveau_i2c_port *port = nouveau_i2c_find(i2c, index);
203203 int i;
@@ -221,7 +221,7 @@ nouveau_i2c_identify(struct nouveau_i2c *i2c, int index, const char *what, · 17 unmodified lines
221221 }
222222
223223 if (nv_probe_i2c(port, info[i].dev.addr) &&
224− (!match || match(port, &info[i].dev))) {
224+ (!match || match(port, &info[i].dev, data))) {
225225 nv_info(i2c, "detected %s: %s\n", what,
226226 info[i].dev.type);
227227 return i;
drivers/gpu/drm/nouveau/core/subdev/therm/ic.c+5−5
@@ -29,9 +29,9 @@ · 28 unmodified lines
2929
3030 static bool
3131 probe_monitoring_device(struct nouveau_i2c_port *i2c,
32− struct i2c_board_info *info)
32+ struct i2c_board_info *info, void *data)
3333 {
34− struct nouveau_therm_priv *priv = (void *)nouveau_therm(i2c);
34+ struct nouveau_therm_priv *priv = data;
3535 struct nvbios_therm_sensor *sensor = &priv->bios_sensor;
3636 struct i2c_client *client;
3737
@@ -96,7 +96,7 @@ nouveau_therm_ic_ctor(struct nouveau_therm *therm) · 58 unmodified lines
9696 };
9797
9898 i2c->identify(i2c, NV_I2C_DEFAULT(0), "monitoring device",
99− board, probe_monitoring_device);
99+ board, probe_monitoring_device, therm);
100100 if (priv->ic)
101101 return;
102102 }
@@ -108,7 +108,7 @@ nouveau_therm_ic_ctor(struct nouveau_therm *therm) · 5 unmodified lines
108108 };
109109
110110 i2c->identify(i2c, NV_I2C_DEFAULT(0), "monitoring device",
111− board, probe_monitoring_device);
111+ board, probe_monitoring_device, therm);
112112 if (priv->ic)
113113 return;
114114 }
@@ -117,5 +117,5 @@ nouveau_therm_ic_ctor(struct nouveau_therm *therm) · 2 unmodified lines
117117 device. Let's try our static list.
118118 */
119119 i2c->identify(i2c, NV_I2C_DEFAULT(0), "monitoring device",
120− nv_board_infos, probe_monitoring_device);
120+ nv_board_infos, probe_monitoring_device, therm);
121121 }
drivers/gpu/drm/nouveau/dispnv04/dfp.c+1−1
@@ -643,7 +643,7 @@ static void nv04_tmds_slave_init(struct drm_encoder *encoder) · 642 unmodified lines
643643 get_tmds_slave(encoder))
644644 return;
645645
646− type = i2c->identify(i2c, 2, "TMDS transmitter", info, NULL);
646+ type = i2c->identify(i2c, 2, "TMDS transmitter", info, NULL, NULL);
647647 if (type < 0)
648648 return;
649649
drivers/gpu/drm/nouveau/dispnv04/tvnv04.c+1−1
@@ -59,7 +59,7 @@ int nv04_tv_identify(struct drm_device *dev, int i2c_index) · 58 unmodified lines
5959 struct nouveau_i2c *i2c = nouveau_i2c(drm->device);
6060
6161 return i2c->identify(i2c, i2c_index, "TV encoder",
62− nv04_tv_encoder_info, NULL);
62+ nv04_tv_encoder_info, NULL, NULL);
6363 }
6464
6565
drivers/gpu/drm/nouveau/nouveau_abi16.c+2−0
@@ -447,6 +447,8 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS) · 446 unmodified lines
447447 if (ret)
448448 goto done;
449449
450+ info->offset = ntfy->node->offset;
451+
450452 done:
451453 if (ret)
452454 nouveau_abi16_ntfy_fini(chan, ntfy);
drivers/gpu/drm/nouveau/nouveau_acpi.c+14−2
@@ -51,6 +51,7 @@ static struct nouveau_dsm_priv { · 50 unmodified lines
5151 bool dsm_detected;
5252 bool optimus_detected;
5353 acpi_handle dhandle;
54+ acpi_handle other_handle;
5455 acpi_handle rom_handle;
5556 } nouveau_dsm_priv;
5657
@@ -260,9 +261,10 @@ static int nouveau_dsm_pci_probe(struct pci_dev *pdev) · 203 unmodified lines
260261 if (!dhandle)
261262 return false;
262263
263− if (!acpi_has_method(dhandle, "_DSM"))
264+ if (!acpi_has_method(dhandle, "_DSM")) {
265+ nouveau_dsm_priv.other_handle = dhandle;
264266 return false;
265−
267+ }
266268 if (nouveau_test_dsm(dhandle, nouveau_dsm, NOUVEAU_DSM_POWER))
267269 retval |= NOUVEAU_DSM_HAS_MUX;
268270
@@ -338,6 +340,16 @@ static bool nouveau_dsm_detect(void) · 69 unmodified lines
338340 printk(KERN_INFO "VGA switcheroo: detected DSM switching method %s handle\n",
339341 acpi_method_name);
340342 nouveau_dsm_priv.dsm_detected = true;
343+ /*
344+ * On some systems hotplug events are generated for the device
345+ * being switched off when _DSM is executed. They cause ACPI
346+ * hotplug to trigger and attempt to remove the device from
347+ * the system, which causes it to break down. Prevent that from
348+ * happening by setting the no_hotplug flag for the involved
349+ * ACPI device objects.
350+ */
351+ acpi_bus_no_hotplug(nouveau_dsm_priv.dhandle);
352+ acpi_bus_no_hotplug(nouveau_dsm_priv.other_handle);
341353 ret = true;
342354 }
343355
drivers/gpu/drm/nouveau/nouveau_display.c+1−1
@@ -610,7 +610,7 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, · 609 unmodified lines
610610 ret = nouveau_fence_sync(fence, chan);
611611 nouveau_fence_unref(&fence);
612612 if (ret)
613− return ret;
613+ goto fail_free;
614614
615615 if (new_bo != old_bo) {
616616 ret = nouveau_bo_pin(new_bo, TTM_PL_FLAG_VRAM);
drivers/gpu/drm/nouveau/nouveau_drm.c+6−0
@@ -858,6 +858,12 @@ static int nouveau_pmops_runtime_suspend(struct device *dev) · 857 unmodified lines
858858 if (nouveau_runtime_pm == 0)
859859 return -EINVAL;
860860
861+ /* are we optimus enabled? */
862+ if (nouveau_runtime_pm == -1 && !nouveau_is_optimus() && !nouveau_is_v1_dsm()) {
863+ DRM_DEBUG_DRIVER("failing to power off - not optimus\n");
864+ return -EINVAL;
865+ }
866+
861867 nv_debug_level(SILENT);
862868 drm_kms_helper_poll_disable(drm_dev);
863869 vga_switcheroo_set_dynamic_switch(pdev, VGA_SWITCHEROO_OFF);
drivers/gpu/drm/qxl/Kconfig+1−0
@@ -8,5 +8,6 @@ config DRM_QXL · 7 unmodified lines
88 select DRM_KMS_HELPER
99 select DRM_KMS_FB_HELPER
1010 select DRM_TTM
11+ select CRC32
1112 help
1213 QXL virtual GPU for Spice virtualization desktop integration. Do not enable this driver unless your distro ships a corresponding X.org QXL driver that can handle kernel modesetting.
drivers/gpu/drm/qxl/qxl_display.c+1−1
@@ -24,7 +24,7 @@ · 23 unmodified lines
2424 */
2525
2626
27−#include "linux/crc32.h"
27+#include <linux/crc32.h>
2828
2929 #include "qxl_drv.h"
3030 #include "qxl_object.h"
drivers/gpu/drm/radeon/atombios_crtc.c+52−35
@@ -1143,31 +1143,53 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, · 1142 unmodified lines
11431143 }
11441144
11451145 if (tiling_flags & RADEON_TILING_MACRO) {
1146− if (rdev->family >= CHIP_BONAIRE)
1147− tmp = rdev->config.cik.tile_config;
1148− else if (rdev->family >= CHIP_TAHITI)
1149− tmp = rdev->config.si.tile_config;
1150− else if (rdev->family >= CHIP_CAYMAN)
1151− tmp = rdev->config.cayman.tile_config;
1152− else
1153− tmp = rdev->config.evergreen.tile_config;
1146+ evergreen_tiling_fields(tiling_flags, &bankw, &bankh, &mtaspect, &tile_split);
11541147
1155− switch ((tmp & 0xf0) >> 4) {
1156− case 0: /* 4 banks */
1157− fb_format |= EVERGREEN_GRPH_NUM_BANKS(EVERGREEN_ADDR_SURF_4_BANK);
1158− break;
1159− case 1: /* 8 banks */
1160− default:
1161− fb_format |= EVERGREEN_GRPH_NUM_BANKS(EVERGREEN_ADDR_SURF_8_BANK);
1162− break;
1163− case 2: /* 16 banks */
1164− fb_format |= EVERGREEN_GRPH_NUM_BANKS(EVERGREEN_ADDR_SURF_16_BANK);
1165− break;
1148+ /* Set NUM_BANKS. */
1149+ if (rdev->family >= CHIP_BONAIRE) {
1150+ unsigned tileb, index, num_banks, tile_split_bytes;
1151+
1152+ /* Calculate the macrotile mode index. */
1153+ tile_split_bytes = 64 << tile_split;
1154+ tileb = 8 * 8 * target_fb->bits_per_pixel / 8;
1155+ tileb = min(tile_split_bytes, tileb);
1156+
1157+ for (index = 0; tileb > 64; index++) {
1158+ tileb >>= 1;
1159+ }
1160+
1161+ if (index >= 16) {
1162+ DRM_ERROR("Wrong screen bpp (%u) or tile split (%u)\n",
1163+ target_fb->bits_per_pixel, tile_split);
1164+ return -EINVAL;
1165+ }
1166+
1167+ num_banks = (rdev->config.cik.macrotile_mode_array[index] >> 6) & 0x3;
1168+ fb_format |= EVERGREEN_GRPH_NUM_BANKS(num_banks);
1169+ } else {
1170+ /* SI and older. */
1171+ if (rdev->family >= CHIP_TAHITI)
1172+ tmp = rdev->config.si.tile_config;
1173+ else if (rdev->family >= CHIP_CAYMAN)
1174+ tmp = rdev->config.cayman.tile_config;
1175+ else
1176+ tmp = rdev->config.evergreen.tile_config;
1177+
1178+ switch ((tmp & 0xf0) >> 4) {
1179+ case 0: /* 4 banks */
1180+ fb_format |= EVERGREEN_GRPH_NUM_BANKS(EVERGREEN_ADDR_SURF_4_BANK);
1181+ break;
1182+ case 1: /* 8 banks */
1183+ default:
1184+ fb_format |= EVERGREEN_GRPH_NUM_BANKS(EVERGREEN_ADDR_SURF_8_BANK);
1185+ break;
1186+ case 2: /* 16 banks */
1187+ fb_format |= EVERGREEN_GRPH_NUM_BANKS(EVERGREEN_ADDR_SURF_16_BANK);
1188+ break;
1189+ }
11661190 }
11671191
11681192 fb_format |= EVERGREEN_GRPH_ARRAY_MODE(EVERGREEN_GRPH_ARRAY_2D_TILED_THIN1);
1169−
1170− evergreen_tiling_fields(tiling_flags, &bankw, &bankh, &mtaspect, &tile_split);
11711193 fb_format |= EVERGREEN_GRPH_TILE_SPLIT(tile_split);
11721194 fb_format |= EVERGREEN_GRPH_BANK_WIDTH(bankw);
11731195 fb_format |= EVERGREEN_GRPH_BANK_HEIGHT(bankh);
@@ -1180,23 +1202,18 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, · 6 unmodified lines
11801202 fb_format |= EVERGREEN_GRPH_ARRAY_MODE(EVERGREEN_GRPH_ARRAY_1D_TILED_THIN1);
11811203
11821204 if (rdev->family >= CHIP_BONAIRE) {
1183− u32 num_pipe_configs = rdev->config.cik.max_tile_pipes;
1184− u32 num_rb = rdev->config.cik.max_backends_per_se;
1185− if (num_pipe_configs > 8)
1186− num_pipe_configs = 8;
1187− if (num_pipe_configs == 8)
1188− fb_format |= CIK_GRPH_PIPE_CONFIG(CIK_ADDR_SURF_P8_32x32_16x16);
1189− else if (num_pipe_configs == 4) {
1190− if (num_rb == 4)
1191− fb_format |= CIK_GRPH_PIPE_CONFIG(CIK_ADDR_SURF_P4_16x16);
1192− else if (num_rb < 4)
1193− fb_format |= CIK_GRPH_PIPE_CONFIG(CIK_ADDR_SURF_P4_8x16);
1194− } else if (num_pipe_configs == 2)
1195− fb_format |= CIK_GRPH_PIPE_CONFIG(CIK_ADDR_SURF_P2);
1205+ /* Read the pipe config from the 2D TILED SCANOUT mode.
1206+ * It should be the same for the other modes too, but not all
1207+ * modes set the pipe config field. */
1208+ u32 pipe_config = (rdev->config.cik.tile_mode_array[10] >> 6) & 0x1f;
1209+
1210+ fb_format |= CIK_GRPH_PIPE_CONFIG(pipe_config);
11961211 } else if ((rdev->family == CHIP_TAHITI) ||
11971212 (rdev->family == CHIP_PITCAIRN))
11981213 fb_format |= SI_GRPH_PIPE_CONFIG(SI_ADDR_SURF_P8_32x32_8x16);
1199− else if (rdev->family == CHIP_VERDE)
1214+ else if ((rdev->family == CHIP_VERDE) ||
1215+ (rdev->family == CHIP_OLAND) ||
1216+ (rdev->family == CHIP_HAINAN)) /* for completeness. HAINAN has no display hw */
12001217 fb_format |= SI_GRPH_PIPE_CONFIG(SI_ADDR_SURF_P4_8x16);
12011218
12021219 switch (radeon_crtc->crtc_id) {
drivers/gpu/drm/radeon/cik.c+7−5
@@ -3057,7 +3057,7 @@ static u32 cik_create_bitmask(u32 bit_width) · 3056 unmodified lines
30573057 * Returns the disabled RB bitmask.
30583058 */
30593059 static u32 cik_get_rb_disabled(struct radeon_device *rdev,
3060− u32 max_rb_num, u32 se_num,
3060+ u32 max_rb_num_per_se,
30613061 u32 sh_per_se)
30623062 {
30633063 u32 data, mask;
@@ -3071,7 +3071,7 @@ static u32 cik_get_rb_disabled(struct radeon_device *rdev, · 7 unmodified lines
30713071
30723072 data >>= BACKEND_DISABLE_SHIFT;
30733073
3074− mask = cik_create_bitmask(max_rb_num / se_num / sh_per_se);
3074+ mask = cik_create_bitmask(max_rb_num_per_se / sh_per_se);
30753075
30763076 return data & mask;
30773077 }
@@ -3088,7 +3088,7 @@ static u32 cik_get_rb_disabled(struct radeon_device *rdev, · 10 unmodified lines
30883088 */
30893089 static void cik_setup_rb(struct radeon_device *rdev,
30903090 u32 se_num, u32 sh_per_se,
3091− u32 max_rb_num)
3091+ u32 max_rb_num_per_se)
30923092 {
30933093 int i, j;
30943094 u32 data, mask;
@@ -3098,7 +3098,7 @@ static void cik_setup_rb(struct radeon_device *rdev, · 3 unmodified lines
30983098 for (i = 0; i < se_num; i++) {
30993099 for (j = 0; j < sh_per_se; j++) {
31003100 cik_select_se_sh(rdev, i, j);
3101− data = cik_get_rb_disabled(rdev, max_rb_num, se_num, sh_per_se);
3101+ data = cik_get_rb_disabled(rdev, max_rb_num_per_se, sh_per_se);
31023102 if (rdev->family == CHIP_HAWAII)
31033103 disabled_rbs |= data << ((i * sh_per_se + j) * HAWAII_RB_BITMAP_WIDTH_PER_SH);
31043104 else
@@ -3108,12 +3108,14 @@ static void cik_setup_rb(struct radeon_device *rdev, · 3 unmodified lines
31083108 cik_select_se_sh(rdev, 0xffffffff, 0xffffffff);
31093109
31103110 mask = 1;
3111− for (i = 0; i < max_rb_num; i++) {
3111+ for (i = 0; i < max_rb_num_per_se * se_num; i++) {
31123112 if (!(disabled_rbs & mask))
31133113 enabled_rbs |= mask;
31143114 mask <<= 1;
31153115 }
31163116
3117+ rdev->config.cik.backend_enable_mask = enabled_rbs;
3118+
31173119 for (i = 0; i < se_num; i++) {
31183120 cik_select_se_sh(rdev, i, 0xffffffff);
31193121 data = 0;
drivers/gpu/drm/radeon/cik_sdma.c+1−1
@@ -458,7 +458,7 @@ int cik_copy_dma(struct radeon_device *rdev, · 457 unmodified lines
458458 radeon_ring_write(ring, 0); /* src/dst endian swap */
459459 radeon_ring_write(ring, src_offset & 0xffffffff);
460460 radeon_ring_write(ring, upper_32_bits(src_offset) & 0xffffffff);
461− radeon_ring_write(ring, dst_offset & 0xfffffffc);
461+ radeon_ring_write(ring, dst_offset & 0xffffffff);
462462 radeon_ring_write(ring, upper_32_bits(dst_offset) & 0xffffffff);
463463 src_offset += cur_size_in_bytes;
464464 dst_offset += cur_size_in_bytes;
drivers/gpu/drm/radeon/dce6_afmt.c+5−3
@@ -174,7 +174,7 @@ void dce6_afmt_write_speaker_allocation(struct drm_encoder *encoder) · 173 unmodified lines
174174 }
175175
176176 sad_count = drm_edid_to_speaker_allocation(radeon_connector->edid, &sadb);
177− if (sad_count < 0) {
177+ if (sad_count <= 0) {
178178 DRM_ERROR("Couldn't read Speaker Allocation Data Block: %d\n", sad_count);
179179 return;
180180 }
@@ -235,7 +235,7 @@ void dce6_afmt_write_sad_regs(struct drm_encoder *encoder) · 54 unmodified lines
235235 }
236236
237237 sad_count = drm_edid_to_sad(radeon_connector->edid, &sads);
238− if (sad_count < 0) {
238+ if (sad_count <= 0) {
239239 DRM_ERROR("Couldn't read SADs: %d\n", sad_count);
240240 return;
241241 }
@@ -308,7 +308,9 @@ int dce6_audio_init(struct radeon_device *rdev) · 66 unmodified lines
308308 rdev->audio.enabled = true;
309309
310310 if (ASIC_IS_DCE8(rdev))
311− rdev->audio.num_pins = 7;
311+ rdev->audio.num_pins = 6;
312+ else if (ASIC_IS_DCE61(rdev))
313+ rdev->audio.num_pins = 4;
312314 else
313315 rdev->audio.num_pins = 6;
314316
drivers/gpu/drm/radeon/evergreen_hdmi.c+2−2
@@ -118,7 +118,7 @@ static void dce4_afmt_write_speaker_allocation(struct drm_encoder *encoder) · 117 unmodified lines
118118 }
119119
120120 sad_count = drm_edid_to_speaker_allocation(radeon_connector->edid, &sadb);
121− if (sad_count < 0) {
121+ if (sad_count <= 0) {
122122 DRM_ERROR("Couldn't read Speaker Allocation Data Block: %d\n", sad_count);
123123 return;
124124 }
@@ -173,7 +173,7 @@ static void evergreen_hdmi_write_sad_regs(struct drm_encoder *encoder) · 48 unmodified lines
173173 }
174174
175175 sad_count = drm_edid_to_sad(radeon_connector->edid, &sads);
176− if (sad_count < 0) {
176+ if (sad_count <= 0) {
177177 DRM_ERROR("Couldn't read SADs: %d\n", sad_count);
178178 return;
179179 }
drivers/gpu/drm/radeon/ni.c+16−4
@@ -895,6 +895,10 @@ static void cayman_gpu_init(struct radeon_device *rdev) · 894 unmodified lines
895895 (rdev->pdev->device == 0x999C)) {
896896 rdev->config.cayman.max_simds_per_se = 6;
897897 rdev->config.cayman.max_backends_per_se = 2;
898+ rdev->config.cayman.max_hw_contexts = 8;
899+ rdev->config.cayman.sx_max_export_size = 256;
900+ rdev->config.cayman.sx_max_export_pos_size = 64;
901+ rdev->config.cayman.sx_max_export_smx_size = 192;
898902 } else if ((rdev->pdev->device == 0x9903) ||
899903 (rdev->pdev->device == 0x9904) ||
900904 (rdev->pdev->device == 0x990A) ||
@@ -905,6 +909,10 @@ static void cayman_gpu_init(struct radeon_device *rdev) · 4 unmodified lines
905909 (rdev->pdev->device == 0x999D)) {
906910 rdev->config.cayman.max_simds_per_se = 4;
907911 rdev->config.cayman.max_backends_per_se = 2;
912+ rdev->config.cayman.max_hw_contexts = 8;
913+ rdev->config.cayman.sx_max_export_size = 256;
914+ rdev->config.cayman.sx_max_export_pos_size = 64;
915+ rdev->config.cayman.sx_max_export_smx_size = 192;
908916 } else if ((rdev->pdev->device == 0x9919) ||
909917 (rdev->pdev->device == 0x9990) ||
910918 (rdev->pdev->device == 0x9991) ||
@@ -915,9 +923,17 @@ static void cayman_gpu_init(struct radeon_device *rdev) · 4 unmodified lines
915923 (rdev->pdev->device == 0x99A0)) {
916924 rdev->config.cayman.max_simds_per_se = 3;
917925 rdev->config.cayman.max_backends_per_se = 1;
926+ rdev->config.cayman.max_hw_contexts = 4;
927+ rdev->config.cayman.sx_max_export_size = 128;
928+ rdev->config.cayman.sx_max_export_pos_size = 32;
929+ rdev->config.cayman.sx_max_export_smx_size = 96;
918930 } else {
919931 rdev->config.cayman.max_simds_per_se = 2;
920932 rdev->config.cayman.max_backends_per_se = 1;
933+ rdev->config.cayman.max_hw_contexts = 4;
934+ rdev->config.cayman.sx_max_export_size = 128;
935+ rdev->config.cayman.sx_max_export_pos_size = 32;
936+ rdev->config.cayman.sx_max_export_smx_size = 96;
921937 }
922938 rdev->config.cayman.max_texture_channel_caches = 2;
923939 rdev->config.cayman.max_gprs = 256;
@@ -925,10 +941,6 @@ static void cayman_gpu_init(struct radeon_device *rdev) · 1 unmodified line
925941 rdev->config.cayman.max_gs_threads = 32;
926942 rdev->config.cayman.max_stack_entries = 512;
927943 rdev->config.cayman.sx_num_of_sets = 8;
928− rdev->config.cayman.sx_max_export_size = 256;
929− rdev->config.cayman.sx_max_export_pos_size = 64;
930− rdev->config.cayman.sx_max_export_smx_size = 192;
931− rdev->config.cayman.max_hw_contexts = 8;
932944 rdev->config.cayman.sq_num_cf_insts = 2;
933945
934946 rdev->config.cayman.sc_prim_fifo_size = 0x40;
drivers/gpu/drm/radeon/radeon.h+2−2
@@ -1940,7 +1940,7 @@ struct si_asic { · 1939 unmodified lines
19401940 unsigned sc_earlyz_tile_fifo_size;
19411941
19421942 unsigned num_tile_pipes;
1943− unsigned num_backends_per_se;
1943+ unsigned backend_enable_mask;
19441944 unsigned backend_disable_mask_per_asic;
19451945 unsigned backend_map;
19461946 unsigned num_texture_channel_caches;
@@ -1970,7 +1970,7 @@ struct cik_asic { · 23 unmodified lines
19701970 unsigned sc_earlyz_tile_fifo_size;
19711971
19721972 unsigned num_tile_pipes;
1973− unsigned num_backends_per_se;
1973+ unsigned backend_enable_mask;
19741974 unsigned backend_disable_mask_per_asic;
19751975 unsigned backend_map;
19761976 unsigned num_texture_channel_caches;
drivers/gpu/drm/radeon/radeon_asic.c+2−2
@@ -2021,7 +2021,7 @@ static struct radeon_asic ci_asic = { · 2020 unmodified lines
20212021 .hdmi_setmode = &evergreen_hdmi_setmode,
20222022 },
20232023 .copy = {
2024− .blit = NULL,
2024+ .blit = &cik_copy_cpdma,
20252025 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
20262026 .dma = &cik_copy_dma,
20272027 .dma_ring_index = R600_RING_TYPE_DMA_INDEX,
@@ -2122,7 +2122,7 @@ static struct radeon_asic kv_asic = { · 94 unmodified lines
21222122 .hdmi_setmode = &evergreen_hdmi_setmode,
21232123 },
21242124 .copy = {
2125− .blit = NULL,
2125+ .blit = &cik_copy_cpdma,
21262126 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
21272127 .dma = &cik_copy_dma,
21282128 .dma_ring_index = R600_RING_TYPE_DMA_INDEX,
drivers/gpu/drm/radeon/radeon_atpx_handler.c+14−2
@@ -33,6 +33,7 @@ static struct radeon_atpx_priv { · 32 unmodified lines
3333 bool atpx_detected;
3434 /* handle for device - and atpx */
3535 acpi_handle dhandle;
36+ acpi_handle other_handle;
3637 struct radeon_atpx atpx;
3738 } radeon_atpx_priv;
3839
@@ -451,9 +452,10 @@ static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev) · 412 unmodified lines
451452 return false;
452453
453454 status = acpi_get_handle(dhandle, "ATPX", &atpx_handle);
454− if (ACPI_FAILURE(status))
455+ if (ACPI_FAILURE(status)) {
456+ radeon_atpx_priv.other_handle = dhandle;
455457 return false;
456−
458+ }
457459 radeon_atpx_priv.dhandle = dhandle;
458460 radeon_atpx_priv.atpx.handle = atpx_handle;
459461 return true;
@@ -530,6 +532,16 @@ static bool radeon_atpx_detect(void) · 70 unmodified lines
530532 printk(KERN_INFO "VGA switcheroo: detected switching method %s handle\n",
531533 acpi_method_name);
532534 radeon_atpx_priv.atpx_detected = true;
535+ /*
536+ * On some systems hotplug events are generated for the device
537+ * being switched off when ATPX is executed. They cause ACPI
538+ * hotplug to trigger and attempt to remove the device from
539+ * the system, which causes it to break down. Prevent that from
540+ * happening by setting the no_hotplug flag for the involved
541+ * ACPI device objects.
542+ */
543+ acpi_bus_no_hotplug(radeon_atpx_priv.dhandle);
544+ acpi_bus_no_hotplug(radeon_atpx_priv.other_handle);
533545 return true;
534546 }
535547 return false;
drivers/gpu/drm/radeon/radeon_drv.c+2−11
@@ -77,9 +77,10 @@ · 76 unmodified lines
7777 * 2.33.0 - Add SI tiling mode array query
7878 * 2.34.0 - Add CIK tiling mode array query
7979 * 2.35.0 - Add CIK macrotile mode array query
80+ * 2.36.0 - Fix CIK DCE tiling setup
8081 */
8182 #define KMS_DRIVER_MAJOR 2
82−#define KMS_DRIVER_MINOR 35
83+#define KMS_DRIVER_MINOR 36
8384 #define KMS_DRIVER_PATCHLEVEL 0
8485 int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
8586 int radeon_driver_unload_kms(struct drm_device *dev);
@@ -508,15 +509,6 @@ static const struct file_operations radeon_driver_kms_fops = { · 422 unmodified lines
508509 #endif
509510 };
510511
511−
512−static void
513−radeon_pci_shutdown(struct pci_dev *pdev)
514−{
515− struct drm_device *dev = pci_get_drvdata(pdev);
516−
517− radeon_driver_unload_kms(dev);
518−}
519−
520512 static struct drm_driver kms_driver = {
521513 .driver_features =
522514 DRIVER_USE_AGP |
@@ -586,7 +578,6 @@ static struct pci_driver radeon_kms_pci_driver = { · 63 unmodified lines
586578 .probe = radeon_pci_probe,
587579 .remove = radeon_pci_remove,
588580 .driver.pm = &radeon_pm_ops,
589− .shutdown = radeon_pci_shutdown,
590581 };
591582
592583 static int __init radeon_init(void)
drivers/gpu/drm/radeon/radeon_kms.c+9−0
@@ -461,6 +461,15 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · 460 unmodified lines
461461 case RADEON_INFO_SI_CP_DMA_COMPUTE:
462462 *value = 1;
463463 break;
464+ case RADEON_INFO_SI_BACKEND_ENABLED_MASK:
465+ if (rdev->family >= CHIP_BONAIRE) {
466+ *value = rdev->config.cik.backend_enable_mask;
467+ } else if (rdev->family >= CHIP_TAHITI) {
468+ *value = rdev->config.si.backend_enable_mask;
469+ } else {
470+ DRM_DEBUG_KMS("BACKEND_ENABLED_MASK is si+ only!\n");
471+ }
472+ break;
464473 default:
465474 DRM_DEBUG_KMS("Invalid request %d\n", info->request);
466475 return -EINVAL;
drivers/gpu/drm/radeon/radeon_uvd.c+1−1
@@ -473,7 +473,7 @@ static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p, · 472 unmodified lines
473473 return -EINVAL;
474474 }
475475
476− if ((start >> 28) != (end >> 28)) {
476+ if ((start >> 28) != ((end - 1) >> 28)) {
477477 DRM_ERROR("reloc %LX-%LX crossing 256MB boundary!\n",
478478 start, end);
479479 return -EINVAL;
drivers/gpu/drm/radeon/rs690.c+10−0
@@ -162,6 +162,16 @@ static void rs690_mc_init(struct radeon_device *rdev) · 161 unmodified lines
162162 base = RREG32_MC(R_000100_MCCFG_FB_LOCATION);
163163 base = G_000100_MC_FB_START(base) << 16;
164164 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev);
165+ /* Some boards seem to be configured for 128MB of sideport memory,
166+ * but really only have 64MB. Just skip the sideport and use
167+ * UMA memory.
168+ */
169+ if (rdev->mc.igp_sideport_enabled &&
170+ (rdev->mc.real_vram_size == (384 * 1024 * 1024))) {
171+ base += 128 * 1024 * 1024;
172+ rdev->mc.real_vram_size -= 128 * 1024 * 1024;
173+ rdev->mc.mc_vram_size = rdev->mc.real_vram_size;
174+ }
165175
166176 /* Use K8 direct mapping for fast fb access. */
167177 rdev->fastfb_working = false;
drivers/gpu/drm/radeon/rv770_dpm.c+6−0
@@ -2328,6 +2328,12 @@ void rv770_get_engine_memory_ss(struct radeon_device *rdev) · 2327 unmodified lines
23282328 pi->mclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss,
23292329 ASIC_INTERNAL_MEMORY_SS, 0);
23302330
2331+ /* disable ss, causes hangs on some cayman boards */
2332+ if (rdev->family == CHIP_CAYMAN) {
2333+ pi->sclk_ss = false;
2334+ pi->mclk_ss = false;
2335+ }
2336+
23312337 if (pi->sclk_ss || pi->mclk_ss)
23322338 pi->dynamic_ss = true;
23332339 else
drivers/gpu/drm/radeon/si.c+7−5
@@ -2811,7 +2811,7 @@ static void si_setup_spi(struct radeon_device *rdev, · 2810 unmodified lines
28112811 }
28122812
28132813 static u32 si_get_rb_disabled(struct radeon_device *rdev,
2814− u32 max_rb_num, u32 se_num,
2814+ u32 max_rb_num_per_se,
28152815 u32 sh_per_se)
28162816 {
28172817 u32 data, mask;
@@ -2825,14 +2825,14 @@ static u32 si_get_rb_disabled(struct radeon_device *rdev, · 7 unmodified lines
28252825
28262826 data >>= BACKEND_DISABLE_SHIFT;
28272827
2828− mask = si_create_bitmask(max_rb_num / se_num / sh_per_se);
2828+ mask = si_create_bitmask(max_rb_num_per_se / sh_per_se);
28292829
28302830 return data & mask;
28312831 }
28322832
28332833 static void si_setup_rb(struct radeon_device *rdev,
28342834 u32 se_num, u32 sh_per_se,
2835− u32 max_rb_num)
2835+ u32 max_rb_num_per_se)
28362836 {
28372837 int i, j;
28382838 u32 data, mask;
@@ -2842,19 +2842,21 @@ static void si_setup_rb(struct radeon_device *rdev, · 3 unmodified lines
28422842 for (i = 0; i < se_num; i++) {
28432843 for (j = 0; j < sh_per_se; j++) {
28442844 si_select_se_sh(rdev, i, j);
2845− data = si_get_rb_disabled(rdev, max_rb_num, se_num, sh_per_se);
2845+ data = si_get_rb_disabled(rdev, max_rb_num_per_se, sh_per_se);
28462846 disabled_rbs |= data << ((i * sh_per_se + j) * TAHITI_RB_BITMAP_WIDTH_PER_SH);
28472847 }
28482848 }
28492849 si_select_se_sh(rdev, 0xffffffff, 0xffffffff);
28502850
28512851 mask = 1;
2852− for (i = 0; i < max_rb_num; i++) {
2852+ for (i = 0; i < max_rb_num_per_se * se_num; i++) {
28532853 if (!(disabled_rbs & mask))
28542854 enabled_rbs |= mask;
28552855 mask <<= 1;
28562856 }
28572857
2858+ rdev->config.si.backend_enable_mask = enabled_rbs;
2859+
28582860 for (i = 0; i < se_num; i++) {
28592861 si_select_se_sh(rdev, i, 0xffffffff);
28602862 data = 0;
drivers/gpu/drm/ttm/ttm_bo_util.c+2−1
@@ -353,7 +353,8 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, · 352 unmodified lines
353353 * Don't move nonexistent data. Clear destination instead.
354354 */
355355 if (old_iomap == NULL &&
356− (ttm == NULL || ttm->state == tt_unpopulated)) {
356+ (ttm == NULL || (ttm->state == tt_unpopulated &&
357+ !(ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)))) {
357358 memset_io(new_iomap, 0, new_mem->num_pages*PAGE_SIZE);
358359 goto out2;
359360 }
drivers/gpu/drm/ttm/ttm_bo_vm.c+3−3
@@ -169,9 +169,9 @@ static int ttm_bo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) · 168 unmodified lines
169169 }
170170
171171 page_offset = ((address - vma->vm_start) >> PAGE_SHIFT) +
172− drm_vma_node_start(&bo->vma_node) - vma->vm_pgoff;
173− page_last = vma_pages(vma) +
174− drm_vma_node_start(&bo->vma_node) - vma->vm_pgoff;
172+ vma->vm_pgoff - drm_vma_node_start(&bo->vma_node);
173+ page_last = vma_pages(vma) + vma->vm_pgoff -
174+ drm_vma_node_start(&bo->vma_node);
175175
176176 if (unlikely(page_offset >= bo->num_pages)) {
177177 retval = VM_FAULT_SIGBUS;
drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c+3−0
@@ -68,6 +68,9 @@ int vmw_getparam_ioctl(struct drm_device *dev, void *data, · 67 unmodified lines
6868 SVGA_FIFO_3D_HWVERSION));
6969 break;
7070 }
71+ case DRM_VMW_PARAM_MAX_SURF_MEMORY:
72+ param->value = dev_priv->memory_size;
73+ break;
7174 default:
7275 DRM_ERROR("Illegal vmwgfx get param request: %d\n",
7376 param->param);
drivers/hwmon/coretemp.c+1−1
@@ -52,7 +52,7 @@ MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius"); · 51 unmodified lines
5252
5353 #define BASE_SYSFS_ATTR_NO 2 /* Sysfs Base attr no for coretemp */
5454 #define NUM_REAL_CORES 32 /* Number of Real cores per cpu */
55−#define CORETEMP_NAME_LENGTH 17 /* String Length of attrs */
55+#define CORETEMP_NAME_LENGTH 19 /* String Length of attrs */
5656 #define MAX_CORE_ATTRS 4 /* Maximum no of basic attrs */
5757 #define TOTAL_ATTRS (MAX_CORE_ATTRS + 1)
5858 #define MAX_CORE_DATA (NUM_REAL_CORES + BASE_SYSFS_ATTR_NO)
drivers/idle/intel_idle.c+11−6
@@ -123,7 +123,7 @@ static struct cpuidle_state *cpuidle_state_table; · 122 unmodified lines
123123 * which is also the index into the MWAIT hint array.
124124 * Thus C0 is a dummy.
125125 */
126−static struct cpuidle_state nehalem_cstates[] __initdata = {
126+static struct cpuidle_state nehalem_cstates[] = {
127127 {
128128 .name = "C1-NHM",
129129 .desc = "MWAIT 0x00",
@@ -156,7 +156,7 @@ static struct cpuidle_state nehalem_cstates[] __initdata = { · 26 unmodified lines
156156 .enter = NULL }
157157 };
158158
159−static struct cpuidle_state snb_cstates[] __initdata = {
159+static struct cpuidle_state snb_cstates[] = {
160160 {
161161 .name = "C1-SNB",
162162 .desc = "MWAIT 0x00",
@@ -196,7 +196,7 @@ static struct cpuidle_state snb_cstates[] __initdata = { · 33 unmodified lines
196196 .enter = NULL }
197197 };
198198
199−static struct cpuidle_state ivb_cstates[] __initdata = {
199+static struct cpuidle_state ivb_cstates[] = {
200200 {
201201 .name = "C1-IVB",
202202 .desc = "MWAIT 0x00",
@@ -236,7 +236,7 @@ static struct cpuidle_state ivb_cstates[] __initdata = { · 33 unmodified lines
236236 .enter = NULL }
237237 };
238238
239−static struct cpuidle_state hsw_cstates[] __initdata = {
239+static struct cpuidle_state hsw_cstates[] = {
240240 {
241241 .name = "C1-HSW",
242242 .desc = "MWAIT 0x00",
@@ -297,7 +297,7 @@ static struct cpuidle_state hsw_cstates[] __initdata = { · 54 unmodified lines
297297 .enter = NULL }
298298 };
299299
300−static struct cpuidle_state atom_cstates[] __initdata = {
300+static struct cpuidle_state atom_cstates[] = {
301301 {
302302 .name = "C1E-ATM",
303303 .desc = "MWAIT 0x00",
@@ -329,7 +329,7 @@ static struct cpuidle_state atom_cstates[] __initdata = { · 25 unmodified lines
329329 {
330330 .enter = NULL }
331331 };
332−static struct cpuidle_state avn_cstates[] __initdata = {
332+static struct cpuidle_state avn_cstates[] = {
333333 {
334334 .name = "C1-AVN",
335335 .desc = "MWAIT 0x00",
@@ -344,6 +344,8 @@ static struct cpuidle_state avn_cstates[] __initdata = { · 8 unmodified lines
344344 .exit_latency = 15,
345345 .target_residency = 45,
346346 .enter = &intel_idle },
347+ {
348+ .enter = NULL }
347349 };
348350
349351 /**
@@ -377,6 +379,9 @@ static int intel_idle(struct cpuidle_device *dev, · 27 unmodified lines
377379
378380 if (!current_set_polling_and_test()) {
379381
382+ if (this_cpu_has(X86_FEATURE_CLFLUSH_MONITOR))
383+ clflush((void *)&current_thread_info()->flags);
384+
380385 __monitor((void *)&current_thread_info()->flags, 0, 0);
381386 smp_mb();
382387 if (!need_resched())
drivers/iio/adc/ad7887.c+14−2
@@ -200,7 +200,13 @@ static const struct ad7887_chip_info ad7887_chip_info_tbl[] = { · 199 unmodified lines
200200 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
201201 .address = 1,
202202 .scan_index = 1,
203− .scan_type = IIO_ST('u', 12, 16, 0),
203+ .scan_type = {
204+ .sign = 'u',
205+ .realbits = 12,
206+ .storagebits = 16,
207+ .shift = 0,
208+ .endianness = IIO_BE,
209+ },
204210 },
205211 .channel[1] = {
206212 .type = IIO_VOLTAGE,
@@ -210,7 +216,13 @@ static const struct ad7887_chip_info ad7887_chip_info_tbl[] = { · 3 unmodified lines
210216 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
211217 .address = 0,
212218 .scan_index = 0,
213− .scan_type = IIO_ST('u', 12, 16, 0),
219+ .scan_type = {
220+ .sign = 'u',
221+ .realbits = 12,
222+ .storagebits = 16,
223+ .shift = 0,
224+ .endianness = IIO_BE,
225+ },
214226 },
215227 .channel[2] = IIO_CHAN_SOFT_TIMESTAMP(2),
216228 .int_vref_mv = 2500,
drivers/iio/imu/adis16400_core.c+6−1
@@ -651,7 +651,12 @@ static const struct iio_chan_spec adis16448_channels[] = { · 650 unmodified lines
651651 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
652652 .address = ADIS16448_BARO_OUT,
653653 .scan_index = ADIS16400_SCAN_BARO,
654− .scan_type = IIO_ST('s', 16, 16, 0),
654+ .scan_type = {
655+ .sign = 's',
656+ .realbits = 16,
657+ .storagebits = 16,
658+ .endianness = IIO_BE,
659+ },
655660 },
656661 ADIS16400_TEMP_CHAN(ADIS16448_TEMP_OUT, 12),
657662 IIO_CHAN_SOFT_TIMESTAMP(11)
drivers/iio/light/cm36651.c+1−1
@@ -387,7 +387,7 @@ static int cm36651_read_int_time(struct cm36651_data *cm36651, · 386 unmodified lines
387387 return -EINVAL;
388388 }
389389
390− return IIO_VAL_INT_PLUS_MICRO;
390+ return IIO_VAL_INT;
391391 }
392392
393393 static int cm36651_write_int_time(struct cm36651_data *cm36651,
drivers/infiniband/core/iwcm.c+9−2
@@ -181,9 +181,16 @@ static void add_ref(struct iw_cm_id *cm_id) · 180 unmodified lines
181181 static void rem_ref(struct iw_cm_id *cm_id)
182182 {
183183 struct iwcm_id_private *cm_id_priv;
184+ int cb_destroy;
185+
184186 cm_id_priv = container_of(cm_id, struct iwcm_id_private, id);
185− if (iwcm_deref_id(cm_id_priv) &&
186− test_bit(IWCM_F_CALLBACK_DESTROY, &cm_id_priv->flags)) {
187+
188+ /*
189+ * Test bit before deref in case the cm_id gets freed on another
190+ * thread.
191+ */
192+ cb_destroy = test_bit(IWCM_F_CALLBACK_DESTROY, &cm_id_priv->flags);
193+ if (iwcm_deref_id(cm_id_priv) && cb_destroy) {
187194 BUG_ON(!list_empty(&cm_id_priv->work_list));
188195 free_cm_id(cm_id_priv);
189196 }
drivers/infiniband/core/uverbs.h+9−1
@@ -49,12 +49,20 @@ · 48 unmodified lines
4949
5050 #define INIT_UDATA(udata, ibuf, obuf, ilen, olen) \
5151 do { \
52− (udata)->inbuf = (void __user *) (ibuf); \
52+ (udata)->inbuf = (const void __user *) (ibuf); \
5353 (udata)->outbuf = (void __user *) (obuf); \
5454 (udata)->inlen = (ilen); \
5555 (udata)->outlen = (olen); \
5656 } while (0)
5757
58+#define INIT_UDATA_BUF_OR_NULL(udata, ibuf, obuf, ilen, olen) \
59+ do { \
60+ (udata)->inbuf = (ilen) ? (const void __user *) (ibuf) : NULL; \
61+ (udata)->outbuf = (olen) ? (void __user *) (obuf) : NULL; \
62+ (udata)->inlen = (ilen); \
63+ (udata)->outlen = (olen); \
64+ } while (0)
65+
5866 /*
5967 * Our lifetime rules for these structs are the following:
6068 *
drivers/infiniband/core/uverbs_cmd.c+17−0
@@ -2593,6 +2593,9 @@ out_put: · 2592 unmodified lines
25932593 static int kern_spec_to_ib_spec(struct ib_uverbs_flow_spec *kern_spec,
25942594 union ib_flow_spec *ib_spec)
25952595 {
2596+ if (kern_spec->reserved)
2597+ return -EINVAL;
2598+
25962599 ib_spec->type = kern_spec->type;
25972600
25982601 switch (ib_spec->type) {
@@ -2646,6 +2649,9 @@ int ib_uverbs_ex_create_flow(struct ib_uverbs_file *file, · 47 unmodified lines
26462649 void *ib_spec;
26472650 int i;
26482651
2652+ if (ucore->inlen < sizeof(cmd))
2653+ return -EINVAL;
2654+
26492655 if (ucore->outlen < sizeof(resp))
26502656 return -ENOSPC;
26512657
@@ -2671,6 +2677,10 @@ int ib_uverbs_ex_create_flow(struct ib_uverbs_file *file, · 19 unmodified lines
26712677 (cmd.flow_attr.num_of_specs * sizeof(struct ib_uverbs_flow_spec)))
26722678 return -EINVAL;
26732679
2680+ if (cmd.flow_attr.reserved[0] ||
2681+ cmd.flow_attr.reserved[1])
2682+ return -EINVAL;
2683+
26742684 if (cmd.flow_attr.num_of_specs) {
26752685 kern_flow_attr = kmalloc(sizeof(*kern_flow_attr) + cmd.flow_attr.size,
26762686 GFP_KERNEL);
@@ -2731,6 +2741,7 @@ int ib_uverbs_ex_create_flow(struct ib_uverbs_file *file, · 54 unmodified lines
27312741 if (cmd.flow_attr.size || (i != flow_attr->num_of_specs)) {
27322742 pr_warn("create flow failed, flow %d: %d bytes left from uverb cmd\n",
27332743 i, cmd.flow_attr.size);
2744+ err = -EINVAL;
27342745 goto err_free;
27352746 }
27362747 flow_id = ib_create_flow(qp, flow_attr, IB_FLOW_DOMAIN_USER);
@@ -2791,10 +2802,16 @@ int ib_uverbs_ex_destroy_flow(struct ib_uverbs_file *file, · 54 unmodified lines
27912802 struct ib_uobject *uobj;
27922803 int ret;
27932804
2805+ if (ucore->inlen < sizeof(cmd))
2806+ return -EINVAL;
2807+
27942808 ret = ib_copy_from_udata(&cmd, ucore, sizeof(cmd));
27952809 if (ret)
27962810 return ret;
27972811
2812+ if (cmd.comp_mask)
2813+ return -EINVAL;
2814+
27982815 uobj = idr_write_uobj(&ib_uverbs_rule_idr, cmd.flow_handle,
27992816 file->ucontext);
28002817 if (!uobj)
drivers/infiniband/core/uverbs_main.c+16−11
@@ -668,25 +668,30 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf, · 667 unmodified lines
668668 if ((hdr.in_words + ex_hdr.provider_in_words) * 8 != count)
669669 return -EINVAL;
670670
671+ if (ex_hdr.cmd_hdr_reserved)
672+ return -EINVAL;
673+
671674 if (ex_hdr.response) {
672675 if (!hdr.out_words && !ex_hdr.provider_out_words)
673676 return -EINVAL;
677+
678+ if (!access_ok(VERIFY_WRITE,
679+ (void __user *) (unsigned long) ex_hdr.response,
680+ (hdr.out_words + ex_hdr.provider_out_words) * 8))
681+ return -EFAULT;
674682 } else {
675683 if (hdr.out_words || ex_hdr.provider_out_words)
676684 return -EINVAL;
677685 }
678686
679− INIT_UDATA(&ucore,
680− (hdr.in_words) ? buf : 0,
681− (unsigned long)ex_hdr.response,
682− hdr.in_words * 8,
683− hdr.out_words * 8);
684−
685− INIT_UDATA(&uhw,
686− (ex_hdr.provider_in_words) ? buf + ucore.inlen : 0,
687− (ex_hdr.provider_out_words) ? (unsigned long)ex_hdr.response + ucore.outlen : 0,
688− ex_hdr.provider_in_words * 8,
689− ex_hdr.provider_out_words * 8);
687+ INIT_UDATA_BUF_OR_NULL(&ucore, buf, (unsigned long) ex_hdr.response,
688+ hdr.in_words * 8, hdr.out_words * 8);
689+
690+ INIT_UDATA_BUF_OR_NULL(&uhw,
691+ buf + ucore.inlen,
692+ (unsigned long) ex_hdr.response + ucore.outlen,
693+ ex_hdr.provider_in_words * 8,
694+ ex_hdr.provider_out_words * 8);
690695
691696 err = uverbs_ex_cmd_table[command](file,
692697 &ucore,
drivers/infiniband/hw/cxgb4/cm.c+20−58
@@ -524,50 +524,6 @@ static int send_abort(struct c4iw_ep *ep, struct sk_buff *skb, gfp_t gfp) · 523 unmodified lines
524524 return c4iw_l2t_send(&ep->com.dev->rdev, skb, ep->l2t);
525525 }
526526
527−#define VLAN_NONE 0xfff
528−#define FILTER_SEL_VLAN_NONE 0xffff
529−#define FILTER_SEL_WIDTH_P_FC (3+1) /* port uses 3 bits, FCoE one bit */
530−#define FILTER_SEL_WIDTH_VIN_P_FC \
531− (6 + 7 + FILTER_SEL_WIDTH_P_FC) /* 6 bits are unused, VF uses 7 bits*/
532−#define FILTER_SEL_WIDTH_TAG_P_FC \
533− (3 + FILTER_SEL_WIDTH_VIN_P_FC) /* PF uses 3 bits */
534−#define FILTER_SEL_WIDTH_VLD_TAG_P_FC (1 + FILTER_SEL_WIDTH_TAG_P_FC)
535−
536−static unsigned int select_ntuple(struct c4iw_dev *dev, struct dst_entry *dst,
537− struct l2t_entry *l2t)
538−{
539− unsigned int ntuple = 0;
540− u32 viid;
541−
542− switch (dev->rdev.lldi.filt_mode) {
543−
544− /* default filter mode */
545− case HW_TPL_FR_MT_PR_IV_P_FC:
546− if (l2t->vlan == VLAN_NONE)
547− ntuple |= FILTER_SEL_VLAN_NONE << FILTER_SEL_WIDTH_P_FC;
548− else {
549− ntuple |= l2t->vlan << FILTER_SEL_WIDTH_P_FC;
550− ntuple |= 1 << FILTER_SEL_WIDTH_TAG_P_FC;
551− }
552− ntuple |= l2t->lport << S_PORT | IPPROTO_TCP <<
553− FILTER_SEL_WIDTH_VLD_TAG_P_FC;
554− break;
555− case HW_TPL_FR_MT_PR_OV_P_FC: {
556− viid = cxgb4_port_viid(l2t->neigh->dev);
557−
558− ntuple |= FW_VIID_VIN_GET(viid) << FILTER_SEL_WIDTH_P_FC;
559− ntuple |= FW_VIID_PFN_GET(viid) << FILTER_SEL_WIDTH_VIN_P_FC;
560− ntuple |= FW_VIID_VIVLD_GET(viid) << FILTER_SEL_WIDTH_TAG_P_FC;
561− ntuple |= l2t->lport << S_PORT | IPPROTO_TCP <<
562− FILTER_SEL_WIDTH_VLD_TAG_P_FC;
563− break;
564− }
565− default:
566− break;
567− }
568− return ntuple;
569−}
570−
571527 static int send_connect(struct c4iw_ep *ep)
572528 {
573529 struct cpl_act_open_req *req;
@@ -641,8 +597,9 @@ static int send_connect(struct c4iw_ep *ep) · 67 unmodified lines
641597 req->local_ip = la->sin_addr.s_addr;
642598 req->peer_ip = ra->sin_addr.s_addr;
643599 req->opt0 = cpu_to_be64(opt0);
644− req->params = cpu_to_be32(select_ntuple(ep->com.dev,
645− ep->dst, ep->l2t));
600+ req->params = cpu_to_be32(cxgb4_select_ntuple(
601+ ep->com.dev->rdev.lldi.ports[0],
602+ ep->l2t));
646603 req->opt2 = cpu_to_be32(opt2);
647604 } else {
648605 req6 = (struct cpl_act_open_req6 *)skb_put(skb, wrlen);
@@ -662,9 +619,9 @@ static int send_connect(struct c4iw_ep *ep) · 13 unmodified lines
662619 req6->peer_ip_lo = *((__be64 *)
663620 (ra6->sin6_addr.s6_addr + 8));
664621 req6->opt0 = cpu_to_be64(opt0);
665− req6->params = cpu_to_be32(
666− select_ntuple(ep->com.dev, ep->dst,
667− ep->l2t));
622+ req6->params = cpu_to_be32(cxgb4_select_ntuple(
623+ ep->com.dev->rdev.lldi.ports[0],
624+ ep->l2t));
668625 req6->opt2 = cpu_to_be32(opt2);
669626 }
670627 } else {
@@ -681,8 +638,9 @@ static int send_connect(struct c4iw_ep *ep) · 10 unmodified lines
681638 t5_req->peer_ip = ra->sin_addr.s_addr;
682639 t5_req->opt0 = cpu_to_be64(opt0);
683640 t5_req->params = cpu_to_be64(V_FILTER_TUPLE(
684− select_ntuple(ep->com.dev,
685− ep->dst, ep->l2t)));
641+ cxgb4_select_ntuple(
642+ ep->com.dev->rdev.lldi.ports[0],
643+ ep->l2t)));
686644 t5_req->opt2 = cpu_to_be32(opt2);
687645 } else {
688646 t5_req6 = (struct cpl_t5_act_open_req6 *)
@@ -703,7 +661,9 @@ static int send_connect(struct c4iw_ep *ep) · 14 unmodified lines
703661 (ra6->sin6_addr.s6_addr + 8));
704662 t5_req6->opt0 = cpu_to_be64(opt0);
705663 t5_req6->params = (__force __be64)cpu_to_be32(
706− select_ntuple(ep->com.dev, ep->dst, ep->l2t));
664+ cxgb4_select_ntuple(
665+ ep->com.dev->rdev.lldi.ports[0],
666+ ep->l2t));
707667 t5_req6->opt2 = cpu_to_be32(opt2);
708668 }
709669 }
@@ -1630,7 +1590,8 @@ static void send_fw_act_open_req(struct c4iw_ep *ep, unsigned int atid) · 920 unmodified lines
16301590 memset(req, 0, sizeof(*req));
16311591 req->op_compl = htonl(V_WR_OP(FW_OFLD_CONNECTION_WR));
16321592 req->len16_pkd = htonl(FW_WR_LEN16(DIV_ROUND_UP(sizeof(*req), 16)));
1633− req->le.filter = cpu_to_be32(select_ntuple(ep->com.dev, ep->dst,
1593+ req->le.filter = cpu_to_be32(cxgb4_select_ntuple(
1594+ ep->com.dev->rdev.lldi.ports[0],
16341595 ep->l2t));
16351596 sin = (struct sockaddr_in *)&ep->com.local_addr;
16361597 req->le.lport = sin->sin_port;
@@ -2938,7 +2899,8 @@ int c4iw_create_listen(struct iw_cm_id *cm_id, int backlog) · 1301 unmodified lines
29382899 /*
29392900 * Allocate a server TID.
29402901 */
2941− if (dev->rdev.lldi.enable_fw_ofld_conn)
2902+ if (dev->rdev.lldi.enable_fw_ofld_conn &&
2903+ ep->com.local_addr.ss_family == AF_INET)
29422904 ep->stid = cxgb4_alloc_sftid(dev->rdev.lldi.tids,
29432905 cm_id->local_addr.ss_family, ep);
29442906 else
@@ -3323,9 +3285,7 @@ static int rx_pkt(struct c4iw_dev *dev, struct sk_buff *skb) · 378 unmodified lines
33233285 /*
33243286 * Calculate the server tid from filter hit index from cpl_rx_pkt.
33253287 */
3326− stid = (__force int) cpu_to_be32((__force u32) rss->hash_val)
3327− - dev->rdev.lldi.tids->sftid_base
3328− + dev->rdev.lldi.tids->nstids;
3288+ stid = (__force int) cpu_to_be32((__force u32) rss->hash_val);
33293289
33303290 lep = (struct c4iw_ep *)lookup_stid(dev->rdev.lldi.tids, stid);
33313291 if (!lep) {
@@ -3397,7 +3357,9 @@ static int rx_pkt(struct c4iw_dev *dev, struct sk_buff *skb) · 65 unmodified lines
33973357 window = (__force u16) htons((__force u16)tcph->window);
33983358
33993359 /* Calcuate filter portion for LE region. */
3400− filter = (__force unsigned int) cpu_to_be32(select_ntuple(dev, dst, e));
3360+ filter = (__force unsigned int) cpu_to_be32(cxgb4_select_ntuple(
3361+ dev->rdev.lldi.ports[0],
3362+ e));
34013363
34023364 /*
34033365 * Synthesize the cpl_pass_accept_req. We have everything except the
drivers/infiniband/hw/cxgb4/mem.c+1−1
@@ -173,7 +173,7 @@ static int _c4iw_write_mem_inline(struct c4iw_rdev *rdev, u32 addr, u32 len, · 172 unmodified lines
173173 return ret;
174174 }
175175
176−int _c4iw_write_mem_dma(struct c4iw_rdev *rdev, u32 addr, u32 len, void *data)
176+static int _c4iw_write_mem_dma(struct c4iw_rdev *rdev, u32 addr, u32 len, void *data)
177177 {
178178 u32 remain = len;
179179 u32 dmalen;
drivers/infiniband/ulp/ipoib/ipoib_netlink.c+2−1
@@ -31,6 +31,7 @@ · 30 unmodified lines
3131 */
3232
3333 #include <linux/netdevice.h>
34+#include <linux/if_arp.h> /* For ARPHRD_xxx */
3435 #include <linux/module.h>
3536 #include <net/rtnetlink.h>
3637 #include "ipoib.h"
@@ -103,7 +104,7 @@ static int ipoib_new_child_link(struct net *src_net, struct net_device *dev, · 66 unmodified lines
103104 return -EINVAL;
104105
105106 pdev = __dev_get_by_index(src_net, nla_get_u32(tb[IFLA_LINK]));
106− if (!pdev)
107+ if (!pdev || pdev->type != ARPHRD_INFINIBAND)
107108 return -ENODEV;
108109
109110 ppriv = netdev_priv(pdev);
drivers/infiniband/ulp/isert/ib_isert.c+16−6
@@ -207,7 +207,9 @@ isert_free_rx_descriptors(struct isert_conn *isert_conn) · 206 unmodified lines
207207 isert_conn->conn_rx_descs = NULL;
208208 }
209209
210+static void isert_cq_tx_work(struct work_struct *);
210211 static void isert_cq_tx_callback(struct ib_cq *, void *);
212+static void isert_cq_rx_work(struct work_struct *);
211213 static void isert_cq_rx_callback(struct ib_cq *, void *);
212214
213215 static int
@@ -259,26 +261,36 @@ isert_create_device_ib_res(struct isert_device *device) · 45 unmodified lines
259261 cq_desc[i].device = device;
260262 cq_desc[i].cq_index = i;
261263
264+ INIT_WORK(&cq_desc[i].cq_rx_work, isert_cq_rx_work);
262265 device->dev_rx_cq[i] = ib_create_cq(device->ib_device,
263266 isert_cq_rx_callback,
264267 isert_cq_event_callback,
265268 (void *)&cq_desc[i],
266269 ISER_MAX_RX_CQ_LEN, i);
267− if (IS_ERR(device->dev_rx_cq[i]))
270+ if (IS_ERR(device->dev_rx_cq[i])) {
271+ ret = PTR_ERR(device->dev_rx_cq[i]);
272+ device->dev_rx_cq[i] = NULL;
268273 goto out_cq;
274+ }
269275
276+ INIT_WORK(&cq_desc[i].cq_tx_work, isert_cq_tx_work);
270277 device->dev_tx_cq[i] = ib_create_cq(device->ib_device,
271278 isert_cq_tx_callback,
272279 isert_cq_event_callback,
273280 (void *)&cq_desc[i],
274281 ISER_MAX_TX_CQ_LEN, i);
275− if (IS_ERR(device->dev_tx_cq[i]))
282+ if (IS_ERR(device->dev_tx_cq[i])) {
283+ ret = PTR_ERR(device->dev_tx_cq[i]);
284+ device->dev_tx_cq[i] = NULL;
276285 goto out_cq;
286+ }
277287
278− if (ib_req_notify_cq(device->dev_rx_cq[i], IB_CQ_NEXT_COMP))
288+ ret = ib_req_notify_cq(device->dev_rx_cq[i], IB_CQ_NEXT_COMP);
289+ if (ret)
279290 goto out_cq;
280291
281− if (ib_req_notify_cq(device->dev_tx_cq[i], IB_CQ_NEXT_COMP))
292+ ret = ib_req_notify_cq(device->dev_tx_cq[i], IB_CQ_NEXT_COMP);
293+ if (ret)
282294 goto out_cq;
283295 }
284296
@@ -1724,7 +1736,6 @@ isert_cq_tx_callback(struct ib_cq *cq, void *context) · 1439 unmodified lines
17241736 {
17251737 struct isert_cq_desc *cq_desc = (struct isert_cq_desc *)context;
17261738
1727− INIT_WORK(&cq_desc->cq_tx_work, isert_cq_tx_work);
17281739 queue_work(isert_comp_wq, &cq_desc->cq_tx_work);
17291740 }
17301741
@@ -1768,7 +1779,6 @@ isert_cq_rx_callback(struct ib_cq *cq, void *context) · 37 unmodified lines
17681779 {
17691780 struct isert_cq_desc *cq_desc = (struct isert_cq_desc *)context;
17701781
1771− INIT_WORK(&cq_desc->cq_rx_work, isert_cq_rx_work);
17721782 queue_work(isert_rx_wq, &cq_desc->cq_rx_work);
17731783 }
17741784
drivers/input/input.c+4−0
@@ -1871,6 +1871,10 @@ void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int · 1870 unmodified lines
18711871 break;
18721872
18731873 case EV_ABS:
1874+ input_alloc_absinfo(dev);
1875+ if (!dev->absinfo)
1876+ return;
1877+
18741878 __set_bit(code, dev->absbit);
18751879 break;
18761880
drivers/input/touchscreen/zforce_ts.c+15−6
@@ -455,7 +455,18 @@ static void zforce_complete(struct zforce_ts *ts, int cmd, int result) · 454 unmodified lines
455455 }
456456 }
457457
458−static irqreturn_t zforce_interrupt(int irq, void *dev_id)
458+static irqreturn_t zforce_irq(int irq, void *dev_id)
459+{
460+ struct zforce_ts *ts = dev_id;
461+ struct i2c_client *client = ts->client;
462+
463+ if (ts->suspended && device_may_wakeup(&client->dev))
464+ pm_wakeup_event(&client->dev, 500);
465+
466+ return IRQ_WAKE_THREAD;
467+}
468+
469+static irqreturn_t zforce_irq_thread(int irq, void *dev_id)
459470 {
460471 struct zforce_ts *ts = dev_id;
461472 struct i2c_client *client = ts->client;
@@ -465,12 +476,10 @@ static irqreturn_t zforce_interrupt(int irq, void *dev_id) · 3 unmodified lines
465476 u8 *payload;
466477
467478 /*
468− * When suspended, emit a wakeup signal if necessary and return.
479+ * When still suspended, return.
469480 * Due to the level-interrupt we will get re-triggered later.
470481 */
471482 if (ts->suspended) {
472− if (device_may_wakeup(&client->dev))
473− pm_wakeup_event(&client->dev, 500);
474483 msleep(20);
475484 return IRQ_HANDLED;
476485 }
@@ -763,8 +772,8 @@ static int zforce_probe(struct i2c_client *client, · 286 unmodified lines
763772 * Therefore we can trigger the interrupt anytime it is low and do
764773 * not need to limit it to the interrupt edge.
765774 */
766− ret = devm_request_threaded_irq(&client->dev, client->irq, NULL,
767− zforce_interrupt,
775+ ret = devm_request_threaded_irq(&client->dev, client->irq,
776+ zforce_irq, zforce_irq_thread,
768777 IRQF_TRIGGER_LOW | IRQF_ONESHOT,
769778 input_dev->name, ts);
770779 if (ret) {
drivers/irqchip/irq-renesas-intc-irqpin.c+5−3
@@ -149,8 +149,9 @@ static void intc_irqpin_read_modify_write(struct intc_irqpin_priv *p, · 148 unmodified lines
149149 static void intc_irqpin_mask_unmask_prio(struct intc_irqpin_priv *p,
150150 int irq, int do_mask)
151151 {
152− int bitfield_width = 4; /* PRIO assumed to have fixed bitfield width */
153− int shift = (7 - irq) * bitfield_width; /* PRIO assumed to be 32-bit */
152+ /* The PRIO register is assumed to be 32-bit with fixed 4-bit fields. */
153+ int bitfield_width = 4;
154+ int shift = 32 - (irq + 1) * bitfield_width;
154155
155156 intc_irqpin_read_modify_write(p, INTC_IRQPIN_REG_PRIO,
156157 shift, bitfield_width,
@@ -159,8 +160,9 @@ static void intc_irqpin_mask_unmask_prio(struct intc_irqpin_priv *p, · 2 unmodified lines
159160
160161 static int intc_irqpin_set_sense(struct intc_irqpin_priv *p, int irq, int value)
161162 {
163+ /* The SENSE register is assumed to be 32-bit. */
162164 int bitfield_width = p->config.sense_bitfield_width;
163− int shift = (7 - irq) * bitfield_width; /* SENSE assumed to be 32-bit */
165+ int shift = 32 - (irq + 1) * bitfield_width;
164166
165167 dev_dbg(&p->pdev->dev, "sense irq = %d, mode = %d\n", irq, value);
166168
drivers/isdn/hisax/hfc_pci.c+0−4
@@ -1643,10 +1643,6 @@ setup_hfcpci(struct IsdnCard *card) · 1642 unmodified lines
16431643 int i;
16441644 struct pci_dev *tmp_hfcpci = NULL;
16451645
1646−#ifdef __BIG_ENDIAN
1647−#error "not running on big endian machines now"
1648−#endif
1649−
16501646 strcpy(tmp, hfcpci_revision);
16511647 printk(KERN_INFO "HiSax: HFC-PCI driver Rev. %s\n", HiSax_getrev(tmp));
16521648
drivers/isdn/hisax/telespci.c+0−4
@@ -290,10 +290,6 @@ int setup_telespci(struct IsdnCard *card) · 289 unmodified lines
290290 struct IsdnCardState *cs = card->cs;
291291 char tmp[64];
292292
293−#ifdef __BIG_ENDIAN
294−#error "not running on big endian machines now"
295−#endif
296−
297293 strcpy(tmp, telespci_revision);
298294 printk(KERN_INFO "HiSax: Teles/PCI driver Rev. %s\n", HiSax_getrev(tmp));
299295 if (cs->typ != ISDN_CTYPE_TELESPCI)
drivers/leds/leds-lp5521.c+4−8
@@ -244,18 +244,12 @@ static int lp5521_update_program_memory(struct lp55xx_chip *chip, · 243 unmodified lines
244244 if (i % 2)
245245 goto err;
246246
247− mutex_lock(&chip->lock);
248−
249247 for (i = 0; i < LP5521_PROGRAM_LENGTH; i++) {
250248 ret = lp55xx_write(chip, addr[idx] + i, pattern[i]);
251− if (ret) {
252− mutex_unlock(&chip->lock);
249+ if (ret)
253250 return -EINVAL;
254− }
255251 }
256252
257− mutex_unlock(&chip->lock);
258−
259253 return size;
260254
261255 err:
@@ -427,15 +421,17 @@ static ssize_t store_engine_load(struct device *dev, · 165 unmodified lines
427421 {
428422 struct lp55xx_led *led = i2c_get_clientdata(to_i2c_client(dev));
429423 struct lp55xx_chip *chip = led->chip;
424+ int ret;
430425
431426 mutex_lock(&chip->lock);
432427
433428 chip->engine_idx = nr;
434429 lp5521_load_engine(chip);
430+ ret = lp5521_update_program_memory(chip, buf, len);
435431
436432 mutex_unlock(&chip->lock);
437433
438− return lp5521_update_program_memory(chip, buf, len);
434+ return ret;
439435 }
440436 store_load(1)
441437 store_load(2)
drivers/leds/leds-lp5523.c+4−8
@@ -337,18 +337,12 @@ static int lp5523_update_program_memory(struct lp55xx_chip *chip, · 336 unmodified lines
337337 if (i % 2)
338338 goto err;
339339
340− mutex_lock(&chip->lock);
341−
342340 for (i = 0; i < LP5523_PROGRAM_LENGTH; i++) {
343341 ret = lp55xx_write(chip, LP5523_REG_PROG_MEM + i, pattern[i]);
344− if (ret) {
345− mutex_unlock(&chip->lock);
342+ if (ret)
346343 return -EINVAL;
347− }
348344 }
349345
350− mutex_unlock(&chip->lock);
351−
352346 return size;
353347
354348 err:
@@ -548,15 +542,17 @@ static ssize_t store_engine_load(struct device *dev, · 193 unmodified lines
548542 {
549543 struct lp55xx_led *led = i2c_get_clientdata(to_i2c_client(dev));
550544 struct lp55xx_chip *chip = led->chip;
545+ int ret;
551546
552547 mutex_lock(&chip->lock);
553548
554549 chip->engine_idx = nr;
555550 lp5523_load_engine_and_select_page(chip);
551+ ret = lp5523_update_program_memory(chip, buf, len);
556552
557553 mutex_unlock(&chip->lock);
558554
559− return lp5523_update_program_memory(chip, buf, len);
555+ return ret;
560556 }
561557 store_load(1)
562558 store_load(2)
drivers/md/bcache/alloc.c+2−0
@@ -421,9 +421,11 @@ out: · 420 unmodified lines
421421
422422 if (watermark <= WATERMARK_METADATA) {
423423 SET_GC_MARK(b, GC_MARK_METADATA);
424+ SET_GC_MOVE(b, 0);
424425 b->prio = BTREE_PRIO;
425426 } else {
426427 SET_GC_MARK(b, GC_MARK_RECLAIMABLE);
428+ SET_GC_MOVE(b, 0);
427429 b->prio = INITIAL_PRIO;
428430 }
429431
drivers/md/bcache/bcache.h+6−6
@@ -197,7 +197,7 @@ struct bucket { · 196 unmodified lines
197197 uint8_t disk_gen;
198198 uint8_t last_gc; /* Most out of date gen in the btree */
199199 uint8_t gc_gen;
200− uint16_t gc_mark;
200+ uint16_t gc_mark; /* Bitfield used by GC. See below for field */
201201 };
202202
203203 /*
@@ -209,7 +209,8 @@ BITMASK(GC_MARK, struct bucket, gc_mark, 0, 2); · 5 unmodified lines
209209 #define GC_MARK_RECLAIMABLE 0
210210 #define GC_MARK_DIRTY 1
211211 #define GC_MARK_METADATA 2
212−BITMASK(GC_SECTORS_USED, struct bucket, gc_mark, 2, 14);
212+BITMASK(GC_SECTORS_USED, struct bucket, gc_mark, 2, 13);
213+BITMASK(GC_MOVE, struct bucket, gc_mark, 15, 1);
213214
214215 #include "journal.h"
215216 #include "stats.h"
@@ -372,14 +373,14 @@ struct cached_dev { · 156 unmodified lines
372373 unsigned char writeback_percent;
373374 unsigned writeback_delay;
374375
375− int writeback_rate_change;
376− int64_t writeback_rate_derivative;
377376 uint64_t writeback_rate_target;
377+ int64_t writeback_rate_proportional;
378+ int64_t writeback_rate_derivative;
379+ int64_t writeback_rate_change;
378380
379381 unsigned writeback_rate_update_seconds;
380382 unsigned writeback_rate_d_term;
381383 unsigned writeback_rate_p_term_inverse;
382− unsigned writeback_rate_d_smooth;
383384 };
384385
385386 enum alloc_watermarks {
@@ -445,7 +446,6 @@ struct cache { · 59 unmodified lines
445446 * call prio_write() to keep gens from wrapping.
446447 */
447448 uint8_t need_save_prio;
448− unsigned gc_move_threshold;
449449
450450 /*
451451 * If nonzero, we know we aren't going to find any buckets to invalidate
drivers/md/bcache/btree.c+25−2
@@ -1561,6 +1561,28 @@ size_t bch_btree_gc_finish(struct cache_set *c) · 1560 unmodified lines
15611561 SET_GC_MARK(PTR_BUCKET(c, &c->uuid_bucket, i),
15621562 GC_MARK_METADATA);
15631563
1564+ /* don't reclaim buckets to which writeback keys point */
1565+ rcu_read_lock();
1566+ for (i = 0; i < c->nr_uuids; i++) {
1567+ struct bcache_device *d = c->devices[i];
1568+ struct cached_dev *dc;
1569+ struct keybuf_key *w, *n;
1570+ unsigned j;
1571+
1572+ if (!d || UUID_FLASH_ONLY(&c->uuids[i]))
1573+ continue;
1574+ dc = container_of(d, struct cached_dev, disk);
1575+
1576+ spin_lock(&dc->writeback_keys.lock);
1577+ rbtree_postorder_for_each_entry_safe(w, n,
1578+ &dc->writeback_keys.keys, node)
1579+ for (j = 0; j < KEY_PTRS(&w->key); j++)
1580+ SET_GC_MARK(PTR_BUCKET(c, &w->key, j),
1581+ GC_MARK_DIRTY);
1582+ spin_unlock(&dc->writeback_keys.lock);
1583+ }
1584+ rcu_read_unlock();
1585+
15641586 for_each_cache(ca, c, i) {
15651587 uint64_t *i;
15661588
@@ -1817,7 +1839,8 @@ static bool fix_overlapping_extents(struct btree *b, struct bkey *insert, · 250 unmodified lines
18171839 if (KEY_START(k) > KEY_START(insert) + sectors_found)
18181840 goto check_failed;
18191841
1820− if (KEY_PTRS(replace_key) != KEY_PTRS(k))
1842+ if (KEY_PTRS(k) != KEY_PTRS(replace_key) ||
1843+ KEY_DIRTY(k) != KEY_DIRTY(replace_key))
18211844 goto check_failed;
18221845
18231846 /* skip past gen */
@@ -2217,7 +2240,7 @@ struct btree_insert_op { · 393 unmodified lines
22172240 struct bkey *replace_key;
22182241 };
22192242
2220−int btree_insert_fn(struct btree_op *b_op, struct btree *b)
2243+static int btree_insert_fn(struct btree_op *b_op, struct btree *b)
22212244 {
22222245 struct btree_insert_op *op = container_of(b_op,
22232246 struct btree_insert_op, op);
drivers/md/bcache/movinggc.c+15−6
@@ -25,10 +25,9 @@ static bool moving_pred(struct keybuf *buf, struct bkey *k) · 24 unmodified lines
2525 unsigned i;
2626
2727 for (i = 0; i < KEY_PTRS(k); i++) {
28− struct cache *ca = PTR_CACHE(c, k, i);
2928 struct bucket *g = PTR_BUCKET(c, k, i);
3029
31− if (GC_SECTORS_USED(g) < ca->gc_move_threshold)
30+ if (GC_MOVE(g))
3231 return true;
3332 }
3433
@@ -65,11 +64,16 @@ static void write_moving_finish(struct closure *cl) · 30 unmodified lines
6564
6665 static void read_moving_endio(struct bio *bio, int error)
6766 {
67+ struct bbio *b = container_of(bio, struct bbio, bio);
6868 struct moving_io *io = container_of(bio->bi_private,
6969 struct moving_io, cl);
7070
7171 if (error)
7272 io->op.error = error;
73+ else if (!KEY_DIRTY(&b->key) &&
74+ ptr_stale(io->op.c, &b->key, 0)) {
75+ io->op.error = -EINTR;
76+ }
7377
7478 bch_bbio_endio(io->op.c, bio, error, "reading data to move");
7579 }
@@ -141,6 +145,11 @@ static void read_moving(struct cache_set *c) · 65 unmodified lines
141145 if (!w)
142146 break;
143147
148+ if (ptr_stale(c, &w->key, 0)) {
149+ bch_keybuf_del(&c->moving_gc_keys, w);
150+ continue;
151+ }
152+
144153 io = kzalloc(sizeof(struct moving_io) + sizeof(struct bio_vec)
145154 * DIV_ROUND_UP(KEY_SIZE(&w->key), PAGE_SECTORS),
146155 GFP_KERNEL);
@@ -184,7 +193,8 @@ static bool bucket_cmp(struct bucket *l, struct bucket *r) · 37 unmodified lines
184193
185194 static unsigned bucket_heap_top(struct cache *ca)
186195 {
187− return GC_SECTORS_USED(heap_peek(&ca->heap));
196+ struct bucket *b;
197+ return (b = heap_peek(&ca->heap)) ? GC_SECTORS_USED(b) : 0;
188198 }
189199
190200 void bch_moving_gc(struct cache_set *c)
@@ -226,9 +236,8 @@ void bch_moving_gc(struct cache_set *c) · 35 unmodified lines
226236 sectors_to_move -= GC_SECTORS_USED(b);
227237 }
228238
229− ca->gc_move_threshold = bucket_heap_top(ca);
230−
231− pr_debug("threshold %u", ca->gc_move_threshold);
239+ while (heap_pop(&ca->heap, b, bucket_cmp))
240+ SET_GC_MOVE(b, 1);
232241 }
233242
234243 mutex_unlock(&c->bucket_lock);
drivers/md/bcache/super.c+1−1
@@ -1676,7 +1676,7 @@ err: · 1675 unmodified lines
16761676 static bool can_attach_cache(struct cache *ca, struct cache_set *c)
16771677 {
16781678 return ca->sb.block_size == c->sb.block_size &&
1679− ca->sb.bucket_size == c->sb.block_size &&
1679+ ca->sb.bucket_size == c->sb.bucket_size &&
16801680 ca->sb.nr_in_set == c->sb.nr_in_set;
16811681 }
16821682
drivers/md/bcache/sysfs.c+29−21
@@ -83,7 +83,6 @@ rw_attribute(writeback_rate); · 82 unmodified lines
8383 rw_attribute(writeback_rate_update_seconds);
8484 rw_attribute(writeback_rate_d_term);
8585 rw_attribute(writeback_rate_p_term_inverse);
86−rw_attribute(writeback_rate_d_smooth);
8786 read_attribute(writeback_rate_debug);
8887
8988 read_attribute(stripe_size);
@@ -129,31 +128,41 @@ SHOW(__bch_cached_dev) · 39 unmodified lines
129128 var_printf(writeback_running, "%i");
130129 var_print(writeback_delay);
131130 var_print(writeback_percent);
132− sysfs_print(writeback_rate, dc->writeback_rate.rate);
131+ sysfs_hprint(writeback_rate, dc->writeback_rate.rate << 9);
133132
134133 var_print(writeback_rate_update_seconds);
135134 var_print(writeback_rate_d_term);
136135 var_print(writeback_rate_p_term_inverse);
137− var_print(writeback_rate_d_smooth);
138136
139137 if (attr == &sysfs_writeback_rate_debug) {
138+ char rate[20];
140139 char dirty[20];
141− char derivative[20];
142140 char target[20];
143− bch_hprint(dirty,
144− bcache_dev_sectors_dirty(&dc->disk) << 9);
145− bch_hprint(derivative, dc->writeback_rate_derivative << 9);
141+ char proportional[20];
142+ char derivative[20];
143+ char change[20];
144+ s64 next_io;
145+
146+ bch_hprint(rate, dc->writeback_rate.rate << 9);
147+ bch_hprint(dirty, bcache_dev_sectors_dirty(&dc->disk) << 9);
146148 bch_hprint(target, dc->writeback_rate_target << 9);
149+ bch_hprint(proportional,dc->writeback_rate_proportional << 9);
150+ bch_hprint(derivative, dc->writeback_rate_derivative << 9);
151+ bch_hprint(change, dc->writeback_rate_change << 9);
152+
153+ next_io = div64_s64(dc->writeback_rate.next - local_clock(),
154+ NSEC_PER_MSEC);
147155
148156 return sprintf(buf,
149− "rate:\t\t%u\n"
150− "change:\t\t%i\n"
157+ "rate:\t\t%s/sec\n"
151158 "dirty:\t\t%s\n"
159+ "target:\t\t%s\n"
160+ "proportional:\t%s\n"
152161 "derivative:\t%s\n"
153− "target:\t\t%s\n",
154− dc->writeback_rate.rate,
155− dc->writeback_rate_change,
156− dirty, derivative, target);
162+ "change:\t\t%s/sec\n"
163+ "next io:\t%llims\n",
164+ rate, dirty, target, proportional,
165+ derivative, change, next_io);
157166 }
158167
159168 sysfs_hprint(dirty_data,
@@ -189,6 +198,7 @@ STORE(__cached_dev) · 29 unmodified lines
189198 struct kobj_uevent_env *env;
190199
191200 #define d_strtoul(var) sysfs_strtoul(var, dc->var)
201+#define d_strtoul_nonzero(var) sysfs_strtoul_clamp(var, dc->var, 1, INT_MAX)
192202 #define d_strtoi_h(var) sysfs_hatoi(var, dc->var)
193203
194204 sysfs_strtoul(data_csum, dc->disk.data_csum);
@@ -197,16 +207,15 @@ STORE(__cached_dev) · 2 unmodified lines
197207 d_strtoul(writeback_metadata);
198208 d_strtoul(writeback_running);
199209 d_strtoul(writeback_delay);
200− sysfs_strtoul_clamp(writeback_rate,
201− dc->writeback_rate.rate, 1, 1000000);
210+
202211 sysfs_strtoul_clamp(writeback_percent, dc->writeback_percent, 0, 40);
203212
204− d_strtoul(writeback_rate_update_seconds);
213+ sysfs_strtoul_clamp(writeback_rate,
214+ dc->writeback_rate.rate, 1, INT_MAX);
215+
216+ d_strtoul_nonzero(writeback_rate_update_seconds);
205217 d_strtoul(writeback_rate_d_term);
206− d_strtoul(writeback_rate_p_term_inverse);
207− sysfs_strtoul_clamp(writeback_rate_p_term_inverse,
208− dc->writeback_rate_p_term_inverse, 1, INT_MAX);
209− d_strtoul(writeback_rate_d_smooth);
218+ d_strtoul_nonzero(writeback_rate_p_term_inverse);
210219
211220 d_strtoi_h(sequential_cutoff);
212221 d_strtoi_h(readahead);
@@ -313,7 +322,6 @@ static struct attribute *bch_cached_dev_files[] = { · 100 unmodified lines
313322 &sysfs_writeback_rate_update_seconds,
314323 &sysfs_writeback_rate_d_term,
315324 &sysfs_writeback_rate_p_term_inverse,
316− &sysfs_writeback_rate_d_smooth,
317325 &sysfs_writeback_rate_debug,
318326 &sysfs_dirty_data,
319327 &sysfs_stripe_size,
drivers/md/bcache/util.c+7−1
@@ -209,7 +209,13 @@ uint64_t bch_next_delay(struct bch_ratelimit *d, uint64_t done) · 208 unmodified lines
209209 {
210210 uint64_t now = local_clock();
211211
212− d->next += div_u64(done, d->rate);
212+ d->next += div_u64(done * NSEC_PER_SEC, d->rate);
213+
214+ if (time_before64(now + NSEC_PER_SEC, d->next))
215+ d->next = now + NSEC_PER_SEC;
216+
217+ if (time_after64(now - NSEC_PER_SEC * 2, d->next))
218+ d->next = now - NSEC_PER_SEC * 2;
213219
214220 return time_after64(d->next, now)
215221 ? div_u64(d->next - now, NSEC_PER_SEC / HZ)
drivers/md/bcache/util.h+1−1
@@ -110,7 +110,7 @@ do { \ · 109 unmodified lines
110110 _r; \
111111 })
112112
113−#define heap_peek(h) ((h)->size ? (h)->data[0] : NULL)
113+#define heap_peek(h) ((h)->used ? (h)->data[0] : NULL)
114114
115115 #define heap_full(h) ((h)->used == (h)->size)
116116
drivers/md/bcache/writeback.c+25−28
@@ -30,38 +30,40 @@ static void __update_writeback_rate(struct cached_dev *dc) · 29 unmodified lines
3030
3131 /* PD controller */
3232
33− int change = 0;
34− int64_t error;
3533 int64_t dirty = bcache_dev_sectors_dirty(&dc->disk);
3634 int64_t derivative = dirty - dc->disk.sectors_dirty_last;
35+ int64_t proportional = dirty - target;
36+ int64_t change;
3737
3838 dc->disk.sectors_dirty_last = dirty;
3939
40− derivative *= dc->writeback_rate_d_term;
41− derivative = clamp(derivative, -dirty, dirty);
40+ /* Scale to sectors per second */
4241
43− derivative = ewma_add(dc->disk.sectors_dirty_derivative, derivative,
44− dc->writeback_rate_d_smooth, 0);
42+ proportional *= dc->writeback_rate_update_seconds;
43+ proportional = div_s64(proportional, dc->writeback_rate_p_term_inverse);
4544
46− /* Avoid divide by zero */
47− if (!target)
48− goto out;
45+ derivative = div_s64(derivative, dc->writeback_rate_update_seconds);
4946
50− error = div64_s64((dirty + derivative - target) << 8, target);
47+ derivative = ewma_add(dc->disk.sectors_dirty_derivative, derivative,
48+ (dc->writeback_rate_d_term /
49+ dc->writeback_rate_update_seconds) ?: 1, 0);
50+
51+ derivative *= dc->writeback_rate_d_term;
52+ derivative = div_s64(derivative, dc->writeback_rate_p_term_inverse);
5153
52− change = div_s64((dc->writeback_rate.rate * error) >> 8,
53− dc->writeback_rate_p_term_inverse);
54+ change = proportional + derivative;
5455
5556 /* Don't increase writeback rate if the device isn't keeping up */
5657 if (change > 0 &&
5758 time_after64(local_clock(),
58− dc->writeback_rate.next + 10 * NSEC_PER_MSEC))
59+ dc->writeback_rate.next + NSEC_PER_MSEC))
5960 change = 0;
6061
6162 dc->writeback_rate.rate =
62− clamp_t(int64_t, dc->writeback_rate.rate + change,
63+ clamp_t(int64_t, (int64_t) dc->writeback_rate.rate + change,
6364 1, NSEC_PER_MSEC);
64−out:
65+
66+ dc->writeback_rate_proportional = proportional;
6567 dc->writeback_rate_derivative = derivative;
6668 dc->writeback_rate_change = change;
6769 dc->writeback_rate_target = target;
@@ -87,15 +89,11 @@ static void update_writeback_rate(struct work_struct *work) · 19 unmodified lines
8789
8890 static unsigned writeback_delay(struct cached_dev *dc, unsigned sectors)
8991 {
90− uint64_t ret;
91−
9292 if (test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags) ||
9393 !dc->writeback_percent)
9494 return 0;
9595
96− ret = bch_next_delay(&dc->writeback_rate, sectors * 10000000ULL);
97−
98− return min_t(uint64_t, ret, HZ);
96+ return bch_next_delay(&dc->writeback_rate, sectors);
9997 }
10098
10199 struct dirty_io {
@@ -241,7 +239,7 @@ static void read_dirty(struct cached_dev *dc) · 139 unmodified lines
241239 if (KEY_START(&w->key) != dc->last_read ||
242240 jiffies_to_msecs(delay) > 50)
243241 while (!kthread_should_stop() && delay)
244− delay = schedule_timeout_interruptible(delay);
242+ delay = schedule_timeout_uninterruptible(delay);
245243
246244 dc->last_read = KEY_OFFSET(&w->key);
247245
@@ -438,7 +436,7 @@ static int bch_writeback_thread(void *arg) · 190 unmodified lines
438436 while (delay &&
439437 !kthread_should_stop() &&
440438 !test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags))
441− delay = schedule_timeout_interruptible(delay);
439+ delay = schedule_timeout_uninterruptible(delay);
442440 }
443441 }
444442
@@ -476,6 +474,8 @@ void bch_sectors_dirty_init(struct cached_dev *dc) · 31 unmodified lines
476474
477475 bch_btree_map_keys(&op.op, dc->disk.c, &KEY(op.inode, 0, 0),
478476 sectors_dirty_init_fn, 0);
477+
478+ dc->disk.sectors_dirty_last = bcache_dev_sectors_dirty(&dc->disk);
479479 }
480480
481481 int bch_cached_dev_writeback_init(struct cached_dev *dc)
@@ -490,18 +490,15 @@ int bch_cached_dev_writeback_init(struct cached_dev *dc) · 8 unmodified lines
490490 dc->writeback_delay = 30;
491491 dc->writeback_rate.rate = 1024;
492492
493− dc->writeback_rate_update_seconds = 30;
494− dc->writeback_rate_d_term = 16;
495− dc->writeback_rate_p_term_inverse = 64;
496− dc->writeback_rate_d_smooth = 8;
493+ dc->writeback_rate_update_seconds = 5;
494+ dc->writeback_rate_d_term = 30;
495+ dc->writeback_rate_p_term_inverse = 6000;
497496
498497 dc->writeback_thread = kthread_create(bch_writeback_thread, dc,
499498 "bcache_writeback");
500499 if (IS_ERR(dc->writeback_thread))
501500 return PTR_ERR(dc->writeback_thread);
502501
503− set_task_state(dc->writeback_thread, TASK_INTERRUPTIBLE);
504−
505502 INIT_DELAYED_WORK(&dc->writeback_rate_update, update_writeback_rate);
506503 schedule_delayed_work(&dc->writeback_rate_update,
507504 dc->writeback_rate_update_seconds * HZ);
drivers/md/md.c+15−3
@@ -1077,6 +1077,7 @@ static int super_90_validate(struct mddev *mddev, struct md_rdev *rdev) · 1076 unmodified lines
10771077 rdev->raid_disk = -1;
10781078 clear_bit(Faulty, &rdev->flags);
10791079 clear_bit(In_sync, &rdev->flags);
1080+ clear_bit(Bitmap_sync, &rdev->flags);
10801081 clear_bit(WriteMostly, &rdev->flags);
10811082
10821083 if (mddev->raid_disks == 0) {
@@ -1155,6 +1156,8 @@ static int super_90_validate(struct mddev *mddev, struct md_rdev *rdev) · 72 unmodified lines
11551156 */
11561157 if (ev1 < mddev->bitmap->events_cleared)
11571158 return 0;
1159+ if (ev1 < mddev->events)
1160+ set_bit(Bitmap_sync, &rdev->flags);
11581161 } else {
11591162 if (ev1 < mddev->events)
11601163 /* just a hot-add of a new device, leave raid_disk at -1 */
@@ -1563,6 +1566,7 @@ static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev) · 402 unmodified lines
15631566 rdev->raid_disk = -1;
15641567 clear_bit(Faulty, &rdev->flags);
15651568 clear_bit(In_sync, &rdev->flags);
1569+ clear_bit(Bitmap_sync, &rdev->flags);
15661570 clear_bit(WriteMostly, &rdev->flags);
15671571
15681572 if (mddev->raid_disks == 0) {
@@ -1645,6 +1649,8 @@ static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev) · 76 unmodified lines
16451649 */
16461650 if (ev1 < mddev->bitmap->events_cleared)
16471651 return 0;
1652+ if (ev1 < mddev->events)
1653+ set_bit(Bitmap_sync, &rdev->flags);
16481654 } else {
16491655 if (ev1 < mddev->events)
16501656 /* just a hot-add of a new device, leave raid_disk at -1 */
@@ -2788,6 +2794,7 @@ slot_store(struct md_rdev *rdev, const char *buf, size_t len) · 1137 unmodified lines
27882794 else
27892795 rdev->saved_raid_disk = -1;
27902796 clear_bit(In_sync, &rdev->flags);
2797+ clear_bit(Bitmap_sync, &rdev->flags);
27912798 err = rdev->mddev->pers->
27922799 hot_add_disk(rdev->mddev, rdev);
27932800 if (err) {
@@ -5760,6 +5767,7 @@ static int add_new_disk(struct mddev * mddev, mdu_disk_info_t *info) · 2966 unmodified lines
57605767 info->raid_disk < mddev->raid_disks) {
57615768 rdev->raid_disk = info->raid_disk;
57625769 set_bit(In_sync, &rdev->flags);
5770+ clear_bit(Bitmap_sync, &rdev->flags);
57635771 } else
57645772 rdev->raid_disk = -1;
57655773 } else
@@ -7706,7 +7714,8 @@ static int remove_and_add_spares(struct mddev *mddev, · 1940 unmodified lines
77067714 if (test_bit(Faulty, &rdev->flags))
77077715 continue;
77087716 if (mddev->ro &&
7709− rdev->saved_raid_disk < 0)
7717+ ! (rdev->saved_raid_disk >= 0 &&
7718+ !test_bit(Bitmap_sync, &rdev->flags)))
77107719 continue;
77117720
77127721 rdev->recovery_offset = 0;
@@ -7787,9 +7796,12 @@ void md_check_recovery(struct mddev *mddev) · 74 unmodified lines
77877796 * As we only add devices that are already in-sync,
77887797 * we can activate the spares immediately.
77897798 */
7790− clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
77917799 remove_and_add_spares(mddev, NULL);
7792− mddev->pers->spare_active(mddev);
7800+ /* There is no thread, but we need to call
7801+ * ->spare_active and clear saved_raid_disk
7802+ */
7803+ md_reap_sync_thread(mddev);
7804+ clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
77937805 goto unlock;
77947806 }
77957807
drivers/md/md.h+3−0
@@ -129,6 +129,9 @@ struct md_rdev { · 128 unmodified lines
129129 enum flag_bits {
130130 Faulty, /* device is known to have a fault */
131131 In_sync, /* device is in_sync with rest of array */
132+ Bitmap_sync, /* ..actually, not quite In_sync. Need a
133+ * bitmap-based recovery to get fully in sync
134+ */
132135 Unmerged, /* device is being added to array and should
133136 * be considerred for bvec_merge_fn but not
134137 * yet for actual IO
drivers/md/raid1.c+1−2
@@ -924,9 +924,8 @@ static sector_t wait_barrier(struct r1conf *conf, struct bio *bio) · 923 unmodified lines
924924 conf->next_window_requests++;
925925 else
926926 conf->current_window_requests++;
927− }
928− if (bio->bi_sector >= conf->start_next_window)
929927 sector = conf->start_next_window;
928+ }
930929 }
931930
932931 conf->nr_pending++;
drivers/md/raid10.c+6−6
@@ -1319,7 +1319,7 @@ read_again: · 1318 unmodified lines
13191319 /* Could not read all from this device, so we will
13201320 * need another r10_bio.
13211321 */
1322− sectors_handled = (r10_bio->sectors + max_sectors
1322+ sectors_handled = (r10_bio->sector + max_sectors
13231323 - bio->bi_sector);
13241324 r10_bio->sectors = max_sectors;
13251325 spin_lock_irq(&conf->device_lock);
@@ -1327,7 +1327,7 @@ read_again: · 1 unmodified line
13271327 bio->bi_phys_segments = 2;
13281328 else
13291329 bio->bi_phys_segments++;
1330− spin_unlock(&conf->device_lock);
1330+ spin_unlock_irq(&conf->device_lock);
13311331 /* Cannot call generic_make_request directly
13321332 * as that will be queued in __generic_make_request
13331333 * and subsequent mempool_alloc might block
@@ -3218,10 +3218,6 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, · 1884 unmodified lines
32183218 if (j == conf->copies) {
32193219 /* Cannot recover, so abort the recovery or
32203220 * record a bad block */
3221− put_buf(r10_bio);
3222− if (rb2)
3223− atomic_dec(&rb2->remaining);
3224− r10_bio = rb2;
32253221 if (any_working) {
32263222 /* problem is that there are bad blocks
32273223 * on other device(s)
@@ -3253,6 +3249,10 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, · 25 unmodified lines
32533249 mirror->recovery_disabled
32543250 = mddev->recovery_disabled;
32553251 }
3252+ put_buf(r10_bio);
3253+ if (rb2)
3254+ atomic_dec(&rb2->remaining);
3255+ r10_bio = rb2;
32563256 break;
32573257 }
32583258 }
drivers/md/raid5.c+4−3
@@ -687,7 +687,8 @@ get_active_stripe(struct r5conf *conf, sector_t sector, · 686 unmodified lines
687687 } else {
688688 if (!test_bit(STRIPE_HANDLE, &sh->state))
689689 atomic_inc(&conf->active_stripes);
690− BUG_ON(list_empty(&sh->lru));
690+ BUG_ON(list_empty(&sh->lru) &&
691+ !test_bit(STRIPE_EXPANDING, &sh->state));
691692 list_del_init(&sh->lru);
692693 if (sh->group) {
693694 sh->group->stripes_cnt--;
@@ -3608,7 +3609,7 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s) · 2914 unmodified lines
36083609 */
36093610 set_bit(R5_Insync, &dev->flags);
36103611
3611− if (rdev && test_bit(R5_WriteError, &dev->flags)) {
3612+ if (test_bit(R5_WriteError, &dev->flags)) {
36123613 /* This flag does not apply to '.replacement'
36133614 * only to .rdev, so make sure to check that*/
36143615 struct md_rdev *rdev2 = rcu_dereference(
@@ -3621,7 +3622,7 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s) · 6 unmodified lines
36213622 } else
36223623 clear_bit(R5_WriteError, &dev->flags);
36233624 }
3624− if (rdev && test_bit(R5_MadeGood, &dev->flags)) {
3625+ if (test_bit(R5_MadeGood, &dev->flags)) {
36253626 /* This flag does not apply to '.replacement'
36263627 * only to .rdev, so make sure to check that*/
36273628 struct md_rdev *rdev2 = rcu_dereference(
drivers/mfd/rtsx_pcr.c+8−2
@@ -1228,8 +1228,14 @@ static void rtsx_pci_remove(struct pci_dev *pcidev) · 1227 unmodified lines
12281228
12291229 pcr->remove_pci = true;
12301230
1231− cancel_delayed_work(&pcr->carddet_work);
1232− cancel_delayed_work(&pcr->idle_work);
1231+ /* Disable interrupts at the pcr level */
1232+ spin_lock_irq(&pcr->lock);
1233+ rtsx_pci_writel(pcr, RTSX_BIER, 0);
1234+ pcr->bier = 0;
1235+ spin_unlock_irq(&pcr->lock);
1236+
1237+ cancel_delayed_work_sync(&pcr->carddet_work);
1238+ cancel_delayed_work_sync(&pcr->idle_work);
12331239
12341240 mfd_remove_devices(&pcidev->dev);
12351241
drivers/mtd/maps/pxa2xx-flash.c+1−1
@@ -73,7 +73,7 @@ static int pxa2xx_flash_probe(struct platform_device *pdev) · 72 unmodified lines
7373 return -ENOMEM;
7474 }
7575 info->map.cached =
76− ioremap_cached(info->map.phys, info->map.size);
76+ ioremap_cache(info->map.phys, info->map.size);
7777 if (!info->map.cached)
7878 printk(KERN_WARNING "Failed to ioremap cached %s\n",
7979 info->map.name);
drivers/net/bonding/bond_3ad.c+33−12
@@ -2201,20 +2201,25 @@ void bond_3ad_adapter_speed_changed(struct slave *slave) · 2200 unmodified lines
22012201
22022202 port = &(SLAVE_AD_INFO(slave).port);
22032203
2204− // if slave is null, the whole port is not initialized
2204+ /* if slave is null, the whole port is not initialized */
22052205 if (!port->slave) {
22062206 pr_warning("Warning: %s: speed changed for uninitialized port on %s\n",
22072207 slave->bond->dev->name, slave->dev->name);
22082208 return;
22092209 }
22102210
2211+ __get_state_machine_lock(port);
2212+
22112213 port->actor_admin_port_key &= ~AD_SPEED_KEY_BITS;
22122214 port->actor_oper_port_key = port->actor_admin_port_key |=
22132215 (__get_link_speed(port) << 1);
22142216 pr_debug("Port %d changed speed\n", port->actor_port_number);
2215− // there is no need to reselect a new aggregator, just signal the
2216− // state machines to reinitialize
2217+ /* there is no need to reselect a new aggregator, just signal the
2218+ * state machines to reinitialize
2219+ */
22172220 port->sm_vars |= AD_PORT_BEGIN;
2221+
2222+ __release_state_machine_lock(port);
22182223 }
22192224
22202225 /**
@@ -2229,20 +2234,25 @@ void bond_3ad_adapter_duplex_changed(struct slave *slave) · 8 unmodified lines
22292234
22302235 port = &(SLAVE_AD_INFO(slave).port);
22312236
2232− // if slave is null, the whole port is not initialized
2237+ /* if slave is null, the whole port is not initialized */
22332238 if (!port->slave) {
22342239 pr_warning("%s: Warning: duplex changed for uninitialized port on %s\n",
22352240 slave->bond->dev->name, slave->dev->name);
22362241 return;
22372242 }
22382243
2244+ __get_state_machine_lock(port);
2245+
22392246 port->actor_admin_port_key &= ~AD_DUPLEX_KEY_BITS;
22402247 port->actor_oper_port_key = port->actor_admin_port_key |=
22412248 __get_duplex(port);
22422249 pr_debug("Port %d changed duplex\n", port->actor_port_number);
2243− // there is no need to reselect a new aggregator, just signal the
2244− // state machines to reinitialize
2250+ /* there is no need to reselect a new aggregator, just signal the
2251+ * state machines to reinitialize
2252+ */
22452253 port->sm_vars |= AD_PORT_BEGIN;
2254+
2255+ __release_state_machine_lock(port);
22462256 }
22472257
22482258 /**
@@ -2258,15 +2268,21 @@ void bond_3ad_handle_link_change(struct slave *slave, char link) · 9 unmodified lines
22582268
22592269 port = &(SLAVE_AD_INFO(slave).port);
22602270
2261− // if slave is null, the whole port is not initialized
2271+ /* if slave is null, the whole port is not initialized */
22622272 if (!port->slave) {
22632273 pr_warning("Warning: %s: link status changed for uninitialized port on %s\n",
22642274 slave->bond->dev->name, slave->dev->name);
22652275 return;
22662276 }
22672277
2268− // on link down we are zeroing duplex and speed since some of the adaptors(ce1000.lan) report full duplex/speed instead of N/A(duplex) / 0(speed)
2269− // on link up we are forcing recheck on the duplex and speed since some of he adaptors(ce1000.lan) report
2278+ __get_state_machine_lock(port);
2279+ /* on link down we are zeroing duplex and speed since
2280+ * some of the adaptors(ce1000.lan) report full duplex/speed
2281+ * instead of N/A(duplex) / 0(speed).
2282+ *
2283+ * on link up we are forcing recheck on the duplex and speed since
2284+ * some of he adaptors(ce1000.lan) report.
2285+ */
22702286 if (link == BOND_LINK_UP) {
22712287 port->is_enabled = true;
22722288 port->actor_admin_port_key &= ~AD_DUPLEX_KEY_BITS;
@@ -2282,10 +2298,15 @@ void bond_3ad_handle_link_change(struct slave *slave, char link) · 9 unmodified lines
22822298 port->actor_oper_port_key = (port->actor_admin_port_key &=
22832299 ~AD_SPEED_KEY_BITS);
22842300 }
2285− //BOND_PRINT_DBG(("Port %d changed link status to %s", port->actor_port_number, ((link == BOND_LINK_UP)?"UP":"DOWN")));
2286− // there is no need to reselect a new aggregator, just signal the
2287− // state machines to reinitialize
2301+ pr_debug("Port %d changed link status to %s",
2302+ port->actor_port_number,
2303+ (link == BOND_LINK_UP) ? "UP" : "DOWN");
2304+ /* there is no need to reselect a new aggregator, just signal the
2305+ * state machines to reinitialize
2306+ */
22882307 port->sm_vars |= AD_PORT_BEGIN;
2308+
2309+ __release_state_machine_lock(port);
22892310 }
22902311
22912312 /*
drivers/net/bonding/bond_main.c+2−1
@@ -3732,7 +3732,8 @@ static inline int bond_slave_override(struct bonding *bond, · 3731 unmodified lines
37323732 }
37333733
37343734
3735−static u16 bond_select_queue(struct net_device *dev, struct sk_buff *skb)
3735+static u16 bond_select_queue(struct net_device *dev, struct sk_buff *skb,
3736+ void *accel_priv)
37363737 {
37373738 /*
37383739 * This helper function exists to help dev_pick_tx get the correct
drivers/net/can/usb/ems_usb.c+2−1
@@ -625,6 +625,7 @@ static int ems_usb_start(struct ems_usb *dev) · 624 unmodified lines
625625 usb_unanchor_urb(urb);
626626 usb_free_coherent(dev->udev, RX_BUFFER_SIZE, buf,
627627 urb->transfer_dma);
628+ usb_free_urb(urb);
628629 break;
629630 }
630631
@@ -798,8 +799,8 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne · 167 unmodified lines
798799 * allowed (MAX_TX_URBS).
799800 */
800801 if (!context) {
801− usb_unanchor_urb(urb);
802802 usb_free_coherent(dev->udev, size, buf, urb->transfer_dma);
803+ usb_free_urb(urb);
803804
804805 netdev_warn(netdev, "couldn't find free context\n");
805806
drivers/net/can/usb/peak_usb/pcan_usb_pro.c+3−0
@@ -927,6 +927,9 @@ static int pcan_usb_pro_init(struct peak_usb_device *dev) · 926 unmodified lines
927927 /* set LED in default state (end of init phase) */
928928 pcan_usb_pro_set_led(dev, 0, 1);
929929
930+ kfree(bi);
931+ kfree(fi);
932+
930933 return 0;
931934
932935 err_out:
drivers/net/ethernet/arc/emac_main.c+2−2
@@ -565,6 +565,8 @@ static int arc_emac_tx(struct sk_buff *skb, struct net_device *ndev) · 564 unmodified lines
565565 /* Make sure pointer to data buffer is set */
566566 wmb();
567567
568+ skb_tx_timestamp(skb);
569+
568570 *info = cpu_to_le32(FOR_EMAC | FIRST_OR_LAST_MASK | len);
569571
570572 /* Increment index to point to the next BD */
@@ -579,8 +581,6 @@ static int arc_emac_tx(struct sk_buff *skb, struct net_device *ndev) · 8 unmodified lines
579581
580582 arc_reg_set(priv, R_STATUS, TXPL_MASK);
581583
582− skb_tx_timestamp(skb);
583−
584584 return NETDEV_TX_OK;
585585 }
586586
drivers/net/ethernet/atheros/atl1c/atl1c_main.c+5−3
@@ -145,9 +145,11 @@ static void atl1c_reset_pcie(struct atl1c_hw *hw, u32 flag) · 144 unmodified lines
145145 * Mask some pcie error bits
146146 */
147147 pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ERR);
148− pci_read_config_dword(pdev, pos + PCI_ERR_UNCOR_SEVER, &data);
149− data &= ~(PCI_ERR_UNC_DLP | PCI_ERR_UNC_FCP);
150− pci_write_config_dword(pdev, pos + PCI_ERR_UNCOR_SEVER, data);
148+ if (pos) {
149+ pci_read_config_dword(pdev, pos + PCI_ERR_UNCOR_SEVER, &data);
150+ data &= ~(PCI_ERR_UNC_DLP | PCI_ERR_UNC_FCP);
151+ pci_write_config_dword(pdev, pos + PCI_ERR_UNCOR_SEVER, data);
152+ }
151153 /* clear error status */
152154 pcie_capability_write_word(pdev, PCI_EXP_DEVSTA,
153155 PCI_EXP_DEVSTA_NFED |
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h+40−11
@@ -520,10 +520,12 @@ struct bnx2x_fastpath { · 519 unmodified lines
520520 #define BNX2X_FP_STATE_IDLE 0
521521 #define BNX2X_FP_STATE_NAPI (1 << 0) /* NAPI owns this FP */
522522 #define BNX2X_FP_STATE_POLL (1 << 1) /* poll owns this FP */
523−#define BNX2X_FP_STATE_NAPI_YIELD (1 << 2) /* NAPI yielded this FP */
524−#define BNX2X_FP_STATE_POLL_YIELD (1 << 3) /* poll yielded this FP */
523+#define BNX2X_FP_STATE_DISABLED (1 << 2)
524+#define BNX2X_FP_STATE_NAPI_YIELD (1 << 3) /* NAPI yielded this FP */
525+#define BNX2X_FP_STATE_POLL_YIELD (1 << 4) /* poll yielded this FP */
526+#define BNX2X_FP_OWNED (BNX2X_FP_STATE_NAPI | BNX2X_FP_STATE_POLL)
525527 #define BNX2X_FP_YIELD (BNX2X_FP_STATE_NAPI_YIELD | BNX2X_FP_STATE_POLL_YIELD)
526−#define BNX2X_FP_LOCKED (BNX2X_FP_STATE_NAPI | BNX2X_FP_STATE_POLL)
528+#define BNX2X_FP_LOCKED (BNX2X_FP_OWNED | BNX2X_FP_STATE_DISABLED)
527529 #define BNX2X_FP_USER_PEND (BNX2X_FP_STATE_POLL | BNX2X_FP_STATE_POLL_YIELD)
528530 /* protect state */
529531 spinlock_t lock;
@@ -613,7 +615,7 @@ static inline bool bnx2x_fp_lock_napi(struct bnx2x_fastpath *fp) · 83 unmodified lines
613615 {
614616 bool rc = true;
615617
616− spin_lock(&fp->lock);
618+ spin_lock_bh(&fp->lock);
617619 if (fp->state & BNX2X_FP_LOCKED) {
618620 WARN_ON(fp->state & BNX2X_FP_STATE_NAPI);
619621 fp->state |= BNX2X_FP_STATE_NAPI_YIELD;
@@ -622,7 +624,7 @@ static inline bool bnx2x_fp_lock_napi(struct bnx2x_fastpath *fp) · 2 unmodified lines
622624 /* we don't care if someone yielded */
623625 fp->state = BNX2X_FP_STATE_NAPI;
624626 }
625− spin_unlock(&fp->lock);
627+ spin_unlock_bh(&fp->lock);
626628 return rc;
627629 }
628630
@@ -631,14 +633,16 @@ static inline bool bnx2x_fp_unlock_napi(struct bnx2x_fastpath *fp) · 2 unmodified lines
631633 {
632634 bool rc = false;
633635
634− spin_lock(&fp->lock);
636+ spin_lock_bh(&fp->lock);
635637 WARN_ON(fp->state &
636638 (BNX2X_FP_STATE_POLL | BNX2X_FP_STATE_NAPI_YIELD));
637639
638640 if (fp->state & BNX2X_FP_STATE_POLL_YIELD)
639641 rc = true;
640− fp->state = BNX2X_FP_STATE_IDLE;
641− spin_unlock(&fp->lock);
642+
643+ /* state ==> idle, unless currently disabled */
644+ fp->state &= BNX2X_FP_STATE_DISABLED;
645+ spin_unlock_bh(&fp->lock);
642646 return rc;
643647 }
644648
@@ -669,7 +673,9 @@ static inline bool bnx2x_fp_unlock_poll(struct bnx2x_fastpath *fp) · 24 unmodified lines
669673
670674 if (fp->state & BNX2X_FP_STATE_POLL_YIELD)
671675 rc = true;
672− fp->state = BNX2X_FP_STATE_IDLE;
676+
677+ /* state ==> idle, unless currently disabled */
678+ fp->state &= BNX2X_FP_STATE_DISABLED;
673679 spin_unlock_bh(&fp->lock);
674680 return rc;
675681 }
@@ -677,9 +683,23 @@ static inline bool bnx2x_fp_unlock_poll(struct bnx2x_fastpath *fp) · 1 unmodified line
677683 /* true if a socket is polling, even if it did not get the lock */
678684 static inline bool bnx2x_fp_ll_polling(struct bnx2x_fastpath *fp)
679685 {
680− WARN_ON(!(fp->state & BNX2X_FP_LOCKED));
686+ WARN_ON(!(fp->state & BNX2X_FP_OWNED));
681687 return fp->state & BNX2X_FP_USER_PEND;
682688 }
689+
690+/* false if fp is currently owned */
691+static inline bool bnx2x_fp_ll_disable(struct bnx2x_fastpath *fp)
692+{
693+ int rc = true;
694+
695+ spin_lock_bh(&fp->lock);
696+ if (fp->state & BNX2X_FP_OWNED)
697+ rc = false;
698+ fp->state |= BNX2X_FP_STATE_DISABLED;
699+ spin_unlock_bh(&fp->lock);
700+
701+ return rc;
702+}
683703 #else
684704 static inline void bnx2x_fp_init_lock(struct bnx2x_fastpath *fp)
685705 {
@@ -709,6 +729,10 @@ static inline bool bnx2x_fp_ll_polling(struct bnx2x_fastpath *fp) · 23 unmodified lines
709729 {
710730 return false;
711731 }
732+static inline bool bnx2x_fp_ll_disable(struct bnx2x_fastpath *fp)
733+{
734+ return true;
735+}
712736 #endif /* CONFIG_NET_RX_BUSY_POLL */
713737
714738 /* Use 2500 as a mini-jumbo MTU for FCoE */
@@ -1250,7 +1274,10 @@ struct bnx2x_slowpath { · 535 unmodified lines
12501274 * Therefore, if they would have been defined in the same union,
12511275 * data can get corrupted.
12521276 */
1253− struct afex_vif_list_ramrod_data func_afex_rdata;
1277+ union {
1278+ struct afex_vif_list_ramrod_data viflist_data;
1279+ struct function_update_data func_update;
1280+ } func_afex_rdata;
12541281
12551282 /* used by dmae command executer */
12561283 struct dmae_command dmae[MAX_DMAE_C];
@@ -2499,4 +2526,6 @@ void bnx2x_set_local_cmng(struct bnx2x *bp); · 1242 unmodified lines
24992526 #define MCPR_SCRATCH_BASE(bp) \
25002527 (CHIP_IS_E1x(bp) ? MCP_REG_MCPR_SCRATCH : MCP_A_REG_MCPR_SCRATCH)
25012528
2529+#define E1H_MAX_MF_SB_COUNT (HC_SB_MAX_SB_E1X/(E1HVN_MAX * PORT_MAX))
2530+
25022531 #endif /* bnx2x.h */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c+15−13
@@ -160,6 +160,7 @@ static u16 bnx2x_free_tx_pkt(struct bnx2x *bp, struct bnx2x_fp_txdata *txdata, · 159 unmodified lines
160160 struct sk_buff *skb = tx_buf->skb;
161161 u16 bd_idx = TX_BD(tx_buf->first_bd), new_cons;
162162 int nbd;
163+ u16 split_bd_len = 0;
163164
164165 /* prefetch skb end pointer to speedup dev_kfree_skb() */
165166 prefetch(&skb->end);
@@ -167,10 +168,7 @@ static u16 bnx2x_free_tx_pkt(struct bnx2x *bp, struct bnx2x_fp_txdata *txdata, · 1 unmodified line
167168 DP(NETIF_MSG_TX_DONE, "fp[%d]: pkt_idx %d buff @(%p)->skb %p\n",
168169 txdata->txq_index, idx, tx_buf, skb);
169170
170− /* unmap first bd */
171171 tx_start_bd = &txdata->tx_desc_ring[bd_idx].start_bd;
172− dma_unmap_single(&bp->pdev->dev, BD_UNMAP_ADDR(tx_start_bd),
173− BD_UNMAP_LEN(tx_start_bd), DMA_TO_DEVICE);
174172
175173 nbd = le16_to_cpu(tx_start_bd->nbd) - 1;
176174 #ifdef BNX2X_STOP_ON_ERROR
@@ -188,12 +186,19 @@ static u16 bnx2x_free_tx_pkt(struct bnx2x *bp, struct bnx2x_fp_txdata *txdata, · 11 unmodified lines
188186 --nbd;
189187 bd_idx = TX_BD(NEXT_TX_IDX(bd_idx));
190188
191− /* ...and the TSO split header bd since they have no mapping */
189+ /* TSO headers+data bds share a common mapping. See bnx2x_tx_split() */
192190 if (tx_buf->flags & BNX2X_TSO_SPLIT_BD) {
191+ tx_data_bd = &txdata->tx_desc_ring[bd_idx].reg_bd;
192+ split_bd_len = BD_UNMAP_LEN(tx_data_bd);
193193 --nbd;
194194 bd_idx = TX_BD(NEXT_TX_IDX(bd_idx));
195195 }
196196
197+ /* unmap first bd */
198+ dma_unmap_single(&bp->pdev->dev, BD_UNMAP_ADDR(tx_start_bd),
199+ BD_UNMAP_LEN(tx_start_bd) + split_bd_len,
200+ DMA_TO_DEVICE);
201+
197202 /* now free frags */
198203 while (nbd > 0) {
199204
@@ -1790,26 +1795,22 @@ static void bnx2x_napi_disable_cnic(struct bnx2x *bp) · 1590 unmodified lines
17901795 {
17911796 int i;
17921797
1793− local_bh_disable();
17941798 for_each_rx_queue_cnic(bp, i) {
17951799 napi_disable(&bnx2x_fp(bp, i, napi));
1796− while (!bnx2x_fp_lock_napi(&bp->fp[i]))
1797− mdelay(1);
1800+ while (!bnx2x_fp_ll_disable(&bp->fp[i]))
1801+ usleep_range(1000, 2000);
17981802 }
1799− local_bh_enable();
18001803 }
18011804
18021805 static void bnx2x_napi_disable(struct bnx2x *bp)
18031806 {
18041807 int i;
18051808
1806− local_bh_disable();
18071809 for_each_eth_queue(bp, i) {
18081810 napi_disable(&bnx2x_fp(bp, i, napi));
1809− while (!bnx2x_fp_lock_napi(&bp->fp[i]))
1810− mdelay(1);
1811+ while (!bnx2x_fp_ll_disable(&bp->fp[i]))
1812+ usleep_range(1000, 2000);
18111813 }
1812− local_bh_enable();
18131814 }
18141815
18151816 void bnx2x_netif_start(struct bnx2x *bp)
@@ -1832,7 +1833,8 @@ void bnx2x_netif_stop(struct bnx2x *bp, int disable_hw) · 16 unmodified lines
18321833 bnx2x_napi_disable_cnic(bp);
18331834 }
18341835
1835−u16 bnx2x_select_queue(struct net_device *dev, struct sk_buff *skb)
1836+u16 bnx2x_select_queue(struct net_device *dev, struct sk_buff *skb,
1837+ void *accel_priv)
18361838 {
18371839 struct bnx2x *bp = netdev_priv(dev);
18381840
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h+2−1
@@ -524,7 +524,8 @@ int bnx2x_set_vf_mac(struct net_device *dev, int queue, u8 *mac); · 523 unmodified lines
524524 int bnx2x_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos);
525525
526526 /* select_queue callback */
527−u16 bnx2x_select_queue(struct net_device *dev, struct sk_buff *skb);
527+u16 bnx2x_select_queue(struct net_device *dev, struct sk_buff *skb,
528+ void *accel_priv);
528529
529530 static inline void bnx2x_update_rx_prod(struct bnx2x *bp,
530531 struct bnx2x_fastpath *fp,
drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c+58−36
@@ -3865,6 +3865,19 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, · 3864 unmodified lines
38653865
38663866 bnx2x_warpcore_enable_AN_KR2(phy, params, vars);
38673867 } else {
3868+ /* Enable Auto-Detect to support 1G over CL37 as well */
3869+ bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
3870+ MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X1, 0x10);
3871+
3872+ /* Force cl48 sync_status LOW to avoid getting stuck in CL73
3873+ * parallel-detect loop when CL73 and CL37 are enabled.
3874+ */
3875+ CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK,
3876+ MDIO_AER_BLOCK_AER_REG, 0);
3877+ bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
3878+ MDIO_WC_REG_RXB_ANA_RX_CONTROL_PCI, 0x0800);
3879+ bnx2x_set_aer_mmd(params, phy);
3880+
38683881 bnx2x_disable_kr2(params, vars, phy);
38693882 }
38703883
@@ -8120,17 +8133,20 @@ static int bnx2x_get_edc_mode(struct bnx2x_phy *phy, · 4249 unmodified lines
81208133 *edc_mode = EDC_MODE_ACTIVE_DAC;
81218134 else
81228135 check_limiting_mode = 1;
8123− } else if (copper_module_type &
8124− SFP_EEPROM_FC_TX_TECH_BITMASK_COPPER_PASSIVE) {
8136+ } else {
8137+ *edc_mode = EDC_MODE_PASSIVE_DAC;
8138+ /* Even in case PASSIVE_DAC indication is not set,
8139+ * treat it as a passive DAC cable, since some cables
8140+ * don't have this indication.
8141+ */
8142+ if (copper_module_type &
8143+ SFP_EEPROM_FC_TX_TECH_BITMASK_COPPER_PASSIVE) {
81258144 DP(NETIF_MSG_LINK,
81268145 "Passive Copper cable detected\n");
8127− *edc_mode =
8128− EDC_MODE_PASSIVE_DAC;
8129− } else {
8130− DP(NETIF_MSG_LINK,
8131− "Unknown copper-cable-type 0x%x !!!\n",
8132− copper_module_type);
8133− return -EINVAL;
8146+ } else {
8147+ DP(NETIF_MSG_LINK,
8148+ "Unknown copper-cable-type\n");
8149+ }
81348150 }
81358151 break;
81368152 }
@@ -10825,9 +10841,9 @@ static int bnx2x_54618se_config_init(struct bnx2x_phy *phy, · 2688 unmodified lines
1082510841 (1<<11));
1082610842
1082710843 if (((phy->req_line_speed == SPEED_AUTO_NEG) &&
10828− (phy->speed_cap_mask &
10829− PORT_HW_CFG_SPEED_CAPABILITY_D0_1G)) ||
10830− (phy->req_line_speed == SPEED_1000)) {
10844+ (phy->speed_cap_mask &
10845+ PORT_HW_CFG_SPEED_CAPABILITY_D0_1G)) ||
10846+ (phy->req_line_speed == SPEED_1000)) {
1083110847 an_1000_val |= (1<<8);
1083210848 autoneg_val |= (1<<9 | 1<<12);
1083310849 if (phy->req_duplex == DUPLEX_FULL)
@@ -10843,30 +10859,32 @@ static int bnx2x_54618se_config_init(struct bnx2x_phy *phy, · 9 unmodified lines
1084310859 0x09,
1084410860 &an_1000_val);
1084510861
10846− /* Set 100 speed advertisement */
10847− if (((phy->req_line_speed == SPEED_AUTO_NEG) &&
10848− (phy->speed_cap_mask &
10849− (PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_FULL |
10850− PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_HALF)))) {
10851− an_10_100_val |= (1<<7);
10852− /* Enable autoneg and restart autoneg for legacy speeds */
10853− autoneg_val |= (1<<9 | 1<<12);
10854−
10855− if (phy->req_duplex == DUPLEX_FULL)
10856− an_10_100_val |= (1<<8);
10857− DP(NETIF_MSG_LINK, "Advertising 100M\n");
10858− }
10859−
10860− /* Set 10 speed advertisement */
10861− if (((phy->req_line_speed == SPEED_AUTO_NEG) &&
10862− (phy->speed_cap_mask &
10863− (PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_FULL |
10864− PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_HALF)))) {
10865− an_10_100_val |= (1<<5);
10866− autoneg_val |= (1<<9 | 1<<12);
10867− if (phy->req_duplex == DUPLEX_FULL)
10862+ /* Advertise 10/100 link speed */
10863+ if (phy->req_line_speed == SPEED_AUTO_NEG) {
10864+ if (phy->speed_cap_mask &
10865+ PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_HALF) {
10866+ an_10_100_val |= (1<<5);
10867+ autoneg_val |= (1<<9 | 1<<12);
10868+ DP(NETIF_MSG_LINK, "Advertising 10M-HD\n");
10869+ }
10870+ if (phy->speed_cap_mask &
10871+ PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_FULL) {
1086810872 an_10_100_val |= (1<<6);
10869− DP(NETIF_MSG_LINK, "Advertising 10M\n");
10873+ autoneg_val |= (1<<9 | 1<<12);
10874+ DP(NETIF_MSG_LINK, "Advertising 10M-FD\n");
10875+ }
10876+ if (phy->speed_cap_mask &
10877+ PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_HALF) {
10878+ an_10_100_val |= (1<<7);
10879+ autoneg_val |= (1<<9 | 1<<12);
10880+ DP(NETIF_MSG_LINK, "Advertising 100M-HD\n");
10881+ }
10882+ if (phy->speed_cap_mask &
10883+ PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_FULL) {
10884+ an_10_100_val |= (1<<8);
10885+ autoneg_val |= (1<<9 | 1<<12);
10886+ DP(NETIF_MSG_LINK, "Advertising 100M-FD\n");
10887+ }
1087010888 }
1087110889
1087210890 /* Only 10/100 are allowed to work in FORCE mode */
@@ -13342,6 +13360,10 @@ static u8 bnx2x_analyze_link_error(struct link_params *params, · 2469 unmodified lines
1334213360 DP(NETIF_MSG_LINK, "Link changed:[%x %x]->%x\n", vars->link_up,
1334313361 old_status, status);
1334413362
13363+ /* Do not touch the link in case physical link down */
13364+ if ((vars->phy_flags & PHY_PHYSICAL_LINK_FLAG) == 0)
13365+ return 1;
13366+
1334513367 /* a. Update shmem->link_status accordingly
1334613368 * b. Update link_vars->link_up
1334713369 */
@@ -13550,7 +13572,7 @@ static void bnx2x_check_kr2_wa(struct link_params *params, · 202 unmodified lines
1355013572 */
1355113573 not_kr2_device = (((base_page & 0x8000) == 0) ||
1355213574 (((base_page & 0x8000) &&
13553− ((next_page & 0xe0) == 0x2))));
13575+ ((next_page & 0xe0) == 0x20))));
1355413576
1355513577 /* In case KR2 is already disabled, check if we need to re-enable it */
1355613578 if (!(vars->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) {
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c+3−3
@@ -11447,9 +11447,9 @@ static int bnx2x_get_hwinfo(struct bnx2x *bp) · 11446 unmodified lines
1144711447 }
1144811448 }
1144911449
11450− /* adjust igu_sb_cnt to MF for E1x */
11451− if (CHIP_IS_E1x(bp) && IS_MF(bp))
11452− bp->igu_sb_cnt /= E1HVN_MAX;
11450+ /* adjust igu_sb_cnt to MF for E1H */
11451+ if (CHIP_IS_E1H(bp) && IS_MF(bp))
11452+ bp->igu_sb_cnt = min_t(u8, bp->igu_sb_cnt, E1H_MAX_MF_SB_COUNT);
1145311453
1145411454 /* port info */
1145511455 bnx2x_get_port_hwinfo(bp);
drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h+1−0
@@ -7179,6 +7179,7 @@ Theotherbitsarereservedandshouldbezero*/ · 7178 unmodified lines
71797179 #define MDIO_WC_REG_RX1_PCI_CTRL 0x80ca
71807180 #define MDIO_WC_REG_RX2_PCI_CTRL 0x80da
71817181 #define MDIO_WC_REG_RX3_PCI_CTRL 0x80ea
7182+#define MDIO_WC_REG_RXB_ANA_RX_CONTROL_PCI 0x80fa
71827183 #define MDIO_WC_REG_XGXSBLK2_UNICORE_MODE_10G 0x8104
71837184 #define MDIO_WC_REG_XGXS_STATUS3 0x8129
71847185 #define MDIO_WC_REG_PAR_DET_10G_STATUS 0x8130
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c+11−4
@@ -2038,6 +2038,7 @@ static int bnx2x_vlan_mac_del_all(struct bnx2x *bp, · 2037 unmodified lines
20382038 struct bnx2x_vlan_mac_ramrod_params p;
20392039 struct bnx2x_exe_queue_obj *exeq = &o->exe_queue;
20402040 struct bnx2x_exeq_elem *exeq_pos, *exeq_pos_n;
2041+ unsigned long flags;
20412042 int read_lock;
20422043 int rc = 0;
20432044
@@ -2046,8 +2047,9 @@ static int bnx2x_vlan_mac_del_all(struct bnx2x *bp, · 2 unmodified lines
20462047 spin_lock_bh(&exeq->lock);
20472048
20482049 list_for_each_entry_safe(exeq_pos, exeq_pos_n, &exeq->exe_queue, link) {
2049− if (exeq_pos->cmd_data.vlan_mac.vlan_mac_flags ==
2050− *vlan_mac_flags) {
2050+ flags = exeq_pos->cmd_data.vlan_mac.vlan_mac_flags;
2051+ if (BNX2X_VLAN_MAC_CMP_FLAGS(flags) ==
2052+ BNX2X_VLAN_MAC_CMP_FLAGS(*vlan_mac_flags)) {
20512053 rc = exeq->remove(bp, exeq->owner, exeq_pos);
20522054 if (rc) {
20532055 BNX2X_ERR("Failed to remove command\n");
@@ -2080,7 +2082,9 @@ static int bnx2x_vlan_mac_del_all(struct bnx2x *bp, · 26 unmodified lines
20802082 return read_lock;
20812083
20822084 list_for_each_entry(pos, &o->head, link) {
2083− if (pos->vlan_mac_flags == *vlan_mac_flags) {
2085+ flags = pos->vlan_mac_flags;
2086+ if (BNX2X_VLAN_MAC_CMP_FLAGS(flags) ==
2087+ BNX2X_VLAN_MAC_CMP_FLAGS(*vlan_mac_flags)) {
20842088 p.user_req.vlan_mac_flags = pos->vlan_mac_flags;
20852089 memcpy(&p.user_req.u, &pos->u, sizeof(pos->u));
20862090 rc = bnx2x_config_vlan_mac(bp, &p);
@@ -4382,8 +4386,11 @@ int bnx2x_config_rss(struct bnx2x *bp, · 2295 unmodified lines
43824386 struct bnx2x_raw_obj *r = &o->raw;
43834387
43844388 /* Do nothing if only driver cleanup was requested */
4385− if (test_bit(RAMROD_DRV_CLR_ONLY, &p->ramrod_flags))
4389+ if (test_bit(RAMROD_DRV_CLR_ONLY, &p->ramrod_flags)) {
4390+ DP(BNX2X_MSG_SP, "Not configuring RSS ramrod_flags=%lx\n",
4391+ p->ramrod_flags);
43864392 return 0;
4393+ }
43874394
43884395 r->set_pending(r);
43894396
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h+7−0
@@ -266,6 +266,13 @@ enum { · 265 unmodified lines
266266 BNX2X_DONT_CONSUME_CAM_CREDIT,
267267 BNX2X_DONT_CONSUME_CAM_CREDIT_DEST,
268268 };
269+/* When looking for matching filters, some flags are not interesting */
270+#define BNX2X_VLAN_MAC_CMP_MASK (1 << BNX2X_UC_LIST_MAC | \
271+ 1 << BNX2X_ETH_MAC | \
272+ 1 << BNX2X_ISCSI_ETH_MAC | \
273+ 1 << BNX2X_NETQ_ETH_MAC)
274+#define BNX2X_VLAN_MAC_CMP_FLAGS(flags) \
275+ ((flags) & BNX2X_VLAN_MAC_CMP_MASK)
269276
270277 struct bnx2x_vlan_mac_ramrod_params {
271278 /* Object to run the command from */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c+144−110
@@ -1209,6 +1209,11 @@ static void bnx2x_vfop_rxmode(struct bnx2x *bp, struct bnx2x_virtf *vf) · 1208 unmodified lines
12091209 /* next state */
12101210 vfop->state = BNX2X_VFOP_RXMODE_DONE;
12111211
1212+ /* record the accept flags in vfdb so hypervisor can modify them
1213+ * if necessary
1214+ */
1215+ bnx2x_vfq(vf, ramrod->cl_id - vf->igu_base_id, accept_flags) =
1216+ ramrod->rx_accept_flags;
12121217 vfop->rc = bnx2x_config_rx_mode(bp, ramrod);
12131218 bnx2x_vfop_finalize(vf, vfop->rc, VFOP_DONE);
12141219 op_err:
@@ -1224,39 +1229,43 @@ op_pending: · 9 unmodified lines
12241229 return;
12251230 }
12261231
1232+static void bnx2x_vf_prep_rx_mode(struct bnx2x *bp, u8 qid,
1233+ struct bnx2x_rx_mode_ramrod_params *ramrod,
1234+ struct bnx2x_virtf *vf,
1235+ unsigned long accept_flags)
1236+{
1237+ struct bnx2x_vf_queue *vfq = vfq_get(vf, qid);
1238+
1239+ memset(ramrod, 0, sizeof(*ramrod));
1240+ ramrod->cid = vfq->cid;
1241+ ramrod->cl_id = vfq_cl_id(vf, vfq);
1242+ ramrod->rx_mode_obj = &bp->rx_mode_obj;
1243+ ramrod->func_id = FW_VF_HANDLE(vf->abs_vfid);
1244+ ramrod->rx_accept_flags = accept_flags;
1245+ ramrod->tx_accept_flags = accept_flags;
1246+ ramrod->pstate = &vf->filter_state;
1247+ ramrod->state = BNX2X_FILTER_RX_MODE_PENDING;
1248+
1249+ set_bit(BNX2X_FILTER_RX_MODE_PENDING, &vf->filter_state);
1250+ set_bit(RAMROD_RX, &ramrod->ramrod_flags);
1251+ set_bit(RAMROD_TX, &ramrod->ramrod_flags);
1252+
1253+ ramrod->rdata = bnx2x_vf_sp(bp, vf, rx_mode_rdata.e2);
1254+ ramrod->rdata_mapping = bnx2x_vf_sp_map(bp, vf, rx_mode_rdata.e2);
1255+}
1256+
12271257 int bnx2x_vfop_rxmode_cmd(struct bnx2x *bp,
12281258 struct bnx2x_virtf *vf,
12291259 struct bnx2x_vfop_cmd *cmd,
12301260 int qid, unsigned long accept_flags)
12311261 {
1232− struct bnx2x_vf_queue *vfq = vfq_get(vf, qid);
12331262 struct bnx2x_vfop *vfop = bnx2x_vfop_add(bp, vf);
12341263
12351264 if (vfop) {
12361265 struct bnx2x_rx_mode_ramrod_params *ramrod =
12371266 &vf->op_params.rx_mode;
12381267
1239− memset(ramrod, 0, sizeof(*ramrod));
1240−
1241− /* Prepare ramrod parameters */
1242− ramrod->cid = vfq->cid;
1243− ramrod->cl_id = vfq_cl_id(vf, vfq);
1244− ramrod->rx_mode_obj = &bp->rx_mode_obj;
1245− ramrod->func_id = FW_VF_HANDLE(vf->abs_vfid);
1246−
1247− ramrod->rx_accept_flags = accept_flags;
1248− ramrod->tx_accept_flags = accept_flags;
1249− ramrod->pstate = &vf->filter_state;
1250− ramrod->state = BNX2X_FILTER_RX_MODE_PENDING;
1251−
1252− set_bit(BNX2X_FILTER_RX_MODE_PENDING, &vf->filter_state);
1253− set_bit(RAMROD_RX, &ramrod->ramrod_flags);
1254− set_bit(RAMROD_TX, &ramrod->ramrod_flags);
1255−
1256− ramrod->rdata =
1257− bnx2x_vf_sp(bp, vf, rx_mode_rdata.e2);
1258− ramrod->rdata_mapping =
1259− bnx2x_vf_sp_map(bp, vf, rx_mode_rdata.e2);
1268+ bnx2x_vf_prep_rx_mode(bp, qid, ramrod, vf, accept_flags);
12601269
12611270 bnx2x_vfop_opset(BNX2X_VFOP_RXMODE_CONFIG,
12621271 bnx2x_vfop_rxmode, cmd->done);
@@ -3202,13 +3211,16 @@ int bnx2x_enable_sriov(struct bnx2x *bp) · 1939 unmodified lines
32023211 bnx2x_iov_static_resc(bp, vf);
32033212 }
32043213
3205− /* prepare msix vectors in VF configuration space */
3214+ /* prepare msix vectors in VF configuration space - the value in the
3215+ * PCI configuration space should be the index of the last entry,
3216+ * namely one less than the actual size of the table
3217+ */
32063218 for (vf_idx = first_vf; vf_idx < first_vf + req_vfs; vf_idx++) {
32073219 bnx2x_pretend_func(bp, HW_VF_HANDLE(bp, vf_idx));
32083220 REG_WR(bp, PCICFG_OFFSET + GRC_CONFIG_REG_VF_MSIX_CONTROL,
3209− num_vf_queues);
3221+ num_vf_queues - 1);
32103222 DP(BNX2X_MSG_IOV, "set msix vec num in VF %d cfg space to %d\n",
3211− vf_idx, num_vf_queues);
3223+ vf_idx, num_vf_queues - 1);
32123224 }
32133225 bnx2x_pretend_func(bp, BP_ABS_FUNC(bp));
32143226
@@ -3436,10 +3448,18 @@ out: · 221 unmodified lines
34363448
34373449 int bnx2x_set_vf_vlan(struct net_device *dev, int vfidx, u16 vlan, u8 qos)
34383450 {
3451+ struct bnx2x_queue_state_params q_params = {NULL};
3452+ struct bnx2x_vlan_mac_ramrod_params ramrod_param;
3453+ struct bnx2x_queue_update_params *update_params;
3454+ struct pf_vf_bulletin_content *bulletin = NULL;
3455+ struct bnx2x_rx_mode_ramrod_params rx_ramrod;
34393456 struct bnx2x *bp = netdev_priv(dev);
3440− int rc, q_logical_state;
3457+ struct bnx2x_vlan_mac_obj *vlan_obj;
3458+ unsigned long vlan_mac_flags = 0;
3459+ unsigned long ramrod_flags = 0;
34413460 struct bnx2x_virtf *vf = NULL;
3442− struct pf_vf_bulletin_content *bulletin = NULL;
3461+ unsigned long accept_flags;
3462+ int rc;
34433463
34443464 /* sanity and init */
34453465 rc = bnx2x_vf_ndo_prep(bp, vfidx, &vf, &bulletin);
@@ -3457,104 +3477,118 @@ int bnx2x_set_vf_vlan(struct net_device *dev, int vfidx, u16 vlan, u8 qos) · 11 unmodified lines
34573477 /* update PF's copy of the VF's bulletin. No point in posting the vlan
34583478 * to the VF since it doesn't have anything to do with it. But it useful
34593479 * to store it here in case the VF is not up yet and we can only
3460− * configure the vlan later when it does.
3480+ * configure the vlan later when it does. Treat vlan id 0 as remove the
3481+ * Host tag.
34613482 */
3462− bulletin->valid_bitmap |= 1 << VLAN_VALID;
3483+ if (vlan > 0)
3484+ bulletin->valid_bitmap |= 1 << VLAN_VALID;
3485+ else
3486+ bulletin->valid_bitmap &= ~(1 << VLAN_VALID);
34633487 bulletin->vlan = vlan;
34643488
34653489 /* is vf initialized and queue set up? */
3466− q_logical_state =
3467− bnx2x_get_q_logical_state(bp, &bnx2x_leading_vfq(vf, sp_obj));
3468− if (vf->state == VF_ENABLED &&
3469− q_logical_state == BNX2X_Q_LOGICAL_STATE_ACTIVE) {
3470− /* configure the vlan in device on this vf's queue */
3471− unsigned long ramrod_flags = 0;
3472− unsigned long vlan_mac_flags = 0;
3473− struct bnx2x_vlan_mac_obj *vlan_obj =
3474− &bnx2x_leading_vfq(vf, vlan_obj);
3475− struct bnx2x_vlan_mac_ramrod_params ramrod_param;
3476− struct bnx2x_queue_state_params q_params = {NULL};
3477− struct bnx2x_queue_update_params *update_params;
3490+ if (vf->state != VF_ENABLED ||
3491+ bnx2x_get_q_logical_state(bp, &bnx2x_leading_vfq(vf, sp_obj)) !=
3492+ BNX2X_Q_LOGICAL_STATE_ACTIVE)
3493+ return rc;
34783494
3479− rc = validate_vlan_mac(bp, &bnx2x_leading_vfq(vf, mac_obj));
3480− if (rc)
3481− return rc;
3482− memset(&ramrod_param, 0, sizeof(ramrod_param));
3495+ /* configure the vlan in device on this vf's queue */
3496+ vlan_obj = &bnx2x_leading_vfq(vf, vlan_obj);
3497+ rc = validate_vlan_mac(bp, &bnx2x_leading_vfq(vf, mac_obj));
3498+ if (rc)
3499+ return rc;
34833500
3484− /* must lock vfpf channel to protect against vf flows */
3485− bnx2x_lock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_SET_VLAN);
3501+ /* must lock vfpf channel to protect against vf flows */
3502+ bnx2x_lock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_SET_VLAN);
34863503
3487− /* remove existing vlans */
3488− __set_bit(RAMROD_COMP_WAIT, &ramrod_flags);
3489− rc = vlan_obj->delete_all(bp, vlan_obj, &vlan_mac_flags,
3490− &ramrod_flags);
3491− if (rc) {
3492− BNX2X_ERR("failed to delete vlans\n");
3493− rc = -EINVAL;
3494− goto out;
3495− }
3504+ /* remove existing vlans */
3505+ __set_bit(RAMROD_COMP_WAIT, &ramrod_flags);
3506+ rc = vlan_obj->delete_all(bp, vlan_obj, &vlan_mac_flags,
3507+ &ramrod_flags);
3508+ if (rc) {
3509+ BNX2X_ERR("failed to delete vlans\n");
3510+ rc = -EINVAL;
3511+ goto out;
3512+ }
3513+
3514+ /* need to remove/add the VF's accept_any_vlan bit */
3515+ accept_flags = bnx2x_leading_vfq(vf, accept_flags);
3516+ if (vlan)
3517+ clear_bit(BNX2X_ACCEPT_ANY_VLAN, &accept_flags);
3518+ else
3519+ set_bit(BNX2X_ACCEPT_ANY_VLAN, &accept_flags);
3520+
3521+ bnx2x_vf_prep_rx_mode(bp, LEADING_IDX, &rx_ramrod, vf,
3522+ accept_flags);
3523+ bnx2x_leading_vfq(vf, accept_flags) = accept_flags;
3524+ bnx2x_config_rx_mode(bp, &rx_ramrod);
3525+
3526+ /* configure the new vlan to device */
3527+ memset(&ramrod_param, 0, sizeof(ramrod_param));
3528+ __set_bit(RAMROD_COMP_WAIT, &ramrod_flags);
3529+ ramrod_param.vlan_mac_obj = vlan_obj;
3530+ ramrod_param.ramrod_flags = ramrod_flags;
3531+ set_bit(BNX2X_DONT_CONSUME_CAM_CREDIT,
3532+ &ramrod_param.user_req.vlan_mac_flags);
3533+ ramrod_param.user_req.u.vlan.vlan = vlan;
3534+ ramrod_param.user_req.cmd = BNX2X_VLAN_MAC_ADD;
3535+ rc = bnx2x_config_vlan_mac(bp, &ramrod_param);
3536+ if (rc) {
3537+ BNX2X_ERR("failed to configure vlan\n");
3538+ rc = -EINVAL;
3539+ goto out;
3540+ }
34963541
3497− /* send queue update ramrod to configure default vlan and silent
3498− * vlan removal
3542+ /* send queue update ramrod to configure default vlan and silent
3543+ * vlan removal
3544+ */
3545+ __set_bit(RAMROD_COMP_WAIT, &q_params.ramrod_flags);
3546+ q_params.cmd = BNX2X_Q_CMD_UPDATE;
3547+ q_params.q_obj = &bnx2x_leading_vfq(vf, sp_obj);
3548+ update_params = &q_params.params.update;
3549+ __set_bit(BNX2X_Q_UPDATE_DEF_VLAN_EN_CHNG,
3550+ &update_params->update_flags);
3551+ __set_bit(BNX2X_Q_UPDATE_SILENT_VLAN_REM_CHNG,
3552+ &update_params->update_flags);
3553+ if (vlan == 0) {
3554+ /* if vlan is 0 then we want to leave the VF traffic
3555+ * untagged, and leave the incoming traffic untouched
3556+ * (i.e. do not remove any vlan tags).
34993557 */
3500− __set_bit(RAMROD_COMP_WAIT, &q_params.ramrod_flags);
3501− q_params.cmd = BNX2X_Q_CMD_UPDATE;
3502− q_params.q_obj = &bnx2x_leading_vfq(vf, sp_obj);
3503− update_params = &q_params.params.update;
3504− __set_bit(BNX2X_Q_UPDATE_DEF_VLAN_EN_CHNG,
3558+ __clear_bit(BNX2X_Q_UPDATE_DEF_VLAN_EN,
3559+ &update_params->update_flags);
3560+ __clear_bit(BNX2X_Q_UPDATE_SILENT_VLAN_REM,
3561+ &update_params->update_flags);
3562+ } else {
3563+ /* configure default vlan to vf queue and set silent
3564+ * vlan removal (the vf remains unaware of this vlan).
3565+ */
3566+ __set_bit(BNX2X_Q_UPDATE_DEF_VLAN_EN,
35053567 &update_params->update_flags);
3506− __set_bit(BNX2X_Q_UPDATE_SILENT_VLAN_REM_CHNG,
3568+ __set_bit(BNX2X_Q_UPDATE_SILENT_VLAN_REM,
35073569 &update_params->update_flags);
3570+ update_params->def_vlan = vlan;
3571+ update_params->silent_removal_value =
3572+ vlan & VLAN_VID_MASK;
3573+ update_params->silent_removal_mask = VLAN_VID_MASK;
3574+ }
35083575
3509− if (vlan == 0) {
3510− /* if vlan is 0 then we want to leave the VF traffic
3511− * untagged, and leave the incoming traffic untouched
3512− * (i.e. do not remove any vlan tags).
3513− */
3514− __clear_bit(BNX2X_Q_UPDATE_DEF_VLAN_EN,
3515− &update_params->update_flags);
3516− __clear_bit(BNX2X_Q_UPDATE_SILENT_VLAN_REM,
3517− &update_params->update_flags);
3518− } else {
3519− /* configure the new vlan to device */
3520− __set_bit(RAMROD_COMP_WAIT, &ramrod_flags);
3521− ramrod_param.vlan_mac_obj = vlan_obj;
3522− ramrod_param.ramrod_flags = ramrod_flags;
3523− ramrod_param.user_req.u.vlan.vlan = vlan;
3524− ramrod_param.user_req.cmd = BNX2X_VLAN_MAC_ADD;
3525− rc = bnx2x_config_vlan_mac(bp, &ramrod_param);
3526− if (rc) {
3527− BNX2X_ERR("failed to configure vlan\n");
3528− rc = -EINVAL;
3529− goto out;
3530− }
3531−
3532− /* configure default vlan to vf queue and set silent
3533− * vlan removal (the vf remains unaware of this vlan).
3534− */
3535− update_params = &q_params.params.update;
3536− __set_bit(BNX2X_Q_UPDATE_DEF_VLAN_EN,
3537− &update_params->update_flags);
3538− __set_bit(BNX2X_Q_UPDATE_SILENT_VLAN_REM,
3539− &update_params->update_flags);
3540− update_params->def_vlan = vlan;
3541− }
3576+ /* Update the Queue state */
3577+ rc = bnx2x_queue_state_change(bp, &q_params);
3578+ if (rc) {
3579+ BNX2X_ERR("Failed to configure default VLAN\n");
3580+ goto out;
3581+ }
35423582
3543− /* Update the Queue state */
3544− rc = bnx2x_queue_state_change(bp, &q_params);
3545− if (rc) {
3546− BNX2X_ERR("Failed to configure default VLAN\n");
3547− goto out;
3548− }
35493583
3550− /* clear the flag indicating that this VF needs its vlan
3551− * (will only be set if the HV configured the Vlan before vf was
3552− * up and we were called because the VF came up later
3553− */
3584+ /* clear the flag indicating that this VF needs its vlan
3585+ * (will only be set if the HV configured the Vlan before vf was
3586+ * up and we were called because the VF came up later
3587+ */
35543588 out:
3555− vf->cfg_flags &= ~VF_CFG_VLAN;
3556− bnx2x_unlock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_SET_VLAN);
3557− }
3589+ vf->cfg_flags &= ~VF_CFG_VLAN;
3590+ bnx2x_unlock_vf_pf_channel(bp, vf, CHANNEL_TLV_PF_SET_VLAN);
3591+
35583592 return rc;
35593593 }
35603594
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h+1−0
@@ -74,6 +74,7 @@ struct bnx2x_vf_queue { · 73 unmodified lines
7474 /* VLANs object */
7575 struct bnx2x_vlan_mac_obj vlan_obj;
7676 atomic_t vlan_count; /* 0 means vlan-0 is set ~ untagged */
77+ unsigned long accept_flags; /* last accept flags configured */
7778
7879 /* Queue Slow-path State object */
7980 struct bnx2x_queue_sp_obj sp_obj;
drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c+25−3
@@ -208,7 +208,7 @@ static int bnx2x_get_vf_id(struct bnx2x *bp, u32 *vf_id) · 207 unmodified lines
208208 return -EINVAL;
209209 }
210210
211− BNX2X_ERR("valid ME register value: 0x%08x\n", me_reg);
211+ DP(BNX2X_MSG_IOV, "valid ME register value: 0x%08x\n", me_reg);
212212
213213 *vf_id = (me_reg & ME_REG_VF_NUM_MASK) >> ME_REG_VF_NUM_SHIFT;
214214
@@ -1598,6 +1598,8 @@ static void bnx2x_vfop_mbx_qfilters(struct bnx2x *bp, struct bnx2x_virtf *vf) · 1383 unmodified lines
15981598
15991599 if (msg->flags & VFPF_SET_Q_FILTERS_RX_MASK_CHANGED) {
16001600 unsigned long accept = 0;
1601+ struct pf_vf_bulletin_content *bulletin =
1602+ BP_VF_BULLETIN(bp, vf->index);
16011603
16021604 /* covert VF-PF if mask to bnx2x accept flags */
16031605 if (msg->rx_mask & VFPF_RX_MASK_ACCEPT_MATCHED_UNICAST)
@@ -1617,9 +1619,11 @@ static void bnx2x_vfop_mbx_qfilters(struct bnx2x *bp, struct bnx2x_virtf *vf) · 13 unmodified lines
16171619 __set_bit(BNX2X_ACCEPT_BROADCAST, &accept);
16181620
16191621 /* A packet arriving the vf's mac should be accepted
1620− * with any vlan
1622+ * with any vlan, unless a vlan has already been
1623+ * configured.
16211624 */
1622− __set_bit(BNX2X_ACCEPT_ANY_VLAN, &accept);
1625+ if (!(bulletin->valid_bitmap & (1 << VLAN_VALID)))
1626+ __set_bit(BNX2X_ACCEPT_ANY_VLAN, &accept);
16231627
16241628 /* set rx-mode */
16251629 rc = bnx2x_vfop_rxmode_cmd(bp, vf, &cmd,
@@ -1710,6 +1714,21 @@ static void bnx2x_vf_mbx_set_q_filters(struct bnx2x *bp, · 84 unmodified lines
17101714 goto response;
17111715 }
17121716 }
1717+ /* if vlan was set by hypervisor we don't allow guest to config vlan */
1718+ if (bulletin->valid_bitmap & 1 << VLAN_VALID) {
1719+ int i;
1720+
1721+ /* search for vlan filters */
1722+ for (i = 0; i < filters->n_mac_vlan_filters; i++) {
1723+ if (filters->filters[i].flags &
1724+ VFPF_Q_FILTER_VLAN_TAG_VALID) {
1725+ BNX2X_ERR("VF[%d] attempted to configure vlan but one was already set by Hypervisor. Aborting request\n",
1726+ vf->abs_vfid);
1727+ vf->op_rc = -EPERM;
1728+ goto response;
1729+ }
1730+ }
1731+ }
17131732
17141733 /* verify vf_qid */
17151734 if (filters->vf_qid > vf_rxq_count(vf))
@@ -1805,6 +1824,9 @@ static void bnx2x_vf_mbx_update_rss(struct bnx2x *bp, struct bnx2x_virtf *vf, · 89 unmodified lines
18051824 vf_op_params->rss_result_mask = rss_tlv->rss_result_mask;
18061825
18071826 /* flags handled individually for backward/forward compatability */
1827+ vf_op_params->rss_flags = 0;
1828+ vf_op_params->ramrod_flags = 0;
1829+
18081830 if (rss_tlv->rss_flags & VFPF_RSS_MODE_DISABLED)
18091831 __set_bit(BNX2X_RSS_MODE_DISABLED, &vf_op_params->rss_flags);
18101832 if (rss_tlv->rss_flags & VFPF_RSS_MODE_REGULAR)
drivers/net/ethernet/broadcom/tg3.c+1−1
@@ -7622,7 +7622,7 @@ static inline int tg3_4g_overflow_test(dma_addr_t mapping, int len) · 7621 unmodified lines
76227622 {
76237623 u32 base = (u32) mapping & 0xffffffff;
76247624
7625− return (base > 0xffffdcc0) && (base + len + 8 < base);
7625+ return base + len + 8 < base;
76267626 }
76277627
76287628 /* Test for TSO DMA buffers that cross into regions which are within MSS bytes
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h+21−0
@@ -228,6 +228,25 @@ struct tp_params { · 227 unmodified lines
228228
229229 uint32_t dack_re; /* DACK timer resolution */
230230 unsigned short tx_modq[NCHAN]; /* channel to modulation queue map */
231+
232+ u32 vlan_pri_map; /* cached TP_VLAN_PRI_MAP */
233+ u32 ingress_config; /* cached TP_INGRESS_CONFIG */
234+
235+ /* TP_VLAN_PRI_MAP Compressed Filter Tuple field offsets. This is a
236+ * subset of the set of fields which may be present in the Compressed
237+ * Filter Tuple portion of filters and TCP TCB connections. The
238+ * fields which are present are controlled by the TP_VLAN_PRI_MAP.
239+ * Since a variable number of fields may or may not be present, their
240+ * shifted field positions within the Compressed Filter Tuple may
241+ * vary, or not even be present if the field isn't selected in
242+ * TP_VLAN_PRI_MAP. Since some of these fields are needed in various
243+ * places we store their offsets here, or a -1 if the field isn't
244+ * present.
245+ */
246+ int vlan_shift;
247+ int vnic_shift;
248+ int port_shift;
249+ int protocol_shift;
231250 };
232251
233252 struct vpd_params {
@@ -926,6 +945,8 @@ int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info, · 692 unmodified lines
926945 const u8 *fw_data, unsigned int fw_size,
927946 struct fw_hdr *card_fw, enum dev_state state, int *reset);
928947 int t4_prep_adapter(struct adapter *adapter);
948+int t4_init_tp_params(struct adapter *adap);
949+int t4_filter_field_shift(const struct adapter *adap, int filter_sel);
929950 int t4_port_init(struct adapter *adap, int mbox, int pf, int vf);
930951 void t4_fatal_err(struct adapter *adapter);
931952 int t4_config_rss_range(struct adapter *adapter, int mbox, unsigned int viid,
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c+39−20
@@ -2986,7 +2986,14 @@ int cxgb4_alloc_stid(struct tid_info *t, int family, void *data) · 2985 unmodified lines
29862986 if (stid >= 0) {
29872987 t->stid_tab[stid].data = data;
29882988 stid += t->stid_base;
2989− t->stids_in_use++;
2989+ /* IPv6 requires max of 520 bits or 16 cells in TCAM
2990+ * This is equivalent to 4 TIDs. With CLIP enabled it
2991+ * needs 2 TIDs.
2992+ */
2993+ if (family == PF_INET)
2994+ t->stids_in_use++;
2995+ else
2996+ t->stids_in_use += 4;
29902997 }
29912998 spin_unlock_bh(&t->stid_lock);
29922999 return stid;
@@ -3012,7 +3019,8 @@ int cxgb4_alloc_sftid(struct tid_info *t, int family, void *data) · 19 unmodified lines
30123019 }
30133020 if (stid >= 0) {
30143021 t->stid_tab[stid].data = data;
3015− stid += t->stid_base;
3022+ stid -= t->nstids;
3023+ stid += t->sftid_base;
30163024 t->stids_in_use++;
30173025 }
30183026 spin_unlock_bh(&t->stid_lock);
@@ -3024,14 +3032,24 @@ EXPORT_SYMBOL(cxgb4_alloc_sftid); · 5 unmodified lines
30243032 */
30253033 void cxgb4_free_stid(struct tid_info *t, unsigned int stid, int family)
30263034 {
3027− stid -= t->stid_base;
3035+ /* Is it a server filter TID? */
3036+ if (t->nsftids && (stid >= t->sftid_base)) {
3037+ stid -= t->sftid_base;
3038+ stid += t->nstids;
3039+ } else {
3040+ stid -= t->stid_base;
3041+ }
3042+
30283043 spin_lock_bh(&t->stid_lock);
30293044 if (family == PF_INET)
30303045 __clear_bit(stid, t->stid_bmap);
30313046 else
30323047 bitmap_release_region(t->stid_bmap, stid, 2);
30333048 t->stid_tab[stid].data = NULL;
3034− t->stids_in_use--;
3049+ if (family == PF_INET)
3050+ t->stids_in_use--;
3051+ else
3052+ t->stids_in_use -= 4;
30353053 spin_unlock_bh(&t->stid_lock);
30363054 }
30373055 EXPORT_SYMBOL(cxgb4_free_stid);
@@ -3134,6 +3152,7 @@ static int tid_init(struct tid_info *t) · 96 unmodified lines
31343152 size_t size;
31353153 unsigned int stid_bmap_size;
31363154 unsigned int natids = t->natids;
3155+ struct adapter *adap = container_of(t, struct adapter, tids);
31373156
31383157 stid_bmap_size = BITS_TO_LONGS(t->nstids + t->nsftids);
31393158 size = t->ntids * sizeof(*t->tid_tab) +
@@ -3167,6 +3186,11 @@ static int tid_init(struct tid_info *t) · 27 unmodified lines
31673186 t->afree = t->atid_tab;
31683187 }
31693188 bitmap_zero(t->stid_bmap, t->nstids + t->nsftids);
3189+ /* Reserve stid 0 for T4/T5 adapters */
3190+ if (!t->stid_base &&
3191+ (is_t4(adap->params.chip) || is_t5(adap->params.chip)))
3192+ __set_bit(0, t->stid_bmap);
3193+
31703194 return 0;
31713195 }
31723196
@@ -3731,7 +3755,7 @@ static void uld_attach(struct adapter *adap, unsigned int uld) · 558 unmodified lines
37313755 lli.ucq_density = 1 << QUEUESPERPAGEPF0_GET(
37323756 t4_read_reg(adap, SGE_INGRESS_QUEUES_PER_PAGE_PF) >>
37333757 (adap->fn * 4));
3734− lli.filt_mode = adap->filter_mode;
3758+ lli.filt_mode = adap->params.tp.vlan_pri_map;
37353759 /* MODQ_REQ_MAP sets queues 0-3 to chan 0-3 */
37363760 for (i = 0; i < NCHAN; i++)
37373761 lli.tx_modq[i] = i;
@@ -4179,7 +4203,7 @@ int cxgb4_create_server_filter(const struct net_device *dev, unsigned int stid, · 441 unmodified lines
41794203 adap = netdev2adap(dev);
41804204
41814205 /* Adjust stid to correct filter index */
4182− stid -= adap->tids.nstids;
4206+ stid -= adap->tids.sftid_base;
41834207 stid += adap->tids.nftids;
41844208
41854209 /* Check to make sure the filter requested is writable ...
@@ -4205,12 +4229,17 @@ int cxgb4_create_server_filter(const struct net_device *dev, unsigned int stid, · 19 unmodified lines
42054229 f->fs.val.lip[i] = val[i];
42064230 f->fs.mask.lip[i] = ~0;
42074231 }
4208− if (adap->filter_mode & F_PORT) {
4232+ if (adap->params.tp.vlan_pri_map & F_PORT) {
42094233 f->fs.val.iport = port;
42104234 f->fs.mask.iport = mask;
42114235 }
42124236 }
42134237
4238+ if (adap->params.tp.vlan_pri_map & F_PROTOCOL) {
4239+ f->fs.val.proto = IPPROTO_TCP;
4240+ f->fs.mask.proto = ~0;
4241+ }
4242+
42144243 f->fs.dirsteer = 1;
42154244 f->fs.iq = queue;
42164245 /* Mark filter as locked */
@@ -4237,7 +4266,7 @@ int cxgb4_remove_server_filter(const struct net_device *dev, unsigned int stid, · 20 unmodified lines
42374266 adap = netdev2adap(dev);
42384267
42394268 /* Adjust stid to correct filter index */
4240− stid -= adap->tids.nstids;
4269+ stid -= adap->tids.sftid_base;
42414270 stid += adap->tids.nftids;
42424271
42434272 f = &adap->tids.ftid_tab[stid];
@@ -5092,7 +5121,7 @@ static int adap_init0(struct adapter *adap) · 848 unmodified lines
50925121 enum dev_state state;
50935122 u32 params[7], val[7];
50945123 struct fw_caps_config_cmd caps_cmd;
5095− int reset = 1, j;
5124+ int reset = 1;
50965125
50975126 /*
50985127 * Contact FW, advertising Master capability (and potentially forcing
@@ -5434,21 +5463,11 @@ static int adap_init0(struct adapter *adap) · 335 unmodified lines
54345463 /*
54355464 * These are finalized by FW initialization, load their values now.
54365465 */
5437− v = t4_read_reg(adap, TP_TIMER_RESOLUTION);
5438− adap->params.tp.tre = TIMERRESOLUTION_GET(v);
5439− adap->params.tp.dack_re = DELAYEDACKRESOLUTION_GET(v);
54405466 t4_read_mtu_tbl(adap, adap->params.mtus, NULL);
54415467 t4_load_mtus(adap, adap->params.mtus, adap->params.a_wnd,
54425468 adap->params.b_wnd);
54435469
5444− /* MODQ_REQ_MAP defaults to setting queues 0-3 to chan 0-3 */
5445− for (j = 0; j < NCHAN; j++)
5446− adap->params.tp.tx_modq[j] = j;
5447−
5448− t4_read_indirect(adap, TP_PIO_ADDR, TP_PIO_DATA,
5449− &adap->filter_mode, 1,
5450− TP_VLAN_PRI_MAP);
5451−
5470+ t4_init_tp_params(adap);
54525471 adap->flags |= FW_OK;
54535472 return 0;
54545473
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h+8−1
@@ -131,7 +131,14 @@ static inline void *lookup_atid(const struct tid_info *t, unsigned int atid) · 130 unmodified lines
131131
132132 static inline void *lookup_stid(const struct tid_info *t, unsigned int stid)
133133 {
134− stid -= t->stid_base;
134+ /* Is it a server filter TID? */
135+ if (t->nsftids && (stid >= t->sftid_base)) {
136+ stid -= t->sftid_base;
137+ stid += t->nstids;
138+ } else {
139+ stid -= t->stid_base;
140+ }
141+
135142 return stid < (t->nstids + t->nsftids) ? t->stid_tab[stid].data : NULL;
136143 }
137144
drivers/net/ethernet/chelsio/cxgb4/l2t.c+35−0
@@ -45,6 +45,7 @@ · 44 unmodified lines
4545 #include "l2t.h"
4646 #include "t4_msg.h"
4747 #include "t4fw_api.h"
48+#include "t4_regs.h"
4849
4950 #define VLAN_NONE 0xfff
5051
@@ -411,6 +412,40 @@ done: · 360 unmodified lines
411412 }
412413 EXPORT_SYMBOL(cxgb4_l2t_get);
413414
415+u64 cxgb4_select_ntuple(struct net_device *dev,
416+ const struct l2t_entry *l2t)
417+{
418+ struct adapter *adap = netdev2adap(dev);
419+ struct tp_params *tp = &adap->params.tp;
420+ u64 ntuple = 0;
421+
422+ /* Initialize each of the fields which we care about which are present
423+ * in the Compressed Filter Tuple.
424+ */
425+ if (tp->vlan_shift >= 0 && l2t->vlan != VLAN_NONE)
426+ ntuple |= (F_FT_VLAN_VLD | l2t->vlan) << tp->vlan_shift;
427+
428+ if (tp->port_shift >= 0)
429+ ntuple |= (u64)l2t->lport << tp->port_shift;
430+
431+ if (tp->protocol_shift >= 0)
432+ ntuple |= (u64)IPPROTO_TCP << tp->protocol_shift;
433+
434+ if (tp->vnic_shift >= 0) {
435+ u32 viid = cxgb4_port_viid(dev);
436+ u32 vf = FW_VIID_VIN_GET(viid);
437+ u32 pf = FW_VIID_PFN_GET(viid);
438+ u32 vld = FW_VIID_VIVLD_GET(viid);
439+
440+ ntuple |= (u64)(V_FT_VNID_ID_VF(vf) |
441+ V_FT_VNID_ID_PF(pf) |
442+ V_FT_VNID_ID_VLD(vld)) << tp->vnic_shift;
443+ }
444+
445+ return ntuple;
446+}
447+EXPORT_SYMBOL(cxgb4_select_ntuple);
448+
414449 /*
415450 * Called when address resolution fails for an L2T entry to handle packets
416451 * on the arpq head. If a packet specifies a failure handler it is invoked,
drivers/net/ethernet/chelsio/cxgb4/l2t.h+2−1
@@ -98,7 +98,8 @@ int cxgb4_l2t_send(struct net_device *dev, struct sk_buff *skb, · 97 unmodified lines
9898 struct l2t_entry *cxgb4_l2t_get(struct l2t_data *d, struct neighbour *neigh,
9999 const struct net_device *physdev,
100100 unsigned int priority);
101−
101+u64 cxgb4_select_ntuple(struct net_device *dev,
102+ const struct l2t_entry *l2t);
102103 void t4_l2t_update(struct adapter *adap, struct neighbour *neigh);
103104 struct l2t_entry *t4_l2t_alloc_switching(struct l2t_data *d);
104105 int t4_l2t_set_switching(struct adapter *adap, struct l2t_entry *e, u16 vlan,
drivers/net/ethernet/chelsio/cxgb4/sge.c+1−1
@@ -2581,7 +2581,7 @@ static int t4_sge_init_soft(struct adapter *adap) · 2580 unmodified lines
25812581 #undef READ_FL_BUF
25822582
25832583 if (fl_small_pg != PAGE_SIZE ||
2584− (fl_large_pg != 0 && (fl_large_pg <= fl_small_pg ||
2584+ (fl_large_pg != 0 && (fl_large_pg < fl_small_pg ||
25852585 (fl_large_pg & (fl_large_pg-1)) != 0))) {
25862586 dev_err(adap->pdev_dev, "bad SGE FL page buffer sizes [%d, %d]\n",
25872587 fl_small_pg, fl_large_pg);
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c+103−0
@@ -3808,6 +3808,109 @@ int t4_prep_adapter(struct adapter *adapter) · 3807 unmodified lines
38083808 return 0;
38093809 }
38103810
3811+/**
3812+ * t4_init_tp_params - initialize adap->params.tp
3813+ * @adap: the adapter
3814+ *
3815+ * Initialize various fields of the adapter's TP Parameters structure.
3816+ */
3817+int t4_init_tp_params(struct adapter *adap)
3818+{
3819+ int chan;
3820+ u32 v;
3821+
3822+ v = t4_read_reg(adap, TP_TIMER_RESOLUTION);
3823+ adap->params.tp.tre = TIMERRESOLUTION_GET(v);
3824+ adap->params.tp.dack_re = DELAYEDACKRESOLUTION_GET(v);
3825+
3826+ /* MODQ_REQ_MAP defaults to setting queues 0-3 to chan 0-3 */
3827+ for (chan = 0; chan < NCHAN; chan++)
3828+ adap->params.tp.tx_modq[chan] = chan;
3829+
3830+ /* Cache the adapter's Compressed Filter Mode and global Incress
3831+ * Configuration.
3832+ */
3833+ t4_read_indirect(adap, TP_PIO_ADDR, TP_PIO_DATA,
3834+ &adap->params.tp.vlan_pri_map, 1,
3835+ TP_VLAN_PRI_MAP);
3836+ t4_read_indirect(adap, TP_PIO_ADDR, TP_PIO_DATA,
3837+ &adap->params.tp.ingress_config, 1,
3838+ TP_INGRESS_CONFIG);
3839+
3840+ /* Now that we have TP_VLAN_PRI_MAP cached, we can calculate the field
3841+ * shift positions of several elements of the Compressed Filter Tuple
3842+ * for this adapter which we need frequently ...
3843+ */
3844+ adap->params.tp.vlan_shift = t4_filter_field_shift(adap, F_VLAN);
3845+ adap->params.tp.vnic_shift = t4_filter_field_shift(adap, F_VNIC_ID);
3846+ adap->params.tp.port_shift = t4_filter_field_shift(adap, F_PORT);
3847+ adap->params.tp.protocol_shift = t4_filter_field_shift(adap,
3848+ F_PROTOCOL);
3849+
3850+ /* If TP_INGRESS_CONFIG.VNID == 0, then TP_VLAN_PRI_MAP.VNIC_ID
3851+ * represents the presense of an Outer VLAN instead of a VNIC ID.
3852+ */
3853+ if ((adap->params.tp.ingress_config & F_VNIC) == 0)
3854+ adap->params.tp.vnic_shift = -1;
3855+
3856+ return 0;
3857+}
3858+
3859+/**
3860+ * t4_filter_field_shift - calculate filter field shift
3861+ * @adap: the adapter
3862+ * @filter_sel: the desired field (from TP_VLAN_PRI_MAP bits)
3863+ *
3864+ * Return the shift position of a filter field within the Compressed
3865+ * Filter Tuple. The filter field is specified via its selection bit
3866+ * within TP_VLAN_PRI_MAL (filter mode). E.g. F_VLAN.
3867+ */
3868+int t4_filter_field_shift(const struct adapter *adap, int filter_sel)
3869+{
3870+ unsigned int filter_mode = adap->params.tp.vlan_pri_map;
3871+ unsigned int sel;
3872+ int field_shift;
3873+
3874+ if ((filter_mode & filter_sel) == 0)
3875+ return -1;
3876+
3877+ for (sel = 1, field_shift = 0; sel < filter_sel; sel <<= 1) {
3878+ switch (filter_mode & sel) {
3879+ case F_FCOE:
3880+ field_shift += W_FT_FCOE;
3881+ break;
3882+ case F_PORT:
3883+ field_shift += W_FT_PORT;
3884+ break;
3885+ case F_VNIC_ID:
3886+ field_shift += W_FT_VNIC_ID;
3887+ break;
3888+ case F_VLAN:
3889+ field_shift += W_FT_VLAN;
3890+ break;
3891+ case F_TOS:
3892+ field_shift += W_FT_TOS;
3893+ break;
3894+ case F_PROTOCOL:
3895+ field_shift += W_FT_PROTOCOL;
3896+ break;
3897+ case F_ETHERTYPE:
3898+ field_shift += W_FT_ETHERTYPE;
3899+ break;
3900+ case F_MACMATCH:
3901+ field_shift += W_FT_MACMATCH;
3902+ break;
3903+ case F_MPSHITTYPE:
3904+ field_shift += W_FT_MPSHITTYPE;
3905+ break;
3906+ case F_FRAGMENTATION:
3907+ field_shift += W_FT_FRAGMENTATION;
3908+ break;
3909+ }
3910+ }
3911+ return field_shift;
3912+}
3913+
38113914 int t4_port_init(struct adapter *adap, int mbox, int pf, int vf)
38123915 {
38133916 u8 addr[6];
drivers/net/ethernet/chelsio/cxgb4/t4_regs.h+73−0
@@ -1171,10 +1171,50 @@ · 1170 unmodified lines
11711171
11721172 #define A_TP_TX_SCHED_PCMD 0x25
11731173
1174+#define S_VNIC 11
1175+#define V_VNIC(x) ((x) << S_VNIC)
1176+#define F_VNIC V_VNIC(1U)
1177+
1178+#define S_FRAGMENTATION 9
1179+#define V_FRAGMENTATION(x) ((x) << S_FRAGMENTATION)
1180+#define F_FRAGMENTATION V_FRAGMENTATION(1U)
1181+
1182+#define S_MPSHITTYPE 8
1183+#define V_MPSHITTYPE(x) ((x) << S_MPSHITTYPE)
1184+#define F_MPSHITTYPE V_MPSHITTYPE(1U)
1185+
1186+#define S_MACMATCH 7
1187+#define V_MACMATCH(x) ((x) << S_MACMATCH)
1188+#define F_MACMATCH V_MACMATCH(1U)
1189+
1190+#define S_ETHERTYPE 6
1191+#define V_ETHERTYPE(x) ((x) << S_ETHERTYPE)
1192+#define F_ETHERTYPE V_ETHERTYPE(1U)
1193+
1194+#define S_PROTOCOL 5
1195+#define V_PROTOCOL(x) ((x) << S_PROTOCOL)
1196+#define F_PROTOCOL V_PROTOCOL(1U)
1197+
1198+#define S_TOS 4
1199+#define V_TOS(x) ((x) << S_TOS)
1200+#define F_TOS V_TOS(1U)
1201+
1202+#define S_VLAN 3
1203+#define V_VLAN(x) ((x) << S_VLAN)
1204+#define F_VLAN V_VLAN(1U)
1205+
1206+#define S_VNIC_ID 2
1207+#define V_VNIC_ID(x) ((x) << S_VNIC_ID)
1208+#define F_VNIC_ID V_VNIC_ID(1U)
1209+
11741210 #define S_PORT 1
11751211 #define V_PORT(x) ((x) << S_PORT)
11761212 #define F_PORT V_PORT(1U)
11771213
1214+#define S_FCOE 0
1215+#define V_FCOE(x) ((x) << S_FCOE)
1216+#define F_FCOE V_FCOE(1U)
1217+
11781218 #define NUM_MPS_CLS_SRAM_L_INSTANCES 336
11791219 #define NUM_MPS_T5_CLS_SRAM_L_INSTANCES 512
11801220
@@ -1213,4 +1253,37 @@ · 32 unmodified lines
12131253 #define V_CHIPID(x) ((x) << S_CHIPID)
12141254 #define G_CHIPID(x) (((x) >> S_CHIPID) & M_CHIPID)
12151255
1256+/* TP_VLAN_PRI_MAP controls which subset of fields will be present in the
1257+ * Compressed Filter Tuple for LE filters. Each bit set in TP_VLAN_PRI_MAP
1258+ * selects for a particular field being present. These fields, when present
1259+ * in the Compressed Filter Tuple, have the following widths in bits.
1260+ */
1261+#define W_FT_FCOE 1
1262+#define W_FT_PORT 3
1263+#define W_FT_VNIC_ID 17
1264+#define W_FT_VLAN 17
1265+#define W_FT_TOS 8
1266+#define W_FT_PROTOCOL 8
1267+#define W_FT_ETHERTYPE 16
1268+#define W_FT_MACMATCH 9
1269+#define W_FT_MPSHITTYPE 3
1270+#define W_FT_FRAGMENTATION 1
1271+
1272+/* Some of the Compressed Filter Tuple fields have internal structure. These
1273+ * bit shifts/masks describe those structures. All shifts are relative to the
1274+ * base position of the fields within the Compressed Filter Tuple
1275+ */
1276+#define S_FT_VLAN_VLD 16
1277+#define V_FT_VLAN_VLD(x) ((x) << S_FT_VLAN_VLD)
1278+#define F_FT_VLAN_VLD V_FT_VLAN_VLD(1U)
1279+
1280+#define S_FT_VNID_ID_VF 0
1281+#define V_FT_VNID_ID_VF(x) ((x) << S_FT_VNID_ID_VF)
1282+
1283+#define S_FT_VNID_ID_PF 7
1284+#define V_FT_VNID_ID_PF(x) ((x) << S_FT_VNID_ID_PF)
1285+
1286+#define S_FT_VNID_ID_VLD 16
1287+#define V_FT_VNID_ID_VLD(x) ((x) << S_FT_VNID_ID_VLD)
1288+
12161289 #endif /* __T4_REGS_H */
drivers/net/ethernet/emulex/benet/be.h+2−1
@@ -104,6 +104,7 @@ static inline char *nic_name(struct pci_dev *pdev) · 103 unmodified lines
104104 #define BE3_MAX_RSS_QS 16
105105 #define BE3_MAX_TX_QS 16
106106 #define BE3_MAX_EVT_QS 16
107+#define BE3_SRIOV_MAX_EVT_QS 8
107108
108109 #define MAX_RX_QS 32
109110 #define MAX_EVT_QS 32
@@ -480,7 +481,7 @@ struct be_adapter { · 370 unmodified lines
480481 struct list_head entry;
481482
482483 u32 flash_status;
483− struct completion flash_compl;
484+ struct completion et_cmd_compl;
484485
485486 struct be_resources res; /* resources available for the func */
486487 u16 num_vfs; /* Number of VFs provisioned by PF */
drivers/net/ethernet/emulex/benet/be_cmds.c+23−10
@@ -141,11 +141,17 @@ static int be_mcc_compl_process(struct be_adapter *adapter, · 140 unmodified lines
141141 subsystem = resp_hdr->subsystem;
142142 }
143143
144+ if (opcode == OPCODE_LOWLEVEL_LOOPBACK_TEST &&
145+ subsystem == CMD_SUBSYSTEM_LOWLEVEL) {
146+ complete(&adapter->et_cmd_compl);
147+ return 0;
148+ }
149+
144150 if (((opcode == OPCODE_COMMON_WRITE_FLASHROM) ||
145151 (opcode == OPCODE_COMMON_WRITE_OBJECT)) &&
146152 (subsystem == CMD_SUBSYSTEM_COMMON)) {
147153 adapter->flash_status = compl_status;
148− complete(&adapter->flash_compl);
154+ complete(&adapter->et_cmd_compl);
149155 }
150156
151157 if (compl_status == MCC_STATUS_SUCCESS) {
@@ -2017,6 +2023,9 @@ int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable, · 1865 unmodified lines
20172023 0x3ea83c02, 0x4a110304};
20182024 int status;
20192025
2026+ if (!(be_if_cap_flags(adapter) & BE_IF_FLAGS_RSS))
2027+ return 0;
2028+
20202029 if (mutex_lock_interruptible(&adapter->mbox_lock))
20212030 return -1;
20222031
@@ -2160,7 +2169,7 @@ int lancer_cmd_write_object(struct be_adapter *adapter, struct be_dma_mem *cmd, · 137 unmodified lines
21602169 be_mcc_notify(adapter);
21612170 spin_unlock_bh(&adapter->mcc_lock);
21622171
2163− if (!wait_for_completion_timeout(&adapter->flash_compl,
2172+ if (!wait_for_completion_timeout(&adapter->et_cmd_compl,
21642173 msecs_to_jiffies(60000)))
21652174 status = -1;
21662175 else
@@ -2255,8 +2264,8 @@ int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd, · 88 unmodified lines
22552264 be_mcc_notify(adapter);
22562265 spin_unlock_bh(&adapter->mcc_lock);
22572266
2258− if (!wait_for_completion_timeout(&adapter->flash_compl,
2259− msecs_to_jiffies(40000)))
2267+ if (!wait_for_completion_timeout(&adapter->et_cmd_compl,
2268+ msecs_to_jiffies(40000)))
22602269 status = -1;
22612270 else
22622271 status = adapter->flash_status;
@@ -2367,6 +2376,7 @@ int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, · 104 unmodified lines
23672376 {
23682377 struct be_mcc_wrb *wrb;
23692378 struct be_cmd_req_loopback_test *req;
2379+ struct be_cmd_resp_loopback_test *resp;
23702380 int status;
23712381
23722382 spin_lock_bh(&adapter->mcc_lock);
@@ -2381,8 +2391,8 @@ int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, · 8 unmodified lines
23812391
23822392 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL,
23832393 OPCODE_LOWLEVEL_LOOPBACK_TEST, sizeof(*req), wrb, NULL);
2384− req->hdr.timeout = cpu_to_le32(4);
23852394
2395+ req->hdr.timeout = cpu_to_le32(15);
23862396 req->pattern = cpu_to_le64(pattern);
23872397 req->src_port = cpu_to_le32(port_num);
23882398 req->dest_port = cpu_to_le32(port_num);
@@ -2390,12 +2400,15 @@ int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, · 1 unmodified line
23902400 req->num_pkts = cpu_to_le32(num_pkts);
23912401 req->loopback_type = cpu_to_le32(loopback_type);
23922402
2393− status = be_mcc_notify_wait(adapter);
2394− if (!status) {
2395− struct be_cmd_resp_loopback_test *resp = embedded_payload(wrb);
2396− status = le32_to_cpu(resp->status);
2397− }
2403+ be_mcc_notify(adapter);
2404+
2405+ spin_unlock_bh(&adapter->mcc_lock);
23982406
2407+ wait_for_completion(&adapter->et_cmd_compl);
2408+ resp = embedded_payload(wrb);
2409+ status = le32_to_cpu(resp->status);
2410+
2411+ return status;
23992412 err:
24002413 spin_unlock_bh(&adapter->mcc_lock);
24012414 return status;
drivers/net/ethernet/emulex/benet/be_main.c+18−11
@@ -2744,13 +2744,16 @@ static int be_rx_qs_create(struct be_adapter *adapter) · 2743 unmodified lines
27442744 if (!BEx_chip(adapter))
27452745 adapter->rss_flags |= RSS_ENABLE_UDP_IPV4 |
27462746 RSS_ENABLE_UDP_IPV6;
2747+ } else {
2748+ /* Disable RSS, if only default RX Q is created */
2749+ adapter->rss_flags = RSS_ENABLE_NONE;
2750+ }
27472751
2748− rc = be_cmd_rss_config(adapter, rsstable, adapter->rss_flags,
2749− 128);
2750− if (rc) {
2751− adapter->rss_flags = 0;
2752− return rc;
2753− }
2752+ rc = be_cmd_rss_config(adapter, rsstable, adapter->rss_flags,
2753+ 128);
2754+ if (rc) {
2755+ adapter->rss_flags = RSS_ENABLE_NONE;
2756+ return rc;
27542757 }
27552758
27562759 /* First time posting */
@@ -3124,11 +3127,11 @@ static void BEx_get_resources(struct be_adapter *adapter, · 367 unmodified lines
31243127 {
31253128 struct pci_dev *pdev = adapter->pdev;
31263129 bool use_sriov = false;
3130+ int max_vfs;
31273131
3128− if (BE3_chip(adapter) && sriov_want(adapter)) {
3129− int max_vfs;
3132+ max_vfs = pci_sriov_get_totalvfs(pdev);
31303133
3131− max_vfs = pci_sriov_get_totalvfs(pdev);
3134+ if (BE3_chip(adapter) && sriov_want(adapter)) {
31323135 res->max_vfs = max_vfs > 0 ? min(MAX_VFS, max_vfs) : 0;
31333136 use_sriov = res->max_vfs;
31343137 }
@@ -3159,7 +3162,11 @@ static void BEx_get_resources(struct be_adapter *adapter, · 24 unmodified lines
31593162 BE3_MAX_RSS_QS : BE2_MAX_RSS_QS;
31603163 res->max_rx_qs = res->max_rss_qs + 1;
31613164
3162− res->max_evt_qs = be_physfn(adapter) ? BE3_MAX_EVT_QS : 1;
3165+ if (be_physfn(adapter))
3166+ res->max_evt_qs = (max_vfs > 0) ?
3167+ BE3_SRIOV_MAX_EVT_QS : BE3_MAX_EVT_QS;
3168+ else
3169+ res->max_evt_qs = 1;
31633170
31643171 res->if_cap_flags = BE_IF_CAP_FLAGS_WANT;
31653172 if (!(adapter->function_caps & BE_FUNCTION_CAPS_RSS))
@@ -4205,7 +4212,7 @@ static int be_ctrl_init(struct be_adapter *adapter) · 1039 unmodified lines
42054212 spin_lock_init(&adapter->mcc_lock);
42064213 spin_lock_init(&adapter->mcc_cq_lock);
42074214
4208− init_completion(&adapter->flash_compl);
4215+ init_completion(&adapter->et_cmd_compl);
42094216 pci_save_state(adapter->pdev);
42104217 return 0;
42114218
drivers/net/ethernet/freescale/fec_main.c+2−2
@@ -428,6 +428,8 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 427 unmodified lines
428428 /* If this was the last BD in the ring, start at the beginning again. */
429429 bdp = fec_enet_get_nextdesc(bdp, fep);
430430
431+ skb_tx_timestamp(skb);
432+
431433 fep->cur_tx = bdp;
432434
433435 if (fep->cur_tx == fep->dirty_tx)
@@ -436,8 +438,6 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 2 unmodified lines
436438 /* Trigger transmission start */
437439 writel(0, fep->hwp + FEC_X_DES_ACTIVE);
438440
439− skb_tx_timestamp(skb);
440−
441441 return NETDEV_TX_OK;
442442 }
443443
drivers/net/ethernet/intel/e1000e/80003es2lan.c+5−2
@@ -718,8 +718,11 @@ static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw) · 717 unmodified lines
718718 e1000_release_phy_80003es2lan(hw);
719719
720720 /* Disable IBIST slave mode (far-end loopback) */
721− e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
722− &kum_reg_data);
721+ ret_val =
722+ e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
723+ &kum_reg_data);
724+ if (ret_val)
725+ return ret_val;
723726 kum_reg_data |= E1000_KMRNCTRLSTA_IBIST_DISABLE;
724727 e1000_write_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
725728 kum_reg_data);
drivers/net/ethernet/intel/e1000e/netdev.c+2−2
@@ -6174,7 +6174,7 @@ static int __e1000_resume(struct pci_dev *pdev) · 6173 unmodified lines
61746174 return 0;
61756175 }
61766176
6177−#ifdef CONFIG_PM_SLEEP
6177+#ifdef CONFIG_PM
61786178 static int e1000_suspend(struct device *dev)
61796179 {
61806180 struct pci_dev *pdev = to_pci_dev(dev);
@@ -6193,7 +6193,7 @@ static int e1000_resume(struct device *dev) · 12 unmodified lines
61936193
61946194 return __e1000_resume(pdev);
61956195 }
6196−#endif /* CONFIG_PM_SLEEP */
6196+#endif /* CONFIG_PM */
61976197
61986198 #ifdef CONFIG_PM_RUNTIME
61996199 static int e1000_runtime_suspend(struct device *dev)
drivers/net/ethernet/intel/e1000e/phy.c+7−3
@@ -1757,19 +1757,23 @@ s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, · 1756 unmodified lines
17571757 * it across the board.
17581758 */
17591759 ret_val = e1e_rphy(hw, MII_BMSR, &phy_status);
1760− if (ret_val)
1760+ if (ret_val) {
17611761 /* If the first read fails, another entity may have
17621762 * ownership of the resources, wait and try again to
17631763 * see if they have relinquished the resources yet.
17641764 */
1765− udelay(usec_interval);
1765+ if (usec_interval >= 1000)
1766+ msleep(usec_interval / 1000);
1767+ else
1768+ udelay(usec_interval);
1769+ }
17661770 ret_val = e1e_rphy(hw, MII_BMSR, &phy_status);
17671771 if (ret_val)
17681772 break;
17691773 if (phy_status & BMSR_LSTATUS)
17701774 break;
17711775 if (usec_interval >= 1000)
1772− mdelay(usec_interval / 1000);
1776+ msleep(usec_interval / 1000);
17731777 else
17741778 udelay(usec_interval);
17751779 }
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c+13−20
@@ -6827,12 +6827,20 @@ static inline int ixgbe_maybe_stop_tx(struct ixgbe_ring *tx_ring, u16 size) · 6826 unmodified lines
68276827 return __ixgbe_maybe_stop_tx(tx_ring, size);
68286828 }
68296829
6830−#ifdef IXGBE_FCOE
6831−static u16 ixgbe_select_queue(struct net_device *dev, struct sk_buff *skb)
6830+static u16 ixgbe_select_queue(struct net_device *dev, struct sk_buff *skb,
6831+ void *accel_priv)
68326832 {
6833+ struct ixgbe_fwd_adapter *fwd_adapter = accel_priv;
6834+#ifdef IXGBE_FCOE
68336835 struct ixgbe_adapter *adapter;
68346836 struct ixgbe_ring_feature *f;
68356837 int txq;
6838+#endif
6839+
6840+ if (fwd_adapter)
6841+ return skb->queue_mapping + fwd_adapter->tx_base_queue;
6842+
6843+#ifdef IXGBE_FCOE
68366844
68376845 /*
68386846 * only execute the code below if protocol is FCoE
@@ -6858,9 +6866,11 @@ static u16 ixgbe_select_queue(struct net_device *dev, struct sk_buff *skb) · 19 unmodified lines
68586866 txq -= f->indices;
68596867
68606868 return txq + f->offset;
6869+#else
6870+ return __netdev_pick_tx(dev, skb);
6871+#endif
68616872 }
68626873
6863−#endif
68646874 netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb,
68656875 struct ixgbe_adapter *adapter,
68666876 struct ixgbe_ring *tx_ring)
@@ -7629,27 +7639,11 @@ static void ixgbe_fwd_del(struct net_device *pdev, void *priv) · 762 unmodified lines
76297639 kfree(fwd_adapter);
76307640 }
76317641
7632−static netdev_tx_t ixgbe_fwd_xmit(struct sk_buff *skb,
7633− struct net_device *dev,
7634− void *priv)
7635−{
7636− struct ixgbe_fwd_adapter *fwd_adapter = priv;
7637− unsigned int queue;
7638− struct ixgbe_ring *tx_ring;
7639−
7640− queue = skb->queue_mapping + fwd_adapter->tx_base_queue;
7641− tx_ring = fwd_adapter->real_adapter->tx_ring[queue];
7642−
7643− return __ixgbe_xmit_frame(skb, dev, tx_ring);
7644−}
7645−
76467642 static const struct net_device_ops ixgbe_netdev_ops = {
76477643 .ndo_open = ixgbe_open,
76487644 .ndo_stop = ixgbe_close,
76497645 .ndo_start_xmit = ixgbe_xmit_frame,
7650−#ifdef IXGBE_FCOE
76517646 .ndo_select_queue = ixgbe_select_queue,
7652−#endif
76537647 .ndo_set_rx_mode = ixgbe_set_rx_mode,
76547648 .ndo_validate_addr = eth_validate_addr,
76557649 .ndo_set_mac_address = ixgbe_set_mac,
@@ -7689,7 +7683,6 @@ static const struct net_device_ops ixgbe_netdev_ops = { · 33 unmodified lines
76897683 .ndo_bridge_getlink = ixgbe_ndo_bridge_getlink,
76907684 .ndo_dfwd_add_station = ixgbe_fwd_add,
76917685 .ndo_dfwd_del_station = ixgbe_fwd_del,
7692− .ndo_dfwd_start_xmit = ixgbe_fwd_xmit,
76937686 };
76947687
76957688 /**
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c+2−0
@@ -291,7 +291,9 @@ static int ixgbe_pci_sriov_disable(struct pci_dev *dev) · 290 unmodified lines
291291 {
292292 struct ixgbe_adapter *adapter = pci_get_drvdata(dev);
293293 int err;
294+#ifdef CONFIG_PCI_IOV
294295 u32 current_flags = adapter->flags;
296+#endif
295297
296298 err = ixgbe_disable_sriov(adapter);
297299
drivers/net/ethernet/lantiq_etop.c+2−1
@@ -619,7 +619,8 @@ ltq_etop_set_multicast_list(struct net_device *dev) · 618 unmodified lines
619619 }
620620
621621 static u16
622−ltq_etop_select_queue(struct net_device *dev, struct sk_buff *skb)
622+ltq_etop_select_queue(struct net_device *dev, struct sk_buff *skb,
623+ void *accel_priv)
623624 {
624625 /* we are currently only using the first queue */
625626 return 0;
drivers/net/ethernet/marvell/mvmdio.c+6−0
@@ -92,6 +92,12 @@ static int orion_mdio_wait_ready(struct mii_bus *bus) · 91 unmodified lines
9292 if (time_is_before_jiffies(end))
9393 ++timedout;
9494 } else {
95+ /* wait_event_timeout does not guarantee a delay of at
96+ * least one whole jiffie, so timeout must be no less
97+ * than two.
98+ */
99+ if (timeout < 2)
100+ timeout = 2;
95101 wait_event_timeout(dev->smi_busy_wait,
96102 orion_mdio_smi_is_done(dev),
97103 timeout);
drivers/net/ethernet/mellanox/mlx4/en_tx.c+2−1
@@ -592,7 +592,8 @@ static void build_inline_wqe(struct mlx4_en_tx_desc *tx_desc, struct sk_buff *sk · 591 unmodified lines
592592 }
593593 }
594594
595−u16 mlx4_en_select_queue(struct net_device *dev, struct sk_buff *skb)
595+u16 mlx4_en_select_queue(struct net_device *dev, struct sk_buff *skb,
596+ void *accel_priv)
596597 {
597598 struct mlx4_en_priv *priv = netdev_priv(dev);
598599 u16 rings_p_up = priv->num_tx_rings_p_up;
drivers/net/ethernet/mellanox/mlx4/mlx4_en.h+2−1
@@ -714,7 +714,8 @@ int mlx4_en_set_cq_moder(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq); · 713 unmodified lines
714714 int mlx4_en_arm_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq);
715715
716716 void mlx4_en_tx_irq(struct mlx4_cq *mcq);
717−u16 mlx4_en_select_queue(struct net_device *dev, struct sk_buff *skb);
717+u16 mlx4_en_select_queue(struct net_device *dev, struct sk_buff *skb,
718+ void *accel_priv);
718719 netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev);
719720
720721 int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv,
drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c+2−2
@@ -1604,13 +1604,13 @@ netxen_process_lro(struct netxen_adapter *adapter, · 1603 unmodified lines
16041604 u32 seq_number;
16051605 u8 vhdr_len = 0;
16061606
1607− if (unlikely(ring > adapter->max_rds_rings))
1607+ if (unlikely(ring >= adapter->max_rds_rings))
16081608 return NULL;
16091609
16101610 rds_ring = &recv_ctx->rds_rings[ring];
16111611
16121612 index = netxen_get_lro_sts_refhandle(sts_data0);
1613− if (unlikely(index > rds_ring->num_desc))
1613+ if (unlikely(index >= rds_ring->num_desc))
16141614 return NULL;
16151615
16161616 buffer = &rds_ring->rx_buf_arr[index];
drivers/net/ethernet/qlogic/qlcnic/qlcnic.h+5−1
@@ -487,6 +487,7 @@ struct qlcnic_hardware_context { · 486 unmodified lines
487487 struct qlcnic_mailbox *mailbox;
488488 u8 extend_lb_time;
489489 u8 phys_port_id[ETH_ALEN];
490+ u8 lb_mode;
490491 };
491492
492493 struct qlcnic_adapter_stats {
@@ -578,6 +579,8 @@ struct qlcnic_host_tx_ring { · 85 unmodified lines
578579 dma_addr_t phys_addr;
579580 dma_addr_t hw_cons_phys_addr;
580581 struct netdev_queue *txq;
582+ /* Lock to protect Tx descriptors cleanup */
583+ spinlock_t tx_clean_lock;
581584 } ____cacheline_internodealigned_in_smp;
582585
583586 /*
@@ -808,6 +811,7 @@ struct qlcnic_mac_list_s { · 224 unmodified lines
808811
809812 #define QLCNIC_ILB_MODE 0x1
810813 #define QLCNIC_ELB_MODE 0x2
814+#define QLCNIC_LB_MODE_MASK 0x3
811815
812816 #define QLCNIC_LINKEVENT 0x1
813817 #define QLCNIC_LB_RESPONSE 0x2
@@ -1093,7 +1097,6 @@ struct qlcnic_adapter { · 279 unmodified lines
10931097 struct qlcnic_filter_hash rx_fhash;
10941098 struct list_head vf_mc_list;
10951099
1096− spinlock_t tx_clean_lock;
10971100 spinlock_t mac_learn_lock;
10981101 /* spinlock for catching rcv filters for eswitch traffic */
10991102 spinlock_t rx_mac_learn_lock;
@@ -1708,6 +1711,7 @@ int qlcnic_83xx_init_mailbox_work(struct qlcnic_adapter *); · 608 unmodified lines
17081711 void qlcnic_83xx_detach_mailbox_work(struct qlcnic_adapter *);
17091712 void qlcnic_83xx_reinit_mbx_work(struct qlcnic_mailbox *mbx);
17101713 void qlcnic_83xx_free_mailbox(struct qlcnic_mailbox *mbx);
1714+void qlcnic_update_stats(struct qlcnic_adapter *);
17111715
17121716 /* Adapter hardware abstraction */
17131717 struct qlcnic_hardware_ops {
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c+22−32
@@ -447,8 +447,9 @@ irqreturn_t qlcnic_83xx_intr(int irq, void *data) · 446 unmodified lines
447447
448448 qlcnic_83xx_poll_process_aen(adapter);
449449
450− if (ahw->diag_test == QLCNIC_INTERRUPT_TEST) {
451− ahw->diag_cnt++;
450+ if (ahw->diag_test) {
451+ if (ahw->diag_test == QLCNIC_INTERRUPT_TEST)
452+ ahw->diag_cnt++;
452453 qlcnic_83xx_enable_legacy_msix_mbx_intr(adapter);
453454 return IRQ_HANDLED;
454455 }
@@ -1345,11 +1346,6 @@ static int qlcnic_83xx_diag_alloc_res(struct net_device *netdev, int test, · 890 unmodified lines
13451346 }
13461347
13471348 if (adapter->ahw->diag_test == QLCNIC_LOOPBACK_TEST) {
1348− /* disable and free mailbox interrupt */
1349− if (!(adapter->flags & QLCNIC_MSIX_ENABLED)) {
1350− qlcnic_83xx_enable_mbx_poll(adapter);
1351− qlcnic_83xx_free_mbx_intr(adapter);
1352− }
13531349 adapter->ahw->loopback_state = 0;
13541350 adapter->ahw->hw_ops->setup_link_event(adapter, 1);
13551351 }
@@ -1363,33 +1359,20 @@ static void qlcnic_83xx_diag_free_res(struct net_device *netdev, · 7 unmodified lines
13631359 {
13641360 struct qlcnic_adapter *adapter = netdev_priv(netdev);
13651361 struct qlcnic_host_sds_ring *sds_ring;
1366− int ring, err;
1362+ int ring;
13671363
13681364 clear_bit(__QLCNIC_DEV_UP, &adapter->state);
13691365 if (adapter->ahw->diag_test == QLCNIC_INTERRUPT_TEST) {
13701366 for (ring = 0; ring < adapter->drv_sds_rings; ring++) {
13711367 sds_ring = &adapter->recv_ctx->sds_rings[ring];
1372− qlcnic_83xx_disable_intr(adapter, sds_ring);
1373− if (!(adapter->flags & QLCNIC_MSIX_ENABLED))
1374− qlcnic_83xx_enable_mbx_poll(adapter);
1368+ if (adapter->flags & QLCNIC_MSIX_ENABLED)
1369+ qlcnic_83xx_disable_intr(adapter, sds_ring);
13751370 }
13761371 }
13771372
13781373 qlcnic_fw_destroy_ctx(adapter);
13791374 qlcnic_detach(adapter);
13801375
1381− if (adapter->ahw->diag_test == QLCNIC_LOOPBACK_TEST) {
1382− if (!(adapter->flags & QLCNIC_MSIX_ENABLED)) {
1383− err = qlcnic_83xx_setup_mbx_intr(adapter);
1384− qlcnic_83xx_disable_mbx_poll(adapter);
1385− if (err) {
1386− dev_err(&adapter->pdev->dev,
1387− "%s: failed to setup mbx interrupt\n",
1388− __func__);
1389− goto out;
1390− }
1391− }
1392− }
13931376 adapter->ahw->diag_test = 0;
13941377 adapter->drv_sds_rings = drv_sds_rings;
13951378
@@ -1399,9 +1382,6 @@ static void qlcnic_83xx_diag_free_res(struct net_device *netdev, · 3 unmodified lines
13991382 if (netif_running(netdev))
14001383 __qlcnic_up(adapter, netdev);
14011384
1402− if (adapter->ahw->diag_test == QLCNIC_INTERRUPT_TEST &&
1403− !(adapter->flags & QLCNIC_MSIX_ENABLED))
1404− qlcnic_83xx_disable_mbx_poll(adapter);
14051385 out:
14061386 netif_device_attach(netdev);
14071387 }
@@ -1704,12 +1684,6 @@ int qlcnic_83xx_loopback_test(struct net_device *netdev, u8 mode) · 296 unmodified lines
17041684 }
17051685 } while ((adapter->ahw->linkup && ahw->has_link_events) != 1);
17061686
1707− /* Make sure carrier is off and queue is stopped during loopback */
1708− if (netif_running(netdev)) {
1709− netif_carrier_off(netdev);
1710− netif_tx_stop_all_queues(netdev);
1711− }
1712−
17131687 ret = qlcnic_do_lb_test(adapter, mode);
17141688
17151689 qlcnic_83xx_clear_lb_mode(adapter, mode);
@@ -2141,6 +2115,7 @@ static void qlcnic_83xx_handle_link_aen(struct qlcnic_adapter *adapter, · 425 unmodified lines
21412115 ahw->link_autoneg = MSB(MSW(data[3]));
21422116 ahw->module_type = MSB(LSW(data[3]));
21432117 ahw->has_link_events = 1;
2118+ ahw->lb_mode = data[4] & QLCNIC_LB_MODE_MASK;
21442119 qlcnic_advert_link_change(adapter, link_status);
21452120 }
21462121
@@ -3754,6 +3729,19 @@ static void qlcnic_83xx_decode_mbx_rsp(struct qlcnic_adapter *adapter, · 1607 unmodified lines
37543729 return;
37553730 }
37563731
3732+static inline void qlcnic_dump_mailbox_registers(struct qlcnic_adapter *adapter)
3733+{
3734+ struct qlcnic_hardware_context *ahw = adapter->ahw;
3735+ u32 offset;
3736+
3737+ offset = QLCRDX(ahw, QLCNIC_DEF_INT_MASK);
3738+ dev_info(&adapter->pdev->dev, "Mbx interrupt mask=0x%x, Mbx interrupt enable=0x%x, Host mbx control=0x%x, Fw mbx control=0x%x",
3739+ readl(ahw->pci_base0 + offset),
3740+ QLCRDX(ahw, QLCNIC_MBX_INTR_ENBL),
3741+ QLCRDX(ahw, QLCNIC_HOST_MBX_CTRL),
3742+ QLCRDX(ahw, QLCNIC_FW_MBX_CTRL));
3743+}
3744+
37573745 static void qlcnic_83xx_mailbox_worker(struct work_struct *work)
37583746 {
37593747 struct qlcnic_mailbox *mbx = container_of(work, struct qlcnic_mailbox,
@@ -3798,6 +3786,8 @@ static void qlcnic_83xx_mailbox_worker(struct work_struct *work) · 38 unmodified lines
37983786 __func__, cmd->cmd_op, cmd->type, ahw->pci_func,
37993787 ahw->op_mode);
38003788 clear_bit(QLC_83XX_MBX_READY, &mbx->status);
3789+ qlcnic_dump_mailbox_registers(adapter);
3790+ qlcnic_83xx_get_mbx_data(adapter, cmd);
38013791 qlcnic_dump_mbx(adapter, cmd);
38023792 qlcnic_83xx_idc_request_reset(adapter,
38033793 QLCNIC_FORCE_FW_DUMP_KEY);
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h+1−0
@@ -662,4 +662,5 @@ pci_ers_result_t qlcnic_83xx_io_error_detected(struct pci_dev *, · 661 unmodified lines
662662 pci_channel_state_t);
663663 pci_ers_result_t qlcnic_83xx_io_slot_reset(struct pci_dev *);
664664 void qlcnic_83xx_io_resume(struct pci_dev *);
665+void qlcnic_83xx_stop_hw(struct qlcnic_adapter *);
665666 #endif
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c+40−25
@@ -740,6 +740,7 @@ static int qlcnic_83xx_idc_unknown_state(struct qlcnic_adapter *adapter) · 739 unmodified lines
740740 adapter->ahw->idc.err_code = -EIO;
741741 dev_err(&adapter->pdev->dev,
742742 "%s: Device in unknown state\n", __func__);
743+ clear_bit(__QLCNIC_RESETTING, &adapter->state);
743744 return 0;
744745 }
745746
@@ -818,7 +819,6 @@ static int qlcnic_83xx_idc_ready_state(struct qlcnic_adapter *adapter) · 72 unmodified lines
818819 struct qlcnic_hardware_context *ahw = adapter->ahw;
819820 struct qlcnic_mailbox *mbx = ahw->mailbox;
820821 int ret = 0;
821− u32 owner;
822822 u32 val;
823823
824824 /* Perform NIC configuration based ready state entry actions */
@@ -848,9 +848,9 @@ static int qlcnic_83xx_idc_ready_state(struct qlcnic_adapter *adapter) · 23 unmodified lines
848848 set_bit(__QLCNIC_RESETTING, &adapter->state);
849849 qlcnic_83xx_idc_enter_need_reset_state(adapter, 1);
850850 } else {
851− owner = qlcnic_83xx_idc_find_reset_owner_id(adapter);
852− if (ahw->pci_func == owner)
853− qlcnic_dump_fw(adapter);
851+ netdev_info(adapter->netdev, "%s: Auto firmware recovery is disabled\n",
852+ __func__);
853+ qlcnic_83xx_idc_enter_failed_state(adapter, 1);
854854 }
855855 return -EIO;
856856 }
@@ -948,13 +948,26 @@ static int qlcnic_83xx_idc_need_quiesce_state(struct qlcnic_adapter *adapter) · 91 unmodified lines
948948 return 0;
949949 }
950950
951−static int qlcnic_83xx_idc_failed_state(struct qlcnic_adapter *adapter)
951+static void qlcnic_83xx_idc_failed_state(struct qlcnic_adapter *adapter)
952952 {
953− dev_err(&adapter->pdev->dev, "%s: please restart!!\n", __func__);
953+ struct qlcnic_hardware_context *ahw = adapter->ahw;
954+ u32 val, owner;
955+
956+ val = QLCRDX(adapter->ahw, QLC_83XX_IDC_CTRL);
957+ if (val & QLC_83XX_IDC_DISABLE_FW_RESET_RECOVERY) {
958+ owner = qlcnic_83xx_idc_find_reset_owner_id(adapter);
959+ if (ahw->pci_func == owner) {
960+ qlcnic_83xx_stop_hw(adapter);
961+ qlcnic_dump_fw(adapter);
962+ }
963+ }
964+
965+ netdev_warn(adapter->netdev, "%s: Reboot will be required to recover the adapter!!\n",
966+ __func__);
954967 clear_bit(__QLCNIC_RESETTING, &adapter->state);
955− adapter->ahw->idc.err_code = -EIO;
968+ ahw->idc.err_code = -EIO;
956969
957− return 0;
970+ return;
958971 }
959972
960973 static int qlcnic_83xx_idc_quiesce_state(struct qlcnic_adapter *adapter)
@@ -1063,12 +1076,6 @@ void qlcnic_83xx_idc_poll_dev_state(struct work_struct *work) · 102 unmodified lines
10631076 adapter->ahw->idc.prev_state = adapter->ahw->idc.curr_state;
10641077 qlcnic_83xx_periodic_tasks(adapter);
10651078
1066− /* Do not reschedule if firmaware is in hanged state and auto
1067− * recovery is disabled
1068− */
1069− if ((adapter->flags & QLCNIC_FW_HANG) && !qlcnic_auto_fw_reset)
1070− return;
1071−
10721079 /* Re-schedule the function */
10731080 if (test_bit(QLC_83XX_MODULE_LOADED, &adapter->ahw->idc.status))
10741081 qlcnic_schedule_work(adapter, qlcnic_83xx_idc_poll_dev_state,
@@ -1219,10 +1226,10 @@ void qlcnic_83xx_idc_request_reset(struct qlcnic_adapter *adapter, u32 key) · 144 unmodified lines
12191226 }
12201227
12211228 val = QLCRDX(adapter->ahw, QLC_83XX_IDC_CTRL);
1222− if ((val & QLC_83XX_IDC_DISABLE_FW_RESET_RECOVERY) ||
1223− !qlcnic_auto_fw_reset) {
1224− dev_err(&adapter->pdev->dev,
1225− "%s:failed, device in non reset mode\n", __func__);
1229+ if (val & QLC_83XX_IDC_DISABLE_FW_RESET_RECOVERY) {
1230+ netdev_info(adapter->netdev, "%s: Auto firmware recovery is disabled\n",
1231+ __func__);
1232+ qlcnic_83xx_idc_enter_failed_state(adapter, 0);
12261233 qlcnic_83xx_unlock_driver(adapter);
12271234 return;
12281235 }
@@ -1254,24 +1261,24 @@ static int qlcnic_83xx_copy_bootloader(struct qlcnic_adapter *adapter) · 25 unmodified lines
12541261 if (size & 0xF)
12551262 size = (size + 16) & ~0xF;
12561263
1257− p_cache = kzalloc(size, GFP_KERNEL);
1264+ p_cache = vzalloc(size);
12581265 if (p_cache == NULL)
12591266 return -ENOMEM;
12601267
12611268 ret = qlcnic_83xx_lockless_flash_read32(adapter, src, p_cache,
12621269 size / sizeof(u32));
12631270 if (ret) {
1264− kfree(p_cache);
1271+ vfree(p_cache);
12651272 return ret;
12661273 }
12671274 /* 16 byte write to MS memory */
12681275 ret = qlcnic_83xx_ms_mem_write128(adapter, dest, (u32 *)p_cache,
12691276 size / 16);
12701277 if (ret) {
1271− kfree(p_cache);
1278+ vfree(p_cache);
12721279 return ret;
12731280 }
1274− kfree(p_cache);
1281+ vfree(p_cache);
12751282
12761283 return ret;
12771284 }
@@ -1939,7 +1946,7 @@ static void qlcnic_83xx_exec_template_cmd(struct qlcnic_adapter *p_dev, · 661 unmodified lines
19391946 p_dev->ahw->reset.seq_index = index;
19401947 }
19411948
1942−static void qlcnic_83xx_stop_hw(struct qlcnic_adapter *p_dev)
1949+void qlcnic_83xx_stop_hw(struct qlcnic_adapter *p_dev)
19431950 {
19441951 p_dev->ahw->reset.seq_index = 0;
19451952
@@ -1994,6 +2001,14 @@ static int qlcnic_83xx_restart_hw(struct qlcnic_adapter *adapter) · 48 unmodified lines
19942001 val = QLCRDX(adapter->ahw, QLC_83XX_IDC_CTRL);
19952002 if (!(val & QLC_83XX_IDC_GRACEFULL_RESET))
19962003 qlcnic_dump_fw(adapter);
2004+
2005+ if (val & QLC_83XX_IDC_DISABLE_FW_RESET_RECOVERY) {
2006+ netdev_info(adapter->netdev, "%s: Auto firmware recovery is disabled\n",
2007+ __func__);
2008+ qlcnic_83xx_idc_enter_failed_state(adapter, 1);
2009+ return err;
2010+ }
2011+
19972012 qlcnic_83xx_init_hw(adapter);
19982013
19992014 if (qlcnic_83xx_copy_bootloader(adapter))
@@ -2073,8 +2088,8 @@ int qlcnic_83xx_configure_opmode(struct qlcnic_adapter *adapter) · 73 unmodified lines
20732088 ahw->nic_mode = QLCNIC_DEFAULT_MODE;
20742089 adapter->nic_ops->init_driver = qlcnic_83xx_init_default_driver;
20752090 ahw->idc.state_entry = qlcnic_83xx_idc_ready_state_entry;
2076− adapter->max_sds_rings = ahw->max_rx_ques;
2077− adapter->max_tx_rings = ahw->max_tx_ques;
2091+ adapter->max_sds_rings = QLCNIC_MAX_SDS_RINGS;
2092+ adapter->max_tx_rings = QLCNIC_MAX_TX_RINGS;
20782093 } else {
20792094 return -EIO;
20802095 }
drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c+30−30
@@ -167,27 +167,35 @@ static const char qlcnic_gstrings_test[][ETH_GSTRING_LEN] = { · 166 unmodified lines
167167
168168 #define QLCNIC_TEST_LEN ARRAY_SIZE(qlcnic_gstrings_test)
169169
170−static inline int qlcnic_82xx_statistics(void)
170+static inline int qlcnic_82xx_statistics(struct qlcnic_adapter *adapter)
171171 {
172− return ARRAY_SIZE(qlcnic_device_gstrings_stats) +
173− ARRAY_SIZE(qlcnic_83xx_mac_stats_strings);
172+ return ARRAY_SIZE(qlcnic_gstrings_stats) +
173+ ARRAY_SIZE(qlcnic_83xx_mac_stats_strings) +
174+ QLCNIC_TX_STATS_LEN * adapter->drv_tx_rings;
174175 }
175176
176−static inline int qlcnic_83xx_statistics(void)
177+static inline int qlcnic_83xx_statistics(struct qlcnic_adapter *adapter)
177178 {
178− return ARRAY_SIZE(qlcnic_83xx_tx_stats_strings) +
179+ return ARRAY_SIZE(qlcnic_gstrings_stats) +
180+ ARRAY_SIZE(qlcnic_83xx_tx_stats_strings) +
179181 ARRAY_SIZE(qlcnic_83xx_mac_stats_strings) +
180− ARRAY_SIZE(qlcnic_83xx_rx_stats_strings);
182+ ARRAY_SIZE(qlcnic_83xx_rx_stats_strings) +
183+ QLCNIC_TX_STATS_LEN * adapter->drv_tx_rings;
181184 }
182185
183186 static int qlcnic_dev_statistics_len(struct qlcnic_adapter *adapter)
184187 {
185− if (qlcnic_82xx_check(adapter))
186− return qlcnic_82xx_statistics();
187− else if (qlcnic_83xx_check(adapter))
188− return qlcnic_83xx_statistics();
189− else
190− return -1;
188+ int len = -1;
189+
190+ if (qlcnic_82xx_check(adapter)) {
191+ len = qlcnic_82xx_statistics(adapter);
192+ if (adapter->flags & QLCNIC_ESWITCH_ENABLED)
193+ len += ARRAY_SIZE(qlcnic_device_gstrings_stats);
194+ } else if (qlcnic_83xx_check(adapter)) {
195+ len = qlcnic_83xx_statistics(adapter);
196+ }
197+
198+ return len;
191199 }
192200
193201 #define QLCNIC_TX_INTR_NOT_CONFIGURED 0X78563412
@@ -667,30 +675,25 @@ qlcnic_set_ringparam(struct net_device *dev, · 473 unmodified lines
667675 static int qlcnic_validate_ring_count(struct qlcnic_adapter *adapter,
668676 u8 rx_ring, u8 tx_ring)
669677 {
678+ if (rx_ring == 0 || tx_ring == 0)
679+ return -EINVAL;
680+
670681 if (rx_ring != 0) {
671682 if (rx_ring > adapter->max_sds_rings) {
672− netdev_err(adapter->netdev, "Invalid ring count, SDS ring count %d should not be greater than max %d driver sds rings.\n",
683+ netdev_err(adapter->netdev,
684+ "Invalid ring count, SDS ring count %d should not be greater than max %d driver sds rings.\n",
673685 rx_ring, adapter->max_sds_rings);
674686 return -EINVAL;
675687 }
676688 }
677689
678690 if (tx_ring != 0) {
679− if (qlcnic_82xx_check(adapter) &&
680− (tx_ring > adapter->max_tx_rings)) {
691+ if (tx_ring > adapter->max_tx_rings) {
681692 netdev_err(adapter->netdev,
682693 "Invalid ring count, Tx ring count %d should not be greater than max %d driver Tx rings.\n",
683694 tx_ring, adapter->max_tx_rings);
684695 return -EINVAL;
685696 }
686−
687− if (qlcnic_83xx_check(adapter) &&
688− (tx_ring > QLCNIC_SINGLE_RING)) {
689− netdev_err(adapter->netdev,
690− "Invalid ring count, Tx ring count %d should not be greater than %d driver Tx rings.\n",
691− tx_ring, QLCNIC_SINGLE_RING);
692− return -EINVAL;
693− }
694697 }
695698
696699 return 0;
@@ -925,18 +928,13 @@ static int qlcnic_eeprom_test(struct net_device *dev) · 228 unmodified lines
925928
926929 static int qlcnic_get_sset_count(struct net_device *dev, int sset)
927930 {
928− int len;
929931
930932 struct qlcnic_adapter *adapter = netdev_priv(dev);
931933 switch (sset) {
932934 case ETH_SS_TEST:
933935 return QLCNIC_TEST_LEN;
934936 case ETH_SS_STATS:
935− len = qlcnic_dev_statistics_len(adapter) + QLCNIC_STATS_LEN;
936− if ((adapter->flags & QLCNIC_ESWITCH_ENABLED) ||
937− qlcnic_83xx_check(adapter))
938− return len;
939− return qlcnic_82xx_statistics();
937+ return qlcnic_dev_statistics_len(adapter);
940938 default:
941939 return -EOPNOTSUPP;
942940 }
@@ -948,6 +946,7 @@ static int qlcnic_irq_test(struct net_device *netdev) · 5 unmodified lines
948946 struct qlcnic_hardware_context *ahw = adapter->ahw;
949947 struct qlcnic_cmd_args cmd;
950948 int ret, drv_sds_rings = adapter->drv_sds_rings;
949+ int drv_tx_rings = adapter->drv_tx_rings;
951950
952951 if (qlcnic_83xx_check(adapter))
953952 return qlcnic_83xx_interrupt_test(netdev);
@@ -980,6 +979,7 @@ free_diag_res: · 26 unmodified lines
980979
981980 clear_diag_irq:
982981 adapter->drv_sds_rings = drv_sds_rings;
982+ adapter->drv_tx_rings = drv_tx_rings;
983983 clear_bit(__QLCNIC_RESETTING, &adapter->state);
984984
985985 return ret;
@@ -1270,7 +1270,7 @@ static u64 *qlcnic_fill_stats(u64 *data, void *stats, int type) · 284 unmodified lines
12701270 return data;
12711271 }
12721272
1273−static void qlcnic_update_stats(struct qlcnic_adapter *adapter)
1273+void qlcnic_update_stats(struct qlcnic_adapter *adapter)
12741274 {
12751275 struct qlcnic_host_tx_ring *tx_ring;
12761276 int ring;
drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c+4−0
@@ -134,6 +134,8 @@ void qlcnic_release_tx_buffers(struct qlcnic_adapter *adapter, · 133 unmodified lines
134134 struct qlcnic_skb_frag *buffrag;
135135 int i, j;
136136
137+ spin_lock(&tx_ring->tx_clean_lock);
138+
137139 cmd_buf = tx_ring->cmd_buf_arr;
138140 for (i = 0; i < tx_ring->num_desc; i++) {
139141 buffrag = cmd_buf->frag_array;
@@ -157,6 +159,8 @@ void qlcnic_release_tx_buffers(struct qlcnic_adapter *adapter, · 17 unmodified lines
157159 }
158160 cmd_buf++;
159161 }
162+
163+ spin_unlock(&tx_ring->tx_clean_lock);
160164 }
161165
162166 void qlcnic_free_sw_resources(struct qlcnic_adapter *adapter)
drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c+11−11
@@ -687,17 +687,15 @@ void qlcnic_advert_link_change(struct qlcnic_adapter *adapter, int linkup) · 686 unmodified lines
687687 if (adapter->ahw->linkup && !linkup) {
688688 netdev_info(netdev, "NIC Link is down\n");
689689 adapter->ahw->linkup = 0;
690− if (netif_running(netdev)) {
691− netif_carrier_off(netdev);
692− netif_tx_stop_all_queues(netdev);
693− }
690+ netif_carrier_off(netdev);
694691 } else if (!adapter->ahw->linkup && linkup) {
692+ /* Do not advertise Link up if the port is in loopback mode */
693+ if (qlcnic_83xx_check(adapter) && adapter->ahw->lb_mode)
694+ return;
695+
695696 netdev_info(netdev, "NIC Link is up\n");
696697 adapter->ahw->linkup = 1;
697− if (netif_running(netdev)) {
698− netif_carrier_on(netdev);
699− netif_wake_queue(netdev);
700− }
698+ netif_carrier_on(netdev);
701699 }
702700 }
703701
@@ -784,7 +782,7 @@ static int qlcnic_process_cmd_ring(struct qlcnic_adapter *adapter, · 80 unmodified lines
784782 struct net_device *netdev = adapter->netdev;
785783 struct qlcnic_skb_frag *frag;
786784
787− if (!spin_trylock(&adapter->tx_clean_lock))
785+ if (!spin_trylock(&tx_ring->tx_clean_lock))
788786 return 1;
789787
790788 sw_consumer = tx_ring->sw_consumer;
@@ -813,8 +811,9 @@ static int qlcnic_process_cmd_ring(struct qlcnic_adapter *adapter, · 22 unmodified lines
813811 break;
814812 }
815813
814+ tx_ring->sw_consumer = sw_consumer;
815+
816816 if (count && netif_running(netdev)) {
817− tx_ring->sw_consumer = sw_consumer;
818817 smp_mb();
819818 if (netif_tx_queue_stopped(tx_ring->txq) &&
820819 netif_carrier_ok(netdev)) {
@@ -840,7 +839,8 @@ static int qlcnic_process_cmd_ring(struct qlcnic_adapter *adapter, · 19 unmodified lines
840839 */
841840 hw_consumer = le32_to_cpu(*(tx_ring->hw_consumer));
842841 done = (sw_consumer == hw_consumer);
843− spin_unlock(&adapter->tx_clean_lock);
842+
843+ spin_unlock(&tx_ring->tx_clean_lock);
844844
845845 return done;
846846 }
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c+5−4
@@ -1178,6 +1178,7 @@ qlcnic_initialize_nic(struct qlcnic_adapter *adapter) · 1177 unmodified lines
11781178 } else {
11791179 adapter->ahw->nic_mode = QLCNIC_DEFAULT_MODE;
11801180 adapter->max_tx_rings = QLCNIC_MAX_HW_TX_RINGS;
1181+ adapter->max_sds_rings = QLCNIC_MAX_SDS_RINGS;
11811182 adapter->flags &= ~QLCNIC_ESWITCH_ENABLED;
11821183 }
11831184
@@ -1755,7 +1756,6 @@ void __qlcnic_down(struct qlcnic_adapter *adapter, struct net_device *netdev) · 571 unmodified lines
17551756 if (qlcnic_sriov_vf_check(adapter))
17561757 qlcnic_sriov_cleanup_async_list(&adapter->ahw->sriov->bc);
17571758 smp_mb();
1758− spin_lock(&adapter->tx_clean_lock);
17591759 netif_carrier_off(netdev);
17601760 adapter->ahw->linkup = 0;
17611761 netif_tx_disable(netdev);
@@ -1776,7 +1776,6 @@ void __qlcnic_down(struct qlcnic_adapter *adapter, struct net_device *netdev) · 14 unmodified lines
17761776
17771777 for (ring = 0; ring < adapter->drv_tx_rings; ring++)
17781778 qlcnic_release_tx_buffers(adapter, &adapter->tx_ring[ring]);
1779− spin_unlock(&adapter->tx_clean_lock);
17801779 }
17811780
17821781 /* Usage: During suspend and firmware recovery module */
@@ -1940,7 +1939,6 @@ int qlcnic_diag_alloc_res(struct net_device *netdev, int test) · 157 unmodified lines
19401939 qlcnic_detach(adapter);
19411940
19421941 adapter->drv_sds_rings = QLCNIC_SINGLE_RING;
1943− adapter->drv_tx_rings = QLCNIC_SINGLE_RING;
19441942 adapter->ahw->diag_test = test;
19451943 adapter->ahw->linkup = 0;
19461944
@@ -2172,6 +2170,7 @@ int qlcnic_alloc_tx_rings(struct qlcnic_adapter *adapter, · 225 unmodified lines
21722170 }
21732171 memset(cmd_buf_arr, 0, TX_BUFF_RINGSIZE(tx_ring));
21742172 tx_ring->cmd_buf_arr = cmd_buf_arr;
2173+ spin_lock_init(&tx_ring->tx_clean_lock);
21752174 }
21762175
21772176 if (qlcnic_83xx_check(adapter) ||
@@ -2299,7 +2298,6 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 121 unmodified lines
22992298 rwlock_init(&adapter->ahw->crb_lock);
23002299 mutex_init(&adapter->ahw->mem_lock);
23012300
2302− spin_lock_init(&adapter->tx_clean_lock);
23032301 INIT_LIST_HEAD(&adapter->mac_list);
23042302
23052303 qlcnic_register_dcb(adapter);
@@ -2782,6 +2780,9 @@ static struct net_device_stats *qlcnic_get_stats(struct net_device *netdev) · 476 unmodified lines
27822780 struct qlcnic_adapter *adapter = netdev_priv(netdev);
27832781 struct net_device_stats *stats = &netdev->stats;
27842782
2783+ if (test_bit(__QLCNIC_DEV_UP, &adapter->state))
2784+ qlcnic_update_stats(adapter);
2785+
27852786 stats->rx_packets = adapter->stats.rx_pkts + adapter->stats.lro_pkts;
27862787 stats->tx_packets = adapter->stats.xmitfinished;
27872788 stats->rx_bytes = adapter->stats.rxbytes + adapter->stats.lrobytes;
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c+2−1
@@ -75,7 +75,6 @@ static int qlcnic_sriov_pf_cal_res_limit(struct qlcnic_adapter *adapter, · 74 unmodified lines
7575 num_vfs = sriov->num_vfs;
7676 max = num_vfs + 1;
7777 info->bit_offsets = 0xffff;
78− info->max_tx_ques = res->num_tx_queues / max;
7978 info->max_rx_mcast_mac_filters = res->num_rx_mcast_mac_filters;
8079 num_vf_macs = QLCNIC_SRIOV_VF_MAX_MAC;
8180
@@ -86,6 +85,7 @@ static int qlcnic_sriov_pf_cal_res_limit(struct qlcnic_adapter *adapter, · 4 unmodified lines
8685 info->max_tx_mac_filters = temp;
8786 info->min_tx_bw = 0;
8887 info->max_tx_bw = MAX_BW;
88+ info->max_tx_ques = res->num_tx_queues - sriov->num_vfs;
8989 } else {
9090 id = qlcnic_sriov_func_to_index(adapter, func);
9191 if (id < 0)
@@ -95,6 +95,7 @@ static int qlcnic_sriov_pf_cal_res_limit(struct qlcnic_adapter *adapter, · 3 unmodified lines
9595 info->max_tx_bw = vp->max_tx_bw;
9696 info->max_rx_ucast_mac_filters = num_vf_macs;
9797 info->max_tx_mac_filters = num_vf_macs;
98+ info->max_tx_ques = QLCNIC_SINGLE_RING;
9899 }
99100
100101 info->max_rx_ip_addr = res->num_destip / max;
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+9−11
@@ -622,17 +622,15 @@ static int stmmac_init_ptp(struct stmmac_priv *priv) · 621 unmodified lines
622622 if (!(priv->dma_cap.time_stamp || priv->dma_cap.atime_stamp))
623623 return -EOPNOTSUPP;
624624
625− if (netif_msg_hw(priv)) {
626− if (priv->dma_cap.time_stamp) {
627− pr_debug("IEEE 1588-2002 Time Stamp supported\n");
628− priv->adv_ts = 0;
629− }
630− if (priv->dma_cap.atime_stamp && priv->extend_desc) {
631− pr_debug
632− ("IEEE 1588-2008 Advanced Time Stamp supported\n");
633− priv->adv_ts = 1;
634− }
635− }
625+ priv->adv_ts = 0;
626+ if (priv->dma_cap.atime_stamp && priv->extend_desc)
627+ priv->adv_ts = 1;
628+
629+ if (netif_msg_hw(priv) && priv->dma_cap.time_stamp)
630+ pr_debug("IEEE 1588-2002 Time Stamp supported\n");
631+
632+ if (netif_msg_hw(priv) && priv->adv_ts)
633+ pr_debug("IEEE 1588-2008 Advanced Time Stamp supported\n");
636634
637635 priv->hw->ptp = &stmmac_ptp;
638636 priv->hwts_tx_en = 0;
drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c+2−2
@@ -56,7 +56,7 @@ static int stmmac_adjust_freq(struct ptp_clock_info *ptp, s32 ppb) · 55 unmodified lines
5656
5757 priv->hw->ptp->config_addend(priv->ioaddr, addend);
5858
59− spin_unlock_irqrestore(&priv->lock, flags);
59+ spin_unlock_irqrestore(&priv->ptp_lock, flags);
6060
6161 return 0;
6262 }
@@ -91,7 +91,7 @@ static int stmmac_adjust_time(struct ptp_clock_info *ptp, s64 delta) · 28 unmodified lines
9191
9292 priv->hw->ptp->adjust_systime(priv->ioaddr, sec, nsec, neg_adj);
9393
94− spin_unlock_irqrestore(&priv->lock, flags);
94+ spin_unlock_irqrestore(&priv->ptp_lock, flags);
9595
9696 return 0;
9797 }
drivers/net/ethernet/ti/cpsw.c+3−1
@@ -740,6 +740,8 @@ static void _cpsw_adjust_link(struct cpsw_slave *slave, · 739 unmodified lines
740740 /* set speed_in input in case RMII mode is used in 100Mbps */
741741 if (phy->speed == 100)
742742 mac_control |= BIT(15);
743+ else if (phy->speed == 10)
744+ mac_control |= BIT(18); /* In Band mode */
743745
744746 *link = true;
745747 } else {
@@ -2106,7 +2108,7 @@ static int cpsw_probe(struct platform_device *pdev) · 1360 unmodified lines
21062108 while ((res = platform_get_resource(priv->pdev, IORESOURCE_IRQ, k))) {
21072109 for (i = res->start; i <= res->end; i++) {
21082110 if (devm_request_irq(&pdev->dev, i, cpsw_interrupt, 0,
2109− dev_name(priv->dev), priv)) {
2111+ dev_name(&pdev->dev), priv)) {
21102112 dev_err(priv->dev, "error attaching irq\n");
21112113 goto clean_ale_ret;
21122114 }
drivers/net/ethernet/tile/tilegx.c+2−1
@@ -2080,7 +2080,8 @@ static int tile_net_tx(struct sk_buff *skb, struct net_device *dev) · 2079 unmodified lines
20802080 }
20812081
20822082 /* Return subqueue id on this core (one per core). */
2083−static u16 tile_net_select_queue(struct net_device *dev, struct sk_buff *skb)
2083+static u16 tile_net_select_queue(struct net_device *dev, struct sk_buff *skb,
2084+ void *accel_priv)
20842085 {
20852086 return smp_processor_id();
20862087 }
drivers/net/hamradio/hdlcdrv.c+2−0
@@ -571,6 +571,8 @@ static int hdlcdrv_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) · 570 unmodified lines
571571 case HDLCDRVCTL_CALIBRATE:
572572 if(!capable(CAP_SYS_RAWIO))
573573 return -EPERM;
574+ if (bi.data.calibrate > INT_MAX / s->par.bitrate)
575+ return -EINVAL;
574576 s->hdlctx.calibrate = bi.data.calibrate * s->par.bitrate / 16;
575577 return 0;
576578
drivers/net/hamradio/yam.c+1−0
@@ -1057,6 +1057,7 @@ static int yam_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) · 1056 unmodified lines
10571057 break;
10581058
10591059 case SIOCYAMGCFG:
1060+ memset(&yi, 0, sizeof(yi));
10601061 yi.cfg.mask = 0xffffffff;
10611062 yi.cfg.iobase = yp->iobase;
10621063 yi.cfg.irq = yp->irq;
drivers/net/hyperv/netvsc_drv.c+8−13
@@ -261,9 +261,7 @@ int netvsc_recv_callback(struct hv_device *device_obj, · 260 unmodified lines
261261 struct sk_buff *skb;
262262
263263 net = ((struct netvsc_device *)hv_get_drvdata(device_obj))->ndev;
264− if (!net) {
265− netdev_err(net, "got receive callback but net device"
266− " not initialized yet\n");
264+ if (!net || net->reg_state != NETREG_REGISTERED) {
267265 packet->status = NVSP_STAT_FAIL;
268266 return 0;
269267 }
@@ -327,7 +325,6 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu) · 57 unmodified lines
327325 return -EINVAL;
328326
329327 nvdev->start_remove = true;
330− cancel_delayed_work_sync(&ndevctx->dwork);
331328 cancel_work_sync(&ndevctx->work);
332329 netif_tx_disable(ndev);
333330 rndis_filter_device_remove(hdev);
@@ -436,19 +433,11 @@ static int netvsc_probe(struct hv_device *dev, · 102 unmodified lines
436433 SET_ETHTOOL_OPS(net, &ethtool_ops);
437434 SET_NETDEV_DEV(net, &dev->device);
438435
439− ret = register_netdev(net);
440− if (ret != 0) {
441− pr_err("Unable to register netdev.\n");
442− free_netdev(net);
443− goto out;
444− }
445−
446436 /* Notify the netvsc driver of the new device */
447437 device_info.ring_size = ring_size;
448438 ret = rndis_filter_device_add(dev, &device_info);
449439 if (ret != 0) {
450440 netdev_err(net, "unable to add netvsc device (ret %d)\n", ret);
451− unregister_netdev(net);
452441 free_netdev(net);
453442 hv_set_drvdata(dev, NULL);
454443 return ret;
@@ -457,7 +446,13 @@ static int netvsc_probe(struct hv_device *dev, · 2 unmodified lines
457446
458447 netif_carrier_on(net);
459448
460−out:
449+ ret = register_netdev(net);
450+ if (ret != 0) {
451+ pr_err("Unable to register netdev.\n");
452+ rndis_filter_device_remove(dev);
453+ free_netdev(net);
454+ }
455+
461456 return ret;
462457 }
463458
drivers/net/macvlan.c+18−8
@@ -299,7 +299,7 @@ netdev_tx_t macvlan_start_xmit(struct sk_buff *skb, · 298 unmodified lines
299299
300300 if (vlan->fwd_priv) {
301301 skb->dev = vlan->lowerdev;
302− ret = dev_hard_start_xmit(skb, skb->dev, NULL, vlan->fwd_priv);
302+ ret = dev_queue_xmit_accel(skb, vlan->fwd_priv);
303303 } else {
304304 ret = macvlan_queue_xmit(skb, dev);
305305 }
@@ -338,6 +338,8 @@ static const struct header_ops macvlan_hard_header_ops = { · 32 unmodified lines
338338 .cache_update = eth_header_cache_update,
339339 };
340340
341+static struct rtnl_link_ops macvlan_link_ops;
342+
341343 static int macvlan_open(struct net_device *dev)
342344 {
343345 struct macvlan_dev *vlan = netdev_priv(dev);
@@ -353,7 +355,8 @@ static int macvlan_open(struct net_device *dev) · 9 unmodified lines
353355 goto hash_add;
354356 }
355357
356− if (lowerdev->features & NETIF_F_HW_L2FW_DOFFLOAD) {
358+ if (lowerdev->features & NETIF_F_HW_L2FW_DOFFLOAD &&
359+ dev->rtnl_link_ops == &macvlan_link_ops) {
357360 vlan->fwd_priv =
358361 lowerdev->netdev_ops->ndo_dfwd_add_station(lowerdev, dev);
359362
@@ -362,10 +365,8 @@ static int macvlan_open(struct net_device *dev) · 2 unmodified lines
362365 */
363366 if (IS_ERR_OR_NULL(vlan->fwd_priv)) {
364367 vlan->fwd_priv = NULL;
365− } else {
366− dev->features &= ~NETIF_F_LLTX;
368+ } else
367369 return 0;
368− }
369370 }
370371
371372 err = -EBUSY;
@@ -690,8 +691,18 @@ static netdev_features_t macvlan_fix_features(struct net_device *dev, · 318 unmodified lines
690691 netdev_features_t features)
691692 {
692693 struct macvlan_dev *vlan = netdev_priv(dev);
694+ netdev_features_t mask;
695+
696+ features |= NETIF_F_ALL_FOR_ALL;
697+ features &= (vlan->set_features | ~MACVLAN_FEATURES);
698+ mask = features;
699+
700+ features = netdev_increment_features(vlan->lowerdev->features,
701+ features,
702+ mask);
703+ features |= NETIF_F_LLTX;
693704
694− return features & (vlan->set_features | ~MACVLAN_FEATURES);
705+ return features;
695706 }
696707
697708 static const struct ethtool_ops macvlan_ethtool_ops = {
@@ -1019,9 +1030,8 @@ static int macvlan_device_event(struct notifier_block *unused, · 321 unmodified lines
10191030 break;
10201031 case NETDEV_FEAT_CHANGE:
10211032 list_for_each_entry(vlan, &port->vlans, list) {
1022− vlan->dev->features = dev->features & MACVLAN_FEATURES;
10231033 vlan->dev->gso_max_size = dev->gso_max_size;
1024− netdev_features_change(vlan->dev);
1034+ netdev_update_features(vlan->dev);
10251035 }
10261036 break;
10271037 case NETDEV_UNREGISTER:
drivers/net/phy/phy.c+2−4
@@ -565,10 +565,8 @@ int phy_start_interrupts(struct phy_device *phydev) · 564 unmodified lines
565565 int err = 0;
566566
567567 atomic_set(&phydev->irq_disable, 0);
568− if (request_irq(phydev->irq, phy_interrupt,
569− IRQF_SHARED,
570− "phy_interrupt",
571− phydev) < 0) {
568+ if (request_irq(phydev->irq, phy_interrupt, 0, "phy_interrupt",
569+ phydev) < 0) {
572570 pr_warn("%s: Can't get IRQ %d (PHY)\n",
573571 phydev->bus->name, phydev->irq);
574572 phydev->irq = PHY_POLL;
drivers/net/team/team.c+2−1
@@ -1647,7 +1647,8 @@ static netdev_tx_t team_xmit(struct sk_buff *skb, struct net_device *dev) · 1646 unmodified lines
16471647 return NETDEV_TX_OK;
16481648 }
16491649
1650−static u16 team_select_queue(struct net_device *dev, struct sk_buff *skb)
1650+static u16 team_select_queue(struct net_device *dev, struct sk_buff *skb,
1651+ void *accel_priv)
16511652 {
16521653 /*
16531654 * This helper function exists to help dev_pick_tx get the correct
drivers/net/tun.c+2−1
@@ -348,7 +348,8 @@ unlock: · 347 unmodified lines
348348 * different rxq no. here. If we could not get rxhash, then we would
349349 * hope the rxq no. may help here.
350350 */
351−static u16 tun_select_queue(struct net_device *dev, struct sk_buff *skb)
351+static u16 tun_select_queue(struct net_device *dev, struct sk_buff *skb,
352+ void *accel_priv)
352353 {
353354 struct tun_struct *tun = netdev_priv(dev);
354355 struct tun_flow_entry *e;
drivers/net/usb/Kconfig+3−3
@@ -276,12 +276,12 @@ config USB_NET_CDC_MBIM · 275 unmodified lines
276276 module will be called cdc_mbim.
277277
278278 config USB_NET_DM9601
279− tristate "Davicom DM9601 based USB 1.1 10/100 ethernet devices"
279+ tristate "Davicom DM96xx based USB 10/100 ethernet devices"
280280 depends on USB_USBNET
281281 select CRC32
282282 help
283− This option adds support for Davicom DM9601 based USB 1.1
284− 10/100 Ethernet adapters.
283+ This option adds support for Davicom DM9601/DM9620/DM9621A
284+ based USB 10/100 Ethernet adapters.
285285
286286 config USB_NET_SR9700
287287 tristate "CoreChip-sz SR9700 based USB 1.1 10/100 ethernet devices"
drivers/net/usb/dm9601.c+32−12
@@ -1,5 +1,5 @@
11 /*
2− * Davicom DM9601 USB 1.1 10/100Mbps ethernet devices
2+ * Davicom DM96xx USB 10/100Mbps ethernet devices
33 *
44 * Peter Korsgaard <jacmet@sunsite.dk>
55 *
@@ -364,7 +364,12 @@ static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf) · 358 unmodified lines
364364 dev->net->ethtool_ops = &dm9601_ethtool_ops;
365365 dev->net->hard_header_len += DM_TX_OVERHEAD;
366366 dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;
367− dev->rx_urb_size = dev->net->mtu + ETH_HLEN + DM_RX_OVERHEAD;
367+
368+ /* dm9620/21a require room for 4 byte padding, even in dm9601
369+ * mode, so we need +1 to be able to receive full size
370+ * ethernet frames.
371+ */
372+ dev->rx_urb_size = dev->net->mtu + ETH_HLEN + DM_RX_OVERHEAD + 1;
368373
369374 dev->mii.dev = dev->net;
370375 dev->mii.mdio_read = dm9601_mdio_read;
@@ -468,7 +473,7 @@ static int dm9601_rx_fixup(struct usbnet *dev, struct sk_buff *skb) · 97 unmodified lines
468473 static struct sk_buff *dm9601_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
469474 gfp_t flags)
470475 {
471− int len;
476+ int len, pad;
472477
473478 /* format:
474479 b1: packet length low
@@ -476,12 +481,23 @@ static struct sk_buff *dm9601_tx_fixup(struct usbnet *dev, struct sk_buff *skb, · 1 unmodified line
476481 b3..n: packet data
477482 */
478483
479− len = skb->len;
484+ len = skb->len + DM_TX_OVERHEAD;
485+
486+ /* workaround for dm962x errata with tx fifo getting out of
487+ * sync if a USB bulk transfer retry happens right after a
488+ * packet with odd / maxpacket length by adding up to 3 bytes
489+ * padding.
490+ */
491+ while ((len & 1) || !(len % dev->maxpacket))
492+ len++;
480493
481− if (skb_headroom(skb) < DM_TX_OVERHEAD) {
494+ len -= DM_TX_OVERHEAD; /* hw header doesn't count as part of length */
495+ pad = len - skb->len;
496+
497+ if (skb_headroom(skb) < DM_TX_OVERHEAD || skb_tailroom(skb) < pad) {
482498 struct sk_buff *skb2;
483499
484− skb2 = skb_copy_expand(skb, DM_TX_OVERHEAD, 0, flags);
500+ skb2 = skb_copy_expand(skb, DM_TX_OVERHEAD, pad, flags);
485501 dev_kfree_skb_any(skb);
486502 skb = skb2;
487503 if (!skb)
@@ -490,10 +506,10 @@ static struct sk_buff *dm9601_tx_fixup(struct usbnet *dev, struct sk_buff *skb, · 2 unmodified lines
490506
491507 __skb_push(skb, DM_TX_OVERHEAD);
492508
493− /* usbnet adds padding if length is a multiple of packet size
494− if so, adjust length value in header */
495− if ((skb->len % dev->maxpacket) == 0)
496− len++;
509+ if (pad) {
510+ memset(skb->data + skb->len, 0, pad);
511+ __skb_put(skb, pad);
512+ }
497513
498514 skb->data[0] = len;
499515 skb->data[1] = len >> 8;
@@ -543,7 +559,7 @@ static int dm9601_link_reset(struct usbnet *dev) · 43 unmodified lines
543559 }
544560
545561 static const struct driver_info dm9601_info = {
546− .description = "Davicom DM9601 USB Ethernet",
562+ .description = "Davicom DM96xx USB 10/100 Ethernet",
547563 .flags = FLAG_ETHER | FLAG_LINK_INTR,
548564 .bind = dm9601_bind,
549565 .rx_fixup = dm9601_rx_fixup,
@@ -594,6 +610,10 @@ static const struct usb_device_id products[] = { · 44 unmodified lines
594610 USB_DEVICE(0x0a46, 0x9620), /* DM9620 USB to Fast Ethernet Adapter */
595611 .driver_info = (unsigned long)&dm9601_info,
596612 },
613+ {
614+ USB_DEVICE(0x0a46, 0x9621), /* DM9621A USB to Fast Ethernet Adapter */
615+ .driver_info = (unsigned long)&dm9601_info,
616+ },
597617 {}, // END
598618 };
599619
@@ -612,5 +632,5 @@ static struct usb_driver dm9601_driver = { · 12 unmodified lines
612632 module_usb_driver(dm9601_driver);
613633
614634 MODULE_AUTHOR("Peter Korsgaard <jacmet@sunsite.dk>");
615−MODULE_DESCRIPTION("Davicom DM9601 USB 1.1 ethernet devices");
635+MODULE_DESCRIPTION("Davicom DM96xx USB 10/100 ethernet devices");
616636 MODULE_LICENSE("GPL");
drivers/net/usb/hso.c+11−2
@@ -185,7 +185,6 @@ enum rx_ctrl_state{ · 184 unmodified lines
185185 #define BM_REQUEST_TYPE (0xa1)
186186 #define B_NOTIFICATION (0x20)
187187 #define W_VALUE (0x0)
188−#define W_INDEX (0x2)
189188 #define W_LENGTH (0x2)
190189
191190 #define B_OVERRUN (0x1<<6)
@@ -1487,6 +1486,7 @@ static void tiocmget_intr_callback(struct urb *urb) · 1295 unmodified lines
14871486 struct uart_icount *icount;
14881487 struct hso_serial_state_notification *serial_state_notification;
14891488 struct usb_device *usb;
1489+ int if_num;
14901490
14911491 /* Sanity checks */
14921492 if (!serial)
@@ -1495,15 +1495,24 @@ static void tiocmget_intr_callback(struct urb *urb) · 2 unmodified lines
14951495 handle_usb_error(status, __func__, serial->parent);
14961496 return;
14971497 }
1498+
1499+ /* tiocmget is only supported on HSO_PORT_MODEM */
14981500 tiocmget = serial->tiocmget;
14991501 if (!tiocmget)
15001502 return;
1503+ BUG_ON((serial->parent->port_spec & HSO_PORT_MASK) != HSO_PORT_MODEM);
1504+
15011505 usb = serial->parent->usb;
1506+ if_num = serial->parent->interface->altsetting->desc.bInterfaceNumber;
1507+
1508+ /* wIndex should be the USB interface number of the port to which the
1509+ * notification applies, which should always be the Modem port.
1510+ */
15021511 serial_state_notification = &tiocmget->serial_state_notification;
15031512 if (serial_state_notification->bmRequestType != BM_REQUEST_TYPE ||
15041513 serial_state_notification->bNotification != B_NOTIFICATION ||
15051514 le16_to_cpu(serial_state_notification->wValue) != W_VALUE ||
1506− le16_to_cpu(serial_state_notification->wIndex) != W_INDEX ||
1515+ le16_to_cpu(serial_state_notification->wIndex) != if_num ||
15071516 le16_to_cpu(serial_state_notification->wLength) != W_LENGTH) {
15081517 dev_warn(&usb->dev,
15091518 "hso received invalid serial state notification\n");
drivers/net/usb/mcs7830.c+4−15
@@ -117,7 +117,6 @@ enum { · 116 unmodified lines
117117 struct mcs7830_data {
118118 u8 multi_filter[8];
119119 u8 config;
120− u8 link_counter;
121120 };
122121
123122 static const char driver_name[] = "MOSCHIP usb-ethernet driver";
@@ -561,26 +560,16 @@ static void mcs7830_status(struct usbnet *dev, struct urb *urb) · 437 unmodified lines
561560 {
562561 u8 *buf = urb->transfer_buffer;
563562 bool link, link_changed;
564− struct mcs7830_data *data = mcs7830_get_data(dev);
565563
566564 if (urb->actual_length < 16)
567565 return;
568566
569− link = !(buf[1] & 0x20);
567+ link = !(buf[1] == 0x20);
570568 link_changed = netif_carrier_ok(dev->net) != link;
571569 if (link_changed) {
572− data->link_counter++;
573− /*
574− track link state 20 times to guard against erroneous
575− link state changes reported sometimes by the chip
576− */
577− if (data->link_counter > 20) {
578− data->link_counter = 0;
579− usbnet_link_change(dev, link, 0);
580− netdev_dbg(dev->net, "Link Status is: %d\n", link);
581− }
582− } else
583− data->link_counter = 0;
570+ usbnet_link_change(dev, link, 0);
571+ netdev_dbg(dev->net, "Link Status is: %d\n", link);
572+ }
584573 }
585574
586575 static const struct driver_info moschip_info = {
drivers/net/virtio_net.c+6−5
@@ -1797,16 +1797,17 @@ static int virtnet_restore(struct virtio_device *vdev) · 1796 unmodified lines
17971797 if (err)
17981798 return err;
17991799
1800− if (netif_running(vi->dev))
1800+ if (netif_running(vi->dev)) {
1801+ for (i = 0; i < vi->curr_queue_pairs; i++)
1802+ if (!try_fill_recv(&vi->rq[i], GFP_KERNEL))
1803+ schedule_delayed_work(&vi->refill, 0);
1804+
18011805 for (i = 0; i < vi->max_queue_pairs; i++)
18021806 virtnet_napi_enable(&vi->rq[i]);
1807+ }
18031808
18041809 netif_device_attach(vi->dev);
18051810
1806− for (i = 0; i < vi->curr_queue_pairs; i++)
1807− if (!try_fill_recv(&vi->rq[i], GFP_KERNEL))
1808− schedule_delayed_work(&vi->refill, 0);
1809−
18101811 mutex_lock(&vi->config_lock);
18111812 vi->config_enable = true;
18121813 mutex_unlock(&vi->config_lock);
drivers/net/vxlan.c+2−1
@@ -2440,7 +2440,8 @@ static int vxlan_newlink(struct net *net, struct net_device *dev, · 2439 unmodified lines
24402440 /* update header length based on lower device */
24412441 dev->hard_header_len = lowerdev->hard_header_len +
24422442 (use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM);
2443− }
2443+ } else if (use_ipv6)
2444+ vxlan->flags |= VXLAN_F_IPV6;
24442445
24452446 if (data[IFLA_VXLAN_TOS])
24462447 vxlan->tos = nla_get_u8(data[IFLA_VXLAN_TOS]);
drivers/net/wireless/ath/ath9k/ar9002_mac.c+43−9
@@ -76,9 +76,16 @@ static bool ar9002_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked) · 75 unmodified lines
7676 mask2 |= ATH9K_INT_CST;
7777 if (isr2 & AR_ISR_S2_TSFOOR)
7878 mask2 |= ATH9K_INT_TSFOOR;
79+
80+ if (!(pCap->hw_caps & ATH9K_HW_CAP_RAC_SUPPORTED)) {
81+ REG_WRITE(ah, AR_ISR_S2, isr2);
82+ isr &= ~AR_ISR_BCNMISC;
83+ }
7984 }
8085
81− isr = REG_READ(ah, AR_ISR_RAC);
86+ if (pCap->hw_caps & ATH9K_HW_CAP_RAC_SUPPORTED)
87+ isr = REG_READ(ah, AR_ISR_RAC);
88+
8289 if (isr == 0xffffffff) {
8390 *masked = 0;
8491 return false;
@@ -97,11 +104,23 @@ static bool ar9002_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked) · 12 unmodified lines
97104
98105 *masked |= ATH9K_INT_TX;
99106
100− s0_s = REG_READ(ah, AR_ISR_S0_S);
107+ if (pCap->hw_caps & ATH9K_HW_CAP_RAC_SUPPORTED) {
108+ s0_s = REG_READ(ah, AR_ISR_S0_S);
109+ s1_s = REG_READ(ah, AR_ISR_S1_S);
110+ } else {
111+ s0_s = REG_READ(ah, AR_ISR_S0);
112+ REG_WRITE(ah, AR_ISR_S0, s0_s);
113+ s1_s = REG_READ(ah, AR_ISR_S1);
114+ REG_WRITE(ah, AR_ISR_S1, s1_s);
115+
116+ isr &= ~(AR_ISR_TXOK |
117+ AR_ISR_TXDESC |
118+ AR_ISR_TXERR |
119+ AR_ISR_TXEOL);
120+ }
121+
101122 ah->intr_txqs |= MS(s0_s, AR_ISR_S0_QCU_TXOK);
102123 ah->intr_txqs |= MS(s0_s, AR_ISR_S0_QCU_TXDESC);
103−
104− s1_s = REG_READ(ah, AR_ISR_S1_S);
105124 ah->intr_txqs |= MS(s1_s, AR_ISR_S1_QCU_TXERR);
106125 ah->intr_txqs |= MS(s1_s, AR_ISR_S1_QCU_TXEOL);
107126 }
@@ -114,13 +133,15 @@ static bool ar9002_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked) · 6 unmodified lines
114133 *masked |= mask2;
115134 }
116135
117− if (AR_SREV_9100(ah))
118− return true;
119−
120− if (isr & AR_ISR_GENTMR) {
136+ if (!AR_SREV_9100(ah) && (isr & AR_ISR_GENTMR)) {
121137 u32 s5_s;
122138
123− s5_s = REG_READ(ah, AR_ISR_S5_S);
139+ if (pCap->hw_caps & ATH9K_HW_CAP_RAC_SUPPORTED) {
140+ s5_s = REG_READ(ah, AR_ISR_S5_S);
141+ } else {
142+ s5_s = REG_READ(ah, AR_ISR_S5);
143+ }
144+
124145 ah->intr_gen_timer_trigger =
125146 MS(s5_s, AR_ISR_S5_GENTIMER_TRIG);
126147
@@ -133,8 +154,21 @@ static bool ar9002_hw_get_isr(struct ath_hw *ah, enum ath9k_int *masked) · 6 unmodified lines
133154 if ((s5_s & AR_ISR_S5_TIM_TIMER) &&
134155 !(pCap->hw_caps & ATH9K_HW_CAP_AUTOSLEEP))
135156 *masked |= ATH9K_INT_TIM_TIMER;
157+
158+ if (!(pCap->hw_caps & ATH9K_HW_CAP_RAC_SUPPORTED)) {
159+ REG_WRITE(ah, AR_ISR_S5, s5_s);
160+ isr &= ~AR_ISR_GENTMR;
161+ }
136162 }
137163
164+ if (!(pCap->hw_caps & ATH9K_HW_CAP_RAC_SUPPORTED)) {
165+ REG_WRITE(ah, AR_ISR, isr);
166+ REG_READ(ah, AR_ISR);
167+ }
168+
169+ if (AR_SREV_9100(ah))
170+ return true;
171+
138172 if (sync_cause) {
139173 ath9k_debug_sync_cause(common, sync_cause);
140174 fatal_int =
drivers/net/wireless/ath/ath9k/htc_drv_main.c+17−8
@@ -127,21 +127,26 @@ static void ath9k_htc_bssid_iter(void *data, u8 *mac, struct ieee80211_vif *vif) · 126 unmodified lines
127127 struct ath9k_vif_iter_data *iter_data = data;
128128 int i;
129129
130− for (i = 0; i < ETH_ALEN; i++)
131− iter_data->mask[i] &= ~(iter_data->hw_macaddr[i] ^ mac[i]);
130+ if (iter_data->hw_macaddr != NULL) {
131+ for (i = 0; i < ETH_ALEN; i++)
132+ iter_data->mask[i] &= ~(iter_data->hw_macaddr[i] ^ mac[i]);
133+ } else {
134+ iter_data->hw_macaddr = mac;
135+ }
132136 }
133137
134−static void ath9k_htc_set_bssid_mask(struct ath9k_htc_priv *priv,
138+static void ath9k_htc_set_mac_bssid_mask(struct ath9k_htc_priv *priv,
135139 struct ieee80211_vif *vif)
136140 {
137141 struct ath_common *common = ath9k_hw_common(priv->ah);
138142 struct ath9k_vif_iter_data iter_data;
139143
140144 /*
141− * Use the hardware MAC address as reference, the hardware uses it
142− * together with the BSSID mask when matching addresses.
145+ * Pick the MAC address of the first interface as the new hardware
146+ * MAC address. The hardware will use it together with the BSSID mask
147+ * when matching addresses.
143148 */
144− iter_data.hw_macaddr = common->macaddr;
149+ iter_data.hw_macaddr = NULL;
145150 memset(&iter_data.mask, 0xff, ETH_ALEN);
146151
147152 if (vif)
@@ -153,6 +158,10 @@ static void ath9k_htc_set_bssid_mask(struct ath9k_htc_priv *priv, · 5 unmodified lines
153158 ath9k_htc_bssid_iter, &iter_data);
154159
155160 memcpy(common->bssidmask, iter_data.mask, ETH_ALEN);
161+
162+ if (iter_data.hw_macaddr)
163+ memcpy(common->macaddr, iter_data.hw_macaddr, ETH_ALEN);
164+
156165 ath_hw_setbssidmask(common);
157166 }
158167
@@ -1063,7 +1072,7 @@ static int ath9k_htc_add_interface(struct ieee80211_hw *hw, · 904 unmodified lines
10631072 goto out;
10641073 }
10651074
1066− ath9k_htc_set_bssid_mask(priv, vif);
1075+ ath9k_htc_set_mac_bssid_mask(priv, vif);
10671076
10681077 priv->vif_slot |= (1 << avp->index);
10691078 priv->nvifs++;
@@ -1128,7 +1137,7 @@ static void ath9k_htc_remove_interface(struct ieee80211_hw *hw, · 58 unmodified lines
11281137
11291138 ath9k_htc_set_opmode(priv);
11301139
1131− ath9k_htc_set_bssid_mask(priv, vif);
1140+ ath9k_htc_set_mac_bssid_mask(priv, vif);
11321141
11331142 /*
11341143 * Stop ANI only if there are no associated station interfaces.
drivers/net/wireless/ath/ath9k/main.c+3−2
@@ -965,8 +965,9 @@ void ath9k_calculate_iter_data(struct ieee80211_hw *hw, · 964 unmodified lines
965965 struct ath_common *common = ath9k_hw_common(ah);
966966
967967 /*
968− * Use the hardware MAC address as reference, the hardware uses it
969− * together with the BSSID mask when matching addresses.
968+ * Pick the MAC address of the first interface as the new hardware
969+ * MAC address. The hardware will use it together with the BSSID mask
970+ * when matching addresses.
970971 */
971972 memset(iter_data, 0, sizeof(*iter_data));
972973 memset(&iter_data->mask, 0xff, ETH_ALEN);
drivers/net/wireless/iwlwifi/pcie/drv.c+8−2
@@ -357,21 +357,27 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = { · 356 unmodified lines
357357 {IWL_PCI_DEVICE(0x095B, 0x5310, iwl7265_2ac_cfg)},
358358 {IWL_PCI_DEVICE(0x095B, 0x5302, iwl7265_2ac_cfg)},
359359 {IWL_PCI_DEVICE(0x095B, 0x5210, iwl7265_2ac_cfg)},
360− {IWL_PCI_DEVICE(0x095B, 0x5012, iwl7265_2ac_cfg)},
361− {IWL_PCI_DEVICE(0x095B, 0x500A, iwl7265_2ac_cfg)},
360+ {IWL_PCI_DEVICE(0x095A, 0x5012, iwl7265_2ac_cfg)},
361+ {IWL_PCI_DEVICE(0x095A, 0x500A, iwl7265_2ac_cfg)},
362362 {IWL_PCI_DEVICE(0x095A, 0x5410, iwl7265_2ac_cfg)},
363+ {IWL_PCI_DEVICE(0x095A, 0x5400, iwl7265_2ac_cfg)},
363364 {IWL_PCI_DEVICE(0x095A, 0x1010, iwl7265_2ac_cfg)},
364365 {IWL_PCI_DEVICE(0x095A, 0x5000, iwl7265_2n_cfg)},
365366 {IWL_PCI_DEVICE(0x095B, 0x5200, iwl7265_2n_cfg)},
366367 {IWL_PCI_DEVICE(0x095A, 0x5002, iwl7265_n_cfg)},
367368 {IWL_PCI_DEVICE(0x095B, 0x5202, iwl7265_n_cfg)},
368369 {IWL_PCI_DEVICE(0x095A, 0x9010, iwl7265_2ac_cfg)},
370+ {IWL_PCI_DEVICE(0x095A, 0x9110, iwl7265_2ac_cfg)},
369371 {IWL_PCI_DEVICE(0x095A, 0x9210, iwl7265_2ac_cfg)},
372+ {IWL_PCI_DEVICE(0x095A, 0x9510, iwl7265_2ac_cfg)},
373+ {IWL_PCI_DEVICE(0x095A, 0x9310, iwl7265_2ac_cfg)},
370374 {IWL_PCI_DEVICE(0x095A, 0x9410, iwl7265_2ac_cfg)},
371375 {IWL_PCI_DEVICE(0x095A, 0x5020, iwl7265_2n_cfg)},
372376 {IWL_PCI_DEVICE(0x095A, 0x502A, iwl7265_2n_cfg)},
373377 {IWL_PCI_DEVICE(0x095A, 0x5420, iwl7265_2n_cfg)},
374378 {IWL_PCI_DEVICE(0x095A, 0x5090, iwl7265_2ac_cfg)},
379+ {IWL_PCI_DEVICE(0x095A, 0x5190, iwl7265_2ac_cfg)},
380+ {IWL_PCI_DEVICE(0x095A, 0x5590, iwl7265_2ac_cfg)},
375381 {IWL_PCI_DEVICE(0x095B, 0x5290, iwl7265_2ac_cfg)},
376382 {IWL_PCI_DEVICE(0x095A, 0x5490, iwl7265_2ac_cfg)},
377383 #endif /* CONFIG_IWLMVM */
drivers/net/wireless/mac80211_hwsim.c+1−1
@@ -2011,7 +2011,7 @@ static int hwsim_tx_info_frame_received_nl(struct sk_buff *skb_2, · 2010 unmodified lines
20112011 (hwsim_flags & HWSIM_TX_STAT_ACK)) {
20122012 if (skb->len >= 16) {
20132013 hdr = (struct ieee80211_hdr *) skb->data;
2014− mac80211_hwsim_monitor_ack(txi->rate_driver_data[0],
2014+ mac80211_hwsim_monitor_ack(data2->channel,
20152015 hdr->addr2);
20162016 }
20172017 txi->flags |= IEEE80211_TX_STAT_ACK;
drivers/net/wireless/mwifiex/main.c+2−1
@@ -746,7 +746,8 @@ static struct net_device_stats *mwifiex_get_stats(struct net_device *dev) · 745 unmodified lines
746746 }
747747
748748 static u16
749−mwifiex_netdev_select_wmm_queue(struct net_device *dev, struct sk_buff *skb)
749+mwifiex_netdev_select_wmm_queue(struct net_device *dev, struct sk_buff *skb,
750+ void *accel_priv)
750751 {
751752 skb->priority = cfg80211_classify8021d(skb);
752753 return mwifiex_1d_to_wmm_queue[skb->priority];
drivers/net/wireless/rtlwifi/pci.c+3−1
@@ -740,6 +740,8 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) · 739 unmodified lines
740740 };
741741 int index = rtlpci->rx_ring[rx_queue_idx].idx;
742742
743+ if (rtlpci->driver_is_goingto_unload)
744+ return;
743745 /*RX NORMAL PKT */
744746 while (count--) {
745747 /*rx descriptor */
@@ -1636,6 +1638,7 @@ static void rtl_pci_stop(struct ieee80211_hw *hw) · 890 unmodified lines
16361638 */
16371639 set_hal_stop(rtlhal);
16381640
1641+ rtlpci->driver_is_goingto_unload = true;
16391642 rtlpriv->cfg->ops->disable_interrupt(hw);
16401643 cancel_work_sync(&rtlpriv->works.lps_change_work);
16411644
@@ -1653,7 +1656,6 @@ static void rtl_pci_stop(struct ieee80211_hw *hw) · 11 unmodified lines
16531656 ppsc->rfchange_inprogress = true;
16541657 spin_unlock_irqrestore(&rtlpriv->locks.rf_ps_lock, flags);
16551658
1656− rtlpci->driver_is_goingto_unload = true;
16571659 rtlpriv->cfg->ops->hw_disable(hw);
16581660 /* some things are not needed if firmware not available */
16591661 if (!rtlpriv->max_fw_size)
drivers/net/xen-netback/common.h+13−6
@@ -101,6 +101,13 @@ struct xenvif_rx_meta { · 100 unmodified lines
101101
102102 #define MAX_PENDING_REQS 256
103103
104+/* It's possible for an skb to have a maximal number of frags
105+ * but still be less than MAX_BUFFER_OFFSET in size. Thus the
106+ * worst-case number of copy operations is MAX_SKB_FRAGS per
107+ * ring slot.
108+ */
109+#define MAX_GRANT_COPY_OPS (MAX_SKB_FRAGS * XEN_NETIF_RX_RING_SIZE)
110+
104111 struct xenvif {
105112 /* Unique identifier for this interface. */
106113 domid_t domid;
@@ -143,13 +150,13 @@ struct xenvif { · 36 unmodified lines
143150 */
144151 RING_IDX rx_req_cons_peek;
145152
146− /* Given MAX_BUFFER_OFFSET of 4096 the worst case is that each
147− * head/fragment page uses 2 copy operations because it
148− * straddles two buffers in the frontend.
149− */
150− struct gnttab_copy grant_copy_op[2*XEN_NETIF_RX_RING_SIZE];
151− struct xenvif_rx_meta meta[2*XEN_NETIF_RX_RING_SIZE];
153+ /* This array is allocated seperately as it is large */
154+ struct gnttab_copy *grant_copy_op;
152155
156+ /* We create one meta structure per ring request we consume, so
157+ * the maximum number is the same as the ring size.
158+ */
159+ struct xenvif_rx_meta meta[XEN_NETIF_RX_RING_SIZE];
153160
154161 u8 fe_dev_addr[6];
155162
drivers/net/xen-netback/interface.c+11−0
@@ -34,6 +34,7 @@ · 33 unmodified lines
3434 #include <linux/ethtool.h>
3535 #include <linux/rtnetlink.h>
3636 #include <linux/if_vlan.h>
37+#include <linux/vmalloc.h>
3738
3839 #include <xen/events.h>
3940 #include <asm/xen/hypercall.h>
@@ -307,6 +308,15 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, · 267 unmodified lines
307308 SET_NETDEV_DEV(dev, parent);
308309
309310 vif = netdev_priv(dev);
311+
312+ vif->grant_copy_op = vmalloc(sizeof(struct gnttab_copy) *
313+ MAX_GRANT_COPY_OPS);
314+ if (vif->grant_copy_op == NULL) {
315+ pr_warn("Could not allocate grant copy space for %s\n", name);
316+ free_netdev(dev);
317+ return ERR_PTR(-ENOMEM);
318+ }
319+
310320 vif->domid = domid;
311321 vif->handle = handle;
312322 vif->can_sg = 1;
@@ -487,6 +497,7 @@ void xenvif_free(struct xenvif *vif) · 174 unmodified lines
487497
488498 unregister_netdev(vif->dev);
489499
500+ vfree(vif->grant_copy_op);
490501 free_netdev(vif->dev);
491502
492503 module_put(THIS_MODULE);
drivers/net/xen-netback/netback.c+16−5
@@ -608,7 +608,7 @@ void xenvif_rx_action(struct xenvif *vif) · 607 unmodified lines
608608 if (!npo.copy_prod)
609609 return;
610610
611− BUG_ON(npo.copy_prod > ARRAY_SIZE(vif->grant_copy_op));
611+ BUG_ON(npo.copy_prod > MAX_GRANT_COPY_OPS);
612612 gnttab_batch_copy(vif->grant_copy_op, npo.copy_prod);
613613
614614 while ((skb = __skb_dequeue(&rxq)) != NULL) {
@@ -1197,6 +1197,9 @@ static int checksum_setup_ip(struct xenvif *vif, struct sk_buff *skb, · 582 unmodified lines
11971197
11981198 err = -EPROTO;
11991199
1200+ if (fragment)
1201+ goto out;
1202+
12001203 switch (ip_hdr(skb)->protocol) {
12011204 case IPPROTO_TCP:
12021205 err = maybe_pull_tail(skb,
@@ -1206,8 +1209,10 @@ static int checksum_setup_ip(struct xenvif *vif, struct sk_buff *skb, · 3 unmodified lines
12061209 goto out;
12071210
12081211 if (!skb_partial_csum_set(skb, off,
1209− offsetof(struct tcphdr, check)))
1212+ offsetof(struct tcphdr, check))) {
1213+ err = -EPROTO;
12101214 goto out;
1215+ }
12111216
12121217 if (recalculate_partial_csum)
12131218 tcp_hdr(skb)->check =
@@ -1224,8 +1229,10 @@ static int checksum_setup_ip(struct xenvif *vif, struct sk_buff *skb, · 10 unmodified lines
12241229 goto out;
12251230
12261231 if (!skb_partial_csum_set(skb, off,
1227− offsetof(struct udphdr, check)))
1232+ offsetof(struct udphdr, check))) {
1233+ err = -EPROTO;
12281234 goto out;
1235+ }
12291236
12301237 if (recalculate_partial_csum)
12311238 udp_hdr(skb)->check =
@@ -1347,8 +1354,10 @@ static int checksum_setup_ipv6(struct xenvif *vif, struct sk_buff *skb, · 115 unmodified lines
13471354 goto out;
13481355
13491356 if (!skb_partial_csum_set(skb, off,
1350− offsetof(struct tcphdr, check)))
1357+ offsetof(struct tcphdr, check))) {
1358+ err = -EPROTO;
13511359 goto out;
1360+ }
13521361
13531362 if (recalculate_partial_csum)
13541363 tcp_hdr(skb)->check =
@@ -1365,8 +1374,10 @@ static int checksum_setup_ipv6(struct xenvif *vif, struct sk_buff *skb, · 10 unmodified lines
13651374 goto out;
13661375
13671376 if (!skb_partial_csum_set(skb, off,
1368− offsetof(struct udphdr, check)))
1377+ offsetof(struct udphdr, check))) {
1378+ err = -EPROTO;
13691379 goto out;
1380+ }
13701381
13711382 if (recalculate_partial_csum)
13721383 udp_hdr(skb)->check =
drivers/of/Kconfig+1−1
@@ -20,7 +20,7 @@ config OF_SELFTEST · 19 unmodified lines
2020 depends on OF_IRQ
2121 help
2222 This option builds in test cases for the device tree infrastructure
23− that are executed one at boot time, and the results dumped to the
23+ that are executed once at boot time, and the results dumped to the
2424 console.
2525
2626 If unsure, say N here, but this option is safe to enable.
drivers/of/address.c+0−8
@@ -69,14 +69,6 @@ static u64 of_bus_default_map(__be32 *addr, const __be32 *range, · 68 unmodified lines
6969 (unsigned long long)cp, (unsigned long long)s,
7070 (unsigned long long)da);
7171
72− /*
73− * If the number of address cells is larger than 2 we assume the
74− * mapping doesn't specify a physical address. Rather, the address
75− * specifies an identifier that must match exactly.
76− */
77− if (na > 2 && memcmp(range, addr, na * 4) != 0)
78− return OF_BAD_ADDR;
79−
8072 if (da < cp || da >= (cp + s))
8173 return OF_BAD_ADDR;
8274 return da - cp;
drivers/of/fdt.c+10−2
@@ -922,8 +922,16 @@ void __init unflatten_device_tree(void) · 921 unmodified lines
922922 */
923923 void __init unflatten_and_copy_device_tree(void)
924924 {
925− int size = __be32_to_cpu(initial_boot_params->totalsize);
926− void *dt = early_init_dt_alloc_memory_arch(size,
925+ int size;
926+ void *dt;
927+
928+ if (!initial_boot_params) {
929+ pr_warn("No valid device tree found, continuing without\n");
930+ return;
931+ }
932+
933+ size = __be32_to_cpu(initial_boot_params->totalsize);
934+ dt = early_init_dt_alloc_memory_arch(size,
927935 __alignof__(struct boot_param_header));
928936
929937 if (dt) {
drivers/of/irq.c+1−4
@@ -165,7 +165,6 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq) · 164 unmodified lines
165165 if (of_get_property(ipar, "interrupt-controller", NULL) !=
166166 NULL) {
167167 pr_debug(" -> got it !\n");
168− of_node_put(old);
169168 return 0;
170169 }
171170
@@ -250,8 +249,7 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq) · 78 unmodified lines
250249 * Successfully parsed an interrrupt-map translation; copy new
251250 * interrupt specifier into the out_irq structure
252251 */
253− of_node_put(out_irq->np);
254− out_irq->np = of_node_get(newpar);
252+ out_irq->np = newpar;
255253
256254 match_array = imap - newaddrsize - newintsize;
257255 for (i = 0; i < newintsize; i++)
@@ -268,7 +266,6 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq) · 10 unmodified lines
268266 }
269267 fail:
270268 of_node_put(ipar);
271− of_node_put(out_irq->np);
272269 of_node_put(newpar);
273270
274271 return -EINVAL;
drivers/pci/hotplug/acpiphp_glue.c+26−4
@@ -279,7 +279,9 @@ static acpi_status register_slot(acpi_handle handle, u32 lvl, void *data, · 278 unmodified lines
279279
280280 status = acpi_evaluate_integer(handle, "_ADR", NULL, &adr);
281281 if (ACPI_FAILURE(status)) {
282− acpi_handle_warn(handle, "can't evaluate _ADR (%#x)\n", status);
282+ if (status != AE_NOT_FOUND)
283+ acpi_handle_warn(handle,
284+ "can't evaluate _ADR (%#x)\n", status);
283285 return AE_OK;
284286 }
285287
@@ -643,6 +645,24 @@ static void disable_slot(struct acpiphp_slot *slot) · 357 unmodified lines
643645 slot->flags &= (~SLOT_ENABLED);
644646 }
645647
648+static bool acpiphp_no_hotplug(acpi_handle handle)
649+{
650+ struct acpi_device *adev = NULL;
651+
652+ acpi_bus_get_device(handle, &adev);
653+ return adev && adev->flags.no_hotplug;
654+}
655+
656+static bool slot_no_hotplug(struct acpiphp_slot *slot)
657+{
658+ struct acpiphp_func *func;
659+
660+ list_for_each_entry(func, &slot->funcs, sibling)
661+ if (acpiphp_no_hotplug(func_to_handle(func)))
662+ return true;
663+
664+ return false;
665+}
646666
647667 /**
648668 * get_slot_status - get ACPI slot status
@@ -701,7 +721,8 @@ static void trim_stale_devices(struct pci_dev *dev) · 52 unmodified lines
701721 unsigned long long sta;
702722
703723 status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
704− alive = ACPI_SUCCESS(status) && sta == ACPI_STA_ALL;
724+ alive = (ACPI_SUCCESS(status) && sta == ACPI_STA_ALL)
725+ || acpiphp_no_hotplug(handle);
705726 }
706727 if (!alive) {
707728 u32 v;
@@ -741,8 +762,9 @@ static void acpiphp_check_bridge(struct acpiphp_bridge *bridge) · 33 unmodified lines
741762 struct pci_dev *dev, *tmp;
742763
743764 mutex_lock(&slot->crit_sect);
744− /* wake up all functions */
745− if (get_slot_status(slot) == ACPI_STA_ALL) {
765+ if (slot_no_hotplug(slot)) {
766+ ; /* do nothing */
767+ } else if (get_slot_status(slot) == ACPI_STA_ALL) {
746768 /* remove stale devices if any */
747769 list_for_each_entry_safe(dev, tmp, &bus->devices,
748770 bus_list)
drivers/pci/pci-acpi.c+12−9
@@ -330,29 +330,32 @@ static int acpi_pci_find_device(struct device *dev, acpi_handle *handle) · 329 unmodified lines
330330 static void pci_acpi_setup(struct device *dev)
331331 {
332332 struct pci_dev *pci_dev = to_pci_dev(dev);
333− acpi_handle handle = ACPI_HANDLE(dev);
334− struct acpi_device *adev;
333+ struct acpi_device *adev = ACPI_COMPANION(dev);
335334
336− if (acpi_bus_get_device(handle, &adev) || !adev->wakeup.flags.valid)
335+ if (!adev)
336+ return;
337+
338+ pci_acpi_add_pm_notifier(adev, pci_dev);
339+ if (!adev->wakeup.flags.valid)
337340 return;
338341
339342 device_set_wakeup_capable(dev, true);
340343 acpi_pci_sleep_wake(pci_dev, false);
341−
342− pci_acpi_add_pm_notifier(adev, pci_dev);
343344 if (adev->wakeup.flags.run_wake)
344345 device_set_run_wake(dev, true);
345346 }
346347
347348 static void pci_acpi_cleanup(struct device *dev)
348349 {
349− acpi_handle handle = ACPI_HANDLE(dev);
350− struct acpi_device *adev;
350+ struct acpi_device *adev = ACPI_COMPANION(dev);
351+
352+ if (!adev)
353+ return;
351354
352− if (!acpi_bus_get_device(handle, &adev) && adev->wakeup.flags.valid) {
355+ pci_acpi_remove_pm_notifier(adev);
356+ if (adev->wakeup.flags.valid) {
353357 device_set_wakeup_capable(dev, false);
354358 device_set_run_wake(dev, false);
355− pci_acpi_remove_pm_notifier(adev);
356359 }
357360 }
358361
drivers/phy/Kconfig+2−2
@@ -24,8 +24,8 @@ config PHY_EXYNOS_MIPI_VIDEO · 23 unmodified lines
2424 config OMAP_USB2
2525 tristate "OMAP USB2 PHY Driver"
2626 depends on ARCH_OMAP2PLUS
27+ depends on USB_PHY
2728 select GENERIC_PHY
28− select USB_PHY
2929 select OMAP_CONTROL_USB
3030 help
3131 Enable this to support the transceiver that is part of SOC. This
@@ -36,8 +36,8 @@ config OMAP_USB2 · 4 unmodified lines
3636 config TWL4030_USB
3737 tristate "TWL4030 USB Transceiver Driver"
3838 depends on TWL4030_CORE && REGULATOR_TWL4030 && USB_MUSB_OMAP2PLUS
39+ depends on USB_PHY
3940 select GENERIC_PHY
40− select USB_PHY
4141 help
4242 Enable this to support the USB OTG transceiver on TWL4030
4343 family chips (including the TWL5030 and TPS659x0 devices).
drivers/phy/phy-core.c+10−16
@@ -437,23 +437,18 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops, · 436 unmodified lines
437437 int id;
438438 struct phy *phy;
439439
440− if (!dev) {
441− dev_WARN(dev, "no device provided for PHY\n");
442− ret = -EINVAL;
443− goto err0;
444− }
440+ if (WARN_ON(!dev))
441+ return ERR_PTR(-EINVAL);
445442
446443 phy = kzalloc(sizeof(*phy), GFP_KERNEL);
447− if (!phy) {
448− ret = -ENOMEM;
449− goto err0;
450− }
444+ if (!phy)
445+ return ERR_PTR(-ENOMEM);
451446
452447 id = ida_simple_get(&phy_ida, 0, 0, GFP_KERNEL);
453448 if (id < 0) {
454449 dev_err(dev, "unable to get id\n");
455450 ret = id;
456− goto err0;
451+ goto free_phy;
457452 }
458453
459454 device_initialize(&phy->dev);
@@ -468,11 +463,11 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops, · 8 unmodified lines
468463
469464 ret = dev_set_name(&phy->dev, "phy-%s.%d", dev_name(dev), id);
470465 if (ret)
471− goto err1;
466+ goto put_dev;
472467
473468 ret = device_add(&phy->dev);
474469 if (ret)
475− goto err1;
470+ goto put_dev;
476471
477472 if (pm_runtime_enabled(dev)) {
478473 pm_runtime_enable(&phy->dev);
@@ -481,12 +476,11 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops, · 2 unmodified lines
481476
482477 return phy;
483478
484−err1:
485− ida_remove(&phy_ida, phy->id);
479+put_dev:
486480 put_device(&phy->dev);
481+ ida_remove(&phy_ida, phy->id);
482+free_phy:
487483 kfree(phy);
488−
489−err0:
490484 return ERR_PTR(ret);
491485 }
492486 EXPORT_SYMBOL_GPL(phy_create);
drivers/pinctrl/pinctrl-baytrail.c+1−0
@@ -512,6 +512,7 @@ static const struct dev_pm_ops byt_gpio_pm_ops = { · 511 unmodified lines
512512
513513 static const struct acpi_device_id byt_gpio_acpi_match[] = {
514514 { "INT33B2", 0 },
515+ { "INT33FC", 0 },
515516 { }
516517 };
517518 MODULE_DEVICE_TABLE(acpi, byt_gpio_acpi_match);
drivers/pinctrl/sh-pfc/sh_pfc.h+1−1
@@ -254,7 +254,7 @@ struct sh_pfc_soc_info { · 253 unmodified lines
254254 #define PINMUX_GPIO(_pin) \
255255 [GPIO_##_pin] = { \
256256 .pin = (u16)-1, \
257− .name = __stringify(name), \
257+ .name = __stringify(GPIO_##_pin), \
258258 .enum_id = _pin##_DATA, \
259259 }
260260
drivers/power/Kconfig+1−0
@@ -196,6 +196,7 @@ config BATTERY_MAX17040 · 195 unmodified lines
196196 config BATTERY_MAX17042
197197 tristate "Maxim MAX17042/17047/17050/8997/8966 Fuel Gauge"
198198 depends on I2C
199+ select REGMAP_I2C
199200 help
200201 MAX17042 is fuel-gauge systems for lithium-ion (Li+) batteries
201202 in handheld and portable equipment. The MAX17042 is configured
drivers/power/power_supply_core.c+6−6
@@ -511,6 +511,10 @@ int power_supply_register(struct device *parent, struct power_supply *psy) · 510 unmodified lines
511511 dev_set_drvdata(dev, psy);
512512 psy->dev = dev;
513513
514+ rc = dev_set_name(dev, "%s", psy->name);
515+ if (rc)
516+ goto dev_set_name_failed;
517+
514518 INIT_WORK(&psy->changed_work, power_supply_changed_work);
515519
516520 rc = power_supply_check_supplies(psy);
@@ -524,10 +528,6 @@ int power_supply_register(struct device *parent, struct power_supply *psy) · 7 unmodified lines
524528 if (rc)
525529 goto wakeup_init_failed;
526530
527− rc = kobject_set_name(&dev->kobj, "%s", psy->name);
528− if (rc)
529− goto kobject_set_name_failed;
530−
531531 rc = device_add(dev);
532532 if (rc)
533533 goto device_add_failed;
@@ -553,11 +553,11 @@ create_triggers_failed: · 19 unmodified lines
553553 register_cooler_failed:
554554 psy_unregister_thermal(psy);
555555 register_thermal_failed:
556−wakeup_init_failed:
557556 device_del(dev);
558−kobject_set_name_failed:
559557 device_add_failed:
558+wakeup_init_failed:
560559 check_supplies_failed:
560+dev_set_name_failed:
561561 put_device(dev);
562562 success:
563563 return rc;
drivers/powercap/intel_rapl.c+11−2
@@ -833,6 +833,11 @@ static int rapl_write_data_raw(struct rapl_domain *rd, · 832 unmodified lines
833833 return 0;
834834 }
835835
836+static const struct x86_cpu_id energy_unit_quirk_ids[] = {
837+ { X86_VENDOR_INTEL, 6, 0x37},/* VLV */
838+ {}
839+};
840+
836841 static int rapl_check_unit(struct rapl_package *rp, int cpu)
837842 {
838843 u64 msr_val;
@@ -853,8 +858,11 @@ static int rapl_check_unit(struct rapl_package *rp, int cpu) · 14 unmodified lines
853858 * time unit: 1/time_unit_divisor Seconds
854859 */
855860 value = (msr_val & ENERGY_UNIT_MASK) >> ENERGY_UNIT_OFFSET;
856− rp->energy_unit_divisor = 1 << value;
857−
861+ /* some CPUs have different way to calculate energy unit */
862+ if (x86_match_cpu(energy_unit_quirk_ids))
863+ rp->energy_unit_divisor = 1000000 / (1 << value);
864+ else
865+ rp->energy_unit_divisor = 1 << value;
858866
859867 value = (msr_val & POWER_UNIT_MASK) >> POWER_UNIT_OFFSET;
860868 rp->power_unit_divisor = 1 << value;
@@ -941,6 +949,7 @@ static void package_power_limit_irq_restore(int package_id) · 80 unmodified lines
941949 static const struct x86_cpu_id rapl_ids[] = {
942950 { X86_VENDOR_INTEL, 6, 0x2a},/* SNB */
943951 { X86_VENDOR_INTEL, 6, 0x2d},/* SNB EP */
952+ { X86_VENDOR_INTEL, 6, 0x37},/* VLV */
944953 { X86_VENDOR_INTEL, 6, 0x3a},/* IVB */
945954 { X86_VENDOR_INTEL, 6, 0x45},/* HSW */
946955 /* TODO: Add more CPU IDs after testing */
drivers/regulator/s2mps11.c+1−1
@@ -438,7 +438,7 @@ common_reg: · 437 unmodified lines
438438 platform_set_drvdata(pdev, s2mps11);
439439
440440 config.dev = &pdev->dev;
441− config.regmap = iodev->regmap;
441+ config.regmap = iodev->regmap_pmic;
442442 config.driver_data = s2mps11;
443443 for (i = 0; i < S2MPS11_REGULATOR_MAX; i++) {
444444 if (!reg_np) {
drivers/s390/char/tty3270.c+1−1
@@ -942,7 +942,7 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty) · 941 unmodified lines
942942 return rc;
943943 }
944944
945− tp->screen = tty3270_alloc_screen(tp->view.cols, tp->view.rows);
945+ tp->screen = tty3270_alloc_screen(tp->view.rows, tp->view.cols);
946946 if (IS_ERR(tp->screen)) {
947947 rc = PTR_ERR(tp->screen);
948948 raw3270_put_view(&tp->view);
drivers/scsi/qla2xxx/qla_target.c+6−4
@@ -471,7 +471,7 @@ static void qlt_schedule_sess_for_deletion(struct qla_tgt_sess *sess, · 470 unmodified lines
471471 schedule_delayed_work(&tgt->sess_del_work, 0);
472472 else
473473 schedule_delayed_work(&tgt->sess_del_work,
474− jiffies - sess->expires);
474+ sess->expires - jiffies);
475475 }
476476
477477 /* ha->hardware_lock supposed to be held on entry */
@@ -550,13 +550,14 @@ static void qlt_del_sess_work_fn(struct delayed_work *work) · 72 unmodified lines
550550 struct scsi_qla_host *vha = tgt->vha;
551551 struct qla_hw_data *ha = vha->hw;
552552 struct qla_tgt_sess *sess;
553− unsigned long flags;
553+ unsigned long flags, elapsed;
554554
555555 spin_lock_irqsave(&ha->hardware_lock, flags);
556556 while (!list_empty(&tgt->del_sess_list)) {
557557 sess = list_entry(tgt->del_sess_list.next, typeof(*sess),
558558 del_list_entry);
559− if (time_after_eq(jiffies, sess->expires)) {
559+ elapsed = jiffies;
560+ if (time_after_eq(elapsed, sess->expires)) {
560561 qlt_undelete_sess(sess);
561562
562563 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf004,
@@ -566,7 +567,7 @@ static void qlt_del_sess_work_fn(struct delayed_work *work) · 3 unmodified lines
566567 ha->tgt.tgt_ops->put_sess(sess);
567568 } else {
568569 schedule_delayed_work(&tgt->sess_del_work,
569− jiffies - sess->expires);
570+ sess->expires - elapsed);
570571 break;
571572 }
572573 }
@@ -4290,6 +4291,7 @@ int qlt_lport_register(struct qla_tgt_func_tmpl *qla_tgt_ops, u64 wwpn, · 3717 unmodified lines
42904291 if (rc != 0) {
42914292 ha->tgt.tgt_ops = NULL;
42924293 ha->tgt.target_lport_ptr = NULL;
4294+ scsi_host_put(host);
42934295 }
42944296 mutex_unlock(&qla_tgt_mutex);
42954297 return rc;
drivers/staging/bcm/Bcmnet.c+2−1
@@ -39,7 +39,8 @@ static INT bcm_close(struct net_device *dev) · 38 unmodified lines
3939 return 0;
4040 }
4141
42−static u16 bcm_select_queue(struct net_device *dev, struct sk_buff *skb)
42+static u16 bcm_select_queue(struct net_device *dev, struct sk_buff *skb,
43+ void *accel_priv)
4344 {
4445 return ClassifyPacket(netdev_priv(dev), skb);
4546 }
drivers/staging/comedi/drivers.c+1−1
@@ -446,7 +446,7 @@ int comedi_load_firmware(struct comedi_device *dev, · 445 unmodified lines
446446 release_firmware(fw);
447447 }
448448
449− return ret;
449+ return ret < 0 ? ret : 0;
450450 }
451451 EXPORT_SYMBOL_GPL(comedi_load_firmware);
452452
drivers/staging/comedi/drivers/8255_pci.c+12−3
@@ -63,7 +63,8 @@ enum pci_8255_boardid { · 62 unmodified lines
6363 BOARD_ADLINK_PCI7296,
6464 BOARD_CB_PCIDIO24,
6565 BOARD_CB_PCIDIO24H,
66− BOARD_CB_PCIDIO48H,
66+ BOARD_CB_PCIDIO48H_OLD,
67+ BOARD_CB_PCIDIO48H_NEW,
6768 BOARD_CB_PCIDIO96H,
6869 BOARD_NI_PCIDIO96,
6970 BOARD_NI_PCIDIO96B,
@@ -106,11 +107,16 @@ static const struct pci_8255_boardinfo pci_8255_boards[] = { · 36 unmodified lines
106107 .dio_badr = 2,
107108 .n_8255 = 1,
108109 },
109− [BOARD_CB_PCIDIO48H] = {
110+ [BOARD_CB_PCIDIO48H_OLD] = {
110111 .name = "cb_pci-dio48h",
111112 .dio_badr = 1,
112113 .n_8255 = 2,
113114 },
115+ [BOARD_CB_PCIDIO48H_NEW] = {
116+ .name = "cb_pci-dio48h",
117+ .dio_badr = 2,
118+ .n_8255 = 2,
119+ },
114120 [BOARD_CB_PCIDIO96H] = {
115121 .name = "cb_pci-dio96h",
116122 .dio_badr = 2,
@@ -263,7 +269,10 @@ static DEFINE_PCI_DEVICE_TABLE(pci_8255_pci_table) = { · 146 unmodified lines
263269 { PCI_VDEVICE(ADLINK, 0x7296), BOARD_ADLINK_PCI7296 },
264270 { PCI_VDEVICE(CB, 0x0028), BOARD_CB_PCIDIO24 },
265271 { PCI_VDEVICE(CB, 0x0014), BOARD_CB_PCIDIO24H },
266− { PCI_VDEVICE(CB, 0x000b), BOARD_CB_PCIDIO48H },
272+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_CB, 0x000b, 0x0000, 0x0000),
273+ .driver_data = BOARD_CB_PCIDIO48H_OLD },
274+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_CB, 0x000b, PCI_VENDOR_ID_CB, 0x000b),
275+ .driver_data = BOARD_CB_PCIDIO48H_NEW },
267276 { PCI_VDEVICE(CB, 0x0017), BOARD_CB_PCIDIO96H },
268277 { PCI_VDEVICE(NI, 0x0160), BOARD_NI_PCIDIO96 },
269278 { PCI_VDEVICE(NI, 0x1630), BOARD_NI_PCIDIO96B },
drivers/staging/iio/magnetometer/hmc5843.c+6−1
@@ -451,7 +451,12 @@ done: · 450 unmodified lines
451451 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) | \
452452 BIT(IIO_CHAN_INFO_SAMP_FREQ), \
453453 .scan_index = idx, \
454− .scan_type = IIO_ST('s', 16, 16, IIO_BE), \
454+ .scan_type = { \
455+ .sign = 's', \
456+ .realbits = 16, \
457+ .storagebits = 16, \
458+ .endianness = IIO_BE, \
459+ }, \
455460 }
456461
457462 static const struct iio_chan_spec hmc5843_channels[] = {
drivers/staging/imx-drm/imx-drm-core.c+29−10
@@ -88,8 +88,9 @@ static int imx_drm_driver_unload(struct drm_device *drm) · 87 unmodified lines
8888
8989 imx_drm_device_put();
9090
91− drm_mode_config_cleanup(imxdrm->drm);
91+ drm_vblank_cleanup(imxdrm->drm);
9292 drm_kms_helper_poll_fini(imxdrm->drm);
93+ drm_mode_config_cleanup(imxdrm->drm);
9394
9495 return 0;
9596 }
@@ -199,8 +200,8 @@ static void imx_drm_driver_preclose(struct drm_device *drm, · 103 unmodified lines
199200 if (!file->is_master)
200201 return;
201202
202− for (i = 0; i < 4; i++)
203− imx_drm_disable_vblank(drm , i);
203+ for (i = 0; i < MAX_CRTC; i++)
204+ imx_drm_disable_vblank(drm, i);
204205 }
205206
206207 static const struct file_operations imx_drm_driver_fops = {
@@ -376,8 +377,6 @@ static int imx_drm_crtc_register(struct imx_drm_crtc *imx_drm_crtc) · 169 unmodified lines
376377 struct imx_drm_device *imxdrm = __imx_drm_device();
377378 int ret;
378379
379− drm_crtc_init(imxdrm->drm, imx_drm_crtc->crtc,
380− imx_drm_crtc->imx_drm_helper_funcs.crtc_funcs);
381380 ret = drm_mode_crtc_set_gamma_size(imx_drm_crtc->crtc, 256);
382381 if (ret)
383382 return ret;
@@ -385,6 +384,9 @@ static int imx_drm_crtc_register(struct imx_drm_crtc *imx_drm_crtc) · 1 unmodified line
385384 drm_crtc_helper_add(imx_drm_crtc->crtc,
386385 imx_drm_crtc->imx_drm_helper_funcs.crtc_helper_funcs);
387386
387+ drm_crtc_init(imxdrm->drm, imx_drm_crtc->crtc,
388+ imx_drm_crtc->imx_drm_helper_funcs.crtc_funcs);
389+
388390 drm_mode_group_reinit(imxdrm->drm);
389391
390392 return 0;
@@ -428,11 +430,11 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags) · 37 unmodified lines
428430 ret = drm_mode_group_init_legacy_group(imxdrm->drm,
429431 &imxdrm->drm->primary->mode_group);
430432 if (ret)
431− goto err_init;
433+ goto err_kms;
432434
433435 ret = drm_vblank_init(imxdrm->drm, MAX_CRTC);
434436 if (ret)
435− goto err_init;
437+ goto err_kms;
436438
437439 /*
438440 * with vblank_disable_allowed = true, vblank interrupt will be disabled
@@ -441,12 +443,19 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags) · 2 unmodified lines
441443 */
442444 imxdrm->drm->vblank_disable_allowed = true;
443445
444− if (!imx_drm_device_get())
446+ if (!imx_drm_device_get()) {
445447 ret = -EINVAL;
448+ goto err_vblank;
449+ }
446450
447− ret = 0;
451+ mutex_unlock(&imxdrm->mutex);
452+ return 0;
448453
449−err_init:
454+err_vblank:
455+ drm_vblank_cleanup(drm);
456+err_kms:
457+ drm_kms_helper_poll_fini(drm);
458+ drm_mode_config_cleanup(drm);
450459 mutex_unlock(&imxdrm->mutex);
451460
452461 return ret;
@@ -492,6 +501,15 @@ int imx_drm_add_crtc(struct drm_crtc *crtc, · 39 unmodified lines
492501
493502 mutex_lock(&imxdrm->mutex);
494503
504+ /*
505+ * The vblank arrays are dimensioned by MAX_CRTC - we can't
506+ * pass IDs greater than this to those functions.
507+ */
508+ if (imxdrm->pipes >= MAX_CRTC) {
509+ ret = -EINVAL;
510+ goto err_busy;
511+ }
512+
495513 if (imxdrm->drm->open_count) {
496514 ret = -EBUSY;
497515 goto err_busy;
@@ -528,6 +546,7 @@ int imx_drm_add_crtc(struct drm_crtc *crtc, · 30 unmodified lines
528546 return 0;
529547
530548 err_register:
549+ list_del(&imx_drm_crtc->list);
531550 kfree(imx_drm_crtc);
532551 err_alloc:
533552 err_busy:
drivers/staging/imx-drm/imx-tve.c+0−9
@@ -114,7 +114,6 @@ struct imx_tve { · 113 unmodified lines
114114 struct drm_encoder encoder;
115115 struct imx_drm_encoder *imx_drm_encoder;
116116 struct device *dev;
117− spinlock_t enable_lock; /* serializes tve_enable/disable */
118117 spinlock_t lock; /* register lock */
119118 bool enabled;
120119 int mode;
@@ -146,10 +145,8 @@ __releases(&tve->lock) · 25 unmodified lines
146145
147146 static void tve_enable(struct imx_tve *tve)
148147 {
149− unsigned long flags;
150148 int ret;
151149
152− spin_lock_irqsave(&tve->enable_lock, flags);
153150 if (!tve->enabled) {
154151 tve->enabled = true;
155152 clk_prepare_enable(tve->clk);
@@ -169,23 +166,18 @@ static void tve_enable(struct imx_tve *tve) · 13 unmodified lines
169166 TVE_CD_SM_IEN |
170167 TVE_CD_LM_IEN |
171168 TVE_CD_MON_END_IEN);
172−
173− spin_unlock_irqrestore(&tve->enable_lock, flags);
174169 }
175170
176171 static void tve_disable(struct imx_tve *tve)
177172 {
178− unsigned long flags;
179173 int ret;
180174
181− spin_lock_irqsave(&tve->enable_lock, flags);
182175 if (tve->enabled) {
183176 tve->enabled = false;
184177 ret = regmap_update_bits(tve->regmap, TVE_COM_CONF_REG,
185178 TVE_IPU_CLK_EN | TVE_EN, 0);
186179 clk_disable_unprepare(tve->clk);
187180 }
188− spin_unlock_irqrestore(&tve->enable_lock, flags);
189181 }
190182
191183 static int tve_setup_tvout(struct imx_tve *tve)
@@ -601,7 +593,6 @@ static int imx_tve_probe(struct platform_device *pdev) · 409 unmodified lines
601593
602594 tve->dev = &pdev->dev;
603595 spin_lock_init(&tve->lock);
604− spin_lock_init(&tve->enable_lock);
605596
606597 ddc_node = of_parse_phandle(np, "ddc", 0);
607598 if (ddc_node) {
drivers/staging/imx-drm/ipu-v3/ipu-common.c+16−16
@@ -996,35 +996,35 @@ static const struct ipu_platform_reg client_reg[] = { · 995 unmodified lines
996996 },
997997 };
998998
999+static DEFINE_MUTEX(ipu_client_id_mutex);
9991000 static int ipu_client_id;
10001001
1001−static int ipu_add_subdevice_pdata(struct device *dev,
1002− const struct ipu_platform_reg *reg)
1003−{
1004− struct platform_device *pdev;
1005−
1006− pdev = platform_device_register_data(dev, reg->name, ipu_client_id++,
1007− &reg->pdata, sizeof(struct ipu_platform_reg));
1008−
1009− return PTR_ERR_OR_ZERO(pdev);
1010−}
1011−
10121002 static int ipu_add_client_devices(struct ipu_soc *ipu)
10131003 {
1014− int ret;
1015− int i;
1004+ struct device *dev = ipu->dev;
1005+ unsigned i;
1006+ int id, ret;
1007+
1008+ mutex_lock(&ipu_client_id_mutex);
1009+ id = ipu_client_id;
1010+ ipu_client_id += ARRAY_SIZE(client_reg);
1011+ mutex_unlock(&ipu_client_id_mutex);
10161012
10171013 for (i = 0; i < ARRAY_SIZE(client_reg); i++) {
10181014 const struct ipu_platform_reg *reg = &client_reg[i];
1019− ret = ipu_add_subdevice_pdata(ipu->dev, reg);
1020− if (ret)
1015+ struct platform_device *pdev;
1016+
1017+ pdev = platform_device_register_data(dev, reg->name,
1018+ id++, &reg->pdata, sizeof(reg->pdata));
1019+
1020+ if (IS_ERR(pdev))
10211021 goto err_register;
10221022 }
10231023
10241024 return 0;
10251025
10261026 err_register:
1027− platform_device_unregister_children(to_platform_device(ipu->dev));
1027+ platform_device_unregister_children(to_platform_device(dev));
10281028
10291029 return ret;
10301030 }
drivers/staging/netlogic/xlr_net.c+2−1
@@ -306,7 +306,8 @@ static netdev_tx_t xlr_net_start_xmit(struct sk_buff *skb, · 305 unmodified lines
306306 return NETDEV_TX_OK;
307307 }
308308
309−static u16 xlr_net_select_queue(struct net_device *ndev, struct sk_buff *skb)
309+static u16 xlr_net_select_queue(struct net_device *ndev, struct sk_buff *skb,
310+ void *accel_priv)
310311 {
311312 return (u16)smp_processor_id();
312313 }
drivers/staging/rtl8188eu/os_dep/os_intfs.c+2−1
@@ -652,7 +652,8 @@ static unsigned int rtw_classify8021d(struct sk_buff *skb) · 651 unmodified lines
652652 return dscp >> 5;
653653 }
654654
655−static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb)
655+static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb,
656+ void *accel_priv)
656657 {
657658 struct adapter *padapter = rtw_netdev_priv(dev);
658659 struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
drivers/target/iscsi/iscsi_target.c+13−14
@@ -465,6 +465,7 @@ int iscsit_del_np(struct iscsi_np *np) · 464 unmodified lines
465465 */
466466 send_sig(SIGINT, np->np_thread, 1);
467467 kthread_stop(np->np_thread);
468+ np->np_thread = NULL;
468469 }
469470
470471 np->np_transport->iscsit_free_np(np);
@@ -823,24 +824,22 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, · 352 unmodified lines
823824 if (((hdr->flags & ISCSI_FLAG_CMD_READ) ||
824825 (hdr->flags & ISCSI_FLAG_CMD_WRITE)) && !hdr->data_length) {
825826 /*
826− * Vmware ESX v3.0 uses a modified Cisco Initiator (v3.4.2)
827− * that adds support for RESERVE/RELEASE. There is a bug
828− * add with this new functionality that sets R/W bits when
829− * neither CDB carries any READ or WRITE datapayloads.
827+ * From RFC-3720 Section 10.3.1:
828+ *
829+ * "Either or both of R and W MAY be 1 when either the
830+ * Expected Data Transfer Length and/or Bidirectional Read
831+ * Expected Data Transfer Length are 0"
832+ *
833+ * For this case, go ahead and clear the unnecssary bits
834+ * to avoid any confusion with ->data_direction.
830835 */
831− if ((hdr->cdb[0] == 0x16) || (hdr->cdb[0] == 0x17)) {
832− hdr->flags &= ~ISCSI_FLAG_CMD_READ;
833− hdr->flags &= ~ISCSI_FLAG_CMD_WRITE;
834− goto done;
835− }
836+ hdr->flags &= ~ISCSI_FLAG_CMD_READ;
837+ hdr->flags &= ~ISCSI_FLAG_CMD_WRITE;
836838
837− pr_err("ISCSI_FLAG_CMD_READ or ISCSI_FLAG_CMD_WRITE"
839+ pr_warn("ISCSI_FLAG_CMD_READ or ISCSI_FLAG_CMD_WRITE"
838840 " set when Expected Data Transfer Length is 0 for"
839− " CDB: 0x%02x. Bad iSCSI Initiator.\n", hdr->cdb[0]);
840− return iscsit_add_reject_cmd(cmd,
841− ISCSI_REASON_BOOKMARK_INVALID, buf);
841+ " CDB: 0x%02x, Fixing up flags\n", hdr->cdb[0]);
842842 }
843−done:
844843
845844 if (!(hdr->flags & ISCSI_FLAG_CMD_READ) &&
846845 !(hdr->flags & ISCSI_FLAG_CMD_WRITE) && (hdr->data_length != 0)) {
drivers/target/iscsi/iscsi_target_configfs.c+2−1
@@ -474,7 +474,8 @@ static ssize_t __iscsi_##prefix##_store_##name( \ · 473 unmodified lines
474474 \
475475 if (!capable(CAP_SYS_ADMIN)) \
476476 return -EPERM; \
477− \
477+ if (count >= sizeof(auth->name)) \
478+ return -EINVAL; \
478479 snprintf(auth->name, sizeof(auth->name), "%s", page); \
479480 if (!strncmp("NULL", auth->name, 4)) \
480481 auth->naf_flags &= ~flags; \
drivers/target/iscsi/iscsi_target_login.c+0−6
@@ -1403,11 +1403,6 @@ old_sess_out: · 1402 unmodified lines
14031403
14041404 out:
14051405 stop = kthread_should_stop();
1406− if (!stop && signal_pending(current)) {
1407− spin_lock_bh(&np->np_thread_lock);
1408− stop = (np->np_thread_state == ISCSI_NP_THREAD_SHUTDOWN);
1409− spin_unlock_bh(&np->np_thread_lock);
1410− }
14111406 /* Wait for another socket.. */
14121407 if (!stop)
14131408 return 1;
@@ -1415,7 +1410,6 @@ exit: · 1 unmodified line
14151410 iscsi_stop_login_thread_timer(np);
14161411 spin_lock_bh(&np->np_thread_lock);
14171412 np->np_thread_state = ISCSI_NP_THREAD_EXIT;
1418− np->np_thread = NULL;
14191413 spin_unlock_bh(&np->np_thread_lock);
14201414
14211415 return 0;
drivers/target/target_core_device.c+5−0
@@ -1106,6 +1106,11 @@ int se_dev_set_block_size(struct se_device *dev, u32 block_size) · 1105 unmodified lines
11061106 dev->dev_attrib.block_size = block_size;
11071107 pr_debug("dev[%p]: SE Device block_size changed to %u\n",
11081108 dev, block_size);
1109+
1110+ if (dev->dev_attrib.max_bytes_per_io)
1111+ dev->dev_attrib.hw_max_sectors =
1112+ dev->dev_attrib.max_bytes_per_io / block_size;
1113+
11091114 return 0;
11101115 }
11111116
drivers/target/target_core_file.c+4−4
@@ -66,9 +66,8 @@ static int fd_attach_hba(struct se_hba *hba, u32 host_id) · 65 unmodified lines
6666 pr_debug("CORE_HBA[%d] - TCM FILEIO HBA Driver %s on Generic"
6767 " Target Core Stack %s\n", hba->hba_id, FD_VERSION,
6868 TARGET_CORE_MOD_VERSION);
69− pr_debug("CORE_HBA[%d] - Attached FILEIO HBA: %u to Generic"
70− " MaxSectors: %u\n",
71− hba->hba_id, fd_host->fd_host_id, FD_MAX_SECTORS);
69+ pr_debug("CORE_HBA[%d] - Attached FILEIO HBA: %u to Generic\n",
70+ hba->hba_id, fd_host->fd_host_id);
7271
7372 return 0;
7473 }
@@ -220,7 +219,8 @@ static int fd_configure_device(struct se_device *dev) · 145 unmodified lines
220219 }
221220
222221 dev->dev_attrib.hw_block_size = fd_dev->fd_block_size;
223− dev->dev_attrib.hw_max_sectors = FD_MAX_SECTORS;
222+ dev->dev_attrib.max_bytes_per_io = FD_MAX_BYTES;
223+ dev->dev_attrib.hw_max_sectors = FD_MAX_BYTES / fd_dev->fd_block_size;
224224 dev->dev_attrib.hw_queue_depth = FD_MAX_DEVICE_QUEUE_DEPTH;
225225
226226 if (fd_dev->fbd_flags & FDBD_HAS_BUFFERED_IO_WCE) {
drivers/target/target_core_file.h+4−1
@@ -7,7 +7,10 @@ · 6 unmodified lines
77 #define FD_DEVICE_QUEUE_DEPTH 32
88 #define FD_MAX_DEVICE_QUEUE_DEPTH 128
99 #define FD_BLOCKSIZE 512
10−#define FD_MAX_SECTORS 2048
10+/*
11+ * Limited by the number of iovecs (2048) per vfs_[writev,readv] call
12+ */
13+#define FD_MAX_BYTES 8388608
1114
1215 #define RRF_EMULATE_CDB 0x01
1316 #define RRF_GOT_LBA 0x02
drivers/target/target_core_tpg.c+1−9
@@ -278,7 +278,6 @@ struct se_node_acl *core_tpg_check_initiator_node_acl( · 277 unmodified lines
278278 snprintf(acl->initiatorname, TRANSPORT_IQN_LEN, "%s", initiatorname);
279279 acl->se_tpg = tpg;
280280 acl->acl_index = scsi_get_new_index(SCSI_AUTH_INTR_INDEX);
281− spin_lock_init(&acl->stats_lock);
282281 acl->dynamic_node_acl = 1;
283282
284283 tpg->se_tpg_tfo->set_default_node_attributes(acl);
@@ -406,7 +405,6 @@ struct se_node_acl *core_tpg_add_initiator_node_acl( · 121 unmodified lines
406405 snprintf(acl->initiatorname, TRANSPORT_IQN_LEN, "%s", initiatorname);
407406 acl->se_tpg = tpg;
408407 acl->acl_index = scsi_get_new_index(SCSI_AUTH_INTR_INDEX);
409− spin_lock_init(&acl->stats_lock);
410408
411409 tpg->se_tpg_tfo->set_default_node_attributes(acl);
412410
@@ -658,15 +656,9 @@ static int core_tpg_setup_virtual_lun0(struct se_portal_group *se_tpg) · 245 unmodified lines
658656 spin_lock_init(&lun->lun_sep_lock);
659657 init_completion(&lun->lun_ref_comp);
660658
661− ret = percpu_ref_init(&lun->lun_ref, core_tpg_lun_ref_release);
662− if (ret < 0)
663− return ret;
664−
665659 ret = core_tpg_post_addlun(se_tpg, lun, lun_access, dev);
666− if (ret < 0) {
667− percpu_ref_cancel_init(&lun->lun_ref);
660+ if (ret < 0)
668661 return ret;
669− }
670662
671663 return 0;
672664 }
drivers/tty/n_tty.c+6−1
@@ -93,6 +93,7 @@ struct n_tty_data { · 92 unmodified lines
9393 size_t canon_head;
9494 size_t echo_head;
9595 size_t echo_commit;
96+ size_t echo_mark;
9697 DECLARE_BITMAP(char_map, 256);
9798
9899 /* private to n_tty_receive_overrun (single-threaded) */
@@ -336,6 +337,7 @@ static void reset_buffer_flags(struct n_tty_data *ldata) · 237 unmodified lines
336337 {
337338 ldata->read_head = ldata->canon_head = ldata->read_tail = 0;
338339 ldata->echo_head = ldata->echo_tail = ldata->echo_commit = 0;
340+ ldata->echo_mark = 0;
339341 ldata->line_start = 0;
340342
341343 ldata->erasing = 0;
@@ -787,6 +789,7 @@ static void commit_echoes(struct tty_struct *tty) · 445 unmodified lines
787789 size_t head;
788790
789791 head = ldata->echo_head;
792+ ldata->echo_mark = head;
790793 old = ldata->echo_commit - ldata->echo_tail;
791794
792795 /* Process committed echoes if the accumulated # of bytes
@@ -811,10 +814,11 @@ static void process_echoes(struct tty_struct *tty) · 18 unmodified lines
811814 size_t echoed;
812815
813816 if ((!L_ECHO(tty) && !L_ECHONL(tty)) ||
814− ldata->echo_commit == ldata->echo_tail)
817+ ldata->echo_mark == ldata->echo_tail)
815818 return;
816819
817820 mutex_lock(&ldata->output_lock);
821+ ldata->echo_commit = ldata->echo_mark;
818822 echoed = __process_echoes(tty);
819823 mutex_unlock(&ldata->output_lock);
820824
@@ -822,6 +826,7 @@ static void process_echoes(struct tty_struct *tty) · 1 unmodified line
822826 tty->ops->flush_chars(tty);
823827 }
824828
829+/* NB: echo_mark and echo_head should be equivalent here */
825830 static void flush_echoes(struct tty_struct *tty)
826831 {
827832 struct n_tty_data *ldata = tty->disc_data;
drivers/tty/serial/8250/8250_dw.c+6−2
@@ -96,7 +96,8 @@ static void dw8250_serial_out(struct uart_port *p, int offset, int value) · 95 unmodified lines
9696 if (offset == UART_LCR) {
9797 int tries = 1000;
9898 while (tries--) {
99− if (value == p->serial_in(p, UART_LCR))
99+ unsigned int lcr = p->serial_in(p, UART_LCR);
100+ if ((value & ~UART_LCR_SPAR) == (lcr & ~UART_LCR_SPAR))
100101 return;
101102 dw8250_force_idle(p);
102103 writeb(value, p->membase + (UART_LCR << p->regshift));
@@ -132,7 +133,8 @@ static void dw8250_serial_out32(struct uart_port *p, int offset, int value) · 29 unmodified lines
132133 if (offset == UART_LCR) {
133134 int tries = 1000;
134135 while (tries--) {
135− if (value == p->serial_in(p, UART_LCR))
136+ unsigned int lcr = p->serial_in(p, UART_LCR);
137+ if ((value & ~UART_LCR_SPAR) == (lcr & ~UART_LCR_SPAR))
136138 return;
137139 dw8250_force_idle(p);
138140 writel(value, p->membase + (UART_LCR << p->regshift));
@@ -455,6 +457,8 @@ MODULE_DEVICE_TABLE(of, dw8250_of_match); · 316 unmodified lines
455457 static const struct acpi_device_id dw8250_acpi_match[] = {
456458 { "INT33C4", 0 },
457459 { "INT33C5", 0 },
460+ { "INT3434", 0 },
461+ { "INT3435", 0 },
458462 { "80860F0A", 0 },
459463 { },
460464 };
drivers/tty/serial/xilinx_uartps.c+2−0
@@ -240,6 +240,7 @@ static irqreturn_t xuartps_isr(int irq, void *dev_id) · 239 unmodified lines
240240 continue;
241241 }
242242
243+#ifdef SUPPORT_SYSRQ
243244 /*
244245 * uart_handle_sysrq_char() doesn't work if
245246 * spinlocked, for some reason
@@ -253,6 +254,7 @@ static irqreturn_t xuartps_isr(int irq, void *dev_id) · 7 unmodified lines
253254 }
254255 spin_lock(&port->lock);
255256 }
257+#endif
256258
257259 port->icount.rx++;
258260
drivers/tty/tty_ldsem.c+13−3
@@ -86,11 +86,21 @@ static inline long ldsem_atomic_update(long delta, struct ld_semaphore *sem) · 85 unmodified lines
8686 return atomic_long_add_return(delta, (atomic_long_t *)&sem->count);
8787 }
8888
89+/*
90+ * ldsem_cmpxchg() updates @*old with the last-known sem->count value.
91+ * Returns 1 if count was successfully changed; @*old will have @new value.
92+ * Returns 0 if count was not changed; @*old will have most recent sem->count
93+ */
8994 static inline int ldsem_cmpxchg(long *old, long new, struct ld_semaphore *sem)
9095 {
91− long tmp = *old;
92− *old = atomic_long_cmpxchg(&sem->count, *old, new);
93− return *old == tmp;
96+ long tmp = atomic_long_cmpxchg(&sem->count, *old, new);
97+ if (tmp == *old) {
98+ *old = new;
99+ return 1;
100+ } else {
101+ *old = tmp;
102+ return 0;
103+ }
94104 }
95105
96106 /*
drivers/usb/chipidea/core.c+4−0
@@ -642,6 +642,10 @@ static int ci_hdrc_probe(struct platform_device *pdev) · 641 unmodified lines
642642 : CI_ROLE_GADGET;
643643 }
644644
645+ /* only update vbus status for peripheral */
646+ if (ci->role == CI_ROLE_GADGET)
647+ ci_handle_vbus_change(ci);
648+
645649 ret = ci_role_start(ci, ci->role);
646650 if (ret) {
647651 dev_err(dev, "can't start %s role\n", ci_role(ci)->name);
drivers/usb/chipidea/host.c+2−1
@@ -88,7 +88,8 @@ static int host_start(struct ci_hdrc *ci) · 87 unmodified lines
8888 return ret;
8989
9090 disable_reg:
91− regulator_disable(ci->platdata->reg_vbus);
91+ if (ci->platdata->reg_vbus)
92+ regulator_disable(ci->platdata->reg_vbus);
9293
9394 put_hcd:
9495 usb_put_hcd(hcd);
drivers/usb/chipidea/udc.c+0−3
@@ -1795,9 +1795,6 @@ static int udc_start(struct ci_hdrc *ci) · 1794 unmodified lines
17951795 pm_runtime_no_callbacks(&ci->gadget.dev);
17961796 pm_runtime_enable(&ci->gadget.dev);
17971797
1798− /* Update ci->vbus_active */
1799− ci_handle_vbus_change(ci);
1800−
18011798 return retval;
18021799
18031800 destroy_eps:
drivers/usb/class/cdc-wdm.c+3−5
@@ -854,13 +854,11 @@ static int wdm_manage_power(struct usb_interface *intf, int on) · 853 unmodified lines
854854 {
855855 /* need autopm_get/put here to ensure the usbcore sees the new value */
856856 int rv = usb_autopm_get_interface(intf);
857− if (rv < 0)
858− goto err;
859857
860858 intf->needs_remote_wakeup = on;
861− usb_autopm_put_interface(intf);
862−err:
863− return rv;
859+ if (!rv)
860+ usb_autopm_put_interface(intf);
861+ return 0;
864862 }
865863
866864 static int wdm_probe(struct usb_interface *intf, const struct usb_device_id *id)
drivers/usb/dwc3/core.c+5−3
@@ -455,9 +455,6 @@ static int dwc3_probe(struct platform_device *pdev) · 454 unmodified lines
455455 if (IS_ERR(regs))
456456 return PTR_ERR(regs);
457457
458− usb_phy_set_suspend(dwc->usb2_phy, 0);
459− usb_phy_set_suspend(dwc->usb3_phy, 0);
460−
461458 spin_lock_init(&dwc->lock);
462459 platform_set_drvdata(pdev, dwc);
463460
@@ -488,6 +485,9 @@ static int dwc3_probe(struct platform_device *pdev) · 24 unmodified lines
488485 goto err0;
489486 }
490487
488+ usb_phy_set_suspend(dwc->usb2_phy, 0);
489+ usb_phy_set_suspend(dwc->usb3_phy, 0);
490+
491491 ret = dwc3_event_buffers_setup(dwc);
492492 if (ret) {
493493 dev_err(dwc->dev, "failed to setup event buffers\n");
@@ -569,6 +569,8 @@ err2: · 75 unmodified lines
569569 dwc3_event_buffers_cleanup(dwc);
570570
571571 err1:
572+ usb_phy_set_suspend(dwc->usb2_phy, 1);
573+ usb_phy_set_suspend(dwc->usb3_phy, 1);
572574 dwc3_core_exit(dwc);
573575
574576 err0:
drivers/usb/host/ohci-at91.c+15−11
@@ -136,23 +136,27 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, · 135 unmodified lines
136136 struct ohci_hcd *ohci;
137137 int retval;
138138 struct usb_hcd *hcd = NULL;
139−
140− if (pdev->num_resources != 2) {
141− pr_debug("hcd probe: invalid num_resources");
142− return -ENODEV;
139+ struct device *dev = &pdev->dev;
140+ struct resource *res;
141+ int irq;
142+
143+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
144+ if (!res) {
145+ dev_dbg(dev, "hcd probe: missing memory resource\n");
146+ return -ENXIO;
143147 }
144148
145− if ((pdev->resource[0].flags != IORESOURCE_MEM)
146− || (pdev->resource[1].flags != IORESOURCE_IRQ)) {
147− pr_debug("hcd probe: invalid resource type\n");
148− return -ENODEV;
149+ irq = platform_get_irq(pdev, 0);
150+ if (irq < 0) {
151+ dev_dbg(dev, "hcd probe: missing irq resource\n");
152+ return irq;
149153 }
150154
151155 hcd = usb_create_hcd(driver, &pdev->dev, "at91");
152156 if (!hcd)
153157 return -ENOMEM;
154− hcd->rsrc_start = pdev->resource[0].start;
155− hcd->rsrc_len = resource_size(&pdev->resource[0]);
158+ hcd->rsrc_start = res->start;
159+ hcd->rsrc_len = resource_size(res);
156160
157161 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
158162 pr_debug("request_mem_region failed\n");
@@ -199,7 +203,7 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, · 40 unmodified lines
199203 ohci->num_ports = board->ports;
200204 at91_start_hc(pdev);
201205
202− retval = usb_add_hcd(hcd, pdev->resource[1].start, IRQF_SHARED);
206+ retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
203207 if (retval == 0)
204208 return retval;
205209
drivers/usb/host/xhci-pci.c+6−1
@@ -128,7 +128,12 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) · 127 unmodified lines
128128 * any other sleep) on Haswell machines with LPT and LPT-LP
129129 * with the new Intel BIOS
130130 */
131− xhci->quirks |= XHCI_SPURIOUS_WAKEUP;
131+ /* Limit the quirk to only known vendors, as this triggers
132+ * yet another BIOS bug on some other machines
133+ * https://bugzilla.kernel.org/show_bug.cgi?id=66171
134+ */
135+ if (pdev->subsystem_vendor == PCI_VENDOR_ID_HP)
136+ xhci->quirks |= XHCI_SPURIOUS_WAKEUP;
132137 }
133138 if (pdev->vendor == PCI_VENDOR_ID_ETRON &&
134139 pdev->device == PCI_DEVICE_ID_ASROCK_P67) {
drivers/usb/phy/Kconfig+3−1
@@ -19,8 +19,9 @@ config AB8500_USB · 18 unmodified lines
1919 in host mode, low speed.
2020
2121 config FSL_USB2_OTG
22− bool "Freescale USB OTG Transceiver Driver"
22+ tristate "Freescale USB OTG Transceiver Driver"
2323 depends on USB_EHCI_FSL && USB_FSL_USB2 && PM_RUNTIME
24+ depends on USB
2425 select USB_OTG
2526 select USB_PHY
2627 help
@@ -29,6 +30,7 @@ config FSL_USB2_OTG · 2 unmodified lines
2930 config ISP1301_OMAP
3031 tristate "Philips ISP1301 with OMAP OTG"
3132 depends on I2C && ARCH_OMAP_OTG
33+ depends on USB
3234 select USB_PHY
3335 help
3436 If you say yes here you get support for the Philips ISP1301
drivers/usb/phy/phy-tegra-usb.c+1−1
@@ -876,7 +876,7 @@ static int utmi_phy_probe(struct tegra_usb_phy *tegra_phy, · 875 unmodified lines
876876
877877 tegra_phy->pad_regs = devm_ioremap(&pdev->dev, res->start,
878878 resource_size(res));
879− if (!tegra_phy->regs) {
879+ if (!tegra_phy->pad_regs) {
880880 dev_err(&pdev->dev, "Failed to remap UTMI Pad regs\n");
881881 return -ENOMEM;
882882 }
drivers/usb/phy/phy-twl6030-usb.c+2−1
@@ -127,7 +127,8 @@ static inline int twl6030_writeb(struct twl6030_usb *twl, u8 module, · 126 unmodified lines
127127
128128 static inline u8 twl6030_readb(struct twl6030_usb *twl, u8 module, u8 address)
129129 {
130− u8 data, ret = 0;
130+ u8 data;
131+ int ret;
131132
132133 ret = twl_i2c_read_u8(module, &data, address);
133134 if (ret >= 0)
drivers/usb/serial/option.c+2−0
@@ -251,6 +251,7 @@ static void option_instat_callback(struct urb *urb); · 250 unmodified lines
251251 #define ZTE_PRODUCT_MF628 0x0015
252252 #define ZTE_PRODUCT_MF626 0x0031
253253 #define ZTE_PRODUCT_MC2718 0xffe8
254+#define ZTE_PRODUCT_AC2726 0xfff1
254255
255256 #define BENQ_VENDOR_ID 0x04a5
256257 #define BENQ_PRODUCT_H10 0x4068
@@ -1453,6 +1454,7 @@ static const struct usb_device_id option_ids[] = { · 1196 unmodified lines
14531454 { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x01) },
14541455 { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x05) },
14551456 { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x86, 0x10) },
1457+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) },
14561458
14571459 { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) },
14581460 { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) },
drivers/usb/serial/zte_ev.c+1−2
@@ -281,8 +281,7 @@ static const struct usb_device_id id_table[] = { · 280 unmodified lines
281281 { USB_DEVICE(0x19d2, 0xfffd) },
282282 { USB_DEVICE(0x19d2, 0xfffc) },
283283 { USB_DEVICE(0x19d2, 0xfffb) },
284− /* AC2726, AC8710_V3 */
285− { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xfff1, 0xff, 0xff, 0xff) },
284+ /* AC8710_V3 */
286285 { USB_DEVICE(0x19d2, 0xfff6) },
287286 { USB_DEVICE(0x19d2, 0xfff7) },
288287 { USB_DEVICE(0x19d2, 0xfff8) },
drivers/virtio/virtio_balloon.c+1−1
@@ -285,7 +285,7 @@ static void update_balloon_size(struct virtio_balloon *vb) · 284 unmodified lines
285285 {
286286 __le32 actual = cpu_to_le32(vb->num_pages);
287287
288− virtio_cwrite(vb->vdev, struct virtio_balloon_config, num_pages,
288+ virtio_cwrite(vb->vdev, struct virtio_balloon_config, actual,
289289 &actual);
290290 }
291291
drivers/xen/balloon.c+34−29
@@ -350,17 +350,19 @@ static enum bp_state increase_reservation(unsigned long nr_pages) · 349 unmodified lines
350350
351351 pfn = page_to_pfn(page);
352352
353− set_phys_to_machine(pfn, frame_list[i]);
354−
355353 #ifdef CONFIG_XEN_HAVE_PVMMU
356− /* Link back into the page tables if not highmem. */
357− if (xen_pv_domain() && !PageHighMem(page)) {
358− int ret;
359− ret = HYPERVISOR_update_va_mapping(
360− (unsigned long)__va(pfn << PAGE_SHIFT),
361− mfn_pte(frame_list[i], PAGE_KERNEL),
362− 0);
363− BUG_ON(ret);
354+ if (!xen_feature(XENFEAT_auto_translated_physmap)) {
355+ set_phys_to_machine(pfn, frame_list[i]);
356+
357+ /* Link back into the page tables if not highmem. */
358+ if (!PageHighMem(page)) {
359+ int ret;
360+ ret = HYPERVISOR_update_va_mapping(
361+ (unsigned long)__va(pfn << PAGE_SHIFT),
362+ mfn_pte(frame_list[i], PAGE_KERNEL),
363+ 0);
364+ BUG_ON(ret);
365+ }
364366 }
365367 #endif
366368
@@ -378,7 +380,6 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) · 11 unmodified lines
378380 enum bp_state state = BP_DONE;
379381 unsigned long pfn, i;
380382 struct page *page;
381− struct page *scratch_page;
382383 int ret;
383384 struct xen_memory_reservation reservation = {
384385 .address_bits = 0,
@@ -411,27 +412,29 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) · 26 unmodified lines
411412
412413 scrub_page(page);
413414
415+#ifdef CONFIG_XEN_HAVE_PVMMU
414416 /*
415417 * Ballooned out frames are effectively replaced with
416418 * a scratch frame. Ensure direct mappings and the
417419 * p2m are consistent.
418420 */
419− scratch_page = get_balloon_scratch_page();
420−#ifdef CONFIG_XEN_HAVE_PVMMU
421− if (xen_pv_domain() && !PageHighMem(page)) {
422− ret = HYPERVISOR_update_va_mapping(
423− (unsigned long)__va(pfn << PAGE_SHIFT),
424− pfn_pte(page_to_pfn(scratch_page),
425− PAGE_KERNEL_RO), 0);
426− BUG_ON(ret);
427− }
428−#endif
429421 if (!xen_feature(XENFEAT_auto_translated_physmap)) {
430422 unsigned long p;
423+ struct page *scratch_page = get_balloon_scratch_page();
424+
425+ if (!PageHighMem(page)) {
426+ ret = HYPERVISOR_update_va_mapping(
427+ (unsigned long)__va(pfn << PAGE_SHIFT),
428+ pfn_pte(page_to_pfn(scratch_page),
429+ PAGE_KERNEL_RO), 0);
430+ BUG_ON(ret);
431+ }
431432 p = page_to_pfn(scratch_page);
432433 __set_phys_to_machine(pfn, pfn_to_mfn(p));
434+
435+ put_balloon_scratch_page();
433436 }
434− put_balloon_scratch_page();
437+#endif
435438
436439 balloon_append(pfn_to_page(pfn));
437440 }
@@ -627,15 +630,17 @@ static int __init balloon_init(void) · 189 unmodified lines
627630 if (!xen_domain())
628631 return -ENODEV;
629632
630− for_each_online_cpu(cpu)
631− {
632− per_cpu(balloon_scratch_page, cpu) = alloc_page(GFP_KERNEL);
633− if (per_cpu(balloon_scratch_page, cpu) == NULL) {
634− pr_warn("Failed to allocate balloon_scratch_page for cpu %d\n", cpu);
635− return -ENOMEM;
633+ if (!xen_feature(XENFEAT_auto_translated_physmap)) {
634+ for_each_online_cpu(cpu)
635+ {
636+ per_cpu(balloon_scratch_page, cpu) = alloc_page(GFP_KERNEL);
637+ if (per_cpu(balloon_scratch_page, cpu) == NULL) {
638+ pr_warn("Failed to allocate balloon_scratch_page for cpu %d\n", cpu);
639+ return -ENOMEM;
640+ }
636641 }
642+ register_cpu_notifier(&balloon_cpu_notifier);
637643 }
638− register_cpu_notifier(&balloon_cpu_notifier);
639644
640645 pr_info("Initialising balloon driver\n");
641646
drivers/xen/grant-table.c+2−1
@@ -1176,7 +1176,8 @@ static int gnttab_setup(void) · 1175 unmodified lines
11761176 gnttab_shared.addr = xen_remap(xen_hvm_resume_frames,
11771177 PAGE_SIZE * max_nr_gframes);
11781178 if (gnttab_shared.addr == NULL) {
1179− pr_warn("Failed to ioremap gnttab share frames!\n");
1179+ pr_warn("Failed to ioremap gnttab share frames (addr=0x%08lx)!\n",
1180+ xen_hvm_resume_frames);
11801181 return -ENOMEM;
11811182 }
11821183 }
drivers/xen/privcmd.c+7−2
@@ -533,12 +533,17 @@ static void privcmd_close(struct vm_area_struct *vma) · 532 unmodified lines
533533 {
534534 struct page **pages = vma->vm_private_data;
535535 int numpgs = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
536+ int rc;
536537
537538 if (!xen_feature(XENFEAT_auto_translated_physmap) || !numpgs || !pages)
538539 return;
539540
540− xen_unmap_domain_mfn_range(vma, numpgs, pages);
541− free_xenballooned_pages(numpgs, pages);
541+ rc = xen_unmap_domain_mfn_range(vma, numpgs, pages);
542+ if (rc == 0)
543+ free_xenballooned_pages(numpgs, pages);
544+ else
545+ pr_crit("unable to unmap MFN range: leaking %d pages. rc=%d\n",
546+ numpgs, rc);
542547 kfree(pages);
543548 }
544549
fs/aio.c+69−44
@@ -244,9 +244,14 @@ static void aio_free_ring(struct kioctx *ctx) · 243 unmodified lines
244244 int i;
245245
246246 for (i = 0; i < ctx->nr_pages; i++) {
247+ struct page *page;
247248 pr_debug("pid(%d) [%d] page->count=%d\n", current->pid, i,
248249 page_count(ctx->ring_pages[i]));
249− put_page(ctx->ring_pages[i]);
250+ page = ctx->ring_pages[i];
251+ if (!page)
252+ continue;
253+ ctx->ring_pages[i] = NULL;
254+ put_page(page);
250255 }
251256
252257 put_aio_ring_file(ctx);
@@ -280,18 +285,38 @@ static int aio_migratepage(struct address_space *mapping, struct page *new, · 27 unmodified lines
280285 unsigned long flags;
281286 int rc;
282287
288+ rc = 0;
289+
290+ /* Make sure the old page hasn't already been changed */
291+ spin_lock(&mapping->private_lock);
292+ ctx = mapping->private_data;
293+ if (ctx) {
294+ pgoff_t idx;
295+ spin_lock_irqsave(&ctx->completion_lock, flags);
296+ idx = old->index;
297+ if (idx < (pgoff_t)ctx->nr_pages) {
298+ if (ctx->ring_pages[idx] != old)
299+ rc = -EAGAIN;
300+ } else
301+ rc = -EINVAL;
302+ spin_unlock_irqrestore(&ctx->completion_lock, flags);
303+ } else
304+ rc = -EINVAL;
305+ spin_unlock(&mapping->private_lock);
306+
307+ if (rc != 0)
308+ return rc;
309+
283310 /* Writeback must be complete */
284311 BUG_ON(PageWriteback(old));
285− put_page(old);
312+ get_page(new);
286313
287− rc = migrate_page_move_mapping(mapping, new, old, NULL, mode);
314+ rc = migrate_page_move_mapping(mapping, new, old, NULL, mode, 1);
288315 if (rc != MIGRATEPAGE_SUCCESS) {
289− get_page(old);
316+ put_page(new);
290317 return rc;
291318 }
292319
293− get_page(new);
294−
295320 /* We can potentially race against kioctx teardown here. Use the
296321 * address_space's private data lock to protect the mapping's
297322 * private_data.
@@ -303,13 +328,24 @@ static int aio_migratepage(struct address_space *mapping, struct page *new, · 5 unmodified lines
303328 spin_lock_irqsave(&ctx->completion_lock, flags);
304329 migrate_page_copy(new, old);
305330 idx = old->index;
306− if (idx < (pgoff_t)ctx->nr_pages)
307− ctx->ring_pages[idx] = new;
331+ if (idx < (pgoff_t)ctx->nr_pages) {
332+ /* And only do the move if things haven't changed */
333+ if (ctx->ring_pages[idx] == old)
334+ ctx->ring_pages[idx] = new;
335+ else
336+ rc = -EAGAIN;
337+ } else
338+ rc = -EINVAL;
308339 spin_unlock_irqrestore(&ctx->completion_lock, flags);
309340 } else
310341 rc = -EBUSY;
311342 spin_unlock(&mapping->private_lock);
312343
344+ if (rc == MIGRATEPAGE_SUCCESS)
345+ put_page(old);
346+ else
347+ put_page(new);
348+
313349 return rc;
314350 }
315351 #endif
@@ -326,7 +362,7 @@ static int aio_setup_ring(struct kioctx *ctx) · 10 unmodified lines
326362 struct aio_ring *ring;
327363 unsigned nr_events = ctx->max_reqs;
328364 struct mm_struct *mm = current->mm;
329− unsigned long size, populate;
365+ unsigned long size, unused;
330366 int nr_pages;
331367 int i;
332368 struct file *file;
@@ -347,6 +383,20 @@ static int aio_setup_ring(struct kioctx *ctx) · 14 unmodified lines
347383 return -EAGAIN;
348384 }
349385
386+ ctx->aio_ring_file = file;
387+ nr_events = (PAGE_SIZE * nr_pages - sizeof(struct aio_ring))
388+ / sizeof(struct io_event);
389+
390+ ctx->ring_pages = ctx->internal_pages;
391+ if (nr_pages > AIO_RING_PAGES) {
392+ ctx->ring_pages = kcalloc(nr_pages, sizeof(struct page *),
393+ GFP_KERNEL);
394+ if (!ctx->ring_pages) {
395+ put_aio_ring_file(ctx);
396+ return -ENOMEM;
397+ }
398+ }
399+
350400 for (i = 0; i < nr_pages; i++) {
351401 struct page *page;
352402 page = find_or_create_page(file->f_inode->i_mapping,
@@ -358,19 +408,14 @@ static int aio_setup_ring(struct kioctx *ctx) · 5 unmodified lines
358408 SetPageUptodate(page);
359409 SetPageDirty(page);
360410 unlock_page(page);
411+
412+ ctx->ring_pages[i] = page;
361413 }
362− ctx->aio_ring_file = file;
363− nr_events = (PAGE_SIZE * nr_pages - sizeof(struct aio_ring))
364− / sizeof(struct io_event);
414+ ctx->nr_pages = i;
365415
366− ctx->ring_pages = ctx->internal_pages;
367− if (nr_pages > AIO_RING_PAGES) {
368− ctx->ring_pages = kcalloc(nr_pages, sizeof(struct page *),
369− GFP_KERNEL);
370− if (!ctx->ring_pages) {
371− put_aio_ring_file(ctx);
372− return -ENOMEM;
373− }
416+ if (unlikely(i != nr_pages)) {
417+ aio_free_ring(ctx);
418+ return -EAGAIN;
374419 }
375420
376421 ctx->mmap_size = nr_pages * PAGE_SIZE;
@@ -379,9 +424,9 @@ static int aio_setup_ring(struct kioctx *ctx) · 2 unmodified lines
379424 down_write(&mm->mmap_sem);
380425 ctx->mmap_base = do_mmap_pgoff(ctx->aio_ring_file, 0, ctx->mmap_size,
381426 PROT_READ | PROT_WRITE,
382− MAP_SHARED | MAP_POPULATE, 0, &populate);
427+ MAP_SHARED, 0, &unused);
428+ up_write(&mm->mmap_sem);
383429 if (IS_ERR((void *)ctx->mmap_base)) {
384− up_write(&mm->mmap_sem);
385430 ctx->mmap_size = 0;
386431 aio_free_ring(ctx);
387432 return -EAGAIN;
@@ -389,27 +434,6 @@ static int aio_setup_ring(struct kioctx *ctx) · 1 unmodified line
389434
390435 pr_debug("mmap address: 0x%08lx\n", ctx->mmap_base);
391436
392− /* We must do this while still holding mmap_sem for write, as we
393− * need to be protected against userspace attempting to mremap()
394− * or munmap() the ring buffer.
395− */
396− ctx->nr_pages = get_user_pages(current, mm, ctx->mmap_base, nr_pages,
397− 1, 0, ctx->ring_pages, NULL);
398−
399− /* Dropping the reference here is safe as the page cache will hold
400− * onto the pages for us. It is also required so that page migration
401− * can unmap the pages and get the right reference count.
402− */
403− for (i = 0; i < ctx->nr_pages; i++)
404− put_page(ctx->ring_pages[i]);
405−
406− up_write(&mm->mmap_sem);
407−
408− if (unlikely(ctx->nr_pages != nr_pages)) {
409− aio_free_ring(ctx);
410− return -EAGAIN;
411− }
412−
413437 ctx->user_id = ctx->mmap_base;
414438 ctx->nr_events = nr_events; /* trusted copy */
415439
@@ -652,7 +676,8 @@ static struct kioctx *ioctx_alloc(unsigned nr_events) · 236 unmodified lines
652676 aio_nr += ctx->max_reqs;
653677 spin_unlock(&aio_nr_lock);
654678
655− percpu_ref_get(&ctx->users); /* io_setup() will drop this ref */
679+ percpu_ref_get(&ctx->users); /* io_setup() will drop this ref */
680+ percpu_ref_get(&ctx->reqs); /* free_ioctx_users() will drop this */
656681
657682 err = ioctx_add_table(ctx, mm);
658683 if (err)
fs/ceph/addr.c+6−2
@@ -210,9 +210,13 @@ static int readpage_nounlock(struct file *filp, struct page *page) · 209 unmodified lines
210210 if (err < 0) {
211211 SetPageError(page);
212212 goto out;
213− } else if (err < PAGE_CACHE_SIZE) {
213+ } else {
214+ if (err < PAGE_CACHE_SIZE) {
214215 /* zero fill remainder of page */
215− zero_user_segment(page, err, PAGE_CACHE_SIZE);
216+ zero_user_segment(page, err, PAGE_CACHE_SIZE);
217+ } else {
218+ flush_dcache_page(page);
219+ }
216220 }
217221 SetPageUptodate(page);
218222
fs/ceph/inode.c+58−78
@@ -978,7 +978,6 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, · 977 unmodified lines
978978 struct ceph_mds_reply_inode *ininfo;
979979 struct ceph_vino vino;
980980 struct ceph_fs_client *fsc = ceph_sb_to_client(sb);
981− int i = 0;
982981 int err = 0;
983982
984983 dout("fill_trace %p is_dentry %d is_target %d\n", req,
@@ -1039,6 +1038,29 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, · 54 unmodified lines
10391038 }
10401039 }
10411040
1041+ if (rinfo->head->is_target) {
1042+ vino.ino = le64_to_cpu(rinfo->targeti.in->ino);
1043+ vino.snap = le64_to_cpu(rinfo->targeti.in->snapid);
1044+
1045+ in = ceph_get_inode(sb, vino);
1046+ if (IS_ERR(in)) {
1047+ err = PTR_ERR(in);
1048+ goto done;
1049+ }
1050+ req->r_target_inode = in;
1051+
1052+ err = fill_inode(in, &rinfo->targeti, NULL,
1053+ session, req->r_request_started,
1054+ (le32_to_cpu(rinfo->head->result) == 0) ?
1055+ req->r_fmode : -1,
1056+ &req->r_caps_reservation);
1057+ if (err < 0) {
1058+ pr_err("fill_inode badness %p %llx.%llx\n",
1059+ in, ceph_vinop(in));
1060+ goto done;
1061+ }
1062+ }
1063+
10421064 /*
10431065 * ignore null lease/binding on snapdir ENOENT, or else we
10441066 * will have trouble splicing in the virtual snapdir later
@@ -1108,7 +1130,6 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, · 63 unmodified lines
11081130 ceph_dentry(req->r_old_dentry)->offset);
11091131
11101132 dn = req->r_old_dentry; /* use old_dentry */
1111− in = dn->d_inode;
11121133 }
11131134
11141135 /* null dentry? */
@@ -1130,44 +1151,28 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, · 15 unmodified lines
11301151 }
11311152
11321153 /* attach proper inode */
1133− ininfo = rinfo->targeti.in;
1134− vino.ino = le64_to_cpu(ininfo->ino);
1135− vino.snap = le64_to_cpu(ininfo->snapid);
1136− in = dn->d_inode;
1137− if (!in) {
1138− in = ceph_get_inode(sb, vino);
1139− if (IS_ERR(in)) {
1140− pr_err("fill_trace bad get_inode "
1141− "%llx.%llx\n", vino.ino, vino.snap);
1142− err = PTR_ERR(in);
1143− d_drop(dn);
1144− goto done;
1145− }
1154+ if (!dn->d_inode) {
1155+ ihold(in);
11461156 dn = splice_dentry(dn, in, &have_lease, true);
11471157 if (IS_ERR(dn)) {
11481158 err = PTR_ERR(dn);
11491159 goto done;
11501160 }
11511161 req->r_dentry = dn; /* may have spliced */
1152− ihold(in);
1153− } else if (ceph_ino(in) == vino.ino &&
1154− ceph_snap(in) == vino.snap) {
1155− ihold(in);
1156− } else {
1162+ } else if (dn->d_inode && dn->d_inode != in) {
11571163 dout(" %p links to %p %llx.%llx, not %llx.%llx\n",
1158− dn, in, ceph_ino(in), ceph_snap(in),
1159− vino.ino, vino.snap);
1164+ dn, dn->d_inode, ceph_vinop(dn->d_inode),
1165+ ceph_vinop(in));
11601166 have_lease = false;
1161− in = NULL;
11621167 }
11631168
11641169 if (have_lease)
11651170 update_dentry_lease(dn, rinfo->dlease, session,
11661171 req->r_request_started);
11671172 dout(" final dn %p\n", dn);
1168− i++;
1169− } else if ((req->r_op == CEPH_MDS_OP_LOOKUPSNAP ||
1170− req->r_op == CEPH_MDS_OP_MKSNAP) && !req->r_aborted) {
1173+ } else if (!req->r_aborted &&
1174+ (req->r_op == CEPH_MDS_OP_LOOKUPSNAP ||
1175+ req->r_op == CEPH_MDS_OP_MKSNAP)) {
11711176 struct dentry *dn = req->r_dentry;
11721177
11731178 /* fill out a snapdir LOOKUPSNAP dentry */
@@ -1177,52 +1182,15 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, · 3 unmodified lines
11771182 ininfo = rinfo->targeti.in;
11781183 vino.ino = le64_to_cpu(ininfo->ino);
11791184 vino.snap = le64_to_cpu(ininfo->snapid);
1180− in = ceph_get_inode(sb, vino);
1181− if (IS_ERR(in)) {
1182− pr_err("fill_inode get_inode badness %llx.%llx\n",
1183− vino.ino, vino.snap);
1184− err = PTR_ERR(in);
1185− d_delete(dn);
1186− goto done;
1187− }
11881185 dout(" linking snapped dir %p to dn %p\n", in, dn);
1186+ ihold(in);
11891187 dn = splice_dentry(dn, in, NULL, true);
11901188 if (IS_ERR(dn)) {
11911189 err = PTR_ERR(dn);
11921190 goto done;
11931191 }
11941192 req->r_dentry = dn; /* may have spliced */
1195− ihold(in);
1196− rinfo->head->is_dentry = 1; /* fool notrace handlers */
1197− }
1198−
1199− if (rinfo->head->is_target) {
1200− vino.ino = le64_to_cpu(rinfo->targeti.in->ino);
1201− vino.snap = le64_to_cpu(rinfo->targeti.in->snapid);
1202−
1203− if (in == NULL || ceph_ino(in) != vino.ino ||
1204− ceph_snap(in) != vino.snap) {
1205− in = ceph_get_inode(sb, vino);
1206− if (IS_ERR(in)) {
1207− err = PTR_ERR(in);
1208− goto done;
1209− }
1210− }
1211− req->r_target_inode = in;
1212−
1213− err = fill_inode(in,
1214− &rinfo->targeti, NULL,
1215− session, req->r_request_started,
1216− (le32_to_cpu(rinfo->head->result) == 0) ?
1217− req->r_fmode : -1,
1218− &req->r_caps_reservation);
1219− if (err < 0) {
1220− pr_err("fill_inode badness %p %llx.%llx\n",
1221− in, ceph_vinop(in));
1222− goto done;
1223− }
12241193 }
1225−
12261194 done:
12271195 dout("fill_trace done err=%d\n", err);
12281196 return err;
@@ -1272,7 +1240,7 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req, · 43 unmodified lines
12721240 struct qstr dname;
12731241 struct dentry *dn;
12741242 struct inode *in;
1275− int err = 0, i;
1243+ int err = 0, ret, i;
12761244 struct inode *snapdir = NULL;
12771245 struct ceph_mds_request_head *rhead = req->r_request->front.iov_base;
12781246 struct ceph_dentry_info *di;
@@ -1305,6 +1273,7 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req, · 26 unmodified lines
13051273 ceph_fill_dirfrag(parent->d_inode, rinfo->dir_dir);
13061274 }
13071275
1276+ /* FIXME: release caps/leases if error occurs */
13081277 for (i = 0; i < rinfo->dir_nr; i++) {
13091278 struct ceph_vino vino;
13101279
@@ -1329,9 +1298,10 @@ retry_lookup: · 18 unmodified lines
13291298 err = -ENOMEM;
13301299 goto out;
13311300 }
1332− err = ceph_init_dentry(dn);
1333− if (err < 0) {
1301+ ret = ceph_init_dentry(dn);
1302+ if (ret < 0) {
13341303 dput(dn);
1304+ err = ret;
13351305 goto out;
13361306 }
13371307 } else if (dn->d_inode &&
@@ -1351,9 +1321,6 @@ retry_lookup: · 13 unmodified lines
13511321 spin_unlock(&parent->d_lock);
13521322 }
13531323
1354− di = dn->d_fsdata;
1355− di->offset = ceph_make_fpos(frag, i + r_readdir_offset);
1356−
13571324 /* inode */
13581325 if (dn->d_inode) {
13591326 in = dn->d_inode;
@@ -1366,26 +1333,39 @@ retry_lookup: · 6 unmodified lines
13661333 err = PTR_ERR(in);
13671334 goto out;
13681335 }
1369− dn = splice_dentry(dn, in, NULL, false);
1370− if (IS_ERR(dn))
1371− dn = NULL;
13721336 }
13731337
13741338 if (fill_inode(in, &rinfo->dir_in[i], NULL, session,
13751339 req->r_request_started, -1,
13761340 &req->r_caps_reservation) < 0) {
13771341 pr_err("fill_inode badness on %p\n", in);
1342+ if (!dn->d_inode)
1343+ iput(in);
1344+ d_drop(dn);
13781345 goto next_item;
13791346 }
1380− if (dn)
1381− update_dentry_lease(dn, rinfo->dir_dlease[i],
1382− req->r_session,
1383− req->r_request_started);
1347+
1348+ if (!dn->d_inode) {
1349+ dn = splice_dentry(dn, in, NULL, false);
1350+ if (IS_ERR(dn)) {
1351+ err = PTR_ERR(dn);
1352+ dn = NULL;
1353+ goto next_item;
1354+ }
1355+ }
1356+
1357+ di = dn->d_fsdata;
1358+ di->offset = ceph_make_fpos(frag, i + r_readdir_offset);
1359+
1360+ update_dentry_lease(dn, rinfo->dir_dlease[i],
1361+ req->r_session,
1362+ req->r_request_started);
13841363 next_item:
13851364 if (dn)
13861365 dput(dn);
13871366 }
1388− req->r_did_prepopulate = true;
1367+ if (err == 0)
1368+ req->r_did_prepopulate = true;
13891369
13901370 out:
13911371 if (snapdir) {
fs/cifs/cifsproto.h+4−3
@@ -477,9 +477,10 @@ extern int CIFSGetExtAttr(const unsigned int xid, struct cifs_tcon *tcon, · 476 unmodified lines
477477 const int netfid, __u64 *pExtAttrBits, __u64 *pMask);
478478 extern void cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb);
479479 extern bool CIFSCouldBeMFSymlink(const struct cifs_fattr *fattr);
480−extern int CIFSCheckMFSymlink(struct cifs_fattr *fattr,
481− const unsigned char *path,
482− struct cifs_sb_info *cifs_sb, unsigned int xid);
480+extern int CIFSCheckMFSymlink(unsigned int xid, struct cifs_tcon *tcon,
481+ struct cifs_sb_info *cifs_sb,
482+ struct cifs_fattr *fattr,
483+ const unsigned char *path);
483484 extern int mdfour(unsigned char *, unsigned char *, int);
484485 extern int E_md4hash(const unsigned char *passwd, unsigned char *p16,
485486 const struct nls_table *codepage);
fs/cifs/cifssmb.c+3−3
@@ -4010,7 +4010,7 @@ QFileInfoRetry: · 4009 unmodified lines
40104010 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
40114011 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
40124012 if (rc) {
4013− cifs_dbg(FYI, "Send error in QPathInfo = %d\n", rc);
4013+ cifs_dbg(FYI, "Send error in QFileInfo = %d", rc);
40144014 } else { /* decode response */
40154015 rc = validate_t2((struct smb_t2_rsp *)pSMBr);
40164016
@@ -4179,7 +4179,7 @@ UnixQFileInfoRetry: · 162 unmodified lines
41794179 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
41804180 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
41814181 if (rc) {
4182− cifs_dbg(FYI, "Send error in QPathInfo = %d\n", rc);
4182+ cifs_dbg(FYI, "Send error in UnixQFileInfo = %d", rc);
41834183 } else { /* decode response */
41844184 rc = validate_t2((struct smb_t2_rsp *)pSMBr);
41854185
@@ -4263,7 +4263,7 @@ UnixQPathInfoRetry: · 77 unmodified lines
42634263 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
42644264 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
42654265 if (rc) {
4266− cifs_dbg(FYI, "Send error in QPathInfo = %d\n", rc);
4266+ cifs_dbg(FYI, "Send error in UnixQPathInfo = %d", rc);
42674267 } else { /* decode response */
42684268 rc = validate_t2((struct smb_t2_rsp *)pSMBr);
42694269
fs/cifs/dir.c+6−5
@@ -193,7 +193,7 @@ check_name(struct dentry *direntry) · 192 unmodified lines
193193 static int
194194 cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid,
195195 struct tcon_link *tlink, unsigned oflags, umode_t mode,
196− __u32 *oplock, struct cifs_fid *fid, int *created)
196+ __u32 *oplock, struct cifs_fid *fid)
197197 {
198198 int rc = -ENOENT;
199199 int create_options = CREATE_NOT_DIR;
@@ -349,7 +349,6 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid, · 149 unmodified lines
349349 .device = 0,
350350 };
351351
352− *created |= FILE_CREATED;
353352 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
354353 args.uid = current_fsuid();
355354 if (inode->i_mode & S_ISGID)
@@ -480,13 +479,16 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry, · 124 unmodified lines
480479 cifs_add_pending_open(&fid, tlink, &open);
481480
482481 rc = cifs_do_create(inode, direntry, xid, tlink, oflags, mode,
483− &oplock, &fid, opened);
482+ &oplock, &fid);
484483
485484 if (rc) {
486485 cifs_del_pending_open(&open);
487486 goto out;
488487 }
489488
489+ if ((oflags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
490+ *opened |= FILE_CREATED;
491+
490492 rc = finish_open(file, direntry, generic_file_open, opened);
491493 if (rc) {
492494 if (server->ops->close)
@@ -529,7 +531,6 @@ int cifs_create(struct inode *inode, struct dentry *direntry, umode_t mode, · 36 unmodified lines
529531 struct TCP_Server_Info *server;
530532 struct cifs_fid fid;
531533 __u32 oplock;
532− int created = FILE_CREATED;
533534
534535 cifs_dbg(FYI, "cifs_create parent inode = 0x%p name is: %s and dentry = 0x%p\n",
535536 inode, direntry->d_name.name, direntry);
@@ -546,7 +547,7 @@ int cifs_create(struct inode *inode, struct dentry *direntry, umode_t mode, · 10 unmodified lines
546547 server->ops->new_lease_key(&fid);
547548
548549 rc = cifs_do_create(inode, direntry, xid, tlink, oflags, mode,
549− &oplock, &fid, &created);
550+ &oplock, &fid);
550551 if (!rc && server->ops->close)
551552 server->ops->close(xid, tcon, &fid);
552553
fs/cifs/inode.c+4−2
@@ -383,7 +383,8 @@ int cifs_get_inode_info_unix(struct inode **pinode, · 382 unmodified lines
383383
384384 /* check for Minshall+French symlinks */
385385 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MF_SYMLINKS) {
386− int tmprc = CIFSCheckMFSymlink(&fattr, full_path, cifs_sb, xid);
386+ int tmprc = CIFSCheckMFSymlink(xid, tcon, cifs_sb, &fattr,
387+ full_path);
387388 if (tmprc)
388389 cifs_dbg(FYI, "CIFSCheckMFSymlink: %d\n", tmprc);
389390 }
@@ -799,7 +800,8 @@ cifs_get_inode_info(struct inode **inode, const char *full_path, · 409 unmodified lines
799800
800801 /* check for Minshall+French symlinks */
801802 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MF_SYMLINKS) {
802− tmprc = CIFSCheckMFSymlink(&fattr, full_path, cifs_sb, xid);
803+ tmprc = CIFSCheckMFSymlink(xid, tcon, cifs_sb, &fattr,
804+ full_path);
803805 if (tmprc)
804806 cifs_dbg(FYI, "CIFSCheckMFSymlink: %d\n", tmprc);
805807 }
fs/cifs/link.c+11−15
@@ -354,34 +354,30 @@ open_query_close_cifs_symlink(const unsigned char *path, char *pbuf, · 353 unmodified lines
354354
355355
356356 int
357−CIFSCheckMFSymlink(struct cifs_fattr *fattr,
358− const unsigned char *path,
359− struct cifs_sb_info *cifs_sb, unsigned int xid)
357+CIFSCheckMFSymlink(unsigned int xid, struct cifs_tcon *tcon,
358+ struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
359+ const unsigned char *path)
360360 {
361− int rc = 0;
361+ int rc;
362362 u8 *buf = NULL;
363363 unsigned int link_len = 0;
364364 unsigned int bytes_read = 0;
365− struct cifs_tcon *ptcon;
366365
367366 if (!CIFSCouldBeMFSymlink(fattr))
368367 /* it's not a symlink */
369368 return 0;
370369
371370 buf = kmalloc(CIFS_MF_SYMLINK_FILE_SIZE, GFP_KERNEL);
372− if (!buf) {
373− rc = -ENOMEM;
374− goto out;
375− }
371+ if (!buf)
372+ return -ENOMEM;
376373
377− ptcon = tlink_tcon(cifs_sb_tlink(cifs_sb));
378− if ((ptcon->ses) && (ptcon->ses->server->ops->query_mf_symlink))
379− rc = ptcon->ses->server->ops->query_mf_symlink(path, buf,
380− &bytes_read, cifs_sb, xid);
374+ if (tcon->ses->server->ops->query_mf_symlink)
375+ rc = tcon->ses->server->ops->query_mf_symlink(path, buf,
376+ &bytes_read, cifs_sb, xid);
381377 else
382− goto out;
378+ rc = -ENOSYS;
383379
384− if (rc != 0)
380+ if (rc)
385381 goto out;
386382
387383 if (bytes_read == 0) /* not a symlink */
fs/eventpoll.c+0−4
@@ -1907,10 +1907,6 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd, · 1906 unmodified lines
19071907 }
19081908 }
19091909 }
1910− if (op == EPOLL_CTL_DEL && is_file_epoll(tf.file)) {
1911− tep = tf.file->private_data;
1912− mutex_lock_nested(&tep->mtx, 1);
1913− }
19141910
19151911 /*
19161912 * Try to lookup the file inside our RB tree, Since we grabbed "mtx"
fs/ext2/super.c+1−0
@@ -1493,6 +1493,7 @@ static ssize_t ext2_quota_write(struct super_block *sb, int type, · 1492 unmodified lines
14931493 sb->s_blocksize - offset : towrite;
14941494
14951495 tmp_bh.b_state = 0;
1496+ tmp_bh.b_size = sb->s_blocksize;
14961497 err = ext2_get_block(inode, blk, &tmp_bh, 1);
14971498 if (err < 0)
14981499 goto out;
fs/ext4/ext4.h+10−0
@@ -268,6 +268,16 @@ struct ext4_io_submit { · 267 unmodified lines
268268 /* Translate # of blks to # of clusters */
269269 #define EXT4_NUM_B2C(sbi, blks) (((blks) + (sbi)->s_cluster_ratio - 1) >> \
270270 (sbi)->s_cluster_bits)
271+/* Mask out the low bits to get the starting block of the cluster */
272+#define EXT4_PBLK_CMASK(s, pblk) ((pblk) & \
273+ ~((ext4_fsblk_t) (s)->s_cluster_ratio - 1))
274+#define EXT4_LBLK_CMASK(s, lblk) ((lblk) & \
275+ ~((ext4_lblk_t) (s)->s_cluster_ratio - 1))
276+/* Get the cluster offset */
277+#define EXT4_PBLK_COFF(s, pblk) ((pblk) & \
278+ ((ext4_fsblk_t) (s)->s_cluster_ratio - 1))
279+#define EXT4_LBLK_COFF(s, lblk) ((lblk) & \
280+ ((ext4_lblk_t) (s)->s_cluster_ratio - 1))
271281
272282 /*
273283 * Structure of a blocks group descriptor
fs/ext4/ext4_jbd2.c+9−0
@@ -259,6 +259,15 @@ int __ext4_handle_dirty_metadata(const char *where, unsigned int line, · 258 unmodified lines
259259 if (WARN_ON_ONCE(err)) {
260260 ext4_journal_abort_handle(where, line, __func__, bh,
261261 handle, err);
262+ ext4_error_inode(inode, where, line,
263+ bh->b_blocknr,
264+ "journal_dirty_metadata failed: "
265+ "handle type %u started at line %u, "
266+ "credits %u/%u, errcode %d",
267+ handle->h_type,
268+ handle->h_line_no,
269+ handle->h_requested_credits,
270+ handle->h_buffer_credits, err);
262271 }
263272 } else {
264273 if (inode)
fs/ext4/extents.c+30−15
@@ -360,8 +360,10 @@ static int ext4_valid_extent(struct inode *inode, struct ext4_extent *ext) · 359 unmodified lines
360360 {
361361 ext4_fsblk_t block = ext4_ext_pblock(ext);
362362 int len = ext4_ext_get_actual_len(ext);
363+ ext4_lblk_t lblock = le32_to_cpu(ext->ee_block);
364+ ext4_lblk_t last = lblock + len - 1;
363365
364− if (len == 0)
366+ if (lblock > last)
365367 return 0;
366368 return ext4_data_block_valid(EXT4_SB(inode->i_sb), block, len);
367369 }
@@ -387,11 +389,26 @@ static int ext4_valid_extent_entries(struct inode *inode, · 19 unmodified lines
387389 if (depth == 0) {
388390 /* leaf entries */
389391 struct ext4_extent *ext = EXT_FIRST_EXTENT(eh);
392+ struct ext4_super_block *es = EXT4_SB(inode->i_sb)->s_es;
393+ ext4_fsblk_t pblock = 0;
394+ ext4_lblk_t lblock = 0;
395+ ext4_lblk_t prev = 0;
396+ int len = 0;
390397 while (entries) {
391398 if (!ext4_valid_extent(inode, ext))
392399 return 0;
400+
401+ /* Check for overlapping extents */
402+ lblock = le32_to_cpu(ext->ee_block);
403+ len = ext4_ext_get_actual_len(ext);
404+ if ((lblock <= prev) && prev) {
405+ pblock = ext4_ext_pblock(ext);
406+ es->s_last_error_block = cpu_to_le64(pblock);
407+ return 0;
408+ }
393409 ext++;
394410 entries--;
411+ prev = lblock + len - 1;
395412 }
396413 } else {
397414 struct ext4_extent_idx *ext_idx = EXT_FIRST_INDEX(eh);
@@ -1834,8 +1851,7 @@ static unsigned int ext4_ext_check_overlap(struct ext4_sb_info *sbi, · 1436 unmodified lines
18341851 depth = ext_depth(inode);
18351852 if (!path[depth].p_ext)
18361853 goto out;
1837− b2 = le32_to_cpu(path[depth].p_ext->ee_block);
1838− b2 &= ~(sbi->s_cluster_ratio - 1);
1854+ b2 = EXT4_LBLK_CMASK(sbi, le32_to_cpu(path[depth].p_ext->ee_block));
18391855
18401856 /*
18411857 * get the next allocated block if the extent in the path
@@ -1845,7 +1861,7 @@ static unsigned int ext4_ext_check_overlap(struct ext4_sb_info *sbi, · 3 unmodified lines
18451861 b2 = ext4_ext_next_allocated_block(path);
18461862 if (b2 == EXT_MAX_BLOCKS)
18471863 goto out;
1848− b2 &= ~(sbi->s_cluster_ratio - 1);
1864+ b2 = EXT4_LBLK_CMASK(sbi, b2);
18491865 }
18501866
18511867 /* check for wrap through zero on extent logical start block*/
@@ -2504,7 +2520,7 @@ static int ext4_remove_blocks(handle_t *handle, struct inode *inode, · 652 unmodified lines
25042520 * extent, we have to mark the cluster as used (store negative
25052521 * cluster number in partial_cluster).
25062522 */
2507− unaligned = pblk & (sbi->s_cluster_ratio - 1);
2523+ unaligned = EXT4_PBLK_COFF(sbi, pblk);
25082524 if (unaligned && (ee_len == num) &&
25092525 (*partial_cluster != -((long long)EXT4_B2C(sbi, pblk))))
25102526 *partial_cluster = EXT4_B2C(sbi, pblk);
@@ -2598,7 +2614,7 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode, · 87 unmodified lines
25982614 * accidentally freeing it later on
25992615 */
26002616 pblk = ext4_ext_pblock(ex);
2601− if (pblk & (sbi->s_cluster_ratio - 1))
2617+ if (EXT4_PBLK_COFF(sbi, pblk))
26022618 *partial_cluster =
26032619 -((long long)EXT4_B2C(sbi, pblk));
26042620 ex--;
@@ -3753,7 +3769,7 @@ int ext4_find_delalloc_cluster(struct inode *inode, ext4_lblk_t lblk) · 1148 unmodified lines
37533769 {
37543770 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
37553771 ext4_lblk_t lblk_start, lblk_end;
3756− lblk_start = lblk & (~(sbi->s_cluster_ratio - 1));
3772+ lblk_start = EXT4_LBLK_CMASK(sbi, lblk);
37573773 lblk_end = lblk_start + sbi->s_cluster_ratio - 1;
37583774
37593775 return ext4_find_delalloc_range(inode, lblk_start, lblk_end);
@@ -3812,9 +3828,9 @@ get_reserved_cluster_alloc(struct inode *inode, ext4_lblk_t lblk_start, · 52 unmodified lines
38123828 trace_ext4_get_reserved_cluster_alloc(inode, lblk_start, num_blks);
38133829
38143830 /* Check towards left side */
3815− c_offset = lblk_start & (sbi->s_cluster_ratio - 1);
3831+ c_offset = EXT4_LBLK_COFF(sbi, lblk_start);
38163832 if (c_offset) {
3817− lblk_from = lblk_start & (~(sbi->s_cluster_ratio - 1));
3833+ lblk_from = EXT4_LBLK_CMASK(sbi, lblk_start);
38183834 lblk_to = lblk_from + c_offset - 1;
38193835
38203836 if (ext4_find_delalloc_range(inode, lblk_from, lblk_to))
@@ -3822,7 +3838,7 @@ get_reserved_cluster_alloc(struct inode *inode, ext4_lblk_t lblk_start, · 1 unmodified line
38223838 }
38233839
38243840 /* Now check towards right. */
3825− c_offset = (lblk_start + num_blks) & (sbi->s_cluster_ratio - 1);
3841+ c_offset = EXT4_LBLK_COFF(sbi, lblk_start + num_blks);
38263842 if (allocated_clusters && c_offset) {
38273843 lblk_from = lblk_start + num_blks;
38283844 lblk_to = lblk_from + (sbi->s_cluster_ratio - c_offset) - 1;
@@ -4030,7 +4046,7 @@ static int get_implied_cluster_alloc(struct super_block *sb, · 201 unmodified lines
40304046 struct ext4_ext_path *path)
40314047 {
40324048 struct ext4_sb_info *sbi = EXT4_SB(sb);
4033− ext4_lblk_t c_offset = map->m_lblk & (sbi->s_cluster_ratio-1);
4049+ ext4_lblk_t c_offset = EXT4_LBLK_COFF(sbi, map->m_lblk);
40344050 ext4_lblk_t ex_cluster_start, ex_cluster_end;
40354051 ext4_lblk_t rr_cluster_start;
40364052 ext4_lblk_t ee_block = le32_to_cpu(ex->ee_block);
@@ -4048,8 +4064,7 @@ static int get_implied_cluster_alloc(struct super_block *sb, · 11 unmodified lines
40484064 (rr_cluster_start == ex_cluster_start)) {
40494065 if (rr_cluster_start == ex_cluster_end)
40504066 ee_start += ee_len - 1;
4051− map->m_pblk = (ee_start & ~(sbi->s_cluster_ratio - 1)) +
4052− c_offset;
4067+ map->m_pblk = EXT4_PBLK_CMASK(sbi, ee_start) + c_offset;
40534068 map->m_len = min(map->m_len,
40544069 (unsigned) sbi->s_cluster_ratio - c_offset);
40554070 /*
@@ -4203,7 +4218,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode, · 147 unmodified lines
42034218 */
42044219 map->m_flags &= ~EXT4_MAP_FROM_CLUSTER;
42054220 newex.ee_block = cpu_to_le32(map->m_lblk);
4206− cluster_offset = map->m_lblk & (sbi->s_cluster_ratio-1);
4221+ cluster_offset = EXT4_LBLK_COFF(sbi, map->m_lblk);
42074222
42084223 /*
42094224 * If we are doing bigalloc, check to see if the extent returned
@@ -4271,7 +4286,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode, · 61 unmodified lines
42714286 * needed so that future calls to get_implied_cluster_alloc()
42724287 * work correctly.
42734288 */
4274− offset = map->m_lblk & (sbi->s_cluster_ratio - 1);
4289+ offset = EXT4_LBLK_COFF(sbi, map->m_lblk);
42754290 ar.len = EXT4_NUM_B2C(sbi, offset+allocated);
42764291 ar.goal -= offset;
42774292 ar.logical -= offset;
fs/ext4/inode.c+0−12
@@ -1206,7 +1206,6 @@ static int ext4_journalled_write_end(struct file *file, · 1205 unmodified lines
12061206 */
12071207 static int ext4_da_reserve_metadata(struct inode *inode, ext4_lblk_t lblock)
12081208 {
1209− int retries = 0;
12101209 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
12111210 struct ext4_inode_info *ei = EXT4_I(inode);
12121211 unsigned int md_needed;
@@ -1218,7 +1217,6 @@ static int ext4_da_reserve_metadata(struct inode *inode, ext4_lblk_t lblock) · 5 unmodified lines
12181217 * in order to allocate nrblocks
12191218 * worse case is one extent per block
12201219 */
1221−repeat:
12221220 spin_lock(&ei->i_block_reservation_lock);
12231221 /*
12241222 * ext4_calc_metadata_amount() has side effects, which we have
@@ -1238,10 +1236,6 @@ repeat: · 13 unmodified lines
12381236 ei->i_da_metadata_calc_len = save_len;
12391237 ei->i_da_metadata_calc_last_lblock = save_last_lblock;
12401238 spin_unlock(&ei->i_block_reservation_lock);
1241− if (ext4_should_retry_alloc(inode->i_sb, &retries)) {
1242− cond_resched();
1243− goto repeat;
1244− }
12451239 return -ENOSPC;
12461240 }
12471241 ei->i_reserved_meta_blocks += md_needed;
@@ -1255,7 +1249,6 @@ repeat: · 7 unmodified lines
12551249 */
12561250 static int ext4_da_reserve_space(struct inode *inode, ext4_lblk_t lblock)
12571251 {
1258− int retries = 0;
12591252 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
12601253 struct ext4_inode_info *ei = EXT4_I(inode);
12611254 unsigned int md_needed;
@@ -1277,7 +1270,6 @@ static int ext4_da_reserve_space(struct inode *inode, ext4_lblk_t lblock) · 15 unmodified lines
12771270 * in order to allocate nrblocks
12781271 * worse case is one extent per block
12791272 */
1280−repeat:
12811273 spin_lock(&ei->i_block_reservation_lock);
12821274 /*
12831275 * ext4_calc_metadata_amount() has side effects, which we have
@@ -1297,10 +1289,6 @@ repeat: · 13 unmodified lines
12971289 ei->i_da_metadata_calc_len = save_len;
12981290 ei->i_da_metadata_calc_last_lblock = save_last_lblock;
12991291 spin_unlock(&ei->i_block_reservation_lock);
1300− if (ext4_should_retry_alloc(inode->i_sb, &retries)) {
1301− cond_resched();
1302− goto repeat;
1303− }
13041292 dquot_release_reservation_block(inode, EXT4_C2B(sbi, 1));
13051293 return -ENOSPC;
13061294 }
fs/ext4/mballoc.c+11−6
@@ -3442,6 +3442,9 @@ static void ext4_mb_pa_callback(struct rcu_head *head) · 3441 unmodified lines
34423442 {
34433443 struct ext4_prealloc_space *pa;
34443444 pa = container_of(head, struct ext4_prealloc_space, u.pa_rcu);
3445+
3446+ BUG_ON(atomic_read(&pa->pa_count));
3447+ BUG_ON(pa->pa_deleted == 0);
34453448 kmem_cache_free(ext4_pspace_cachep, pa);
34463449 }
34473450
@@ -3455,11 +3458,13 @@ static void ext4_mb_put_pa(struct ext4_allocation_context *ac, · 7 unmodified lines
34553458 ext4_group_t grp;
34563459 ext4_fsblk_t grp_blk;
34573460
3458− if (!atomic_dec_and_test(&pa->pa_count) || pa->pa_free != 0)
3459− return;
3460−
34613461 /* in this short window concurrent discard can set pa_deleted */
34623462 spin_lock(&pa->pa_lock);
3463+ if (!atomic_dec_and_test(&pa->pa_count) || pa->pa_free != 0) {
3464+ spin_unlock(&pa->pa_lock);
3465+ return;
3466+ }
3467+
34633468 if (pa->pa_deleted == 1) {
34643469 spin_unlock(&pa->pa_lock);
34653470 return;
@@ -4121,7 +4126,7 @@ ext4_mb_initialize_context(struct ext4_allocation_context *ac, · 655 unmodified lines
41214126 ext4_get_group_no_and_offset(sb, goal, &group, &block);
41224127
41234128 /* set up allocation goals */
4124− ac->ac_b_ex.fe_logical = ar->logical & ~(sbi->s_cluster_ratio - 1);
4129+ ac->ac_b_ex.fe_logical = EXT4_LBLK_CMASK(sbi, ar->logical);
41254130 ac->ac_status = AC_STATUS_CONTINUE;
41264131 ac->ac_sb = sb;
41274132 ac->ac_inode = ar->inode;
@@ -4663,7 +4668,7 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode, · 535 unmodified lines
46634668 * blocks at the beginning or the end unless we are explicitly
46644669 * requested to avoid doing so.
46654670 */
4666− overflow = block & (sbi->s_cluster_ratio - 1);
4671+ overflow = EXT4_PBLK_COFF(sbi, block);
46674672 if (overflow) {
46684673 if (flags & EXT4_FREE_BLOCKS_NOFREE_FIRST_CLUSTER) {
46694674 overflow = sbi->s_cluster_ratio - overflow;
@@ -4677,7 +4682,7 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode, · 7 unmodified lines
46774682 count += overflow;
46784683 }
46794684 }
4680− overflow = count & (sbi->s_cluster_ratio - 1);
4685+ overflow = EXT4_LBLK_COFF(sbi, count);
46814686 if (overflow) {
46824687 if (flags & EXT4_FREE_BLOCKS_NOFREE_LAST_CLUSTER) {
46834688 if (count > overflow)
fs/ext4/super.c+15−6
@@ -792,7 +792,7 @@ static void ext4_put_super(struct super_block *sb) · 791 unmodified lines
792792 }
793793
794794 ext4_es_unregister_shrinker(sbi);
795− del_timer(&sbi->s_err_report);
795+ del_timer_sync(&sbi->s_err_report);
796796 ext4_release_system_zone(sb);
797797 ext4_mb_release(sb);
798798 ext4_ext_release(sb);
@@ -3316,10 +3316,18 @@ int ext4_calculate_overhead(struct super_block *sb) · 2517 unmodified lines
33163316 }
33173317
33183318
3319−static ext4_fsblk_t ext4_calculate_resv_clusters(struct ext4_sb_info *sbi)
3319+static ext4_fsblk_t ext4_calculate_resv_clusters(struct super_block *sb)
33203320 {
33213321 ext4_fsblk_t resv_clusters;
33223322
3323+ /*
3324+ * There's no need to reserve anything when we aren't using extents.
3325+ * The space estimates are exact, there are no unwritten extents,
3326+ * hole punching doesn't need new metadata... This is needed especially
3327+ * to keep ext2/3 backward compatibility.
3328+ */
3329+ if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS))
3330+ return 0;
33233331 /*
33243332 * By default we reserve 2% or 4096 clusters, whichever is smaller.
33253333 * This should cover the situations where we can not afford to run
@@ -3328,7 +3336,8 @@ static ext4_fsblk_t ext4_calculate_resv_clusters(struct ext4_sb_info *sbi) · 2 unmodified lines
33283336 * allocation would require 1, or 2 blocks, higher numbers are
33293337 * very rare.
33303338 */
3331− resv_clusters = ext4_blocks_count(sbi->s_es) >> sbi->s_cluster_bits;
3339+ resv_clusters = ext4_blocks_count(EXT4_SB(sb)->s_es) >>
3340+ EXT4_SB(sb)->s_cluster_bits;
33323341
33333342 do_div(resv_clusters, 50);
33343343 resv_clusters = min_t(ext4_fsblk_t, resv_clusters, 4096);
@@ -4071,10 +4080,10 @@ no_journal: · 736 unmodified lines
40714080 "available");
40724081 }
40734082
4074− err = ext4_reserve_clusters(sbi, ext4_calculate_resv_clusters(sbi));
4083+ err = ext4_reserve_clusters(sbi, ext4_calculate_resv_clusters(sb));
40754084 if (err) {
40764085 ext4_msg(sb, KERN_ERR, "failed to reserve %llu clusters for "
4077− "reserved pool", ext4_calculate_resv_clusters(sbi));
4086+ "reserved pool", ext4_calculate_resv_clusters(sb));
40784087 goto failed_mount4a;
40794088 }
40804089
@@ -4184,7 +4193,7 @@ failed_mount_wq: · 103 unmodified lines
41844193 }
41854194 failed_mount3:
41864195 ext4_es_unregister_shrinker(sbi);
4187− del_timer(&sbi->s_err_report);
4196+ del_timer_sync(&sbi->s_err_report);
41884197 if (sbi->s_flex_groups)
41894198 ext4_kvfree(sbi->s_flex_groups);
41904199 percpu_counter_destroy(&sbi->s_freeclusters_counter);
fs/fs-writeback.c+9−6
@@ -516,13 +516,16 @@ writeback_single_inode(struct inode *inode, struct bdi_writeback *wb, · 515 unmodified lines
516516 }
517517 WARN_ON(inode->i_state & I_SYNC);
518518 /*
519− * Skip inode if it is clean. We don't want to mess with writeback
520− * lists in this function since flusher thread may be doing for example
521− * sync in parallel and if we move the inode, it could get skipped. So
522− * here we make sure inode is on some writeback list and leave it there
523− * unless we have completely cleaned the inode.
519+ * Skip inode if it is clean and we have no outstanding writeback in
520+ * WB_SYNC_ALL mode. We don't want to mess with writeback lists in this
521+ * function since flusher thread may be doing for example sync in
522+ * parallel and if we move the inode, it could get skipped. So here we
523+ * make sure inode is on some writeback list and leave it there unless
524+ * we have completely cleaned the inode.
524525 */
525− if (!(inode->i_state & I_DIRTY))
526+ if (!(inode->i_state & I_DIRTY) &&
527+ (wbc->sync_mode != WB_SYNC_ALL ||
528+ !mapping_tagged(inode->i_mapping, PAGECACHE_TAG_WRITEBACK)))
526529 goto out;
527530 inode->i_state |= I_SYNC;
528531 spin_unlock(&inode->i_lock);
fs/gfs2/aops.c+30−0
@@ -986,6 +986,7 @@ static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb, · 985 unmodified lines
986986 {
987987 struct file *file = iocb->ki_filp;
988988 struct inode *inode = file->f_mapping->host;
989+ struct address_space *mapping = inode->i_mapping;
989990 struct gfs2_inode *ip = GFS2_I(inode);
990991 struct gfs2_holder gh;
991992 int rv;
@@ -1006,6 +1007,35 @@ static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb, · 14 unmodified lines
10061007 if (rv != 1)
10071008 goto out; /* dio not valid, fall back to buffered i/o */
10081009
1010+ /*
1011+ * Now since we are holding a deferred (CW) lock at this point, you
1012+ * might be wondering why this is ever needed. There is a case however
1013+ * where we've granted a deferred local lock against a cached exclusive
1014+ * glock. That is ok provided all granted local locks are deferred, but
1015+ * it also means that it is possible to encounter pages which are
1016+ * cached and possibly also mapped. So here we check for that and sort
1017+ * them out ahead of the dio. The glock state machine will take care of
1018+ * everything else.
1019+ *
1020+ * If in fact the cached glock state (gl->gl_state) is deferred (CW) in
1021+ * the first place, mapping->nr_pages will always be zero.
1022+ */
1023+ if (mapping->nrpages) {
1024+ loff_t lstart = offset & (PAGE_CACHE_SIZE - 1);
1025+ loff_t len = iov_length(iov, nr_segs);
1026+ loff_t end = PAGE_ALIGN(offset + len) - 1;
1027+
1028+ rv = 0;
1029+ if (len == 0)
1030+ goto out;
1031+ if (test_and_clear_bit(GIF_SW_PAGED, &ip->i_flags))
1032+ unmap_shared_mapping_range(ip->i_inode.i_mapping, offset, len);
1033+ rv = filemap_write_and_wait_range(mapping, lstart, end);
1034+ if (rv)
1035+ return rv;
1036+ truncate_inode_pages_range(mapping, lstart, end);
1037+ }
1038+
10091039 rv = __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
10101040 offset, nr_segs, gfs2_get_block_direct,
10111041 NULL, NULL, 0);
fs/gfs2/glock.c+2−0
@@ -1655,6 +1655,7 @@ static int dump_holder(struct seq_file *seq, const struct gfs2_holder *gh) · 1654 unmodified lines
16551655 struct task_struct *gh_owner = NULL;
16561656 char flags_buf[32];
16571657
1658+ rcu_read_lock();
16581659 if (gh->gh_owner_pid)
16591660 gh_owner = pid_task(gh->gh_owner_pid, PIDTYPE_PID);
16601661 gfs2_print_dbg(seq, " H: s:%s f:%s e:%d p:%ld [%s] %pS\n",
@@ -1664,6 +1665,7 @@ static int dump_holder(struct seq_file *seq, const struct gfs2_holder *gh) · 3 unmodified lines
16641665 gh->gh_owner_pid ? (long)pid_nr(gh->gh_owner_pid) : -1,
16651666 gh_owner ? gh_owner->comm : "(ended)",
16661667 (void *)gh->gh_ip);
1668+ rcu_read_unlock();
16671669 return 0;
16681670 }
16691671
fs/gfs2/glops.c+8−2
@@ -192,8 +192,11 @@ static void inode_go_sync(struct gfs2_glock *gl) · 191 unmodified lines
192192
193193 if (ip && !S_ISREG(ip->i_inode.i_mode))
194194 ip = NULL;
195− if (ip && test_and_clear_bit(GIF_SW_PAGED, &ip->i_flags))
196− unmap_shared_mapping_range(ip->i_inode.i_mapping, 0, 0);
195+ if (ip) {
196+ if (test_and_clear_bit(GIF_SW_PAGED, &ip->i_flags))
197+ unmap_shared_mapping_range(ip->i_inode.i_mapping, 0, 0);
198+ inode_dio_wait(&ip->i_inode);
199+ }
197200 if (!test_and_clear_bit(GLF_DIRTY, &gl->gl_flags))
198201 return;
199202
@@ -410,6 +413,9 @@ static int inode_go_lock(struct gfs2_holder *gh) · 210 unmodified lines
410413 return error;
411414 }
412415
416+ if (gh->gh_state != LM_ST_DEFERRED)
417+ inode_dio_wait(&ip->i_inode);
418+
413419 if ((ip->i_diskflags & GFS2_DIF_TRUNC_IN_PROG) &&
414420 (gl->gl_state == LM_ST_EXCLUSIVE) &&
415421 (gh->gh_state == LM_ST_EXCLUSIVE)) {
fs/gfs2/log.c+2−2
@@ -551,10 +551,10 @@ void gfs2_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd) · 550 unmodified lines
551551 struct buffer_head *bh = bd->bd_bh;
552552 struct gfs2_glock *gl = bd->bd_gl;
553553
554− gfs2_remove_from_ail(bd);
555− bd->bd_bh = NULL;
556554 bh->b_private = NULL;
557555 bd->bd_blkno = bh->b_blocknr;
556+ gfs2_remove_from_ail(bd); /* drops ref on bh */
557+ bd->bd_bh = NULL;
558558 bd->bd_ops = &gfs2_revoke_lops;
559559 sdp->sd_log_num_revoke++;
560560 atomic_inc(&gl->gl_revokes);
fs/gfs2/meta_io.c+5−0
@@ -258,6 +258,7 @@ void gfs2_remove_from_journal(struct buffer_head *bh, struct gfs2_trans *tr, int · 257 unmodified lines
258258 struct address_space *mapping = bh->b_page->mapping;
259259 struct gfs2_sbd *sdp = gfs2_mapping2sbd(mapping);
260260 struct gfs2_bufdata *bd = bh->b_private;
261+ int was_pinned = 0;
261262
262263 if (test_clear_buffer_pinned(bh)) {
263264 trace_gfs2_pin(bd, 0);
@@ -273,12 +274,16 @@ void gfs2_remove_from_journal(struct buffer_head *bh, struct gfs2_trans *tr, int · 9 unmodified lines
273274 tr->tr_num_databuf_rm++;
274275 }
275276 tr->tr_touched = 1;
277+ was_pinned = 1;
276278 brelse(bh);
277279 }
278280 if (bd) {
279281 spin_lock(&sdp->sd_ail_lock);
280282 if (bd->bd_tr) {
281283 gfs2_trans_add_revoke(sdp, bd);
284+ } else if (was_pinned) {
285+ bh->b_private = NULL;
286+ kmem_cache_free(gfs2_bufdata_cachep, bd);
282287 }
283288 spin_unlock(&sdp->sd_ail_lock);
284289 }
fs/gfs2/ops_fstype.c+11−1
@@ -1366,8 +1366,18 @@ static struct dentry *gfs2_mount(struct file_system_type *fs_type, int flags, · 1365 unmodified lines
13661366 if (IS_ERR(s))
13671367 goto error_bdev;
13681368
1369− if (s->s_root)
1369+ if (s->s_root) {
1370+ /*
1371+ * s_umount nests inside bd_mutex during
1372+ * __invalidate_device(). blkdev_put() acquires
1373+ * bd_mutex and can't be called under s_umount. Drop
1374+ * s_umount temporarily. This is safe as we're
1375+ * holding an active reference.
1376+ */
1377+ up_write(&s->s_umount);
13701378 blkdev_put(bdev, mode);
1379+ down_write(&s->s_umount);
1380+ }
13711381
13721382 memset(&args, 0, sizeof(args));
13731383 args.ar_quota = GFS2_QUOTA_DEFAULT;
fs/jbd2/journal.c+8−10
@@ -702,7 +702,7 @@ int jbd2_log_wait_commit(journal_t *journal, tid_t tid) · 701 unmodified lines
702702 read_lock(&journal->j_state_lock);
703703 #ifdef CONFIG_JBD2_DEBUG
704704 if (!tid_geq(journal->j_commit_request, tid)) {
705− printk(KERN_EMERG
705+ printk(KERN_ERR
706706 "%s: error: j_commit_request=%d, tid=%d\n",
707707 __func__, journal->j_commit_request, tid);
708708 }
@@ -718,10 +718,8 @@ int jbd2_log_wait_commit(journal_t *journal, tid_t tid) · 9 unmodified lines
718718 }
719719 read_unlock(&journal->j_state_lock);
720720
721− if (unlikely(is_journal_aborted(journal))) {
722− printk(KERN_EMERG "journal commit I/O error\n");
721+ if (unlikely(is_journal_aborted(journal)))
723722 err = -EIO;
724− }
725723 return err;
726724 }
727725
@@ -1527,13 +1525,13 @@ static int journal_get_superblock(journal_t *journal) · 799 unmodified lines
15271525 if (JBD2_HAS_COMPAT_FEATURE(journal, JBD2_FEATURE_COMPAT_CHECKSUM) &&
15281526 JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) {
15291527 /* Can't have checksum v1 and v2 on at the same time! */
1530− printk(KERN_ERR "JBD: Can't enable checksumming v1 and v2 "
1528+ printk(KERN_ERR "JBD2: Can't enable checksumming v1 and v2 "
15311529 "at the same time!\n");
15321530 goto out;
15331531 }
15341532
15351533 if (!jbd2_verify_csum_type(journal, sb)) {
1536− printk(KERN_ERR "JBD: Unknown checksum type\n");
1534+ printk(KERN_ERR "JBD2: Unknown checksum type\n");
15371535 goto out;
15381536 }
15391537
@@ -1541,7 +1539,7 @@ static int journal_get_superblock(journal_t *journal) · 1 unmodified line
15411539 if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_CSUM_V2)) {
15421540 journal->j_chksum_driver = crypto_alloc_shash("crc32c", 0, 0);
15431541 if (IS_ERR(journal->j_chksum_driver)) {
1544− printk(KERN_ERR "JBD: Cannot load crc32c driver.\n");
1542+ printk(KERN_ERR "JBD2: Cannot load crc32c driver.\n");
15451543 err = PTR_ERR(journal->j_chksum_driver);
15461544 journal->j_chksum_driver = NULL;
15471545 goto out;
@@ -1550,7 +1548,7 @@ static int journal_get_superblock(journal_t *journal) · 2 unmodified lines
15501548
15511549 /* Check superblock checksum */
15521550 if (!jbd2_superblock_csum_verify(journal, sb)) {
1553− printk(KERN_ERR "JBD: journal checksum error\n");
1551+ printk(KERN_ERR "JBD2: journal checksum error\n");
15541552 goto out;
15551553 }
15561554
@@ -1836,7 +1834,7 @@ int jbd2_journal_set_features (journal_t *journal, unsigned long compat, · 279 unmodified lines
18361834 journal->j_chksum_driver = crypto_alloc_shash("crc32c",
18371835 0, 0);
18381836 if (IS_ERR(journal->j_chksum_driver)) {
1839− printk(KERN_ERR "JBD: Cannot load crc32c "
1837+ printk(KERN_ERR "JBD2: Cannot load crc32c "
18401838 "driver.\n");
18411839 journal->j_chksum_driver = NULL;
18421840 return 0;
@@ -2645,7 +2643,7 @@ static void __exit journal_exit(void) · 802 unmodified lines
26452643 #ifdef CONFIG_JBD2_DEBUG
26462644 int n = atomic_read(&nr_journal_heads);
26472645 if (n)
2648− printk(KERN_EMERG "JBD2: leaked %d journal_heads!\n", n);
2646+ printk(KERN_ERR "JBD2: leaked %d journal_heads!\n", n);
26492647 #endif
26502648 jbd2_remove_jbd_stats_proc_entry();
26512649 jbd2_journal_destroy_caches();
fs/jbd2/recovery.c+1−1
@@ -594,7 +594,7 @@ static int do_one_pass(journal_t *journal, · 593 unmodified lines
594594 be32_to_cpu(tmp->h_sequence))) {
595595 brelse(obh);
596596 success = -EIO;
597− printk(KERN_ERR "JBD: Invalid "
597+ printk(KERN_ERR "JBD2: Invalid "
598598 "checksum recovering "
599599 "block %llu in log\n",
600600 blocknr);
fs/jbd2/transaction.c+9−7
@@ -932,7 +932,7 @@ repeat: · 931 unmodified lines
932932 jbd2_alloc(jh2bh(jh)->b_size,
933933 GFP_NOFS);
934934 if (!frozen_buffer) {
935− printk(KERN_EMERG
935+ printk(KERN_ERR
936936 "%s: OOM for frozen_buffer\n",
937937 __func__);
938938 JBUFFER_TRACE(jh, "oom!");
@@ -1166,7 +1166,7 @@ repeat: · 227 unmodified lines
11661166 if (!jh->b_committed_data) {
11671167 committed_data = jbd2_alloc(jh2bh(jh)->b_size, GFP_NOFS);
11681168 if (!committed_data) {
1169− printk(KERN_EMERG "%s: No memory for committed data\n",
1169+ printk(KERN_ERR "%s: No memory for committed data\n",
11701170 __func__);
11711171 err = -ENOMEM;
11721172 goto out;
@@ -1290,7 +1290,10 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) · 117 unmodified lines
12901290 * once a transaction -bzzz
12911291 */
12921292 jh->b_modified = 1;
1293− J_ASSERT_JH(jh, handle->h_buffer_credits > 0);
1293+ if (handle->h_buffer_credits <= 0) {
1294+ ret = -ENOSPC;
1295+ goto out_unlock_bh;
1296+ }
12941297 handle->h_buffer_credits--;
12951298 }
12961299
@@ -1305,7 +1308,7 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) · 8 unmodified lines
13051308 JBUFFER_TRACE(jh, "fastpath");
13061309 if (unlikely(jh->b_transaction !=
13071310 journal->j_running_transaction)) {
1308− printk(KERN_EMERG "JBD: %s: "
1311+ printk(KERN_ERR "JBD2: %s: "
13091312 "jh->b_transaction (%llu, %p, %u) != "
13101313 "journal->j_running_transaction (%p, %u)",
13111314 journal->j_devname,
@@ -1332,7 +1335,7 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) · 20 unmodified lines
13321335 JBUFFER_TRACE(jh, "already on other transaction");
13331336 if (unlikely(jh->b_transaction !=
13341337 journal->j_committing_transaction)) {
1335− printk(KERN_EMERG "JBD: %s: "
1338+ printk(KERN_ERR "JBD2: %s: "
13361339 "jh->b_transaction (%llu, %p, %u) != "
13371340 "journal->j_committing_transaction (%p, %u)",
13381341 journal->j_devname,
@@ -1345,7 +1348,7 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) · 6 unmodified lines
13451348 ret = -EINVAL;
13461349 }
13471350 if (unlikely(jh->b_next_transaction != transaction)) {
1348− printk(KERN_EMERG "JBD: %s: "
1351+ printk(KERN_ERR "JBD2: %s: "
13491352 "jh->b_next_transaction (%llu, %p, %u) != "
13501353 "transaction (%p, %u)",
13511354 journal->j_devname,
@@ -1373,7 +1376,6 @@ out_unlock_bh: · 21 unmodified lines
13731376 jbd2_journal_put_journal_head(jh);
13741377 out:
13751378 JBUFFER_TRACE(jh, "exit");
1376− WARN_ON(ret); /* All errors are bugs, so dump the stack */
13771379 return ret;
13781380 }
13791381
fs/nilfs2/segment.c+6−4
@@ -1440,17 +1440,19 @@ static int nilfs_segctor_collect(struct nilfs_sc_info *sci, · 1439 unmodified lines
14401440
14411441 nilfs_clear_logs(&sci->sc_segbufs);
14421442
1443− err = nilfs_segctor_extend_segments(sci, nilfs, nadd);
1444− if (unlikely(err))
1445− return err;
1446−
14471443 if (sci->sc_stage.flags & NILFS_CF_SUFREED) {
14481444 err = nilfs_sufile_cancel_freev(nilfs->ns_sufile,
14491445 sci->sc_freesegs,
14501446 sci->sc_nfreesegs,
14511447 NULL);
14521448 WARN_ON(err); /* do not happen */
1449+ sci->sc_stage.flags &= ~NILFS_CF_SUFREED;
14531450 }
1451+
1452+ err = nilfs_segctor_extend_segments(sci, nilfs, nadd);
1453+ if (unlikely(err))
1454+ return err;
1455+
14541456 nadd = min_t(int, nadd << 1, SC_MAX_SEGDELTA);
14551457 sci->sc_stage = prev_stage;
14561458 }
fs/pstore/platform.c+5−2
@@ -443,8 +443,11 @@ int pstore_register(struct pstore_info *psi) · 442 unmodified lines
443443 pstore_get_records(0);
444444
445445 kmsg_dump_register(&pstore_dumper);
446− pstore_register_console();
447− pstore_register_ftrace();
446+
447+ if ((psi->flags & PSTORE_FLAGS_FRAGILE) == 0) {
448+ pstore_register_console();
449+ pstore_register_ftrace();
450+ }
448451
449452 if (pstore_update_ms >= 0) {
450453 pstore_timer.expires = jiffies +
fs/sysfs/file.c+3−5
@@ -609,7 +609,7 @@ static int sysfs_open_file(struct inode *inode, struct file *file) · 608 unmodified lines
609609 struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata;
610610 struct kobject *kobj = attr_sd->s_parent->s_dir.kobj;
611611 struct sysfs_open_file *of;
612− bool has_read, has_write, has_mmap;
612+ bool has_read, has_write;
613613 int error = -EACCES;
614614
615615 /* need attr_sd for attr and ops, its parent for kobj */
@@ -621,7 +621,6 @@ static int sysfs_open_file(struct inode *inode, struct file *file) · 5 unmodified lines
621621
622622 has_read = battr->read || battr->mmap;
623623 has_write = battr->write || battr->mmap;
624− has_mmap = battr->mmap;
625624 } else {
626625 const struct sysfs_ops *ops = sysfs_file_ops(attr_sd);
627626
@@ -633,7 +632,6 @@ static int sysfs_open_file(struct inode *inode, struct file *file) · 5 unmodified lines
633632
634633 has_read = ops->show;
635634 has_write = ops->store;
636− has_mmap = false;
637635 }
638636
639637 /* check perms and supported operations */
@@ -661,9 +659,9 @@ static int sysfs_open_file(struct inode *inode, struct file *file) · 21 unmodified lines
661659 * open file has a separate mutex, it's okay as long as those don't
662660 * happen on the same file. At this point, we can't easily give
663661 * each file a separate locking class. Let's differentiate on
664− * whether the file has mmap or not for now.
662+ * whether the file is bin or not for now.
665663 */
666− if (has_mmap)
664+ if (sysfs_is_bin(attr_sd))
667665 mutex_init(&of->mutex);
668666 else
669667 mutex_init(&of->mutex);
fs/xfs/xfs_attr_remote.c+1−1
@@ -110,7 +110,7 @@ xfs_attr3_rmt_verify( · 109 unmodified lines
110110 if (be32_to_cpu(rmt->rm_bytes) > fsbsize - sizeof(*rmt))
111111 return false;
112112 if (be32_to_cpu(rmt->rm_offset) +
113− be32_to_cpu(rmt->rm_bytes) >= XATTR_SIZE_MAX)
113+ be32_to_cpu(rmt->rm_bytes) > XATTR_SIZE_MAX)
114114 return false;
115115 if (rmt->rm_owner == 0)
116116 return false;
fs/xfs/xfs_bmap.c+24−8
@@ -1635,7 +1635,7 @@ xfs_bmap_last_extent( · 1634 unmodified lines
16351635 * blocks at the end of the file which do not start at the previous data block,
16361636 * we will try to align the new blocks at stripe unit boundaries.
16371637 *
1638− * Returns 0 in bma->aeof if the file (fork) is empty as any new write will be
1638+ * Returns 1 in bma->aeof if the file (fork) is empty as any new write will be
16391639 * at, or past the EOF.
16401640 */
16411641 STATIC int
@@ -1650,9 +1650,14 @@ xfs_bmap_isaeof( · 8 unmodified lines
16501650 bma->aeof = 0;
16511651 error = xfs_bmap_last_extent(NULL, bma->ip, whichfork, &rec,
16521652 &is_empty);
1653− if (error || is_empty)
1653+ if (error)
16541654 return error;
16551655
1656+ if (is_empty) {
1657+ bma->aeof = 1;
1658+ return 0;
1659+ }
1660+
16561661 /*
16571662 * Check if we are allocation or past the last extent, or at least into
16581663 * the last delayed allocated extent.
@@ -3643,10 +3648,19 @@ xfs_bmap_btalloc( · 1984 unmodified lines
36433648 int isaligned;
36443649 int tryagain;
36453650 int error;
3651+ int stripe_align;
36463652
36473653 ASSERT(ap->length);
36483654
36493655 mp = ap->ip->i_mount;
3656+
3657+ /* stripe alignment for allocation is determined by mount parameters */
3658+ stripe_align = 0;
3659+ if (mp->m_swidth && (mp->m_flags & XFS_MOUNT_SWALLOC))
3660+ stripe_align = mp->m_swidth;
3661+ else if (mp->m_dalign)
3662+ stripe_align = mp->m_dalign;
3663+
36503664 align = ap->userdata ? xfs_get_extsz_hint(ap->ip) : 0;
36513665 if (unlikely(align)) {
36523666 error = xfs_bmap_extsize_align(mp, &ap->got, &ap->prev,
@@ -3655,6 +3669,8 @@ xfs_bmap_btalloc( · 2 unmodified lines
36553669 ASSERT(!error);
36563670 ASSERT(ap->length);
36573671 }
3672+
3673+
36583674 nullfb = *ap->firstblock == NULLFSBLOCK;
36593675 fb_agno = nullfb ? NULLAGNUMBER : XFS_FSB_TO_AGNO(mp, *ap->firstblock);
36603676 if (nullfb) {
@@ -3730,7 +3746,7 @@ xfs_bmap_btalloc( · 69 unmodified lines
37303746 */
37313747 if (!ap->flist->xbf_low && ap->aeof) {
37323748 if (!ap->offset) {
3733− args.alignment = mp->m_dalign;
3749+ args.alignment = stripe_align;
37343750 atype = args.type;
37353751 isaligned = 1;
37363752 /*
@@ -3755,13 +3771,13 @@ xfs_bmap_btalloc( · 18 unmodified lines
37553771 * of minlen+alignment+slop doesn't go up
37563772 * between the calls.
37573773 */
3758− if (blen > mp->m_dalign && blen <= args.maxlen)
3759− nextminlen = blen - mp->m_dalign;
3774+ if (blen > stripe_align && blen <= args.maxlen)
3775+ nextminlen = blen - stripe_align;
37603776 else
37613777 nextminlen = args.minlen;
3762− if (nextminlen + mp->m_dalign > args.minlen + 1)
3778+ if (nextminlen + stripe_align > args.minlen + 1)
37633779 args.minalignslop =
3764− nextminlen + mp->m_dalign -
3780+ nextminlen + stripe_align -
37653781 args.minlen - 1;
37663782 else
37673783 args.minalignslop = 0;
@@ -3783,7 +3799,7 @@ xfs_bmap_btalloc( · 15 unmodified lines
37833799 */
37843800 args.type = atype;
37853801 args.fsbno = ap->blkno;
3786− args.alignment = mp->m_dalign;
3802+ args.alignment = stripe_align;
37873803 args.minlen = nextminlen;
37883804 args.minalignslop = 0;
37893805 isaligned = 1;
fs/xfs/xfs_bmap_util.c+13−2
@@ -287,6 +287,7 @@ xfs_bmapi_allocate( · 286 unmodified lines
287287 INIT_WORK_ONSTACK(&args->work, xfs_bmapi_allocate_worker);
288288 queue_work(xfs_alloc_wq, &args->work);
289289 wait_for_completion(&done);
290+ destroy_work_on_stack(&args->work);
290291 return args->result;
291292 }
292293
@@ -1187,7 +1188,12 @@ xfs_zero_remaining_bytes( · 894 unmodified lines
11871188 XFS_BUF_UNWRITE(bp);
11881189 XFS_BUF_READ(bp);
11891190 XFS_BUF_SET_ADDR(bp, xfs_fsb_to_db(ip, imap.br_startblock));
1190− xfsbdstrat(mp, bp);
1191+
1192+ if (XFS_FORCED_SHUTDOWN(mp)) {
1193+ error = XFS_ERROR(EIO);
1194+ break;
1195+ }
1196+ xfs_buf_iorequest(bp);
11911197 error = xfs_buf_iowait(bp);
11921198 if (error) {
11931199 xfs_buf_ioerror_alert(bp,
@@ -1200,7 +1206,12 @@ xfs_zero_remaining_bytes( · 6 unmodified lines
12001206 XFS_BUF_UNDONE(bp);
12011207 XFS_BUF_UNREAD(bp);
12021208 XFS_BUF_WRITE(bp);
1203− xfsbdstrat(mp, bp);
1209+
1210+ if (XFS_FORCED_SHUTDOWN(mp)) {
1211+ error = XFS_ERROR(EIO);
1212+ break;
1213+ }
1214+ xfs_buf_iorequest(bp);
12041215 error = xfs_buf_iowait(bp);
12051216 if (error) {
12061217 xfs_buf_ioerror_alert(bp,
fs/xfs/xfs_buf.c+14−23
@@ -698,7 +698,11 @@ xfs_buf_read_uncached( · 697 unmodified lines
698698 bp->b_flags |= XBF_READ;
699699 bp->b_ops = ops;
700700
701− xfsbdstrat(target->bt_mount, bp);
701+ if (XFS_FORCED_SHUTDOWN(target->bt_mount)) {
702+ xfs_buf_relse(bp);
703+ return NULL;
704+ }
705+ xfs_buf_iorequest(bp);
702706 xfs_buf_iowait(bp);
703707 return bp;
704708 }
@@ -1089,7 +1093,7 @@ xfs_bioerror( · 384 unmodified lines
10891093 * This is meant for userdata errors; metadata bufs come with
10901094 * iodone functions attached, so that we can track down errors.
10911095 */
1092−STATIC int
1096+int
10931097 xfs_bioerror_relse(
10941098 struct xfs_buf *bp)
10951099 {
@@ -1152,7 +1156,7 @@ xfs_bwrite( · 56 unmodified lines
11521156 ASSERT(xfs_buf_islocked(bp));
11531157
11541158 bp->b_flags |= XBF_WRITE;
1155− bp->b_flags &= ~(XBF_ASYNC | XBF_READ | _XBF_DELWRI_Q);
1159+ bp->b_flags &= ~(XBF_ASYNC | XBF_READ | _XBF_DELWRI_Q | XBF_WRITE_FAIL);
11561160
11571161 xfs_bdstrat_cb(bp);
11581162
@@ -1164,25 +1168,6 @@ xfs_bwrite( · 5 unmodified lines
11641168 return error;
11651169 }
11661170
1167−/*
1168− * Wrapper around bdstrat so that we can stop data from going to disk in case
1169− * we are shutting down the filesystem. Typically user data goes thru this
1170− * path; one of the exceptions is the superblock.
1171− */
1172−void
1173−xfsbdstrat(
1174− struct xfs_mount *mp,
1175− struct xfs_buf *bp)
1176−{
1177− if (XFS_FORCED_SHUTDOWN(mp)) {
1178− trace_xfs_bdstrat_shut(bp, _RET_IP_);
1179− xfs_bioerror_relse(bp);
1180− return;
1181− }
1182−
1183− xfs_buf_iorequest(bp);
1184−}
1185−
11861171 STATIC void
11871172 _xfs_buf_ioend(
11881173 xfs_buf_t *bp,
@@ -1516,6 +1501,12 @@ xfs_wait_buftarg( · 327 unmodified lines
15161501 struct xfs_buf *bp;
15171502 bp = list_first_entry(&dispose, struct xfs_buf, b_lru);
15181503 list_del_init(&bp->b_lru);
1504+ if (bp->b_flags & XBF_WRITE_FAIL) {
1505+ xfs_alert(btp->bt_mount,
1506+"Corruption Alert: Buffer at block 0x%llx had permanent write failures!\n"
1507+"Please run xfs_repair to determine the extent of the problem.",
1508+ (long long)bp->b_bn);
1509+ }
15191510 xfs_buf_rele(bp);
15201511 }
15211512 if (loop++ != 0)
@@ -1799,7 +1790,7 @@ __xfs_buf_delwri_submit( · 277 unmodified lines
17991790
18001791 blk_start_plug(&plug);
18011792 list_for_each_entry_safe(bp, n, io_list, b_list) {
1802− bp->b_flags &= ~(_XBF_DELWRI_Q | XBF_ASYNC);
1793+ bp->b_flags &= ~(_XBF_DELWRI_Q | XBF_ASYNC | XBF_WRITE_FAIL);
18031794 bp->b_flags |= XBF_WRITE;
18041795
18051796 if (!wait) {
fs/xfs/xfs_buf.h+7−4
@@ -45,6 +45,7 @@ typedef enum { · 44 unmodified lines
4545 #define XBF_ASYNC (1 << 4) /* initiator will not wait for completion */
4646 #define XBF_DONE (1 << 5) /* all pages in the buffer uptodate */
4747 #define XBF_STALE (1 << 6) /* buffer has been staled, do not find it */
48+#define XBF_WRITE_FAIL (1 << 24)/* async writes have failed on this buffer */
4849
4950 /* I/O hints for the BIO layer */
5051 #define XBF_SYNCIO (1 << 10)/* treat this buffer as synchronous I/O */
@@ -70,6 +71,7 @@ typedef unsigned int xfs_buf_flags_t; · 19 unmodified lines
7071 { XBF_ASYNC, "ASYNC" }, \
7172 { XBF_DONE, "DONE" }, \
7273 { XBF_STALE, "STALE" }, \
74+ { XBF_WRITE_FAIL, "WRITE_FAIL" }, \
7375 { XBF_SYNCIO, "SYNCIO" }, \
7476 { XBF_FUA, "FUA" }, \
7577 { XBF_FLUSH, "FLUSH" }, \
@@ -80,6 +82,7 @@ typedef unsigned int xfs_buf_flags_t; · 4 unmodified lines
8082 { _XBF_DELWRI_Q, "DELWRI_Q" }, \
8183 { _XBF_COMPOUND, "COMPOUND" }
8284
85+
8386 /*
8487 * Internal state flags.
8588 */
@@ -269,9 +272,6 @@ extern void xfs_buf_unlock(xfs_buf_t *); · 183 unmodified lines
269272
270273 /* Buffer Read and Write Routines */
271274 extern int xfs_bwrite(struct xfs_buf *bp);
272−
273−extern void xfsbdstrat(struct xfs_mount *, struct xfs_buf *);
274−
275275 extern void xfs_buf_ioend(xfs_buf_t *, int);
276276 extern void xfs_buf_ioerror(xfs_buf_t *, int);
277277 extern void xfs_buf_ioerror_alert(struct xfs_buf *, const char *func);
@@ -282,6 +282,8 @@ extern void xfs_buf_iomove(xfs_buf_t *, size_t, size_t, void *, · 4 unmodified lines
282282 #define xfs_buf_zero(bp, off, len) \
283283 xfs_buf_iomove((bp), (off), (len), NULL, XBRW_ZERO)
284284
285+extern int xfs_bioerror_relse(struct xfs_buf *);
286+
285287 static inline int xfs_buf_geterror(xfs_buf_t *bp)
286288 {
287289 return bp ? bp->b_error : ENOMEM;
@@ -301,7 +303,8 @@ extern void xfs_buf_terminate(void); · 13 unmodified lines
301303
302304 #define XFS_BUF_ZEROFLAGS(bp) \
303305 ((bp)->b_flags &= ~(XBF_READ|XBF_WRITE|XBF_ASYNC| \
304− XBF_SYNCIO|XBF_FUA|XBF_FLUSH))
306+ XBF_SYNCIO|XBF_FUA|XBF_FLUSH| \
307+ XBF_WRITE_FAIL))
305308
306309 void xfs_buf_stale(struct xfs_buf *bp);
307310 #define XFS_BUF_UNSTALE(bp) ((bp)->b_flags &= ~XBF_STALE)
fs/xfs/xfs_buf_item.c+19−2
@@ -496,6 +496,14 @@ xfs_buf_item_unpin( · 495 unmodified lines
496496 }
497497 }
498498
499+/*
500+ * Buffer IO error rate limiting. Limit it to no more than 10 messages per 30
501+ * seconds so as to not spam logs too much on repeated detection of the same
502+ * buffer being bad..
503+ */
504+
505+DEFINE_RATELIMIT_STATE(xfs_buf_write_fail_rl_state, 30 * HZ, 10);
506+
499507 STATIC uint
500508 xfs_buf_item_push(
501509 struct xfs_log_item *lip,
@@ -524,6 +532,14 @@ xfs_buf_item_push( · 22 unmodified lines
524532
525533 trace_xfs_buf_item_push(bip);
526534
535+ /* has a previous flush failed due to IO errors? */
536+ if ((bp->b_flags & XBF_WRITE_FAIL) &&
537+ ___ratelimit(&xfs_buf_write_fail_rl_state, "XFS:")) {
538+ xfs_warn(bp->b_target->bt_mount,
539+"Detected failing async write on buffer block 0x%llx. Retrying async write.\n",
540+ (long long)bp->b_bn);
541+ }
542+
527543 if (!xfs_buf_delwri_queue(bp, buffer_list))
528544 rval = XFS_ITEM_FLUSHING;
529545 xfs_buf_unlock(bp);
@@ -1096,8 +1112,9 @@ xfs_buf_iodone_callbacks( · 566 unmodified lines
10961112
10971113 xfs_buf_ioerror(bp, 0); /* errno of 0 unsets the flag */
10981114
1099− if (!XFS_BUF_ISSTALE(bp)) {
1100− bp->b_flags |= XBF_WRITE | XBF_ASYNC | XBF_DONE;
1115+ if (!(bp->b_flags & (XBF_STALE|XBF_WRITE_FAIL))) {
1116+ bp->b_flags |= XBF_WRITE | XBF_ASYNC |
1117+ XBF_DONE | XBF_WRITE_FAIL;
11011118 xfs_buf_iorequest(bp);
11021119 } else {
11031120 xfs_buf_relse(bp);
fs/xfs/xfs_dir2_node.c+13−13
@@ -2067,12 +2067,12 @@ xfs_dir2_node_lookup( · 2066 unmodified lines
20672067 */
20682068 int /* error */
20692069 xfs_dir2_node_removename(
2070− xfs_da_args_t *args) /* operation arguments */
2070+ struct xfs_da_args *args) /* operation arguments */
20712071 {
2072− xfs_da_state_blk_t *blk; /* leaf block */
2072+ struct xfs_da_state_blk *blk; /* leaf block */
20732073 int error; /* error return value */
20742074 int rval; /* operation return value */
2075− xfs_da_state_t *state; /* btree cursor */
2075+ struct xfs_da_state *state; /* btree cursor */
20762076
20772077 trace_xfs_dir2_node_removename(args);
20782078
@@ -2084,19 +2084,18 @@ xfs_dir2_node_removename( · 5 unmodified lines
20842084 state->mp = args->dp->i_mount;
20852085 state->blocksize = state->mp->m_dirblksize;
20862086 state->node_ents = state->mp->m_dir_node_ents;
2087− /*
2088− * Look up the entry we're deleting, set up the cursor.
2089− */
2087+
2088+ /* Look up the entry we're deleting, set up the cursor. */
20902089 error = xfs_da3_node_lookup_int(state, &rval);
20912090 if (error)
2092− rval = error;
2093− /*
2094− * Didn't find it, upper layer screwed up.
2095− */
2091+ goto out_free;
2092+
2093+ /* Didn't find it, upper layer screwed up. */
20962094 if (rval != EEXIST) {
2097− xfs_da_state_free(state);
2098− return rval;
2095+ error = rval;
2096+ goto out_free;
20992097 }
2098+
21002099 blk = &state->path.blk[state->path.active - 1];
21012100 ASSERT(blk->magic == XFS_DIR2_LEAFN_MAGIC);
21022101 ASSERT(state->extravalid);
@@ -2107,7 +2106,7 @@ xfs_dir2_node_removename( · 4 unmodified lines
21072106 error = xfs_dir2_leafn_remove(args, blk->bp, blk->index,
21082107 &state->extrablk, &rval);
21092108 if (error)
2110− return error;
2109+ goto out_free;
21112110 /*
21122111 * Fix the hash values up the btree.
21132112 */
@@ -2122,6 +2121,7 @@ xfs_dir2_node_removename( · 8 unmodified lines
21222121 */
21232122 if (!error)
21242123 error = xfs_dir2_node_to_leaf(state);
2124+out_free:
21252125 xfs_da_state_free(state);
21262126 return error;
21272127 }
fs/xfs/xfs_iops.c+2−1
@@ -618,7 +618,8 @@ xfs_setattr_nonsize( · 617 unmodified lines
618618 }
619619 if (!gid_eq(igid, gid)) {
620620 if (XFS_IS_QUOTA_RUNNING(mp) && XFS_IS_GQUOTA_ON(mp)) {
621− ASSERT(!XFS_IS_PQUOTA_ON(mp));
621+ ASSERT(xfs_sb_version_has_pquotino(&mp->m_sb) ||
622+ !XFS_IS_PQUOTA_ON(mp));
622623 ASSERT(mask & ATTR_GID);
623624 ASSERT(gdqp);
624625 olddquot2 = xfs_qm_vop_chown(tp, ip,
fs/xfs/xfs_log_recover.c+11−2
@@ -193,7 +193,10 @@ xlog_bread_noalign( · 192 unmodified lines
193193 bp->b_io_length = nbblks;
194194 bp->b_error = 0;
195195
196− xfsbdstrat(log->l_mp, bp);
196+ if (XFS_FORCED_SHUTDOWN(log->l_mp))
197+ return XFS_ERROR(EIO);
198+
199+ xfs_buf_iorequest(bp);
197200 error = xfs_buf_iowait(bp);
198201 if (error)
199202 xfs_buf_ioerror_alert(bp, __func__);
@@ -4397,7 +4400,13 @@ xlog_do_recover( · 4197 unmodified lines
43974400 XFS_BUF_READ(bp);
43984401 XFS_BUF_UNASYNC(bp);
43994402 bp->b_ops = &xfs_sb_buf_ops;
4400− xfsbdstrat(log->l_mp, bp);
4403+
4404+ if (XFS_FORCED_SHUTDOWN(log->l_mp)) {
4405+ xfs_buf_relse(bp);
4406+ return XFS_ERROR(EIO);
4407+ }
4408+
4409+ xfs_buf_iorequest(bp);
44014410 error = xfs_buf_iowait(bp);
44024411 if (error) {
44034412 xfs_buf_ioerror_alert(bp, __func__);
fs/xfs/xfs_qm.c+53−27
@@ -134,8 +134,6 @@ xfs_qm_dqpurge( · 133 unmodified lines
134134 {
135135 struct xfs_mount *mp = dqp->q_mount;
136136 struct xfs_quotainfo *qi = mp->m_quotainfo;
137− struct xfs_dquot *gdqp = NULL;
138− struct xfs_dquot *pdqp = NULL;
139137
140138 xfs_dqlock(dqp);
141139 if ((dqp->dq_flags & XFS_DQ_FREEING) || dqp->q_nrefs != 0) {
@@ -143,21 +141,6 @@ xfs_qm_dqpurge( · 1 unmodified line
143141 return EAGAIN;
144142 }
145143
146− /*
147− * If this quota has a hint attached, prepare for releasing it now.
148− */
149− gdqp = dqp->q_gdquot;
150− if (gdqp) {
151− xfs_dqlock(gdqp);
152− dqp->q_gdquot = NULL;
153− }
154−
155− pdqp = dqp->q_pdquot;
156− if (pdqp) {
157− xfs_dqlock(pdqp);
158− dqp->q_pdquot = NULL;
159− }
160−
161144 dqp->dq_flags |= XFS_DQ_FREEING;
162145
163146 xfs_dqflock(dqp);
@@ -206,11 +189,47 @@ xfs_qm_dqpurge( · 42 unmodified lines
206189 XFS_STATS_DEC(xs_qm_dquot_unused);
207190
208191 xfs_qm_dqdestroy(dqp);
192+ return 0;
193+}
194+
195+/*
196+ * Release the group or project dquot pointers the user dquots maybe carrying
197+ * around as a hint, and proceed to purge the user dquot cache if requested.
198+*/
199+STATIC int
200+xfs_qm_dqpurge_hints(
201+ struct xfs_dquot *dqp,
202+ void *data)
203+{
204+ struct xfs_dquot *gdqp = NULL;
205+ struct xfs_dquot *pdqp = NULL;
206+ uint flags = *((uint *)data);
207+
208+ xfs_dqlock(dqp);
209+ if (dqp->dq_flags & XFS_DQ_FREEING) {
210+ xfs_dqunlock(dqp);
211+ return EAGAIN;
212+ }
213+
214+ /* If this quota has a hint attached, prepare for releasing it now */
215+ gdqp = dqp->q_gdquot;
216+ if (gdqp)
217+ dqp->q_gdquot = NULL;
218+
219+ pdqp = dqp->q_pdquot;
220+ if (pdqp)
221+ dqp->q_pdquot = NULL;
222+
223+ xfs_dqunlock(dqp);
209224
210225 if (gdqp)
211− xfs_qm_dqput(gdqp);
226+ xfs_qm_dqrele(gdqp);
212227 if (pdqp)
213− xfs_qm_dqput(pdqp);
228+ xfs_qm_dqrele(pdqp);
229+
230+ if (flags & XFS_QMOPT_UQUOTA)
231+ return xfs_qm_dqpurge(dqp, NULL);
232+
214233 return 0;
215234 }
216235
@@ -222,8 +241,18 @@ xfs_qm_dqpurge_all( · 5 unmodified lines
222241 struct xfs_mount *mp,
223242 uint flags)
224243 {
225− if (flags & XFS_QMOPT_UQUOTA)
226− xfs_qm_dquot_walk(mp, XFS_DQ_USER, xfs_qm_dqpurge, NULL);
244+ /*
245+ * We have to release group/project dquot hint(s) from the user dquot
246+ * at first if they are there, otherwise we would run into an infinite
247+ * loop while walking through radix tree to purge other type of dquots
248+ * since their refcount is not zero if the user dquot refers to them
249+ * as hint.
250+ *
251+ * Call the special xfs_qm_dqpurge_hints() will end up go through the
252+ * general xfs_qm_dqpurge() against user dquot cache if requested.
253+ */
254+ xfs_qm_dquot_walk(mp, XFS_DQ_USER, xfs_qm_dqpurge_hints, &flags);
255+
227256 if (flags & XFS_QMOPT_GQUOTA)
228257 xfs_qm_dquot_walk(mp, XFS_DQ_GROUP, xfs_qm_dqpurge, NULL);
229258 if (flags & XFS_QMOPT_PQUOTA)
@@ -2082,24 +2111,21 @@ xfs_qm_vop_create_dqattach( · 1852 unmodified lines
20822111 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
20832112 ASSERT(XFS_IS_QUOTA_RUNNING(mp));
20842113
2085− if (udqp) {
2114+ if (udqp && XFS_IS_UQUOTA_ON(mp)) {
20862115 ASSERT(ip->i_udquot == NULL);
2087− ASSERT(XFS_IS_UQUOTA_ON(mp));
20882116 ASSERT(ip->i_d.di_uid == be32_to_cpu(udqp->q_core.d_id));
20892117
20902118 ip->i_udquot = xfs_qm_dqhold(udqp);
20912119 xfs_trans_mod_dquot(tp, udqp, XFS_TRANS_DQ_ICOUNT, 1);
20922120 }
2093− if (gdqp) {
2121+ if (gdqp && XFS_IS_GQUOTA_ON(mp)) {
20942122 ASSERT(ip->i_gdquot == NULL);
2095− ASSERT(XFS_IS_GQUOTA_ON(mp));
20962123 ASSERT(ip->i_d.di_gid == be32_to_cpu(gdqp->q_core.d_id));
20972124 ip->i_gdquot = xfs_qm_dqhold(gdqp);
20982125 xfs_trans_mod_dquot(tp, gdqp, XFS_TRANS_DQ_ICOUNT, 1);
20992126 }
2100− if (pdqp) {
2127+ if (pdqp && XFS_IS_PQUOTA_ON(mp)) {
21012128 ASSERT(ip->i_pdquot == NULL);
2102− ASSERT(XFS_IS_PQUOTA_ON(mp));
21032129 ASSERT(xfs_get_projid(ip) == be32_to_cpu(pdqp->q_core.d_id));
21042130
21052131 ip->i_pdquot = xfs_qm_dqhold(pdqp);
fs/xfs/xfs_trans_buf.c+12−1
@@ -314,7 +314,18 @@ xfs_trans_read_buf_map( · 313 unmodified lines
314314 ASSERT(bp->b_iodone == NULL);
315315 XFS_BUF_READ(bp);
316316 bp->b_ops = ops;
317− xfsbdstrat(tp->t_mountp, bp);
317+
318+ /*
319+ * XXX(hch): clean up the error handling here to be less
320+ * of a mess..
321+ */
322+ if (XFS_FORCED_SHUTDOWN(mp)) {
323+ trace_xfs_bdstrat_shut(bp, _RET_IP_);
324+ xfs_bioerror_relse(bp);
325+ } else {
326+ xfs_buf_iorequest(bp);
327+ }
328+
318329 error = xfs_buf_iowait(bp);
319330 if (error) {
320331 xfs_buf_ioerror_alert(bp, __func__);
include/acpi/acpi_bus.h+3−1
@@ -169,7 +169,8 @@ struct acpi_device_flags { · 168 unmodified lines
169169 u32 ejectable:1;
170170 u32 power_manageable:1;
171171 u32 match_driver:1;
172− u32 reserved:27;
172+ u32 no_hotplug:1;
173+ u32 reserved:26;
173174 };
174175
175176 /* File System */
@@ -344,6 +345,7 @@ extern struct kobject *acpi_kobj; · 168 unmodified lines
344345 extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int);
345346 void acpi_bus_private_data_handler(acpi_handle, void *);
346347 int acpi_bus_get_private_data(acpi_handle, void **);
348+void acpi_bus_no_hotplug(acpi_handle handle);
347349 extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32);
348350 extern int register_acpi_notifier(struct notifier_block *);
349351 extern int unregister_acpi_notifier(struct notifier_block *);
include/asm-generic/pgtable.h+3−4
@@ -217,7 +217,7 @@ static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b) · 216 unmodified lines
217217 #endif
218218
219219 #ifndef pte_accessible
220−# define pte_accessible(pte) ((void)(pte),1)
220+# define pte_accessible(mm, pte) ((void)(pte), 1)
221221 #endif
222222
223223 #ifndef flush_tlb_fix_spurious_fault
@@ -599,11 +599,10 @@ static inline int pmd_none_or_trans_huge_or_clear_bad(pmd_t *pmd) · 375 unmodified lines
599599 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
600600 barrier();
601601 #endif
602− if (pmd_none(pmdval))
602+ if (pmd_none(pmdval) || pmd_trans_huge(pmdval))
603603 return 1;
604604 if (unlikely(pmd_bad(pmdval))) {
605− if (!pmd_trans_huge(pmdval))
606− pmd_clear_bad(pmd);
605+ pmd_clear_bad(pmd);
607606 return 1;
608607 }
609608 return 0;
include/asm-generic/preempt.h+11−24
@@ -3,13 +3,11 @@ · 2 unmodified lines
33
44 #include <linux/thread_info.h>
55
6−/*
7− * We mask the PREEMPT_NEED_RESCHED bit so as not to confuse all current users
8− * that think a non-zero value indicates we cannot preempt.
9− */
6+#define PREEMPT_ENABLED (0)
7+
108 static __always_inline int preempt_count(void)
119 {
12− return current_thread_info()->preempt_count & ~PREEMPT_NEED_RESCHED;
10+ return current_thread_info()->preempt_count;
1311 }
1412
1513 static __always_inline int *preempt_count_ptr(void)
@@ -17,11 +15,6 @@ static __always_inline int *preempt_count_ptr(void) · 1 unmodified line
1715 return &current_thread_info()->preempt_count;
1816 }
1917
20−/*
21− * We now loose PREEMPT_NEED_RESCHED and cause an extra reschedule; however the
22− * alternative is loosing a reschedule. Better schedule too often -- also this
23− * should be a very rare operation.
24− */
2518 static __always_inline void preempt_count_set(int pc)
2619 {
2720 *preempt_count_ptr() = pc;
@@ -41,28 +34,17 @@ static __always_inline void preempt_count_set(int pc) · 13 unmodified lines
4134 task_thread_info(p)->preempt_count = PREEMPT_ENABLED; \
4235 } while (0)
4336
44−/*
45− * We fold the NEED_RESCHED bit into the preempt count such that
46− * preempt_enable() can decrement and test for needing to reschedule with a
47− * single instruction.
48− *
49− * We invert the actual bit, so that when the decrement hits 0 we know we both
50− * need to resched (the bit is cleared) and can resched (no preempt count).
51− */
52−
5337 static __always_inline void set_preempt_need_resched(void)
5438 {
55− *preempt_count_ptr() &= ~PREEMPT_NEED_RESCHED;
5639 }
5740
5841 static __always_inline void clear_preempt_need_resched(void)
5942 {
60− *preempt_count_ptr() |= PREEMPT_NEED_RESCHED;
6143 }
6244
6345 static __always_inline bool test_preempt_need_resched(void)
6446 {
65− return !(*preempt_count_ptr() & PREEMPT_NEED_RESCHED);
47+ return false;
6648 }
6749
6850 /*
@@ -81,7 +63,12 @@ static __always_inline void __preempt_count_sub(int val) · 12 unmodified lines
8163
8264 static __always_inline bool __preempt_count_dec_and_test(void)
8365 {
84− return !--*preempt_count_ptr();
66+ /*
67+ * Because of load-store architectures cannot do per-cpu atomic
68+ * operations; we cannot use PREEMPT_NEED_RESCHED because it might get
69+ * lost.
70+ */
71+ return !--*preempt_count_ptr() && tif_need_resched();
8572 }
8673
8774 /*
@@ -89,7 +76,7 @@ static __always_inline bool __preempt_count_dec_and_test(void) · 1 unmodified line
8976 */
9077 static __always_inline bool should_resched(void)
9178 {
92− return unlikely(!*preempt_count_ptr());
79+ return unlikely(!preempt_count() && tif_need_resched());
9380 }
9481
9582 #ifdef CONFIG_PREEMPT
include/drm/drm_pciids.h+1−1
@@ -600,7 +600,7 @@ · 599 unmodified lines
600600 {0x1002, 0x9645, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO2|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
601601 {0x1002, 0x9647, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\
602602 {0x1002, 0x9648, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\
603− {0x1002, 0x9649, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\
603+ {0x1002, 0x9649, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO2|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP},\
604604 {0x1002, 0x964a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
605605 {0x1002, 0x964b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
606606 {0x1002, 0x964c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SUMO|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
include/linux/auxvec.h+1−1
@@ -3,6 +3,6 @@ · 2 unmodified lines
33
44 #include <uapi/linux/auxvec.h>
55
6−#define AT_VECTOR_SIZE_BASE 19 /* NEW_AUX_ENT entries in auxiliary table */
6+#define AT_VECTOR_SIZE_BASE 20 /* NEW_AUX_ENT entries in auxiliary table */
77 /* number of "#define AT_.*" above, minus {AT_NULL, AT_IGNORE, AT_NOTELF} */
88 #endif /* _LINUX_AUXVEC_H */
include/linux/crash_dump.h+2−0
@@ -6,6 +6,8 @@ · 5 unmodified lines
66 #include <linux/proc_fs.h>
77 #include <linux/elf.h>
88
9+#include <asm/pgtable.h> /* for pgprot_t */
10+
911 #define ELFCORE_ADDR_MAX (-1ULL)
1012 #define ELFCORE_ADDR_ERR (-2ULL)
1113
include/linux/i2c.h+1−1
@@ -445,7 +445,7 @@ static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data) · 444 unmodified lines
445445 static inline struct i2c_adapter *
446446 i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter)
447447 {
448−#if IS_ENABLED(I2C_MUX)
448+#if IS_ENABLED(CONFIG_I2C_MUX)
449449 struct device *parent = adapter->dev.parent;
450450
451451 if (parent != NULL && parent->type == &i2c_adapter_type)
include/linux/libata.h+1−0
@@ -418,6 +418,7 @@ enum { · 417 unmodified lines
418418 ATA_HORKAGE_DUMP_ID = (1 << 16), /* dump IDENTIFY data */
419419 ATA_HORKAGE_MAX_SEC_LBA48 = (1 << 17), /* Set max sects to 65535 */
420420 ATA_HORKAGE_ATAPI_DMADIR = (1 << 18), /* device requires dmadir */
421+ ATA_HORKAGE_NO_NCQ_TRIM = (1 << 19), /* don't use queued TRIM */
421422
422423 /* DMA mask for user DMA control: User visible values; DO NOT
423424 renumber */
include/linux/lockref.h+1−1
@@ -19,7 +19,7 @@ · 18 unmodified lines
1919
2020 #define USE_CMPXCHG_LOCKREF \
2121 (IS_ENABLED(CONFIG_ARCH_USE_CMPXCHG_LOCKREF) && \
22− IS_ENABLED(CONFIG_SMP) && !BLOATED_SPINLOCKS)
22+ IS_ENABLED(CONFIG_SMP) && SPINLOCK_SIZE <= 4)
2323
2424 struct lockref {
2525 union {
include/linux/math64.h+30−0
@@ -133,4 +133,34 @@ __iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder) · 132 unmodified lines
133133 return ret;
134134 }
135135
136+#if defined(CONFIG_ARCH_SUPPORTS_INT128) && defined(__SIZEOF_INT128__)
137+
138+#ifndef mul_u64_u32_shr
139+static inline u64 mul_u64_u32_shr(u64 a, u32 mul, unsigned int shift)
140+{
141+ return (u64)(((unsigned __int128)a * mul) >> shift);
142+}
143+#endif /* mul_u64_u32_shr */
144+
145+#else
146+
147+#ifndef mul_u64_u32_shr
148+static inline u64 mul_u64_u32_shr(u64 a, u32 mul, unsigned int shift)
149+{
150+ u32 ah, al;
151+ u64 ret;
152+
153+ al = a;
154+ ah = a >> 32;
155+
156+ ret = ((u64)al * mul) >> shift;
157+ if (ah)
158+ ret += ((u64)ah * mul) << (32 - shift);
159+
160+ return ret;
161+}
162+#endif /* mul_u64_u32_shr */
163+
164+#endif
165+
136166 #endif /* _LINUX_MATH64_H */
include/linux/migrate.h+11−1
@@ -55,7 +55,8 @@ extern int migrate_huge_page_move_mapping(struct address_space *mapping, · 54 unmodified lines
5555 struct page *newpage, struct page *page);
5656 extern int migrate_page_move_mapping(struct address_space *mapping,
5757 struct page *newpage, struct page *page,
58− struct buffer_head *head, enum migrate_mode mode);
58+ struct buffer_head *head, enum migrate_mode mode,
59+ int extra_count);
5960 #else
6061
6162 static inline void putback_lru_pages(struct list_head *l) {}
@@ -90,10 +91,19 @@ static inline int migrate_huge_page_move_mapping(struct address_space *mapping, · 28 unmodified lines
9091 #endif /* CONFIG_MIGRATION */
9192
9293 #ifdef CONFIG_NUMA_BALANCING
94+extern bool pmd_trans_migrating(pmd_t pmd);
95+extern void wait_migrate_huge_page(struct anon_vma *anon_vma, pmd_t *pmd);
9396 extern int migrate_misplaced_page(struct page *page,
9497 struct vm_area_struct *vma, int node);
9598 extern bool migrate_ratelimited(int node);
9699 #else
100+static inline bool pmd_trans_migrating(pmd_t pmd)
101+{
102+ return false;
103+}
104+static inline void wait_migrate_huge_page(struct anon_vma *anon_vma, pmd_t *pmd)
105+{
106+}
97107 static inline int migrate_misplaced_page(struct page *page,
98108 struct vm_area_struct *vma, int node)
99109 {
include/linux/mm.h+3−3
@@ -1317,7 +1317,7 @@ static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long a · 1316 unmodified lines
13171317 #endif /* CONFIG_MMU && !__ARCH_HAS_4LEVEL_HACK */
13181318
13191319 #if USE_SPLIT_PTE_PTLOCKS
1320−#if BLOATED_SPINLOCKS
1320+#if ALLOC_SPLIT_PTLOCKS
13211321 extern bool ptlock_alloc(struct page *page);
13221322 extern void ptlock_free(struct page *page);
13231323
@@ -1325,7 +1325,7 @@ static inline spinlock_t *ptlock_ptr(struct page *page) · 1 unmodified line
13251325 {
13261326 return page->ptl;
13271327 }
1328−#else /* BLOATED_SPINLOCKS */
1328+#else /* ALLOC_SPLIT_PTLOCKS */
13291329 static inline bool ptlock_alloc(struct page *page)
13301330 {
13311331 return true;
@@ -1339,7 +1339,7 @@ static inline spinlock_t *ptlock_ptr(struct page *page) · 7 unmodified lines
13391339 {
13401340 return &page->ptl;
13411341 }
1342−#endif /* BLOATED_SPINLOCKS */
1342+#endif /* ALLOC_SPLIT_PTLOCKS */
13431343
13441344 static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd)
13451345 {
include/linux/mm_types.h+51−1
@@ -26,6 +26,7 @@ struct address_space; · 25 unmodified lines
2626 #define USE_SPLIT_PTE_PTLOCKS (NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS)
2727 #define USE_SPLIT_PMD_PTLOCKS (USE_SPLIT_PTE_PTLOCKS && \
2828 IS_ENABLED(CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK))
29+#define ALLOC_SPLIT_PTLOCKS (SPINLOCK_SIZE > BITS_PER_LONG/8)
2930
3031 /*
3132 * Each physical page in the system has a struct page associated with
@@ -155,7 +156,7 @@ struct page { · 123 unmodified lines
155156 * system if PG_buddy is set.
156157 */
157158 #if USE_SPLIT_PTE_PTLOCKS
158−#if BLOATED_SPINLOCKS
159+#if ALLOC_SPLIT_PTLOCKS
159160 spinlock_t *ptl;
160161 #else
161162 spinlock_t ptl;
@@ -442,6 +443,14 @@ struct mm_struct { · 280 unmodified lines
442443
443444 /* numa_scan_seq prevents two threads setting pte_numa */
444445 int numa_scan_seq;
446+#endif
447+#if defined(CONFIG_NUMA_BALANCING) || defined(CONFIG_COMPACTION)
448+ /*
449+ * An operation with batched TLB flushing is going on. Anything that
450+ * can move process memory needs to flush the TLB when moving a
451+ * PROT_NONE or PROT_NUMA mapped page.
452+ */
453+ bool tlb_flush_pending;
445454 #endif
446455 struct uprobes_state uprobes_state;
447456 };
@@ -459,4 +468,45 @@ static inline cpumask_t *mm_cpumask(struct mm_struct *mm) · 11 unmodified lines
459468 return mm->cpu_vm_mask_var;
460469 }
461470
471+#if defined(CONFIG_NUMA_BALANCING) || defined(CONFIG_COMPACTION)
472+/*
473+ * Memory barriers to keep this state in sync are graciously provided by
474+ * the page table locks, outside of which no page table modifications happen.
475+ * The barriers below prevent the compiler from re-ordering the instructions
476+ * around the memory barriers that are already present in the code.
477+ */
478+static inline bool mm_tlb_flush_pending(struct mm_struct *mm)
479+{
480+ barrier();
481+ return mm->tlb_flush_pending;
482+}
483+static inline void set_tlb_flush_pending(struct mm_struct *mm)
484+{
485+ mm->tlb_flush_pending = true;
486+
487+ /*
488+ * Guarantee that the tlb_flush_pending store does not leak into the
489+ * critical section updating the page tables
490+ */
491+ smp_mb__before_spinlock();
492+}
493+/* Clearing is done after a TLB flush, which also provides a barrier. */
494+static inline void clear_tlb_flush_pending(struct mm_struct *mm)
495+{
496+ barrier();
497+ mm->tlb_flush_pending = false;
498+}
499+#else
500+static inline bool mm_tlb_flush_pending(struct mm_struct *mm)
501+{
502+ return false;
503+}
504+static inline void set_tlb_flush_pending(struct mm_struct *mm)
505+{
506+}
507+static inline void clear_tlb_flush_pending(struct mm_struct *mm)
508+{
509+}
510+#endif
511+
462512 #endif /* _LINUX_MM_TYPES_H */
include/linux/netdevice.h+30−4
@@ -769,7 +769,8 @@ struct netdev_phys_port_id { · 768 unmodified lines
769769 * (can also return NETDEV_TX_LOCKED iff NETIF_F_LLTX)
770770 * Required can not be NULL.
771771 *
772− * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb);
772+ * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb,
773+ * void *accel_priv);
773774 * Called to decide which queue to when device supports multiple
774775 * transmit queues.
775776 *
@@ -990,7 +991,8 @@ struct net_device_ops { · 214 unmodified lines
990991 netdev_tx_t (*ndo_start_xmit) (struct sk_buff *skb,
991992 struct net_device *dev);
992993 u16 (*ndo_select_queue)(struct net_device *dev,
993− struct sk_buff *skb);
994+ struct sk_buff *skb,
995+ void *accel_priv);
994996 void (*ndo_change_rx_flags)(struct net_device *dev,
995997 int flags);
996998 void (*ndo_set_rx_mode)(struct net_device *dev);
@@ -1529,7 +1531,8 @@ static inline void netdev_for_each_tx_queue(struct net_device *dev, · 532 unmodified lines
15291531 }
15301532
15311533 struct netdev_queue *netdev_pick_tx(struct net_device *dev,
1532− struct sk_buff *skb);
1534+ struct sk_buff *skb,
1535+ void *accel_priv);
15331536 u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb);
15341537
15351538 /*
@@ -1819,6 +1822,7 @@ int dev_close(struct net_device *dev); · 283 unmodified lines
18191822 void dev_disable_lro(struct net_device *dev);
18201823 int dev_loopback_xmit(struct sk_buff *newskb);
18211824 int dev_queue_xmit(struct sk_buff *skb);
1825+int dev_queue_xmit_accel(struct sk_buff *skb, void *accel_priv);
18221826 int register_netdevice(struct net_device *dev);
18231827 void unregister_netdevice_queue(struct net_device *dev, struct list_head *head);
18241828 void unregister_netdevice_many(struct list_head *head);
@@ -1912,6 +1916,15 @@ static inline int dev_parse_header(const struct sk_buff *skb, · 87 unmodified lines
19121916 return dev->header_ops->parse(skb, haddr);
19131917 }
19141918
1919+static inline int dev_rebuild_header(struct sk_buff *skb)
1920+{
1921+ const struct net_device *dev = skb->dev;
1922+
1923+ if (!dev->header_ops || !dev->header_ops->rebuild)
1924+ return 0;
1925+ return dev->header_ops->rebuild(skb);
1926+}
1927+
19151928 typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len);
19161929 int register_gifconf(unsigned int family, gifconf_func_t *gifconf);
19171930 static inline int unregister_gifconf(unsigned int family)
@@ -2417,7 +2430,7 @@ int dev_change_carrier(struct net_device *, bool new_carrier); · 499 unmodified lines
24172430 int dev_get_phys_port_id(struct net_device *dev,
24182431 struct netdev_phys_port_id *ppid);
24192432 int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2420− struct netdev_queue *txq, void *accel_priv);
2433+ struct netdev_queue *txq);
24212434 int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
24222435
24232436 extern int netdev_budget;
@@ -3008,6 +3021,19 @@ static inline void netif_set_gso_max_size(struct net_device *dev, · 584 unmodified lines
30083021 dev->gso_max_size = size;
30093022 }
30103023
3024+static inline void skb_gso_error_unwind(struct sk_buff *skb, __be16 protocol,
3025+ int pulled_hlen, u16 mac_offset,
3026+ int mac_len)
3027+{
3028+ skb->protocol = protocol;
3029+ skb->encapsulation = 1;
3030+ skb_push(skb, pulled_hlen);
3031+ skb_reset_transport_header(skb);
3032+ skb->mac_header = mac_offset;
3033+ skb->network_header = skb->mac_header + mac_len;
3034+ skb->mac_len = mac_len;
3035+}
3036+
30113037 static inline bool netif_is_macvlan(struct net_device *dev)
30123038 {
30133039 return dev->priv_flags & IFF_MACVLAN;
include/linux/percpu-defs.h+1−0
@@ -69,6 +69,7 @@ · 68 unmodified lines
6969 __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \
7070 extern __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \
7171 __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \
72+ extern __PCPU_ATTRS(sec) __typeof__(type) name; \
7273 __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES __weak \
7374 __typeof__(type) name
7475 #else
include/linux/pstore.h+3−0
@@ -51,6 +51,7 @@ struct pstore_info { · 50 unmodified lines
5151 char *buf;
5252 size_t bufsize;
5353 struct mutex read_mutex; /* serialize open/read/close */
54+ int flags;
5455 int (*open)(struct pstore_info *psi);
5556 int (*close)(struct pstore_info *psi);
5657 ssize_t (*read)(u64 *id, enum pstore_type_id *type,
@@ -70,6 +71,8 @@ struct pstore_info { · 13 unmodified lines
7071 void *data;
7172 };
7273
74+#define PSTORE_FLAGS_FRAGILE 1
75+
7376 #ifdef CONFIG_PSTORE
7477 extern int pstore_register(struct pstore_info *);
7578 extern bool pstore_cannot_block_path(enum kmsg_dump_reason reason);
include/linux/reboot.h+1−0
@@ -43,6 +43,7 @@ extern int unregister_reboot_notifier(struct notifier_block *); · 42 unmodified lines
4343 * Architecture-specific implementations of sys_reboot commands.
4444 */
4545
46+extern void migrate_to_reboot_cpu(void);
4647 extern void machine_restart(char *cmd);
4748 extern void machine_halt(void);
4849 extern void machine_power_off(void);
include/linux/rtnetlink.h+5−0
@@ -24,6 +24,11 @@ extern int rtnl_trylock(void); · 23 unmodified lines
2424 extern int rtnl_is_locked(void);
2525 #ifdef CONFIG_PROVE_LOCKING
2626 extern int lockdep_rtnl_is_held(void);
27+#else
28+static inline int lockdep_rtnl_is_held(void)
29+{
30+ return 1;
31+}
2732 #endif /* #ifdef CONFIG_PROVE_LOCKING */
2833
2934 /**
include/linux/sched.h+2−3
@@ -440,8 +440,6 @@ struct task_cputime { · 439 unmodified lines
440440 .sum_exec_runtime = 0, \
441441 }
442442
443−#define PREEMPT_ENABLED (PREEMPT_NEED_RESCHED)
444−
445443 #ifdef CONFIG_PREEMPT_COUNT
446444 #define PREEMPT_DISABLED (1 + PREEMPT_ENABLED)
447445 #else
@@ -932,7 +930,8 @@ struct pipe_inode_info; · 484 unmodified lines
932930 struct uts_namespace;
933931
934932 struct load_weight {
935− unsigned long weight, inv_weight;
933+ unsigned long weight;
934+ u32 inv_weight;
936935 };
937936
938937 struct sched_avg {
include/linux/seqlock.h+19−8
@@ -117,15 +117,15 @@ repeat: · 116 unmodified lines
117117 }
118118
119119 /**
120− * read_seqcount_begin_no_lockdep - start seq-read critical section w/o lockdep
120+ * raw_read_seqcount_begin - start seq-read critical section w/o lockdep
121121 * @s: pointer to seqcount_t
122122 * Returns: count to be passed to read_seqcount_retry
123123 *
124− * read_seqcount_begin_no_lockdep opens a read critical section of the given
124+ * raw_read_seqcount_begin opens a read critical section of the given
125125 * seqcount, but without any lockdep checking. Validity of the critical
126126 * section is tested by checking read_seqcount_retry function.
127127 */
128−static inline unsigned read_seqcount_begin_no_lockdep(const seqcount_t *s)
128+static inline unsigned raw_read_seqcount_begin(const seqcount_t *s)
129129 {
130130 unsigned ret = __read_seqcount_begin(s);
131131 smp_rmb();
@@ -144,7 +144,7 @@ static inline unsigned read_seqcount_begin_no_lockdep(const seqcount_t *s) · 12 unmodified lines
144144 static inline unsigned read_seqcount_begin(const seqcount_t *s)
145145 {
146146 seqcount_lockdep_reader_access(s);
147− return read_seqcount_begin_no_lockdep(s);
147+ return raw_read_seqcount_begin(s);
148148 }
149149
150150 /**
@@ -206,14 +206,26 @@ static inline int read_seqcount_retry(const seqcount_t *s, unsigned start) · 55 unmodified lines
206206 }
207207
208208
209+
210+static inline void raw_write_seqcount_begin(seqcount_t *s)
211+{
212+ s->sequence++;
213+ smp_wmb();
214+}
215+
216+static inline void raw_write_seqcount_end(seqcount_t *s)
217+{
218+ smp_wmb();
219+ s->sequence++;
220+}
221+
209222 /*
210223 * Sequence counter only version assumes that callers are using their
211224 * own mutexing.
212225 */
213226 static inline void write_seqcount_begin_nested(seqcount_t *s, int subclass)
214227 {
215− s->sequence++;
216− smp_wmb();
228+ raw_write_seqcount_begin(s);
217229 seqcount_acquire(&s->dep_map, subclass, 0, _RET_IP_);
218230 }
219231
@@ -225,8 +237,7 @@ static inline void write_seqcount_begin(seqcount_t *s) · 5 unmodified lines
225237 static inline void write_seqcount_end(seqcount_t *s)
226238 {
227239 seqcount_release(&s->dep_map, 1, _RET_IP_);
228− smp_wmb();
229− s->sequence++;
240+ raw_write_seqcount_end(s);
230241 }
231242
232243 /**
include/linux/skbuff.h+9−0
@@ -1638,6 +1638,11 @@ static inline void skb_set_mac_header(struct sk_buff *skb, const int offset) · 1637 unmodified lines
16381638 skb->mac_header += offset;
16391639 }
16401640
1641+static inline void skb_pop_mac_header(struct sk_buff *skb)
1642+{
1643+ skb->mac_header = skb->network_header;
1644+}
1645+
16411646 static inline void skb_probe_transport_header(struct sk_buff *skb,
16421647 const int offset_hint)
16431648 {
@@ -2526,6 +2531,10 @@ static inline void sw_tx_timestamp(struct sk_buff *skb) · 882 unmodified lines
25262531 * Ethernet MAC Drivers should call this function in their hard_xmit()
25272532 * function immediately before giving the sk_buff to the MAC hardware.
25282533 *
2534+ * Specifically, one should make absolutely sure that this function is
2535+ * called before TX completion of this packet can trigger. Otherwise
2536+ * the packet could potentially already be freed.
2537+ *
25292538 * @skb: A socket buffer.
25302539 */
25312540 static inline void skb_tx_timestamp(struct sk_buff *skb)
include/net/llc_pdu.h+1−1
@@ -142,7 +142,7 @@ · 141 unmodified lines
142142 #define LLC_S_PF_IS_1(pdu) ((pdu->ctrl_2 & LLC_S_PF_BIT_MASK) ? 1 : 0)
143143
144144 #define PDU_SUPV_GET_Nr(pdu) ((pdu->ctrl_2 & 0xFE) >> 1)
145−#define PDU_GET_NEXT_Vr(sn) (++sn & ~LLC_2_SEQ_NBR_MODULO)
145+#define PDU_GET_NEXT_Vr(sn) (((sn) + 1) & ~LLC_2_SEQ_NBR_MODULO)
146146
147147 /* FRMR information field macros */
148148
include/net/sctp/structs.h+0−3
@@ -1046,9 +1046,6 @@ struct sctp_outq { · 1045 unmodified lines
10461046
10471047 /* Corked? */
10481048 char cork;
1049−
1050− /* Is this structure empty? */
1051− char empty;
10521049 };
10531050
10541051 void sctp_outq_init(struct sctp_association *, struct sctp_outq *);
include/rdma/ib_verbs.h+1−1
@@ -978,7 +978,7 @@ struct ib_uobject { · 977 unmodified lines
978978 };
979979
980980 struct ib_udata {
981− void __user *inbuf;
981+ const void __user *inbuf;
982982 void __user *outbuf;
983983 size_t inlen;
984984 size_t outlen;
include/target/target_core_base.h+1−4
@@ -517,10 +517,6 @@ struct se_node_acl { · 516 unmodified lines
517517 u32 acl_index;
518518 #define MAX_ACL_TAG_SIZE 64
519519 char acl_tag[MAX_ACL_TAG_SIZE];
520− u64 num_cmds;
521− u64 read_bytes;
522− u64 write_bytes;
523− spinlock_t stats_lock;
524520 /* Used for PR SPEC_I_PT=1 and REGISTER_AND_MOVE */
525521 atomic_t acl_pr_ref_count;
526522 struct se_dev_entry **device_list;
@@ -624,6 +620,7 @@ struct se_dev_attrib { · 97 unmodified lines
624620 u32 unmap_granularity;
625621 u32 unmap_granularity_alignment;
626622 u32 max_write_same_len;
623+ u32 max_bytes_per_io;
627624 struct se_device *da_dev;
628625 struct config_group da_group;
629626 };
include/uapi/drm/radeon_drm.h+2−0
@@ -983,6 +983,8 @@ struct drm_radeon_cs { · 982 unmodified lines
983983 #define RADEON_INFO_SI_CP_DMA_COMPUTE 0x17
984984 /* CIK macrotile mode array */
985985 #define RADEON_INFO_CIK_MACROTILE_MODE_ARRAY 0x18
986+/* query the number of render backends */
987+#define RADEON_INFO_SI_BACKEND_ENABLED_MASK 0x19
986988
987989
988990 struct drm_radeon_info {
include/uapi/drm/vmwgfx_drm.h+1−0
@@ -75,6 +75,7 @@ · 74 unmodified lines
7575 #define DRM_VMW_PARAM_FIFO_CAPS 4
7676 #define DRM_VMW_PARAM_MAX_FB_SIZE 5
7777 #define DRM_VMW_PARAM_FIFO_HW_VERSION 6
78+#define DRM_VMW_PARAM_MAX_SURF_MEMORY 7
7879
7980 /**
8081 * struct drm_vmw_getparam_arg
include/uapi/linux/input.h+2−1
@@ -464,7 +464,8 @@ struct input_keymap_entry { · 463 unmodified lines
464464 #define KEY_BRIGHTNESS_ZERO 244 /* brightness off, use ambient */
465465 #define KEY_DISPLAY_OFF 245 /* display device to off state */
466466
467−#define KEY_WIMAX 246
467+#define KEY_WWAN 246 /* Wireless WAN (LTE, UMTS, GSM, etc.) */
468+#define KEY_WIMAX KEY_WWAN
468469 #define KEY_RFKILL 247 /* Key that controls all radios */
469470
470471 #define KEY_MICMUTE 248 /* Mute / unmute the microphone */
include/uapi/linux/perf_event.h+1−0
@@ -679,6 +679,7 @@ enum perf_event_type { · 678 unmodified lines
679679 *
680680 * { u64 weight; } && PERF_SAMPLE_WEIGHT
681681 * { u64 data_src; } && PERF_SAMPLE_DATA_SRC
682+ * { u64 transaction; } && PERF_SAMPLE_TRANSACTION
682683 * };
683684 */
684685 PERF_RECORD_SAMPLE = 9,
include/xen/interface/io/blkif.h+5−5
@@ -146,7 +146,7 @@ struct blkif_request_segment_aligned { · 145 unmodified lines
146146 struct blkif_request_rw {
147147 uint8_t nr_segments; /* number of segments */
148148 blkif_vdev_t handle; /* only for read/write requests */
149−#ifdef CONFIG_X86_64
149+#ifndef CONFIG_X86_32
150150 uint32_t _pad1; /* offsetof(blkif_request,u.rw.id) == 8 */
151151 #endif
152152 uint64_t id; /* private guest value, echoed in resp */
@@ -163,7 +163,7 @@ struct blkif_request_discard { · 10 unmodified lines
163163 uint8_t flag; /* BLKIF_DISCARD_SECURE or zero. */
164164 #define BLKIF_DISCARD_SECURE (1<<0) /* ignored if discard-secure=0 */
165165 blkif_vdev_t _pad1; /* only for read/write requests */
166−#ifdef CONFIG_X86_64
166+#ifndef CONFIG_X86_32
167167 uint32_t _pad2; /* offsetof(blkif_req..,u.discard.id)==8*/
168168 #endif
169169 uint64_t id; /* private guest value, echoed in resp */
@@ -175,7 +175,7 @@ struct blkif_request_discard { · 5 unmodified lines
175175 struct blkif_request_other {
176176 uint8_t _pad1;
177177 blkif_vdev_t _pad2; /* only for read/write requests */
178−#ifdef CONFIG_X86_64
178+#ifndef CONFIG_X86_32
179179 uint32_t _pad3; /* offsetof(blkif_req..,u.other.id)==8*/
180180 #endif
181181 uint64_t id; /* private guest value, echoed in resp */
@@ -184,7 +184,7 @@ struct blkif_request_other { · 2 unmodified lines
184184 struct blkif_request_indirect {
185185 uint8_t indirect_op;
186186 uint16_t nr_segments;
187−#ifdef CONFIG_X86_64
187+#ifndef CONFIG_X86_32
188188 uint32_t _pad1; /* offsetof(blkif_...,u.indirect.id) == 8 */
189189 #endif
190190 uint64_t id;
@@ -192,7 +192,7 @@ struct blkif_request_indirect { · 1 unmodified line
192192 blkif_vdev_t handle;
193193 uint16_t _pad2;
194194 grant_ref_t indirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST];
195−#ifdef CONFIG_X86_64
195+#ifndef CONFIG_X86_32
196196 uint32_t _pad3; /* make it 64 byte aligned */
197197 #else
198198 uint64_t _pad3; /* make it 64 byte aligned */
init/Kconfig+6−0
@@ -809,6 +809,12 @@ config GENERIC_SCHED_CLOCK · 808 unmodified lines
809809 config ARCH_SUPPORTS_NUMA_BALANCING
810810 bool
811811
812+#
813+# For architectures that know their GCC __int128 support is sound
814+#
815+config ARCH_SUPPORTS_INT128
816+ bool
817+
812818 # For architectures that (ab)use NUMA to represent different memory regions
813819 # all cpu-local but of different latencies, such as SuperH.
814820 #
kernel/Makefile+4−3
@@ -137,9 +137,10 @@ $(obj)/timeconst.h: $(obj)/hz.bc $(src)/timeconst.bc FORCE · 136 unmodified lines
137137 ###############################################################################
138138 ifeq ($(CONFIG_SYSTEM_TRUSTED_KEYRING),y)
139139 X509_CERTIFICATES-y := $(wildcard *.x509) $(wildcard $(srctree)/*.x509)
140−X509_CERTIFICATES-$(CONFIG_MODULE_SIG) += signing_key.x509
141−X509_CERTIFICATES := $(sort $(foreach CERT,$(X509_CERTIFICATES-y), \
140+X509_CERTIFICATES-$(CONFIG_MODULE_SIG) += $(objtree)/signing_key.x509
141+X509_CERTIFICATES-raw := $(sort $(foreach CERT,$(X509_CERTIFICATES-y), \
142142 $(or $(realpath $(CERT)),$(CERT))))
143+X509_CERTIFICATES := $(subst $(realpath $(objtree))/,,$(X509_CERTIFICATES-raw))
143144
144145 ifeq ($(X509_CERTIFICATES),)
145146 $(warning *** No X.509 certificates found ***)
@@ -164,9 +165,9 @@ $(obj)/x509_certificate_list: $(X509_CERTIFICATES) $(obj)/.x509.list · 18 unmodified lines
164165 targets += $(obj)/.x509.list
165166 $(obj)/.x509.list:
166167 @echo $(X509_CERTIFICATES) >$@
168+endif
167169
168170 clean-files := x509_certificate_list .x509.list
169−endif
170171
171172 ifeq ($(CONFIG_MODULE_SIG),y)
172173 ###############################################################################
kernel/bounds.c+1−1
@@ -22,6 +22,6 @@ void foo(void) · 21 unmodified lines
2222 #ifdef CONFIG_SMP
2323 DEFINE(NR_CPUS_BITS, ilog2(CONFIG_NR_CPUS));
2424 #endif
25− DEFINE(BLOATED_SPINLOCKS, sizeof(spinlock_t) > sizeof(int));
25+ DEFINE(SPINLOCK_SIZE, sizeof(spinlock_t));
2626 /* End of constants */
2727 }
kernel/cgroup.c+32−18
@@ -890,6 +890,16 @@ static void cgroup_diput(struct dentry *dentry, struct inode *inode) · 889 unmodified lines
890890 struct cgroup *cgrp = dentry->d_fsdata;
891891
892892 BUG_ON(!(cgroup_is_dead(cgrp)));
893+
894+ /*
895+ * XXX: cgrp->id is only used to look up css's. As cgroup
896+ * and css's lifetimes will be decoupled, it should be made
897+ * per-subsystem and moved to css->id so that lookups are
898+ * successful until the target css is released.
899+ */
900+ idr_remove(&cgrp->root->cgroup_idr, cgrp->id);
901+ cgrp->id = -1;
902+
893903 call_rcu(&cgrp->rcu_head, cgroup_free_rcu);
894904 } else {
895905 struct cfent *cfe = __d_cfe(dentry);
@@ -4268,6 +4278,7 @@ static void css_release(struct percpu_ref *ref) · 3372 unmodified lines
42684278 struct cgroup_subsys_state *css =
42694279 container_of(ref, struct cgroup_subsys_state, refcnt);
42704280
4281+ rcu_assign_pointer(css->cgroup->subsys[css->ss->subsys_id], NULL);
42714282 call_rcu(&css->rcu_head, css_free_rcu_fn);
42724283 }
42734284
@@ -4426,14 +4437,6 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry, · 152 unmodified lines
44264437 list_add_tail_rcu(&cgrp->sibling, &cgrp->parent->children);
44274438 root->number_of_cgroups++;
44284439
4429− /* each css holds a ref to the cgroup's dentry and the parent css */
4430− for_each_root_subsys(root, ss) {
4431− struct cgroup_subsys_state *css = css_ar[ss->subsys_id];
4432−
4433− dget(dentry);
4434− css_get(css->parent);
4435− }
4436−
44374440 /* hold a ref to the parent's dentry */
44384441 dget(parent->dentry);
44394442
@@ -4445,6 +4448,13 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry, · 5 unmodified lines
44454448 if (err)
44464449 goto err_destroy;
44474450
4451+ /* each css holds a ref to the cgroup's dentry and parent css */
4452+ dget(dentry);
4453+ css_get(css->parent);
4454+
4455+ /* mark it consumed for error path */
4456+ css_ar[ss->subsys_id] = NULL;
4457+
44484458 if (ss->broken_hierarchy && !ss->warned_broken_hierarchy &&
44494459 parent->parent) {
44504460 pr_warning("cgroup: %s (%d) created nested cgroup for controller \"%s\" which has incomplete hierarchy support. Nested cgroups may change behavior in the future.\n",
@@ -4491,6 +4501,14 @@ err_free_cgrp: · 40 unmodified lines
44914501 return err;
44924502
44934503 err_destroy:
4504+ for_each_root_subsys(root, ss) {
4505+ struct cgroup_subsys_state *css = css_ar[ss->subsys_id];
4506+
4507+ if (css) {
4508+ percpu_ref_cancel_init(&css->refcnt);
4509+ ss->css_free(css);
4510+ }
4511+ }
44944512 cgroup_destroy_locked(cgrp);
44954513 mutex_unlock(&cgroup_mutex);
44964514 mutex_unlock(&dentry->d_inode->i_mutex);
@@ -4652,8 +4670,12 @@ static int cgroup_destroy_locked(struct cgroup *cgrp) · 155 unmodified lines
46524670 * will be invoked to perform the rest of destruction once the
46534671 * percpu refs of all css's are confirmed to be killed.
46544672 */
4655− for_each_root_subsys(cgrp->root, ss)
4656− kill_css(cgroup_css(cgrp, ss));
4673+ for_each_root_subsys(cgrp->root, ss) {
4674+ struct cgroup_subsys_state *css = cgroup_css(cgrp, ss);
4675+
4676+ if (css)
4677+ kill_css(css);
4678+ }
46574679
46584680 /*
46594681 * Mark @cgrp dead. This prevents further task migration and child
@@ -4722,14 +4744,6 @@ static void cgroup_destroy_css_killed(struct cgroup *cgrp) · 62 unmodified lines
47224744 /* delete this cgroup from parent->children */
47234745 list_del_rcu(&cgrp->sibling);
47244746
4725− /*
4726− * We should remove the cgroup object from idr before its grace
4727− * period starts, so we won't be looking up a cgroup while the
4728− * cgroup is being freed.
4729− */
4730− idr_remove(&cgrp->root->cgroup_idr, cgrp->id);
4731− cgrp->id = -1;
4732−
47334747 dput(d);
47344748
47354749 set_bit(CGRP_RELEASABLE, &parent->flags);
kernel/events/core.c+18−3
@@ -1397,6 +1397,8 @@ event_sched_out(struct perf_event *event, · 1396 unmodified lines
13971397 if (event->state != PERF_EVENT_STATE_ACTIVE)
13981398 return;
13991399
1400+ perf_pmu_disable(event->pmu);
1401+
14001402 event->state = PERF_EVENT_STATE_INACTIVE;
14011403 if (event->pending_disable) {
14021404 event->pending_disable = 0;
@@ -1413,6 +1415,8 @@ event_sched_out(struct perf_event *event, · 10 unmodified lines
14131415 ctx->nr_freq--;
14141416 if (event->attr.exclusive || !cpuctx->active_oncpu)
14151417 cpuctx->exclusive = 0;
1418+
1419+ perf_pmu_enable(event->pmu);
14161420 }
14171421
14181422 static void
@@ -1653,6 +1657,7 @@ event_sched_in(struct perf_event *event, · 234 unmodified lines
16531657 struct perf_event_context *ctx)
16541658 {
16551659 u64 tstamp = perf_event_time(event);
1660+ int ret = 0;
16561661
16571662 if (event->state <= PERF_EVENT_STATE_OFF)
16581663 return 0;
@@ -1675,10 +1680,13 @@ event_sched_in(struct perf_event *event, · 16 unmodified lines
16751680 */
16761681 smp_wmb();
16771682
1683+ perf_pmu_disable(event->pmu);
1684+
16781685 if (event->pmu->add(event, PERF_EF_START)) {
16791686 event->state = PERF_EVENT_STATE_INACTIVE;
16801687 event->oncpu = -1;
1681− return -EAGAIN;
1688+ ret = -EAGAIN;
1689+ goto out;
16821690 }
16831691
16841692 event->tstamp_running += tstamp - event->tstamp_stopped;
@@ -1694,7 +1702,10 @@ event_sched_in(struct perf_event *event, · 9 unmodified lines
16941702 if (event->attr.exclusive)
16951703 cpuctx->exclusive = 1;
16961704
1697− return 0;
1705+out:
1706+ perf_pmu_enable(event->pmu);
1707+
1708+ return ret;
16981709 }
16991710
17001711 static int
@@ -2744,6 +2755,8 @@ static void perf_adjust_freq_unthr_context(struct perf_event_context *ctx, · 1043 unmodified lines
27442755 if (!event_filter_match(event))
27452756 continue;
27462757
2758+ perf_pmu_disable(event->pmu);
2759+
27472760 hwc = &event->hw;
27482761
27492762 if (hwc->interrupts == MAX_INTERRUPTS) {
@@ -2753,7 +2766,7 @@ static void perf_adjust_freq_unthr_context(struct perf_event_context *ctx, · 3 unmodified lines
27532766 }
27542767
27552768 if (!event->attr.freq || !event->attr.sample_freq)
2756− continue;
2769+ goto next;
27572770
27582771 /*
27592772 * stop the event and update event->count
@@ -2775,6 +2788,8 @@ static void perf_adjust_freq_unthr_context(struct perf_event_context *ctx, · 15 unmodified lines
27752788 perf_adjust_period(event, period, delta, false);
27762789
27772790 event->pmu->start(event, delta > 0 ? PERF_EF_RELOAD : 0);
2791+ next:
2792+ perf_pmu_enable(event->pmu);
27782793 }
27792794
27802795 perf_pmu_enable(ctx->pmu);
kernel/fork.c+1−0
@@ -537,6 +537,7 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p) · 536 unmodified lines
537537 spin_lock_init(&mm->page_table_lock);
538538 mm_init_aio(mm);
539539 mm_init_owner(mm, p);
540+ clear_tlb_flush_pending(mm);
540541
541542 if (likely(!mm_alloc_pgd(mm))) {
542543 mm->def_flags = 0;
kernel/freezer.c+6−0
@@ -19,6 +19,12 @@ EXPORT_SYMBOL(system_freezing_cnt); · 18 unmodified lines
1919 bool pm_freezing;
2020 bool pm_nosig_freezing;
2121
22+/*
23+ * Temporary export for the deadlock workaround in ata_scsi_hotplug().
24+ * Remove once the hack becomes unnecessary.
25+ */
26+EXPORT_SYMBOL_GPL(pm_freezing);
27+
2228 /* protects freezing and frozen transitions */
2329 static DEFINE_SPINLOCK(freezer_lock);
2430
kernel/kexec.c+1−0
@@ -1680,6 +1680,7 @@ int kernel_kexec(void) · 1679 unmodified lines
16801680 {
16811681 kexec_in_progress = true;
16821682 kernel_restart_prepare(NULL);
1683+ migrate_to_reboot_cpu();
16831684 printk(KERN_EMERG "Starting new kernel\n");
16841685 machine_shutdown();
16851686 }
kernel/power/console.c+1−0
@@ -81,6 +81,7 @@ void pm_vt_switch_unregister(struct device *dev) · 80 unmodified lines
8181 list_for_each_entry(tmp, &pm_vt_switch_list, head) {
8282 if (tmp->dev == dev) {
8383 list_del(&tmp->head);
84+ kfree(tmp);
8485 break;
8586 }
8687 }
kernel/reboot.c+1−1
@@ -104,7 +104,7 @@ int unregister_reboot_notifier(struct notifier_block *nb) · 103 unmodified lines
104104 }
105105 EXPORT_SYMBOL(unregister_reboot_notifier);
106106
107−static void migrate_to_reboot_cpu(void)
107+void migrate_to_reboot_cpu(void)
108108 {
109109 /* The boot cpu is always logical cpu 0 */
110110 int cpu = reboot_cpu;
kernel/sched/core.c+4−2
@@ -4902,6 +4902,7 @@ DEFINE_PER_CPU(struct sched_domain *, sd_asym); · 4901 unmodified lines
49024902 static void update_top_cache_domain(int cpu)
49034903 {
49044904 struct sched_domain *sd;
4905+ struct sched_domain *busy_sd = NULL;
49054906 int id = cpu;
49064907 int size = 1;
49074908
@@ -4909,9 +4910,9 @@ static void update_top_cache_domain(int cpu) · 1 unmodified line
49094910 if (sd) {
49104911 id = cpumask_first(sched_domain_span(sd));
49114912 size = cpumask_weight(sched_domain_span(sd));
4912− sd = sd->parent; /* sd_busy */
4913+ busy_sd = sd->parent; /* sd_busy */
49134914 }
4914− rcu_assign_pointer(per_cpu(sd_busy, cpu), sd);
4915+ rcu_assign_pointer(per_cpu(sd_busy, cpu), busy_sd);
49154916
49164917 rcu_assign_pointer(per_cpu(sd_llc, cpu), sd);
49174918 per_cpu(sd_llc_size, cpu) = size;
@@ -5112,6 +5113,7 @@ build_overlap_sched_groups(struct sched_domain *sd, int cpu) · 194 unmodified lines
51125113 * die on a /0 trap.
51135114 */
51145115 sg->sgp->power = SCHED_POWER_SCALE * cpumask_weight(sg_span);
5116+ sg->sgp->power_orig = sg->sgp->power;
51155117
51165118 /*
51175119 * Make sure the first group of this domain contains the
kernel/sched/fair.c+72−81
@@ -178,59 +178,61 @@ void sched_init_granularity(void) · 177 unmodified lines
178178 update_sysctl();
179179 }
180180
181−#if BITS_PER_LONG == 32
182−# define WMULT_CONST (~0UL)
183−#else
184−# define WMULT_CONST (1UL << 32)
185−#endif
186−
181+#define WMULT_CONST (~0U)
187182 #define WMULT_SHIFT 32
188183
189−/*
190− * Shift right and round:
191− */
192−#define SRR(x, y) (((x) + (1UL << ((y) - 1))) >> (y))
184+static void __update_inv_weight(struct load_weight *lw)
185+{
186+ unsigned long w;
187+
188+ if (likely(lw->inv_weight))
189+ return;
190+
191+ w = scale_load_down(lw->weight);
192+
193+ if (BITS_PER_LONG > 32 && unlikely(w >= WMULT_CONST))
194+ lw->inv_weight = 1;
195+ else if (unlikely(!w))
196+ lw->inv_weight = WMULT_CONST;
197+ else
198+ lw->inv_weight = WMULT_CONST / w;
199+}
193200
194201 /*
195− * delta *= weight / lw
202+ * delta_exec * weight / lw.weight
203+ * OR
204+ * (delta_exec * (weight * lw->inv_weight)) >> WMULT_SHIFT
205+ *
206+ * Either weight := NICE_0_LOAD and lw \e prio_to_wmult[], in which case
207+ * we're guaranteed shift stays positive because inv_weight is guaranteed to
208+ * fit 32 bits, and NICE_0_LOAD gives another 10 bits; therefore shift >= 22.
209+ *
210+ * Or, weight =< lw.weight (because lw.weight is the runqueue weight), thus
211+ * weight/lw.weight <= 1, and therefore our shift will also be positive.
196212 */
197−static unsigned long
198−calc_delta_mine(unsigned long delta_exec, unsigned long weight,
199− struct load_weight *lw)
213+static u64 __calc_delta(u64 delta_exec, unsigned long weight, struct load_weight *lw)
200214 {
201− u64 tmp;
202−
203− /*
204− * weight can be less than 2^SCHED_LOAD_RESOLUTION for task group sched
205− * entities since MIN_SHARES = 2. Treat weight as 1 if less than
206− * 2^SCHED_LOAD_RESOLUTION.
207− */
208− if (likely(weight > (1UL << SCHED_LOAD_RESOLUTION)))
209− tmp = (u64)delta_exec * scale_load_down(weight);
210− else
211− tmp = (u64)delta_exec;
215+ u64 fact = scale_load_down(weight);
216+ int shift = WMULT_SHIFT;
212217
213− if (!lw->inv_weight) {
214− unsigned long w = scale_load_down(lw->weight);
218+ __update_inv_weight(lw);
215219
216− if (BITS_PER_LONG > 32 && unlikely(w >= WMULT_CONST))
217− lw->inv_weight = 1;
218− else if (unlikely(!w))
219− lw->inv_weight = WMULT_CONST;
220− else
221− lw->inv_weight = WMULT_CONST / w;
220+ if (unlikely(fact >> 32)) {
221+ while (fact >> 32) {
222+ fact >>= 1;
223+ shift--;
224+ }
222225 }
223226
224− /*
225− * Check whether we'd overflow the 64-bit multiplication:
226− */
227− if (unlikely(tmp > WMULT_CONST))
228− tmp = SRR(SRR(tmp, WMULT_SHIFT/2) * lw->inv_weight,
229− WMULT_SHIFT/2);
230− else
231− tmp = SRR(tmp * lw->inv_weight, WMULT_SHIFT);
227+ /* hint to use a 32x32->64 mul */
228+ fact = (u64)(u32)fact * lw->inv_weight;
229+
230+ while (fact >> 32) {
231+ fact >>= 1;
232+ shift--;
233+ }
232234
233− return (unsigned long)min(tmp, (u64)(unsigned long)LONG_MAX);
235+ return mul_u64_u32_shr(delta_exec, fact, shift);
234236 }
235237
236238
@@ -443,7 +445,7 @@ find_matching_se(struct sched_entity **se, struct sched_entity **pse) · 206 unmodified lines
443445 #endif /* CONFIG_FAIR_GROUP_SCHED */
444446
445447 static __always_inline
446−void account_cfs_rq_runtime(struct cfs_rq *cfs_rq, unsigned long delta_exec);
448+void account_cfs_rq_runtime(struct cfs_rq *cfs_rq, u64 delta_exec);
447449
448450 /**************************************************************
449451 * Scheduling class tree data structure manipulation methods:
@@ -612,11 +614,10 @@ int sched_proc_update_handler(struct ctl_table *table, int write, · 162 unmodified lines
612614 /*
613615 * delta /= w
614616 */
615−static inline unsigned long
616−calc_delta_fair(unsigned long delta, struct sched_entity *se)
617+static inline u64 calc_delta_fair(u64 delta, struct sched_entity *se)
617618 {
618619 if (unlikely(se->load.weight != NICE_0_LOAD))
619− delta = calc_delta_mine(delta, NICE_0_LOAD, &se->load);
620+ delta = __calc_delta(delta, NICE_0_LOAD, &se->load);
620621
621622 return delta;
622623 }
@@ -665,7 +666,7 @@ static u64 sched_slice(struct cfs_rq *cfs_rq, struct sched_entity *se) · 42 unmodified lines
665666 update_load_add(&lw, se->load.weight);
666667 load = &lw;
667668 }
668− slice = calc_delta_mine(slice, se->load.weight, load);
669+ slice = __calc_delta(slice, se->load.weight, load);
669670 }
670671 return slice;
671672 }
@@ -703,47 +704,32 @@ void init_task_runnable_average(struct task_struct *p) · 31 unmodified lines
703704 #endif
704705
705706 /*
706− * Update the current task's runtime statistics. Skip current tasks that
707− * are not in our scheduling class.
707+ * Update the current task's runtime statistics.
708708 */
709−static inline void
710−__update_curr(struct cfs_rq *cfs_rq, struct sched_entity *curr,
711− unsigned long delta_exec)
712−{
713− unsigned long delta_exec_weighted;
714−
715− schedstat_set(curr->statistics.exec_max,
716− max((u64)delta_exec, curr->statistics.exec_max));
717−
718− curr->sum_exec_runtime += delta_exec;
719− schedstat_add(cfs_rq, exec_clock, delta_exec);
720− delta_exec_weighted = calc_delta_fair(delta_exec, curr);
721−
722− curr->vruntime += delta_exec_weighted;
723− update_min_vruntime(cfs_rq);
724−}
725−
726709 static void update_curr(struct cfs_rq *cfs_rq)
727710 {
728711 struct sched_entity *curr = cfs_rq->curr;
729712 u64 now = rq_clock_task(rq_of(cfs_rq));
730− unsigned long delta_exec;
713+ u64 delta_exec;
731714
732715 if (unlikely(!curr))
733716 return;
734717
735− /*
736− * Get the amount of time the current task was running
737− * since the last time we changed load (this cannot
738− * overflow on 32 bits):
739− */
740− delta_exec = (unsigned long)(now - curr->exec_start);
741− if (!delta_exec)
718+ delta_exec = now - curr->exec_start;
719+ if (unlikely((s64)delta_exec <= 0))
742720 return;
743721
744− __update_curr(cfs_rq, curr, delta_exec);
745722 curr->exec_start = now;
746723
724+ schedstat_set(curr->statistics.exec_max,
725+ max(delta_exec, curr->statistics.exec_max));
726+
727+ curr->sum_exec_runtime += delta_exec;
728+ schedstat_add(cfs_rq, exec_clock, delta_exec);
729+
730+ curr->vruntime += calc_delta_fair(delta_exec, curr);
731+ update_min_vruntime(cfs_rq);
732+
747733 if (entity_is_task(curr)) {
748734 struct task_struct *curtask = task_of(curr);
749735
@@ -1752,6 +1738,13 @@ void task_numa_work(struct callback_head *work) · 1002 unmodified lines
17521738 (vma->vm_file && (vma->vm_flags & (VM_READ|VM_WRITE)) == (VM_READ)))
17531739 continue;
17541740
1741+ /*
1742+ * Skip inaccessible VMAs to avoid any confusion between
1743+ * PROT_NONE and NUMA hinting ptes
1744+ */
1745+ if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)))
1746+ continue;
1747+
17551748 do {
17561749 start = max(start, vma->vm_start);
17571750 end = ALIGN(start + (pages << PAGE_SHIFT), HPAGE_SIZE);
@@ -3015,8 +3008,7 @@ static void expire_cfs_rq_runtime(struct cfs_rq *cfs_rq) · 1257 unmodified lines
30153008 }
30163009 }
30173010
3018−static void __account_cfs_rq_runtime(struct cfs_rq *cfs_rq,
3019− unsigned long delta_exec)
3011+static void __account_cfs_rq_runtime(struct cfs_rq *cfs_rq, u64 delta_exec)
30203012 {
30213013 /* dock delta_exec before expiring quota (as it could span periods) */
30223014 cfs_rq->runtime_remaining -= delta_exec;
@@ -3034,7 +3026,7 @@ static void __account_cfs_rq_runtime(struct cfs_rq *cfs_rq, · 11 unmodified lines
30343026 }
30353027
30363028 static __always_inline
3037−void account_cfs_rq_runtime(struct cfs_rq *cfs_rq, unsigned long delta_exec)
3029+void account_cfs_rq_runtime(struct cfs_rq *cfs_rq, u64 delta_exec)
30383030 {
30393031 if (!cfs_bandwidth_used() || !cfs_rq->runtime_enabled)
30403032 return;
@@ -3574,8 +3566,7 @@ static inline u64 cfs_rq_clock_task(struct cfs_rq *cfs_rq) · 533 unmodified lines
35743566 return rq_clock_task(rq_of(cfs_rq));
35753567 }
35763568
3577−static void account_cfs_rq_runtime(struct cfs_rq *cfs_rq,
3578− unsigned long delta_exec) {}
3569+static void account_cfs_rq_runtime(struct cfs_rq *cfs_rq, u64 delta_exec) {}
35793570 static void check_cfs_rq_runtime(struct cfs_rq *cfs_rq) {}
35803571 static void check_enqueue_throttle(struct cfs_rq *cfs_rq) {}
35813572 static __always_inline void return_cfs_rq_runtime(struct cfs_rq *cfs_rq) {}
@@ -3932,7 +3923,7 @@ static long effective_load(struct task_group *tg, int cpu, long wl, long wg) · 350 unmodified lines
39323923 {
39333924 struct sched_entity *se = tg->se[cpu];
39343925
3935− if (!tg->parent || !wl) /* the trivial, non-cgroup case */
3926+ if (!tg->parent) /* the trivial, non-cgroup case */
39363927 return wl;
39373928
39383929 for_each_sched_entity(se) {
kernel/sched/rt.c+14−0
@@ -901,6 +901,13 @@ inc_rt_prio_smp(struct rt_rq *rt_rq, int prio, int prev_prio) · 900 unmodified lines
901901 {
902902 struct rq *rq = rq_of_rt_rq(rt_rq);
903903
904+#ifdef CONFIG_RT_GROUP_SCHED
905+ /*
906+ * Change rq's cpupri only if rt_rq is the top queue.
907+ */
908+ if (&rq->rt != rt_rq)
909+ return;
910+#endif
904911 if (rq->online && prio < prev_prio)
905912 cpupri_set(&rq->rd->cpupri, rq->cpu, prio);
906913 }
@@ -910,6 +917,13 @@ dec_rt_prio_smp(struct rt_rq *rt_rq, int prio, int prev_prio) · 3 unmodified lines
910917 {
911918 struct rq *rq = rq_of_rt_rq(rt_rq);
912919
920+#ifdef CONFIG_RT_GROUP_SCHED
921+ /*
922+ * Change rq's cpupri only if rt_rq is the top queue.
923+ */
924+ if (&rq->rt != rt_rq)
925+ return;
926+#endif
913927 if (rq->online && rt_rq->highest_prio.curr != prev_prio)
914928 cpupri_set(&rq->rd->cpupri, rq->cpu, rt_rq->highest_prio.curr);
915929 }
kernel/time/sched_clock.c+3−3
@@ -74,7 +74,7 @@ unsigned long long notrace sched_clock(void) · 73 unmodified lines
7474 return cd.epoch_ns;
7575
7676 do {
77− seq = read_seqcount_begin(&cd.seq);
77+ seq = raw_read_seqcount_begin(&cd.seq);
7878 epoch_cyc = cd.epoch_cyc;
7979 epoch_ns = cd.epoch_ns;
8080 } while (read_seqcount_retry(&cd.seq, seq));
@@ -99,10 +99,10 @@ static void notrace update_sched_clock(void) · 18 unmodified lines
9999 cd.mult, cd.shift);
100100
101101 raw_local_irq_save(flags);
102− write_seqcount_begin(&cd.seq);
102+ raw_write_seqcount_begin(&cd.seq);
103103 cd.epoch_ns = ns;
104104 cd.epoch_cyc = cyc;
105− write_seqcount_end(&cd.seq);
105+ raw_write_seqcount_end(&cd.seq);
106106 raw_local_irq_restore(flags);
107107 }
108108
kernel/trace/ftrace.c+1−1
@@ -775,7 +775,7 @@ static int ftrace_profile_init(void) · 774 unmodified lines
775775 int cpu;
776776 int ret = 0;
777777
778− for_each_online_cpu(cpu) {
778+ for_each_possible_cpu(cpu) {
779779 ret = ftrace_profile_init_cpu(cpu);
780780 if (ret)
781781 break;
kernel/user.c+3−3
@@ -51,9 +51,9 @@ struct user_namespace init_user_ns = { · 50 unmodified lines
5151 .owner = GLOBAL_ROOT_UID,
5252 .group = GLOBAL_ROOT_GID,
5353 .proc_inum = PROC_USER_INIT_INO,
54−#ifdef CONFIG_KEYS_KERBEROS_CACHE
55− .krb_cache_register_sem =
56− __RWSEM_INITIALIZER(init_user_ns.krb_cache_register_sem),
54+#ifdef CONFIG_PERSISTENT_KEYRINGS
55+ .persistent_keyring_register_sem =
56+ __RWSEM_INITIALIZER(init_user_ns.persistent_keyring_register_sem),
5757 #endif
5858 };
5959 EXPORT_SYMBOL_GPL(init_user_ns);
lib/percpu_counter.c+2−2
@@ -82,10 +82,10 @@ void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch) · 81 unmodified lines
8282 unsigned long flags;
8383 raw_spin_lock_irqsave(&fbc->lock, flags);
8484 fbc->count += count;
85+ __this_cpu_sub(*fbc->counters, count);
8586 raw_spin_unlock_irqrestore(&fbc->lock, flags);
86− __this_cpu_write(*fbc->counters, 0);
8787 } else {
88− __this_cpu_write(*fbc->counters, count);
88+ this_cpu_add(*fbc->counters, amount);
8989 }
9090 preempt_enable();
9191 }
mm/Kconfig+1−1
@@ -543,7 +543,7 @@ config ZSWAP · 542 unmodified lines
543543
544544 config MEM_SOFT_DIRTY
545545 bool "Track memory changes"
546− depends on CHECKPOINT_RESTORE && HAVE_ARCH_SOFT_DIRTY
546+ depends on CHECKPOINT_RESTORE && HAVE_ARCH_SOFT_DIRTY && PROC_FS
547547 select PROC_PAGE_MONITOR
548548 help
549549 This option enables memory changes tracking by introducing a
mm/compaction.c+4−0
@@ -134,6 +134,10 @@ static void update_pageblock_skip(struct compact_control *cc, · 133 unmodified lines
134134 bool migrate_scanner)
135135 {
136136 struct zone *zone = cc->zone;
137+
138+ if (cc->ignore_skip_hint)
139+ return;
140+
137141 if (!page)
138142 return;
139143
mm/fremap.c+5−3
@@ -208,9 +208,10 @@ get_write_lock: · 207 unmodified lines
208208 if (mapping_cap_account_dirty(mapping)) {
209209 unsigned long addr;
210210 struct file *file = get_file(vma->vm_file);
211+ /* mmap_region may free vma; grab the info now */
212+ vm_flags = vma->vm_flags;
211213
212− addr = mmap_region(file, start, size,
213− vma->vm_flags, pgoff);
214+ addr = mmap_region(file, start, size, vm_flags, pgoff);
214215 fput(file);
215216 if (IS_ERR_VALUE(addr)) {
216217 err = addr;
@@ -218,7 +219,7 @@ get_write_lock: · 1 unmodified line
218219 BUG_ON(addr != start);
219220 err = 0;
220221 }
221− goto out;
222+ goto out_freed;
222223 }
223224 mutex_lock(&mapping->i_mmap_mutex);
224225 flush_dcache_mmap_lock(mapping);
@@ -253,6 +254,7 @@ get_write_lock: · 28 unmodified lines
253254 out:
254255 if (vma)
255256 vm_flags = vma->vm_flags;
257+out_freed:
256258 if (likely(!has_write_lock))
257259 up_read(&mm->mmap_sem);
258260 else
mm/huge_memory.c+36−12
@@ -882,6 +882,7 @@ int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm, · 881 unmodified lines
882882 ret = 0;
883883 goto out_unlock;
884884 }
885+
885886 if (unlikely(pmd_trans_splitting(pmd))) {
886887 /* split huge page running from under us */
887888 spin_unlock(src_ptl);
@@ -1153,7 +1154,7 @@ alloc: · 265 unmodified lines
11531154 new_page = NULL;
11541155
11551156 if (unlikely(!new_page)) {
1156− if (is_huge_zero_pmd(orig_pmd)) {
1157+ if (!page) {
11571158 ret = do_huge_pmd_wp_zero_page_fallback(mm, vma,
11581159 address, pmd, orig_pmd, haddr);
11591160 } else {
@@ -1180,7 +1181,7 @@ alloc: · 20 unmodified lines
11801181
11811182 count_vm_event(THP_FAULT_ALLOC);
11821183
1183− if (is_huge_zero_pmd(orig_pmd))
1184+ if (!page)
11841185 clear_huge_page(new_page, haddr, HPAGE_PMD_NR);
11851186 else
11861187 copy_user_huge_page(new_page, page, haddr, vma, HPAGE_PMD_NR);
@@ -1206,7 +1207,7 @@ alloc: · 19 unmodified lines
12061207 page_add_new_anon_rmap(new_page, vma, haddr);
12071208 set_pmd_at(mm, haddr, pmd, entry);
12081209 update_mmu_cache_pmd(vma, address, pmd);
1209− if (is_huge_zero_pmd(orig_pmd)) {
1210+ if (!page) {
12101211 add_mm_counter(mm, MM_ANONPAGES, HPAGE_PMD_NR);
12111212 put_huge_zero_page();
12121213 } else {
@@ -1243,6 +1244,10 @@ struct page *follow_trans_huge_pmd(struct vm_area_struct *vma, · 30 unmodified lines
12431244 if ((flags & FOLL_DUMP) && is_huge_zero_pmd(*pmd))
12441245 return ERR_PTR(-EFAULT);
12451246
1247+ /* Full NUMA hinting faults to serialise migration in fault paths */
1248+ if ((flags & FOLL_NUMA) && pmd_numa(*pmd))
1249+ goto out;
1250+
12461251 page = pmd_page(*pmd);
12471252 VM_BUG_ON(!PageHead(page));
12481253 if (flags & FOLL_TOUCH) {
@@ -1295,6 +1300,17 @@ int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, · 46 unmodified lines
12951300 if (unlikely(!pmd_same(pmd, *pmdp)))
12961301 goto out_unlock;
12971302
1303+ /*
1304+ * If there are potential migrations, wait for completion and retry
1305+ * without disrupting NUMA hinting information. Do not relock and
1306+ * check_same as the page may no longer be mapped.
1307+ */
1308+ if (unlikely(pmd_trans_migrating(*pmdp))) {
1309+ spin_unlock(ptl);
1310+ wait_migrate_huge_page(vma->anon_vma, pmdp);
1311+ goto out;
1312+ }
1313+
12981314 page = pmd_page(pmd);
12991315 BUG_ON(is_huge_zero_page(page));
13001316 page_nid = page_to_nid(page);
@@ -1323,23 +1339,22 @@ int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, · 22 unmodified lines
13231339 /* If the page was locked, there are no parallel migrations */
13241340 if (page_locked)
13251341 goto clear_pmdnuma;
1342+ }
13261343
1327− /*
1328− * Otherwise wait for potential migrations and retry. We do
1329− * relock and check_same as the page may no longer be mapped.
1330− * As the fault is being retried, do not account for it.
1331− */
1344+ /* Migration could have started since the pmd_trans_migrating check */
1345+ if (!page_locked) {
13321346 spin_unlock(ptl);
13331347 wait_on_page_locked(page);
13341348 page_nid = -1;
13351349 goto out;
13361350 }
13371351
1338− /* Page is misplaced, serialise migrations and parallel THP splits */
1352+ /*
1353+ * Page is misplaced. Page lock serialises migrations. Acquire anon_vma
1354+ * to serialises splits
1355+ */
13391356 get_page(page);
13401357 spin_unlock(ptl);
1341− if (!page_locked)
1342− lock_page(page);
13431358 anon_vma = page_lock_anon_vma_read(page);
13441359
13451360 /* Confirm the PMD did not change while page_table_lock was released */
@@ -1351,6 +1366,13 @@ int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, · 5 unmodified lines
13511366 goto out_unlock;
13521367 }
13531368
1369+ /* Bail if we fail to protect against THP splits for any reason */
1370+ if (unlikely(!anon_vma)) {
1371+ put_page(page);
1372+ page_nid = -1;
1373+ goto clear_pmdnuma;
1374+ }
1375+
13541376 /*
13551377 * Migrate the THP to the requested node, returns with page unlocked
13561378 * and pmd_numa cleared.
@@ -1517,6 +1539,8 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, · 160 unmodified lines
15171539 ret = 1;
15181540 if (!prot_numa) {
15191541 entry = pmdp_get_and_clear(mm, addr, pmd);
1542+ if (pmd_numa(entry))
1543+ entry = pmd_mknonnuma(entry);
15201544 entry = pmd_modify(entry, newprot);
15211545 ret = HPAGE_PMD_NR;
15221546 BUG_ON(pmd_write(entry));
@@ -1531,7 +1555,7 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, · 8 unmodified lines
15311555 */
15321556 if (!is_huge_zero_page(page) &&
15331557 !pmd_numa(*pmd)) {
1534− entry = pmdp_get_and_clear(mm, addr, pmd);
1558+ entry = *pmd;
15351559 entry = pmd_mknuma(entry);
15361560 ret = HPAGE_PMD_NR;
15371561 }
mm/memcontrol.c+1−1
@@ -338,7 +338,7 @@ struct mem_cgroup { · 337 unmodified lines
338338 static size_t memcg_size(void)
339339 {
340340 return sizeof(struct mem_cgroup) +
341− nr_node_ids * sizeof(struct mem_cgroup_per_node);
341+ nr_node_ids * sizeof(struct mem_cgroup_per_node *);
342342 }
343343
344344 /* internal only representation about the status of kmem accounting. */
mm/memory-failure.c+20−4
@@ -938,6 +938,16 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn, · 937 unmodified lines
938938 BUG_ON(!PageHWPoison(p));
939939 return SWAP_FAIL;
940940 }
941+ /*
942+ * We pinned the head page for hwpoison handling,
943+ * now we split the thp and we are interested in
944+ * the hwpoisoned raw page, so move the refcount
945+ * to it.
946+ */
947+ if (hpage != p) {
948+ put_page(hpage);
949+ get_page(p);
950+ }
941951 /* THP is split, so ppage should be the real poisoned page. */
942952 ppage = p;
943953 }
@@ -1505,10 +1515,16 @@ static int soft_offline_huge_page(struct page *page, int flags) · 561 unmodified lines
15051515 if (ret > 0)
15061516 ret = -EIO;
15071517 } else {
1508− set_page_hwpoison_huge_page(hpage);
1509− dequeue_hwpoisoned_huge_page(hpage);
1510− atomic_long_add(1 << compound_order(hpage),
1511− &num_poisoned_pages);
1518+ /* overcommit hugetlb page will be freed to buddy */
1519+ if (PageHuge(page)) {
1520+ set_page_hwpoison_huge_page(hpage);
1521+ dequeue_hwpoisoned_huge_page(hpage);
1522+ atomic_long_add(1 << compound_order(hpage),
1523+ &num_poisoned_pages);
1524+ } else {
1525+ SetPageHWPoison(page);
1526+ atomic_long_inc(&num_poisoned_pages);
1527+ }
15121528 }
15131529 return ret;
15141530 }
mm/memory.c+1−1
@@ -4271,7 +4271,7 @@ void copy_user_huge_page(struct page *dst, struct page *src, · 4270 unmodified lines
42714271 }
42724272 #endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */
42734273
4274−#if USE_SPLIT_PTE_PTLOCKS && BLOATED_SPINLOCKS
4274+#if USE_SPLIT_PTE_PTLOCKS && ALLOC_SPLIT_PTLOCKS
42754275 bool ptlock_alloc(struct page *page)
42764276 {
42774277 spinlock_t *ptl;
mm/mempolicy.c+9−7
@@ -1197,14 +1197,16 @@ static struct page *new_vma_page(struct page *page, unsigned long private, int * · 1196 unmodified lines
11971197 break;
11981198 vma = vma->vm_next;
11991199 }
1200+
1201+ if (PageHuge(page)) {
1202+ if (vma)
1203+ return alloc_huge_page_noerr(vma, address, 1);
1204+ else
1205+ return NULL;
1206+ }
12001207 /*
1201− * queue_pages_range() confirms that @page belongs to some vma,
1202− * so vma shouldn't be NULL.
1208+ * if !vma, alloc_page_vma() will use task or system default policy
12031209 */
1204− BUG_ON(!vma);
1205−
1206− if (PageHuge(page))
1207− return alloc_huge_page_noerr(vma, address, 1);
12081210 return alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, address);
12091211 }
12101212 #else
@@ -1318,7 +1320,7 @@ static long do_mbind(unsigned long start, unsigned long len, · 107 unmodified lines
13181320 if (nr_failed && (flags & MPOL_MF_STRICT))
13191321 err = -EIO;
13201322 } else
1321− putback_lru_pages(&pagelist);
1323+ putback_movable_pages(&pagelist);
13221324
13231325 up_write(&mm->mmap_sem);
13241326 mpol_out:
mm/migrate.c+65−17
@@ -36,6 +36,7 @@ · 35 unmodified lines
3636 #include <linux/hugetlb_cgroup.h>
3737 #include <linux/gfp.h>
3838 #include <linux/balloon_compaction.h>
39+#include <linux/mmu_notifier.h>
3940
4041 #include <asm/tlbflush.h>
4142
@@ -316,14 +317,15 @@ static inline bool buffer_migrate_lock_buffers(struct buffer_head *head, · 274 unmodified lines
316317 */
317318 int migrate_page_move_mapping(struct address_space *mapping,
318319 struct page *newpage, struct page *page,
319− struct buffer_head *head, enum migrate_mode mode)
320+ struct buffer_head *head, enum migrate_mode mode,
321+ int extra_count)
320322 {
321− int expected_count = 0;
323+ int expected_count = 1 + extra_count;
322324 void **pslot;
323325
324326 if (!mapping) {
325327 /* Anonymous page without mapping */
326− if (page_count(page) != 1)
328+ if (page_count(page) != expected_count)
327329 return -EAGAIN;
328330 return MIGRATEPAGE_SUCCESS;
329331 }
@@ -333,7 +335,7 @@ int migrate_page_move_mapping(struct address_space *mapping, · 3 unmodified lines
333335 pslot = radix_tree_lookup_slot(&mapping->page_tree,
334336 page_index(page));
335337
336− expected_count = 2 + page_has_private(page);
338+ expected_count += 1 + page_has_private(page);
337339 if (page_count(page) != expected_count ||
338340 radix_tree_deref_slot_protected(pslot, &mapping->tree_lock) != page) {
339341 spin_unlock_irq(&mapping->tree_lock);
@@ -583,7 +585,7 @@ int migrate_page(struct address_space *mapping, · 243 unmodified lines
583585
584586 BUG_ON(PageWriteback(page)); /* Writeback must be complete */
585587
586− rc = migrate_page_move_mapping(mapping, newpage, page, NULL, mode);
588+ rc = migrate_page_move_mapping(mapping, newpage, page, NULL, mode, 0);
587589
588590 if (rc != MIGRATEPAGE_SUCCESS)
589591 return rc;
@@ -610,7 +612,7 @@ int buffer_migrate_page(struct address_space *mapping, · 20 unmodified lines
610612
611613 head = page_buffers(page);
612614
613− rc = migrate_page_move_mapping(mapping, newpage, page, head, mode);
615+ rc = migrate_page_move_mapping(mapping, newpage, page, head, mode, 0);
614616
615617 if (rc != MIGRATEPAGE_SUCCESS)
616618 return rc;
@@ -1654,6 +1656,18 @@ int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page) · 1037 unmodified lines
16541656 return 1;
16551657 }
16561658
1659+bool pmd_trans_migrating(pmd_t pmd)
1660+{
1661+ struct page *page = pmd_page(pmd);
1662+ return PageLocked(page);
1663+}
1664+
1665+void wait_migrate_huge_page(struct anon_vma *anon_vma, pmd_t *pmd)
1666+{
1667+ struct page *page = pmd_page(*pmd);
1668+ wait_on_page_locked(page);
1669+}
1670+
16571671 /*
16581672 * Attempt to migrate a misplaced page to the specified destination
16591673 * node. Caller is expected to have an elevated reference count on
@@ -1716,12 +1730,14 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm, · 56 unmodified lines
17161730 struct page *page, int node)
17171731 {
17181732 spinlock_t *ptl;
1719− unsigned long haddr = address & HPAGE_PMD_MASK;
17201733 pg_data_t *pgdat = NODE_DATA(node);
17211734 int isolated = 0;
17221735 struct page *new_page = NULL;
17231736 struct mem_cgroup *memcg = NULL;
17241737 int page_lru = page_is_file_cache(page);
1738+ unsigned long mmun_start = address & HPAGE_PMD_MASK;
1739+ unsigned long mmun_end = mmun_start + HPAGE_PMD_SIZE;
1740+ pmd_t orig_entry;
17251741
17261742 /*
17271743 * Rate-limit the amount of data that is being migrated to a node.
@@ -1744,6 +1760,9 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm, · 16 unmodified lines
17441760 goto out_fail;
17451761 }
17461762
1763+ if (mm_tlb_flush_pending(mm))
1764+ flush_tlb_range(vma, mmun_start, mmun_end);
1765+
17471766 /* Prepare a page as a migration target */
17481767 __set_page_locked(new_page);
17491768 SetPageSwapBacked(new_page);
@@ -1755,9 +1774,12 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm, · 5 unmodified lines
17551774 WARN_ON(PageLRU(new_page));
17561775
17571776 /* Recheck the target PMD */
1777+ mmu_notifier_invalidate_range_start(mm, mmun_start, mmun_end);
17581778 ptl = pmd_lock(mm, pmd);
1759− if (unlikely(!pmd_same(*pmd, entry))) {
1779+ if (unlikely(!pmd_same(*pmd, entry) || page_count(page) != 2)) {
1780+fail_putback:
17601781 spin_unlock(ptl);
1782+ mmu_notifier_invalidate_range_end(mm, mmun_start, mmun_end);
17611783
17621784 /* Reverse changes made by migrate_page_copy() */
17631785 if (TestClearPageActive(new_page))
@@ -1774,7 +1796,8 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm, · 10 unmodified lines
17741796 putback_lru_page(page);
17751797 mod_zone_page_state(page_zone(page),
17761798 NR_ISOLATED_ANON + page_lru, -HPAGE_PMD_NR);
1777− goto out_fail;
1799+
1800+ goto out_unlock;
17781801 }
17791802
17801803 /*
@@ -1786,16 +1809,35 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm, · 5 unmodified lines
17861809 */
17871810 mem_cgroup_prepare_migration(page, new_page, &memcg);
17881811
1812+ orig_entry = *pmd;
17891813 entry = mk_pmd(new_page, vma->vm_page_prot);
1790− entry = pmd_mknonnuma(entry);
1791− entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma);
17921814 entry = pmd_mkhuge(entry);
1815+ entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma);
17931816
1794− pmdp_clear_flush(vma, haddr, pmd);
1795− set_pmd_at(mm, haddr, pmd, entry);
1796− page_add_new_anon_rmap(new_page, vma, haddr);
1817+ /*
1818+ * Clear the old entry under pagetable lock and establish the new PTE.
1819+ * Any parallel GUP will either observe the old page blocking on the
1820+ * page lock, block on the page table lock or observe the new page.
1821+ * The SetPageUptodate on the new page and page_add_new_anon_rmap
1822+ * guarantee the copy is visible before the pagetable update.
1823+ */
1824+ flush_cache_range(vma, mmun_start, mmun_end);
1825+ page_add_new_anon_rmap(new_page, vma, mmun_start);
1826+ pmdp_clear_flush(vma, mmun_start, pmd);
1827+ set_pmd_at(mm, mmun_start, pmd, entry);
1828+ flush_tlb_range(vma, mmun_start, mmun_end);
17971829 update_mmu_cache_pmd(vma, address, &entry);
1830+
1831+ if (page_count(page) != 2) {
1832+ set_pmd_at(mm, mmun_start, pmd, orig_entry);
1833+ flush_tlb_range(vma, mmun_start, mmun_end);
1834+ update_mmu_cache_pmd(vma, address, &entry);
1835+ page_remove_rmap(new_page);
1836+ goto fail_putback;
1837+ }
1838+
17981839 page_remove_rmap(page);
1840+
17991841 /*
18001842 * Finish the charge transaction under the page table lock to
18011843 * prevent split_huge_page() from dividing up the charge
@@ -1803,6 +1845,7 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm, · 1 unmodified line
18031845 */
18041846 mem_cgroup_end_migration(memcg, page, new_page, true);
18051847 spin_unlock(ptl);
1848+ mmu_notifier_invalidate_range_end(mm, mmun_start, mmun_end);
18061849
18071850 unlock_page(new_page);
18081851 unlock_page(page);
@@ -1820,10 +1863,15 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm, · 11 unmodified lines
18201863 out_fail:
18211864 count_vm_events(PGMIGRATE_FAIL, HPAGE_PMD_NR);
18221865 out_dropref:
1823− entry = pmd_mknonnuma(entry);
1824− set_pmd_at(mm, haddr, pmd, entry);
1825− update_mmu_cache_pmd(vma, address, &entry);
1866+ ptl = pmd_lock(mm, pmd);
1867+ if (pmd_same(*pmd, entry)) {
1868+ entry = pmd_mknonnuma(entry);
1869+ set_pmd_at(mm, mmun_start, pmd, entry);
1870+ update_mmu_cache_pmd(vma, address, &entry);
1871+ }
1872+ spin_unlock(ptl);
18261873
1874+out_unlock:
18271875 unlock_page(page);
18281876 put_page(page);
18291877 return 0;
mm/mlock.c+32−12
@@ -133,7 +133,10 @@ static void __munlock_isolation_failed(struct page *page) · 132 unmodified lines
133133
134134 /**
135135 * munlock_vma_page - munlock a vma page
136− * @page - page to be unlocked
136+ * @page - page to be unlocked, either a normal page or THP page head
137+ *
138+ * returns the size of the page as a page mask (0 for normal page,
139+ * HPAGE_PMD_NR - 1 for THP head page)
137140 *
138141 * called from munlock()/munmap() path with page supposedly on the LRU.
139142 * When we munlock a page, because the vma where we found the page is being
@@ -148,21 +151,30 @@ static void __munlock_isolation_failed(struct page *page) · 8 unmodified lines
148151 */
149152 unsigned int munlock_vma_page(struct page *page)
150153 {
151− unsigned int page_mask = 0;
154+ unsigned int nr_pages;
152155
153156 BUG_ON(!PageLocked(page));
154157
155158 if (TestClearPageMlocked(page)) {
156− unsigned int nr_pages = hpage_nr_pages(page);
159+ nr_pages = hpage_nr_pages(page);
157160 mod_zone_page_state(page_zone(page), NR_MLOCK, -nr_pages);
158− page_mask = nr_pages - 1;
159161 if (!isolate_lru_page(page))
160162 __munlock_isolated_page(page);
161163 else
162164 __munlock_isolation_failed(page);
165+ } else {
166+ nr_pages = hpage_nr_pages(page);
163167 }
164168
165− return page_mask;
169+ /*
170+ * Regardless of the original PageMlocked flag, we determine nr_pages
171+ * after touching the flag. This leaves a possible race with a THP page
172+ * split, such that a whole THP page was munlocked, but nr_pages == 1.
173+ * Returning a smaller mask due to that is OK, the worst that can
174+ * happen is subsequent useless scanning of the former tail pages.
175+ * The NR_MLOCK accounting can however become broken.
176+ */
177+ return nr_pages - 1;
166178 }
167179
168180 /**
@@ -286,10 +298,12 @@ static void __munlock_pagevec(struct pagevec *pvec, struct zone *zone) · 117 unmodified lines
286298 {
287299 int i;
288300 int nr = pagevec_count(pvec);
289− int delta_munlocked = -nr;
301+ int delta_munlocked;
290302 struct pagevec pvec_putback;
291303 int pgrescued = 0;
292304
305+ pagevec_init(&pvec_putback, 0);
306+
293307 /* Phase 1: page isolation */
294308 spin_lock_irq(&zone->lru_lock);
295309 for (i = 0; i < nr; i++) {
@@ -318,18 +332,21 @@ skip_munlock: · 22 unmodified lines
318332 /*
319333 * We won't be munlocking this page in the next phase
320334 * but we still need to release the follow_page_mask()
321− * pin.
335+ * pin. We cannot do it under lru_lock however. If it's
336+ * the last pin, __page_cache_release would deadlock.
322337 */
338+ pagevec_add(&pvec_putback, pvec->pages[i]);
323339 pvec->pages[i] = NULL;
324− put_page(page);
325− delta_munlocked++;
326340 }
327341 }
342+ delta_munlocked = -nr + pagevec_count(&pvec_putback);
328343 __mod_zone_page_state(zone, NR_MLOCK, delta_munlocked);
329344 spin_unlock_irq(&zone->lru_lock);
330345
346+ /* Now we can release pins of pages that we are not munlocking */
347+ pagevec_release(&pvec_putback);
348+
331349 /* Phase 2: page munlock */
332− pagevec_init(&pvec_putback, 0);
333350 for (i = 0; i < nr; i++) {
334351 struct page *page = pvec->pages[i];
335352
@@ -440,7 +457,8 @@ void munlock_vma_pages_range(struct vm_area_struct *vma, · 104 unmodified lines
440457
441458 while (start < end) {
442459 struct page *page = NULL;
443− unsigned int page_mask, page_increm;
460+ unsigned int page_mask;
461+ unsigned long page_increm;
444462 struct pagevec pvec;
445463 struct zone *zone;
446464 int zoneid;
@@ -490,7 +508,9 @@ void munlock_vma_pages_range(struct vm_area_struct *vma, · 43 unmodified lines
490508 goto next;
491509 }
492510 }
493− page_increm = 1 + (~(start >> PAGE_SHIFT) & page_mask);
511+ /* It's a bug to munlock in the middle of a THP page */
512+ VM_BUG_ON((start >> PAGE_SHIFT) & page_mask);
513+ page_increm = 1 + page_mask;
494514 start += page_increm * PAGE_SIZE;
495515 next:
496516 cond_resched();
mm/mprotect.c+11−2
@@ -52,17 +52,21 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd, · 51 unmodified lines
5252 pte_t ptent;
5353 bool updated = false;
5454
55− ptent = ptep_modify_prot_start(mm, addr, pte);
5655 if (!prot_numa) {
56+ ptent = ptep_modify_prot_start(mm, addr, pte);
57+ if (pte_numa(ptent))
58+ ptent = pte_mknonnuma(ptent);
5759 ptent = pte_modify(ptent, newprot);
5860 updated = true;
5961 } else {
6062 struct page *page;
6163
64+ ptent = *pte;
6265 page = vm_normal_page(vma, addr, oldpte);
6366 if (page) {
6467 if (!pte_numa(oldpte)) {
6568 ptent = pte_mknuma(ptent);
69+ set_pte_at(mm, addr, pte, ptent);
6670 updated = true;
6771 }
6872 }
@@ -79,7 +83,10 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd, · 10 unmodified lines
7983
8084 if (updated)
8185 pages++;
82− ptep_modify_prot_commit(mm, addr, pte, ptent);
86+
87+ /* Only !prot_numa always clears the pte */
88+ if (!prot_numa)
89+ ptep_modify_prot_commit(mm, addr, pte, ptent);
8390 } else if (IS_ENABLED(CONFIG_MIGRATION) && !pte_file(oldpte)) {
8491 swp_entry_t entry = pte_to_swp_entry(oldpte);
8592
@@ -181,6 +188,7 @@ static unsigned long change_protection_range(struct vm_area_struct *vma, · 95 unmodified lines
181188 BUG_ON(addr >= end);
182189 pgd = pgd_offset(mm, addr);
183190 flush_cache_range(vma, addr, end);
191+ set_tlb_flush_pending(mm);
184192 do {
185193 next = pgd_addr_end(addr, end);
186194 if (pgd_none_or_clear_bad(pgd))
@@ -192,6 +200,7 @@ static unsigned long change_protection_range(struct vm_area_struct *vma, · 5 unmodified lines
192200 /* Only flush the TLB if we actually modified any entries: */
193201 if (pages)
194202 flush_tlb_range(vma, start, end);
203+ clear_tlb_flush_pending(mm);
195204
196205 return pages;
197206 }
mm/page_alloc.c+9−10
@@ -1816,7 +1816,7 @@ static void zlc_clear_zones_full(struct zonelist *zonelist) · 1815 unmodified lines
18161816
18171817 static bool zone_local(struct zone *local_zone, struct zone *zone)
18181818 {
1819− return node_distance(local_zone->node, zone->node) == LOCAL_DISTANCE;
1819+ return local_zone->node == zone->node;
18201820 }
18211821
18221822 static bool zone_allows_reclaim(struct zone *local_zone, struct zone *zone)
@@ -1913,18 +1913,17 @@ zonelist_scan: · 90 unmodified lines
19131913 * page was allocated in should have no effect on the
19141914 * time the page has in memory before being reclaimed.
19151915 *
1916− * When zone_reclaim_mode is enabled, try to stay in
1917− * local zones in the fastpath. If that fails, the
1918− * slowpath is entered, which will do another pass
1919− * starting with the local zones, but ultimately fall
1920− * back to remote zones that do not partake in the
1921− * fairness round-robin cycle of this zonelist.
1916+ * Try to stay in local zones in the fastpath. If
1917+ * that fails, the slowpath is entered, which will do
1918+ * another pass starting with the local zones, but
1919+ * ultimately fall back to remote zones that do not
1920+ * partake in the fairness round-robin cycle of this
1921+ * zonelist.
19221922 */
19231923 if (alloc_flags & ALLOC_WMARK_LOW) {
19241924 if (zone_page_state(zone, NR_ALLOC_BATCH) <= 0)
19251925 continue;
1926− if (zone_reclaim_mode &&
1927− !zone_local(preferred_zone, zone))
1926+ if (!zone_local(preferred_zone, zone))
19281927 continue;
19291928 }
19301929 /*
@@ -2390,7 +2389,7 @@ static void prepare_slowpath(gfp_t gfp_mask, unsigned int order, · 459 unmodified lines
23902389 * thrash fairness information for zones that are not
23912390 * actually part of this zonelist's round-robin cycle.
23922391 */
2393− if (zone_reclaim_mode && !zone_local(preferred_zone, zone))
2392+ if (!zone_local(preferred_zone, zone))
23942393 continue;
23952394 mod_zone_page_state(zone, NR_ALLOC_BATCH,
23962395 high_wmark_pages(zone) -
mm/pgtable-generic.c+6−2
@@ -110,9 +110,10 @@ int pmdp_clear_flush_young(struct vm_area_struct *vma, · 109 unmodified lines
110110 pte_t ptep_clear_flush(struct vm_area_struct *vma, unsigned long address,
111111 pte_t *ptep)
112112 {
113+ struct mm_struct *mm = (vma)->vm_mm;
113114 pte_t pte;
114− pte = ptep_get_and_clear((vma)->vm_mm, address, ptep);
115− if (pte_accessible(pte))
115+ pte = ptep_get_and_clear(mm, address, ptep);
116+ if (pte_accessible(mm, pte))
116117 flush_tlb_page(vma, address);
117118 return pte;
118119 }
@@ -191,6 +192,9 @@ pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp) · 72 unmodified lines
191192 void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
192193 pmd_t *pmdp)
193194 {
195+ pmd_t entry = *pmdp;
196+ if (pmd_numa(entry))
197+ entry = pmd_mknonnuma(entry);
194198 set_pmd_at(vma->vm_mm, address, pmdp, pmd_mknotpresent(*pmdp));
195199 flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
196200 }
mm/rmap.c+4−0
@@ -600,7 +600,11 @@ pte_t *__page_check_address(struct page *page, struct mm_struct *mm, · 599 unmodified lines
600600 spinlock_t *ptl;
601601
602602 if (unlikely(PageHuge(page))) {
603+ /* when pud is not present, pte will be NULL */
603604 pte = huge_pte_offset(mm, address);
605+ if (!pte)
606+ return NULL;
607+
604608 ptl = huge_pte_lockptr(page_hstate(page), mm, pte);
605609 goto check;
606610 }
mm/util.c+4−1
@@ -390,7 +390,10 @@ struct address_space *page_mapping(struct page *page) · 389 unmodified lines
390390 {
391391 struct address_space *mapping = page->mapping;
392392
393− VM_BUG_ON(PageSlab(page));
393+ /* This happens if someone calls flush_dcache_page on slab page */
394+ if (unlikely(PageSlab(page)))
395+ return NULL;
396+
394397 if (unlikely(PageSwapCache(page))) {
395398 swp_entry_t entry;
396399
net/8021q/vlan_dev.c+18−1
@@ -530,6 +530,23 @@ static const struct header_ops vlan_header_ops = { · 529 unmodified lines
530530 .parse = eth_header_parse,
531531 };
532532
533+static int vlan_passthru_hard_header(struct sk_buff *skb, struct net_device *dev,
534+ unsigned short type,
535+ const void *daddr, const void *saddr,
536+ unsigned int len)
537+{
538+ struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
539+ struct net_device *real_dev = vlan->real_dev;
540+
541+ return dev_hard_header(skb, real_dev, type, daddr, saddr, len);
542+}
543+
544+static const struct header_ops vlan_passthru_header_ops = {
545+ .create = vlan_passthru_hard_header,
546+ .rebuild = dev_rebuild_header,
547+ .parse = eth_header_parse,
548+};
549+
533550 static struct device_type vlan_type = {
534551 .name = "vlan",
535552 };
@@ -573,7 +590,7 @@ static int vlan_dev_init(struct net_device *dev) · 37 unmodified lines
573590
574591 dev->needed_headroom = real_dev->needed_headroom;
575592 if (real_dev->features & NETIF_F_HW_VLAN_CTAG_TX) {
576− dev->header_ops = real_dev->header_ops;
593+ dev->header_ops = &vlan_passthru_header_ops;
577594 dev->hard_header_len = real_dev->hard_header_len;
578595 } else {
579596 dev->header_ops = &vlan_header_ops;
net/batman-adv/bat_iv_ogm.c+18−18
@@ -307,9 +307,9 @@ static int batadv_iv_ogm_iface_enable(struct batadv_hard_iface *hard_iface) · 306 unmodified lines
307307 hard_iface->bat_iv.ogm_buff = ogm_buff;
308308
309309 batadv_ogm_packet = (struct batadv_ogm_packet *)ogm_buff;
310− batadv_ogm_packet->header.packet_type = BATADV_IV_OGM;
311− batadv_ogm_packet->header.version = BATADV_COMPAT_VERSION;
312− batadv_ogm_packet->header.ttl = 2;
310+ batadv_ogm_packet->packet_type = BATADV_IV_OGM;
311+ batadv_ogm_packet->version = BATADV_COMPAT_VERSION;
312+ batadv_ogm_packet->ttl = 2;
313313 batadv_ogm_packet->flags = BATADV_NO_FLAGS;
314314 batadv_ogm_packet->reserved = 0;
315315 batadv_ogm_packet->tq = BATADV_TQ_MAX_VALUE;
@@ -346,7 +346,7 @@ batadv_iv_ogm_primary_iface_set(struct batadv_hard_iface *hard_iface) · 30 unmodified lines
346346
347347 batadv_ogm_packet = (struct batadv_ogm_packet *)ogm_buff;
348348 batadv_ogm_packet->flags = BATADV_PRIMARIES_FIRST_HOP;
349− batadv_ogm_packet->header.ttl = BATADV_TTL;
349+ batadv_ogm_packet->ttl = BATADV_TTL;
350350 }
351351
352352 /* when do we schedule our own ogm to be sent */
@@ -435,7 +435,7 @@ static void batadv_iv_ogm_send_to_if(struct batadv_forw_packet *forw_packet, · 82 unmodified lines
435435 fwd_str, (packet_num > 0 ? "aggregated " : ""),
436436 batadv_ogm_packet->orig,
437437 ntohl(batadv_ogm_packet->seqno),
438− batadv_ogm_packet->tq, batadv_ogm_packet->header.ttl,
438+ batadv_ogm_packet->tq, batadv_ogm_packet->ttl,
439439 (batadv_ogm_packet->flags & BATADV_DIRECTLINK ?
440440 "on" : "off"),
441441 hard_iface->net_dev->name,
@@ -491,7 +491,7 @@ static void batadv_iv_ogm_emit(struct batadv_forw_packet *forw_packet) · 49 unmodified lines
491491 /* multihomed peer assumed
492492 * non-primary OGMs are only broadcasted on their interface
493493 */
494− if ((directlink && (batadv_ogm_packet->header.ttl == 1)) ||
494+ if ((directlink && (batadv_ogm_packet->ttl == 1)) ||
495495 (forw_packet->own && (forw_packet->if_incoming != primary_if))) {
496496 /* FIXME: what about aggregated packets ? */
497497 batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
@@ -499,7 +499,7 @@ static void batadv_iv_ogm_emit(struct batadv_forw_packet *forw_packet) · 1 unmodified line
499499 (forw_packet->own ? "Sending own" : "Forwarding"),
500500 batadv_ogm_packet->orig,
501501 ntohl(batadv_ogm_packet->seqno),
502− batadv_ogm_packet->header.ttl,
502+ batadv_ogm_packet->ttl,
503503 forw_packet->if_incoming->net_dev->name,
504504 forw_packet->if_incoming->net_dev->dev_addr);
505505
@@ -572,7 +572,7 @@ batadv_iv_ogm_can_aggregate(const struct batadv_ogm_packet *new_bat_ogm_packet, · 66 unmodified lines
572572 */
573573 if ((!directlink) &&
574574 (!(batadv_ogm_packet->flags & BATADV_DIRECTLINK)) &&
575− (batadv_ogm_packet->header.ttl != 1) &&
575+ (batadv_ogm_packet->ttl != 1) &&
576576
577577 /* own packets originating non-primary
578578 * interfaces leave only that interface
@@ -587,7 +587,7 @@ batadv_iv_ogm_can_aggregate(const struct batadv_ogm_packet *new_bat_ogm_packet, · 8 unmodified lines
587587 * interface only - we still can aggregate
588588 */
589589 if ((directlink) &&
590− (new_bat_ogm_packet->header.ttl == 1) &&
590+ (new_bat_ogm_packet->ttl == 1) &&
591591 (forw_packet->if_incoming == if_incoming) &&
592592
593593 /* packets from direct neighbors or
@@ -778,7 +778,7 @@ static void batadv_iv_ogm_forward(struct batadv_orig_node *orig_node, · 184 unmodified lines
778778 struct batadv_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
779779 uint16_t tvlv_len;
780780
781− if (batadv_ogm_packet->header.ttl <= 1) {
781+ if (batadv_ogm_packet->ttl <= 1) {
782782 batadv_dbg(BATADV_DBG_BATMAN, bat_priv, "ttl exceeded\n");
783783 return;
784784 }
@@ -798,7 +798,7 @@ static void batadv_iv_ogm_forward(struct batadv_orig_node *orig_node, · 13 unmodified lines
798798
799799 tvlv_len = ntohs(batadv_ogm_packet->tvlv_len);
800800
801− batadv_ogm_packet->header.ttl--;
801+ batadv_ogm_packet->ttl--;
802802 memcpy(batadv_ogm_packet->prev_sender, ethhdr->h_source, ETH_ALEN);
803803
804804 /* apply hop penalty */
@@ -807,7 +807,7 @@ static void batadv_iv_ogm_forward(struct batadv_orig_node *orig_node, · 2 unmodified lines
807807
808808 batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
809809 "Forwarding packet: tq: %i, ttl: %i\n",
810− batadv_ogm_packet->tq, batadv_ogm_packet->header.ttl);
810+ batadv_ogm_packet->tq, batadv_ogm_packet->ttl);
811811
812812 /* switch of primaries first hop flag when forwarding */
813813 batadv_ogm_packet->flags &= ~BATADV_PRIMARIES_FIRST_HOP;
@@ -972,8 +972,8 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv, · 158 unmodified lines
972972 spin_unlock_bh(&neigh_node->bat_iv.lq_update_lock);
973973
974974 if (dup_status == BATADV_NO_DUP) {
975− orig_node->last_ttl = batadv_ogm_packet->header.ttl;
976− neigh_node->last_ttl = batadv_ogm_packet->header.ttl;
975+ orig_node->last_ttl = batadv_ogm_packet->ttl;
976+ neigh_node->last_ttl = batadv_ogm_packet->ttl;
977977 }
978978
979979 batadv_bonding_candidate_add(bat_priv, orig_node, neigh_node);
@@ -1247,7 +1247,7 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr, · 267 unmodified lines
12471247 * packet in an aggregation. Here we expect that the padding
12481248 * is always zero (or not 0x01)
12491249 */
1250− if (batadv_ogm_packet->header.packet_type != BATADV_IV_OGM)
1250+ if (batadv_ogm_packet->packet_type != BATADV_IV_OGM)
12511251 return;
12521252
12531253 /* could be changed by schedule_own_packet() */
@@ -1267,8 +1267,8 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr, · 13 unmodified lines
12671267 if_incoming->net_dev->dev_addr, batadv_ogm_packet->orig,
12681268 batadv_ogm_packet->prev_sender,
12691269 ntohl(batadv_ogm_packet->seqno), batadv_ogm_packet->tq,
1270− batadv_ogm_packet->header.ttl,
1271− batadv_ogm_packet->header.version, has_directlink_flag);
1270+ batadv_ogm_packet->ttl,
1271+ batadv_ogm_packet->version, has_directlink_flag);
12721272
12731273 rcu_read_lock();
12741274 list_for_each_entry_rcu(hard_iface, &batadv_hardif_list, list) {
@@ -1433,7 +1433,7 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr, · 158 unmodified lines
14331433 * seqno and similar ttl as the non-duplicate
14341434 */
14351435 sameseq = orig_node->last_real_seqno == ntohl(batadv_ogm_packet->seqno);
1436− similar_ttl = orig_node->last_ttl - 3 <= batadv_ogm_packet->header.ttl;
1436+ similar_ttl = orig_node->last_ttl - 3 <= batadv_ogm_packet->ttl;
14371437 if (is_bidirect && ((dup_status == BATADV_NO_DUP) ||
14381438 (sameseq && similar_ttl)))
14391439 batadv_iv_ogm_orig_update(bat_priv, orig_node, ethhdr,
net/batman-adv/distributed-arp-table.c+3−3
@@ -349,7 +349,7 @@ static void batadv_dbg_arp(struct batadv_priv *bat_priv, struct sk_buff *skb, · 348 unmodified lines
349349
350350 unicast_4addr_packet = (struct batadv_unicast_4addr_packet *)skb->data;
351351
352− switch (unicast_4addr_packet->u.header.packet_type) {
352+ switch (unicast_4addr_packet->u.packet_type) {
353353 case BATADV_UNICAST:
354354 batadv_dbg(BATADV_DBG_DAT, bat_priv,
355355 "* encapsulated within a UNICAST packet\n");
@@ -374,7 +374,7 @@ static void batadv_dbg_arp(struct batadv_priv *bat_priv, struct sk_buff *skb, · 18 unmodified lines
374374 break;
375375 default:
376376 batadv_dbg(BATADV_DBG_DAT, bat_priv, "* type: Unknown (%u)!\n",
377− unicast_4addr_packet->u.header.packet_type);
377+ unicast_4addr_packet->u.packet_type);
378378 }
379379 break;
380380 case BATADV_BCAST:
@@ -387,7 +387,7 @@ static void batadv_dbg_arp(struct batadv_priv *bat_priv, struct sk_buff *skb, · 6 unmodified lines
387387 default:
388388 batadv_dbg(BATADV_DBG_DAT, bat_priv,
389389 "* encapsulated within an unknown packet type (0x%x)\n",
390− unicast_4addr_packet->u.header.packet_type);
390+ unicast_4addr_packet->u.packet_type);
391391 }
392392 }
393393
net/batman-adv/fragmentation.c+4−4
@@ -355,7 +355,7 @@ bool batadv_frag_skb_fwd(struct sk_buff *skb, · 354 unmodified lines
355355 batadv_add_counter(bat_priv, BATADV_CNT_FRAG_FWD_BYTES,
356356 skb->len + ETH_HLEN);
357357
358− packet->header.ttl--;
358+ packet->ttl--;
359359 batadv_send_skb_packet(skb, neigh_node->if_incoming,
360360 neigh_node->addr);
361361 ret = true;
@@ -444,9 +444,9 @@ bool batadv_frag_send_packet(struct sk_buff *skb, · 82 unmodified lines
444444 goto out_err;
445445
446446 /* Create one header to be copied to all fragments */
447− frag_header.header.packet_type = BATADV_UNICAST_FRAG;
448− frag_header.header.version = BATADV_COMPAT_VERSION;
449− frag_header.header.ttl = BATADV_TTL;
447+ frag_header.packet_type = BATADV_UNICAST_FRAG;
448+ frag_header.version = BATADV_COMPAT_VERSION;
449+ frag_header.ttl = BATADV_TTL;
450450 frag_header.seqno = htons(atomic_inc_return(&bat_priv->frag_seqno));
451451 frag_header.reserved = 0;
452452 frag_header.no = 0;
net/batman-adv/icmp_socket.c+3−3
@@ -194,7 +194,7 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff, · 193 unmodified lines
194194 goto free_skb;
195195 }
196196
197− if (icmp_header->header.packet_type != BATADV_ICMP) {
197+ if (icmp_header->packet_type != BATADV_ICMP) {
198198 batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
199199 "Error - can't send packet from char device: got bogus packet type (expected: BAT_ICMP)\n");
200200 len = -EINVAL;
@@ -243,9 +243,9 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff, · 42 unmodified lines
243243
244244 icmp_header->uid = socket_client->index;
245245
246− if (icmp_header->header.version != BATADV_COMPAT_VERSION) {
246+ if (icmp_header->version != BATADV_COMPAT_VERSION) {
247247 icmp_header->msg_type = BATADV_PARAMETER_PROBLEM;
248− icmp_header->header.version = BATADV_COMPAT_VERSION;
248+ icmp_header->version = BATADV_COMPAT_VERSION;
249249 batadv_socket_add_packet(socket_client, icmp_header,
250250 packet_len);
251251 goto free_skb;
net/batman-adv/main.c+8−8
@@ -383,17 +383,17 @@ int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev, · 382 unmodified lines
383383
384384 batadv_ogm_packet = (struct batadv_ogm_packet *)skb->data;
385385
386− if (batadv_ogm_packet->header.version != BATADV_COMPAT_VERSION) {
386+ if (batadv_ogm_packet->version != BATADV_COMPAT_VERSION) {
387387 batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
388388 "Drop packet: incompatible batman version (%i)\n",
389− batadv_ogm_packet->header.version);
389+ batadv_ogm_packet->version);
390390 goto err_free;
391391 }
392392
393393 /* all receive handlers return whether they received or reused
394394 * the supplied skb. if not, we have to free the skb.
395395 */
396− idx = batadv_ogm_packet->header.packet_type;
396+ idx = batadv_ogm_packet->packet_type;
397397 ret = (*batadv_rx_handler[idx])(skb, hard_iface);
398398
399399 if (ret == NET_RX_DROP)
@@ -426,8 +426,8 @@ static void batadv_recv_handler_init(void) · 26 unmodified lines
426426 BUILD_BUG_ON(offsetof(struct batadv_unicast_packet, dest) != 4);
427427 BUILD_BUG_ON(offsetof(struct batadv_unicast_tvlv_packet, dst) != 4);
428428 BUILD_BUG_ON(offsetof(struct batadv_frag_packet, dest) != 4);
429− BUILD_BUG_ON(offsetof(struct batadv_icmp_packet, icmph.dst) != 4);
430− BUILD_BUG_ON(offsetof(struct batadv_icmp_packet_rr, icmph.dst) != 4);
429+ BUILD_BUG_ON(offsetof(struct batadv_icmp_packet, dst) != 4);
430+ BUILD_BUG_ON(offsetof(struct batadv_icmp_packet_rr, dst) != 4);
431431
432432 /* broadcast packet */
433433 batadv_rx_handler[BATADV_BCAST] = batadv_recv_bcast_packet;
@@ -1119,9 +1119,9 @@ void batadv_tvlv_unicast_send(struct batadv_priv *bat_priv, uint8_t *src, · 685 unmodified lines
11191119 skb_reserve(skb, ETH_HLEN);
11201120 tvlv_buff = skb_put(skb, sizeof(*unicast_tvlv_packet) + tvlv_len);
11211121 unicast_tvlv_packet = (struct batadv_unicast_tvlv_packet *)tvlv_buff;
1122− unicast_tvlv_packet->header.packet_type = BATADV_UNICAST_TVLV;
1123− unicast_tvlv_packet->header.version = BATADV_COMPAT_VERSION;
1124− unicast_tvlv_packet->header.ttl = BATADV_TTL;
1122+ unicast_tvlv_packet->packet_type = BATADV_UNICAST_TVLV;
1123+ unicast_tvlv_packet->version = BATADV_COMPAT_VERSION;
1124+ unicast_tvlv_packet->ttl = BATADV_TTL;
11251125 unicast_tvlv_packet->reserved = 0;
11261126 unicast_tvlv_packet->tvlv_len = htons(tvlv_len);
11271127 unicast_tvlv_packet->align = 0;
net/batman-adv/network-coding.c+11−11
@@ -722,7 +722,7 @@ static bool batadv_can_nc_with_orig(struct batadv_priv *bat_priv, · 721 unmodified lines
722722 {
723723 if (orig_node->last_real_seqno != ntohl(ogm_packet->seqno))
724724 return false;
725− if (orig_node->last_ttl != ogm_packet->header.ttl + 1)
725+ if (orig_node->last_ttl != ogm_packet->ttl + 1)
726726 return false;
727727 if (!batadv_compare_eth(ogm_packet->orig, ogm_packet->prev_sender))
728728 return false;
@@ -1082,9 +1082,9 @@ static bool batadv_nc_code_packets(struct batadv_priv *bat_priv, · 353 unmodified lines
10821082 coded_packet = (struct batadv_coded_packet *)skb_dest->data;
10831083 skb_reset_mac_header(skb_dest);
10841084
1085− coded_packet->header.packet_type = BATADV_CODED;
1086− coded_packet->header.version = BATADV_COMPAT_VERSION;
1087− coded_packet->header.ttl = packet1->header.ttl;
1085+ coded_packet->packet_type = BATADV_CODED;
1086+ coded_packet->version = BATADV_COMPAT_VERSION;
1087+ coded_packet->ttl = packet1->ttl;
10881088
10891089 /* Info about first unicast packet */
10901090 memcpy(coded_packet->first_source, first_source, ETH_ALEN);
@@ -1097,7 +1097,7 @@ static bool batadv_nc_code_packets(struct batadv_priv *bat_priv, · 6 unmodified lines
10971097 memcpy(coded_packet->second_source, second_source, ETH_ALEN);
10981098 memcpy(coded_packet->second_orig_dest, packet2->dest, ETH_ALEN);
10991099 coded_packet->second_crc = packet_id2;
1100− coded_packet->second_ttl = packet2->header.ttl;
1100+ coded_packet->second_ttl = packet2->ttl;
11011101 coded_packet->second_ttvn = packet2->ttvn;
11021102 coded_packet->coded_len = htons(coding_len);
11031103
@@ -1452,7 +1452,7 @@ bool batadv_nc_skb_forward(struct sk_buff *skb, · 348 unmodified lines
14521452 /* We only handle unicast packets */
14531453 payload = skb_network_header(skb);
14541454 packet = (struct batadv_unicast_packet *)payload;
1455− if (packet->header.packet_type != BATADV_UNICAST)
1455+ if (packet->packet_type != BATADV_UNICAST)
14561456 goto out;
14571457
14581458 /* Try to find a coding opportunity and send the skb if one is found */
@@ -1505,7 +1505,7 @@ void batadv_nc_skb_store_for_decoding(struct batadv_priv *bat_priv, · 46 unmodified lines
15051505 /* Check for supported packet type */
15061506 payload = skb_network_header(skb);
15071507 packet = (struct batadv_unicast_packet *)payload;
1508− if (packet->header.packet_type != BATADV_UNICAST)
1508+ if (packet->packet_type != BATADV_UNICAST)
15091509 goto out;
15101510
15111511 /* Find existing nc_path or create a new */
@@ -1623,7 +1623,7 @@ batadv_nc_skb_decode_packet(struct batadv_priv *bat_priv, struct sk_buff *skb, · 111 unmodified lines
16231623 ttvn = coded_packet_tmp.second_ttvn;
16241624 } else {
16251625 orig_dest = coded_packet_tmp.first_orig_dest;
1626− ttl = coded_packet_tmp.header.ttl;
1626+ ttl = coded_packet_tmp.ttl;
16271627 ttvn = coded_packet_tmp.first_ttvn;
16281628 }
16291629
@@ -1648,9 +1648,9 @@ batadv_nc_skb_decode_packet(struct batadv_priv *bat_priv, struct sk_buff *skb, · 18 unmodified lines
16481648
16491649 /* Create decoded unicast packet */
16501650 unicast_packet = (struct batadv_unicast_packet *)skb->data;
1651− unicast_packet->header.packet_type = BATADV_UNICAST;
1652− unicast_packet->header.version = BATADV_COMPAT_VERSION;
1653− unicast_packet->header.ttl = ttl;
1651+ unicast_packet->packet_type = BATADV_UNICAST;
1652+ unicast_packet->version = BATADV_COMPAT_VERSION;
1653+ unicast_packet->ttl = ttl;
16541654 memcpy(unicast_packet->dest, orig_dest, ETH_ALEN);
16551655 unicast_packet->ttvn = ttvn;
16561656
net/batman-adv/packet.h+94−30
@@ -155,6 +155,7 @@ enum batadv_tvlv_type { · 154 unmodified lines
155155 BATADV_TVLV_ROAM = 0x05,
156156 };
157157
158+#pragma pack(2)
158159 /* the destination hardware field in the ARP frame is used to
159160 * transport the claim type and the group id
160161 */
@@ -163,24 +164,20 @@ struct batadv_bla_claim_dst { · 2 unmodified lines
163164 uint8_t type; /* bla_claimframe */
164165 __be16 group; /* group id */
165166 };
166−
167−struct batadv_header {
168− uint8_t packet_type;
169− uint8_t version; /* batman version field */
170− uint8_t ttl;
171− /* the parent struct has to add a byte after the header to make
172− * everything 4 bytes aligned again
173− */
174−};
167+#pragma pack()
175168
176169 /**
177170 * struct batadv_ogm_packet - ogm (routing protocol) packet
178− * @header: common batman packet header
171+ * @packet_type: batman-adv packet type, part of the general header
172+ * @version: batman-adv protocol version, part of the genereal header
173+ * @ttl: time to live for this packet, part of the genereal header
179174 * @flags: contains routing relevant flags - see enum batadv_iv_flags
180175 * @tvlv_len: length of tvlv data following the ogm header
181176 */
182177 struct batadv_ogm_packet {
183− struct batadv_header header;
178+ uint8_t packet_type;
179+ uint8_t version;
180+ uint8_t ttl;
184181 uint8_t flags;
185182 __be32 seqno;
186183 uint8_t orig[ETH_ALEN];
@@ -196,29 +193,51 @@ struct batadv_ogm_packet { · 9 unmodified lines
196193 #define BATADV_OGM_HLEN sizeof(struct batadv_ogm_packet)
197194
198195 /**
199− * batadv_icmp_header - common ICMP header
200− * @header: common batman header
196+ * batadv_icmp_header - common members among all the ICMP packets
197+ * @packet_type: batman-adv packet type, part of the general header
198+ * @version: batman-adv protocol version, part of the genereal header
199+ * @ttl: time to live for this packet, part of the genereal header
201200 * @msg_type: ICMP packet type
202201 * @dst: address of the destination node
203202 * @orig: address of the source node
204203 * @uid: local ICMP socket identifier
204+ * @align: not used - useful for alignment purposes only
205+ *
206+ * This structure is used for ICMP packets parsing only and it is never sent
207+ * over the wire. The alignment field at the end is there to ensure that
208+ * members are padded the same way as they are in real packets.
205209 */
206210 struct batadv_icmp_header {
207− struct batadv_header header;
211+ uint8_t packet_type;
212+ uint8_t version;
213+ uint8_t ttl;
208214 uint8_t msg_type; /* see ICMP message types above */
209215 uint8_t dst[ETH_ALEN];
210216 uint8_t orig[ETH_ALEN];
211217 uint8_t uid;
218+ uint8_t align[3];
212219 };
213220
214221 /**
215222 * batadv_icmp_packet - ICMP packet
216− * @icmph: common ICMP header
223+ * @packet_type: batman-adv packet type, part of the general header
224+ * @version: batman-adv protocol version, part of the genereal header
225+ * @ttl: time to live for this packet, part of the genereal header
226+ * @msg_type: ICMP packet type
227+ * @dst: address of the destination node
228+ * @orig: address of the source node
229+ * @uid: local ICMP socket identifier
217230 * @reserved: not used - useful for alignment
218231 * @seqno: ICMP sequence number
219232 */
220233 struct batadv_icmp_packet {
221− struct batadv_icmp_header icmph;
234+ uint8_t packet_type;
235+ uint8_t version;
236+ uint8_t ttl;
237+ uint8_t msg_type; /* see ICMP message types above */
238+ uint8_t dst[ETH_ALEN];
239+ uint8_t orig[ETH_ALEN];
240+ uint8_t uid;
222241 uint8_t reserved;
223242 __be16 seqno;
224243 };
@@ -227,13 +246,25 @@ struct batadv_icmp_packet { · 2 unmodified lines
227246
228247 /**
229248 * batadv_icmp_packet_rr - ICMP RouteRecord packet
230− * @icmph: common ICMP header
249+ * @packet_type: batman-adv packet type, part of the general header
250+ * @version: batman-adv protocol version, part of the genereal header
251+ * @ttl: time to live for this packet, part of the genereal header
252+ * @msg_type: ICMP packet type
253+ * @dst: address of the destination node
254+ * @orig: address of the source node
255+ * @uid: local ICMP socket identifier
231256 * @rr_cur: number of entries the rr array
232257 * @seqno: ICMP sequence number
233258 * @rr: route record array
234259 */
235260 struct batadv_icmp_packet_rr {
236− struct batadv_icmp_header icmph;
261+ uint8_t packet_type;
262+ uint8_t version;
263+ uint8_t ttl;
264+ uint8_t msg_type; /* see ICMP message types above */
265+ uint8_t dst[ETH_ALEN];
266+ uint8_t orig[ETH_ALEN];
267+ uint8_t uid;
237268 uint8_t rr_cur;
238269 __be16 seqno;
239270 uint8_t rr[BATADV_RR_LEN][ETH_ALEN];
@@ -253,8 +284,18 @@ struct batadv_icmp_packet_rr { · 13 unmodified lines
253284 */
254285 #pragma pack(2)
255286
287+/**
288+ * struct batadv_unicast_packet - unicast packet for network payload
289+ * @packet_type: batman-adv packet type, part of the general header
290+ * @version: batman-adv protocol version, part of the genereal header
291+ * @ttl: time to live for this packet, part of the genereal header
292+ * @ttvn: translation table version number
293+ * @dest: originator destination of the unicast packet
294+ */
256295 struct batadv_unicast_packet {
257− struct batadv_header header;
296+ uint8_t packet_type;
297+ uint8_t version;
298+ uint8_t ttl;
258299 uint8_t ttvn; /* destination translation table version number */
259300 uint8_t dest[ETH_ALEN];
260301 /* "4 bytes boundary + 2 bytes" long to make the payload after the
@@ -280,7 +321,9 @@ struct batadv_unicast_4addr_packet { · 19 unmodified lines
280321
281322 /**
282323 * struct batadv_frag_packet - fragmented packet
283− * @header: common batman packet header with type, compatversion, and ttl
324+ * @packet_type: batman-adv packet type, part of the general header
325+ * @version: batman-adv protocol version, part of the genereal header
326+ * @ttl: time to live for this packet, part of the genereal header
284327 * @dest: final destination used when routing fragments
285328 * @orig: originator of the fragment used when merging the packet
286329 * @no: fragment number within this sequence
@@ -289,7 +332,9 @@ struct batadv_unicast_4addr_packet { · 2 unmodified lines
289332 * @total_size: size of the merged packet
290333 */
291334 struct batadv_frag_packet {
292− struct batadv_header header;
335+ uint8_t packet_type;
336+ uint8_t version; /* batman version field */
337+ uint8_t ttl;
293338 #if defined(__BIG_ENDIAN_BITFIELD)
294339 uint8_t no:4;
295340 uint8_t reserved:4;
@@ -305,8 +350,19 @@ struct batadv_frag_packet { · 9 unmodified lines
305350 __be16 total_size;
306351 };
307352
353+/**
354+ * struct batadv_bcast_packet - broadcast packet for network payload
355+ * @packet_type: batman-adv packet type, part of the general header
356+ * @version: batman-adv protocol version, part of the genereal header
357+ * @ttl: time to live for this packet, part of the genereal header
358+ * @reserved: reserved byte for alignment
359+ * @seqno: sequence identification
360+ * @orig: originator of the broadcast packet
361+ */
308362 struct batadv_bcast_packet {
309− struct batadv_header header;
363+ uint8_t packet_type;
364+ uint8_t version; /* batman version field */
365+ uint8_t ttl;
310366 uint8_t reserved;
311367 __be32 seqno;
312368 uint8_t orig[ETH_ALEN];
@@ -315,11 +371,11 @@ struct batadv_bcast_packet { · 2 unmodified lines
315371 */
316372 };
317373
318−#pragma pack()
319−
320374 /**
321375 * struct batadv_coded_packet - network coded packet
322− * @header: common batman packet header and ttl of first included packet
376+ * @packet_type: batman-adv packet type, part of the general header
377+ * @version: batman-adv protocol version, part of the genereal header
378+ * @ttl: time to live for this packet, part of the genereal header
323379 * @reserved: Align following fields to 2-byte boundaries
324380 * @first_source: original source of first included packet
325381 * @first_orig_dest: original destinal of first included packet
@@ -334,7 +390,9 @@ struct batadv_bcast_packet { · 8 unmodified lines
334390 * @coded_len: length of network coded part of the payload
335391 */
336392 struct batadv_coded_packet {
337− struct batadv_header header;
393+ uint8_t packet_type;
394+ uint8_t version; /* batman version field */
395+ uint8_t ttl;
338396 uint8_t first_ttvn;
339397 /* uint8_t first_dest[ETH_ALEN]; - saved in mac header destination */
340398 uint8_t first_source[ETH_ALEN];
@@ -349,9 +407,13 @@ struct batadv_coded_packet { · 8 unmodified lines
349407 __be16 coded_len;
350408 };
351409
410+#pragma pack()
411+
352412 /**
353413 * struct batadv_unicast_tvlv - generic unicast packet with tvlv payload
354− * @header: common batman packet header
414+ * @packet_type: batman-adv packet type, part of the general header
415+ * @version: batman-adv protocol version, part of the genereal header
416+ * @ttl: time to live for this packet, part of the genereal header
355417 * @reserved: reserved field (for packet alignment)
356418 * @src: address of the source
357419 * @dst: address of the destination
@@ -359,7 +421,9 @@ struct batadv_coded_packet { · 1 unmodified line
359421 * @align: 2 bytes to align the header to a 4 byte boundry
360422 */
361423 struct batadv_unicast_tvlv_packet {
362− struct batadv_header header;
424+ uint8_t packet_type;
425+ uint8_t version; /* batman version field */
426+ uint8_t ttl;
363427 uint8_t reserved;
364428 uint8_t dst[ETH_ALEN];
365429 uint8_t src[ETH_ALEN];
@@ -420,13 +484,13 @@ struct batadv_tvlv_tt_vlan_data { · 54 unmodified lines
420484 * struct batadv_tvlv_tt_change - translation table diff data
421485 * @flags: status indicators concerning the non-mesh client (see
422486 * batadv_tt_client_flags)
423− * @reserved: reserved field
487+ * @reserved: reserved field - useful for alignment purposes only
424488 * @addr: mac address of non-mesh client that triggered this tt change
425489 * @vid: VLAN identifier
426490 */
427491 struct batadv_tvlv_tt_change {
428492 uint8_t flags;
429− uint8_t reserved;
493+ uint8_t reserved[3];
430494 uint8_t addr[ETH_ALEN];
431495 __be16 vid;
432496 };
net/batman-adv/routing.c+15−15
@@ -308,7 +308,7 @@ static int batadv_recv_my_icmp_packet(struct batadv_priv *bat_priv, · 307 unmodified lines
308308 memcpy(icmph->dst, icmph->orig, ETH_ALEN);
309309 memcpy(icmph->orig, primary_if->net_dev->dev_addr, ETH_ALEN);
310310 icmph->msg_type = BATADV_ECHO_REPLY;
311− icmph->header.ttl = BATADV_TTL;
311+ icmph->ttl = BATADV_TTL;
312312
313313 res = batadv_send_skb_to_orig(skb, orig_node, NULL);
314314 if (res != NET_XMIT_DROP)
@@ -338,9 +338,9 @@ static int batadv_recv_icmp_ttl_exceeded(struct batadv_priv *bat_priv, · 23 unmodified lines
338338 icmp_packet = (struct batadv_icmp_packet *)skb->data;
339339
340340 /* send TTL exceeded if packet is an echo request (traceroute) */
341− if (icmp_packet->icmph.msg_type != BATADV_ECHO_REQUEST) {
341+ if (icmp_packet->msg_type != BATADV_ECHO_REQUEST) {
342342 pr_debug("Warning - can't forward icmp packet from %pM to %pM: ttl exceeded\n",
343− icmp_packet->icmph.orig, icmp_packet->icmph.dst);
343+ icmp_packet->orig, icmp_packet->dst);
344344 goto out;
345345 }
346346
@@ -349,7 +349,7 @@ static int batadv_recv_icmp_ttl_exceeded(struct batadv_priv *bat_priv, · 2 unmodified lines
349349 goto out;
350350
351351 /* get routing information */
352− orig_node = batadv_orig_hash_find(bat_priv, icmp_packet->icmph.orig);
352+ orig_node = batadv_orig_hash_find(bat_priv, icmp_packet->orig);
353353 if (!orig_node)
354354 goto out;
355355
@@ -359,11 +359,11 @@ static int batadv_recv_icmp_ttl_exceeded(struct batadv_priv *bat_priv, · 3 unmodified lines
359359
360360 icmp_packet = (struct batadv_icmp_packet *)skb->data;
361361
362− memcpy(icmp_packet->icmph.dst, icmp_packet->icmph.orig, ETH_ALEN);
363− memcpy(icmp_packet->icmph.orig, primary_if->net_dev->dev_addr,
362+ memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN);
363+ memcpy(icmp_packet->orig, primary_if->net_dev->dev_addr,
364364 ETH_ALEN);
365− icmp_packet->icmph.msg_type = BATADV_TTL_EXCEEDED;
366− icmp_packet->icmph.header.ttl = BATADV_TTL;
365+ icmp_packet->msg_type = BATADV_TTL_EXCEEDED;
366+ icmp_packet->ttl = BATADV_TTL;
367367
368368 if (batadv_send_skb_to_orig(skb, orig_node, NULL) != NET_XMIT_DROP)
369369 ret = NET_RX_SUCCESS;
@@ -434,7 +434,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb, · 64 unmodified lines
434434 return batadv_recv_my_icmp_packet(bat_priv, skb);
435435
436436 /* TTL exceeded */
437− if (icmph->header.ttl < 2)
437+ if (icmph->ttl < 2)
438438 return batadv_recv_icmp_ttl_exceeded(bat_priv, skb);
439439
440440 /* get routing information */
@@ -449,7 +449,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb, · 8 unmodified lines
449449 icmph = (struct batadv_icmp_header *)skb->data;
450450
451451 /* decrement ttl */
452− icmph->header.ttl--;
452+ icmph->ttl--;
453453
454454 /* route it */
455455 if (batadv_send_skb_to_orig(skb, orig_node, recv_if) != NET_XMIT_DROP)
@@ -709,7 +709,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb, · 253 unmodified lines
709709 unicast_packet = (struct batadv_unicast_packet *)skb->data;
710710
711711 /* TTL exceeded */
712− if (unicast_packet->header.ttl < 2) {
712+ if (unicast_packet->ttl < 2) {
713713 pr_debug("Warning - can't forward unicast packet from %pM to %pM: ttl exceeded\n",
714714 ethhdr->h_source, unicast_packet->dest);
715715 goto out;
@@ -727,9 +727,9 @@ static int batadv_route_unicast_packet(struct sk_buff *skb, · 11 unmodified lines
727727
728728 /* decrement ttl */
729729 unicast_packet = (struct batadv_unicast_packet *)skb->data;
730− unicast_packet->header.ttl--;
730+ unicast_packet->ttl--;
731731
732− switch (unicast_packet->header.packet_type) {
732+ switch (unicast_packet->packet_type) {
733733 case BATADV_UNICAST_4ADDR:
734734 hdr_len = sizeof(struct batadv_unicast_4addr_packet);
735735 break;
@@ -970,7 +970,7 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, · 234 unmodified lines
970970 unicast_packet = (struct batadv_unicast_packet *)skb->data;
971971 unicast_4addr_packet = (struct batadv_unicast_4addr_packet *)skb->data;
972972
973− is4addr = unicast_packet->header.packet_type == BATADV_UNICAST_4ADDR;
973+ is4addr = unicast_packet->packet_type == BATADV_UNICAST_4ADDR;
974974 /* the caller function should have already pulled 2 bytes */
975975 if (is4addr)
976976 hdr_size = sizeof(*unicast_4addr_packet);
@@ -1160,7 +1160,7 @@ int batadv_recv_bcast_packet(struct sk_buff *skb, · 183 unmodified lines
11601160 if (batadv_is_my_mac(bat_priv, bcast_packet->orig))
11611161 goto out;
11621162
1163− if (bcast_packet->header.ttl < 2)
1163+ if (bcast_packet->ttl < 2)
11641164 goto out;
11651165
11661166 orig_node = batadv_orig_hash_find(bat_priv, bcast_packet->orig);
net/batman-adv/send.c+5−5
@@ -161,11 +161,11 @@ batadv_send_skb_push_fill_unicast(struct sk_buff *skb, int hdr_size, · 160 unmodified lines
161161 return false;
162162
163163 unicast_packet = (struct batadv_unicast_packet *)skb->data;
164− unicast_packet->header.version = BATADV_COMPAT_VERSION;
164+ unicast_packet->version = BATADV_COMPAT_VERSION;
165165 /* batman packet type: unicast */
166− unicast_packet->header.packet_type = BATADV_UNICAST;
166+ unicast_packet->packet_type = BATADV_UNICAST;
167167 /* set unicast ttl */
168− unicast_packet->header.ttl = BATADV_TTL;
168+ unicast_packet->ttl = BATADV_TTL;
169169 /* copy the destination for faster routing */
170170 memcpy(unicast_packet->dest, orig_node->orig, ETH_ALEN);
171171 /* set the destination tt version number */
@@ -221,7 +221,7 @@ bool batadv_send_skb_prepare_unicast_4addr(struct batadv_priv *bat_priv, · 49 unmodified lines
221221 goto out;
222222
223223 uc_4addr_packet = (struct batadv_unicast_4addr_packet *)skb->data;
224− uc_4addr_packet->u.header.packet_type = BATADV_UNICAST_4ADDR;
224+ uc_4addr_packet->u.packet_type = BATADV_UNICAST_4ADDR;
225225 memcpy(uc_4addr_packet->src, primary_if->net_dev->dev_addr, ETH_ALEN);
226226 uc_4addr_packet->subtype = packet_subtype;
227227 uc_4addr_packet->reserved = 0;
@@ -436,7 +436,7 @@ int batadv_add_bcast_packet_to_list(struct batadv_priv *bat_priv, · 208 unmodified lines
436436
437437 /* as we have a copy now, it is safe to decrease the TTL */
438438 bcast_packet = (struct batadv_bcast_packet *)newskb->data;
439− bcast_packet->header.ttl--;
439+ bcast_packet->ttl--;
440440
441441 skb_reset_mac_header(newskb);
442442
net/batman-adv/soft-interface.c+12−6
@@ -264,11 +264,11 @@ static int batadv_interface_tx(struct sk_buff *skb, · 263 unmodified lines
264264 goto dropped;
265265
266266 bcast_packet = (struct batadv_bcast_packet *)skb->data;
267− bcast_packet->header.version = BATADV_COMPAT_VERSION;
268− bcast_packet->header.ttl = BATADV_TTL;
267+ bcast_packet->version = BATADV_COMPAT_VERSION;
268+ bcast_packet->ttl = BATADV_TTL;
269269
270270 /* batman packet type: broadcast */
271− bcast_packet->header.packet_type = BATADV_BCAST;
271+ bcast_packet->packet_type = BATADV_BCAST;
272272 bcast_packet->reserved = 0;
273273
274274 /* hw address of first interface is the orig mac because only
@@ -328,7 +328,7 @@ void batadv_interface_rx(struct net_device *soft_iface, · 53 unmodified lines
328328 struct sk_buff *skb, struct batadv_hard_iface *recv_if,
329329 int hdr_size, struct batadv_orig_node *orig_node)
330330 {
331− struct batadv_header *batadv_header = (struct batadv_header *)skb->data;
331+ struct batadv_bcast_packet *batadv_bcast_packet;
332332 struct batadv_priv *bat_priv = netdev_priv(soft_iface);
333333 __be16 ethertype = htons(ETH_P_BATMAN);
334334 struct vlan_ethhdr *vhdr;
@@ -336,7 +336,8 @@ void batadv_interface_rx(struct net_device *soft_iface, · 1 unmodified line
336336 unsigned short vid;
337337 bool is_bcast;
338338
339− is_bcast = (batadv_header->packet_type == BATADV_BCAST);
339+ batadv_bcast_packet = (struct batadv_bcast_packet *)skb->data;
340+ is_bcast = (batadv_bcast_packet->packet_type == BATADV_BCAST);
340341
341342 /* check if enough space is available for pulling, and pull */
342343 if (!pskb_may_pull(skb, hdr_size))
@@ -345,7 +346,12 @@ void batadv_interface_rx(struct net_device *soft_iface, · 2 unmodified lines
345346 skb_pull_rcsum(skb, hdr_size);
346347 skb_reset_mac_header(skb);
347348
348− vid = batadv_get_vid(skb, hdr_size);
349+ /* clean the netfilter state now that the batman-adv header has been
350+ * removed
351+ */
352+ nf_reset(skb);
353+
354+ vid = batadv_get_vid(skb, 0);
349355 ethhdr = eth_hdr(skb);
350356
351357 switch (ntohs(ethhdr->h_proto)) {
net/batman-adv/translation-table.c+4−2
@@ -333,7 +333,8 @@ static void batadv_tt_local_event(struct batadv_priv *bat_priv, · 332 unmodified lines
333333 return;
334334
335335 tt_change_node->change.flags = flags;
336− tt_change_node->change.reserved = 0;
336+ memset(tt_change_node->change.reserved, 0,
337+ sizeof(tt_change_node->change.reserved));
337338 memcpy(tt_change_node->change.addr, common->addr, ETH_ALEN);
338339 tt_change_node->change.vid = htons(common->vid);
339340
@@ -2221,7 +2222,8 @@ static void batadv_tt_tvlv_generate(struct batadv_priv *bat_priv, · 1881 unmodified lines
22212222 ETH_ALEN);
22222223 tt_change->flags = tt_common_entry->flags;
22232224 tt_change->vid = htons(tt_common_entry->vid);
2224− tt_change->reserved = 0;
2225+ memset(tt_change->reserved, 0,
2226+ sizeof(tt_change->reserved));
22252227
22262228 tt_num_entries++;
22272229 tt_change++;
net/bluetooth/hci_sock.c+16−10
@@ -940,8 +940,22 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock, · 939 unmodified lines
940940 bt_cb(skb)->pkt_type = *((unsigned char *) skb->data);
941941 skb_pull(skb, 1);
942942
943− if (hci_pi(sk)->channel == HCI_CHANNEL_RAW &&
944− bt_cb(skb)->pkt_type == HCI_COMMAND_PKT) {
943+ if (hci_pi(sk)->channel == HCI_CHANNEL_USER) {
944+ /* No permission check is needed for user channel
945+ * since that gets enforced when binding the socket.
946+ *
947+ * However check that the packet type is valid.
948+ */
949+ if (bt_cb(skb)->pkt_type != HCI_COMMAND_PKT &&
950+ bt_cb(skb)->pkt_type != HCI_ACLDATA_PKT &&
951+ bt_cb(skb)->pkt_type != HCI_SCODATA_PKT) {
952+ err = -EINVAL;
953+ goto drop;
954+ }
955+
956+ skb_queue_tail(&hdev->raw_q, skb);
957+ queue_work(hdev->workqueue, &hdev->tx_work);
958+ } else if (bt_cb(skb)->pkt_type == HCI_COMMAND_PKT) {
945959 u16 opcode = get_unaligned_le16(skb->data);
946960 u16 ogf = hci_opcode_ogf(opcode);
947961 u16 ocf = hci_opcode_ocf(opcode);
@@ -972,14 +986,6 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock, · 24 unmodified lines
972986 goto drop;
973987 }
974988
975− if (hci_pi(sk)->channel == HCI_CHANNEL_USER &&
976− bt_cb(skb)->pkt_type != HCI_COMMAND_PKT &&
977− bt_cb(skb)->pkt_type != HCI_ACLDATA_PKT &&
978− bt_cb(skb)->pkt_type != HCI_SCODATA_PKT) {
979− err = -EINVAL;
980− goto drop;
981− }
982−
983989 skb_queue_tail(&hdev->raw_q, skb);
984990 queue_work(hdev->workqueue, &hdev->tx_work);
985991 }
net/bridge/br_multicast.c+2−2
@@ -1998,7 +1998,7 @@ int br_multicast_set_hash_max(struct net_bridge *br, unsigned long val) · 1997 unmodified lines
19981998 u32 old;
19991999 struct net_bridge_mdb_htable *mdb;
20002000
2001− spin_lock(&br->multicast_lock);
2001+ spin_lock_bh(&br->multicast_lock);
20022002 if (!netif_running(br->dev))
20032003 goto unlock;
20042004
@@ -2030,7 +2030,7 @@ rollback: · 25 unmodified lines
20302030 }
20312031
20322032 unlock:
2033− spin_unlock(&br->multicast_lock);
2033+ spin_unlock_bh(&br->multicast_lock);
20342034
20352035 return err;
20362036 }
net/core/dev.c+18−13
@@ -2539,7 +2539,7 @@ static inline int skb_needs_linearize(struct sk_buff *skb, · 2538 unmodified lines
25392539 }
25402540
25412541 int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2542− struct netdev_queue *txq, void *accel_priv)
2542+ struct netdev_queue *txq)
25432543 {
25442544 const struct net_device_ops *ops = dev->netdev_ops;
25452545 int rc = NETDEV_TX_OK;
@@ -2605,13 +2605,10 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, · 59 unmodified lines
26052605 dev_queue_xmit_nit(skb, dev);
26062606
26072607 skb_len = skb->len;
2608− if (accel_priv)
2609− rc = ops->ndo_dfwd_start_xmit(skb, dev, accel_priv);
2610− else
26112608 rc = ops->ndo_start_xmit(skb, dev);
26122609
26132610 trace_net_dev_xmit(skb, rc, dev, skb_len);
2614− if (rc == NETDEV_TX_OK && txq)
2611+ if (rc == NETDEV_TX_OK)
26152612 txq_trans_update(txq);
26162613 return rc;
26172614 }
@@ -2627,10 +2624,7 @@ gso: · 9 unmodified lines
26272624 dev_queue_xmit_nit(nskb, dev);
26282625
26292626 skb_len = nskb->len;
2630− if (accel_priv)
2631− rc = ops->ndo_dfwd_start_xmit(nskb, dev, accel_priv);
2632− else
2633− rc = ops->ndo_start_xmit(nskb, dev);
2627+ rc = ops->ndo_start_xmit(nskb, dev);
26342628 trace_net_dev_xmit(nskb, rc, dev, skb_len);
26352629 if (unlikely(rc != NETDEV_TX_OK)) {
26362630 if (rc & ~NETDEV_TX_MASK)
@@ -2811,7 +2805,7 @@ EXPORT_SYMBOL(dev_loopback_xmit); · 174 unmodified lines
28112805 * the BH enable code must have IRQs enabled so that it will not deadlock.
28122806 * --BLG
28132807 */
2814−int dev_queue_xmit(struct sk_buff *skb)
2808+int __dev_queue_xmit(struct sk_buff *skb, void *accel_priv)
28152809 {
28162810 struct net_device *dev = skb->dev;
28172811 struct netdev_queue *txq;
@@ -2827,7 +2821,7 @@ int dev_queue_xmit(struct sk_buff *skb) · 9 unmodified lines
28272821
28282822 skb_update_prio(skb);
28292823
2830− txq = netdev_pick_tx(dev, skb);
2824+ txq = netdev_pick_tx(dev, skb, accel_priv);
28312825 q = rcu_dereference_bh(txq->qdisc);
28322826
28332827 #ifdef CONFIG_NET_CLS_ACT
@@ -2863,7 +2857,7 @@ int dev_queue_xmit(struct sk_buff *skb) · 29 unmodified lines
28632857
28642858 if (!netif_xmit_stopped(txq)) {
28652859 __this_cpu_inc(xmit_recursion);
2866− rc = dev_hard_start_xmit(skb, dev, txq, NULL);
2860+ rc = dev_hard_start_xmit(skb, dev, txq);
28672861 __this_cpu_dec(xmit_recursion);
28682862 if (dev_xmit_complete(rc)) {
28692863 HARD_TX_UNLOCK(dev, txq);
@@ -2892,8 +2886,19 @@ out: · 22 unmodified lines
28922886 rcu_read_unlock_bh();
28932887 return rc;
28942888 }
2889+
2890+int dev_queue_xmit(struct sk_buff *skb)
2891+{
2892+ return __dev_queue_xmit(skb, NULL);
2893+}
28952894 EXPORT_SYMBOL(dev_queue_xmit);
28962895
2896+int dev_queue_xmit_accel(struct sk_buff *skb, void *accel_priv)
2897+{
2898+ return __dev_queue_xmit(skb, accel_priv);
2899+}
2900+EXPORT_SYMBOL(dev_queue_xmit_accel);
2901+
28972902
28982903 /*=======================================================================
28992904 Receiver routines
@@ -4500,7 +4505,7 @@ struct net_device *netdev_all_upper_get_next_dev_rcu(struct net_device *dev, · 1600 unmodified lines
45004505 {
45014506 struct netdev_adjacent *upper;
45024507
4503− WARN_ON_ONCE(!rcu_read_lock_held());
4508+ WARN_ON_ONCE(!rcu_read_lock_held() && !lockdep_rtnl_is_held());
45044509
45054510 upper = list_entry_rcu((*iter)->next, struct netdev_adjacent, list);
45064511
net/core/flow_dissector.c+7−3
@@ -395,17 +395,21 @@ u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb) · 394 unmodified lines
395395 EXPORT_SYMBOL(__netdev_pick_tx);
396396
397397 struct netdev_queue *netdev_pick_tx(struct net_device *dev,
398− struct sk_buff *skb)
398+ struct sk_buff *skb,
399+ void *accel_priv)
399400 {
400401 int queue_index = 0;
401402
402403 if (dev->real_num_tx_queues != 1) {
403404 const struct net_device_ops *ops = dev->netdev_ops;
404405 if (ops->ndo_select_queue)
405− queue_index = ops->ndo_select_queue(dev, skb);
406+ queue_index = ops->ndo_select_queue(dev, skb,
407+ accel_priv);
406408 else
407409 queue_index = __netdev_pick_tx(dev, skb);
408− queue_index = dev_cap_txqueue(dev, queue_index);
410+
411+ if (!accel_priv)
412+ queue_index = dev_cap_txqueue(dev, queue_index);
409413 }
410414
411415 skb_set_queue_mapping(skb, queue_index);
net/core/neighbour.c+2−1
@@ -1161,6 +1161,7 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, · 1160 unmodified lines
11611161 neigh->parms->reachable_time :
11621162 0)));
11631163 neigh->nud_state = new;
1164+ notify = 1;
11641165 }
11651166
11661167 if (lladdr != neigh->ha) {
@@ -1274,7 +1275,7 @@ int neigh_compat_output(struct neighbour *neigh, struct sk_buff *skb) · 107 unmodified lines
12741275
12751276 if (dev_hard_header(skb, dev, ntohs(skb->protocol), NULL, NULL,
12761277 skb->len) < 0 &&
1277− dev->header_ops->rebuild(skb))
1278+ dev_rebuild_header(skb))
12781279 return 0;
12791280
12801281 return dev_queue_xmit(skb);
net/core/netpoll.c+10−3
@@ -375,7 +375,7 @@ void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb, · 374 unmodified lines
375375 if (skb_queue_len(&npinfo->txq) == 0 && !netpoll_owner_active(dev)) {
376376 struct netdev_queue *txq;
377377
378− txq = netdev_pick_tx(dev, skb);
378+ txq = netdev_pick_tx(dev, skb, NULL);
379379
380380 /* try until next clock tick */
381381 for (tries = jiffies_to_usecs(1)/USEC_PER_POLL;
@@ -386,8 +386,14 @@ void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb, · 4 unmodified lines
386386 !vlan_hw_offload_capable(netif_skb_features(skb),
387387 skb->vlan_proto)) {
388388 skb = __vlan_put_tag(skb, skb->vlan_proto, vlan_tx_tag_get(skb));
389− if (unlikely(!skb))
390− break;
389+ if (unlikely(!skb)) {
390+ /* This is actually a packet drop, but we
391+ * don't want the code at the end of this
392+ * function to try and re-queue a NULL skb.
393+ */
394+ status = NETDEV_TX_OK;
395+ goto unlock_txq;
396+ }
391397 skb->vlan_tci = 0;
392398 }
393399
@@ -395,6 +401,7 @@ void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb, · 1 unmodified line
395401 if (status == NETDEV_TX_OK)
396402 txq_trans_update(txq);
397403 }
404+ unlock_txq:
398405 __netif_tx_unlock(txq);
399406
400407 if (status == NETDEV_TX_OK)
net/dccp/probe.c+7−12
@@ -152,17 +152,6 @@ static const struct file_operations dccpprobe_fops = { · 151 unmodified lines
152152 .llseek = noop_llseek,
153153 };
154154
155−static __init int setup_jprobe(void)
156−{
157− int ret = register_jprobe(&dccp_send_probe);
158−
159− if (ret) {
160− request_module("dccp");
161− ret = register_jprobe(&dccp_send_probe);
162− }
163− return ret;
164−}
165−
166155 static __init int dccpprobe_init(void)
167156 {
168157 int ret = -ENOMEM;
@@ -174,7 +163,13 @@ static __init int dccpprobe_init(void) · 5 unmodified lines
174163 if (!proc_create(procname, S_IRUSR, init_net.proc_net, &dccpprobe_fops))
175164 goto err0;
176165
177− ret = setup_jprobe();
166+ ret = register_jprobe(&dccp_send_probe);
167+ if (ret) {
168+ ret = request_module("dccp");
169+ if (!ret)
170+ ret = register_jprobe(&dccp_send_probe);
171+ }
172+
178173 if (ret)
179174 goto err1;
180175
net/ieee802154/6lowpan.c+1−1
@@ -547,7 +547,7 @@ static int lowpan_header_create(struct sk_buff *skb, · 546 unmodified lines
547547 hc06_ptr += 3;
548548 } else {
549549 /* compress nothing */
550− memcpy(hc06_ptr, &hdr, 4);
550+ memcpy(hc06_ptr, hdr, 4);
551551 /* replace the top byte with new ECN | DSCP format */
552552 *hc06_ptr = tmp;
553553 hc06_ptr += 4;
net/ipv4/gre_offload.c+7−4
@@ -28,6 +28,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb, · 27 unmodified lines
2828 netdev_features_t enc_features;
2929 int ghl = GRE_HEADER_SECTION;
3030 struct gre_base_hdr *greh;
31+ u16 mac_offset = skb->mac_header;
3132 int mac_len = skb->mac_len;
3233 __be16 protocol = skb->protocol;
3334 int tnl_hlen;
@@ -58,13 +59,13 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb, · 24 unmodified lines
5859 } else
5960 csum = false;
6061
62+ if (unlikely(!pskb_may_pull(skb, ghl)))
63+ goto out;
64+
6165 /* setup inner skb. */
6266 skb->protocol = greh->protocol;
6367 skb->encapsulation = 0;
6468
65− if (unlikely(!pskb_may_pull(skb, ghl)))
66− goto out;
67−
6869 __skb_pull(skb, ghl);
6970 skb_reset_mac_header(skb);
7071 skb_set_network_header(skb, skb_inner_network_offset(skb));
@@ -73,8 +74,10 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb, · 2 unmodified lines
7374 /* segment inner packet. */
7475 enc_features = skb->dev->hw_enc_features & netif_skb_features(skb);
7576 segs = skb_mac_gso_segment(skb, enc_features);
76− if (!segs || IS_ERR(segs))
77+ if (!segs || IS_ERR(segs)) {
78+ skb_gso_error_unwind(skb, protocol, ghl, mac_offset, mac_len);
7779 goto out;
80+ }
7881
7982 skb = segs;
8083 tnl_hlen = skb_tnl_header_len(skb);
net/ipv4/inet_diag.c+16−0
@@ -106,6 +106,10 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, · 105 unmodified lines
106106
107107 r->id.idiag_sport = inet->inet_sport;
108108 r->id.idiag_dport = inet->inet_dport;
109+
110+ memset(&r->id.idiag_src, 0, sizeof(r->id.idiag_src));
111+ memset(&r->id.idiag_dst, 0, sizeof(r->id.idiag_dst));
112+
109113 r->id.idiag_src[0] = inet->inet_rcv_saddr;
110114 r->id.idiag_dst[0] = inet->inet_daddr;
111115
@@ -240,12 +244,19 @@ static int inet_twsk_diag_fill(struct inet_timewait_sock *tw, · 128 unmodified lines
240244
241245 r->idiag_family = tw->tw_family;
242246 r->idiag_retrans = 0;
247+
243248 r->id.idiag_if = tw->tw_bound_dev_if;
244249 sock_diag_save_cookie(tw, r->id.idiag_cookie);
250+
245251 r->id.idiag_sport = tw->tw_sport;
246252 r->id.idiag_dport = tw->tw_dport;
253+
254+ memset(&r->id.idiag_src, 0, sizeof(r->id.idiag_src));
255+ memset(&r->id.idiag_dst, 0, sizeof(r->id.idiag_dst));
256+
247257 r->id.idiag_src[0] = tw->tw_rcv_saddr;
248258 r->id.idiag_dst[0] = tw->tw_daddr;
259+
249260 r->idiag_state = tw->tw_substate;
250261 r->idiag_timer = 3;
251262 r->idiag_expires = jiffies_to_msecs(tmo);
@@ -726,8 +737,13 @@ static int inet_diag_fill_req(struct sk_buff *skb, struct sock *sk, · 474 unmodified lines
726737
727738 r->id.idiag_sport = inet->inet_sport;
728739 r->id.idiag_dport = ireq->ir_rmt_port;
740+
741+ memset(&r->id.idiag_src, 0, sizeof(r->id.idiag_src));
742+ memset(&r->id.idiag_dst, 0, sizeof(r->id.idiag_dst));
743+
729744 r->id.idiag_src[0] = ireq->ir_loc_addr;
730745 r->id.idiag_dst[0] = ireq->ir_rmt_addr;
746+
731747 r->idiag_expires = jiffies_to_msecs(tmo);
732748 r->idiag_rqueue = 0;
733749 r->idiag_wqueue = 0;
net/ipv4/ip_gre.c+1−0
@@ -217,6 +217,7 @@ static int ipgre_rcv(struct sk_buff *skb, const struct tnl_ptk_info *tpi) · 216 unmodified lines
217217 iph->saddr, iph->daddr, tpi->key);
218218
219219 if (tunnel) {
220+ skb_pop_mac_header(skb);
220221 ip_tunnel_rcv(tunnel, skb, tpi, log_ecn_error);
221222 return PACKET_RCVD;
222223 }
net/ipv4/ip_output.c+3−2
@@ -828,7 +828,7 @@ static int __ip_append_data(struct sock *sk, · 827 unmodified lines
828828
829829 if (cork->length + length > maxnonfragsize - fragheaderlen) {
830830 ip_local_error(sk, EMSGSIZE, fl4->daddr, inet->inet_dport,
831− mtu-exthdrlen);
831+ mtu - (opt ? opt->optlen : 0));
832832 return -EMSGSIZE;
833833 }
834834
@@ -1151,7 +1151,8 @@ ssize_t ip_append_page(struct sock *sk, struct flowi4 *fl4, struct page *page, · 316 unmodified lines
11511151 mtu : 0xFFFF;
11521152
11531153 if (cork->length + size > maxnonfragsize - fragheaderlen) {
1154− ip_local_error(sk, EMSGSIZE, fl4->daddr, inet->inet_dport, mtu);
1154+ ip_local_error(sk, EMSGSIZE, fl4->daddr, inet->inet_dport,
1155+ mtu - (opt ? opt->optlen : 0));
11551156 return -EMSGSIZE;
11561157 }
11571158
net/ipv4/netfilter/ipt_SYNPROXY.c+1−0
@@ -423,6 +423,7 @@ static void synproxy_tg4_destroy(const struct xt_tgdtor_param *par) · 422 unmodified lines
423423 static struct xt_target synproxy_tg4_reg __read_mostly = {
424424 .name = "SYNPROXY",
425425 .family = NFPROTO_IPV4,
426+ .hooks = (1 << NF_INET_LOCAL_IN) | (1 << NF_INET_FORWARD),
426427 .target = synproxy_tg4,
427428 .targetsize = sizeof(struct xt_synproxy_info),
428429 .checkentry = synproxy_tg4_check,
net/ipv4/netfilter/nft_reject_ipv4.c+1−1
@@ -72,7 +72,7 @@ static int nft_reject_dump(struct sk_buff *skb, const struct nft_expr *expr) · 71 unmodified lines
7272 {
7373 const struct nft_reject *priv = nft_expr_priv(expr);
7474
75− if (nla_put_be32(skb, NFTA_REJECT_TYPE, priv->type))
75+ if (nla_put_be32(skb, NFTA_REJECT_TYPE, htonl(priv->type)))
7676 goto nla_put_failure;
7777
7878 switch (priv->type) {
net/ipv4/udp.c+9−10
@@ -1600,20 +1600,15 @@ static void flush_stack(struct sock **stack, unsigned int count, · 1599 unmodified lines
16001600 }
16011601
16021602 /* For TCP sockets, sk_rx_dst is protected by socket lock
1603− * For UDP, we use sk_dst_lock to guard against concurrent changes.
1603+ * For UDP, we use xchg() to guard against concurrent changes.
16041604 */
16051605 static void udp_sk_rx_dst_set(struct sock *sk, struct dst_entry *dst)
16061606 {
16071607 struct dst_entry *old;
16081608
1609− spin_lock(&sk->sk_dst_lock);
1610− old = sk->sk_rx_dst;
1611− if (likely(old != dst)) {
1612− dst_hold(dst);
1613− sk->sk_rx_dst = dst;
1614− dst_release(old);
1615− }
1616− spin_unlock(&sk->sk_dst_lock);
1609+ dst_hold(dst);
1610+ old = xchg(&sk->sk_rx_dst, dst);
1611+ dst_release(old);
16171612 }
16181613
16191614 /*
@@ -2483,6 +2478,7 @@ struct sk_buff *skb_udp_tunnel_segment(struct sk_buff *skb, · 863 unmodified lines
24832478 netdev_features_t features)
24842479 {
24852480 struct sk_buff *segs = ERR_PTR(-EINVAL);
2481+ u16 mac_offset = skb->mac_header;
24862482 int mac_len = skb->mac_len;
24872483 int tnl_hlen = skb_inner_mac_header(skb) - skb_transport_header(skb);
24882484 __be16 protocol = skb->protocol;
@@ -2502,8 +2498,11 @@ struct sk_buff *skb_udp_tunnel_segment(struct sk_buff *skb, · 13 unmodified lines
25022498 /* segment inner packet. */
25032499 enc_features = skb->dev->hw_enc_features & netif_skb_features(skb);
25042500 segs = skb_mac_gso_segment(skb, enc_features);
2505− if (!segs || IS_ERR(segs))
2501+ if (!segs || IS_ERR(segs)) {
2502+ skb_gso_error_unwind(skb, protocol, tnl_hlen, mac_offset,
2503+ mac_len);
25062504 goto out;
2505+ }
25072506
25082507 outer_hlen = skb_tnl_header_len(skb);
25092508 skb = segs;
net/ipv4/udp_offload.c+19−18
@@ -41,6 +41,14 @@ static struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, · 40 unmodified lines
4141 {
4242 struct sk_buff *segs = ERR_PTR(-EINVAL);
4343 unsigned int mss;
44+ int offset;
45+ __wsum csum;
46+
47+ if (skb->encapsulation &&
48+ skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL) {
49+ segs = skb_udp_tunnel_segment(skb, features);
50+ goto out;
51+ }
4452
4553 mss = skb_shinfo(skb)->gso_size;
4654 if (unlikely(skb->len <= mss))
@@ -63,27 +71,20 @@ static struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, · 16 unmodified lines
6371 goto out;
6472 }
6573
74+ /* Do software UFO. Complete and fill in the UDP checksum as
75+ * HW cannot do checksum of UDP packets sent as multiple
76+ * IP fragments.
77+ */
78+ offset = skb_checksum_start_offset(skb);
79+ csum = skb_checksum(skb, offset, skb->len - offset, 0);
80+ offset += skb->csum_offset;
81+ *(__sum16 *)(skb->data + offset) = csum_fold(csum);
82+ skb->ip_summed = CHECKSUM_NONE;
83+
6684 /* Fragment the skb. IP headers of the fragments are updated in
6785 * inet_gso_segment()
6886 */
69− if (skb->encapsulation && skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL)
70− segs = skb_udp_tunnel_segment(skb, features);
71− else {
72− int offset;
73− __wsum csum;
74−
75− /* Do software UFO. Complete and fill in the UDP checksum as
76− * HW cannot do checksum of UDP packets sent as multiple
77− * IP fragments.
78− */
79− offset = skb_checksum_start_offset(skb);
80− csum = skb_checksum(skb, offset, skb->len - offset, 0);
81− offset += skb->csum_offset;
82− *(__sum16 *)(skb->data + offset) = csum_fold(csum);
83− skb->ip_summed = CHECKSUM_NONE;
84−
85− segs = skb_segment(skb, features);
86− }
87+ segs = skb_segment(skb, features);
8788 out:
8889 return segs;
8990 }
net/ipv6/addrconf.c+16−7
@@ -1671,7 +1671,7 @@ void addrconf_leave_solict(struct inet6_dev *idev, const struct in6_addr *addr) · 1670 unmodified lines
16711671 static void addrconf_join_anycast(struct inet6_ifaddr *ifp)
16721672 {
16731673 struct in6_addr addr;
1674− if (ifp->prefix_len == 127) /* RFC 6164 */
1674+ if (ifp->prefix_len >= 127) /* RFC 6164 */
16751675 return;
16761676 ipv6_addr_prefix(&addr, &ifp->addr, ifp->prefix_len);
16771677 if (ipv6_addr_any(&addr))
@@ -1682,7 +1682,7 @@ static void addrconf_join_anycast(struct inet6_ifaddr *ifp) · 4 unmodified lines
16821682 static void addrconf_leave_anycast(struct inet6_ifaddr *ifp)
16831683 {
16841684 struct in6_addr addr;
1685− if (ifp->prefix_len == 127) /* RFC 6164 */
1685+ if (ifp->prefix_len >= 127) /* RFC 6164 */
16861686 return;
16871687 ipv6_addr_prefix(&addr, &ifp->addr, ifp->prefix_len);
16881688 if (ipv6_addr_any(&addr))
@@ -2509,7 +2509,8 @@ static void add_addr(struct inet6_dev *idev, const struct in6_addr *addr, · 820 unmodified lines
25092509 struct inet6_ifaddr *ifp;
25102510
25112511 ifp = ipv6_add_addr(idev, addr, NULL, plen,
2512− scope, IFA_F_PERMANENT, 0, 0);
2512+ scope, IFA_F_PERMANENT,
2513+ INFINITY_LIFE_TIME, INFINITY_LIFE_TIME);
25132514 if (!IS_ERR(ifp)) {
25142515 spin_lock_bh(&ifp->lock);
25152516 ifp->flags &= ~IFA_F_TENTATIVE;
@@ -2637,7 +2638,8 @@ static void addrconf_add_linklocal(struct inet6_dev *idev, const struct in6_addr · 121 unmodified lines
26372638 #endif
26382639
26392640
2640− ifp = ipv6_add_addr(idev, addr, NULL, 64, IFA_LINK, addr_flags, 0, 0);
2641+ ifp = ipv6_add_addr(idev, addr, NULL, 64, IFA_LINK, addr_flags,
2642+ INFINITY_LIFE_TIME, INFINITY_LIFE_TIME);
26412643 if (!IS_ERR(ifp)) {
26422644 addrconf_prefix_route(&ifp->addr, ifp->prefix_len, idev->dev, 0, 0);
26432645 addrconf_dad_start(ifp);
@@ -3456,7 +3458,12 @@ restart: · 812 unmodified lines
34563458 &inet6_addr_lst[i], addr_lst) {
34573459 unsigned long age;
34583460
3459− if (ifp->flags & IFA_F_PERMANENT)
3461+ /* When setting preferred_lft to a value not zero or
3462+ * infinity, while valid_lft is infinity
3463+ * IFA_F_PERMANENT has a non-infinity life time.
3464+ */
3465+ if ((ifp->flags & IFA_F_PERMANENT) &&
3466+ (ifp->prefered_lft == INFINITY_LIFE_TIME))
34603467 continue;
34613468
34623469 spin_lock(&ifp->lock);
@@ -3481,7 +3488,8 @@ restart: · 18 unmodified lines
34813488 ifp->flags |= IFA_F_DEPRECATED;
34823489 }
34833490
3484− if (time_before(ifp->tstamp + ifp->valid_lft * HZ, next))
3491+ if ((ifp->valid_lft != INFINITY_LIFE_TIME) &&
3492+ (time_before(ifp->tstamp + ifp->valid_lft * HZ, next)))
34853493 next = ifp->tstamp + ifp->valid_lft * HZ;
34863494
34873495 spin_unlock(&ifp->lock);
@@ -3761,7 +3769,8 @@ static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa, · 273 unmodified lines
37613769 put_ifaddrmsg(nlh, ifa->prefix_len, ifa->flags, rt_scope(ifa->scope),
37623770 ifa->idev->dev->ifindex);
37633771
3764− if (!(ifa->flags&IFA_F_PERMANENT)) {
3772+ if (!((ifa->flags&IFA_F_PERMANENT) &&
3773+ (ifa->prefered_lft == INFINITY_LIFE_TIME))) {
37653774 preferred = ifa->prefered_lft;
37663775 valid = ifa->valid_lft;
37673776 if (preferred != INFINITY_LIFE_TIME) {
net/ipv6/ip6_output.c+27−9
@@ -1193,11 +1193,35 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, · 1192 unmodified lines
11931193
11941194 fragheaderlen = sizeof(struct ipv6hdr) + rt->rt6i_nfheader_len +
11951195 (opt ? opt->opt_nflen : 0);
1196− maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen - sizeof(struct frag_hdr);
1196+ maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen -
1197+ sizeof(struct frag_hdr);
11971198
11981199 if (mtu <= sizeof(struct ipv6hdr) + IPV6_MAXPLEN) {
1199− if (cork->length + length > sizeof(struct ipv6hdr) + IPV6_MAXPLEN - fragheaderlen) {
1200− ipv6_local_error(sk, EMSGSIZE, fl6, mtu-exthdrlen);
1200+ unsigned int maxnonfragsize, headersize;
1201+
1202+ headersize = sizeof(struct ipv6hdr) +
1203+ (opt ? opt->tot_len : 0) +
1204+ (dst_allfrag(&rt->dst) ?
1205+ sizeof(struct frag_hdr) : 0) +
1206+ rt->rt6i_nfheader_len;
1207+
1208+ maxnonfragsize = (np->pmtudisc >= IPV6_PMTUDISC_DO) ?
1209+ mtu : sizeof(struct ipv6hdr) + IPV6_MAXPLEN;
1210+
1211+ /* dontfrag active */
1212+ if ((cork->length + length > mtu - headersize) && dontfrag &&
1213+ (sk->sk_protocol == IPPROTO_UDP ||
1214+ sk->sk_protocol == IPPROTO_RAW)) {
1215+ ipv6_local_rxpmtu(sk, fl6, mtu - headersize +
1216+ sizeof(struct ipv6hdr));
1217+ goto emsgsize;
1218+ }
1219+
1220+ if (cork->length + length > maxnonfragsize - headersize) {
1221+emsgsize:
1222+ ipv6_local_error(sk, EMSGSIZE, fl6,
1223+ mtu - headersize +
1224+ sizeof(struct ipv6hdr));
12011225 return -EMSGSIZE;
12021226 }
12031227 }
@@ -1222,12 +1246,6 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, · 18 unmodified lines
12221246 * --yoshfuji
12231247 */
12241248
1225− if ((length > mtu) && dontfrag && (sk->sk_protocol == IPPROTO_UDP ||
1226− sk->sk_protocol == IPPROTO_RAW)) {
1227− ipv6_local_rxpmtu(sk, fl6, mtu-exthdrlen);
1228− return -EMSGSIZE;
1229− }
1230−
12311249 skb = skb_peek_tail(&sk->sk_write_queue);
12321250 cork->length += length;
12331251 if (((length > mtu) ||
net/ipv6/ip6_tunnel.c+16−5
@@ -103,16 +103,25 @@ struct ip6_tnl_net { · 102 unmodified lines
103103
104104 static struct net_device_stats *ip6_get_stats(struct net_device *dev)
105105 {
106− struct pcpu_tstats sum = { 0 };
106+ struct pcpu_tstats tmp, sum = { 0 };
107107 int i;
108108
109109 for_each_possible_cpu(i) {
110+ unsigned int start;
110111 const struct pcpu_tstats *tstats = per_cpu_ptr(dev->tstats, i);
111112
112− sum.rx_packets += tstats->rx_packets;
113− sum.rx_bytes += tstats->rx_bytes;
114− sum.tx_packets += tstats->tx_packets;
115− sum.tx_bytes += tstats->tx_bytes;
113+ do {
114+ start = u64_stats_fetch_begin_bh(&tstats->syncp);
115+ tmp.rx_packets = tstats->rx_packets;
116+ tmp.rx_bytes = tstats->rx_bytes;
117+ tmp.tx_packets = tstats->tx_packets;
118+ tmp.tx_bytes = tstats->tx_bytes;
119+ } while (u64_stats_fetch_retry_bh(&tstats->syncp, start));
120+
121+ sum.rx_packets += tmp.rx_packets;
122+ sum.rx_bytes += tmp.rx_bytes;
123+ sum.tx_packets += tmp.tx_packets;
124+ sum.tx_bytes += tmp.tx_bytes;
116125 }
117126 dev->stats.rx_packets = sum.rx_packets;
118127 dev->stats.rx_bytes = sum.rx_bytes;
@@ -824,8 +833,10 @@ static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol, · 705 unmodified lines
824833 }
825834
826835 tstats = this_cpu_ptr(t->dev->tstats);
836+ u64_stats_update_begin(&tstats->syncp);
827837 tstats->rx_packets++;
828838 tstats->rx_bytes += skb->len;
839+ u64_stats_update_end(&tstats->syncp);
829840
830841 netif_rx(skb);
831842
net/ipv6/ip6_vti.c+9−21
@@ -75,26 +75,6 @@ struct vti6_net { · 74 unmodified lines
7575 struct ip6_tnl __rcu **tnls[2];
7676 };
7777
78−static struct net_device_stats *vti6_get_stats(struct net_device *dev)
79−{
80− struct pcpu_tstats sum = { 0 };
81− int i;
82−
83− for_each_possible_cpu(i) {
84− const struct pcpu_tstats *tstats = per_cpu_ptr(dev->tstats, i);
85−
86− sum.rx_packets += tstats->rx_packets;
87− sum.rx_bytes += tstats->rx_bytes;
88− sum.tx_packets += tstats->tx_packets;
89− sum.tx_bytes += tstats->tx_bytes;
90− }
91− dev->stats.rx_packets = sum.rx_packets;
92− dev->stats.rx_bytes = sum.rx_bytes;
93− dev->stats.tx_packets = sum.tx_packets;
94− dev->stats.tx_bytes = sum.tx_bytes;
95− return &dev->stats;
96−}
97−
9878 #define for_each_vti6_tunnel_rcu(start) \
9979 for (t = rcu_dereference(start); t; t = rcu_dereference(t->next))
10080
@@ -331,8 +311,10 @@ static int vti6_rcv(struct sk_buff *skb) · 230 unmodified lines
331311 }
332312
333313 tstats = this_cpu_ptr(t->dev->tstats);
314+ u64_stats_update_begin(&tstats->syncp);
334315 tstats->rx_packets++;
335316 tstats->rx_bytes += skb->len;
317+ u64_stats_update_end(&tstats->syncp);
336318
337319 skb->mark = 0;
338320 secpath_reset(skb);
@@ -716,7 +698,7 @@ static const struct net_device_ops vti6_netdev_ops = { · 377 unmodified lines
716698 .ndo_start_xmit = vti6_tnl_xmit,
717699 .ndo_do_ioctl = vti6_ioctl,
718700 .ndo_change_mtu = vti6_change_mtu,
719− .ndo_get_stats = vti6_get_stats,
701+ .ndo_get_stats64 = ip_tunnel_get_stats64,
720702 };
721703
722704 /**
@@ -750,12 +732,18 @@ static void vti6_dev_setup(struct net_device *dev) · 27 unmodified lines
750732 static inline int vti6_dev_init_gen(struct net_device *dev)
751733 {
752734 struct ip6_tnl *t = netdev_priv(dev);
735+ int i;
753736
754737 t->dev = dev;
755738 t->net = dev_net(dev);
756739 dev->tstats = alloc_percpu(struct pcpu_tstats);
757740 if (!dev->tstats)
758741 return -ENOMEM;
742+ for_each_possible_cpu(i) {
743+ struct pcpu_tstats *stats;
744+ stats = per_cpu_ptr(dev->tstats, i);
745+ u64_stats_init(&stats->syncp);
746+ }
759747 return 0;
760748 }
761749
net/ipv6/netfilter/ip6t_SYNPROXY.c+1−0
@@ -446,6 +446,7 @@ static void synproxy_tg6_destroy(const struct xt_tgdtor_param *par) · 445 unmodified lines
446446 static struct xt_target synproxy_tg6_reg __read_mostly = {
447447 .name = "SYNPROXY",
448448 .family = NFPROTO_IPV6,
449+ .hooks = (1 << NF_INET_LOCAL_IN) | (1 << NF_INET_FORWARD),
449450 .target = synproxy_tg6,
450451 .targetsize = sizeof(struct xt_synproxy_info),
451452 .checkentry = synproxy_tg6_check,
net/ipv6/route.c+1−3
@@ -1905,9 +1905,7 @@ static struct rt6_info *ip6_rt_copy(struct rt6_info *ort, · 1904 unmodified lines
19051905 else
19061906 rt->rt6i_gateway = *dest;
19071907 rt->rt6i_flags = ort->rt6i_flags;
1908− if ((ort->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) ==
1909− (RTF_DEFAULT | RTF_ADDRCONF))
1910− rt6_set_from(rt, ort);
1908+ rt6_set_from(rt, ort);
19111909 rt->rt6i_metric = 0;
19121910
19131911 #ifdef CONFIG_IPV6_SUBTREES
net/ipv6/sit.c+6−2
@@ -702,8 +702,10 @@ static int ipip6_rcv(struct sk_buff *skb) · 701 unmodified lines
702702 }
703703
704704 tstats = this_cpu_ptr(tunnel->dev->tstats);
705+ u64_stats_update_begin(&tstats->syncp);
705706 tstats->rx_packets++;
706707 tstats->rx_bytes += skb->len;
708+ u64_stats_update_end(&tstats->syncp);
707709
708710 netif_rx(skb);
709711
@@ -924,7 +926,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, · 214 unmodified lines
924926 if (tunnel->parms.iph.daddr && skb_dst(skb))
925927 skb_dst(skb)->ops->update_pmtu(skb_dst(skb), NULL, skb, mtu);
926928
927− if (skb->len > mtu) {
929+ if (skb->len > mtu && !skb_is_gso(skb)) {
928930 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
929931 ip_rt_put(rt);
930932 goto tx_error;
@@ -966,8 +968,10 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, · 35 unmodified lines
966968 tos = INET_ECN_encapsulate(tos, ipv6_get_dsfield(iph6));
967969
968970 skb = iptunnel_handle_offloads(skb, false, SKB_GSO_SIT);
969− if (IS_ERR(skb))
971+ if (IS_ERR(skb)) {
972+ ip_rt_put(rt);
970973 goto out;
974+ }
971975
972976 err = iptunnel_xmit(rt, skb, fl4.saddr, fl4.daddr, IPPROTO_IPV6, tos,
973977 ttl, df, !net_eq(tunnel->net, dev_net(dev)));
net/llc/af_llc.c+3−2
@@ -715,7 +715,7 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock, · 714 unmodified lines
715715 unsigned long cpu_flags;
716716 size_t copied = 0;
717717 u32 peek_seq = 0;
718− u32 *seq;
718+ u32 *seq, skb_len;
719719 unsigned long used;
720720 int target; /* Read at least this many bytes */
721721 long timeo;
@@ -812,6 +812,7 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock, · 90 unmodified lines
812812 }
813813 continue;
814814 found_ok_skb:
815+ skb_len = skb->len;
815816 /* Ok so how much can we use? */
816817 used = skb->len - offset;
817818 if (len < used)
@@ -844,7 +845,7 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock, · 26 unmodified lines
844845 }
845846
846847 /* Partial read */
847− if (used + offset < skb->len)
848+ if (used + offset < skb_len)
848849 continue;
849850 } while (len > 0);
850851
net/mac80211/iface.c+4−2
@@ -1061,7 +1061,8 @@ static void ieee80211_uninit(struct net_device *dev) · 1060 unmodified lines
10611061 }
10621062
10631063 static u16 ieee80211_netdev_select_queue(struct net_device *dev,
1064− struct sk_buff *skb)
1064+ struct sk_buff *skb,
1065+ void *accel_priv)
10651066 {
10661067 return ieee80211_select_queue(IEEE80211_DEV_TO_SUB_IF(dev), skb);
10671068 }
@@ -1078,7 +1079,8 @@ static const struct net_device_ops ieee80211_dataif_ops = { · 10 unmodified lines
10781079 };
10791080
10801081 static u16 ieee80211_monitor_select_queue(struct net_device *dev,
1081− struct sk_buff *skb)
1082+ struct sk_buff *skb,
1083+ void *accel_priv)
10821084 {
10831085 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
10841086 struct ieee80211_local *local = sdata->local;
net/mac80211/tx.c+13−10
@@ -463,7 +463,6 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) · 462 unmodified lines
463463 {
464464 struct sta_info *sta = tx->sta;
465465 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
466− struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
467466 struct ieee80211_local *local = tx->local;
468467
469468 if (unlikely(!sta))
@@ -474,15 +473,6 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) · 4 unmodified lines
474473 !(info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER))) {
475474 int ac = skb_get_queue_mapping(tx->skb);
476475
477− /* only deauth, disassoc and action are bufferable MMPDUs */
478− if (ieee80211_is_mgmt(hdr->frame_control) &&
479− !ieee80211_is_deauth(hdr->frame_control) &&
480− !ieee80211_is_disassoc(hdr->frame_control) &&
481− !ieee80211_is_action(hdr->frame_control)) {
482− info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER;
483− return TX_CONTINUE;
484− }
485−
486476 ps_dbg(sta->sdata, "STA %pM aid %d: PS buffer for AC %d\n",
487477 sta->sta.addr, sta->sta.aid, ac);
488478 if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER)
@@ -525,9 +515,22 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) · 36 unmodified lines
525515 static ieee80211_tx_result debug_noinline
526516 ieee80211_tx_h_ps_buf(struct ieee80211_tx_data *tx)
527517 {
518+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
519+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
520+
528521 if (unlikely(tx->flags & IEEE80211_TX_PS_BUFFERED))
529522 return TX_CONTINUE;
530523
524+ /* only deauth, disassoc and action are bufferable MMPDUs */
525+ if (ieee80211_is_mgmt(hdr->frame_control) &&
526+ !ieee80211_is_deauth(hdr->frame_control) &&
527+ !ieee80211_is_disassoc(hdr->frame_control) &&
528+ !ieee80211_is_action(hdr->frame_control)) {
529+ if (tx->flags & IEEE80211_TX_UNICAST)
530+ info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER;
531+ return TX_CONTINUE;
532+ }
533+
531534 if (tx->flags & IEEE80211_TX_UNICAST)
532535 return ieee80211_tx_h_unicast_ps_buf(tx);
533536 else
net/netfilter/ipvs/ip_vs_nfct.c+6−0
@@ -63,6 +63,7 @@ · 62 unmodified lines
6363 #include <net/ip_vs.h>
6464 #include <net/netfilter/nf_conntrack_core.h>
6565 #include <net/netfilter/nf_conntrack_expect.h>
66+#include <net/netfilter/nf_conntrack_seqadj.h>
6667 #include <net/netfilter/nf_conntrack_helper.h>
6768 #include <net/netfilter/nf_conntrack_zones.h>
6869
@@ -97,6 +98,11 @@ ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp, int outin) · 28 unmodified lines
9798 if (CTINFO2DIR(ctinfo) != IP_CT_DIR_ORIGINAL)
9899 return;
99100
101+ /* Applications may adjust TCP seqs */
102+ if (cp->app && nf_ct_protonum(ct) == IPPROTO_TCP &&
103+ !nfct_seqadj(ct) && !nfct_seqadj_ext_add(ct))
104+ return;
105+
100106 /*
101107 * The connection is not yet in the hashtable, so we update it.
102108 * CIP->VIP will remain the same, so leave the tuple in
net/netfilter/nf_conntrack_seqadj.c+5−0
@@ -36,6 +36,11 @@ int nf_ct_seqadj_set(struct nf_conn *ct, enum ip_conntrack_info ctinfo, · 35 unmodified lines
3636 if (off == 0)
3737 return 0;
3838
39+ if (unlikely(!seqadj)) {
40+ WARN_ONCE(1, "Missing nfct_seqadj_ext_add() setup call\n");
41+ return 0;
42+ }
43+
3944 set_bit(IPS_SEQ_ADJUST_BIT, &ct->status);
4045
4146 spin_lock_bh(&ct->lock);
net/netfilter/nf_conntrack_timestamp.c+0−1
@@ -97,7 +97,6 @@ int nf_conntrack_tstamp_pernet_init(struct net *net) · 96 unmodified lines
9797 void nf_conntrack_tstamp_pernet_fini(struct net *net)
9898 {
9999 nf_conntrack_tstamp_fini_sysctl(net);
100− nf_ct_extend_unregister(&tstamp_extend);
101100 }
102101
103102 int nf_conntrack_tstamp_init(void)
net/netfilter/nf_nat_irc.c+27−5
@@ -34,10 +34,14 @@ static unsigned int help(struct sk_buff *skb, · 33 unmodified lines
3434 struct nf_conntrack_expect *exp)
3535 {
3636 char buffer[sizeof("4294967296 65635")];
37+ struct nf_conn *ct = exp->master;
38+ union nf_inet_addr newaddr;
3739 u_int16_t port;
3840 unsigned int ret;
3941
4042 /* Reply comes from server. */
43+ newaddr = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3;
44+
4145 exp->saved_proto.tcp.port = exp->tuple.dst.u.tcp.port;
4246 exp->dir = IP_CT_DIR_REPLY;
4347 exp->expectfn = nf_nat_follow_master;
@@ -57,17 +61,35 @@ static unsigned int help(struct sk_buff *skb, · 13 unmodified lines
5761 }
5862
5963 if (port == 0) {
60− nf_ct_helper_log(skb, exp->master, "all ports in use");
64+ nf_ct_helper_log(skb, ct, "all ports in use");
6165 return NF_DROP;
6266 }
6367
64− ret = nf_nat_mangle_tcp_packet(skb, exp->master, ctinfo,
65− protoff, matchoff, matchlen, buffer,
66− strlen(buffer));
68+ /* strlen("\1DCC CHAT chat AAAAAAAA P\1\n")=27
69+ * strlen("\1DCC SCHAT chat AAAAAAAA P\1\n")=28
70+ * strlen("\1DCC SEND F AAAAAAAA P S\1\n")=26
71+ * strlen("\1DCC MOVE F AAAAAAAA P S\1\n")=26
72+ * strlen("\1DCC TSEND F AAAAAAAA P S\1\n")=27
73+ *
74+ * AAAAAAAAA: bound addr (1.0.0.0==16777216, min 8 digits,
75+ * 255.255.255.255==4294967296, 10 digits)
76+ * P: bound port (min 1 d, max 5d (65635))
77+ * F: filename (min 1 d )
78+ * S: size (min 1 d )
79+ * 0x01, \n: terminators
80+ */
81+ /* AAA = "us", ie. where server normally talks to. */
82+ snprintf(buffer, sizeof(buffer), "%u %u", ntohl(newaddr.ip), port);
83+ pr_debug("nf_nat_irc: inserting '%s' == %pI4, port %u\n",
84+ buffer, &newaddr.ip, port);
85+
86+ ret = nf_nat_mangle_tcp_packet(skb, ct, ctinfo, protoff, matchoff,
87+ matchlen, buffer, strlen(buffer));
6788 if (ret != NF_ACCEPT) {
68− nf_ct_helper_log(skb, exp->master, "cannot mangle packet");
89+ nf_ct_helper_log(skb, ct, "cannot mangle packet");
6990 nf_ct_unexpect_related(exp);
7091 }
92+
7193 return ret;
7294 }
7395
net/netfilter/nf_tables_api.c+20−6
@@ -312,6 +312,9 @@ static int nf_tables_table_enable(struct nft_table *table) · 311 unmodified lines
312312 int err, i = 0;
313313
314314 list_for_each_entry(chain, &table->chains, list) {
315+ if (!(chain->flags & NFT_BASE_CHAIN))
316+ continue;
317+
315318 err = nf_register_hook(&nft_base_chain(chain)->ops);
316319 if (err < 0)
317320 goto err;
@@ -321,6 +324,9 @@ static int nf_tables_table_enable(struct nft_table *table) · 3 unmodified lines
321324 return 0;
322325 err:
323326 list_for_each_entry(chain, &table->chains, list) {
327+ if (!(chain->flags & NFT_BASE_CHAIN))
328+ continue;
329+
324330 if (i-- <= 0)
325331 break;
326332
@@ -333,8 +339,10 @@ static int nf_tables_table_disable(struct nft_table *table) · 6 unmodified lines
333339 {
334340 struct nft_chain *chain;
335341
336− list_for_each_entry(chain, &table->chains, list)
337− nf_unregister_hook(&nft_base_chain(chain)->ops);
342+ list_for_each_entry(chain, &table->chains, list) {
343+ if (chain->flags & NFT_BASE_CHAIN)
344+ nf_unregister_hook(&nft_base_chain(chain)->ops);
345+ }
338346
339347 return 0;
340348 }
@@ -2098,17 +2106,21 @@ static int nf_tables_dump_sets_all(struct nft_ctx *ctx, struct sk_buff *skb, · 1757 unmodified lines
20982106 struct netlink_callback *cb)
20992107 {
21002108 const struct nft_set *set;
2101− unsigned int idx = 0, s_idx = cb->args[0];
2109+ unsigned int idx, s_idx = cb->args[0];
21022110 struct nft_table *table, *cur_table = (struct nft_table *)cb->args[2];
21032111
21042112 if (cb->args[1])
21052113 return skb->len;
21062114
21072115 list_for_each_entry(table, &ctx->afi->tables, list) {
2108− if (cur_table && cur_table != table)
2109− continue;
2116+ if (cur_table) {
2117+ if (cur_table != table)
2118+ continue;
21102119
2120+ cur_table = NULL;
2121+ }
21112122 ctx->table = table;
2123+ idx = 0;
21122124 list_for_each_entry(set, &ctx->table->sets, list) {
21132125 if (idx < s_idx)
21142126 goto cont;
@@ -2370,7 +2382,9 @@ static int nf_tables_bind_check_setelem(const struct nft_ctx *ctx, · 255 unmodified lines
23702382 enum nft_registers dreg;
23712383
23722384 dreg = nft_type_to_reg(set->dtype);
2373− return nft_validate_data_load(ctx, dreg, &elem->data, set->dtype);
2385+ return nft_validate_data_load(ctx, dreg, &elem->data,
2386+ set->dtype == NFT_DATA_VERDICT ?
2387+ NFT_DATA_VERDICT : NFT_DATA_VALUE);
23742388 }
23752389
23762390 int nf_tables_bind_set(const struct nft_ctx *ctx, struct nft_set *set,
net/netfilter/nfnetlink_log.c+1−0
@@ -1053,6 +1053,7 @@ static void __net_exit nfnl_log_net_exit(struct net *net) · 1052 unmodified lines
10531053 #ifdef CONFIG_PROC_FS
10541054 remove_proc_entry("nfnetlink_log", net->nf.proc_netfilter);
10551055 #endif
1056+ nf_log_unset(net, &nfulnl_logger);
10561057 }
10571058
10581059 static struct pernet_operations nfnl_log_net_ops = {
net/netfilter/nft_exthdr.c+1−1
@@ -31,7 +31,7 @@ static void nft_exthdr_eval(const struct nft_expr *expr, · 30 unmodified lines
3131 {
3232 struct nft_exthdr *priv = nft_expr_priv(expr);
3333 struct nft_data *dest = &data[priv->dreg];
34− unsigned int offset;
34+ unsigned int offset = 0;
3535 int err;
3636
3737 err = ipv6_find_hdr(pkt->skb, &offset, priv->type, NULL, NULL);
net/nfc/core.c+1−1
@@ -384,7 +384,7 @@ int nfc_dep_link_is_up(struct nfc_dev *dev, u32 target_idx, · 383 unmodified lines
384384 {
385385 dev->dep_link_up = true;
386386
387− if (!dev->active_target) {
387+ if (!dev->active_target && rf_mode == NFC_RF_INITIATOR) {
388388 struct nfc_target *target;
389389
390390 target = nfc_find_target(dev, target_idx);
net/rds/ib.c+2−1
@@ -338,7 +338,8 @@ static int rds_ib_laddr_check(__be32 addr) · 337 unmodified lines
338338 ret = rdma_bind_addr(cm_id, (struct sockaddr *)&sin);
339339 /* due to this, we will claim to support iWARP devices unless we
340340 check node_type. */
341− if (ret || cm_id->device->node_type != RDMA_NODE_IB_CA)
341+ if (ret || !cm_id->device ||
342+ cm_id->device->node_type != RDMA_NODE_IB_CA)
342343 ret = -EADDRNOTAVAIL;
343344
344345 rdsdebug("addr %pI4 ret %d node type %d\n",
net/rose/af_rose.c+4−12
@@ -1253,6 +1253,7 @@ static int rose_recvmsg(struct kiocb *iocb, struct socket *sock, · 1252 unmodified lines
12531253
12541254 if (msg->msg_name) {
12551255 struct sockaddr_rose *srose;
1256+ struct full_sockaddr_rose *full_srose = msg->msg_name;
12561257
12571258 memset(msg->msg_name, 0, sizeof(struct full_sockaddr_rose));
12581259 srose = msg->msg_name;
@@ -1260,18 +1261,9 @@ static int rose_recvmsg(struct kiocb *iocb, struct socket *sock, · 1 unmodified line
12601261 srose->srose_addr = rose->dest_addr;
12611262 srose->srose_call = rose->dest_call;
12621263 srose->srose_ndigis = rose->dest_ndigis;
1263− if (msg->msg_namelen >= sizeof(struct full_sockaddr_rose)) {
1264− struct full_sockaddr_rose *full_srose = (struct full_sockaddr_rose *)msg->msg_name;
1265− for (n = 0 ; n < rose->dest_ndigis ; n++)
1266− full_srose->srose_digis[n] = rose->dest_digis[n];
1267− msg->msg_namelen = sizeof(struct full_sockaddr_rose);
1268− } else {
1269− if (rose->dest_ndigis >= 1) {
1270− srose->srose_ndigis = 1;
1271− srose->srose_digi = rose->dest_digis[0];
1272− }
1273− msg->msg_namelen = sizeof(struct sockaddr_rose);
1274− }
1264+ for (n = 0 ; n < rose->dest_ndigis ; n++)
1265+ full_srose->srose_digis[n] = rose->dest_digis[n];
1266+ msg->msg_namelen = sizeof(struct full_sockaddr_rose);
12751267 }
12761268
12771269 skb_free_datagram(sk, skb);
net/sched/act_csum.c+5−5
@@ -77,16 +77,16 @@ static int tcf_csum_init(struct net *n, struct nlattr *nla, struct nlattr *est, · 76 unmodified lines
7777 &csum_idx_gen, &csum_hash_info);
7878 if (IS_ERR(pc))
7979 return PTR_ERR(pc);
80− p = to_tcf_csum(pc);
8180 ret = ACT_P_CREATED;
8281 } else {
83− p = to_tcf_csum(pc);
84− if (!ovr) {
85− tcf_hash_release(pc, bind, &csum_hash_info);
82+ if (bind)/* dont override defaults */
83+ return 0;
84+ tcf_hash_release(pc, bind, &csum_hash_info);
85+ if (!ovr)
8686 return -EEXIST;
87− }
8887 }
8988
89+ p = to_tcf_csum(pc);
9090 spin_lock_bh(&p->tcf_lock);
9191 p->tcf_action = parm->action;
9292 p->update_flags = parm->update_flags;
net/sched/act_gact.c+4−3
@@ -102,10 +102,11 @@ static int tcf_gact_init(struct net *net, struct nlattr *nla, · 101 unmodified lines
102102 return PTR_ERR(pc);
103103 ret = ACT_P_CREATED;
104104 } else {
105− if (!ovr) {
106− tcf_hash_release(pc, bind, &gact_hash_info);
105+ if (bind)/* dont override defaults */
106+ return 0;
107+ tcf_hash_release(pc, bind, &gact_hash_info);
108+ if (!ovr)
107109 return -EEXIST;
108− }
109110 }
110111
111112 gact = to_gact(pc);
net/sched/act_ipt.c+5−3
@@ -141,10 +141,12 @@ static int tcf_ipt_init(struct net *net, struct nlattr *nla, struct nlattr *est, · 140 unmodified lines
141141 return PTR_ERR(pc);
142142 ret = ACT_P_CREATED;
143143 } else {
144− if (!ovr) {
145− tcf_ipt_release(to_ipt(pc), bind);
144+ if (bind)/* dont override defaults */
145+ return 0;
146+ tcf_ipt_release(to_ipt(pc), bind);
147+
148+ if (!ovr)
146149 return -EEXIST;
147− }
148150 }
149151 ipt = to_ipt(pc);
150152
net/sched/act_nat.c+5−5
@@ -70,15 +70,15 @@ static int tcf_nat_init(struct net *net, struct nlattr *nla, struct nlattr *est, · 69 unmodified lines
7070 &nat_idx_gen, &nat_hash_info);
7171 if (IS_ERR(pc))
7272 return PTR_ERR(pc);
73− p = to_tcf_nat(pc);
7473 ret = ACT_P_CREATED;
7574 } else {
76− p = to_tcf_nat(pc);
77− if (!ovr) {
78− tcf_hash_release(pc, bind, &nat_hash_info);
75+ if (bind)
76+ return 0;
77+ tcf_hash_release(pc, bind, &nat_hash_info);
78+ if (!ovr)
7979 return -EEXIST;
80− }
8180 }
81+ p = to_tcf_nat(pc);
8282
8383 spin_lock_bh(&p->tcf_lock);
8484 p->old_addr = parm->old_addr;
net/sched/act_pedit.c+5−3
@@ -84,10 +84,12 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla, · 83 unmodified lines
8484 ret = ACT_P_CREATED;
8585 } else {
8686 p = to_pedit(pc);
87− if (!ovr) {
88− tcf_hash_release(pc, bind, &pedit_hash_info);
87+ tcf_hash_release(pc, bind, &pedit_hash_info);
88+ if (bind)
89+ return 0;
90+ if (!ovr)
8991 return -EEXIST;
90− }
92+
9193 if (p->tcfp_nkeys && p->tcfp_nkeys != parm->nkeys) {
9294 keys = kmalloc(ksize, GFP_KERNEL);
9395 if (keys == NULL)
net/sched/act_police.c+3−1
@@ -177,10 +177,12 @@ static int tcf_act_police_locate(struct net *net, struct nlattr *nla, · 176 unmodified lines
177177 if (bind) {
178178 police->tcf_bindcnt += 1;
179179 police->tcf_refcnt += 1;
180+ return 0;
180181 }
181182 if (ovr)
182183 goto override;
183− return ret;
184+ /* not replacing */
185+ return -EEXIST;
184186 }
185187 }
186188
net/sched/act_simple.c+6−3
@@ -142,10 +142,13 @@ static int tcf_simp_init(struct net *net, struct nlattr *nla, · 141 unmodified lines
142142 ret = ACT_P_CREATED;
143143 } else {
144144 d = to_defact(pc);
145− if (!ovr) {
146− tcf_simp_release(d, bind);
145+
146+ if (bind)
147+ return 0;
148+ tcf_simp_release(d, bind);
149+ if (!ovr)
147150 return -EEXIST;
148− }
151+
149152 reset_policy(d, defdata, parm);
150153 }
151154
net/sched/act_skbedit.c+4−3
@@ -120,10 +120,11 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla, · 119 unmodified lines
120120 ret = ACT_P_CREATED;
121121 } else {
122122 d = to_skbedit(pc);
123− if (!ovr) {
124− tcf_hash_release(pc, bind, &skbedit_hash_info);
123+ if (bind)
124+ return 0;
125+ tcf_hash_release(pc, bind, &skbedit_hash_info);
126+ if (!ovr)
125127 return -EEXIST;
126− }
127128 }
128129
129130 spin_lock_bh(&d->tcf_lock);
net/sched/sch_generic.c+1−1
@@ -126,7 +126,7 @@ int sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q, · 125 unmodified lines
126126
127127 HARD_TX_LOCK(dev, txq, smp_processor_id());
128128 if (!netif_xmit_frozen_or_stopped(txq))
129− ret = dev_hard_start_xmit(skb, dev, txq, NULL);
129+ ret = dev_hard_start_xmit(skb, dev, txq);
130130
131131 HARD_TX_UNLOCK(dev, txq);
132132
net/sctp/outqueue.c+7−25
@@ -208,8 +208,6 @@ void sctp_outq_init(struct sctp_association *asoc, struct sctp_outq *q) · 207 unmodified lines
208208 INIT_LIST_HEAD(&q->retransmit);
209209 INIT_LIST_HEAD(&q->sacked);
210210 INIT_LIST_HEAD(&q->abandoned);
211−
212− q->empty = 1;
213211 }
214212
215213 /* Free the outqueue structure and any related pending chunks.
@@ -332,7 +330,6 @@ int sctp_outq_tail(struct sctp_outq *q, struct sctp_chunk *chunk) · 116 unmodified lines
332330 SCTP_INC_STATS(net, SCTP_MIB_OUTUNORDERCHUNKS);
333331 else
334332 SCTP_INC_STATS(net, SCTP_MIB_OUTORDERCHUNKS);
335− q->empty = 0;
336333 break;
337334 }
338335 } else {
@@ -654,7 +651,6 @@ redo: · 315 unmodified lines
654651 if (chunk->fast_retransmit == SCTP_NEED_FRTX)
655652 chunk->fast_retransmit = SCTP_DONT_FRTX;
656653
657− q->empty = 0;
658654 q->asoc->stats.rtxchunks++;
659655 break;
660656 }
@@ -1065,8 +1061,6 @@ static int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout) · 404 unmodified lines
10651061
10661062 sctp_transport_reset_timers(transport);
10671063
1068− q->empty = 0;
1069−
10701064 /* Only let one DATA chunk get bundled with a
10711065 * COOKIE-ECHO chunk.
10721066 */
@@ -1275,29 +1269,17 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_chunk *chunk) · 202 unmodified lines
12751269 "advertised peer ack point:0x%x\n", __func__, asoc, ctsn,
12761270 asoc->adv_peer_ack_point);
12771271
1278− /* See if all chunks are acked.
1279− * Make sure the empty queue handler will get run later.
1280− */
1281− q->empty = (list_empty(&q->out_chunk_list) &&
1282− list_empty(&q->retransmit));
1283− if (!q->empty)
1284− goto finish;
1285−
1286− list_for_each_entry(transport, transport_list, transports) {
1287− q->empty = q->empty && list_empty(&transport->transmitted);
1288− if (!q->empty)
1289− goto finish;
1290− }
1291−
1292− pr_debug("%s: sack queue is empty\n", __func__);
1293−finish:
1294− return q->empty;
1272+ return sctp_outq_is_empty(q);
12951273 }
12961274
1297−/* Is the outqueue empty? */
1275+/* Is the outqueue empty?
1276+ * The queue is empty when we have not pending data, no in-flight data
1277+ * and nothing pending retransmissions.
1278+ */
12981279 int sctp_outq_is_empty(const struct sctp_outq *q)
12991280 {
1300− return q->empty;
1281+ return q->out_qlen == 0 && q->outstanding_bytes == 0 &&
1282+ list_empty(&q->retransmit);
13011283 }
13021284
13031285 /********************************************************************
net/sctp/probe.c+16−1
@@ -38,6 +38,7 @@ · 37 unmodified lines
3838 #include <net/sctp/sctp.h>
3939 #include <net/sctp/sm.h>
4040
41+MODULE_SOFTDEP("pre: sctp");
4142 MODULE_AUTHOR("Wei Yongjun <yjwei@cn.fujitsu.com>");
4243 MODULE_DESCRIPTION("SCTP snooper");
4344 MODULE_LICENSE("GPL");
@@ -182,6 +183,20 @@ static struct jprobe sctp_recv_probe = { · 138 unmodified lines
182183 .entry = jsctp_sf_eat_sack,
183184 };
184185
186+static __init int sctp_setup_jprobe(void)
187+{
188+ int ret = register_jprobe(&sctp_recv_probe);
189+
190+ if (ret) {
191+ if (request_module("sctp"))
192+ goto out;
193+ ret = register_jprobe(&sctp_recv_probe);
194+ }
195+
196+out:
197+ return ret;
198+}
199+
185200 static __init int sctpprobe_init(void)
186201 {
187202 int ret = -ENOMEM;
@@ -202,7 +217,7 @@ static __init int sctpprobe_init(void) · 14 unmodified lines
202217 &sctpprobe_fops))
203218 goto free_kfifo;
204219
205− ret = register_jprobe(&sctp_recv_probe);
220+ ret = sctp_setup_jprobe();
206221 if (ret)
207222 goto remove_proc;
208223
net/tipc/link.c+1−0
@@ -1498,6 +1498,7 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr) · 1497 unmodified lines
14981498 int type;
14991499
15001500 head = head->next;
1501+ buf->next = NULL;
15011502
15021503 /* Ensure bearer is still enabled */
15031504 if (unlikely(!b_ptr->active))
net/tipc/port.c+15−30
@@ -251,18 +251,15 @@ struct tipc_port *tipc_createport(struct sock *sk, · 250 unmodified lines
251251 return p_ptr;
252252 }
253253
254−int tipc_deleteport(u32 ref)
254+int tipc_deleteport(struct tipc_port *p_ptr)
255255 {
256− struct tipc_port *p_ptr;
257256 struct sk_buff *buf = NULL;
258257
259− tipc_withdraw(ref, 0, NULL);
260− p_ptr = tipc_port_lock(ref);
261− if (!p_ptr)
262− return -EINVAL;
258+ tipc_withdraw(p_ptr, 0, NULL);
263259
264− tipc_ref_discard(ref);
265− tipc_port_unlock(p_ptr);
260+ spin_lock_bh(p_ptr->lock);
261+ tipc_ref_discard(p_ptr->ref);
262+ spin_unlock_bh(p_ptr->lock);
266263
267264 k_cancel_timer(&p_ptr->timer);
268265 if (p_ptr->connected) {
@@ -704,47 +701,36 @@ int tipc_set_portimportance(u32 ref, unsigned int imp) · 435 unmodified lines
704701 }
705702
706703
707−int tipc_publish(u32 ref, unsigned int scope, struct tipc_name_seq const *seq)
704+int tipc_publish(struct tipc_port *p_ptr, unsigned int scope,
705+ struct tipc_name_seq const *seq)
708706 {
709− struct tipc_port *p_ptr;
710707 struct publication *publ;
711708 u32 key;
712− int res = -EINVAL;
713709
714− p_ptr = tipc_port_lock(ref);
715− if (!p_ptr)
710+ if (p_ptr->connected)
716711 return -EINVAL;
712+ key = p_ptr->ref + p_ptr->pub_count + 1;
713+ if (key == p_ptr->ref)
714+ return -EADDRINUSE;
717715
718− if (p_ptr->connected)
719− goto exit;
720− key = ref + p_ptr->pub_count + 1;
721− if (key == ref) {
722− res = -EADDRINUSE;
723− goto exit;
724− }
725716 publ = tipc_nametbl_publish(seq->type, seq->lower, seq->upper,
726717 scope, p_ptr->ref, key);
727718 if (publ) {
728719 list_add(&publ->pport_list, &p_ptr->publications);
729720 p_ptr->pub_count++;
730721 p_ptr->published = 1;
731− res = 0;
722+ return 0;
732723 }
733−exit:
734− tipc_port_unlock(p_ptr);
735− return res;
724+ return -EINVAL;
736725 }
737726
738−int tipc_withdraw(u32 ref, unsigned int scope, struct tipc_name_seq const *seq)
727+int tipc_withdraw(struct tipc_port *p_ptr, unsigned int scope,
728+ struct tipc_name_seq const *seq)
739729 {
740− struct tipc_port *p_ptr;
741730 struct publication *publ;
742731 struct publication *tpubl;
743732 int res = -EINVAL;
744733
745− p_ptr = tipc_port_lock(ref);
746− if (!p_ptr)
747− return -EINVAL;
748734 if (!seq) {
749735 list_for_each_entry_safe(publ, tpubl,
750736 &p_ptr->publications, pport_list) {
@@ -771,7 +757,6 @@ int tipc_withdraw(u32 ref, unsigned int scope, struct tipc_name_seq const *seq) · 20 unmodified lines
771757 }
772758 if (list_empty(&p_ptr->publications))
773759 p_ptr->published = 0;
774− tipc_port_unlock(p_ptr);
775760 return res;
776761 }
777762
net/tipc/port.h+3−3
@@ -116,7 +116,7 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err); · 115 unmodified lines
116116
117117 void tipc_acknowledge(u32 port_ref, u32 ack);
118118
119−int tipc_deleteport(u32 portref);
119+int tipc_deleteport(struct tipc_port *p_ptr);
120120
121121 int tipc_portimportance(u32 portref, unsigned int *importance);
122122 int tipc_set_portimportance(u32 portref, unsigned int importance);
@@ -127,9 +127,9 @@ int tipc_set_portunreliable(u32 portref, unsigned int isunreliable); · 4 unmodified lines
127127 int tipc_portunreturnable(u32 portref, unsigned int *isunreturnable);
128128 int tipc_set_portunreturnable(u32 portref, unsigned int isunreturnable);
129129
130−int tipc_publish(u32 portref, unsigned int scope,
130+int tipc_publish(struct tipc_port *p_ptr, unsigned int scope,
131131 struct tipc_name_seq const *name_seq);
132−int tipc_withdraw(u32 portref, unsigned int scope,
132+int tipc_withdraw(struct tipc_port *p_ptr, unsigned int scope,
133133 struct tipc_name_seq const *name_seq);
134134
135135 int tipc_connect(u32 portref, struct tipc_portid const *port);
net/tipc/socket.c+31−15
@@ -354,7 +354,7 @@ static int release(struct socket *sock) · 353 unmodified lines
354354 * Delete TIPC port; this ensures no more messages are queued
355355 * (also disconnects an active connection & sends a 'FIN-' to peer)
356356 */
357− res = tipc_deleteport(tport->ref);
357+ res = tipc_deleteport(tport);
358358
359359 /* Discard any remaining (connection-based) messages in receive queue */
360360 __skb_queue_purge(&sk->sk_receive_queue);
@@ -386,30 +386,46 @@ static int release(struct socket *sock) · 25 unmodified lines
386386 */
387387 static int bind(struct socket *sock, struct sockaddr *uaddr, int uaddr_len)
388388 {
389+ struct sock *sk = sock->sk;
389390 struct sockaddr_tipc *addr = (struct sockaddr_tipc *)uaddr;
390− u32 portref = tipc_sk_port(sock->sk)->ref;
391+ struct tipc_port *tport = tipc_sk_port(sock->sk);
392+ int res = -EINVAL;
391393
392− if (unlikely(!uaddr_len))
393− return tipc_withdraw(portref, 0, NULL);
394+ lock_sock(sk);
395+ if (unlikely(!uaddr_len)) {
396+ res = tipc_withdraw(tport, 0, NULL);
397+ goto exit;
398+ }
394399
395− if (uaddr_len < sizeof(struct sockaddr_tipc))
396− return -EINVAL;
397− if (addr->family != AF_TIPC)
398− return -EAFNOSUPPORT;
400+ if (uaddr_len < sizeof(struct sockaddr_tipc)) {
401+ res = -EINVAL;
402+ goto exit;
403+ }
404+ if (addr->family != AF_TIPC) {
405+ res = -EAFNOSUPPORT;
406+ goto exit;
407+ }
399408
400409 if (addr->addrtype == TIPC_ADDR_NAME)
401410 addr->addr.nameseq.upper = addr->addr.nameseq.lower;
402− else if (addr->addrtype != TIPC_ADDR_NAMESEQ)
403− return -EAFNOSUPPORT;
411+ else if (addr->addrtype != TIPC_ADDR_NAMESEQ) {
412+ res = -EAFNOSUPPORT;
413+ goto exit;
414+ }
404415
405416 if ((addr->addr.nameseq.type < TIPC_RESERVED_TYPES) &&
406417 (addr->addr.nameseq.type != TIPC_TOP_SRV) &&
407− (addr->addr.nameseq.type != TIPC_CFG_SRV))
408− return -EACCES;
418+ (addr->addr.nameseq.type != TIPC_CFG_SRV)) {
419+ res = -EACCES;
420+ goto exit;
421+ }
409422
410− return (addr->scope > 0) ?
411− tipc_publish(portref, addr->scope, &addr->addr.nameseq) :
412− tipc_withdraw(portref, -addr->scope, &addr->addr.nameseq);
423+ res = (addr->scope > 0) ?
424+ tipc_publish(tport, addr->scope, &addr->addr.nameseq) :
425+ tipc_withdraw(tport, -addr->scope, &addr->addr.nameseq);
426+exit:
427+ release_sock(sk);
428+ return res;
413429 }
414430
415431 /**
net/unix/af_unix.c+6−2
@@ -718,7 +718,9 @@ static int unix_autobind(struct socket *sock) · 717 unmodified lines
718718 int err;
719719 unsigned int retries = 0;
720720
721− mutex_lock(&u->readlock);
721+ err = mutex_lock_interruptible(&u->readlock);
722+ if (err)
723+ return err;
722724
723725 err = 0;
724726 if (u->addr)
@@ -877,7 +879,9 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) · 152 unmodified lines
877879 goto out;
878880 addr_len = err;
879881
880− mutex_lock(&u->readlock);
882+ err = mutex_lock_interruptible(&u->readlock);
883+ if (err)
884+ goto out;
881885
882886 err = -EINVAL;
883887 if (u->addr)
net/wireless/radiotap.c+4−0
@@ -124,6 +124,10 @@ int ieee80211_radiotap_iterator_init( · 123 unmodified lines
124124 /* find payload start allowing for extended bitmap(s) */
125125
126126 if (iterator->_bitmap_shifter & (1<<IEEE80211_RADIOTAP_EXT)) {
127+ if ((unsigned long)iterator->_arg -
128+ (unsigned long)iterator->_rtheader + sizeof(uint32_t) >
129+ (unsigned long)iterator->_max_length)
130+ return -EINVAL;
127131 while (get_unaligned_le32(iterator->_arg) &
128132 (1 << IEEE80211_RADIOTAP_EXT)) {
129133 iterator->_arg += sizeof(uint32_t);
net/wireless/sme.c+12−10
@@ -632,6 +632,16 @@ void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid, · 631 unmodified lines
632632 }
633633 #endif
634634
635+ if (!bss && (status == WLAN_STATUS_SUCCESS)) {
636+ WARN_ON_ONCE(!wiphy_to_dev(wdev->wiphy)->ops->connect);
637+ bss = cfg80211_get_bss(wdev->wiphy, NULL, bssid,
638+ wdev->ssid, wdev->ssid_len,
639+ WLAN_CAPABILITY_ESS,
640+ WLAN_CAPABILITY_ESS);
641+ if (bss)
642+ cfg80211_hold_bss(bss_from_pub(bss));
643+ }
644+
635645 if (wdev->current_bss) {
636646 cfg80211_unhold_bss(wdev->current_bss);
637647 cfg80211_put_bss(wdev->wiphy, &wdev->current_bss->pub);
@@ -649,16 +659,8 @@ void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid, · 11 unmodified lines
649659 return;
650660 }
651661
652− if (!bss) {
653− WARN_ON_ONCE(!wiphy_to_dev(wdev->wiphy)->ops->connect);
654− bss = cfg80211_get_bss(wdev->wiphy, NULL, bssid,
655− wdev->ssid, wdev->ssid_len,
656− WLAN_CAPABILITY_ESS,
657− WLAN_CAPABILITY_ESS);
658− if (WARN_ON(!bss))
659− return;
660− cfg80211_hold_bss(bss_from_pub(bss));
661− }
662+ if (WARN_ON(!bss))
663+ return;
662664
663665 wdev->current_bss = bss_from_pub(bss);
664666
scripts/link-vmlinux.sh+3−1
@@ -82,7 +82,9 @@ kallsyms() · 81 unmodified lines
8282 kallsymopt="${kallsymopt} --all-symbols"
8383 fi
8484
85− kallsymopt="${kallsymopt} --page-offset=$CONFIG_PAGE_OFFSET"
85+ if [ -n "${CONFIG_ARM}" ] && [ -n "${CONFIG_PAGE_OFFSET}" ]; then
86+ kallsymopt="${kallsymopt} --page-offset=$CONFIG_PAGE_OFFSET"
87+ fi
8688
8789 local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \
8890 ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}"
security/selinux/hooks.c+23−5
@@ -234,6 +234,14 @@ static int inode_alloc_security(struct inode *inode) · 233 unmodified lines
234234 return 0;
235235 }
236236
237+static void inode_free_rcu(struct rcu_head *head)
238+{
239+ struct inode_security_struct *isec;
240+
241+ isec = container_of(head, struct inode_security_struct, rcu);
242+ kmem_cache_free(sel_inode_cache, isec);
243+}
244+
237245 static void inode_free_security(struct inode *inode)
238246 {
239247 struct inode_security_struct *isec = inode->i_security;
@@ -244,8 +252,16 @@ static void inode_free_security(struct inode *inode) · 4 unmodified lines
244252 list_del_init(&isec->list);
245253 spin_unlock(&sbsec->isec_lock);
246254
247− inode->i_security = NULL;
248− kmem_cache_free(sel_inode_cache, isec);
255+ /*
256+ * The inode may still be referenced in a path walk and
257+ * a call to selinux_inode_permission() can be made
258+ * after inode_free_security() is called. Ideally, the VFS
259+ * wouldn't do this, but fixing that is a much harder
260+ * job. For now, simply free the i_security via RCU, and
261+ * leave the current inode->i_security pointer intact.
262+ * The inode will be freed after the RCU grace period too.
263+ */
264+ call_rcu(&isec->rcu, inode_free_rcu);
249265 }
250266
251267 static int file_alloc_security(struct file *file)
@@ -4334,8 +4350,10 @@ static int selinux_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb) · 4082 unmodified lines
43344350 }
43354351 err = avc_has_perm(sk_sid, peer_sid, SECCLASS_PEER,
43364352 PEER__RECV, &ad);
4337− if (err)
4353+ if (err) {
43384354 selinux_netlbl_err(skb, err, 0);
4355+ return err;
4356+ }
43394357 }
43404358
43414359 if (secmark_active) {
@@ -5586,11 +5604,11 @@ static int selinux_setprocattr(struct task_struct *p, · 1244 unmodified lines
55865604 /* Check for ptracing, and update the task SID if ok.
55875605 Otherwise, leave SID unchanged and fail. */
55885606 ptsid = 0;
5589− task_lock(p);
5607+ rcu_read_lock();
55905608 tracer = ptrace_parent(p);
55915609 if (tracer)
55925610 ptsid = task_sid(tracer);
5593− task_unlock(p);
5611+ rcu_read_unlock();
55945612
55955613 if (tracer) {
55965614 error = avc_has_perm(ptsid, sid, SECCLASS_PROCESS,
security/selinux/include/objsec.h+4−1
@@ -38,7 +38,10 @@ struct task_security_struct { · 37 unmodified lines
3838
3939 struct inode_security_struct {
4040 struct inode *inode; /* back pointer to inode object */
41− struct list_head list; /* list of inode_security_struct */
41+ union {
42+ struct list_head list; /* list of inode_security_struct */
43+ struct rcu_head rcu; /* for freeing the inode_security_struct */
44+ };
4245 u32 task_sid; /* SID of creating task */
4346 u32 sid; /* SID of this object */
4447 u16 sclass; /* security class of this object */
sound/core/pcm_lib.c+2−0
@@ -1937,6 +1937,8 @@ static int wait_for_avail(struct snd_pcm_substream *substream, · 1936 unmodified lines
19371937 case SNDRV_PCM_STATE_DISCONNECTED:
19381938 err = -EBADFD;
19391939 goto _endloop;
1940+ case SNDRV_PCM_STATE_PAUSED:
1941+ continue;
19401942 }
19411943 if (!tout) {
19421944 snd_printd("%s write error (DMA or IRQ trouble?)\n",
sound/pci/hda/hda_intel.c+4−0
@@ -3433,6 +3433,10 @@ static void check_probe_mask(struct azx *chip, int dev) · 3432 unmodified lines
34333433 * white/black-list for enable_msi
34343434 */
34353435 static struct snd_pci_quirk msi_black_list[] = {
3436+ SND_PCI_QUIRK(0x103c, 0x2191, "HP", 0), /* AMD Hudson */
3437+ SND_PCI_QUIRK(0x103c, 0x2192, "HP", 0), /* AMD Hudson */
3438+ SND_PCI_QUIRK(0x103c, 0x21f7, "HP", 0), /* AMD Hudson */
3439+ SND_PCI_QUIRK(0x103c, 0x21fa, "HP", 0), /* AMD Hudson */
34363440 SND_PCI_QUIRK(0x1043, 0x81f2, "ASUS", 0), /* Athlon64 X2 + nvidia */
34373441 SND_PCI_QUIRK(0x1043, 0x81f6, "ASUS", 0), /* nvidia */
34383442 SND_PCI_QUIRK(0x1043, 0x822d, "ASUS", 0), /* Athlon64 X2 + nvidia MCP55 */
sound/pci/hda/patch_realtek.c+4−0
@@ -4247,12 +4247,16 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 4246 unmodified lines
42474247 SND_PCI_QUIRK(0x1028, 0x0606, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
42484248 SND_PCI_QUIRK(0x1028, 0x0608, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
42494249 SND_PCI_QUIRK(0x1028, 0x0609, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4250+ SND_PCI_QUIRK(0x1028, 0x0610, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
42504251 SND_PCI_QUIRK(0x1028, 0x0613, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
42514252 SND_PCI_QUIRK(0x1028, 0x0614, "Dell Inspiron 3135", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
42524253 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_MONO_SPEAKERS),
42534254 SND_PCI_QUIRK(0x1028, 0x061f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4255+ SND_PCI_QUIRK(0x1028, 0x0629, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
42544256 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS),
4257+ SND_PCI_QUIRK(0x1028, 0x063e, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
42554258 SND_PCI_QUIRK(0x1028, 0x063f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4259+ SND_PCI_QUIRK(0x1028, 0x0640, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
42564260 SND_PCI_QUIRK(0x1028, 0x15cc, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
42574261 SND_PCI_QUIRK(0x1028, 0x15cd, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
42584262 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
sound/soc/atmel/atmel_ssc_dai.c+29−1
@@ -648,7 +648,7 @@ static int atmel_ssc_prepare(struct snd_pcm_substream *substream, · 647 unmodified lines
648648
649649 dma_params = ssc_p->dma_params[dir];
650650
651− ssc_writel(ssc_p->ssc->regs, CR, dma_params->mask->ssc_enable);
651+ ssc_writel(ssc_p->ssc->regs, CR, dma_params->mask->ssc_disable);
652652 ssc_writel(ssc_p->ssc->regs, IDR, dma_params->mask->ssc_error);
653653
654654 pr_debug("%s enabled SSC_SR=0x%08x\n",
@@ -657,6 +657,33 @@ static int atmel_ssc_prepare(struct snd_pcm_substream *substream, · 2 unmodified lines
657657 return 0;
658658 }
659659
660+static int atmel_ssc_trigger(struct snd_pcm_substream *substream,
661+ int cmd, struct snd_soc_dai *dai)
662+{
663+ struct atmel_ssc_info *ssc_p = &ssc_info[dai->id];
664+ struct atmel_pcm_dma_params *dma_params;
665+ int dir;
666+
667+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
668+ dir = 0;
669+ else
670+ dir = 1;
671+
672+ dma_params = ssc_p->dma_params[dir];
673+
674+ switch (cmd) {
675+ case SNDRV_PCM_TRIGGER_START:
676+ case SNDRV_PCM_TRIGGER_RESUME:
677+ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
678+ ssc_writel(ssc_p->ssc->regs, CR, dma_params->mask->ssc_enable);
679+ break;
680+ default:
681+ ssc_writel(ssc_p->ssc->regs, CR, dma_params->mask->ssc_disable);
682+ break;
683+ }
684+
685+ return 0;
686+}
660687
661688 #ifdef CONFIG_PM
662689 static int atmel_ssc_suspend(struct snd_soc_dai *cpu_dai)
@@ -731,6 +758,7 @@ static const struct snd_soc_dai_ops atmel_ssc_dai_ops = { · 68 unmodified lines
731758 .startup = atmel_ssc_startup,
732759 .shutdown = atmel_ssc_shutdown,
733760 .prepare = atmel_ssc_prepare,
761+ .trigger = atmel_ssc_trigger,
734762 .hw_params = atmel_ssc_hw_params,
735763 .set_fmt = atmel_ssc_set_dai_fmt,
736764 .set_clkdiv = atmel_ssc_set_dai_clkdiv,
sound/soc/atmel/sam9x5_wm8731.c+1−1
@@ -109,7 +109,7 @@ static int sam9x5_wm8731_driver_probe(struct platform_device *pdev) · 108 unmodified lines
109109 dai->stream_name = "WM8731 PCM";
110110 dai->codec_dai_name = "wm8731-hifi";
111111 dai->init = sam9x5_wm8731_init;
112− dai->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
112+ dai->dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_NB_NF
113113 | SND_SOC_DAIFMT_CBM_CFM;
114114
115115 ret = snd_soc_of_parse_card_name(card, "atmel,model");
sound/soc/codecs/wm5110.c+1−1
@@ -1012,7 +1012,7 @@ static const struct snd_soc_dapm_route wm5110_dapm_routes[] = { · 1011 unmodified lines
10121012 { "AEC Loopback", "HPOUT3L", "OUT3L" },
10131013 { "AEC Loopback", "HPOUT3R", "OUT3R" },
10141014 { "HPOUT3L", NULL, "OUT3L" },
1015− { "HPOUT3R", NULL, "OUT3L" },
1015+ { "HPOUT3R", NULL, "OUT3R" },
10161016
10171017 { "AEC Loopback", "SPKOUTL", "OUT4L" },
10181018 { "SPKOUTLN", NULL, "OUT4L" },
sound/soc/codecs/wm8904.c+1−1
@@ -1444,7 +1444,7 @@ static int wm8904_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) · 1443 unmodified lines
14441444
14451445 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
14461446 case SND_SOC_DAIFMT_DSP_B:
1447− aif1 |= WM8904_AIF_LRCLK_INV;
1447+ aif1 |= 0x3 | WM8904_AIF_LRCLK_INV;
14481448 case SND_SOC_DAIFMT_DSP_A:
14491449 aif1 |= 0x3;
14501450 break;
sound/soc/codecs/wm8962.c+13−0
@@ -2439,7 +2439,20 @@ static void wm8962_configure_bclk(struct snd_soc_codec *codec) · 2438 unmodified lines
24392439 snd_soc_update_bits(codec, WM8962_CLOCKING_4,
24402440 WM8962_SYSCLK_RATE_MASK, clocking4);
24412441
2442+ /* DSPCLK_DIV can be only generated correctly after enabling SYSCLK.
2443+ * So we here provisionally enable it and then disable it afterward
2444+ * if current bias_level hasn't reached SND_SOC_BIAS_ON.
2445+ */
2446+ if (codec->dapm.bias_level != SND_SOC_BIAS_ON)
2447+ snd_soc_update_bits(codec, WM8962_CLOCKING2,
2448+ WM8962_SYSCLK_ENA_MASK, WM8962_SYSCLK_ENA);
2449+
24422450 dspclk = snd_soc_read(codec, WM8962_CLOCKING1);
2451+
2452+ if (codec->dapm.bias_level != SND_SOC_BIAS_ON)
2453+ snd_soc_update_bits(codec, WM8962_CLOCKING2,
2454+ WM8962_SYSCLK_ENA_MASK, 0);
2455+
24432456 if (dspclk < 0) {
24442457 dev_err(codec->dev, "Failed to read DSPCLK: %d\n", dspclk);
24452458 return;
sound/soc/codecs/wm_adsp.c+7−3
@@ -1474,13 +1474,17 @@ static int wm_adsp2_ena(struct wm_adsp *dsp) · 1473 unmodified lines
14741474 return ret;
14751475
14761476 /* Wait for the RAM to start, should be near instantaneous */
1477− count = 0;
1478− do {
1477+ for (count = 0; count < 10; ++count) {
14791478 ret = regmap_read(dsp->regmap, dsp->base + ADSP2_STATUS1,
14801479 &val);
14811480 if (ret != 0)
14821481 return ret;
1483− } while (!(val & ADSP2_RAM_RDY) && ++count < 10);
1482+
1483+ if (val & ADSP2_RAM_RDY)
1484+ break;
1485+
1486+ msleep(1);
1487+ }
14841488
14851489 if (!(val & ADSP2_RAM_RDY)) {
14861490 adsp_err(dsp, "Failed to start DSP RAM\n");
sound/soc/fsl/imx-wm8962.c+0−2
@@ -130,8 +130,6 @@ static int imx_wm8962_set_bias_level(struct snd_soc_card *card, · 129 unmodified lines
130130 break;
131131 }
132132
133− dapm->bias_level = level;
134−
135133 return 0;
136134 }
137135
sound/soc/kirkwood/kirkwood-i2s.c+12−12
@@ -473,17 +473,17 @@ static struct snd_soc_dai_driver kirkwood_i2s_dai_extclk[2] = { · 472 unmodified lines
473473 .playback = {
474474 .channels_min = 1,
475475 .channels_max = 2,
476− .rates = SNDRV_PCM_RATE_8000_192000 |
477− SNDRV_PCM_RATE_CONTINUOUS |
478− SNDRV_PCM_RATE_KNOT,
476+ .rates = SNDRV_PCM_RATE_CONTINUOUS,
477+ .rate_min = 5512,
478+ .rate_max = 192000,
479479 .formats = KIRKWOOD_I2S_FORMATS,
480480 },
481481 .capture = {
482482 .channels_min = 1,
483483 .channels_max = 2,
484− .rates = SNDRV_PCM_RATE_8000_192000 |
485− SNDRV_PCM_RATE_CONTINUOUS |
486− SNDRV_PCM_RATE_KNOT,
484+ .rates = SNDRV_PCM_RATE_CONTINUOUS,
485+ .rate_min = 5512,
486+ .rate_max = 192000,
487487 .formats = KIRKWOOD_I2S_FORMATS,
488488 },
489489 .ops = &kirkwood_i2s_dai_ops,
@@ -494,17 +494,17 @@ static struct snd_soc_dai_driver kirkwood_i2s_dai_extclk[2] = { · 4 unmodified lines
494494 .playback = {
495495 .channels_min = 1,
496496 .channels_max = 2,
497− .rates = SNDRV_PCM_RATE_8000_192000 |
498− SNDRV_PCM_RATE_CONTINUOUS |
499− SNDRV_PCM_RATE_KNOT,
497+ .rates = SNDRV_PCM_RATE_CONTINUOUS,
498+ .rate_min = 5512,
499+ .rate_max = 192000,
500500 .formats = KIRKWOOD_SPDIF_FORMATS,
501501 },
502502 .capture = {
503503 .channels_min = 1,
504504 .channels_max = 2,
505− .rates = SNDRV_PCM_RATE_8000_192000 |
506− SNDRV_PCM_RATE_CONTINUOUS |
507− SNDRV_PCM_RATE_KNOT,
505+ .rates = SNDRV_PCM_RATE_CONTINUOUS,
506+ .rate_min = 5512,
507+ .rate_max = 192000,
508508 .formats = KIRKWOOD_SPDIF_FORMATS,
509509 },
510510 .ops = &kirkwood_i2s_dai_ops,
sound/soc/soc-generic-dmaengine-pcm.c+27−11
@@ -305,6 +305,20 @@ static void dmaengine_pcm_request_chan_of(struct dmaengine_pcm *pcm, · 304 unmodified lines
305305 }
306306 }
307307
308+static void dmaengine_pcm_release_chan(struct dmaengine_pcm *pcm)
309+{
310+ unsigned int i;
311+
312+ for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_CAPTURE;
313+ i++) {
314+ if (!pcm->chan[i])
315+ continue;
316+ dma_release_channel(pcm->chan[i]);
317+ if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX)
318+ break;
319+ }
320+}
321+
308322 /**
309323 * snd_dmaengine_pcm_register - Register a dmaengine based PCM device
310324 * @dev: The parent device for the PCM device
@@ -315,6 +329,7 @@ int snd_dmaengine_pcm_register(struct device *dev, · 4 unmodified lines
315329 const struct snd_dmaengine_pcm_config *config, unsigned int flags)
316330 {
317331 struct dmaengine_pcm *pcm;
332+ int ret;
318333
319334 pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
320335 if (!pcm)
@@ -326,11 +341,20 @@ int snd_dmaengine_pcm_register(struct device *dev, · 5 unmodified lines
326341 dmaengine_pcm_request_chan_of(pcm, dev);
327342
328343 if (flags & SND_DMAENGINE_PCM_FLAG_NO_RESIDUE)
329− return snd_soc_add_platform(dev, &pcm->platform,
344+ ret = snd_soc_add_platform(dev, &pcm->platform,
330345 &dmaengine_no_residue_pcm_platform);
331346 else
332− return snd_soc_add_platform(dev, &pcm->platform,
347+ ret = snd_soc_add_platform(dev, &pcm->platform,
333348 &dmaengine_pcm_platform);
349+ if (ret)
350+ goto err_free_dma;
351+
352+ return 0;
353+
354+err_free_dma:
355+ dmaengine_pcm_release_chan(pcm);
356+ kfree(pcm);
357+ return ret;
334358 }
335359 EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_register);
336360
@@ -345,7 +369,6 @@ void snd_dmaengine_pcm_unregister(struct device *dev) · 8 unmodified lines
345369 {
346370 struct snd_soc_platform *platform;
347371 struct dmaengine_pcm *pcm;
348− unsigned int i;
349372
350373 platform = snd_soc_lookup_platform(dev);
351374 if (!platform)
@@ -353,15 +376,8 @@ void snd_dmaengine_pcm_unregister(struct device *dev) · 1 unmodified line
353376
354377 pcm = soc_platform_to_pcm(platform);
355378
356− for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_CAPTURE; i++) {
357− if (pcm->chan[i]) {
358− dma_release_channel(pcm->chan[i]);
359− if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX)
360− break;
361− }
362− }
363−
364379 snd_soc_remove_platform(platform);
380+ dmaengine_pcm_release_chan(pcm);
365381 kfree(pcm);
366382 }
367383 EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_unregister);
sound/soc/soc-pcm.c+3−2
@@ -600,12 +600,13 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream) · 599 unmodified lines
600600 struct snd_soc_platform *platform = rtd->platform;
601601 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
602602 struct snd_soc_dai *codec_dai = rtd->codec_dai;
603− struct snd_soc_codec *codec = rtd->codec;
603+ bool playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
604604
605605 mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);
606606
607607 /* apply codec digital mute */
608− if (!codec->active)
608+ if ((playback && codec_dai->playback_active == 1) ||
609+ (!playback && codec_dai->capture_active == 1))
609610 snd_soc_dai_digital_mute(codec_dai, 1, substream->stream);
610611
611612 /* free any machine hw params */
sound/soc/tegra/tegra20_i2s.c+3−3
@@ -74,7 +74,7 @@ static int tegra20_i2s_set_fmt(struct snd_soc_dai *dai, · 73 unmodified lines
7474 unsigned int fmt)
7575 {
7676 struct tegra20_i2s *i2s = snd_soc_dai_get_drvdata(dai);
77− unsigned int mask, val;
77+ unsigned int mask = 0, val = 0;
7878
7979 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
8080 case SND_SOC_DAIFMT_NB_NF:
@@ -83,10 +83,10 @@ static int tegra20_i2s_set_fmt(struct snd_soc_dai *dai, · 2 unmodified lines
8383 return -EINVAL;
8484 }
8585
86− mask = TEGRA20_I2S_CTRL_MASTER_ENABLE;
86+ mask |= TEGRA20_I2S_CTRL_MASTER_ENABLE;
8787 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
8888 case SND_SOC_DAIFMT_CBS_CFS:
89− val = TEGRA20_I2S_CTRL_MASTER_ENABLE;
89+ val |= TEGRA20_I2S_CTRL_MASTER_ENABLE;
9090 break;
9191 case SND_SOC_DAIFMT_CBM_CFM:
9292 break;
sound/soc/tegra/tegra20_spdif.c+5−5
@@ -67,15 +67,15 @@ static int tegra20_spdif_hw_params(struct snd_pcm_substream *substream, · 66 unmodified lines
6767 {
6868 struct device *dev = dai->dev;
6969 struct tegra20_spdif *spdif = snd_soc_dai_get_drvdata(dai);
70− unsigned int mask, val;
70+ unsigned int mask = 0, val = 0;
7171 int ret, spdifclock;
7272
73− mask = TEGRA20_SPDIF_CTRL_PACK |
74− TEGRA20_SPDIF_CTRL_BIT_MODE_MASK;
73+ mask |= TEGRA20_SPDIF_CTRL_PACK |
74+ TEGRA20_SPDIF_CTRL_BIT_MODE_MASK;
7575 switch (params_format(params)) {
7676 case SNDRV_PCM_FORMAT_S16_LE:
77− val = TEGRA20_SPDIF_CTRL_PACK |
78− TEGRA20_SPDIF_CTRL_BIT_MODE_16BIT;
77+ val |= TEGRA20_SPDIF_CTRL_PACK |
78+ TEGRA20_SPDIF_CTRL_BIT_MODE_16BIT;
7979 break;
8080 default:
8181 return -EINVAL;
sound/soc/tegra/tegra30_i2s.c+3−3
@@ -118,7 +118,7 @@ static int tegra30_i2s_set_fmt(struct snd_soc_dai *dai, · 117 unmodified lines
118118 unsigned int fmt)
119119 {
120120 struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai);
121− unsigned int mask, val;
121+ unsigned int mask = 0, val = 0;
122122
123123 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
124124 case SND_SOC_DAIFMT_NB_NF:
@@ -127,10 +127,10 @@ static int tegra30_i2s_set_fmt(struct snd_soc_dai *dai, · 2 unmodified lines
127127 return -EINVAL;
128128 }
129129
130− mask = TEGRA30_I2S_CTRL_MASTER_ENABLE;
130+ mask |= TEGRA30_I2S_CTRL_MASTER_ENABLE;
131131 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
132132 case SND_SOC_DAIFMT_CBS_CFS:
133− val = TEGRA30_I2S_CTRL_MASTER_ENABLE;
133+ val |= TEGRA30_I2S_CTRL_MASTER_ENABLE;
134134 break;
135135 case SND_SOC_DAIFMT_CBM_CFM:
136136 break;
tools/power/cpupower/utils/cpupower-set.c+3−3
@@ -18,9 +18,9 @@ · 17 unmodified lines
1818 #include "helpers/bitmask.h"
1919
2020 static struct option set_opts[] = {
21− { .name = "perf-bias", .has_arg = optional_argument, .flag = NULL, .val = 'b'},
22− { .name = "sched-mc", .has_arg = optional_argument, .flag = NULL, .val = 'm'},
23− { .name = "sched-smt", .has_arg = optional_argument, .flag = NULL, .val = 's'},
21+ { .name = "perf-bias", .has_arg = required_argument, .flag = NULL, .val = 'b'},
22+ { .name = "sched-mc", .has_arg = required_argument, .flag = NULL, .val = 'm'},
23+ { .name = "sched-smt", .has_arg = required_argument, .flag = NULL, .val = 's'},
2424 { },
2525 };
2626