History

Merge 4.7-rc4 into staging-next

We want the fixes in here, and we can resolve a merge issue in drivers/iio/industrialio-trigger.c

Greg Kroah-Hartman committed 10 years ago

Commit af527392 parents 25ed6a5 33688ab561 files · +5198 −3321Browse files

Unified · Split

561 files
  1. .mailmap +2 −0
  2. CREDITS +1 −0
  3. Documentation/ABI/testing/configfs-usb-gadget-uvc +29 −29
  4. Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 +1 −1
  5. Documentation/devicetree/bindings/hwmon/ina2xx.txt +1 −0
  6. Documentation/devicetree/bindings/i2c/i2c-arb-gpio-challenge.txt +2 −2
  7. Documentation/devicetree/bindings/i2c/i2c-demux-pinctrl.txt +2 −1
  8. Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt +3 −3
  9. Documentation/devicetree/bindings/i2c/i2c-mux-pinctrl.txt +2 −2
  10. Documentation/devicetree/bindings/i2c/i2c-mux-reg.txt +3 −3
  11. Documentation/devicetree/bindings/net/marvell-bt-sd8xxx.txt +4 −4
  12. Documentation/devicetree/bindings/vendor-prefixes.txt +2 −0
  13. Documentation/leds/leds-class.txt +2 −2
  14. MAINTAINERS +45 −23
  15. Makefile +1 −1
  16. arch/Kconfig +3 −0
  17. arch/arc/Kconfig +4 −27
  18. arch/arc/Makefile +1 −1
  19. arch/arc/boot/dts/abilis_tb100.dtsi +0 −2
  20. arch/arc/boot/dts/abilis_tb101.dtsi +0 −2
  21. arch/arc/boot/dts/axc001.dtsi +0 −1
  22. arch/arc/boot/dts/axc003.dtsi +0 −1
  23. arch/arc/boot/dts/axc003_idu.dtsi +0 −1
  24. arch/arc/boot/dts/eznps.dts +0 −1
  25. arch/arc/boot/dts/nsim_700.dts +0 −1
  26. arch/arc/boot/dts/nsimosci.dts +0 −1
  27. arch/arc/boot/dts/nsimosci_hs.dts +0 −1
  28. arch/arc/boot/dts/nsimosci_hs_idu.dts +0 −1
  29. arch/arc/boot/dts/skeleton.dtsi +0 −1
  30. arch/arc/boot/dts/skeleton_hs.dtsi +0 −1
  31. arch/arc/boot/dts/skeleton_hs_idu.dtsi +0 −1
  32. arch/arc/boot/dts/vdk_axc003.dtsi +0 −1
  33. arch/arc/boot/dts/vdk_axc003_idu.dtsi +0 −1
  34. arch/arc/include/asm/atomic.h +4 −41
  35. arch/arc/include/asm/entry-compact.h +2 −2
  36. arch/arc/include/asm/mmu_context.h +1 −1
  37. arch/arc/include/asm/pgtable.h +1 −1
  38. arch/arc/include/asm/processor.h +1 −1
  39. arch/arc/include/asm/smp.h +1 −1
  40. arch/arc/include/asm/spinlock.h +0 −292
  41. arch/arc/include/asm/thread_info.h +1 −1
  42. arch/arc/include/asm/uaccess.h +1 −1
  43. arch/arc/include/uapi/asm/swab.h +1 −1
  44. arch/arc/kernel/entry-compact.S +2 −16
  45. arch/arc/kernel/intc-compact.c +2 −4
  46. arch/arc/kernel/perf_event.c +1 −1
  47. arch/arc/kernel/setup.c +1 −1
  48. arch/arc/kernel/signal.c +1 −1
  49. arch/arc/kernel/troubleshoot.c +1 −1
  50. arch/arc/mm/cache.c +3 −3
  51. arch/arc/mm/dma.c +1 −1
  52. arch/arm/boot/dts/Makefile +1 −0
  53. arch/arm/boot/dts/am437x-sk-evm.dts +1 −1
  54. arch/arm/boot/dts/am57xx-idk-common.dtsi +17 −15
  55. arch/arm/boot/dts/dm8148-evm.dts +8 −0
  56. arch/arm/boot/dts/dm8148-t410.dts +9 −0
  57. arch/arm/boot/dts/dra7.dtsi +2 −0
  58. arch/arm/boot/dts/dra74x.dtsi +2 −2
  59. arch/arm/boot/dts/exynos5250-snow-common.dtsi +10 −3
  60. arch/arm/boot/dts/exynos5420-peach-pit.dts +10 −3
  61. arch/arm/boot/dts/omap3-evm-37xx.dts +1 −1
  62. arch/arm/boot/dts/omap3-igep.dtsi +1 −0
  63. arch/arm/boot/dts/omap3-igep0020-common.dtsi +11 −0
  64. arch/arm/boot/dts/omap3-n900.dts +2 −2
  65. arch/arm/boot/dts/omap3-n950-n9.dtsi +3 −3
  66. arch/arm/boot/dts/omap3-zoom3.dts +3 −3
  67. arch/arm/boot/dts/omap5-board-common.dtsi +46 −2
  68. arch/arm/boot/dts/omap5-igep0050.dts +26 −0
  69. arch/arm/boot/dts/omap5-uevm.dts +10 −0
  70. arch/arm/boot/dts/socfpga_cyclone5_vining_fpga.dts +1 −0
  71. arch/arm/boot/dts/stih407-family.dtsi +3 −0
  72. arch/arm/boot/dts/sun6i-a31s-primo81.dts +0 −2
  73. arch/arm/boot/dts/sun6i-a31s-yones-toptech-bs1078-v2.dts +0 −2
  74. arch/arm/configs/exynos_defconfig +1 −0
  75. arch/arm/configs/multi_v7_defconfig +1 −0
  76. arch/arm/include/asm/pgtable-2level.h +1 −0
  77. arch/arm/include/asm/pgtable-3level.h +3 −2
  78. arch/arm/include/asm/pgtable.h +0 −1
  79. arch/arm/kernel/smp.c +1 −1
  80. arch/arm/mach-exynos/Kconfig +0 −1
  81. arch/arm/mach-imx/mach-imx6ul.c +1 −1
  82. arch/arm/mach-omap1/ams-delta-fiq-handler.S +3 −3
  83. arch/arm/mach-omap1/ams-delta-fiq.c +3 −2
  84. arch/arm/mach-omap1/include/mach/ams-delta-fiq.h +2 −0
  85. arch/arm/mach-omap2/Kconfig +12 −0
  86. arch/arm/mach-omap2/omap-secure.h +1 −0
  87. arch/arm/mach-omap2/omap-smp.c +43 −5
  88. arch/arm/mach-omap2/powerdomain.c +5 −4
  89. arch/arm/mach-omap2/powerdomains7xx_data.c +2 −74
  90. arch/arm/mach-omap2/timer.c +5 −2
  91. arch/arm/mach-vexpress/spc.c +1 −1
  92. arch/arm/plat-samsung/devs.c +1 −1
  93. arch/arm64/boot/dts/lg/lg1312.dtsi +1 −1
  94. arch/arm64/boot/dts/rockchip/rk3399.dtsi +1 −1
  95. arch/arm64/include/asm/kgdb.h +37 −8
  96. arch/arm64/include/asm/spinlock.h +37 −5
  97. arch/arm64/kernel/kgdb.c +13 −1
  98. arch/arm64/kernel/traps.c +13 −13
  99. arch/arm64/mm/fault.c +2 −2
  100. arch/mips/include/asm/kvm_host.h +2 −1
  101. arch/mips/kvm/emulate.c +13 −6
  102. arch/mips/kvm/interrupt.h +1 −0
  103. arch/mips/kvm/locore.S +1 −0
  104. arch/mips/kvm/mips.c +10 −1
  105. arch/powerpc/include/asm/nohash/64/pgalloc.h +1 −1
  106. arch/powerpc/kernel/prom_init.c +1 −1
  107. arch/powerpc/kernel/ptrace.c +2 −2
  108. arch/powerpc/mm/hash_native_64.c +5 −1
  109. arch/powerpc/mm/tlb-radix.c +4 −4
  110. arch/powerpc/platforms/512x/clock-commonclk.c +1 −1
  111. arch/powerpc/platforms/cell/spufs/coredump.c +1 −1
  112. arch/powerpc/platforms/pseries/iommu.c +2 −2
  113. arch/s390/include/asm/kvm_host.h +1 −0
  114. arch/s390/kvm/intercept.c +2 −0
  115. arch/s390/kvm/kvm-s390.c +2 −1
  116. arch/x86/Kconfig +9 −0
  117. arch/x86/boot/Makefile +3 −0
  118. arch/x86/events/intel/rapl.c +1 −1
  119. arch/x86/events/intel/uncore_snbep.c +0 −21
  120. arch/x86/include/asm/intel-family.h +68 −0
  121. arch/x86/include/asm/kvm_host.h +11 −0
  122. arch/x86/include/asm/msr.h +2 −2
  123. arch/x86/kernel/apic/io_apic.c +1 −1
  124. arch/x86/kernel/cpu/amd.c +2 −2
  125. arch/x86/kernel/traps.c +10 −10
  126. arch/x86/kvm/svm.c +13 −8
  127. arch/x86/kvm/vmx.c +10 −5
  128. block/blk-lib.c +9 −3
  129. block/blk-mq.c +8 −9
  130. drivers/acpi/acpica/hwregs.c +9 −137
  131. drivers/acpi/bus.c +1 −1
  132. drivers/acpi/ec.c +22 −7
  133. drivers/acpi/internal.h +1 −1
  134. drivers/base/Makefile +1 −1
  135. drivers/base/isa.c +1 −1
  136. drivers/base/module.c +5 −3
  137. drivers/base/power/opp/cpu.c +9 −3
  138. drivers/base/power/opp/of.c +8 −2
  139. drivers/base/power/opp/opp.h +7 −1
  140. drivers/block/nbd.c +1 −1
  141. drivers/block/xen-blkfront.c +22 −13
  142. drivers/char/ipmi/ipmi_msghandler.c +6 −2
  143. drivers/clk/Kconfig +1 −0
  144. drivers/clk/microchip/clk-pic32mzda.c +5 −5
  145. drivers/cpufreq/intel_pstate.c +11 −23
  146. drivers/dma/at_xdmac.c +57 −25
  147. drivers/dma/mv_xor.c +6 −4
  148. drivers/edac/edac_mc.c +2 −1
  149. drivers/edac/sb_edac.c +22 −13
  150. drivers/extcon/extcon-palmas.c +2 −0
  151. drivers/firmware/efi/arm-init.c +6 −8
  152. drivers/gpio/Kconfig +5 −4
  153. drivers/gpio/gpio-104-dio-48e.c +2 −2
  154. drivers/gpio/gpio-bcm-kona.c +2 −2
  155. drivers/gpio/gpio-zynq.c +7 −0
  156. drivers/gpio/gpiolib-of.c +1 −0
  157. drivers/gpio/gpiolib.c +3 −3
  158. drivers/gpu/drm/amd/amdgpu/amdgpu.h +7 −0
  159. drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +12 −0
  160. drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +23 −2
  161. drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c +17 −7
  162. drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +1 −0
  163. drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c +1 −0
  164. drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +10 −9
  165. drivers/gpu/drm/amd/amdgpu/ci_dpm.c +3 −0
  166. drivers/gpu/drm/amd/amdgpu/cik.c +7 −0
  167. drivers/gpu/drm/amd/amdgpu/cik_sdma.c +20 −2
  168. drivers/gpu/drm/amd/amdgpu/fiji_dpm.c +5 −0
  169. drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +18 −1
  170. drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +26 −2
  171. drivers/gpu/drm/amd/amdgpu/iceland_dpm.c +5 −0
  172. drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +18 −2
  173. drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +23 −4
  174. drivers/gpu/drm/amd/amdgpu/tonga_dpm.c +5 −0
  175. drivers/gpu/drm/amd/amdgpu/vi.c +15 −0
  176. drivers/gpu/drm/amd/amdkfd/kfd_process.c +43 −27
  177. drivers/gpu/drm/amd/amdkfd/kfd_topology.c +1 −1
  178. drivers/gpu/drm/amd/include/amd_shared.h +1 −0
  179. drivers/gpu/drm/amd/include/cgs_common.h +6 −0
  180. drivers/gpu/drm/amd/powerplay/amd_powerplay.c +7 −1
  181. drivers/gpu/drm/amd/powerplay/eventmgr/eventmgr.c +0 −3
  182. drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c +1 −1
  183. drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +8 −1
  184. drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr_ppt.h +1 −0
  185. drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c +17 −11
  186. drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_powertune.c +1 −1
  187. drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c +0 −21
  188. drivers/gpu/drm/amd/powerplay/hwmgr/tonga_pptable.h +16 −0
  189. drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c +89 −56
  190. drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c +6 −0
  191. drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +1 −0
  192. drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c +1 −0
  193. drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c +7 −0
  194. drivers/gpu/drm/drm_crtc_helper.c +28 −26
  195. drivers/gpu/drm/drm_dp_mst_topology.c +3 −5
  196. drivers/gpu/drm/etnaviv/etnaviv_iommu.c +1 −0
  197. drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +2 −1
  198. drivers/gpu/drm/i915/i915_drv.h +1 −0
  199. drivers/gpu/drm/i915/intel_bios.c +45 −1
  200. drivers/gpu/drm/i915/intel_display.c +60 −28
  201. drivers/gpu/drm/i915/intel_dp.c +10 −8
  202. drivers/gpu/drm/i915/intel_dpll_mgr.c +3 −0
  203. drivers/gpu/drm/i915/intel_drv.h +1 −1
  204. drivers/gpu/drm/i915/intel_dsi.c +3 −0
  205. drivers/gpu/drm/i915/intel_hdmi.c +3 −0
  206. drivers/gpu/drm/i915/intel_lvds.c +2 −0
  207. drivers/gpu/drm/i915/intel_vbt_defs.h +4 −3
  208. drivers/gpu/drm/msm/adreno/adreno_gpu.c +1 −1
  209. drivers/gpu/drm/msm/msm_fbdev.c +4 −0
  210. drivers/gpu/drm/msm/msm_gem.c +2 −0
  211. drivers/gpu/drm/msm/msm_gem_submit.c +7 −0
  212. drivers/gpu/drm/msm/msm_rd.c +3 −0
  213. drivers/gpu/drm/msm/msm_ringbuffer.c +4 −0
  214. drivers/gpu/drm/nouveau/include/nvkm/core/device.h +1 −1
  215. drivers/gpu/drm/nouveau/include/nvkm/subdev/bios/disp.h +3 −2
  216. drivers/gpu/drm/nouveau/nouveau_fbcon.c +1 −0
  217. drivers/gpu/drm/nouveau/nv04_fbcon.c +2 −5
  218. drivers/gpu/drm/nouveau/nv50_fbcon.c +2 −4
  219. drivers/gpu/drm/nouveau/nvc0_fbcon.c +2 −4
  220. drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c +1 −1
  221. drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild +1 −0
  222. drivers/gpu/drm/nouveau/nvkm/engine/disp/gf119.c +5 −8
  223. drivers/gpu/drm/nouveau/nvkm/engine/disp/gm107.c +1 −1
  224. drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.c +4 −8
  225. drivers/gpu/drm/nouveau/nvkm/engine/disp/outpdp.h +7 −2
  226. drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgf119.c +2 −3
  227. drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm107.c +53 −0
  228. drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c +1 −14
  229. drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c +28 −9
  230. drivers/gpu/drm/nouveau/nvkm/subdev/bios/disp.c +5 −3
  231. drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c +9 −7
  232. drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gm107.c +3 −3
  233. drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gm200.c +1 −1
  234. drivers/gpu/drm/omapdrm/dss/dsi.c +0 −1
  235. drivers/gpu/drm/omapdrm/dss/hdmi5.c +0 −1
  236. drivers/gpu/drm/radeon/atombios_crtc.c +3 −2
  237. drivers/gpu/drm/radeon/radeon_device.c +22 −1
  238. drivers/gpu/drm/vc4/vc4_crtc.c +22 −10
  239. drivers/gpu/drm/vc4/vc4_drv.c +7 −7
  240. drivers/gpu/drm/vc4/vc4_kms.c +12 −4
  241. drivers/gpu/drm/vc4/vc4_regs.h +4 −0
  242. drivers/gpu/drm/vmwgfx/vmwgfx_msg.c +3 −1
  243. drivers/hid/hid-elo.c +1 −1
  244. drivers/hid/hid-multitouch.c +5 −0
  245. drivers/hwmon/fam15h_power.c +2 −6
  246. drivers/hwmon/lm90.c +1 −1
  247. drivers/hwtracing/coresight/coresight-tmc-etr.c +4 −7
  248. drivers/hwtracing/coresight/coresight.c +9 −6
  249. drivers/i2c/busses/i2c-i801.c +96 −3
  250. drivers/i2c/busses/i2c-octeon.c +10 −7
  251. drivers/i2c/muxes/i2c-mux-reg.c +1 −0
  252. drivers/iio/accel/st_accel_buffer.c +1 −1
  253. drivers/iio/accel/st_accel_core.c +1 −0
  254. drivers/iio/common/st_sensors/st_sensors_buffer.c +7 −18
  255. drivers/iio/common/st_sensors/st_sensors_core.c +8 −0
  256. drivers/iio/common/st_sensors/st_sensors_trigger.c +89 −7
  257. drivers/iio/dac/Kconfig +1 −1
  258. drivers/iio/dac/ad5592r-base.c +1 −1
  259. drivers/iio/gyro/st_gyro_buffer.c +1 −1
  260. drivers/iio/gyro/st_gyro_core.c +1 −0
  261. drivers/iio/humidity/am2315.c +1 −3
  262. drivers/iio/humidity/hdc100x.c +10 −10
  263. drivers/iio/imu/bmi160/bmi160_core.c +8 −8
  264. drivers/iio/industrialio-trigger.c +18 −5
  265. drivers/iio/light/apds9960.c +1 −0
  266. drivers/iio/light/bh1780.c +6 −4
  267. drivers/iio/light/max44000.c +0 −1
  268. drivers/iio/magnetometer/st_magn_buffer.c +1 −1
  269. drivers/iio/magnetometer/st_magn_core.c +1 −0
  270. drivers/iio/pressure/bmp280.c +2 −2
  271. drivers/iio/pressure/st_pressure_buffer.c +1 −1
  272. drivers/iio/pressure/st_pressure_core.c +51 −30
  273. drivers/iio/proximity/as3935.c +12 −5
  274. drivers/infiniband/core/cache.c +8 −2
  275. drivers/infiniband/core/cm.c +2 −2
  276. drivers/infiniband/core/device.c +5 −1
  277. drivers/infiniband/core/iwpm_msg.c +1 −1
  278. drivers/infiniband/core/mad.c +3 −3
  279. drivers/infiniband/core/sysfs.c +16 −8
  280. drivers/infiniband/hw/hfi1/affinity.c +14 −17
  281. drivers/infiniband/hw/hfi1/chip.c +3 −3
  282. drivers/infiniband/hw/hfi1/init.c +1 −1
  283. drivers/infiniband/hw/hfi1/trace.c +0 −13
  284. drivers/infiniband/hw/hfi1/user_sdma.c +3 −3
  285. drivers/infiniband/hw/mlx4/main.c +2 −2
  286. drivers/infiniband/hw/mlx5/cq.c +9 −3
  287. drivers/infiniband/hw/mlx5/main.c +15 −7
  288. drivers/infiniband/hw/mlx5/qp.c +25 −16
  289. drivers/infiniband/hw/usnic/usnic_uiom.c +0 −5
  290. drivers/infiniband/sw/rdmavt/qp.c +6 −0
  291. drivers/infiniband/ulp/ipoib/ipoib.h +1 −0
  292. drivers/infiniband/ulp/ipoib/ipoib_cm.c +4 −0
  293. drivers/infiniband/ulp/ipoib/ipoib_ib.c +4 −4
  294. drivers/infiniband/ulp/ipoib/ipoib_main.c +10 −5
  295. drivers/infiniband/ulp/ipoib/ipoib_multicast.c +3 −3
  296. drivers/infiniband/ulp/ipoib/ipoib_vlan.c +6 −0
  297. drivers/infiniband/ulp/srp/ib_srp.c +2 −5
  298. drivers/iommu/arm-smmu-v3.c +1 −0
  299. drivers/iommu/intel-iommu.c +12 −5
  300. drivers/iommu/rockchip-iommu.c +1 −1
  301. drivers/leds/led-core.c +6 −3
  302. drivers/leds/trigger/ledtrig-heartbeat.c +31 −0
  303. drivers/mcb/mcb-core.c +16 −1
  304. drivers/media/usb/uvc/uvc_v4l2.c +20 −77
  305. drivers/media/v4l2-core/v4l2-mc.c +1 −1
  306. drivers/memory/omap-gpmc.c +1 −1
  307. drivers/misc/mei/client.c +1 −1
  308. drivers/mtd/ubi/build.c +9 −2
  309. drivers/mtd/ubi/kapi.c +7 −1
  310. drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +62 −89
  311. drivers/net/ethernet/broadcom/bnxt/bnxt.c +25 −21
  312. drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h +1 −0
  313. drivers/net/ethernet/ethoc.c +4 −3
  314. drivers/net/ethernet/freescale/fec_main.c +4 −4
  315. drivers/net/ethernet/freescale/gianfar.c +2 −1
  316. drivers/net/ethernet/mediatek/mtk_eth_soc.c +34 −6
  317. drivers/net/ethernet/mellanox/mlx5/core/en_main.c +1 −4
  318. drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +2 −1
  319. drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +43 −26
  320. drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +25 −15
  321. drivers/net/ethernet/mellanox/mlx5/core/qp.c +1 −1
  322. drivers/net/ethernet/mellanox/mlx5/core/vport.c +38 −0
  323. drivers/net/ethernet/mellanox/mlxsw/spectrum.c +112 −91
  324. drivers/net/ethernet/mellanox/mlxsw/spectrum.h +5 −0
  325. drivers/net/ethernet/qlogic/qed/qed_main.c +36 −9
  326. drivers/net/ethernet/qlogic/qed/qed_sriov.h +3 −1
  327. drivers/net/ethernet/qlogic/qede/qede_main.c +2 −0
  328. drivers/net/ethernet/sfc/mcdi_port.c +4 −3
  329. drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +1 −1
  330. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +4 −2
  331. drivers/net/ethernet/ti/cpsw.c +1 −1
  332. drivers/net/vmxnet3/vmxnet3_drv.c +1 −1
  333. drivers/net/vmxnet3/vmxnet3_int.h +2 −2
  334. drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +16 −0
  335. drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +2 −0
  336. drivers/net/wireless/mac80211_hwsim.c +1 −0
  337. drivers/net/wireless/realtek/rtlwifi/core.c +3 −3
  338. drivers/nvme/host/pci.c +7 −2
  339. drivers/of/fdt.c +13 −2
  340. drivers/of/irq.c +10 −9
  341. drivers/of/of_reserved_mem.c +9 −2
  342. drivers/perf/arm_pmu.c +1 −1
  343. drivers/phy/phy-exynos-mipi-video.c +5 −1
  344. drivers/phy/phy-ti-pipe3.c +11 −4
  345. drivers/phy/phy-twl4030-usb.c +10 −4
  346. drivers/platform/x86/Kconfig +4 −6
  347. drivers/platform/x86/ideapad-laptop.c +2 −0
  348. drivers/platform/x86/thinkpad_acpi.c +63 −24
  349. drivers/pwm/core.c +2 −1
  350. drivers/pwm/pwm-atmel-hlcdc.c +1 −1
  351. drivers/pwm/sysfs.c +1 −1
  352. drivers/regulator/qcom_smd-regulator.c +14 −1
  353. drivers/regulator/tps51632-regulator.c +6 −3
  354. drivers/scsi/scsi_devinfo.c +1 −0
  355. drivers/scsi/sd.c +4 −4
  356. drivers/scsi/sd.h +5 −0
  357. drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +4 −3
  358. drivers/staging/rtl8188eu/core/rtw_efuse.c +1 −1
  359. drivers/staging/rtl8188eu/hal/usb_halinit.c +2 −1
  360. drivers/thermal/cpu_cooling.c +8 −8
  361. drivers/usb/core/quirks.c +13 −10
  362. drivers/usb/dwc2/core.h +27 −0
  363. drivers/usb/dwc2/gadget.c +20 −4
  364. drivers/usb/dwc3/core.h +1 −0
  365. drivers/usb/dwc3/dwc3-exynos.c +11 −8
  366. drivers/usb/dwc3/dwc3-st.c +8 −2
  367. drivers/usb/dwc3/gadget.c +24 −6
  368. drivers/usb/gadget/composite.c +13 −8
  369. drivers/usb/gadget/configfs.c +1 −0
  370. drivers/usb/gadget/function/f_fs.c +15 −15
  371. drivers/usb/gadget/function/f_printer.c +0 −8
  372. drivers/usb/gadget/function/f_tcm.c +11 −9
  373. drivers/usb/gadget/function/f_uac2.c +1 −12
  374. drivers/usb/gadget/function/storage_common.c +1 −3
  375. drivers/usb/gadget/legacy/inode.c +13 −4
  376. drivers/usb/gadget/udc/udc-core.c +8 −4
  377. drivers/usb/host/ehci-hcd.c +9 −0
  378. drivers/usb/host/ehci-hub.c +11 −3
  379. drivers/usb/host/ehci-msm.c +12 −2
  380. drivers/usb/host/ehci-tegra.c +13 −3
  381. drivers/usb/host/ohci-q.c +2 −1
  382. drivers/usb/host/xhci-pci.c +5 −0
  383. drivers/usb/host/xhci-plat.c +3 −0
  384. drivers/usb/host/xhci-ring.c +24 −6
  385. drivers/usb/host/xhci.c +16 −13
  386. drivers/usb/musb/musb_core.c +37 −48
  387. drivers/usb/musb/musb_core.h +2 −1
  388. drivers/usb/musb/musb_gadget.c +23 −11
  389. drivers/usb/musb/musb_host.c +37 −31
  390. drivers/usb/musb/omap2430.c +89 −168
  391. drivers/usb/musb/sunxi.c +34 −20
  392. drivers/usb/phy/phy-twl6030-usb.c +24 −5
  393. drivers/usb/serial/mos7720.c +1 −0
  394. drivers/usb/storage/uas.c +1 −1
  395. drivers/usb/usbip/vhci_hcd.c +1 −1
  396. drivers/watchdog/Kconfig +1 −1
  397. fs/binfmt_elf.c +1 −1
  398. fs/binfmt_elf_fdpic.c +1 −1
  399. fs/btrfs/check-integrity.c +1 −1
  400. fs/btrfs/ctree.c +10 −3
  401. fs/btrfs/disk-io.c +32 −22
  402. fs/btrfs/disk-io.h +1 −1
  403. fs/btrfs/extent-tree.c +7 −5
  404. fs/btrfs/extent_io.c +17 −8
  405. fs/btrfs/extent_io.h +2 −2
  406. fs/btrfs/free-space-cache.c +9 −9
  407. fs/btrfs/hash.c +5 −0
  408. fs/btrfs/hash.h +1 −0
  409. fs/btrfs/inode.c +10 −1
  410. fs/btrfs/super.c +39 −22
  411. fs/btrfs/tests/btrfs-tests.c +3 −3
  412. fs/btrfs/tests/btrfs-tests.h +14 −13
  413. fs/btrfs/tests/extent-buffer-tests.c +7 −6
  414. fs/btrfs/tests/extent-io-tests.c +54 −32
  415. fs/btrfs/tests/free-space-tests.c +46 −30
  416. fs/btrfs/tests/free-space-tree-tests.c +18 −12
  417. fs/btrfs/tests/inode-tests.c +188 −156
  418. fs/btrfs/tests/qgroup-tests.c +64 −47
  419. fs/btrfs/transaction.c +1 −6
  420. fs/btrfs/transaction.h +1 −1
  421. fs/btrfs/tree-log.c +2 −2
  422. fs/btrfs/volumes.c +96 −17
  423. fs/coredump.c +3 −1
  424. fs/dcache.c +2 −2
  425. fs/debugfs/file.c +4 −3
  426. fs/ecryptfs/kthread.c +11 −2
  427. fs/namei.c +15 −46
  428. fs/namespace.c +4 −2
  429. fs/nfsd/blocklayout.c +1 −1
  430. fs/nfsd/nfs4callback.c +1 −17
  431. fs/nfsd/nfs4state.c +37 −30
  432. fs/nfsd/state.h +1 −1
  433. fs/overlayfs/dir.c +11 −2
  434. fs/overlayfs/inode.c +6 −20
  435. fs/proc/root.c +7 −0
  436. fs/reiserfs/super.c +7 −2
  437. fs/udf/partition.c +9 −4
  438. fs/udf/super.c +12 −10
  439. fs/udf/udf_sb.h +5 −0
  440. include/asm-generic/qspinlock.h +17 −36
  441. include/linux/binfmts.h +1 −0
  442. include/linux/clk-provider.h +1 −1
  443. include/linux/cpuidle.h +3 −0
  444. include/linux/dcache.h +12 −0
  445. include/linux/efi.h +1 −1
  446. include/linux/iio/common/st_sensors.h +8 −1
  447. include/linux/isa.h +3 −2
  448. include/linux/leds.h +12 −11
  449. include/linux/mlx5/device.h +6 −2
  450. include/linux/mlx5/mlx5_ifc.h +9 −3
  451. include/linux/mlx5/qp.h +3 −3
  452. include/linux/mlx5/vport.h +2 −0
  453. include/linux/of.h +1 −1
  454. include/linux/of_pci.h +1 −1
  455. include/linux/of_reserved_mem.h +7 −0
  456. include/linux/pwm.h +3 −0
  457. include/linux/seqlock.h +5 −2
  458. include/linux/sunrpc/clnt.h +0 −2
  459. include/linux/sunrpc/svc_xprt.h +1 −0
  460. include/linux/sunrpc/xprt.h +1 −0
  461. include/linux/thermal.h +2 −0
  462. include/linux/usb/gadget.h +3 −0
  463. include/linux/usb/musb.h +3 −2
  464. include/media/v4l2-mc.h +1 −1
  465. include/net/compat.h +1 −0
  466. include/net/ip_vs.h +1 −1
  467. include/net/netfilter/nf_queue.h +2 −2
  468. include/net/netns/netfilter.h +2 −0
  469. include/net/pkt_cls.h +7 −3
  470. include/net/sch_generic.h +5 −1
  471. include/rdma/ib_verbs.h +3 −3
  472. include/uapi/linux/btrfs.h +1 −1
  473. include/uapi/linux/gtp.h +1 −1
  474. include/uapi/sound/Kbuild +3 −0
  475. kernel/events/core.c +2 −4
  476. kernel/futex.c +11 −3
  477. kernel/kcov.c +6 −1
  478. kernel/locking/mutex.c +6 −3
  479. kernel/locking/qspinlock.c +60 −0
  480. kernel/relay.c +1 −0
  481. kernel/sched/core.c +23 −6
  482. kernel/sched/debug.c +4 −11
  483. kernel/sched/idle.c +1 −1
  484. kernel/sched/stats.h +3 −0
  485. kernel/trace/bpf_trace.c +2 −2
  486. mm/fadvise.c +11 −0
  487. mm/hugetlb.c +40 −2
  488. mm/kasan/kasan.c +2 −2
  489. mm/memcontrol.c +1 −1
  490. mm/page-writeback.c +12 −9
  491. mm/percpu.c +44 −29
  492. mm/swap.c +19 −1
  493. mm/swap_state.c +4 −1
  494. net/bridge/br_fdb.c +2 −0
  495. net/compat.c +17 −3
  496. net/core/gen_stats.c +2 −0
  497. net/core/net-sysfs.c +1 −0
  498. net/ipv4/udp.c +5 −5
  499. net/ipv6/ip6_gre.c +3 −0
  500. net/ipv6/ip6_output.c +3 −8
  501. net/ipv6/netfilter/nf_dup_ipv6.c +1 −0
  502. net/ipv6/tcp_ipv6.c +3 −1
  503. net/ipv6/udp.c +6 −6
  504. net/l2tp/l2tp_core.c +1 −1
  505. net/mac80211/mesh.c +4 −0
  506. net/mac80211/sta_info.h +1 −1
  507. net/netfilter/ipvs/ip_vs_conn.c +3 −2
  508. net/netfilter/ipvs/ip_vs_core.c +3 −2
  509. net/netfilter/nf_conntrack_ftp.c +1 −0
  510. net/netfilter/nf_conntrack_helper.c +4 −5
  511. net/netfilter/nf_conntrack_irc.c +1 −0
  512. net/netfilter/nf_conntrack_sane.c +1 −0
  513. net/netfilter/nf_conntrack_sip.c +1 −0
  514. net/netfilter/nf_conntrack_standalone.c +0 −2
  515. net/netfilter/nf_conntrack_tftp.c +1 −0
  516. net/netfilter/nf_queue.c +8 −9
  517. net/netfilter/nf_tables_api.c +2 −0
  518. net/netfilter/nfnetlink_queue.c +13 −7
  519. net/netfilter/x_tables.c +2 −2
  520. net/packet/af_packet.c +25 −0
  521. net/rds/rds.h +2 −0
  522. net/rds/recv.c +2 −0
  523. net/rds/send.c +1 −0
  524. net/rds/tcp.c +75 −3
  525. net/rds/tcp.h +1 −0
  526. net/rds/tcp_connect.c +1 −1
  527. net/rds/tcp_listen.c +7 −13
  528. net/rds/threads.c +8 −2
  529. net/rxrpc/rxkad.c +1 −3
  530. net/sched/act_police.c +11 −22
  531. net/sched/cls_flower.c +3 −3
  532. net/sched/cls_u32.c +40 −32
  533. net/sched/sch_drr.c +4 −0
  534. net/sched/sch_fq_codel.c +19 −7
  535. net/sched/sch_generic.c +2 −0
  536. net/sched/sch_hfsc.c +4 −8
  537. net/sched/sch_ingress.c +12 −0
  538. net/sched/sch_prio.c +4 −0
  539. net/sched/sch_qfq.c +4 −2
  540. net/sched/sch_red.c +4 −0
  541. net/sched/sch_tbf.c +4 −0
  542. net/sunrpc/clnt.c +25 −6
  543. net/sunrpc/svc_xprt.c +2 −0
  544. net/sunrpc/xprtsock.c +1 −0
  545. net/tipc/netlink_compat.c +2 −1
  546. net/unix/af_unix.c +3 −3
  547. net/wireless/core.c +0 −2
  548. net/wireless/wext-core.c +23 −2
  549. scripts/mod/file2alias.c +1 −1
  550. security/keys/key.c +1 −1
  551. sound/pci/hda/hda_intel.c +10 −1
  552. sound/pci/hda/patch_realtek.c +68 −5
  553. tools/perf/util/data-convert-bt.c +39 −2
  554. tools/perf/util/event.c +2 −0
  555. tools/perf/util/symbol.c +8 −8
  556. tools/testing/selftests/net/reuseport_bpf.c +5 −5
  557. tools/virtio/ringtest/Makefile +3 −1
  558. tools/virtio/ringtest/README +4 −0
  559. tools/virtio/ringtest/noring.c +69 −0
  560. tools/virtio/ringtest/run-on-all.sh +2 −2
  561. virt/kvm/kvm_main.c +1 −1
.mailmap+2−0
@@ -89,6 +89,7 @@ Leonid I Ananiev <leonid.i.ananiev@intel.com> · 88 unmodified lines
8989 Linas Vepstas <linas@austin.ibm.com>
9090 Mark Brown <broonie@sirena.org.uk>
9191 Matthieu CASTET <castet.matthieu@free.fr>
92+Mauro Carvalho Chehab <mchehab@kernel.org> <maurochehab@gmail.com> <mchehab@infradead.org> <mchehab@redhat.com> <m.chehab@samsung.com> <mchehab@osg.samsung.com> <mchehab@s-opensource.com>
9293 Mayuresh Janorkar <mayur@ti.com>
9394 Michael Buesch <m@bues.ch>
9495 Michel Dänzer <michel@tungstengraphics.com>
@@ -122,6 +123,7 @@ Santosh Shilimkar <santosh.shilimkar@oracle.org> · 27 unmodified lines
122123 Sascha Hauer <s.hauer@pengutronix.de>
123124 S.Çağlar Onur <caglar@pardus.org.tr>
124125 Shiraz Hashim <shiraz.linux.kernel@gmail.com> <shiraz.hashim@st.com>
126+Shuah Khan <shuah@kernel.org> <shuahkhan@gmail.com> <shuah.khan@hp.com> <shuahkh@osg.samsung.com> <shuah.kh@samsung.com>
125127 Simon Kelley <simon@thekelleys.org.uk>
126128 Stéphane Witzmann <stephane.witzmann@ubpmes.univ-bpclermont.fr>
127129 Stephen Hemminger <shemminger@osdl.org>
CREDITS+1−0
@@ -649,6 +649,7 @@ D: Configure, Menuconfig, xconfig · 648 unmodified lines
649649
650650 N: Mauro Carvalho Chehab
651651 E: m.chehab@samsung.org
652+E: mchehab@osg.samsung.com
652653 E: mchehab@infradead.org
653654 D: Media subsystem (V4L/DVB) drivers and core
654655 D: EDAC drivers and EDAC 3.0 core rework
Documentation/ABI/testing/configfs-usb-gadget-uvc+29−29
@@ -1,6 +1,6 @@
11 What: /config/usb-gadget/gadget/functions/uvc.name
22 Date: Dec 2014
3−KernelVersion: 3.20
3+KernelVersion: 4.0
44 Description: UVC function directory
55
66 streaming_maxburst - 0..15 (ss only)
@@ -9,37 +9,37 @@ Description: UVC function directory · 2 unmodified lines
99
1010 What: /config/usb-gadget/gadget/functions/uvc.name/control
1111 Date: Dec 2014
12−KernelVersion: 3.20
12+KernelVersion: 4.0
1313 Description: Control descriptors
1414
1515 What: /config/usb-gadget/gadget/functions/uvc.name/control/class
1616 Date: Dec 2014
17−KernelVersion: 3.20
17+KernelVersion: 4.0
1818 Description: Class descriptors
1919
2020 What: /config/usb-gadget/gadget/functions/uvc.name/control/class/ss
2121 Date: Dec 2014
22−KernelVersion: 3.20
22+KernelVersion: 4.0
2323 Description: Super speed control class descriptors
2424
2525 What: /config/usb-gadget/gadget/functions/uvc.name/control/class/fs
2626 Date: Dec 2014
27−KernelVersion: 3.20
27+KernelVersion: 4.0
2828 Description: Full speed control class descriptors
2929
3030 What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal
3131 Date: Dec 2014
32−KernelVersion: 3.20
32+KernelVersion: 4.0
3333 Description: Terminal descriptors
3434
3535 What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/output
3636 Date: Dec 2014
37−KernelVersion: 3.20
37+KernelVersion: 4.0
3838 Description: Output terminal descriptors
3939
4040 What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/output/default
4141 Date: Dec 2014
42−KernelVersion: 3.20
42+KernelVersion: 4.0
4343 Description: Default output terminal descriptors
4444
4545 All attributes read only:
@@ -53,12 +53,12 @@ Description: Default output terminal descriptors · 7 unmodified lines
5353
5454 What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/camera
5555 Date: Dec 2014
56−KernelVersion: 3.20
56+KernelVersion: 4.0
5757 Description: Camera terminal descriptors
5858
5959 What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/camera/default
6060 Date: Dec 2014
61−KernelVersion: 3.20
61+KernelVersion: 4.0
6262 Description: Default camera terminal descriptors
6363
6464 All attributes read only:
@@ -75,12 +75,12 @@ Description: Default camera terminal descriptors · 10 unmodified lines
7575
7676 What: /config/usb-gadget/gadget/functions/uvc.name/control/processing
7777 Date: Dec 2014
78−KernelVersion: 3.20
78+KernelVersion: 4.0
7979 Description: Processing unit descriptors
8080
8181 What: /config/usb-gadget/gadget/functions/uvc.name/control/processing/default
8282 Date: Dec 2014
83−KernelVersion: 3.20
83+KernelVersion: 4.0
8484 Description: Default processing unit descriptors
8585
8686 All attributes read only:
@@ -94,49 +94,49 @@ Description: Default processing unit descriptors · 7 unmodified lines
9494
9595 What: /config/usb-gadget/gadget/functions/uvc.name/control/header
9696 Date: Dec 2014
97−KernelVersion: 3.20
97+KernelVersion: 4.0
9898 Description: Control header descriptors
9999
100100 What: /config/usb-gadget/gadget/functions/uvc.name/control/header/name
101101 Date: Dec 2014
102−KernelVersion: 3.20
102+KernelVersion: 4.0
103103 Description: Specific control header descriptors
104104
105105 dwClockFrequency
106106 bcdUVC
107107 What: /config/usb-gadget/gadget/functions/uvc.name/streaming
108108 Date: Dec 2014
109−KernelVersion: 3.20
109+KernelVersion: 4.0
110110 Description: Streaming descriptors
111111
112112 What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class
113113 Date: Dec 2014
114−KernelVersion: 3.20
114+KernelVersion: 4.0
115115 Description: Streaming class descriptors
116116
117117 What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class/ss
118118 Date: Dec 2014
119−KernelVersion: 3.20
119+KernelVersion: 4.0
120120 Description: Super speed streaming class descriptors
121121
122122 What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class/hs
123123 Date: Dec 2014
124−KernelVersion: 3.20
124+KernelVersion: 4.0
125125 Description: High speed streaming class descriptors
126126
127127 What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class/fs
128128 Date: Dec 2014
129−KernelVersion: 3.20
129+KernelVersion: 4.0
130130 Description: Full speed streaming class descriptors
131131
132132 What: /config/usb-gadget/gadget/functions/uvc.name/streaming/color_matching
133133 Date: Dec 2014
134−KernelVersion: 3.20
134+KernelVersion: 4.0
135135 Description: Color matching descriptors
136136
137137 What: /config/usb-gadget/gadget/functions/uvc.name/streaming/color_matching/default
138138 Date: Dec 2014
139−KernelVersion: 3.20
139+KernelVersion: 4.0
140140 Description: Default color matching descriptors
141141
142142 All attributes read only:
@@ -150,12 +150,12 @@ Description: Default color matching descriptors · 7 unmodified lines
150150
151151 What: /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg
152152 Date: Dec 2014
153−KernelVersion: 3.20
153+KernelVersion: 4.0
154154 Description: MJPEG format descriptors
155155
156156 What: /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg/name
157157 Date: Dec 2014
158−KernelVersion: 3.20
158+KernelVersion: 4.0
159159 Description: Specific MJPEG format descriptors
160160
161161 All attributes read only,
@@ -174,7 +174,7 @@ Description: Specific MJPEG format descriptors · 12 unmodified lines
174174
175175 What: /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg/name/name
176176 Date: Dec 2014
177−KernelVersion: 3.20
177+KernelVersion: 4.0
178178 Description: Specific MJPEG frame descriptors
179179
180180 dwFrameInterval - indicates how frame interval can be
@@ -196,12 +196,12 @@ Description: Specific MJPEG frame descriptors · 15 unmodified lines
196196
197197 What: /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed
198198 Date: Dec 2014
199−KernelVersion: 3.20
199+KernelVersion: 4.0
200200 Description: Uncompressed format descriptors
201201
202202 What: /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed/name
203203 Date: Dec 2014
204−KernelVersion: 3.20
204+KernelVersion: 4.0
205205 Description: Specific uncompressed format descriptors
206206
207207 bmaControls - this format's data for bmaControls in
@@ -221,7 +221,7 @@ Description: Specific uncompressed format descriptors · 13 unmodified lines
221221
222222 What: /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed/name/name
223223 Date: Dec 2014
224−KernelVersion: 3.20
224+KernelVersion: 4.0
225225 Description: Specific uncompressed frame descriptors
226226
227227 dwFrameInterval - indicates how frame interval can be
@@ -243,12 +243,12 @@ Description: Specific uncompressed frame descriptors · 15 unmodified lines
243243
244244 What: /config/usb-gadget/gadget/functions/uvc.name/streaming/header
245245 Date: Dec 2014
246−KernelVersion: 3.20
246+KernelVersion: 4.0
247247 Description: Streaming header descriptors
248248
249249 What: /config/usb-gadget/gadget/functions/uvc.name/streaming/header/name
250250 Date: Dec 2014
251−KernelVersion: 3.20
251+KernelVersion: 4.0
252252 Description: Specific streaming header descriptors
253253
254254 All attributes read only:
Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935+1−1
@@ -1,4 +1,4 @@
1−What /sys/bus/iio/devices/iio:deviceX/in_proximity_raw
1+What /sys/bus/iio/devices/iio:deviceX/in_proximity_input
22 Date: March 2014
33 KernelVersion: 3.15
44 Contact: Matt Ranostay <mranostay@gmail.com>
Documentation/devicetree/bindings/hwmon/ina2xx.txt+1−0
@@ -7,6 +7,7 @@ Required properties: · 6 unmodified lines
77 - "ti,ina220" for ina220
88 - "ti,ina226" for ina226
99 - "ti,ina230" for ina230
10+ - "ti,ina231" for ina231
1011 - reg: I2C address
1112
1213 Optional properties:
Documentation/devicetree/bindings/i2c/i2c-arb-gpio-challenge.txt+2−2
@@ -44,8 +44,8 @@ Required properties: · 43 unmodified lines
4444 - our-claim-gpio: The GPIO that we use to claim the bus.
4545 - their-claim-gpios: The GPIOs that the other sides use to claim the bus.
4646 Note that some implementations may only support a single other master.
47−- Standard I2C mux properties. See mux.txt in this directory.
48−- Single I2C child bus node at reg 0. See mux.txt in this directory.
47+- Standard I2C mux properties. See i2c-mux.txt in this directory.
48+- Single I2C child bus node at reg 0. See i2c-mux.txt in this directory.
4949
5050 Optional properties:
5151 - slew-delay-us: microseconds to wait for a GPIO to go high. Default is 10 us.
Documentation/devicetree/bindings/i2c/i2c-demux-pinctrl.txt+2−1
@@ -27,7 +27,8 @@ Required properties: · 26 unmodified lines
2727 - i2c-bus-name: The name of this bus. Also needed as pinctrl-name for the I2C
2828 parents.
2929
30−Furthermore, I2C mux properties and child nodes. See mux.txt in this directory.
30+Furthermore, I2C mux properties and child nodes. See i2c-mux.txt in this
31+directory.
3132
3233 Example:
3334
Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt+3−3
@@ -22,8 +22,8 @@ Required properties: · 21 unmodified lines
2222 - i2c-parent: The phandle of the I2C bus that this multiplexer's master-side
2323 port is connected to.
2424 - mux-gpios: list of gpios used to control the muxer
25−* Standard I2C mux properties. See mux.txt in this directory.
26−* I2C child bus nodes. See mux.txt in this directory.
25+* Standard I2C mux properties. See i2c-mux.txt in this directory.
26+* I2C child bus nodes. See i2c-mux.txt in this directory.
2727
2828 Optional properties:
2929 - idle-state: value to set the muxer to when idle. When no value is
@@ -33,7 +33,7 @@ For each i2c child node, an I2C child bus will be created. They will · 3 unmodified lines
3333 be numbered based on their order in the device tree.
3434
3535 Whenever an access is made to a device on a child bus, the value set
36−in the revelant node's reg property will be output using the list of
36+in the relevant node's reg property will be output using the list of
3737 GPIOs, the first in the list holding the least-significant value.
3838
3939 If an idle state is defined, using the idle-state (optional) property,
Documentation/devicetree/bindings/i2c/i2c-mux-pinctrl.txt+2−2
@@ -28,9 +28,9 @@ Also required are: · 27 unmodified lines
2828 * Standard pinctrl properties that specify the pin mux state for each child
2929 bus. See ../pinctrl/pinctrl-bindings.txt.
3030
31−* Standard I2C mux properties. See mux.txt in this directory.
31+* Standard I2C mux properties. See i2c-mux.txt in this directory.
3232
33−* I2C child bus nodes. See mux.txt in this directory.
33+* I2C child bus nodes. See i2c-mux.txt in this directory.
3434
3535 For each named state defined in the pinctrl-names property, an I2C child bus
3636 will be created. I2C child bus numbers are assigned based on the index into
Documentation/devicetree/bindings/i2c/i2c-mux-reg.txt+3−3
@@ -7,8 +7,8 @@ Required properties: · 6 unmodified lines
77 - compatible: i2c-mux-reg
88 - i2c-parent: The phandle of the I2C bus that this multiplexer's master-side
99 port is connected to.
10−* Standard I2C mux properties. See mux.txt in this directory.
11−* I2C child bus nodes. See mux.txt in this directory.
10+* Standard I2C mux properties. See i2c-mux.txt in this directory.
11+* I2C child bus nodes. See i2c-mux.txt in this directory.
1212
1313 Optional properties:
1414 - reg: this pair of <offset size> specifies the register to control the mux.
@@ -24,7 +24,7 @@ Optional properties: · 9 unmodified lines
2424 given, it defaults to the last value used.
2525
2626 Whenever an access is made to a device on a child bus, the value set
27−in the revelant node's reg property will be output to the register.
27+in the relevant node's reg property will be output to the register.
2828
2929 If an idle state is defined, using the idle-state (optional) property,
3030 whenever an access is not being made to a device on a child bus, the
Documentation/devicetree/bindings/net/marvell-bt-sd8xxx.txt+4−4
@@ -13,10 +13,10 @@ Optional properties: · 12 unmodified lines
1313 initialization. This is an array of 28 values(u8).
1414
1515 - marvell,wakeup-pin: It represents wakeup pin number of the bluetooth chip.
16− firmware will use the pin to wakeup host system.
16+ firmware will use the pin to wakeup host system (u16).
1717 - marvell,wakeup-gap-ms: wakeup gap represents wakeup latency of the host
1818 platform. The value will be configured to firmware. This
19− is needed to work chip's sleep feature as expected.
19+ is needed to work chip's sleep feature as expected (u16).
2020 - interrupt-parent: phandle of the parent interrupt controller
2121 - interrupts : interrupt pin number to the cpu. Driver will request an irq based
2222 on this interrupt number. During system suspend, the irq will be
@@ -50,7 +50,7 @@ calibration data is also available in below example. · 27 unmodified lines
5050 0x37 0x01 0x1c 0x00 0xff 0xff 0xff 0xff 0x01 0x7f 0x04 0x02
5151 0x00 0x00 0xba 0xce 0xc0 0xc6 0x2d 0x00 0x00 0x00 0x00 0x00
5252 0x00 0x00 0xf0 0x00>;
53− marvell,wakeup-pin = <0x0d>;
54− marvell,wakeup-gap-ms = <0x64>;
53+ marvell,wakeup-pin = /bits/ 16 <0x0d>;
54+ marvell,wakeup-gap-ms = /bits/ 16 <0x64>;
5555 };
5656 };
Documentation/devicetree/bindings/vendor-prefixes.txt+2−0
@@ -255,6 +255,7 @@ synology Synology, Inc. · 254 unmodified lines
255255 SUNW Sun Microsystems, Inc
256256 tbs TBS Technologies
257257 tcl Toby Churchill Ltd.
258+technexion TechNexion
258259 technologic Technologic Systems
259260 thine THine Electronics, Inc.
260261 ti Texas Instruments
@@ -269,6 +270,7 @@ tronsmart Tronsmart · 8 unmodified lines
269270 truly Truly Semiconductors Limited
270271 tyan Tyan Computer Corporation
271272 upisemi uPI Semiconductor Corp.
273+uniwest United Western Technologies Corp (UniWest)
272274 urt United Radiant Technology Corporation
273275 usi Universal Scientific Industrial Co., Ltd.
274276 v3 V3 Semiconductor
Documentation/leds/leds-class.txt+2−2
@@ -74,8 +74,8 @@ blink_set() function (see <linux/leds.h>). To set an LED to blinking, · 73 unmodified lines
7474 however, it is better to use the API function led_blink_set(), as it
7575 will check and implement software fallback if necessary.
7676
77−To turn off blinking again, use the API function led_brightness_set()
78−as that will not just set the LED brightness but also stop any software
77+To turn off blinking, use the API function led_brightness_set()
78+with brightness value LED_OFF, which should stop any software
7979 timers that may have been required for blinking.
8080
8181 The blink_set() function should choose a user friendly blinking value
MAINTAINERS+45−23
@@ -1159,6 +1159,7 @@ F: arch/arm/mach-footbridge/ · 1158 unmodified lines
11591159 ARM/FREESCALE IMX / MXC ARM ARCHITECTURE
11601160 M: Shawn Guo <shawnguo@kernel.org>
11611161 M: Sascha Hauer <kernel@pengutronix.de>
1162+R: Fabio Estevam <fabio.estevam@nxp.com>
11621163 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
11631164 S: Maintained
11641165 T: git git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git
@@ -2242,7 +2243,8 @@ F: include/net/ax25.h · 1077 unmodified lines
22422243 F: net/ax25/
22432244
22442245 AZ6007 DVB DRIVER
2245−M: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2246+M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2247+M: Mauro Carvalho Chehab <mchehab@kernel.org>
22462248 L: linux-media@vger.kernel.org
22472249 W: https://linuxtv.org
22482250 T: git git://linuxtv.org/media_tree.git
@@ -2709,7 +2711,8 @@ F: Documentation/filesystems/btrfs.txt · 460 unmodified lines
27092711 F: fs/btrfs/
27102712
27112713 BTTV VIDEO4LINUX DRIVER
2712−M: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2714+M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2715+M: Mauro Carvalho Chehab <mchehab@kernel.org>
27132716 L: linux-media@vger.kernel.org
27142717 W: https://linuxtv.org
27152718 T: git git://linuxtv.org/media_tree.git
@@ -3086,6 +3089,7 @@ M: Stephen Boyd <sboyd@codeaurora.org> · 370 unmodified lines
30863089 L: linux-clk@vger.kernel.org
30873090 T: git git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git
30883091 S: Maintained
3092+F: Documentation/devicetree/bindings/clock/
30893093 F: drivers/clk/
30903094 X: drivers/clk/clkdev.c
30913095 F: include/linux/clk-pr*
@@ -3343,7 +3347,8 @@ S: Maintained · 251 unmodified lines
33433347 F: drivers/media/dvb-frontends/cx24120*
33443348
33453349 CX88 VIDEO4LINUX DRIVER
3346−M: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
3350+M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
3351+M: Mauro Carvalho Chehab <mchehab@kernel.org>
33473352 L: linux-media@vger.kernel.org
33483353 W: https://linuxtv.org
33493354 T: git git://linuxtv.org/media_tree.git
@@ -3773,6 +3778,7 @@ Q: https://patchwork.kernel.org/project/linux-dmaengine/list/ · 423 unmodified lines
37733778 S: Maintained
37743779 F: drivers/dma/
37753780 F: include/linux/dmaengine.h
3781+F: Documentation/devicetree/bindings/dma/
37763782 F: Documentation/dmaengine/
37773783 T: git git://git.infradead.org/users/vkoul/slave-dma.git
37783784
@@ -4290,7 +4296,8 @@ F: fs/ecryptfs/ · 511 unmodified lines
42904296 EDAC-CORE
42914297 M: Doug Thompson <dougthompson@xmission.com>
42924298 M: Borislav Petkov <bp@alien8.de>
4293−M: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
4299+M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
4300+M: Mauro Carvalho Chehab <mchehab@kernel.org>
42944301 L: linux-edac@vger.kernel.org
42954302 T: git git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git for-next
42964303 T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-edac.git linux_next
@@ -4335,7 +4342,8 @@ S: Maintained · 38 unmodified lines
43354342 F: drivers/edac/e7xxx_edac.c
43364343
43374344 EDAC-GHES
4338−M: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
4345+M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
4346+M: Mauro Carvalho Chehab <mchehab@kernel.org>
43394347 L: linux-edac@vger.kernel.org
43404348 S: Maintained
43414349 F: drivers/edac/ghes_edac.c
@@ -4359,19 +4367,22 @@ S: Maintained · 17 unmodified lines
43594367 F: drivers/edac/i5000_edac.c
43604368
43614369 EDAC-I5400
4362−M: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
4370+M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
4371+M: Mauro Carvalho Chehab <mchehab@kernel.org>
43634372 L: linux-edac@vger.kernel.org
43644373 S: Maintained
43654374 F: drivers/edac/i5400_edac.c
43664375
43674376 EDAC-I7300
4368−M: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
4377+M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
4378+M: Mauro Carvalho Chehab <mchehab@kernel.org>
43694379 L: linux-edac@vger.kernel.org
43704380 S: Maintained
43714381 F: drivers/edac/i7300_edac.c
43724382
43734383 EDAC-I7CORE
4374−M: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
4384+M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
4385+M: Mauro Carvalho Chehab <mchehab@kernel.org>
43754386 L: linux-edac@vger.kernel.org
43764387 S: Maintained
43774388 F: drivers/edac/i7core_edac.c
@@ -4408,7 +4419,8 @@ S: Maintained · 30 unmodified lines
44084419 F: drivers/edac/r82600_edac.c
44094420
44104421 EDAC-SBRIDGE
4411−M: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
4422+M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
4423+M: Mauro Carvalho Chehab <mchehab@kernel.org>
44124424 L: linux-edac@vger.kernel.org
44134425 S: Maintained
44144426 F: drivers/edac/sb_edac.c
@@ -4467,7 +4479,8 @@ S: Maintained · 52 unmodified lines
44674479 F: drivers/net/ethernet/ibm/ehea/
44684480
44694481 EM28XX VIDEO4LINUX DRIVER
4470−M: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
4482+M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
4483+M: Mauro Carvalho Chehab <mchehab@kernel.org>
44714484 L: linux-media@vger.kernel.org
44724485 W: https://linuxtv.org
44734486 T: git git://linuxtv.org/media_tree.git
@@ -6487,6 +6500,7 @@ F: include/uapi/linux/sunrpc/ · 2013 unmodified lines
64876500
64886501 KERNEL SELFTEST FRAMEWORK
64896502 M: Shuah Khan <shuahkh@osg.samsung.com>
6503+M: Shuah Khan <shuah@kernel.org>
64906504 L: linux-kselftest@vger.kernel.org
64916505 T: git git://git.kernel.org/pub/scm/shuah/linux-kselftest
64926506 S: Maintained
@@ -7358,7 +7372,8 @@ S: Supported · 865 unmodified lines
73587372 F: drivers/media/pci/netup_unidvb/*
73597373
73607374 MEDIA INPUT INFRASTRUCTURE (V4L/DVB)
7361−M: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
7375+M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
7376+M: Mauro Carvalho Chehab <mchehab@kernel.org>
73627377 P: LinuxTV.org Project
73637378 L: linux-media@vger.kernel.org
73647379 W: https://linuxtv.org
@@ -8009,6 +8024,7 @@ Q: http://patchwork.kernel.org/project/linux-wireless/list/ · 644 unmodified lines
80098024 T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git
80108025 T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git
80118026 S: Maintained
8027+F: Documentation/devicetree/bindings/net/wireless/
80128028 F: drivers/net/wireless/
80138029
80148030 NETXEN (1/10) GbE SUPPORT
@@ -8406,10 +8422,9 @@ F: drivers/i2c/busses/i2c-ocores.c · 391 unmodified lines
84068422 OPEN FIRMWARE AND FLATTENED DEVICE TREE
84078423 M: Rob Herring <robh+dt@kernel.org>
84088424 M: Frank Rowand <frowand.list@gmail.com>
8409−M: Grant Likely <grant.likely@linaro.org>
84108425 L: devicetree@vger.kernel.org
84118426 W: http://www.devicetree.org/
8412−T: git git://git.kernel.org/pub/scm/linux/kernel/git/glikely/linux.git
8427+T: git git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git
84138428 S: Maintained
84148429 F: drivers/of/
84158430 F: include/linux/of*.h
@@ -8417,12 +8432,10 @@ F: scripts/dtc/ · 1 unmodified line
84178432
84188433 OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS
84198434 M: Rob Herring <robh+dt@kernel.org>
8420−M: Pawel Moll <pawel.moll@arm.com>
84218435 M: Mark Rutland <mark.rutland@arm.com>
8422−M: Ian Campbell <ijc+devicetree@hellion.org.uk>
8423−M: Kumar Gala <galak@codeaurora.org>
84248436 L: devicetree@vger.kernel.org
84258437 T: git git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git
8438+Q: http://patchwork.ozlabs.org/project/devicetree-bindings/list/
84268439 S: Maintained
84278440 F: Documentation/devicetree/
84288441 F: arch/*/boot/dts/
@@ -9854,7 +9867,8 @@ S: Odd Fixes · 1425 unmodified lines
98549867 F: drivers/media/i2c/saa6588*
98559868
98569869 SAA7134 VIDEO4LINUX DRIVER
9857−M: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9870+M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
9871+M: Mauro Carvalho Chehab <mchehab@kernel.org>
98589872 L: linux-media@vger.kernel.org
98599873 W: https://linuxtv.org
98609874 T: git git://linuxtv.org/media_tree.git
@@ -10373,7 +10387,8 @@ S: Maintained · 512 unmodified lines
1037310387 F: drivers/media/radio/si4713/radio-usb-si4713.c
1037410388
1037510389 SIANO DVB DRIVER
10376−M: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
10390+M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
10391+M: Mauro Carvalho Chehab <mchehab@kernel.org>
1037710392 L: linux-media@vger.kernel.org
1037810393 W: https://linuxtv.org
1037910394 T: git git://linuxtv.org/media_tree.git
@@ -11140,7 +11155,8 @@ S: Maintained · 760 unmodified lines
1114011155 F: drivers/media/i2c/tda9840*
1114111156
1114211157 TEA5761 TUNER DRIVER
11143−M: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
11158+M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
11159+M: Mauro Carvalho Chehab <mchehab@kernel.org>
1114411160 L: linux-media@vger.kernel.org
1114511161 W: https://linuxtv.org
1114611162 T: git git://linuxtv.org/media_tree.git
@@ -11148,7 +11164,8 @@ S: Odd fixes · 1 unmodified line
1114811164 F: drivers/media/tuners/tea5761.*
1114911165
1115011166 TEA5767 TUNER DRIVER
11151−M: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
11167+M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
11168+M: Mauro Carvalho Chehab <mchehab@kernel.org>
1115211169 L: linux-media@vger.kernel.org
1115311170 W: https://linuxtv.org
1115411171 T: git git://linuxtv.org/media_tree.git
@@ -11535,7 +11552,8 @@ F: include/linux/shmem_fs.h · 380 unmodified lines
1153511552 F: mm/shmem.c
1153611553
1153711554 TM6000 VIDEO4LINUX DRIVER
11538−M: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
11555+M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
11556+M: Mauro Carvalho Chehab <mchehab@kernel.org>
1153911557 L: linux-media@vger.kernel.org
1154011558 W: https://linuxtv.org
1154111559 T: git git://linuxtv.org/media_tree.git
@@ -11889,7 +11907,8 @@ F: drivers/usb/common/usb-otg-fsm.c · 347 unmodified lines
1188911907
1189011908 USB OVER IP DRIVER
1189111909 M: Valentina Manea <valentina.manea.m@gmail.com>
11892−M: Shuah Khan <shuah.kh@samsung.com>
11910+M: Shuah Khan <shuahkh@osg.samsung.com>
11911+M: Shuah Khan <shuah@kernel.org>
1189311912 L: linux-usb@vger.kernel.org
1189411913 S: Maintained
1189511914 F: Documentation/usb/usbip_protocol.txt
@@ -11960,6 +11979,7 @@ L: linux-usb@vger.kernel.org · 64 unmodified lines
1196011979 W: http://www.linux-usb.org
1196111980 T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
1196211981 S: Supported
11982+F: Documentation/devicetree/bindings/usb/
1196311983 F: Documentation/usb/
1196411984 F: drivers/usb/
1196511985 F: include/linux/usb.h
@@ -12133,6 +12153,7 @@ VIRTIO CORE, NET AND BLOCK DRIVERS · 167 unmodified lines
1213312153 M: "Michael S. Tsirkin" <mst@redhat.com>
1213412154 L: virtualization@lists.linux-foundation.org
1213512155 S: Maintained
12156+F: Documentation/devicetree/bindings/virtio/
1213612157 F: drivers/virtio/
1213712158 F: tools/virtio/
1213812159 F: drivers/net/virtio_net.c
@@ -12521,7 +12542,8 @@ S: Maintained · 382 unmodified lines
1252112542 F: arch/x86/entry/vdso/
1252212543
1252312544 XC2028/3028 TUNER DRIVER
12524−M: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
12545+M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
12546+M: Mauro Carvalho Chehab <mchehab@kernel.org>
1252512547 L: linux-media@vger.kernel.org
1252612548 W: https://linuxtv.org
1252712549 T: git git://linuxtv.org/media_tree.git
Makefile+1−1
@@ -1,7 +1,7 @@
11 VERSION = 4
22 PATCHLEVEL = 7
33 SUBLEVEL = 0
4−EXTRAVERSION = -rc2
4+EXTRAVERSION = -rc4
55 NAME = Psychotic Stoned Sheep
66
77 # *DOCUMENTATION*
arch/Kconfig+3−0
@@ -606,6 +606,9 @@ config HAVE_ARCH_HASH · 605 unmodified lines
606606 file which provides platform-specific implementations of some
607607 functions in <linux/hash.h> or fs/namei.c.
608608
609+config ISA_BUS_API
610+ def_bool ISA
611+
609612 #
610613 # ABI hall of shame
611614 #
arch/arc/Kconfig+4−27
@@ -61,7 +61,7 @@ config RWSEM_GENERIC_SPINLOCK · 60 unmodified lines
6161 def_bool y
6262
6363 config ARCH_DISCONTIGMEM_ENABLE
64− def_bool y
64+ def_bool n
6565
6666 config ARCH_FLATMEM_ENABLE
6767 def_bool y
@@ -186,9 +186,6 @@ if SMP · 118 unmodified lines
186186 config ARC_HAS_COH_CACHES
187187 def_bool n
188188
189−config ARC_HAS_REENTRANT_IRQ_LV2
190− def_bool n
191−
192189 config ARC_MCIP
193190 bool "ARConnect Multicore IP (MCIP) Support "
194191 depends on ISA_ARCV2
@@ -366,25 +363,10 @@ config NODES_SHIFT · 171 unmodified lines
366363 if ISA_ARCOMPACT
367364
368365 config ARC_COMPACT_IRQ_LEVELS
369− bool "ARCompact IRQ Priorities: High(2)/Low(1)"
366+ bool "Setup Timer IRQ as high Priority"
370367 default n
371− # Timer HAS to be high priority, for any other high priority config
372− select ARC_IRQ3_LV2
373368 # if SMP, LV2 enabled ONLY if ARC implementation has LV2 re-entrancy
374− depends on !SMP || ARC_HAS_REENTRANT_IRQ_LV2
375−
376−if ARC_COMPACT_IRQ_LEVELS
377−
378−config ARC_IRQ3_LV2
379− bool
380−
381−config ARC_IRQ5_LV2
382− bool
383−
384−config ARC_IRQ6_LV2
385− bool
386−
387−endif #ARC_COMPACT_IRQ_LEVELS
369+ depends on !SMP
388370
389371 config ARC_FPU_SAVE_RESTORE
390372 bool "Enable FPU state persistence across context switch"
@@ -407,11 +389,6 @@ config ARC_HAS_LLSC · 16 unmodified lines
407389 default y
408390 depends on !ARC_CANT_LLSC
409391
410−config ARC_STAR_9000923308
411− bool "Workaround for llock/scond livelock"
412− default n
413− depends on ISA_ARCV2 && SMP && ARC_HAS_LLSC
414−
415392 config ARC_HAS_SWAPE
416393 bool "Insn: SWAPE (endian-swap)"
417394 default y
@@ -471,7 +448,7 @@ config LINUX_LINK_BASE · 53 unmodified lines
471448
472449 config HIGHMEM
473450 bool "High Memory Support"
474− select DISCONTIGMEM
451+ select ARCH_DISCONTIGMEM_ENABLE
475452 help
476453 With ARC 2G:2G address split, only upper 2G is directly addressable by
477454 kernel. Enable this to potentially allow access to rest of 2G and PAE
arch/arc/Makefile+1−1
@@ -127,7 +127,7 @@ libs-y += arch/arc/lib/ $(LIBGCC) · 126 unmodified lines
127127
128128 boot := arch/arc/boot
129129
130−#default target for make without any arguements.
130+#default target for make without any arguments.
131131 KBUILD_IMAGE := bootpImage
132132
133133 all: $(KBUILD_IMAGE)
arch/arc/boot/dts/abilis_tb100.dtsi+0−2
@@ -23,8 +23,6 @@ · 22 unmodified lines
2323
2424
2525 / {
26− clock-frequency = <500000000>; /* 500 MHZ */
27−
2826 soc100 {
2927 bus-frequency = <166666666>;
3028
arch/arc/boot/dts/abilis_tb101.dtsi+0−2
@@ -23,8 +23,6 @@ · 22 unmodified lines
2323
2424
2525 / {
26− clock-frequency = <500000000>; /* 500 MHZ */
27−
2826 soc100 {
2927 bus-frequency = <166666666>;
3028
arch/arc/boot/dts/axc001.dtsi+0−1
@@ -15,7 +15,6 @@ · 14 unmodified lines
1515
1616 / {
1717 compatible = "snps,arc";
18− clock-frequency = <750000000>; /* 750 MHZ */
1918 #address-cells = <1>;
2019 #size-cells = <1>;
2120
arch/arc/boot/dts/axc003.dtsi+0−1
@@ -14,7 +14,6 @@ · 13 unmodified lines
1414
1515 / {
1616 compatible = "snps,arc";
17− clock-frequency = <90000000>;
1817 #address-cells = <1>;
1918 #size-cells = <1>;
2019
arch/arc/boot/dts/axc003_idu.dtsi+0−1
@@ -14,7 +14,6 @@ · 13 unmodified lines
1414
1515 / {
1616 compatible = "snps,arc";
17− clock-frequency = <90000000>;
1817 #address-cells = <1>;
1918 #size-cells = <1>;
2019
arch/arc/boot/dts/eznps.dts+0−1
@@ -18,7 +18,6 @@ · 17 unmodified lines
1818
1919 / {
2020 compatible = "ezchip,arc-nps";
21− clock-frequency = <83333333>; /* 83.333333 MHZ */
2221 #address-cells = <1>;
2322 #size-cells = <1>;
2423 interrupt-parent = <&intc>;
arch/arc/boot/dts/nsim_700.dts+0−1
@@ -11,7 +11,6 @@ · 10 unmodified lines
1111
1212 / {
1313 compatible = "snps,nsim";
14− clock-frequency = <80000000>; /* 80 MHZ */
1514 #address-cells = <1>;
1615 #size-cells = <1>;
1716 interrupt-parent = <&core_intc>;
arch/arc/boot/dts/nsimosci.dts+0−1
@@ -11,7 +11,6 @@ · 10 unmodified lines
1111
1212 / {
1313 compatible = "snps,nsimosci";
14− clock-frequency = <20000000>; /* 20 MHZ */
1514 #address-cells = <1>;
1615 #size-cells = <1>;
1716 interrupt-parent = <&core_intc>;
arch/arc/boot/dts/nsimosci_hs.dts+0−1
@@ -11,7 +11,6 @@ · 10 unmodified lines
1111
1212 / {
1313 compatible = "snps,nsimosci_hs";
14− clock-frequency = <20000000>; /* 20 MHZ */
1514 #address-cells = <1>;
1615 #size-cells = <1>;
1716 interrupt-parent = <&core_intc>;
arch/arc/boot/dts/nsimosci_hs_idu.dts+0−1
@@ -11,7 +11,6 @@ · 10 unmodified lines
1111
1212 / {
1313 compatible = "snps,nsimosci_hs";
14− clock-frequency = <5000000>; /* 5 MHZ */
1514 #address-cells = <1>;
1615 #size-cells = <1>;
1716 interrupt-parent = <&core_intc>;
arch/arc/boot/dts/skeleton.dtsi+0−1
@@ -13,7 +13,6 @@ · 12 unmodified lines
1313
1414 / {
1515 compatible = "snps,arc";
16− clock-frequency = <80000000>; /* 80 MHZ */
1716 #address-cells = <1>;
1817 #size-cells = <1>;
1918 chosen { };
arch/arc/boot/dts/skeleton_hs.dtsi+0−1
@@ -8,7 +8,6 @@ · 7 unmodified lines
88
99 / {
1010 compatible = "snps,arc";
11− clock-frequency = <80000000>; /* 80 MHZ */
1211 #address-cells = <1>;
1312 #size-cells = <1>;
1413 chosen { };
arch/arc/boot/dts/skeleton_hs_idu.dtsi+0−1
@@ -8,7 +8,6 @@ · 7 unmodified lines
88
99 / {
1010 compatible = "snps,arc";
11− clock-frequency = <80000000>; /* 80 MHZ */
1211 #address-cells = <1>;
1312 #size-cells = <1>;
1413 chosen { };
arch/arc/boot/dts/vdk_axc003.dtsi+0−1
@@ -14,7 +14,6 @@ · 13 unmodified lines
1414
1515 / {
1616 compatible = "snps,arc";
17− clock-frequency = <50000000>;
1817 #address-cells = <1>;
1918 #size-cells = <1>;
2019
arch/arc/boot/dts/vdk_axc003_idu.dtsi+0−1
@@ -15,7 +15,6 @@ · 14 unmodified lines
1515
1616 / {
1717 compatible = "snps,arc";
18− clock-frequency = <50000000>;
1918 #address-cells = <1>;
2019 #size-cells = <1>;
2120
arch/arc/include/asm/atomic.h+4−41
@@ -25,50 +25,17 @@ · 24 unmodified lines
2525
2626 #define atomic_set(v, i) WRITE_ONCE(((v)->counter), (i))
2727
28−#ifdef CONFIG_ARC_STAR_9000923308
29−
30−#define SCOND_FAIL_RETRY_VAR_DEF \
31− unsigned int delay = 1, tmp; \
32−
33−#define SCOND_FAIL_RETRY_ASM \
34− " bz 4f \n" \
35− " ; --- scond fail delay --- \n" \
36− " mov %[tmp], %[delay] \n" /* tmp = delay */ \
37− "2: brne.d %[tmp], 0, 2b \n" /* while (tmp != 0) */ \
38− " sub %[tmp], %[tmp], 1 \n" /* tmp-- */ \
39− " rol %[delay], %[delay] \n" /* delay *= 2 */ \
40− " b 1b \n" /* start over */ \
41− "4: ; --- success --- \n" \
42−
43−#define SCOND_FAIL_RETRY_VARS \
44− ,[delay] "+&r" (delay),[tmp] "=&r" (tmp) \
45−
46−#else /* !CONFIG_ARC_STAR_9000923308 */
47−
48−#define SCOND_FAIL_RETRY_VAR_DEF
49−
50−#define SCOND_FAIL_RETRY_ASM \
51− " bnz 1b \n" \
52−
53−#define SCOND_FAIL_RETRY_VARS
54−
55−#endif
56−
5728 #define ATOMIC_OP(op, c_op, asm_op) \
5829 static inline void atomic_##op(int i, atomic_t *v) \
5930 { \
60− unsigned int val; \
61− SCOND_FAIL_RETRY_VAR_DEF \
31+ unsigned int val; \
6232 \
6333 __asm__ __volatile__( \
6434 "1: llock %[val], [%[ctr]] \n" \
6535 " " #asm_op " %[val], %[val], %[i] \n" \
6636 " scond %[val], [%[ctr]] \n" \
67− " \n" \
68− SCOND_FAIL_RETRY_ASM \
69− \
37+ " bnz 1b \n" \
7038 : [val] "=&r" (val) /* Early clobber to prevent reg reuse */ \
71− SCOND_FAIL_RETRY_VARS \
7239 : [ctr] "r" (&v->counter), /* Not "m": llock only supports reg direct addr mode */ \
7340 [i] "ir" (i) \
7441 : "cc"); \
@@ -77,8 +44,7 @@ static inline void atomic_##op(int i, atomic_t *v) \ · 2 unmodified lines
7744 #define ATOMIC_OP_RETURN(op, c_op, asm_op) \
7845 static inline int atomic_##op##_return(int i, atomic_t *v) \
7946 { \
80− unsigned int val; \
81− SCOND_FAIL_RETRY_VAR_DEF \
47+ unsigned int val; \
8248 \
8349 /* \
8450 * Explicit full memory barrier needed before/after as \
@@ -90,11 +56,8 @@ static inline int atomic_##op##_return(int i, atomic_t *v) \ · 5 unmodified lines
9056 "1: llock %[val], [%[ctr]] \n" \
9157 " " #asm_op " %[val], %[val], %[i] \n" \
9258 " scond %[val], [%[ctr]] \n" \
93− " \n" \
94− SCOND_FAIL_RETRY_ASM \
95− \
59+ " bnz 1b \n" \
9660 : [val] "=&r" (val) \
97− SCOND_FAIL_RETRY_VARS \
9861 : [ctr] "r" (&v->counter), \
9962 [i] "ir" (i) \
10063 : "cc"); \
arch/arc/include/asm/entry-compact.h+2−2
@@ -76,8 +76,8 @@ · 75 unmodified lines
7676 * We need to be a bit more cautious here. What if a kernel bug in
7777 * L1 ISR, caused SP to go whaco (some small value which looks like
7878 * USER stk) and then we take L2 ISR.
79− * Above brlo alone would treat it as a valid L1-L2 sceanrio
80− * instead of shouting alound
79+ * Above brlo alone would treat it as a valid L1-L2 scenario
80+ * instead of shouting around
8181 * The only feasible way is to make sure this L2 happened in
8282 * L1 prelogue ONLY i.e. ilink2 is less than a pre-set marker in
8383 * L1 ISR before it switches stack
arch/arc/include/asm/mmu_context.h+1−1
@@ -83,7 +83,7 @@ static inline void get_new_mmu_context(struct mm_struct *mm) · 82 unmodified lines
8383 local_flush_tlb_all();
8484
8585 /*
86− * Above checke for rollover of 8 bit ASID in 32 bit container.
86+ * Above check for rollover of 8 bit ASID in 32 bit container.
8787 * If the container itself wrapped around, set it to a non zero
8888 * "generation" to distinguish from no context
8989 */
arch/arc/include/asm/pgtable.h+1−1
@@ -47,7 +47,7 @@ · 46 unmodified lines
4747 * Page Tables are purely for Linux VM's consumption and the bits below are
4848 * suited to that (uniqueness). Hence some are not implemented in the TLB and
4949 * some have different value in TLB.
50− * e.g. MMU v2: K_READ bit is 8 and so is GLOBAL (possible becoz they live in
50+ * e.g. MMU v2: K_READ bit is 8 and so is GLOBAL (possible because they live in
5151 * seperate PD0 and PD1, which combined forms a translation entry)
5252 * while for PTE perspective, they are 8 and 9 respectively
5353 * with MMU v3: Most bits (except SHARED) represent the exact hardware pos
arch/arc/include/asm/processor.h+1−1
@@ -78,7 +78,7 @@ struct task_struct; · 77 unmodified lines
7878 #define KSTK_ESP(tsk) (task_pt_regs(tsk)->sp)
7979
8080 /*
81− * Where abouts of Task's sp, fp, blink when it was last seen in kernel mode.
81+ * Where about of Task's sp, fp, blink when it was last seen in kernel mode.
8282 * Look in process.c for details of kernel stack layout
8383 */
8484 #define TSK_K_ESP(tsk) (tsk->thread.ksp)
arch/arc/include/asm/smp.h+1−1
@@ -86,7 +86,7 @@ static inline const char *arc_platform_smp_cpuinfo(void) · 85 unmodified lines
8686 * (1) These insn were introduced only in 4.10 release. So for older released
8787 * support needed.
8888 *
89− * (2) In a SMP setup, the LLOCK/SCOND atomiticity across CPUs needs to be
89+ * (2) In a SMP setup, the LLOCK/SCOND atomicity across CPUs needs to be
9090 * gaurantted by the platform (not something which core handles).
9191 * Assuming a platform won't, SMP Linux needs to use spinlocks + local IRQ
9292 * disabling for atomicity.
arch/arc/include/asm/spinlock.h+0−292
@@ -20,11 +20,6 @@ · 19 unmodified lines
2020
2121 #ifdef CONFIG_ARC_HAS_LLSC
2222
23−/*
24− * A normal LLOCK/SCOND based system, w/o need for livelock workaround
25− */
26−#ifndef CONFIG_ARC_STAR_9000923308
27−
2823 static inline void arch_spin_lock(arch_spinlock_t *lock)
2924 {
3025 unsigned int val;
@@ -238,293 +233,6 @@ static inline void arch_write_unlock(arch_rwlock_t *rw) · 207 unmodified lines
238233 smp_mb();
239234 }
240235
241−#else /* CONFIG_ARC_STAR_9000923308 */
242−
243−/*
244− * HS38x4 could get into a LLOCK/SCOND livelock in case of multiple overlapping
245− * coherency transactions in the SCU. The exclusive line state keeps rotating
246− * among contenting cores leading to a never ending cycle. So break the cycle
247− * by deferring the retry of failed exclusive access (SCOND). The actual delay
248− * needed is function of number of contending cores as well as the unrelated
249− * coherency traffic from other cores. To keep the code simple, start off with
250− * small delay of 1 which would suffice most cases and in case of contention
251− * double the delay. Eventually the delay is sufficient such that the coherency
252− * pipeline is drained, thus a subsequent exclusive access would succeed.
253− */
254−
255−#define SCOND_FAIL_RETRY_VAR_DEF \
256− unsigned int delay, tmp; \
257−
258−#define SCOND_FAIL_RETRY_ASM \
259− " ; --- scond fail delay --- \n" \
260− " mov %[tmp], %[delay] \n" /* tmp = delay */ \
261− "2: brne.d %[tmp], 0, 2b \n" /* while (tmp != 0) */ \
262− " sub %[tmp], %[tmp], 1 \n" /* tmp-- */ \
263− " rol %[delay], %[delay] \n" /* delay *= 2 */ \
264− " b 1b \n" /* start over */ \
265− " \n" \
266− "4: ; --- done --- \n" \
267−
268−#define SCOND_FAIL_RETRY_VARS \
269− ,[delay] "=&r" (delay), [tmp] "=&r" (tmp) \
270−
271−static inline void arch_spin_lock(arch_spinlock_t *lock)
272−{
273− unsigned int val;
274− SCOND_FAIL_RETRY_VAR_DEF;
275−
276− smp_mb();
277−
278− __asm__ __volatile__(
279− "0: mov %[delay], 1 \n"
280− "1: llock %[val], [%[slock]] \n"
281− " breq %[val], %[LOCKED], 0b \n" /* spin while LOCKED */
282− " scond %[LOCKED], [%[slock]] \n" /* acquire */
283− " bz 4f \n" /* done */
284− " \n"
285− SCOND_FAIL_RETRY_ASM
286−
287− : [val] "=&r" (val)
288− SCOND_FAIL_RETRY_VARS
289− : [slock] "r" (&(lock->slock)),
290− [LOCKED] "r" (__ARCH_SPIN_LOCK_LOCKED__)
291− : "memory", "cc");
292−
293− smp_mb();
294−}
295−
296−/* 1 - lock taken successfully */
297−static inline int arch_spin_trylock(arch_spinlock_t *lock)
298−{
299− unsigned int val, got_it = 0;
300− SCOND_FAIL_RETRY_VAR_DEF;
301−
302− smp_mb();
303−
304− __asm__ __volatile__(
305− "0: mov %[delay], 1 \n"
306− "1: llock %[val], [%[slock]] \n"
307− " breq %[val], %[LOCKED], 4f \n" /* already LOCKED, just bail */
308− " scond %[LOCKED], [%[slock]] \n" /* acquire */
309− " bz.d 4f \n"
310− " mov.z %[got_it], 1 \n" /* got it */
311− " \n"
312− SCOND_FAIL_RETRY_ASM
313−
314− : [val] "=&r" (val),
315− [got_it] "+&r" (got_it)
316− SCOND_FAIL_RETRY_VARS
317− : [slock] "r" (&(lock->slock)),
318− [LOCKED] "r" (__ARCH_SPIN_LOCK_LOCKED__)
319− : "memory", "cc");
320−
321− smp_mb();
322−
323− return got_it;
324−}
325−
326−static inline void arch_spin_unlock(arch_spinlock_t *lock)
327−{
328− smp_mb();
329−
330− lock->slock = __ARCH_SPIN_LOCK_UNLOCKED__;
331−
332− smp_mb();
333−}
334−
335−/*
336− * Read-write spinlocks, allowing multiple readers but only one writer.
337− * Unfair locking as Writers could be starved indefinitely by Reader(s)
338− */
339−
340−static inline void arch_read_lock(arch_rwlock_t *rw)
341−{
342− unsigned int val;
343− SCOND_FAIL_RETRY_VAR_DEF;
344−
345− smp_mb();
346−
347− /*
348− * zero means writer holds the lock exclusively, deny Reader.
349− * Otherwise grant lock to first/subseq reader
350− *
351− * if (rw->counter > 0) {
352− * rw->counter--;
353− * ret = 1;
354− * }
355− */
356−
357− __asm__ __volatile__(
358− "0: mov %[delay], 1 \n"
359− "1: llock %[val], [%[rwlock]] \n"
360− " brls %[val], %[WR_LOCKED], 0b\n" /* <= 0: spin while write locked */
361− " sub %[val], %[val], 1 \n" /* reader lock */
362− " scond %[val], [%[rwlock]] \n"
363− " bz 4f \n" /* done */
364− " \n"
365− SCOND_FAIL_RETRY_ASM
366−
367− : [val] "=&r" (val)
368− SCOND_FAIL_RETRY_VARS
369− : [rwlock] "r" (&(rw->counter)),
370− [WR_LOCKED] "ir" (0)
371− : "memory", "cc");
372−
373− smp_mb();
374−}
375−
376−/* 1 - lock taken successfully */
377−static inline int arch_read_trylock(arch_rwlock_t *rw)
378−{
379− unsigned int val, got_it = 0;
380− SCOND_FAIL_RETRY_VAR_DEF;
381−
382− smp_mb();
383−
384− __asm__ __volatile__(
385− "0: mov %[delay], 1 \n"
386− "1: llock %[val], [%[rwlock]] \n"
387− " brls %[val], %[WR_LOCKED], 4f\n" /* <= 0: already write locked, bail */
388− " sub %[val], %[val], 1 \n" /* counter-- */
389− " scond %[val], [%[rwlock]] \n"
390− " bz.d 4f \n"
391− " mov.z %[got_it], 1 \n" /* got it */
392− " \n"
393− SCOND_FAIL_RETRY_ASM
394−
395− : [val] "=&r" (val),
396− [got_it] "+&r" (got_it)
397− SCOND_FAIL_RETRY_VARS
398− : [rwlock] "r" (&(rw->counter)),
399− [WR_LOCKED] "ir" (0)
400− : "memory", "cc");
401−
402− smp_mb();
403−
404− return got_it;
405−}
406−
407−static inline void arch_write_lock(arch_rwlock_t *rw)
408−{
409− unsigned int val;
410− SCOND_FAIL_RETRY_VAR_DEF;
411−
412− smp_mb();
413−
414− /*
415− * If reader(s) hold lock (lock < __ARCH_RW_LOCK_UNLOCKED__),
416− * deny writer. Otherwise if unlocked grant to writer
417− * Hence the claim that Linux rwlocks are unfair to writers.
418− * (can be starved for an indefinite time by readers).
419− *
420− * if (rw->counter == __ARCH_RW_LOCK_UNLOCKED__) {
421− * rw->counter = 0;
422− * ret = 1;
423− * }
424− */
425−
426− __asm__ __volatile__(
427− "0: mov %[delay], 1 \n"
428− "1: llock %[val], [%[rwlock]] \n"
429− " brne %[val], %[UNLOCKED], 0b \n" /* while !UNLOCKED spin */
430− " mov %[val], %[WR_LOCKED] \n"
431− " scond %[val], [%[rwlock]] \n"
432− " bz 4f \n"
433− " \n"
434− SCOND_FAIL_RETRY_ASM
435−
436− : [val] "=&r" (val)
437− SCOND_FAIL_RETRY_VARS
438− : [rwlock] "r" (&(rw->counter)),
439− [UNLOCKED] "ir" (__ARCH_RW_LOCK_UNLOCKED__),
440− [WR_LOCKED] "ir" (0)
441− : "memory", "cc");
442−
443− smp_mb();
444−}
445−
446−/* 1 - lock taken successfully */
447−static inline int arch_write_trylock(arch_rwlock_t *rw)
448−{
449− unsigned int val, got_it = 0;
450− SCOND_FAIL_RETRY_VAR_DEF;
451−
452− smp_mb();
453−
454− __asm__ __volatile__(
455− "0: mov %[delay], 1 \n"
456− "1: llock %[val], [%[rwlock]] \n"
457− " brne %[val], %[UNLOCKED], 4f \n" /* !UNLOCKED, bail */
458− " mov %[val], %[WR_LOCKED] \n"
459− " scond %[val], [%[rwlock]] \n"
460− " bz.d 4f \n"
461− " mov.z %[got_it], 1 \n" /* got it */
462− " \n"
463− SCOND_FAIL_RETRY_ASM
464−
465− : [val] "=&r" (val),
466− [got_it] "+&r" (got_it)
467− SCOND_FAIL_RETRY_VARS
468− : [rwlock] "r" (&(rw->counter)),
469− [UNLOCKED] "ir" (__ARCH_RW_LOCK_UNLOCKED__),
470− [WR_LOCKED] "ir" (0)
471− : "memory", "cc");
472−
473− smp_mb();
474−
475− return got_it;
476−}
477−
478−static inline void arch_read_unlock(arch_rwlock_t *rw)
479−{
480− unsigned int val;
481−
482− smp_mb();
483−
484− /*
485− * rw->counter++;
486− */
487− __asm__ __volatile__(
488− "1: llock %[val], [%[rwlock]] \n"
489− " add %[val], %[val], 1 \n"
490− " scond %[val], [%[rwlock]] \n"
491− " bnz 1b \n"
492− " \n"
493− : [val] "=&r" (val)
494− : [rwlock] "r" (&(rw->counter))
495− : "memory", "cc");
496−
497− smp_mb();
498−}
499−
500−static inline void arch_write_unlock(arch_rwlock_t *rw)
501−{
502− unsigned int val;
503−
504− smp_mb();
505−
506− /*
507− * rw->counter = __ARCH_RW_LOCK_UNLOCKED__;
508− */
509− __asm__ __volatile__(
510− "1: llock %[val], [%[rwlock]] \n"
511− " scond %[UNLOCKED], [%[rwlock]]\n"
512− " bnz 1b \n"
513− " \n"
514− : [val] "=&r" (val)
515− : [rwlock] "r" (&(rw->counter)),
516− [UNLOCKED] "r" (__ARCH_RW_LOCK_UNLOCKED__)
517− : "memory", "cc");
518−
519− smp_mb();
520−}
521−
522−#undef SCOND_FAIL_RETRY_VAR_DEF
523−#undef SCOND_FAIL_RETRY_ASM
524−#undef SCOND_FAIL_RETRY_VARS
525−
526−#endif /* CONFIG_ARC_STAR_9000923308 */
527−
528236 #else /* !CONFIG_ARC_HAS_LLSC */
529237
530238 static inline void arch_spin_lock(arch_spinlock_t *lock)
arch/arc/include/asm/thread_info.h+1−1
@@ -103,7 +103,7 @@ static inline __attribute_const__ struct thread_info *current_thread_info(void) · 102 unmodified lines
103103
104104 /*
105105 * _TIF_ALLWORK_MASK includes SYSCALL_TRACE, but we don't need it.
106− * SYSCALL_TRACE is anways seperately/unconditionally tested right after a
106+ * SYSCALL_TRACE is anyway seperately/unconditionally tested right after a
107107 * syscall, so all that reamins to be tested is _TIF_WORK_MASK
108108 */
109109
arch/arc/include/asm/uaccess.h+1−1
@@ -32,7 +32,7 @@ · 31 unmodified lines
3232 #define __kernel_ok (segment_eq(get_fs(), KERNEL_DS))
3333
3434 /*
35− * Algorthmically, for __user_ok() we want do:
35+ * Algorithmically, for __user_ok() we want do:
3636 * (start < TASK_SIZE) && (start+len < TASK_SIZE)
3737 * where TASK_SIZE could either be retrieved from thread_info->addr_limit or
3838 * emitted directly in code.
arch/arc/include/uapi/asm/swab.h+1−1
@@ -74,7 +74,7 @@ · 73 unmodified lines
7474 __tmp ^ __in; \
7575 })
7676
77−#elif (ARC_BSWAP_TYPE == 2) /* Custom single cycle bwap instruction */
77+#elif (ARC_BSWAP_TYPE == 2) /* Custom single cycle bswap instruction */
7878
7979 #define __arch_swab32(x) \
8080 ({ \
arch/arc/kernel/entry-compact.S+2−16
@@ -91,27 +91,13 @@ VECTOR mem_service ; 0x8, Mem exception (0x1) · 90 unmodified lines
9191 VECTOR instr_service ; 0x10, Instrn Error (0x2)
9292
9393 ; ******************** Device ISRs **********************
94−#ifdef CONFIG_ARC_IRQ3_LV2
95−VECTOR handle_interrupt_level2
96−#else
97−VECTOR handle_interrupt_level1
98−#endif
99−
100−VECTOR handle_interrupt_level1
101−
102−#ifdef CONFIG_ARC_IRQ5_LV2
103−VECTOR handle_interrupt_level2
104−#else
105−VECTOR handle_interrupt_level1
106−#endif
107−
108−#ifdef CONFIG_ARC_IRQ6_LV2
94+#ifdef CONFIG_ARC_COMPACT_IRQ_LEVELS
10995 VECTOR handle_interrupt_level2
11096 #else
11197 VECTOR handle_interrupt_level1
11298 #endif
11399
114−.rept 25
100+.rept 28
115101 VECTOR handle_interrupt_level1 ; Other devices
116102 .endr
117103
arch/arc/kernel/intc-compact.c+2−4
@@ -28,10 +28,8 @@ void arc_init_IRQ(void) · 27 unmodified lines
2828 {
2929 int level_mask = 0;
3030
31− /* setup any high priority Interrupts (Level2 in ARCompact jargon) */
32− level_mask |= IS_ENABLED(CONFIG_ARC_IRQ3_LV2) << 3;
33− level_mask |= IS_ENABLED(CONFIG_ARC_IRQ5_LV2) << 5;
34− level_mask |= IS_ENABLED(CONFIG_ARC_IRQ6_LV2) << 6;
31+ /* Is timer high priority Interrupt (Level2 in ARCompact jargon) */
32+ level_mask |= IS_ENABLED(CONFIG_ARC_COMPACT_IRQ_LEVELS) << TIMER0_IRQ;
3533
3634 /*
3735 * Write to register, even if no LV2 IRQs configured to reset it
arch/arc/kernel/perf_event.c+1−1
@@ -108,7 +108,7 @@ static void arc_perf_event_update(struct perf_event *event, · 107 unmodified lines
108108 int64_t delta = new_raw_count - prev_raw_count;
109109
110110 /*
111− * We don't afaraid of hwc->prev_count changing beneath our feet
111+ * We aren't afraid of hwc->prev_count changing beneath our feet
112112 * because there's no way for us to re-enter this function anytime.
113113 */
114114 local64_set(&hwc->prev_count, new_raw_count);
arch/arc/kernel/setup.c+1−1
@@ -392,7 +392,7 @@ void __init setup_arch(char **cmdline_p) · 391 unmodified lines
392392 /*
393393 * If we are here, it is established that @uboot_arg didn't
394394 * point to DT blob. Instead if u-boot says it is cmdline,
395− * Appent to embedded DT cmdline.
395+ * append to embedded DT cmdline.
396396 * setup_machine_fdt() would have populated @boot_command_line
397397 */
398398 if (uboot_tag == 1) {
arch/arc/kernel/signal.c+1−1
@@ -34,7 +34,7 @@ · 33 unmodified lines
3434 * -ViXS were still seeing crashes when using insmod to load drivers.
3535 * It turned out that the code to change Execute permssions for TLB entries
3636 * of user was not guarded for interrupts (mod_tlb_permission)
37− * This was cauing TLB entries to be overwritten on unrelated indexes
37+ * This was causing TLB entries to be overwritten on unrelated indexes
3838 *
3939 * Vineetg: July 15th 2008: Bug #94183
4040 * -Exception happens in Delay slot of a JMP, and before user space resumes,
arch/arc/kernel/troubleshoot.c+1−1
@@ -276,7 +276,7 @@ static int tlb_stats_open(struct inode *inode, struct file *file) · 275 unmodified lines
276276 return 0;
277277 }
278278
279−/* called on user read(): display the couters */
279+/* called on user read(): display the counters */
280280 static ssize_t tlb_stats_output(struct file *file, /* file descriptor */
281281 char __user *user_buf, /* user buffer */
282282 size_t len, /* length of buffer */
arch/arc/mm/cache.c+3−3
@@ -215,7 +215,7 @@ slc_chk: · 214 unmodified lines
215215 * ------------------
216216 * This ver of MMU supports variable page sizes (1k-16k): although Linux will
217217 * only support 8k (default), 16k and 4k.
218− * However from hardware perspective, smaller page sizes aggrevate aliasing
218+ * However from hardware perspective, smaller page sizes aggravate aliasing
219219 * meaning more vaddr bits needed to disambiguate the cache-line-op ;
220220 * the existing scheme of piggybacking won't work for certain configurations.
221221 * Two new registers IC_PTAG and DC_PTAG inttoduced.
@@ -302,7 +302,7 @@ void __cache_line_loop_v3(phys_addr_t paddr, unsigned long vaddr, · 80 unmodified lines
302302
303303 /*
304304 * This is technically for MMU v4, using the MMU v3 programming model
305− * Special work for HS38 aliasing I-cache configuratino with PAE40
305+ * Special work for HS38 aliasing I-cache configuration with PAE40
306306 * - upper 8 bits of paddr need to be written into PTAG_HI
307307 * - (and needs to be written before the lower 32 bits)
308308 * Note that PTAG_HI is hoisted outside the line loop
@@ -936,7 +936,7 @@ void arc_cache_init(void) · 627 unmodified lines
936936 ic->ver, CONFIG_ARC_MMU_VER);
937937
938938 /*
939− * In MMU v4 (HS38x) the alising icache config uses IVIL/PTAG
939+ * In MMU v4 (HS38x) the aliasing icache config uses IVIL/PTAG
940940 * pair to provide vaddr/paddr respectively, just as in MMU v3
941941 */
942942 if (is_isa_arcv2() && ic->alias)
arch/arc/mm/dma.c+1−1
@@ -10,7 +10,7 @@ · 9 unmodified lines
1010 * DMA Coherent API Notes
1111 *
1212 * I/O is inherently non-coherent on ARC. So a coherent DMA buffer is
13− * implemented by accessintg it using a kernel virtual address, with
13+ * implemented by accessing it using a kernel virtual address, with
1414 * Cache bit off in the TLB entry.
1515 *
1616 * The default DMA address == Phy address which is 0x8000_0000 based.
arch/arm/boot/dts/Makefile+1−0
@@ -741,6 +741,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \ · 740 unmodified lines
741741 sun7i-a20-olimex-som-evb.dtb \
742742 sun7i-a20-olinuxino-lime.dtb \
743743 sun7i-a20-olinuxino-lime2.dtb \
744+ sun7i-a20-olinuxino-lime2-emmc.dtb \
744745 sun7i-a20-olinuxino-micro.dtb \
745746 sun7i-a20-orangepi.dtb \
746747 sun7i-a20-orangepi-mini.dtb \
arch/arm/boot/dts/am437x-sk-evm.dts+1−1
@@ -418,7 +418,7 @@ · 417 unmodified lines
418418 status = "okay";
419419 pinctrl-names = "default";
420420 pinctrl-0 = <&i2c0_pins>;
421− clock-frequency = <400000>;
421+ clock-frequency = <100000>;
422422
423423 tps@24 {
424424 compatible = "ti,tps65218";
arch/arm/boot/dts/am57xx-idk-common.dtsi+17−15
@@ -60,10 +60,26 @@ · 59 unmodified lines
6060
6161 tps659038_pmic {
6262 compatible = "ti,tps659038-pmic";
63+
64+ smps12-in-supply = <&vmain>;
65+ smps3-in-supply = <&vmain>;
66+ smps45-in-supply = <&vmain>;
67+ smps6-in-supply = <&vmain>;
68+ smps7-in-supply = <&vmain>;
69+ smps8-in-supply = <&vmain>;
70+ smps9-in-supply = <&vmain>;
71+ ldo1-in-supply = <&vmain>;
72+ ldo2-in-supply = <&vmain>;
73+ ldo3-in-supply = <&vmain>;
74+ ldo4-in-supply = <&vmain>;
75+ ldo9-in-supply = <&vmain>;
76+ ldoln-in-supply = <&vmain>;
77+ ldousb-in-supply = <&vmain>;
78+ ldortc-in-supply = <&vmain>;
79+
6380 regulators {
6481 smps12_reg: smps12 {
6582 /* VDD_MPU */
66− vin-supply = <&vmain>;
6783 regulator-name = "smps12";
6884 regulator-min-microvolt = <850000>;
6985 regulator-max-microvolt = <1250000>;
@@ -73,7 +89,6 @@ · 3 unmodified lines
7389
7490 smps3_reg: smps3 {
7591 /* VDD_DDR EMIF1 EMIF2 */
76− vin-supply = <&vmain>;
7792 regulator-name = "smps3";
7893 regulator-min-microvolt = <1350000>;
7994 regulator-max-microvolt = <1350000>;
@@ -84,7 +99,6 @@ · 4 unmodified lines
8499 smps45_reg: smps45 {
85100 /* VDD_DSPEVE on AM572 */
86101 /* VDD_IVA + VDD_DSP on AM571 */
87− vin-supply = <&vmain>;
88102 regulator-name = "smps45";
89103 regulator-min-microvolt = <850000>;
90104 regulator-max-microvolt = <1250000>;
@@ -94,7 +108,6 @@ · 3 unmodified lines
94108
95109 smps6_reg: smps6 {
96110 /* VDD_GPU */
97− vin-supply = <&vmain>;
98111 regulator-name = "smps6";
99112 regulator-min-microvolt = <850000>;
100113 regulator-max-microvolt = <1250000>;
@@ -104,7 +117,6 @@ · 3 unmodified lines
104117
105118 smps7_reg: smps7 {
106119 /* VDD_CORE */
107− vin-supply = <&vmain>;
108120 regulator-name = "smps7";
109121 regulator-min-microvolt = <850000>;
110122 regulator-max-microvolt = <1150000>;
@@ -115,13 +127,11 @@ · 4 unmodified lines
115127 smps8_reg: smps8 {
116128 /* 5728 - VDD_IVAHD */
117129 /* 5718 - N.C. test point */
118− vin-supply = <&vmain>;
119130 regulator-name = "smps8";
120131 };
121132
122133 smps9_reg: smps9 {
123134 /* VDD_3_3D */
124− vin-supply = <&vmain>;
125135 regulator-name = "smps9";
126136 regulator-min-microvolt = <3300000>;
127137 regulator-max-microvolt = <3300000>;
@@ -132,7 +142,6 @@ · 4 unmodified lines
132142 ldo1_reg: ldo1 {
133143 /* VDDSHV8 - VSDMMC */
134144 /* NOTE: on rev 1.3a, data supply */
135− vin-supply = <&vmain>;
136145 regulator-name = "ldo1";
137146 regulator-min-microvolt = <1800000>;
138147 regulator-max-microvolt = <3300000>;
@@ -142,7 +151,6 @@ · 3 unmodified lines
142151
143152 ldo2_reg: ldo2 {
144153 /* VDDSH18V */
145− vin-supply = <&vmain>;
146154 regulator-name = "ldo2";
147155 regulator-min-microvolt = <1800000>;
148156 regulator-max-microvolt = <1800000>;
@@ -152,7 +160,6 @@ · 3 unmodified lines
152160
153161 ldo3_reg: ldo3 {
154162 /* R1.3a 572x V1_8PHY_LDO3: USB, SATA */
155− vin-supply = <&vmain>;
156163 regulator-name = "ldo3";
157164 regulator-min-microvolt = <1800000>;
158165 regulator-max-microvolt = <1800000>;
@@ -162,7 +169,6 @@ · 3 unmodified lines
162169
163170 ldo4_reg: ldo4 {
164171 /* R1.3a 572x V1_8PHY_LDO4: PCIE, HDMI*/
165− vin-supply = <&vmain>;
166172 regulator-name = "ldo4";
167173 regulator-min-microvolt = <1800000>;
168174 regulator-max-microvolt = <1800000>;
@@ -174,7 +180,6 @@ · 5 unmodified lines
174180
175181 ldo9_reg: ldo9 {
176182 /* VDD_RTC */
177− vin-supply = <&vmain>;
178183 regulator-name = "ldo9";
179184 regulator-min-microvolt = <840000>;
180185 regulator-max-microvolt = <1160000>;
@@ -184,7 +189,6 @@ · 3 unmodified lines
184189
185190 ldoln_reg: ldoln {
186191 /* VDDA_1V8_PLL */
187− vin-supply = <&vmain>;
188192 regulator-name = "ldoln";
189193 regulator-min-microvolt = <1800000>;
190194 regulator-max-microvolt = <1800000>;
@@ -194,7 +198,6 @@ · 3 unmodified lines
194198
195199 ldousb_reg: ldousb {
196200 /* VDDA_3V_USB: VDDA_USBHS33 */
197− vin-supply = <&vmain>;
198201 regulator-name = "ldousb";
199202 regulator-min-microvolt = <3300000>;
200203 regulator-max-microvolt = <3300000>;
@@ -204,7 +207,6 @@ · 3 unmodified lines
204207
205208 ldortc_reg: ldortc {
206209 /* VDDA_RTC */
207− vin-supply = <&vmain>;
208210 regulator-name = "ldortc";
209211 regulator-min-microvolt = <1800000>;
210212 regulator-max-microvolt = <1800000>;
arch/arm/boot/dts/dm8148-evm.dts+8−0
@@ -93,6 +93,10 @@ · 92 unmodified lines
9393 };
9494 };
9595
96+&mmc1 {
97+ status = "disabled";
98+};
99+
96100 &mmc2 {
97101 pinctrl-names = "default";
98102 pinctrl-0 = <&sd1_pins>;
@@ -101,6 +105,10 @@ · 2 unmodified lines
101105 cd-gpios = <&gpio2 6 GPIO_ACTIVE_LOW>;
102106 };
103107
108+&mmc3 {
109+ status = "disabled";
110+};
111+
104112 &pincntl {
105113 sd1_pins: pinmux_sd1_pins {
106114 pinctrl-single,pins = <
arch/arm/boot/dts/dm8148-t410.dts+9−0
@@ -45,6 +45,14 @@ · 44 unmodified lines
4545 phy-mode = "rgmii";
4646 };
4747
48+&mmc1 {
49+ status = "disabled";
50+};
51+
52+&mmc2 {
53+ status = "disabled";
54+};
55+
4856 &mmc3 {
4957 pinctrl-names = "default";
5058 pinctrl-0 = <&sd2_pins>;
@@ -53,6 +61,7 @@ · 2 unmodified lines
5361 dmas = <&edma_xbar 8 0 1 /* use SDTXEVT1 instead of MCASP0TX */
5462 &edma_xbar 9 0 2>; /* use SDRXEVT1 instead of MCASP0RX */
5563 dma-names = "tx", "rx";
64+ non-removable;
5665 };
5766
5867 &pincntl {
arch/arm/boot/dts/dra7.dtsi+2−0
@@ -1451,6 +1451,8 @@ · 1450 unmodified lines
14511451 ti,hwmods = "gpmc";
14521452 reg = <0x50000000 0x37c>; /* device IO registers */
14531453 interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
1454+ dmas = <&edma_xbar 4 0>;
1455+ dma-names = "rxtx";
14541456 gpmc,num-cs = <8>;
14551457 gpmc,num-waitpins = <2>;
14561458 #address-cells = <2>;
arch/arm/boot/dts/dra74x.dtsi+2−2
@@ -107,8 +107,8 @@ · 106 unmodified lines
107107 reg = <0x58000000 0x80>,
108108 <0x58004054 0x4>,
109109 <0x58004300 0x20>,
110− <0x58005054 0x4>,
111− <0x58005300 0x20>;
110+ <0x58009054 0x4>,
111+ <0x58009300 0x20>;
112112 reg-names = "dss", "pll1_clkctrl", "pll1",
113113 "pll2_clkctrl", "pll2";
114114
arch/arm/boot/dts/exynos5250-snow-common.dtsi+10−3
@@ -242,7 +242,7 @@ · 241 unmodified lines
242242 hpd-gpios = <&gpx0 7 GPIO_ACTIVE_HIGH>;
243243
244244 ports {
245− port0 {
245+ port {
246246 dp_out: endpoint {
247247 remote-endpoint = <&bridge_in>;
248248 };
@@ -485,13 +485,20 @@ · 236 unmodified lines
485485 edid-emulation = <5>;
486486
487487 ports {
488− port0 {
488+ #address-cells = <1>;
489+ #size-cells = <0>;
490+
491+ port@0 {
492+ reg = <0>;
493+
489494 bridge_out: endpoint {
490495 remote-endpoint = <&panel_in>;
491496 };
492497 };
493498
494− port1 {
499+ port@1 {
500+ reg = <1>;
501+
495502 bridge_in: endpoint {
496503 remote-endpoint = <&dp_out>;
497504 };
arch/arm/boot/dts/exynos5420-peach-pit.dts+10−3
@@ -163,7 +163,7 @@ · 162 unmodified lines
163163 hpd-gpios = <&gpx2 6 GPIO_ACTIVE_HIGH>;
164164
165165 ports {
166− port0 {
166+ port {
167167 dp_out: endpoint {
168168 remote-endpoint = <&bridge_in>;
169169 };
@@ -631,13 +631,20 @@ · 461 unmodified lines
631631 use-external-pwm;
632632
633633 ports {
634− port0 {
634+ #address-cells = <1>;
635+ #size-cells = <0>;
636+
637+ port@0 {
638+ reg = <0>;
639+
635640 bridge_out: endpoint {
636641 remote-endpoint = <&panel_in>;
637642 };
638643 };
639644
640− port1 {
645+ port@1 {
646+ reg = <1>;
647+
641648 bridge_in: endpoint {
642649 remote-endpoint = <&dp_out>;
643650 };
arch/arm/boot/dts/omap3-evm-37xx.dts+1−1
@@ -85,7 +85,7 @@ · 84 unmodified lines
8585 OMAP3_CORE1_IOPAD(0x2158, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_clk.sdmmc2_clk */
8686 OMAP3_CORE1_IOPAD(0x215a, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_cmd.sdmmc2_cmd */
8787 OMAP3_CORE1_IOPAD(0x215c, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat0.sdmmc2_dat0 */
88− OMAP3_CORE1_IOPAD(0x215e, WAKEUP_EN | PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat1.sdmmc2_dat1 */
88+ OMAP3_CORE1_IOPAD(0x215e, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat1.sdmmc2_dat1 */
8989 OMAP3_CORE1_IOPAD(0x2160, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat2.sdmmc2_dat2 */
9090 OMAP3_CORE1_IOPAD(0x2162, PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat3.sdmmc2_dat3 */
9191 >;
arch/arm/boot/dts/omap3-igep.dtsi+1−0
@@ -188,6 +188,7 @@ · 187 unmodified lines
188188 vmmc-supply = <&vmmc1>;
189189 vmmc_aux-supply = <&vsim>;
190190 bus-width = <4>;
191+ cd-gpios = <&twl_gpio 0 GPIO_ACTIVE_LOW>;
191192 };
192193
193194 &mmc3 {
arch/arm/boot/dts/omap3-igep0020-common.dtsi+11−0
@@ -194,6 +194,12 @@ · 193 unmodified lines
194194 OMAP3630_CORE2_IOPAD(0x25f8, PIN_OUTPUT | MUX_MODE4) /* etk_d14.gpio_28 */
195195 >;
196196 };
197+
198+ mmc1_wp_pins: pinmux_mmc1_cd_pins {
199+ pinctrl-single,pins = <
200+ OMAP3630_CORE2_IOPAD(0x25fa, PIN_INPUT | MUX_MODE4) /* etk_d15.gpio_29 */
201+ >;
202+ };
197203 };
198204
199205 &i2c3 {
@@ -250,3 +256,8 @@ · 50 unmodified lines
250256 };
251257 };
252258 };
259+
260+&mmc1 {
261+ pinctrl-0 = <&mmc1_pins &mmc1_wp_pins>;
262+ wp-gpios = <&gpio1 29 GPIO_ACTIVE_LOW>; /* gpio_29 */
263+};
arch/arm/boot/dts/omap3-n900.dts+2−2
@@ -288,7 +288,7 @@ · 287 unmodified lines
288288 pinctrl-single,pins = <
289289 OMAP3_CORE1_IOPAD(0x2180, PIN_INPUT_PULLUP | MUX_MODE1) /* ssi1_rdy_tx */
290290 OMAP3_CORE1_IOPAD(0x217e, PIN_OUTPUT | MUX_MODE1) /* ssi1_flag_tx */
291− OMAP3_CORE1_IOPAD(0x2182, PIN_INPUT | WAKEUP_EN | MUX_MODE4) /* ssi1_wake_tx (cawake) */
291+ OMAP3_CORE1_IOPAD(0x2182, PIN_INPUT | MUX_MODE4) /* ssi1_wake_tx (cawake) */
292292 OMAP3_CORE1_IOPAD(0x217c, PIN_OUTPUT | MUX_MODE1) /* ssi1_dat_tx */
293293 OMAP3_CORE1_IOPAD(0x2184, PIN_INPUT | MUX_MODE1) /* ssi1_dat_rx */
294294 OMAP3_CORE1_IOPAD(0x2186, PIN_INPUT | MUX_MODE1) /* ssi1_flag_rx */
@@ -300,7 +300,7 @@ · 5 unmodified lines
300300 modem_pins: pinmux_modem {
301301 pinctrl-single,pins = <
302302 OMAP3_CORE1_IOPAD(0x20dc, PIN_OUTPUT | MUX_MODE4) /* gpio 70 => cmt_apeslpx */
303− OMAP3_CORE1_IOPAD(0x20e0, PIN_INPUT | WAKEUP_EN | MUX_MODE4) /* gpio 72 => ape_rst_rq */
303+ OMAP3_CORE1_IOPAD(0x20e0, PIN_INPUT | MUX_MODE4) /* gpio 72 => ape_rst_rq */
304304 OMAP3_CORE1_IOPAD(0x20e2, PIN_OUTPUT | MUX_MODE4) /* gpio 73 => cmt_rst_rq */
305305 OMAP3_CORE1_IOPAD(0x20e4, PIN_OUTPUT | MUX_MODE4) /* gpio 74 => cmt_en */
306306 OMAP3_CORE1_IOPAD(0x20e6, PIN_OUTPUT | MUX_MODE4) /* gpio 75 => cmt_rst */
arch/arm/boot/dts/omap3-n950-n9.dtsi+3−3
@@ -97,7 +97,7 @@ · 96 unmodified lines
9797 OMAP3_CORE1_IOPAD(0x217c, PIN_OUTPUT | MUX_MODE1) /* ssi1_dat_tx */
9898 OMAP3_CORE1_IOPAD(0x217e, PIN_OUTPUT | MUX_MODE1) /* ssi1_flag_tx */
9999 OMAP3_CORE1_IOPAD(0x2180, PIN_INPUT_PULLUP | MUX_MODE1) /* ssi1_rdy_tx */
100− OMAP3_CORE1_IOPAD(0x2182, PIN_INPUT | WAKEUP_EN | MUX_MODE4) /* ssi1_wake_tx (cawake) */
100+ OMAP3_CORE1_IOPAD(0x2182, PIN_INPUT | MUX_MODE4) /* ssi1_wake_tx (cawake) */
101101 OMAP3_CORE1_IOPAD(0x2184, PIN_INPUT | MUX_MODE1) /* ssi1_dat_rx */
102102 OMAP3_CORE1_IOPAD(0x2186, PIN_INPUT | MUX_MODE1) /* ssi1_flag_rx */
103103 OMAP3_CORE1_IOPAD(0x2188, PIN_OUTPUT | MUX_MODE1) /* ssi1_rdy_rx */
@@ -110,7 +110,7 @@ · 6 unmodified lines
110110 OMAP3_CORE1_IOPAD(0x217c, PIN_OUTPUT | MUX_MODE7) /* ssi1_dat_tx */
111111 OMAP3_CORE1_IOPAD(0x217e, PIN_OUTPUT | MUX_MODE7) /* ssi1_flag_tx */
112112 OMAP3_CORE1_IOPAD(0x2180, PIN_INPUT_PULLDOWN | MUX_MODE7) /* ssi1_rdy_tx */
113− OMAP3_CORE1_IOPAD(0x2182, PIN_INPUT | WAKEUP_EN | MUX_MODE4) /* ssi1_wake_tx (cawake) */
113+ OMAP3_CORE1_IOPAD(0x2182, PIN_INPUT | MUX_MODE4) /* ssi1_wake_tx (cawake) */
114114 OMAP3_CORE1_IOPAD(0x2184, PIN_INPUT | MUX_MODE7) /* ssi1_dat_rx */
115115 OMAP3_CORE1_IOPAD(0x2186, PIN_INPUT | MUX_MODE7) /* ssi1_flag_rx */
116116 OMAP3_CORE1_IOPAD(0x2188, PIN_OUTPUT | MUX_MODE4) /* ssi1_rdy_rx */
@@ -120,7 +120,7 @@ · 3 unmodified lines
120120
121121 modem_pins1: pinmux_modem_core1_pins {
122122 pinctrl-single,pins = <
123− OMAP3_CORE1_IOPAD(0x207a, PIN_INPUT | WAKEUP_EN | MUX_MODE4) /* gpio_34 (ape_rst_rq) */
123+ OMAP3_CORE1_IOPAD(0x207a, PIN_INPUT | MUX_MODE4) /* gpio_34 (ape_rst_rq) */
124124 OMAP3_CORE1_IOPAD(0x2100, PIN_OUTPUT | MUX_MODE4) /* gpio_88 (cmt_rst_rq) */
125125 OMAP3_CORE1_IOPAD(0x210a, PIN_OUTPUT | MUX_MODE4) /* gpio_93 (cmt_apeslpx) */
126126 >;
arch/arm/boot/dts/omap3-zoom3.dts+3−3
@@ -98,7 +98,7 @@ · 97 unmodified lines
9898 pinctrl-single,pins = <
9999 OMAP3_CORE1_IOPAD(0x2174, PIN_INPUT_PULLUP | MUX_MODE0) /* uart2_cts.uart2_cts */
100100 OMAP3_CORE1_IOPAD(0x2176, PIN_OUTPUT | MUX_MODE0) /* uart2_rts.uart2_rts */
101− OMAP3_CORE1_IOPAD(0x217a, WAKEUP_EN | PIN_INPUT | MUX_MODE0) /* uart2_rx.uart2_rx */
101+ OMAP3_CORE1_IOPAD(0x217a, PIN_INPUT | MUX_MODE0) /* uart2_rx.uart2_rx */
102102 OMAP3_CORE1_IOPAD(0x2178, PIN_OUTPUT | MUX_MODE0) /* uart2_tx.uart2_tx */
103103 >;
104104 };
@@ -107,7 +107,7 @@ · 2 unmodified lines
107107 pinctrl-single,pins = <
108108 OMAP3_CORE1_IOPAD(0x219a, PIN_INPUT_PULLDOWN | MUX_MODE0) /* uart3_cts_rctx.uart3_cts_rctx */
109109 OMAP3_CORE1_IOPAD(0x219c, PIN_OUTPUT | MUX_MODE0) /* uart3_rts_sd.uart3_rts_sd */
110− OMAP3_CORE1_IOPAD(0x219e, WAKEUP_EN | PIN_INPUT | MUX_MODE0) /* uart3_rx_irrx.uart3_rx_irrx */
110+ OMAP3_CORE1_IOPAD(0x219e, PIN_INPUT | MUX_MODE0) /* uart3_rx_irrx.uart3_rx_irrx */
111111 OMAP3_CORE1_IOPAD(0x21a0, PIN_OUTPUT | MUX_MODE0) /* uart3_tx_irtx.uart3_tx_irtx */
112112 >;
113113 };
@@ -125,7 +125,7 @@ · 11 unmodified lines
125125 pinctrl-single,pins = <
126126 OMAP3630_CORE2_IOPAD(0x25d8, PIN_INPUT_PULLUP | MUX_MODE2) /* etk_clk.sdmmc3_clk */
127127 OMAP3630_CORE2_IOPAD(0x25e4, PIN_INPUT_PULLUP | MUX_MODE2) /* etk_d4.sdmmc3_dat0 */
128− OMAP3630_CORE2_IOPAD(0x25e6, WAKEUP_EN | PIN_INPUT_PULLUP | MUX_MODE2) /* etk_d5.sdmmc3_dat1 */
128+ OMAP3630_CORE2_IOPAD(0x25e6, PIN_INPUT_PULLUP | MUX_MODE2) /* etk_d5.sdmmc3_dat1 */
129129 OMAP3630_CORE2_IOPAD(0x25e8, PIN_INPUT_PULLUP | MUX_MODE2) /* etk_d6.sdmmc3_dat2 */
130130 OMAP3630_CORE2_IOPAD(0x25e2, PIN_INPUT_PULLUP | MUX_MODE2) /* etk_d3.sdmmc3_dat3 */
131131 >;
arch/arm/boot/dts/omap5-board-common.dtsi+46−2
@@ -14,6 +14,29 @@ · 13 unmodified lines
1414 display0 = &hdmi0;
1515 };
1616
17+ vmain: fixedregulator-vmain {
18+ compatible = "regulator-fixed";
19+ regulator-name = "vmain";
20+ regulator-min-microvolt = <5000000>;
21+ regulator-max-microvolt = <5000000>;
22+ };
23+
24+ vsys_cobra: fixedregulator-vsys_cobra {
25+ compatible = "regulator-fixed";
26+ regulator-name = "vsys_cobra";
27+ vin-supply = <&vmain>;
28+ regulator-min-microvolt = <5000000>;
29+ regulator-max-microvolt = <5000000>;
30+ };
31+
32+ vdds_1v8_main: fixedregulator-vdds_1v8_main {
33+ compatible = "regulator-fixed";
34+ regulator-name = "vdds_1v8_main";
35+ vin-supply = <&smps7_reg>;
36+ regulator-min-microvolt = <1800000>;
37+ regulator-max-microvolt = <1800000>;
38+ };
39+
1740 vmmcsd_fixed: fixedregulator-mmcsd {
1841 compatible = "regulator-fixed";
1942 regulator-name = "vmmcsd_fixed";
@@ -309,7 +332,7 @@ · 289 unmodified lines
309332
310333 wlcore_irq_pin: pinmux_wlcore_irq_pin {
311334 pinctrl-single,pins = <
312− OMAP5_IOPAD(0x40, WAKEUP_EN | PIN_INPUT_PULLUP | MUX_MODE6) /* llia_wakereqin.gpio1_wk14 */
335+ OMAP5_IOPAD(0x40, PIN_INPUT_PULLUP | MUX_MODE6) /* llia_wakereqin.gpio1_wk14 */
313336 >;
314337 };
315338 };
@@ -409,6 +432,26 @@ · 93 unmodified lines
409432
410433 ti,ldo6-vibrator;
411434
435+ smps123-in-supply = <&vsys_cobra>;
436+ smps45-in-supply = <&vsys_cobra>;
437+ smps6-in-supply = <&vsys_cobra>;
438+ smps7-in-supply = <&vsys_cobra>;
439+ smps8-in-supply = <&vsys_cobra>;
440+ smps9-in-supply = <&vsys_cobra>;
441+ smps10_out2-in-supply = <&vsys_cobra>;
442+ smps10_out1-in-supply = <&vsys_cobra>;
443+ ldo1-in-supply = <&vsys_cobra>;
444+ ldo2-in-supply = <&vsys_cobra>;
445+ ldo3-in-supply = <&vdds_1v8_main>;
446+ ldo4-in-supply = <&vdds_1v8_main>;
447+ ldo5-in-supply = <&vsys_cobra>;
448+ ldo6-in-supply = <&vdds_1v8_main>;
449+ ldo7-in-supply = <&vsys_cobra>;
450+ ldo8-in-supply = <&vsys_cobra>;
451+ ldo9-in-supply = <&vmmcsd_fixed>;
452+ ldoln-in-supply = <&vsys_cobra>;
453+ ldousb-in-supply = <&vsys_cobra>;
454+
412455 regulators {
413456 smps123_reg: smps123 {
414457 /* VDD_OPP_MPU */
@@ -600,7 +643,8 @@ · 185 unmodified lines
600643 pinctrl-0 = <&twl6040_pins>;
601644
602645 interrupts = <GIC_SPI 119 IRQ_TYPE_NONE>; /* IRQ_SYS_2N cascaded to gic */
603− ti,audpwron-gpio = <&gpio5 13 GPIO_ACTIVE_HIGH>; /* gpio line 141 */
646+
647+ /* audpwron gpio defined in the board specific dts */
604648
605649 vio-supply = <&smps7_reg>;
606650 v2v1-supply = <&smps9_reg>;
arch/arm/boot/dts/omap5-igep0050.dts+26−0
@@ -35,6 +35,22 @@ · 34 unmodified lines
3535 };
3636 };
3737
38+/* LDO4 is VPP1 - ball AD9 */
39+&ldo4_reg {
40+ regulator-min-microvolt = <2000000>;
41+ regulator-max-microvolt = <2000000>;
42+};
43+
44+/*
45+ * LDO7 is used for HDMI: VDDA_DSIPORTA - ball AA33, VDDA_DSIPORTC - ball AE33,
46+ * VDDA_HDMI - ball AN25
47+ */
48+&ldo7_reg {
49+ status = "okay";
50+ regulator-min-microvolt = <1800000>;
51+ regulator-max-microvolt = <1800000>;
52+};
53+
3854 &omap5_pmx_core {
3955 i2c4_pins: pinmux_i2c4_pins {
4056 pinctrl-single,pins = <
@@ -52,3 +68,13 @@ · 11 unmodified lines
5268 <&gpio7 3 0>; /* 195, SDA */
5369 };
5470
71+&twl6040 {
72+ ti,audpwron-gpio = <&gpio5 16 GPIO_ACTIVE_HIGH>; /* gpio line 144 */
73+};
74+
75+&twl6040_pins {
76+ pinctrl-single,pins = <
77+ OMAP5_IOPAD(0x1c4, PIN_OUTPUT | MUX_MODE6) /* mcspi1_somi.gpio5_144 */
78+ OMAP5_IOPAD(0x1ca, PIN_OUTPUT | MUX_MODE6) /* perslimbus2_clock.gpio5_145 */
79+ >;
80+};
arch/arm/boot/dts/omap5-uevm.dts+10−0
@@ -51,3 +51,13 @@ · 50 unmodified lines
5151 <&gpio9 1 GPIO_ACTIVE_HIGH>, /* TCA6424A P00, LS OE */
5252 <&gpio7 1 GPIO_ACTIVE_HIGH>; /* GPIO 193, HPD */
5353 };
54+
55+&twl6040 {
56+ ti,audpwron-gpio = <&gpio5 13 GPIO_ACTIVE_HIGH>; /* gpio line 141 */
57+};
58+
59+&twl6040_pins {
60+ pinctrl-single,pins = <
61+ OMAP5_IOPAD(0x1be, PIN_OUTPUT | MUX_MODE6) /* mcspi1_somi.gpio5_141 */
62+ >;
63+};
arch/arm/boot/dts/socfpga_cyclone5_vining_fpga.dts+1−0
@@ -136,6 +136,7 @@ · 135 unmodified lines
136136 &gmac1 {
137137 status = "okay";
138138 phy-mode = "rgmii";
139+ phy-handle = <&phy1>;
139140
140141 snps,reset-gpio = <&porta 0 GPIO_ACTIVE_LOW>;
141142 snps,reset-active-low;
arch/arm/boot/dts/stih407-family.dtsi+3−0
@@ -24,18 +24,21 @@ · 23 unmodified lines
2424 compatible = "shared-dma-pool";
2525 reg = <0x40000000 0x01000000>;
2626 no-map;
27+ status = "disabled";
2728 };
2829
2930 gp1_reserved: rproc@41000000 {
3031 compatible = "shared-dma-pool";
3132 reg = <0x41000000 0x01000000>;
3233 no-map;
34+ status = "disabled";
3335 };
3436
3537 audio_reserved: rproc@42000000 {
3638 compatible = "shared-dma-pool";
3739 reg = <0x42000000 0x01000000>;
3840 no-map;
41+ status = "disabled";
3942 };
4043
4144 dmu_reserved: rproc@43000000 {
arch/arm/boot/dts/sun6i-a31s-primo81.dts+0−2
@@ -176,8 +176,6 @@ · 175 unmodified lines
176176 };
177177
178178 &reg_dc1sw {
179− regulator-min-microvolt = <3000000>;
180− regulator-max-microvolt = <3000000>;
181179 regulator-name = "vcc-lcd";
182180 };
183181
arch/arm/boot/dts/sun6i-a31s-yones-toptech-bs1078-v2.dts+0−2
@@ -135,8 +135,6 @@ · 134 unmodified lines
135135
136136 &reg_dc1sw {
137137 regulator-name = "vcc-lcd-usb2";
138− regulator-min-microvolt = <3000000>;
139− regulator-max-microvolt = <3000000>;
140138 };
141139
142140 &reg_dc5ldo {
arch/arm/configs/exynos_defconfig+1−0
@@ -82,6 +82,7 @@ CONFIG_TOUCHSCREEN_MMS114=y · 81 unmodified lines
8282 CONFIG_INPUT_MISC=y
8383 CONFIG_INPUT_MAX77693_HAPTIC=y
8484 CONFIG_INPUT_MAX8997_HAPTIC=y
85+CONFIG_KEYBOARD_SAMSUNG=y
8586 CONFIG_SERIAL_8250=y
8687 CONFIG_SERIAL_SAMSUNG=y
8788 CONFIG_SERIAL_SAMSUNG_CONSOLE=y
arch/arm/configs/multi_v7_defconfig+1−0
@@ -264,6 +264,7 @@ CONFIG_KEYBOARD_TEGRA=y · 263 unmodified lines
264264 CONFIG_KEYBOARD_SPEAR=y
265265 CONFIG_KEYBOARD_ST_KEYSCAN=y
266266 CONFIG_KEYBOARD_CROS_EC=m
267+CONFIG_KEYBOARD_SAMSUNG=m
267268 CONFIG_MOUSE_PS2_ELANTECH=y
268269 CONFIG_MOUSE_CYAPA=m
269270 CONFIG_MOUSE_ELAN_I2C=y
arch/arm/include/asm/pgtable-2level.h+1−0
@@ -193,6 +193,7 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr) · 192 unmodified lines
193193
194194 #define pmd_large(pmd) (pmd_val(pmd) & 2)
195195 #define pmd_bad(pmd) (pmd_val(pmd) & 2)
196+#define pmd_present(pmd) (pmd_val(pmd))
196197
197198 #define copy_pmd(pmdpd,pmdps) \
198199 do { \
arch/arm/include/asm/pgtable-3level.h+3−2
@@ -211,6 +211,7 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr) · 210 unmodified lines
211211 : !!(pmd_val(pmd) & (val)))
212212 #define pmd_isclear(pmd, val) (!(pmd_val(pmd) & (val)))
213213
214+#define pmd_present(pmd) (pmd_isset((pmd), L_PMD_SECT_VALID))
214215 #define pmd_young(pmd) (pmd_isset((pmd), PMD_SECT_AF))
215216 #define pte_special(pte) (pte_isset((pte), L_PTE_SPECIAL))
216217 static inline pte_t pte_mkspecial(pte_t pte)
@@ -249,10 +250,10 @@ PMD_BIT_FUNC(mkyoung, |= PMD_SECT_AF); · 32 unmodified lines
249250 #define pfn_pmd(pfn,prot) (__pmd(((phys_addr_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot)))
250251 #define mk_pmd(page,prot) pfn_pmd(page_to_pfn(page),prot)
251252
252−/* represent a notpresent pmd by zero, this is used by pmdp_invalidate */
253+/* represent a notpresent pmd by faulting entry, this is used by pmdp_invalidate */
253254 static inline pmd_t pmd_mknotpresent(pmd_t pmd)
254255 {
255− return __pmd(0);
256+ return __pmd(pmd_val(pmd) & ~L_PMD_SECT_VALID);
256257 }
257258
258259 static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
arch/arm/include/asm/pgtable.h+0−1
@@ -182,7 +182,6 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; · 181 unmodified lines
182182 #define pgd_offset_k(addr) pgd_offset(&init_mm, addr)
183183
184184 #define pmd_none(pmd) (!pmd_val(pmd))
185−#define pmd_present(pmd) (pmd_val(pmd))
186185
187186 static inline pte_t *pmd_page_vaddr(pmd_t pmd)
188187 {
arch/arm/kernel/smp.c+1−1
@@ -486,7 +486,7 @@ static const char *ipi_types[NR_IPI] __tracepoint_string = { · 485 unmodified lines
486486
487487 static void smp_cross_call(const struct cpumask *target, unsigned int ipinr)
488488 {
489− trace_ipi_raise(target, ipi_types[ipinr]);
489+ trace_ipi_raise_rcuidle(target, ipi_types[ipinr]);
490490 __smp_cross_call(target, ipinr);
491491 }
492492
arch/arm/mach-exynos/Kconfig+0−1
@@ -61,7 +61,6 @@ config ARCH_EXYNOS4 · 60 unmodified lines
6161 select CLKSRC_SAMSUNG_PWM if CPU_EXYNOS4210
6262 select CPU_EXYNOS4210
6363 select GIC_NON_BANKED
64− select KEYBOARD_SAMSUNG if INPUT_KEYBOARD
6564 select MIGHT_HAVE_CACHE_L2X0
6665 help
6766 Samsung EXYNOS4 (Cortex-A9) SoC based systems
arch/arm/mach-imx/mach-imx6ul.c+1−1
@@ -46,7 +46,7 @@ static int ksz8081_phy_fixup(struct phy_device *dev) · 45 unmodified lines
4646 static void __init imx6ul_enet_phy_init(void)
4747 {
4848 if (IS_BUILTIN(CONFIG_PHYLIB))
49− phy_register_fixup_for_uid(PHY_ID_KSZ8081, 0xffffffff,
49+ phy_register_fixup_for_uid(PHY_ID_KSZ8081, MICREL_PHY_ID_MASK,
5050 ksz8081_phy_fixup);
5151 }
5252
arch/arm/mach-omap1/ams-delta-fiq-handler.S+3−3
@@ -43,8 +43,8 @@ · 42 unmodified lines
4343 #define OTHERS_MASK (MODEM_IRQ_MASK | HOOK_SWITCH_MASK)
4444
4545 /* IRQ handler register bitmasks */
46−#define DEFERRED_FIQ_MASK (0x1 << (INT_DEFERRED_FIQ % IH2_BASE))
47−#define GPIO_BANK1_MASK (0x1 << INT_GPIO_BANK1)
46+#define DEFERRED_FIQ_MASK OMAP_IRQ_BIT(INT_DEFERRED_FIQ)
47+#define GPIO_BANK1_MASK OMAP_IRQ_BIT(INT_GPIO_BANK1)
4848
4949 /* Driver buffer byte offsets */
5050 #define BUF_MASK (FIQ_MASK * 4)
@@ -110,7 +110,7 @@ ENTRY(qwerty_fiqin_start) · 59 unmodified lines
110110 mov r8, #2 @ reset FIQ agreement
111111 str r8, [r12, #IRQ_CONTROL_REG_OFFSET]
112112
113− cmp r10, #INT_GPIO_BANK1 @ is it GPIO bank interrupt?
113+ cmp r10, #(INT_GPIO_BANK1 - NR_IRQS_LEGACY) @ is it GPIO interrupt?
114114 beq gpio @ yes - process it
115115
116116 mov r8, #1
arch/arm/mach-omap1/ams-delta-fiq.c+3−2
@@ -109,7 +109,8 @@ void __init ams_delta_init_fiq(void) · 108 unmodified lines
109109 * Since no set_type() method is provided by OMAP irq chip,
110110 * switch to edge triggered interrupt type manually.
111111 */
112− offset = IRQ_ILR0_REG_OFFSET + INT_DEFERRED_FIQ * 0x4;
112+ offset = IRQ_ILR0_REG_OFFSET +
113+ ((INT_DEFERRED_FIQ - NR_IRQS_LEGACY) & 0x1f) * 0x4;
113114 val = omap_readl(DEFERRED_FIQ_IH_BASE + offset) & ~(1 << 1);
114115 omap_writel(val, DEFERRED_FIQ_IH_BASE + offset);
115116
@@ -149,7 +150,7 @@ void __init ams_delta_init_fiq(void) · 33 unmodified lines
149150 /*
150151 * Redirect GPIO interrupts to FIQ
151152 */
152− offset = IRQ_ILR0_REG_OFFSET + INT_GPIO_BANK1 * 0x4;
153+ offset = IRQ_ILR0_REG_OFFSET + (INT_GPIO_BANK1 - NR_IRQS_LEGACY) * 0x4;
153154 val = omap_readl(OMAP_IH1_BASE + offset) | 1;
154155 omap_writel(val, OMAP_IH1_BASE + offset);
155156 }
arch/arm/mach-omap1/include/mach/ams-delta-fiq.h+2−0
@@ -14,6 +14,8 @@ · 13 unmodified lines
1414 #ifndef __AMS_DELTA_FIQ_H
1515 #define __AMS_DELTA_FIQ_H
1616
17+#include <mach/irqs.h>
18+
1719 /*
1820 * Interrupt number used for passing control from FIQ to IRQ.
1921 * IRQ12, described as reserved, has been selected.
arch/arm/mach-omap2/Kconfig+12−0
@@ -17,6 +17,7 @@ config ARCH_OMAP3 · 16 unmodified lines
1717 select PM_OPP if PM
1818 select PM if CPU_IDLE
1919 select SOC_HAS_OMAP2_SDRC
20+ select ARM_ERRATA_430973
2021
2122 config ARCH_OMAP4
2223 bool "TI OMAP4"
@@ -36,6 +37,7 @@ config ARCH_OMAP4 · 13 unmodified lines
3637 select PM if CPU_IDLE
3738 select ARM_ERRATA_754322
3839 select ARM_ERRATA_775420
40+ select OMAP_INTERCONNECT
3941
4042 config SOC_OMAP5
4143 bool "TI OMAP5"
@@ -67,6 +69,8 @@ config SOC_AM43XX · 25 unmodified lines
6769 select HAVE_ARM_SCU
6870 select GENERIC_CLOCKEVENTS_BROADCAST
6971 select HAVE_ARM_TWD
72+ select ARM_ERRATA_754322
73+ select ARM_ERRATA_775420
7074
7175 config SOC_DRA7XX
7276 bool "TI DRA7XX"
@@ -240,4 +244,12 @@ endmenu · 167 unmodified lines
240244
241245 endif
242246
247+config OMAP5_ERRATA_801819
248+ bool "Errata 801819: An eviction from L1 data cache might stall indefinitely"
249+ depends on SOC_OMAP5 || SOC_DRA7XX
250+ help
251+ A livelock can occur in the L2 cache arbitration that might prevent
252+ a snoop from completing. Under certain conditions this can cause the
253+ system to deadlock.
254+
243255 endmenu
arch/arm/mach-omap2/omap-secure.h+1−0
@@ -46,6 +46,7 @@ · 45 unmodified lines
4646
4747 #define OMAP5_DRA7_MON_SET_CNTFRQ_INDEX 0x109
4848 #define OMAP5_MON_AMBA_IF_INDEX 0x108
49+#define OMAP5_DRA7_MON_SET_ACR_INDEX 0x107
4950
5051 /* Secure PPA(Primary Protected Application) APIs */
5152 #define OMAP4_PPA_L2_POR_INDEX 0x23
arch/arm/mach-omap2/omap-smp.c+43−5
@@ -50,6 +50,39 @@ void __iomem *omap4_get_scu_base(void) · 49 unmodified lines
5050 return scu_base;
5151 }
5252
53+#ifdef CONFIG_OMAP5_ERRATA_801819
54+void omap5_erratum_workaround_801819(void)
55+{
56+ u32 acr, revidr;
57+ u32 acr_mask;
58+
59+ /* REVIDR[3] indicates erratum fix available on silicon */
60+ asm volatile ("mrc p15, 0, %0, c0, c0, 6" : "=r" (revidr));
61+ if (revidr & (0x1 << 3))
62+ return;
63+
64+ asm volatile ("mrc p15, 0, %0, c1, c0, 1" : "=r" (acr));
65+ /*
66+ * BIT(27) - Disables streaming. All write-allocate lines allocate in
67+ * the L1 or L2 cache.
68+ * BIT(25) - Disables streaming. All write-allocate lines allocate in
69+ * the L1 cache.
70+ */
71+ acr_mask = (0x3 << 25) | (0x3 << 27);
72+ /* do we already have it done.. if yes, skip expensive smc */
73+ if ((acr & acr_mask) == acr_mask)
74+ return;
75+
76+ acr |= acr_mask;
77+ omap_smc1(OMAP5_DRA7_MON_SET_ACR_INDEX, acr);
78+
79+ pr_debug("%s: ARM erratum workaround 801819 applied on CPU%d\n",
80+ __func__, smp_processor_id());
81+}
82+#else
83+static inline void omap5_erratum_workaround_801819(void) { }
84+#endif
85+
5386 static void omap4_secondary_init(unsigned int cpu)
5487 {
5588 /*
@@ -64,12 +97,15 @@ static void omap4_secondary_init(unsigned int cpu) · 8 unmodified lines
6497 omap_secure_dispatcher(OMAP4_PPA_CPU_ACTRL_SMP_INDEX,
6598 4, 0, 0, 0, 0, 0);
6699
67− /*
68− * Configure the CNTFRQ register for the secondary cpu's which
69− * indicates the frequency of the cpu local timers.
70− */
71− if (soc_is_omap54xx() || soc_is_dra7xx())
100+ if (soc_is_omap54xx() || soc_is_dra7xx()) {
101+ /*
102+ * Configure the CNTFRQ register for the secondary cpu's which
103+ * indicates the frequency of the cpu local timers.
104+ */
72105 set_cntfreq();
106+ /* Configure ACR to disable streaming WA for 801819 */
107+ omap5_erratum_workaround_801819();
108+ }
73109
74110 /*
75111 * Synchronise with the boot thread.
@@ -218,6 +254,8 @@ static void __init omap4_smp_prepare_cpus(unsigned int max_cpus) · 142 unmodified lines
218254
219255 if (cpu_is_omap446x())
220256 startup_addr = omap4460_secondary_startup;
257+ if (soc_is_dra74x() || soc_is_omap54xx())
258+ omap5_erratum_workaround_801819();
221259
222260 /*
223261 * Write the address of secondary startup routine into the
arch/arm/mach-omap2/powerdomain.c+5−4
@@ -186,8 +186,9 @@ static int _pwrdm_state_switch(struct powerdomain *pwrdm, int flag) · 185 unmodified lines
186186 trace_state = (PWRDM_TRACE_STATES_FLAG |
187187 ((next & OMAP_POWERSTATE_MASK) << 8) |
188188 ((prev & OMAP_POWERSTATE_MASK) << 0));
189− trace_power_domain_target(pwrdm->name, trace_state,
190− smp_processor_id());
189+ trace_power_domain_target_rcuidle(pwrdm->name,
190+ trace_state,
191+ smp_processor_id());
191192 }
192193 break;
193194 default:
@@ -523,8 +524,8 @@ int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst) · 329 unmodified lines
523524
524525 if (arch_pwrdm && arch_pwrdm->pwrdm_set_next_pwrst) {
525526 /* Trace the pwrdm desired target state */
526− trace_power_domain_target(pwrdm->name, pwrst,
527− smp_processor_id());
527+ trace_power_domain_target_rcuidle(pwrdm->name, pwrst,
528+ smp_processor_id());
528529 /* Program the pwrdm desired target state */
529530 ret = arch_pwrdm->pwrdm_set_next_pwrst(pwrdm, pwrst);
530531 }
arch/arm/mach-omap2/powerdomains7xx_data.c+2−74
@@ -36,14 +36,7 @@ static struct powerdomain iva_7xx_pwrdm = { · 35 unmodified lines
3636 .prcm_offs = DRA7XX_PRM_IVA_INST,
3737 .prcm_partition = DRA7XX_PRM_PARTITION,
3838 .pwrsts = PWRSTS_OFF_ON,
39− .pwrsts_logic_ret = PWRSTS_OFF,
4039 .banks = 4,
41− .pwrsts_mem_ret = {
42− [0] = PWRSTS_OFF_RET, /* hwa_mem */
43− [1] = PWRSTS_OFF_RET, /* sl2_mem */
44− [2] = PWRSTS_OFF_RET, /* tcm1_mem */
45− [3] = PWRSTS_OFF_RET, /* tcm2_mem */
46− },
4740 .pwrsts_mem_on = {
4841 [0] = PWRSTS_ON, /* hwa_mem */
4942 [1] = PWRSTS_ON, /* sl2_mem */
@@ -76,12 +69,7 @@ static struct powerdomain ipu_7xx_pwrdm = { · 26 unmodified lines
7669 .prcm_offs = DRA7XX_PRM_IPU_INST,
7770 .prcm_partition = DRA7XX_PRM_PARTITION,
7871 .pwrsts = PWRSTS_OFF_ON,
79− .pwrsts_logic_ret = PWRSTS_OFF,
8072 .banks = 2,
81− .pwrsts_mem_ret = {
82− [0] = PWRSTS_OFF_RET, /* aessmem */
83− [1] = PWRSTS_OFF_RET, /* periphmem */
84− },
8573 .pwrsts_mem_on = {
8674 [0] = PWRSTS_ON, /* aessmem */
8775 [1] = PWRSTS_ON, /* periphmem */
@@ -95,11 +83,7 @@ static struct powerdomain dss_7xx_pwrdm = { · 7 unmodified lines
9583 .prcm_offs = DRA7XX_PRM_DSS_INST,
9684 .prcm_partition = DRA7XX_PRM_PARTITION,
9785 .pwrsts = PWRSTS_OFF_ON,
98− .pwrsts_logic_ret = PWRSTS_OFF,
9986 .banks = 1,
100− .pwrsts_mem_ret = {
101− [0] = PWRSTS_OFF_RET, /* dss_mem */
102− },
10387 .pwrsts_mem_on = {
10488 [0] = PWRSTS_ON, /* dss_mem */
10589 },
@@ -111,13 +95,8 @@ static struct powerdomain l4per_7xx_pwrdm = { · 5 unmodified lines
11195 .name = "l4per_pwrdm",
11296 .prcm_offs = DRA7XX_PRM_L4PER_INST,
11397 .prcm_partition = DRA7XX_PRM_PARTITION,
114− .pwrsts = PWRSTS_RET_ON,
115− .pwrsts_logic_ret = PWRSTS_RET,
98+ .pwrsts = PWRSTS_ON,
11699 .banks = 2,
117− .pwrsts_mem_ret = {
118− [0] = PWRSTS_OFF_RET, /* nonretained_bank */
119− [1] = PWRSTS_OFF_RET, /* retained_bank */
120− },
121100 .pwrsts_mem_on = {
122101 [0] = PWRSTS_ON, /* nonretained_bank */
123102 [1] = PWRSTS_ON, /* retained_bank */
@@ -132,9 +111,6 @@ static struct powerdomain gpu_7xx_pwrdm = { · 8 unmodified lines
132111 .prcm_partition = DRA7XX_PRM_PARTITION,
133112 .pwrsts = PWRSTS_OFF_ON,
134113 .banks = 1,
135− .pwrsts_mem_ret = {
136− [0] = PWRSTS_OFF_RET, /* gpu_mem */
137− },
138114 .pwrsts_mem_on = {
139115 [0] = PWRSTS_ON, /* gpu_mem */
140116 },
@@ -148,8 +124,6 @@ static struct powerdomain wkupaon_7xx_pwrdm = { · 7 unmodified lines
148124 .prcm_partition = DRA7XX_PRM_PARTITION,
149125 .pwrsts = PWRSTS_ON,
150126 .banks = 1,
151− .pwrsts_mem_ret = {
152− },
153127 .pwrsts_mem_on = {
154128 [0] = PWRSTS_ON, /* wkup_bank */
155129 },
@@ -161,15 +135,7 @@ static struct powerdomain core_7xx_pwrdm = { · 5 unmodified lines
161135 .prcm_offs = DRA7XX_PRM_CORE_INST,
162136 .prcm_partition = DRA7XX_PRM_PARTITION,
163137 .pwrsts = PWRSTS_ON,
164− .pwrsts_logic_ret = PWRSTS_RET,
165138 .banks = 5,
166− .pwrsts_mem_ret = {
167− [0] = PWRSTS_OFF_RET, /* core_nret_bank */
168− [1] = PWRSTS_OFF_RET, /* core_ocmram */
169− [2] = PWRSTS_OFF_RET, /* core_other_bank */
170− [3] = PWRSTS_OFF_RET, /* ipu_l2ram */
171− [4] = PWRSTS_OFF_RET, /* ipu_unicache */
172− },
173139 .pwrsts_mem_on = {
174140 [0] = PWRSTS_ON, /* core_nret_bank */
175141 [1] = PWRSTS_ON, /* core_ocmram */
@@ -226,11 +192,7 @@ static struct powerdomain vpe_7xx_pwrdm = { · 50 unmodified lines
226192 .prcm_offs = DRA7XX_PRM_VPE_INST,
227193 .prcm_partition = DRA7XX_PRM_PARTITION,
228194 .pwrsts = PWRSTS_OFF_ON,
229− .pwrsts_logic_ret = PWRSTS_OFF,
230195 .banks = 1,
231− .pwrsts_mem_ret = {
232− [0] = PWRSTS_OFF_RET, /* vpe_bank */
233− },
234196 .pwrsts_mem_on = {
235197 [0] = PWRSTS_ON, /* vpe_bank */
236198 },
@@ -260,14 +222,8 @@ static struct powerdomain l3init_7xx_pwrdm = { · 23 unmodified lines
260222 .name = "l3init_pwrdm",
261223 .prcm_offs = DRA7XX_PRM_L3INIT_INST,
262224 .prcm_partition = DRA7XX_PRM_PARTITION,
263− .pwrsts = PWRSTS_RET_ON,
264− .pwrsts_logic_ret = PWRSTS_RET,
225+ .pwrsts = PWRSTS_ON,
265226 .banks = 3,
266− .pwrsts_mem_ret = {
267− [0] = PWRSTS_OFF_RET, /* gmac_bank */
268− [1] = PWRSTS_OFF_RET, /* l3init_bank1 */
269− [2] = PWRSTS_OFF_RET, /* l3init_bank2 */
270− },
271227 .pwrsts_mem_on = {
272228 [0] = PWRSTS_ON, /* gmac_bank */
273229 [1] = PWRSTS_ON, /* l3init_bank1 */
@@ -283,9 +239,6 @@ static struct powerdomain eve3_7xx_pwrdm = { · 9 unmodified lines
283239 .prcm_partition = DRA7XX_PRM_PARTITION,
284240 .pwrsts = PWRSTS_OFF_ON,
285241 .banks = 1,
286− .pwrsts_mem_ret = {
287− [0] = PWRSTS_OFF_RET, /* eve3_bank */
288− },
289242 .pwrsts_mem_on = {
290243 [0] = PWRSTS_ON, /* eve3_bank */
291244 },
@@ -299,9 +252,6 @@ static struct powerdomain emu_7xx_pwrdm = { · 7 unmodified lines
299252 .prcm_partition = DRA7XX_PRM_PARTITION,
300253 .pwrsts = PWRSTS_OFF_ON,
301254 .banks = 1,
302− .pwrsts_mem_ret = {
303− [0] = PWRSTS_OFF_RET, /* emu_bank */
304− },
305255 .pwrsts_mem_on = {
306256 [0] = PWRSTS_ON, /* emu_bank */
307257 },
@@ -314,11 +264,6 @@ static struct powerdomain dsp2_7xx_pwrdm = { · 6 unmodified lines
314264 .prcm_partition = DRA7XX_PRM_PARTITION,
315265 .pwrsts = PWRSTS_OFF_ON,
316266 .banks = 3,
317− .pwrsts_mem_ret = {
318− [0] = PWRSTS_OFF_RET, /* dsp2_edma */
319− [1] = PWRSTS_OFF_RET, /* dsp2_l1 */
320− [2] = PWRSTS_OFF_RET, /* dsp2_l2 */
321− },
322267 .pwrsts_mem_on = {
323268 [0] = PWRSTS_ON, /* dsp2_edma */
324269 [1] = PWRSTS_ON, /* dsp2_l1 */
@@ -334,11 +279,6 @@ static struct powerdomain dsp1_7xx_pwrdm = { · 9 unmodified lines
334279 .prcm_partition = DRA7XX_PRM_PARTITION,
335280 .pwrsts = PWRSTS_OFF_ON,
336281 .banks = 3,
337− .pwrsts_mem_ret = {
338− [0] = PWRSTS_OFF_RET, /* dsp1_edma */
339− [1] = PWRSTS_OFF_RET, /* dsp1_l1 */
340− [2] = PWRSTS_OFF_RET, /* dsp1_l2 */
341− },
342282 .pwrsts_mem_on = {
343283 [0] = PWRSTS_ON, /* dsp1_edma */
344284 [1] = PWRSTS_ON, /* dsp1_l1 */
@@ -354,9 +294,6 @@ static struct powerdomain cam_7xx_pwrdm = { · 9 unmodified lines
354294 .prcm_partition = DRA7XX_PRM_PARTITION,
355295 .pwrsts = PWRSTS_OFF_ON,
356296 .banks = 1,
357− .pwrsts_mem_ret = {
358− [0] = PWRSTS_OFF_RET, /* vip_bank */
359− },
360297 .pwrsts_mem_on = {
361298 [0] = PWRSTS_ON, /* vip_bank */
362299 },
@@ -370,9 +307,6 @@ static struct powerdomain eve4_7xx_pwrdm = { · 7 unmodified lines
370307 .prcm_partition = DRA7XX_PRM_PARTITION,
371308 .pwrsts = PWRSTS_OFF_ON,
372309 .banks = 1,
373− .pwrsts_mem_ret = {
374− [0] = PWRSTS_OFF_RET, /* eve4_bank */
375− },
376310 .pwrsts_mem_on = {
377311 [0] = PWRSTS_ON, /* eve4_bank */
378312 },
@@ -386,9 +320,6 @@ static struct powerdomain eve2_7xx_pwrdm = { · 7 unmodified lines
386320 .prcm_partition = DRA7XX_PRM_PARTITION,
387321 .pwrsts = PWRSTS_OFF_ON,
388322 .banks = 1,
389− .pwrsts_mem_ret = {
390− [0] = PWRSTS_OFF_RET, /* eve2_bank */
391− },
392323 .pwrsts_mem_on = {
393324 [0] = PWRSTS_ON, /* eve2_bank */
394325 },
@@ -402,9 +333,6 @@ static struct powerdomain eve1_7xx_pwrdm = { · 7 unmodified lines
402333 .prcm_partition = DRA7XX_PRM_PARTITION,
403334 .pwrsts = PWRSTS_OFF_ON,
404335 .banks = 1,
405− .pwrsts_mem_ret = {
406− [0] = PWRSTS_OFF_RET, /* eve1_bank */
407− },
408336 .pwrsts_mem_on = {
409337 [0] = PWRSTS_ON, /* eve1_bank */
410338 },
arch/arm/mach-omap2/timer.c+5−2
@@ -496,8 +496,7 @@ void __init omap_init_time(void) · 495 unmodified lines
496496 __omap_sync32k_timer_init(1, "timer_32k_ck", "ti,timer-alwon",
497497 2, "timer_sys_ck", NULL, false);
498498
499− if (of_have_populated_dt())
500− clocksource_probe();
499+ clocksource_probe();
501500 }
502501
503502 #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_SOC_AM43XX)
@@ -505,6 +504,8 @@ void __init omap3_secure_sync32k_timer_init(void) · 1 unmodified line
505504 {
506505 __omap_sync32k_timer_init(12, "secure_32k_fck", "ti,timer-secure",
507506 2, "timer_sys_ck", NULL, false);
507+
508+ clocksource_probe();
508509 }
509510 #endif /* CONFIG_ARCH_OMAP3 */
510511
@@ -513,6 +514,8 @@ void __init omap3_gptimer_timer_init(void) · 2 unmodified lines
513514 {
514515 __omap_sync32k_timer_init(2, "timer_sys_ck", NULL,
515516 1, "timer_sys_ck", "ti,timer-alwon", true);
517+
518+ clocksource_probe();
516519 }
517520 #endif
518521
arch/arm/mach-vexpress/spc.c+1−1
@@ -547,7 +547,7 @@ static struct clk *ve_spc_clk_register(struct device *cpu_dev) · 546 unmodified lines
547547
548548 init.name = dev_name(cpu_dev);
549549 init.ops = &clk_spc_ops;
550− init.flags = CLK_IS_ROOT | CLK_GET_RATE_NOCACHE;
550+ init.flags = CLK_GET_RATE_NOCACHE;
551551 init.num_parents = 0;
552552
553553 return devm_clk_register(cpu_dev, &spc->hw);
arch/arm/plat-samsung/devs.c+1−1
@@ -68,7 +68,7 @@ · 67 unmodified lines
6868 #include <linux/platform_data/asoc-s3c.h>
6969 #include <linux/platform_data/spi-s3c64xx.h>
7070
71−static u64 samsung_device_dma_mask = DMA_BIT_MASK(32);
71+#define samsung_device_dma_mask (*((u64[]) { DMA_BIT_MASK(32) }))
7272
7373 /* AC97 */
7474 #ifdef CONFIG_CPU_S3C2440
arch/arm64/boot/dts/lg/lg1312.dtsi+1−1
@@ -125,7 +125,7 @@ · 124 unmodified lines
125125 #size-cells = <1>;
126126 #interrupts-cells = <3>;
127127
128− compatible = "arm,amba-bus";
128+ compatible = "simple-bus";
129129 interrupt-parent = <&gic>;
130130 ranges;
131131
arch/arm64/boot/dts/rockchip/rk3399.dtsi+1−1
@@ -163,7 +163,7 @@ · 162 unmodified lines
163163 };
164164
165165 amba {
166− compatible = "arm,amba-bus";
166+ compatible = "simple-bus";
167167 #address-cells = <2>;
168168 #size-cells = <2>;
169169 ranges;
arch/arm64/include/asm/kgdb.h+37−8
@@ -38,25 +38,54 @@ extern int kgdb_fault_expected; · 37 unmodified lines
3838 #endif /* !__ASSEMBLY__ */
3939
4040 /*
41− * gdb is expecting the following registers layout.
41+ * gdb remote procotol (well most versions of it) expects the following
42+ * register layout.
4243 *
4344 * General purpose regs:
4445 * r0-r30: 64 bit
4546 * sp,pc : 64 bit
46− * pstate : 64 bit
47− * Total: 34
47+ * pstate : 32 bit
48+ * Total: 33 + 1
4849 * FPU regs:
4950 * f0-f31: 128 bit
50− * Total: 32
51− * Extra regs
5251 * fpsr & fpcr: 32 bit
53− * Total: 2
52+ * Total: 32 + 2
5453 *
54+ * To expand a little on the "most versions of it"... when the gdb remote
55+ * protocol for AArch64 was developed it depended on a statement in the
56+ * Architecture Reference Manual that claimed "SPSR_ELx is a 32-bit register".
57+ * and, as a result, allocated only 32-bits for the PSTATE in the remote
58+ * protocol. In fact this statement is still present in ARM DDI 0487A.i.
59+ *
60+ * Unfortunately "is a 32-bit register" has a very special meaning for
61+ * system registers. It means that "the upper bits, bits[63:32], are
62+ * RES0.". RES0 is heavily used in the ARM architecture documents as a
63+ * way to leave space for future architecture changes. So to translate a
64+ * little for people who don't spend their spare time reading ARM architecture
65+ * manuals, what "is a 32-bit register" actually means in this context is
66+ * "is a 64-bit register but one with no meaning allocated to any of the
67+ * upper 32-bits... *yet*".
68+ *
69+ * Perhaps then we should not be surprised that this has led to some
70+ * confusion. Specifically a patch, influenced by the above translation,
71+ * that extended PSTATE to 64-bit was accepted into gdb-7.7 but the patch
72+ * was reverted in gdb-7.8.1 and all later releases, when this was
73+ * discovered to be an undocumented protocol change.
74+ *
75+ * So... it is *not* wrong for us to only allocate 32-bits to PSTATE
76+ * here even though the kernel itself allocates 64-bits for the same
77+ * state. That is because this bit of code tells the kernel how the gdb
78+ * remote protocol (well most versions of it) describes the register state.
79+ *
80+ * Note that if you are using one of the versions of gdb that supports
81+ * the gdb-7.7 version of the protocol you cannot use kgdb directly
82+ * without providing a custom register description (gdb can load new
83+ * protocol descriptions at runtime).
5584 */
5685
57−#define _GP_REGS 34
86+#define _GP_REGS 33
5887 #define _FP_REGS 32
59−#define _EXTRA_REGS 2
88+#define _EXTRA_REGS 3
6089 /*
6190 * general purpose registers size in bytes.
6291 * pstate is only 4 bytes. subtract 4 bytes
arch/arm64/include/asm/spinlock.h+37−5
@@ -30,22 +30,53 @@ static inline void arch_spin_unlock_wait(arch_spinlock_t *lock) · 29 unmodified lines
3030 {
3131 unsigned int tmp;
3232 arch_spinlock_t lockval;
33+ u32 owner;
34+
35+ /*
36+ * Ensure prior spin_lock operations to other locks have completed
37+ * on this CPU before we test whether "lock" is locked.
38+ */
39+ smp_mb();
40+ owner = READ_ONCE(lock->owner) << 16;
3341
3442 asm volatile(
3543 " sevl\n"
3644 "1: wfe\n"
3745 "2: ldaxr %w0, %2\n"
46+ /* Is the lock free? */
3847 " eor %w1, %w0, %w0, ror #16\n"
39−" cbnz %w1, 1b\n"
48+" cbz %w1, 3f\n"
49+ /* Lock taken -- has there been a subsequent unlock->lock transition? */
50+" eor %w1, %w3, %w0, lsl #16\n"
51+" cbz %w1, 1b\n"
52+ /*
53+ * The owner has been updated, so there was an unlock->lock
54+ * transition that we missed. That means we can rely on the
55+ * store-release of the unlock operation paired with the
56+ * load-acquire of the lock operation to publish any of our
57+ * previous stores to the new lock owner and therefore don't
58+ * need to bother with the writeback below.
59+ */
60+" b 4f\n"
61+"3:\n"
62+ /*
63+ * Serialise against any concurrent lockers by writing back the
64+ * unlocked lock value
65+ */
4066 ARM64_LSE_ATOMIC_INSN(
4167 /* LL/SC */
4268 " stxr %w1, %w0, %2\n"
43−" cbnz %w1, 2b\n", /* Serialise against any concurrent lockers */
44− /* LSE atomics */
4569 " nop\n"
46−" nop\n")
70+" nop\n",
71+ /* LSE atomics */
72+" mov %w1, %w0\n"
73+" cas %w0, %w0, %2\n"
74+" eor %w1, %w1, %w0\n")
75+ /* Somebody else wrote to the lock, GOTO 10 and reload the value */
76+" cbnz %w1, 2b\n"
77+"4:"
4778 : "=&r" (lockval), "=&r" (tmp), "+Q" (*lock)
48− :
79+ : "r" (owner)
4980 : "memory");
5081 }
5182
@@ -148,6 +179,7 @@ static inline int arch_spin_value_unlocked(arch_spinlock_t lock) · 96 unmodified lines
148179
149180 static inline int arch_spin_is_locked(arch_spinlock_t *lock)
150181 {
182+ smp_mb(); /* See arch_spin_unlock_wait */
151183 return !arch_spin_value_unlocked(READ_ONCE(*lock));
152184 }
153185
arch/arm64/kernel/kgdb.c+13−1
@@ -58,7 +58,17 @@ struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = { · 57 unmodified lines
5858 { "x30", 8, offsetof(struct pt_regs, regs[30])},
5959 { "sp", 8, offsetof(struct pt_regs, sp)},
6060 { "pc", 8, offsetof(struct pt_regs, pc)},
61− { "pstate", 8, offsetof(struct pt_regs, pstate)},
61+ /*
62+ * struct pt_regs thinks PSTATE is 64-bits wide but gdb remote
63+ * protocol disagrees. Therefore we must extract only the lower
64+ * 32-bits. Look for the big comment in asm/kgdb.h for more
65+ * detail.
66+ */
67+ { "pstate", 4, offsetof(struct pt_regs, pstate)
68+#ifdef CONFIG_CPU_BIG_ENDIAN
69+ + 4
70+#endif
71+ },
6272 { "v0", 16, -1 },
6373 { "v1", 16, -1 },
6474 { "v2", 16, -1 },
@@ -128,6 +138,8 @@ sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *task) · 63 unmodified lines
128138 memset((char *)gdb_regs, 0, NUMREGBYTES);
129139 thread_regs = task_pt_regs(task);
130140 memcpy((void *)gdb_regs, (void *)thread_regs->regs, GP_REG_BYTES);
141+ /* Special case for PSTATE (check comments in asm/kgdb.h for details) */
142+ dbg_get_reg(33, gdb_regs + GP_REG_BYTES, thread_regs);
131143 }
132144
133145 void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc)
arch/arm64/kernel/traps.c+13−13
@@ -64,8 +64,7 @@ static void dump_mem(const char *lvl, const char *str, unsigned long bottom, · 63 unmodified lines
6464
6565 /*
6666 * We need to switch to kernel mode so that we can use __get_user
67− * to safely read from kernel space. Note that we now dump the
68− * code first, just in case the backtrace kills us.
67+ * to safely read from kernel space.
6968 */
7069 fs = get_fs();
7170 set_fs(KERNEL_DS);
@@ -111,21 +110,12 @@ static void dump_backtrace_entry(unsigned long where) · 39 unmodified lines
111110 print_ip_sym(where);
112111 }
113112
114−static void dump_instr(const char *lvl, struct pt_regs *regs)
113+static void __dump_instr(const char *lvl, struct pt_regs *regs)
115114 {
116115 unsigned long addr = instruction_pointer(regs);
117− mm_segment_t fs;
118116 char str[sizeof("00000000 ") * 5 + 2 + 1], *p = str;
119117 int i;
120118
121− /*
122− * We need to switch to kernel mode so that we can use __get_user
123− * to safely read from kernel space. Note that we now dump the
124− * code first, just in case the backtrace kills us.
125− */
126− fs = get_fs();
127− set_fs(KERNEL_DS);
128−
129119 for (i = -4; i < 1; i++) {
130120 unsigned int val, bad;
131121
@@ -139,8 +129,18 @@ static void dump_instr(const char *lvl, struct pt_regs *regs) · 7 unmodified lines
139129 }
140130 }
141131 printk("%sCode: %s\n", lvl, str);
132+}
142133
143− set_fs(fs);
134+static void dump_instr(const char *lvl, struct pt_regs *regs)
135+{
136+ if (!user_mode(regs)) {
137+ mm_segment_t fs = get_fs();
138+ set_fs(KERNEL_DS);
139+ __dump_instr(lvl, regs);
140+ set_fs(fs);
141+ } else {
142+ __dump_instr(lvl, regs);
143+ }
144144 }
145145
146146 static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
arch/arm64/mm/fault.c+2−2
@@ -109,7 +109,7 @@ int ptep_set_access_flags(struct vm_area_struct *vma, · 108 unmodified lines
109109 * PTE_RDONLY is cleared by default in the asm below, so set it in
110110 * back if necessary (read-only or clean PTE).
111111 */
112− if (!pte_write(entry) || !dirty)
112+ if (!pte_write(entry) || !pte_sw_dirty(entry))
113113 pte_val(entry) |= PTE_RDONLY;
114114
115115 /*
@@ -441,7 +441,7 @@ static int do_bad(unsigned long addr, unsigned int esr, struct pt_regs *regs) · 325 unmodified lines
441441 return 1;
442442 }
443443
444−static struct fault_info {
444+static const struct fault_info {
445445 int (*fn)(unsigned long addr, unsigned int esr, struct pt_regs *regs);
446446 int sig;
447447 int code;
arch/mips/include/asm/kvm_host.h+2−1
@@ -74,7 +74,7 @@ · 73 unmodified lines
7474 #define KVM_GUEST_KUSEG 0x00000000UL
7575 #define KVM_GUEST_KSEG0 0x40000000UL
7676 #define KVM_GUEST_KSEG23 0x60000000UL
77−#define KVM_GUEST_KSEGX(a) ((_ACAST32_(a)) & 0x60000000)
77+#define KVM_GUEST_KSEGX(a) ((_ACAST32_(a)) & 0xe0000000)
7878 #define KVM_GUEST_CPHYSADDR(a) ((_ACAST32_(a)) & 0x1fffffff)
7979
8080 #define KVM_GUEST_CKSEG0ADDR(a) (KVM_GUEST_CPHYSADDR(a) | KVM_GUEST_KSEG0)
@@ -338,6 +338,7 @@ struct kvm_mips_tlb { · 257 unmodified lines
338338 #define KVM_MIPS_GUEST_TLB_SIZE 64
339339 struct kvm_vcpu_arch {
340340 void *host_ebase, *guest_ebase;
341+ int (*vcpu_run)(struct kvm_run *run, struct kvm_vcpu *vcpu);
341342 unsigned long host_stack;
342343 unsigned long host_gp;
343344
arch/mips/kvm/emulate.c+13−6
@@ -1636,6 +1636,7 @@ enum emulation_result kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc, · 1635 unmodified lines
16361636 if (index < 0) {
16371637 vcpu->arch.host_cp0_entryhi = (va & VPN2_MASK);
16381638 vcpu->arch.host_cp0_badvaddr = va;
1639+ vcpu->arch.pc = curr_pc;
16391640 er = kvm_mips_emulate_tlbmiss_ld(cause, NULL, run,
16401641 vcpu);
16411642 preempt_enable();
@@ -1647,6 +1648,8 @@ enum emulation_result kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc, · 5 unmodified lines
16471648 * invalid exception to the guest
16481649 */
16491650 if (!TLB_IS_VALID(*tlb, va)) {
1651+ vcpu->arch.host_cp0_badvaddr = va;
1652+ vcpu->arch.pc = curr_pc;
16501653 er = kvm_mips_emulate_tlbinv_ld(cause, NULL,
16511654 run, vcpu);
16521655 preempt_enable();
@@ -1666,7 +1669,7 @@ enum emulation_result kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc, · 13 unmodified lines
16661669 cache, op, base, arch->gprs[base], offset);
16671670 er = EMULATE_FAIL;
16681671 preempt_enable();
1669− goto dont_update_pc;
1672+ goto done;
16701673
16711674 }
16721675
@@ -1694,16 +1697,20 @@ skip_fault: · 21 unmodified lines
16941697 kvm_err("NO-OP CACHE (cache: %#x, op: %#x, base[%d]: %#lx, offset: %#x\n",
16951698 cache, op, base, arch->gprs[base], offset);
16961699 er = EMULATE_FAIL;
1697− preempt_enable();
1698− goto dont_update_pc;
16991700 }
17001701
17011702 preempt_enable();
1703+done:
1704+ /* Rollback PC only if emulation was unsuccessful */
1705+ if (er == EMULATE_FAIL)
1706+ vcpu->arch.pc = curr_pc;
17021707
17031708 dont_update_pc:
1704− /* Rollback PC */
1705− vcpu->arch.pc = curr_pc;
1706−done:
1709+ /*
1710+ * This is for exceptions whose emulation updates the PC, so do not
1711+ * overwrite the PC under any circumstances
1712+ */
1713+
17071714 return er;
17081715 }
17091716
arch/mips/kvm/interrupt.h+1−0
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828 #define MIPS_EXC_MAX 12
2929 /* XXXSL More to follow */
3030
31+extern char __kvm_mips_vcpu_run_end[];
3132 extern char mips32_exception[], mips32_exceptionEnd[];
3233 extern char mips32_GuestException[], mips32_GuestExceptionEnd[];
3334
arch/mips/kvm/locore.S+1−0
@@ -202,6 +202,7 @@ FEXPORT(__kvm_mips_load_k0k1) · 201 unmodified lines
202202
203203 /* Jump to guest */
204204 eret
205+EXPORT(__kvm_mips_vcpu_run_end)
205206
206207 VECTOR(MIPSX(exception), unknown)
207208 /* Find out what mode we came from and jump to the proper handler. */
arch/mips/kvm/mips.c+10−1
@@ -315,6 +315,15 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) · 314 unmodified lines
315315 memcpy(gebase + offset, mips32_GuestException,
316316 mips32_GuestExceptionEnd - mips32_GuestException);
317317
318+#ifdef MODULE
319+ offset += mips32_GuestExceptionEnd - mips32_GuestException;
320+ memcpy(gebase + offset, (char *)__kvm_mips_vcpu_run,
321+ __kvm_mips_vcpu_run_end - (char *)__kvm_mips_vcpu_run);
322+ vcpu->arch.vcpu_run = gebase + offset;
323+#else
324+ vcpu->arch.vcpu_run = __kvm_mips_vcpu_run;
325+#endif
326+
318327 /* Invalidate the icache for these ranges */
319328 local_flush_icache_range((unsigned long)gebase,
320329 (unsigned long)gebase + ALIGN(size, PAGE_SIZE));
@@ -404,7 +413,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) · 83 unmodified lines
404413 /* Disable hardware page table walking while in guest */
405414 htw_stop();
406415
407− r = __kvm_mips_vcpu_run(run, vcpu);
416+ r = vcpu->arch.vcpu_run(run, vcpu);
408417
409418 /* Re-enable HTW before enabling interrupts */
410419 htw_start();
arch/powerpc/include/asm/nohash/64/pgalloc.h+1−1
@@ -172,7 +172,7 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm, · 171 unmodified lines
172172
173173 static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
174174 {
175− pte_fragment_fre((unsigned long *)pte, 1);
175+ pte_fragment_free((unsigned long *)pte, 1);
176176 }
177177
178178 static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage)
arch/powerpc/kernel/prom_init.c+1−1
@@ -719,7 +719,7 @@ unsigned char ibm_architecture_vec[] = { · 718 unmodified lines
719719 * must match by the macro below. Update the definition if
720720 * the structure layout changes.
721721 */
722−#define IBM_ARCH_VEC_NRCORES_OFFSET 125
722+#define IBM_ARCH_VEC_NRCORES_OFFSET 133
723723 W(NR_CPUS), /* number of cores supported */
724724 0,
725725 0,
arch/powerpc/kernel/ptrace.c+2−2
@@ -377,7 +377,7 @@ static int fpr_get(struct task_struct *target, const struct user_regset *regset, · 376 unmodified lines
377377
378378 #else
379379 BUILD_BUG_ON(offsetof(struct thread_fp_state, fpscr) !=
380− offsetof(struct thread_fp_state, fpr[32][0]));
380+ offsetof(struct thread_fp_state, fpr[32]));
381381
382382 return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
383383 &target->thread.fp_state, 0, -1);
@@ -405,7 +405,7 @@ static int fpr_set(struct task_struct *target, const struct user_regset *regset, · 21 unmodified lines
405405 return 0;
406406 #else
407407 BUILD_BUG_ON(offsetof(struct thread_fp_state, fpscr) !=
408− offsetof(struct thread_fp_state, fpr[32][0]));
408+ offsetof(struct thread_fp_state, fpr[32]));
409409
410410 return user_regset_copyin(&pos, &count, &kbuf, &ubuf,
411411 &target->thread.fp_state, 0, -1);
arch/powerpc/mm/hash_native_64.c+5−1
@@ -550,7 +550,11 @@ static void hpte_decode(struct hash_pte *hpte, unsigned long slot, · 549 unmodified lines
550550 }
551551 }
552552 /* This works for all page sizes, and for 256M and 1T segments */
553− *ssize = hpte_v >> HPTE_V_SSIZE_SHIFT;
553+ if (cpu_has_feature(CPU_FTR_ARCH_300))
554+ *ssize = hpte_r >> HPTE_R_3_0_SSIZE_SHIFT;
555+ else
556+ *ssize = hpte_v >> HPTE_V_SSIZE_SHIFT;
557+
554558 shift = mmu_psize_defs[size].shift;
555559
556560 avpn = (HPTE_V_AVPN_VAL(hpte_v) & ~mmu_psize_defs[size].avpnm);
arch/powerpc/mm/tlb-radix.c+4−4
@@ -117,7 +117,7 @@ static inline void _tlbie_va(unsigned long va, unsigned long pid, · 116 unmodified lines
117117 */
118118 void radix__local_flush_tlb_mm(struct mm_struct *mm)
119119 {
120− unsigned int pid;
120+ unsigned long pid;
121121
122122 preempt_disable();
123123 pid = mm->context.id;
@@ -130,7 +130,7 @@ EXPORT_SYMBOL(radix__local_flush_tlb_mm); · 6 unmodified lines
130130 void radix___local_flush_tlb_page(struct mm_struct *mm, unsigned long vmaddr,
131131 unsigned long ap, int nid)
132132 {
133− unsigned int pid;
133+ unsigned long pid;
134134
135135 preempt_disable();
136136 pid = mm ? mm->context.id : 0;
@@ -160,7 +160,7 @@ static int mm_is_core_local(struct mm_struct *mm) · 23 unmodified lines
160160
161161 void radix__flush_tlb_mm(struct mm_struct *mm)
162162 {
163− unsigned int pid;
163+ unsigned long pid;
164164
165165 preempt_disable();
166166 pid = mm->context.id;
@@ -185,7 +185,7 @@ EXPORT_SYMBOL(radix__flush_tlb_mm); · 18 unmodified lines
185185 void radix___flush_tlb_page(struct mm_struct *mm, unsigned long vmaddr,
186186 unsigned long ap, int nid)
187187 {
188− unsigned int pid;
188+ unsigned long pid;
189189
190190 preempt_disable();
191191 pid = mm ? mm->context.id : 0;
arch/powerpc/platforms/512x/clock-commonclk.c+1−1
@@ -221,7 +221,7 @@ static bool soc_has_mclk_mux0_canin(void) · 220 unmodified lines
221221 /* convenience wrappers around the common clk API */
222222 static inline struct clk *mpc512x_clk_fixed(const char *name, int rate)
223223 {
224− return clk_register_fixed_rate(NULL, name, NULL, CLK_IS_ROOT, rate);
224+ return clk_register_fixed_rate(NULL, name, NULL, 0, rate);
225225 }
226226
227227 static inline struct clk *mpc512x_clk_factor(
arch/powerpc/platforms/cell/spufs/coredump.c+1−1
@@ -172,7 +172,7 @@ static int spufs_arch_write_note(struct spu_context *ctx, int i, · 171 unmodified lines
172172 if (rc < 0)
173173 goto out;
174174
175− skip = roundup(cprm->file->f_pos - total + sz, 4) - cprm->file->f_pos;
175+ skip = roundup(cprm->pos - total + sz, 4) - cprm->pos;
176176 if (!dump_skip(cprm, skip))
177177 goto Eio;
178178 out:
arch/powerpc/platforms/pseries/iommu.c+2−2
@@ -927,7 +927,7 @@ static int query_ddw(struct pci_dev *dev, const u32 *ddw_avail, · 926 unmodified lines
927927 dn = pci_device_to_OF_node(dev);
928928 pdn = PCI_DN(dn);
929929 buid = pdn->phb->buid;
930− cfg_addr = (pdn->busno << 8) | pdn->devfn;
930+ cfg_addr = ((pdn->busno << 16) | (pdn->devfn << 8));
931931
932932 ret = rtas_call(ddw_avail[0], 3, 5, (u32 *)query,
933933 cfg_addr, BUID_HI(buid), BUID_LO(buid));
@@ -956,7 +956,7 @@ static int create_ddw(struct pci_dev *dev, const u32 *ddw_avail, · 22 unmodified lines
956956 dn = pci_device_to_OF_node(dev);
957957 pdn = PCI_DN(dn);
958958 buid = pdn->phb->buid;
959− cfg_addr = (pdn->busno << 8) | pdn->devfn;
959+ cfg_addr = ((pdn->busno << 16) | (pdn->devfn << 8));
960960
961961 do {
962962 /* extra outputs are LIOBN and dma-addr (hi, lo) */
arch/s390/include/asm/kvm_host.h+1−0
@@ -245,6 +245,7 @@ struct kvm_vcpu_stat { · 244 unmodified lines
245245 u32 exit_stop_request;
246246 u32 exit_validity;
247247 u32 exit_instruction;
248+ u32 exit_pei;
248249 u32 halt_successful_poll;
249250 u32 halt_attempted_poll;
250251 u32 halt_poll_invalid;
arch/s390/kvm/intercept.c+2−0
@@ -341,6 +341,8 @@ static int handle_mvpg_pei(struct kvm_vcpu *vcpu) · 340 unmodified lines
341341
342342 static int handle_partial_execution(struct kvm_vcpu *vcpu)
343343 {
344+ vcpu->stat.exit_pei++;
345+
344346 if (vcpu->arch.sie_block->ipa == 0xb254) /* MVPG */
345347 return handle_mvpg_pei(vcpu);
346348 if (vcpu->arch.sie_block->ipa >> 8 == 0xae) /* SIGP */
arch/s390/kvm/kvm-s390.c+2−1
@@ -61,6 +61,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = { · 60 unmodified lines
6161 { "exit_external_request", VCPU_STAT(exit_external_request) },
6262 { "exit_external_interrupt", VCPU_STAT(exit_external_interrupt) },
6363 { "exit_instruction", VCPU_STAT(exit_instruction) },
64+ { "exit_pei", VCPU_STAT(exit_pei) },
6465 { "exit_program_interruption", VCPU_STAT(exit_program_interruption) },
6566 { "exit_instr_and_program_int", VCPU_STAT(exit_instr_and_program) },
6667 { "halt_successful_poll", VCPU_STAT(halt_successful_poll) },
@@ -657,7 +658,7 @@ static int kvm_s390_set_processor(struct kvm *kvm, struct kvm_device_attr *attr) · 590 unmodified lines
657658 kvm->arch.model.cpuid = proc->cpuid;
658659 lowest_ibc = sclp.ibc >> 16 & 0xfff;
659660 unblocked_ibc = sclp.ibc & 0xfff;
660− if (lowest_ibc) {
661+ if (lowest_ibc && proc->ibc) {
661662 if (proc->ibc > unblocked_ibc)
662663 kvm->arch.model.ibc = unblocked_ibc;
663664 else if (proc->ibc < lowest_ibc)
arch/x86/Kconfig+9−0
@@ -2439,6 +2439,15 @@ config PCI_CNB20LE_QUIRK · 2438 unmodified lines
24392439
24402440 source "drivers/pci/Kconfig"
24412441
2442+config ISA_BUS
2443+ bool "ISA-style bus support on modern systems" if EXPERT
2444+ select ISA_BUS_API
2445+ help
2446+ Enables ISA-style drivers on modern systems. This is necessary to
2447+ support PC/104 devices on X86_64 platforms.
2448+
2449+ If unsure, say N.
2450+
24422451 # x86_64 have no ISA slots, but can have ISA-style DMA.
24432452 config ISA_DMA_API
24442453 bool "ISA-style DMA support" if (X86_64 && EXPERT)
arch/x86/boot/Makefile+3−0
@@ -162,6 +162,9 @@ isoimage: $(obj)/bzImage · 161 unmodified lines
162162 for i in lib lib64 share end ; do \
163163 if [ -f /usr/$$i/syslinux/isolinux.bin ] ; then \
164164 cp /usr/$$i/syslinux/isolinux.bin $(obj)/isoimage ; \
165+ if [ -f /usr/$$i/syslinux/ldlinux.c32 ]; then \
166+ cp /usr/$$i/syslinux/ldlinux.c32 $(obj)/isoimage ; \
167+ fi ; \
165168 break ; \
166169 fi ; \
167170 if [ $$i = end ] ; then exit 1 ; fi ; \
arch/x86/events/intel/rapl.c+1−1
@@ -714,7 +714,7 @@ static void cleanup_rapl_pmus(void) · 713 unmodified lines
714714 int i;
715715
716716 for (i = 0; i < rapl_pmus->maxpkg; i++)
717− kfree(rapl_pmus->pmus + i);
717+ kfree(rapl_pmus->pmus[i]);
718718 kfree(rapl_pmus);
719719 }
720720
arch/x86/events/intel/uncore_snbep.c+0−21
@@ -2868,27 +2868,10 @@ static struct intel_uncore_type bdx_uncore_cbox = { · 2867 unmodified lines
28682868 .format_group = &hswep_uncore_cbox_format_group,
28692869 };
28702870
2871−static struct intel_uncore_type bdx_uncore_sbox = {
2872− .name = "sbox",
2873− .num_counters = 4,
2874− .num_boxes = 4,
2875− .perf_ctr_bits = 48,
2876− .event_ctl = HSWEP_S0_MSR_PMON_CTL0,
2877− .perf_ctr = HSWEP_S0_MSR_PMON_CTR0,
2878− .event_mask = HSWEP_S_MSR_PMON_RAW_EVENT_MASK,
2879− .box_ctl = HSWEP_S0_MSR_PMON_BOX_CTL,
2880− .msr_offset = HSWEP_SBOX_MSR_OFFSET,
2881− .ops = &hswep_uncore_sbox_msr_ops,
2882− .format_group = &hswep_uncore_sbox_format_group,
2883−};
2884−
2885−#define BDX_MSR_UNCORE_SBOX 3
2886−
28872871 static struct intel_uncore_type *bdx_msr_uncores[] = {
28882872 &bdx_uncore_ubox,
28892873 &bdx_uncore_cbox,
28902874 &hswep_uncore_pcu,
2891− &bdx_uncore_sbox,
28922875 NULL,
28932876 };
28942877
@@ -2897,10 +2880,6 @@ void bdx_uncore_cpu_init(void) · 2 unmodified lines
28972880 if (bdx_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores)
28982881 bdx_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores;
28992882 uncore_msr_uncores = bdx_msr_uncores;
2900−
2901− /* BDX-DE doesn't have SBOX */
2902− if (boot_cpu_data.x86_model == 86)
2903− uncore_msr_uncores[BDX_MSR_UNCORE_SBOX] = NULL;
29042883 }
29052884
29062885 static struct intel_uncore_type bdx_uncore_ha = {
arch/x86/include/asm/intel-family.h+68−0
@@ -0,0 +1,68 @@
1+#ifndef _ASM_X86_INTEL_FAMILY_H
2+#define _ASM_X86_INTEL_FAMILY_H
3+
4+/*
5+ * "Big Core" Processors (Branded as Core, Xeon, etc...)
6+ *
7+ * The "_X" parts are generally the EP and EX Xeons, or the
8+ * "Extreme" ones, like Broadwell-E.
9+ *
10+ * Things ending in "2" are usually because we have no better
11+ * name for them. There's no processor called "WESTMERE2".
12+ */
13+
14+#define INTEL_FAM6_CORE_YONAH 0x0E
15+#define INTEL_FAM6_CORE2_MEROM 0x0F
16+#define INTEL_FAM6_CORE2_MEROM_L 0x16
17+#define INTEL_FAM6_CORE2_PENRYN 0x17
18+#define INTEL_FAM6_CORE2_DUNNINGTON 0x1D
19+
20+#define INTEL_FAM6_NEHALEM 0x1E
21+#define INTEL_FAM6_NEHALEM_EP 0x1A
22+#define INTEL_FAM6_NEHALEM_EX 0x2E
23+#define INTEL_FAM6_WESTMERE 0x25
24+#define INTEL_FAM6_WESTMERE2 0x1F
25+#define INTEL_FAM6_WESTMERE_EP 0x2C
26+#define INTEL_FAM6_WESTMERE_EX 0x2F
27+
28+#define INTEL_FAM6_SANDYBRIDGE 0x2A
29+#define INTEL_FAM6_SANDYBRIDGE_X 0x2D
30+#define INTEL_FAM6_IVYBRIDGE 0x3A
31+#define INTEL_FAM6_IVYBRIDGE_X 0x3E
32+
33+#define INTEL_FAM6_HASWELL_CORE 0x3C
34+#define INTEL_FAM6_HASWELL_X 0x3F
35+#define INTEL_FAM6_HASWELL_ULT 0x45
36+#define INTEL_FAM6_HASWELL_GT3E 0x46
37+
38+#define INTEL_FAM6_BROADWELL_CORE 0x3D
39+#define INTEL_FAM6_BROADWELL_XEON_D 0x56
40+#define INTEL_FAM6_BROADWELL_GT3E 0x47
41+#define INTEL_FAM6_BROADWELL_X 0x4F
42+
43+#define INTEL_FAM6_SKYLAKE_MOBILE 0x4E
44+#define INTEL_FAM6_SKYLAKE_DESKTOP 0x5E
45+#define INTEL_FAM6_SKYLAKE_X 0x55
46+#define INTEL_FAM6_KABYLAKE_MOBILE 0x8E
47+#define INTEL_FAM6_KABYLAKE_DESKTOP 0x9E
48+
49+/* "Small Core" Processors (Atom) */
50+
51+#define INTEL_FAM6_ATOM_PINEVIEW 0x1C
52+#define INTEL_FAM6_ATOM_LINCROFT 0x26
53+#define INTEL_FAM6_ATOM_PENWELL 0x27
54+#define INTEL_FAM6_ATOM_CLOVERVIEW 0x35
55+#define INTEL_FAM6_ATOM_CEDARVIEW 0x36
56+#define INTEL_FAM6_ATOM_SILVERMONT1 0x37 /* BayTrail/BYT / Valleyview */
57+#define INTEL_FAM6_ATOM_SILVERMONT2 0x4D /* Avaton/Rangely */
58+#define INTEL_FAM6_ATOM_AIRMONT 0x4C /* CherryTrail / Braswell */
59+#define INTEL_FAM6_ATOM_MERRIFIELD1 0x4A /* Tangier */
60+#define INTEL_FAM6_ATOM_MERRIFIELD2 0x5A /* Annidale */
61+#define INTEL_FAM6_ATOM_GOLDMONT 0x5C
62+#define INTEL_FAM6_ATOM_DENVERTON 0x5F /* Goldmont Microserver */
63+
64+/* Xeon Phi */
65+
66+#define INTEL_FAM6_XEON_PHI_KNL 0x57 /* Knights Landing */
67+
68+#endif /* _ASM_X86_INTEL_FAMILY_H */
arch/x86/include/asm/kvm_host.h+11−0
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 #include <linux/irqbypass.h>
2828 #include <linux/hyperv.h>
2929
30+#include <asm/apic.h>
3031 #include <asm/pvclock-abi.h>
3132 #include <asm/desc.h>
3233 #include <asm/mtrr.h>
@@ -1368,4 +1369,14 @@ static inline void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu) · 1335 unmodified lines
13681369
13691370 static inline void kvm_arch_vcpu_block_finish(struct kvm_vcpu *vcpu) {}
13701371
1372+static inline int kvm_cpu_get_apicid(int mps_cpu)
1373+{
1374+#ifdef CONFIG_X86_LOCAL_APIC
1375+ return __default_cpu_present_to_apicid(mps_cpu);
1376+#else
1377+ WARN_ON_ONCE(1);
1378+ return BAD_APICID;
1379+#endif
1380+}
1381+
13711382 #endif /* _ASM_X86_KVM_HOST_H */
arch/x86/include/asm/msr.h+2−2
@@ -122,7 +122,7 @@ notrace static inline void native_write_msr(unsigned int msr, · 121 unmodified lines
122122 "2:\n"
123123 _ASM_EXTABLE_HANDLE(1b, 2b, ex_handler_wrmsr_unsafe)
124124 : : "c" (msr), "a"(low), "d" (high) : "memory");
125− if (msr_tracepoint_active(__tracepoint_read_msr))
125+ if (msr_tracepoint_active(__tracepoint_write_msr))
126126 do_trace_write_msr(msr, ((u64)high << 32 | low), 0);
127127 }
128128
@@ -141,7 +141,7 @@ notrace static inline int native_write_msr_safe(unsigned int msr, · 12 unmodified lines
141141 : "c" (msr), "0" (low), "d" (high),
142142 [fault] "i" (-EIO)
143143 : "memory");
144− if (msr_tracepoint_active(__tracepoint_read_msr))
144+ if (msr_tracepoint_active(__tracepoint_write_msr))
145145 do_trace_write_msr(msr, ((u64)high << 32 | low), err);
146146 return err;
147147 }
arch/x86/kernel/apic/io_apic.c+1−1
@@ -2588,8 +2588,8 @@ static struct resource * __init ioapic_setup_resources(void) · 2587 unmodified lines
25882588 res[num].flags = IORESOURCE_MEM | IORESOURCE_BUSY;
25892589 snprintf(mem, IOAPIC_RESOURCE_NAME_SIZE, "IOAPIC %u", i);
25902590 mem += IOAPIC_RESOURCE_NAME_SIZE;
2591+ ioapics[i].iomem_res = &res[num];
25912592 num++;
2592− ioapics[i].iomem_res = res;
25932593 }
25942594
25952595 ioapic_resources = res;
arch/x86/kernel/cpu/amd.c+2−2
@@ -674,14 +674,14 @@ static void init_amd_bd(struct cpuinfo_x86 *c) · 673 unmodified lines
674674 u64 value;
675675
676676 /* re-enable TopologyExtensions if switched off by BIOS */
677− if ((c->x86_model >= 0x10) && (c->x86_model <= 0x1f) &&
677+ if ((c->x86_model >= 0x10) && (c->x86_model <= 0x6f) &&
678678 !cpu_has(c, X86_FEATURE_TOPOEXT)) {
679679
680680 if (msr_set_bit(0xc0011005, 54) > 0) {
681681 rdmsrl(0xc0011005, value);
682682 if (value & BIT_64(54)) {
683683 set_cpu_cap(c, X86_FEATURE_TOPOEXT);
684− pr_info(FW_INFO "CPU: Re-enabling disabled Topology Extensions Support.\n");
684+ pr_info_once(FW_INFO "CPU: Re-enabling disabled Topology Extensions Support.\n");
685685 }
686686 }
687687 }
arch/x86/kernel/traps.c+10−10
@@ -96,6 +96,12 @@ static inline void cond_local_irq_disable(struct pt_regs *regs) · 95 unmodified lines
9696 local_irq_disable();
9797 }
9898
99+/*
100+ * In IST context, we explicitly disable preemption. This serves two
101+ * purposes: it makes it much less likely that we would accidentally
102+ * schedule in IST context and it will force a warning if we somehow
103+ * manage to schedule by accident.
104+ */
99105 void ist_enter(struct pt_regs *regs)
100106 {
101107 if (user_mode(regs)) {
@@ -110,13 +116,7 @@ void ist_enter(struct pt_regs *regs) · 8 unmodified lines
110116 rcu_nmi_enter();
111117 }
112118
113− /*
114− * We are atomic because we're on the IST stack; or we're on
115− * x86_32, in which case we still shouldn't schedule; or we're
116− * on x86_64 and entered from user mode, in which case we're
117− * still atomic unless ist_begin_non_atomic is called.
118− */
119− preempt_count_add(HARDIRQ_OFFSET);
119+ preempt_disable();
120120
121121 /* This code is a bit fragile. Test it. */
122122 RCU_LOCKDEP_WARN(!rcu_is_watching(), "ist_enter didn't work");
@@ -124,7 +124,7 @@ void ist_enter(struct pt_regs *regs) · 1 unmodified line
124124
125125 void ist_exit(struct pt_regs *regs)
126126 {
127− preempt_count_sub(HARDIRQ_OFFSET);
127+ preempt_enable_no_resched();
128128
129129 if (!user_mode(regs))
130130 rcu_nmi_exit();
@@ -155,7 +155,7 @@ void ist_begin_non_atomic(struct pt_regs *regs) · 24 unmodified lines
155155 BUG_ON((unsigned long)(current_top_of_stack() -
156156 current_stack_pointer()) >= THREAD_SIZE);
157157
158− preempt_count_sub(HARDIRQ_OFFSET);
158+ preempt_enable_no_resched();
159159 }
160160
161161 /**
@@ -165,7 +165,7 @@ void ist_begin_non_atomic(struct pt_regs *regs) · 3 unmodified lines
165165 */
166166 void ist_end_non_atomic(void)
167167 {
168− preempt_count_add(HARDIRQ_OFFSET);
168+ preempt_disable();
169169 }
170170
171171 static nokprobe_inline int
arch/x86/kvm/svm.c+13−8
@@ -238,7 +238,9 @@ module_param(nested, int, S_IRUGO); · 237 unmodified lines
238238
239239 /* enable / disable AVIC */
240240 static int avic;
241+#ifdef CONFIG_X86_LOCAL_APIC
241242 module_param(avic, int, S_IRUGO);
243+#endif
242244
243245 static void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0);
244246 static void svm_flush_tlb(struct kvm_vcpu *vcpu);
@@ -981,11 +983,14 @@ static __init int svm_hardware_setup(void) · 736 unmodified lines
981983 } else
982984 kvm_disable_tdp();
983985
984− if (avic && (!npt_enabled || !boot_cpu_has(X86_FEATURE_AVIC)))
985− avic = false;
986−
987− if (avic)
988− pr_info("AVIC enabled\n");
986+ if (avic) {
987+ if (!npt_enabled ||
988+ !boot_cpu_has(X86_FEATURE_AVIC) ||
989+ !IS_ENABLED(CONFIG_X86_LOCAL_APIC))
990+ avic = false;
991+ else
992+ pr_info("AVIC enabled\n");
993+ }
989994
990995 return 0;
991996
@@ -1324,7 +1329,7 @@ free_avic: · 332 unmodified lines
13241329 static void avic_set_running(struct kvm_vcpu *vcpu, bool is_run)
13251330 {
13261331 u64 entry;
1327− int h_physical_id = __default_cpu_present_to_apicid(vcpu->cpu);
1332+ int h_physical_id = kvm_cpu_get_apicid(vcpu->cpu);
13281333 struct vcpu_svm *svm = to_svm(vcpu);
13291334
13301335 if (!kvm_vcpu_apicv_active(vcpu))
@@ -1349,7 +1354,7 @@ static void avic_vcpu_load(struct kvm_vcpu *vcpu, int cpu) · 18 unmodified lines
13491354 {
13501355 u64 entry;
13511356 /* ID = 0xff (broadcast), ID > 0xff (reserved) */
1352− int h_physical_id = __default_cpu_present_to_apicid(cpu);
1357+ int h_physical_id = kvm_cpu_get_apicid(cpu);
13531358 struct vcpu_svm *svm = to_svm(vcpu);
13541359
13551360 if (!kvm_vcpu_apicv_active(vcpu))
@@ -4236,7 +4241,7 @@ static void svm_deliver_avic_intr(struct kvm_vcpu *vcpu, int vec) · 2880 unmodified lines
42364241
42374242 if (avic_vcpu_is_running(vcpu))
42384243 wrmsrl(SVM_AVIC_DOORBELL,
4239− __default_cpu_present_to_apicid(vcpu->cpu));
4244+ kvm_cpu_get_apicid(vcpu->cpu));
42404245 else
42414246 kvm_vcpu_wake_up(vcpu);
42424247 }
arch/x86/kvm/vmx.c+10−5
@@ -2072,7 +2072,8 @@ static void vmx_vcpu_pi_load(struct kvm_vcpu *vcpu, int cpu) · 2071 unmodified lines
20722072 unsigned int dest;
20732073
20742074 if (!kvm_arch_has_assigned_device(vcpu->kvm) ||
2075− !irq_remapping_cap(IRQ_POSTING_CAP))
2075+ !irq_remapping_cap(IRQ_POSTING_CAP) ||
2076+ !kvm_vcpu_apicv_active(vcpu))
20762077 return;
20772078
20782079 do {
@@ -2180,7 +2181,8 @@ static void vmx_vcpu_pi_put(struct kvm_vcpu *vcpu) · 101 unmodified lines
21802181 struct pi_desc *pi_desc = vcpu_to_pi_desc(vcpu);
21812182
21822183 if (!kvm_arch_has_assigned_device(vcpu->kvm) ||
2183− !irq_remapping_cap(IRQ_POSTING_CAP))
2184+ !irq_remapping_cap(IRQ_POSTING_CAP) ||
2185+ !kvm_vcpu_apicv_active(vcpu))
21842186 return;
21852187
21862188 /* Set SN when the vCPU is preempted */
@@ -10714,7 +10716,8 @@ static int vmx_pre_block(struct kvm_vcpu *vcpu) · 8527 unmodified lines
1071410716 struct pi_desc *pi_desc = vcpu_to_pi_desc(vcpu);
1071510717
1071610718 if (!kvm_arch_has_assigned_device(vcpu->kvm) ||
10717− !irq_remapping_cap(IRQ_POSTING_CAP))
10719+ !irq_remapping_cap(IRQ_POSTING_CAP) ||
10720+ !kvm_vcpu_apicv_active(vcpu))
1071810721 return 0;
1071910722
1072010723 vcpu->pre_pcpu = vcpu->cpu;
@@ -10780,7 +10783,8 @@ static void vmx_post_block(struct kvm_vcpu *vcpu) · 59 unmodified lines
1078010783 unsigned long flags;
1078110784
1078210785 if (!kvm_arch_has_assigned_device(vcpu->kvm) ||
10783− !irq_remapping_cap(IRQ_POSTING_CAP))
10786+ !irq_remapping_cap(IRQ_POSTING_CAP) ||
10787+ !kvm_vcpu_apicv_active(vcpu))
1078410788 return;
1078510789
1078610790 do {
@@ -10833,7 +10837,8 @@ static int vmx_update_pi_irte(struct kvm *kvm, unsigned int host_irq, · 46 unmodified lines
1083310837 int idx, ret = -EINVAL;
1083410838
1083510839 if (!kvm_arch_has_assigned_device(kvm) ||
10836− !irq_remapping_cap(IRQ_POSTING_CAP))
10840+ !irq_remapping_cap(IRQ_POSTING_CAP) ||
10841+ !kvm_vcpu_apicv_active(kvm->vcpus[0]))
1083710842 return 0;
1083810843
1083910844 idx = srcu_read_lock(&kvm->irq_srcu);
block/blk-lib.c+9−3
@@ -113,6 +113,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector, · 112 unmodified lines
113113 ret = submit_bio_wait(type, bio);
114114 if (ret == -EOPNOTSUPP)
115115 ret = 0;
116+ bio_put(bio);
116117 }
117118 blk_finish_plug(&plug);
118119
@@ -165,8 +166,10 @@ int blkdev_issue_write_same(struct block_device *bdev, sector_t sector, · 46 unmodified lines
165166 }
166167 }
167168
168− if (bio)
169+ if (bio) {
169170 ret = submit_bio_wait(REQ_WRITE | REQ_WRITE_SAME, bio);
171+ bio_put(bio);
172+ }
170173 return ret != -EOPNOTSUPP ? ret : 0;
171174 }
172175 EXPORT_SYMBOL(blkdev_issue_write_same);
@@ -206,8 +209,11 @@ static int __blkdev_issue_zeroout(struct block_device *bdev, sector_t sector, · 33 unmodified lines
206209 }
207210 }
208211
209− if (bio)
210− return submit_bio_wait(WRITE, bio);
212+ if (bio) {
213+ ret = submit_bio_wait(WRITE, bio);
214+ bio_put(bio);
215+ return ret;
216+ }
211217 return 0;
212218 }
213219
block/blk-mq.c+8−9
@@ -1262,12 +1262,9 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) · 1261 unmodified lines
12621262
12631263 blk_queue_split(q, &bio, q->bio_split);
12641264
1265− if (!is_flush_fua && !blk_queue_nomerges(q)) {
1266− if (blk_attempt_plug_merge(q, bio, &request_count,
1267− &same_queue_rq))
1268− return BLK_QC_T_NONE;
1269− } else
1270− request_count = blk_plug_queued_count(q);
1265+ if (!is_flush_fua && !blk_queue_nomerges(q) &&
1266+ blk_attempt_plug_merge(q, bio, &request_count, &same_queue_rq))
1267+ return BLK_QC_T_NONE;
12711268
12721269 rq = blk_mq_map_request(q, bio, &data);
12731270 if (unlikely(!rq))
@@ -1358,9 +1355,11 @@ static blk_qc_t blk_sq_make_request(struct request_queue *q, struct bio *bio) · 84 unmodified lines
13581355
13591356 blk_queue_split(q, &bio, q->bio_split);
13601357
1361− if (!is_flush_fua && !blk_queue_nomerges(q) &&
1362− blk_attempt_plug_merge(q, bio, &request_count, NULL))
1363− return BLK_QC_T_NONE;
1358+ if (!is_flush_fua && !blk_queue_nomerges(q)) {
1359+ if (blk_attempt_plug_merge(q, bio, &request_count, NULL))
1360+ return BLK_QC_T_NONE;
1361+ } else
1362+ request_count = blk_plug_queued_count(q);
13641363
13651364 rq = blk_mq_map_request(q, bio, &data);
13661365 if (unlikely(!rq))
drivers/acpi/acpica/hwregs.c+9−137
@@ -306,12 +306,6 @@ acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg) · 305 unmodified lines
306306 acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg)
307307 {
308308 u64 address;
309− u8 access_width;
310− u32 bit_width;
311− u8 bit_offset;
312− u64 value64;
313− u32 new_value32, old_value32;
314− u8 index;
315309 acpi_status status;
316310
317311 ACPI_FUNCTION_NAME(hw_write);
@@ -323,145 +317,23 @@ acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg) · 5 unmodified lines
323317 return (status);
324318 }
325319
326− /* Convert access_width into number of bits based */
327−
328− access_width = acpi_hw_get_access_bit_width(reg, 32);
329− bit_width = reg->bit_offset + reg->bit_width;
330− bit_offset = reg->bit_offset;
331−
332320 /*
333321 * Two address spaces supported: Memory or IO. PCI_Config is
334322 * not supported here because the GAS structure is insufficient
335323 */
336− index = 0;
337− while (bit_width) {
338− /*
339− * Use offset style bit reads because "Index * AccessWidth" is
340− * ensured to be less than 32-bits by acpi_hw_validate_register().
341− */
342− new_value32 = ACPI_GET_BITS(&value, index * access_width,
343− ACPI_MASK_BITS_ABOVE_32
344− (access_width));
345−
346− if (bit_offset >= access_width) {
347− bit_offset -= access_width;
348− } else {
349− /*
350− * Use offset style bit masks because access_width is ensured
351− * to be less than 32-bits by acpi_hw_validate_register() and
352− * bit_offset/bit_width is less than access_width here.
353− */
354− if (bit_offset) {
355− new_value32 &= ACPI_MASK_BITS_BELOW(bit_offset);
356− }
357− if (bit_width < access_width) {
358− new_value32 &= ACPI_MASK_BITS_ABOVE(bit_width);
359− }
360−
361− if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
362− if (bit_offset || bit_width < access_width) {
363− /*
364− * Read old values in order not to modify the bits that
365− * are beyond the register bit_width/bit_offset setting.
366− */
367− status =
368− acpi_os_read_memory((acpi_physical_address)
369− address +
370− index *
371− ACPI_DIV_8
372− (access_width),
373− &value64,
374− access_width);
375− old_value32 = (u32)value64;
376−
377− /*
378− * Use offset style bit masks because access_width is
379− * ensured to be less than 32-bits by
380− * acpi_hw_validate_register() and bit_offset/bit_width is
381− * less than access_width here.
382− */
383− if (bit_offset) {
384− old_value32 &=
385− ACPI_MASK_BITS_ABOVE
386− (bit_offset);
387− bit_offset = 0;
388− }
389− if (bit_width < access_width) {
390− old_value32 &=
391− ACPI_MASK_BITS_BELOW
392− (bit_width);
393− }
394−
395− new_value32 |= old_value32;
396− }
397−
398− value64 = (u64)new_value32;
399− status =
400− acpi_os_write_memory((acpi_physical_address)
401− address +
402− index *
403− ACPI_DIV_8
404− (access_width),
405− value64, access_width);
406− } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
407−
408− if (bit_offset || bit_width < access_width) {
409− /*
410− * Read old values in order not to modify the bits that
411− * are beyond the register bit_width/bit_offset setting.
412− */
413− status =
414− acpi_hw_read_port((acpi_io_address)
415− address +
416− index *
417− ACPI_DIV_8
418− (access_width),
419− &old_value32,
420− access_width);
421−
422− /*
423− * Use offset style bit masks because access_width is
424− * ensured to be less than 32-bits by
425− * acpi_hw_validate_register() and bit_offset/bit_width is
426− * less than access_width here.
427− */
428− if (bit_offset) {
429− old_value32 &=
430− ACPI_MASK_BITS_ABOVE
431− (bit_offset);
432− bit_offset = 0;
433− }
434− if (bit_width < access_width) {
435− old_value32 &=
436− ACPI_MASK_BITS_BELOW
437− (bit_width);
438− }
439−
440− new_value32 |= old_value32;
441− }
442−
443− status = acpi_hw_write_port((acpi_io_address)
444− address +
445− index *
446− ACPI_DIV_8
447− (access_width),
448− new_value32,
449− access_width);
450− }
451− }
452−
453− /*
454− * Index * access_width is ensured to be less than 32-bits by
455− * acpi_hw_validate_register().
456− */
457− bit_width -=
458− bit_width > access_width ? access_width : bit_width;
459− index++;
324+ if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
325+ status = acpi_os_write_memory((acpi_physical_address)
326+ address, (u64)value,
327+ reg->bit_width);
328+ } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
329+
330+ status = acpi_hw_write_port((acpi_io_address)
331+ address, value, reg->bit_width);
460332 }
461333
462334 ACPI_DEBUG_PRINT((ACPI_DB_IO,
463335 "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",
464− value, access_width, ACPI_FORMAT_UINT64(address),
336+ value, reg->bit_width, ACPI_FORMAT_UINT64(address),
465337 acpi_ut_get_region_name(reg->space_id)));
466338
467339 return (status);
drivers/acpi/bus.c+1−1
@@ -1051,7 +1051,7 @@ static int __init acpi_bus_init(void) · 1050 unmodified lines
10511051 * Maybe EC region is required at bus_scan/acpi_get_devices. So it
10521052 * is necessary to enable it as early as possible.
10531053 */
1054− acpi_boot_ec_enable();
1054+ acpi_ec_dsdt_probe();
10551055
10561056 printk(KERN_INFO PREFIX "Interpreter enabled\n");
10571057
drivers/acpi/ec.c+22−7
@@ -1446,10 +1446,30 @@ ec_parse_io_ports(struct acpi_resource *resource, void *context) · 1445 unmodified lines
14461446 return AE_OK;
14471447 }
14481448
1449−int __init acpi_boot_ec_enable(void)
1449+static const struct acpi_device_id ec_device_ids[] = {
1450+ {"PNP0C09", 0},
1451+ {"", 0},
1452+};
1453+
1454+int __init acpi_ec_dsdt_probe(void)
14501455 {
1451− if (!boot_ec)
1456+ acpi_status status;
1457+
1458+ if (boot_ec)
14521459 return 0;
1460+
1461+ /*
1462+ * Finding EC from DSDT if there is no ECDT EC available. When this
1463+ * function is invoked, ACPI tables have been fully loaded, we can
1464+ * walk namespace now.
1465+ */
1466+ boot_ec = make_acpi_ec();
1467+ if (!boot_ec)
1468+ return -ENOMEM;
1469+ status = acpi_get_devices(ec_device_ids[0].id,
1470+ ec_parse_device, boot_ec, NULL);
1471+ if (ACPI_FAILURE(status) || !boot_ec->handle)
1472+ return -ENODEV;
14531473 if (!ec_install_handlers(boot_ec)) {
14541474 first_ec = boot_ec;
14551475 return 0;
@@ -1457,11 +1477,6 @@ int __init acpi_boot_ec_enable(void) · 1 unmodified line
14571477 return -EFAULT;
14581478 }
14591479
1460−static const struct acpi_device_id ec_device_ids[] = {
1461− {"PNP0C09", 0},
1462− {"", 0},
1463−};
1464−
14651480 #if 0
14661481 /*
14671482 * Some EC firmware variations refuses to respond QR_EC when SCI_EVT is not
drivers/acpi/internal.h+1−1
@@ -181,7 +181,7 @@ typedef int (*acpi_ec_query_func) (void *data); · 180 unmodified lines
181181
182182 int acpi_ec_init(void);
183183 int acpi_ec_ecdt_probe(void);
184−int acpi_boot_ec_enable(void);
184+int acpi_ec_dsdt_probe(void);
185185 void acpi_ec_block_transactions(void);
186186 void acpi_ec_unblock_transactions(void);
187187 void acpi_ec_unblock_transactions_early(void);
drivers/base/Makefile+1−1
@@ -10,7 +10,7 @@ obj-$(CONFIG_DMA_CMA) += dma-contiguous.o · 9 unmodified lines
1010 obj-y += power/
1111 obj-$(CONFIG_HAS_DMA) += dma-mapping.o
1212 obj-$(CONFIG_HAVE_GENERIC_DMA_COHERENT) += dma-coherent.o
13−obj-$(CONFIG_ISA) += isa.o
13+obj-$(CONFIG_ISA_BUS_API) += isa.o
1414 obj-$(CONFIG_FW_LOADER) += firmware_class.o
1515 obj-$(CONFIG_NUMA) += node.o
1616 obj-$(CONFIG_MEMORY_HOTPLUG_SPARSE) += memory.o
drivers/base/isa.c+1−1
@@ -180,4 +180,4 @@ static int __init isa_bus_init(void) · 179 unmodified lines
180180 return error;
181181 }
182182
183−device_initcall(isa_bus_init);
183+postcore_initcall(isa_bus_init);
drivers/base/module.c+5−3
@@ -24,10 +24,12 @@ static char *make_driver_name(struct device_driver *drv) · 23 unmodified lines
2424
2525 static void module_create_drivers_dir(struct module_kobject *mk)
2626 {
27− if (!mk || mk->drivers_dir)
28− return;
27+ static DEFINE_MUTEX(drivers_dir_mutex);
2928
30− mk->drivers_dir = kobject_create_and_add("drivers", &mk->kobj);
29+ mutex_lock(&drivers_dir_mutex);
30+ if (mk && !mk->drivers_dir)
31+ mk->drivers_dir = kobject_create_and_add("drivers", &mk->kobj);
32+ mutex_unlock(&drivers_dir_mutex);
3133 }
3234
3335 void module_add_driver(struct module *mod, struct device_driver *drv)
drivers/base/power/opp/cpu.c+9−3
@@ -211,7 +211,7 @@ int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, · 210 unmodified lines
211211 }
212212
213213 /* Mark opp-table as multiple CPUs are sharing it now */
214− opp_table->shared_opp = true;
214+ opp_table->shared_opp = OPP_TABLE_ACCESS_SHARED;
215215 }
216216 unlock:
217217 mutex_unlock(&opp_table_lock);
@@ -227,7 +227,8 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_set_sharing_cpus); · 9 unmodified lines
227227 *
228228 * This updates the @cpumask with CPUs that are sharing OPPs with @cpu_dev.
229229 *
230− * Returns -ENODEV if OPP table isn't already present.
230+ * Returns -ENODEV if OPP table isn't already present and -EINVAL if the OPP
231+ * table's status is access-unknown.
231232 *
232233 * Locking: The internal opp_table and opp structures are RCU protected.
233234 * Hence this function internally uses RCU updater strategy with mutex locks
@@ -249,9 +250,14 @@ int dev_pm_opp_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask) · 15 unmodified lines
249250 goto unlock;
250251 }
251252
253+ if (opp_table->shared_opp == OPP_TABLE_ACCESS_UNKNOWN) {
254+ ret = -EINVAL;
255+ goto unlock;
256+ }
257+
252258 cpumask_clear(cpumask);
253259
254− if (opp_table->shared_opp) {
260+ if (opp_table->shared_opp == OPP_TABLE_ACCESS_SHARED) {
255261 list_for_each_entry(opp_dev, &opp_table->dev_list, node)
256262 cpumask_set_cpu(opp_dev->dev->id, cpumask);
257263 } else {
drivers/base/power/opp/of.c+8−2
@@ -34,7 +34,10 @@ static struct opp_table *_managed_opp(const struct device_node *np) · 33 unmodified lines
3434 * But the OPPs will be considered as shared only if the
3535 * OPP table contains a "opp-shared" property.
3636 */
37− return opp_table->shared_opp ? opp_table : NULL;
37+ if (opp_table->shared_opp == OPP_TABLE_ACCESS_SHARED)
38+ return opp_table;
39+
40+ return NULL;
3841 }
3942 }
4043
@@ -353,7 +356,10 @@ static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np) · 312 unmodified lines
353356 }
354357
355358 opp_table->np = opp_np;
356− opp_table->shared_opp = of_property_read_bool(opp_np, "opp-shared");
359+ if (of_property_read_bool(opp_np, "opp-shared"))
360+ opp_table->shared_opp = OPP_TABLE_ACCESS_SHARED;
361+ else
362+ opp_table->shared_opp = OPP_TABLE_ACCESS_EXCLUSIVE;
357363
358364 mutex_unlock(&opp_table_lock);
359365
drivers/base/power/opp/opp.h+7−1
@@ -119,6 +119,12 @@ struct opp_device { · 118 unmodified lines
119119 #endif
120120 };
121121
122+enum opp_table_access {
123+ OPP_TABLE_ACCESS_UNKNOWN = 0,
124+ OPP_TABLE_ACCESS_EXCLUSIVE = 1,
125+ OPP_TABLE_ACCESS_SHARED = 2,
126+};
127+
122128 /**
123129 * struct opp_table - Device opp structure
124130 * @node: table node - contains the devices with OPPs that
@@ -166,7 +172,7 @@ struct opp_table { · 41 unmodified lines
166172 /* For backward compatibility with v1 bindings */
167173 unsigned int voltage_tolerance_v1;
168174
169− bool shared_opp;
175+ enum opp_table_access shared_opp;
170176 struct dev_pm_opp *suspend_opp;
171177
172178 unsigned int *supported_hw;
drivers/block/nbd.c+1−1
@@ -941,7 +941,7 @@ static int nbd_dev_dbg_init(struct nbd_device *nbd) · 940 unmodified lines
941941 debugfs_create_u64("size_bytes", 0444, dir, &nbd->bytesize);
942942 debugfs_create_u32("timeout", 0444, dir, &nbd->xmit_timeout);
943943 debugfs_create_u32("blocksize", 0444, dir, &nbd->blksize);
944− debugfs_create_file("flags", 0444, dir, &nbd, &nbd_dbg_flags_ops);
944+ debugfs_create_file("flags", 0444, dir, nbd, &nbd_dbg_flags_ops);
945945
946946 return 0;
947947 }
drivers/block/xen-blkfront.c+22−13
@@ -874,8 +874,12 @@ static int blkif_queue_rq(struct blk_mq_hw_ctx *hctx, · 873 unmodified lines
874874 const struct blk_mq_queue_data *qd)
875875 {
876876 unsigned long flags;
877− struct blkfront_ring_info *rinfo = (struct blkfront_ring_info *)hctx->driver_data;
877+ int qid = hctx->queue_num;
878+ struct blkfront_info *info = hctx->queue->queuedata;
879+ struct blkfront_ring_info *rinfo = NULL;
878880
881+ BUG_ON(info->nr_rings <= qid);
882+ rinfo = &info->rinfo[qid];
879883 blk_mq_start_request(qd->rq);
880884 spin_lock_irqsave(&rinfo->ring_lock, flags);
881885 if (RING_FULL(&rinfo->ring))
@@ -901,20 +905,9 @@ out_busy: · 19 unmodified lines
901905 return BLK_MQ_RQ_QUEUE_BUSY;
902906 }
903907
904−static int blk_mq_init_hctx(struct blk_mq_hw_ctx *hctx, void *data,
905− unsigned int index)
906−{
907− struct blkfront_info *info = (struct blkfront_info *)data;
908−
909− BUG_ON(info->nr_rings <= index);
910− hctx->driver_data = &info->rinfo[index];
911− return 0;
912−}
913−
914908 static struct blk_mq_ops blkfront_mq_ops = {
915909 .queue_rq = blkif_queue_rq,
916910 .map_queue = blk_mq_map_queue,
917− .init_hctx = blk_mq_init_hctx,
918911 };
919912
920913 static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size,
@@ -950,6 +943,7 @@ static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size, · 29 unmodified lines
950943 return PTR_ERR(rq);
951944 }
952945
946+ rq->queuedata = info;
953947 queue_flag_set_unlocked(QUEUE_FLAG_VIRT, rq);
954948
955949 if (info->feature_discard) {
@@ -2149,6 +2143,8 @@ static int blkfront_resume(struct xenbus_device *dev) · 1193 unmodified lines
21492143 return err;
21502144
21512145 err = talk_to_blkback(dev, info);
2146+ if (!err)
2147+ blk_mq_update_nr_hw_queues(&info->tag_set, info->nr_rings);
21522148
21532149 /*
21542150 * We have to wait for the backend to switch to
@@ -2485,10 +2481,23 @@ static void blkback_changed(struct xenbus_device *dev, · 330 unmodified lines
24852481 break;
24862482
24872483 case XenbusStateConnected:
2488− if (dev->state != XenbusStateInitialised) {
2484+ /*
2485+ * talk_to_blkback sets state to XenbusStateInitialised
2486+ * and blkfront_connect sets it to XenbusStateConnected
2487+ * (if connection went OK).
2488+ *
2489+ * If the backend (or toolstack) decides to poke at backend
2490+ * state (and re-trigger the watch by setting the state repeatedly
2491+ * to XenbusStateConnected (4)) we need to deal with this.
2492+ * This is allowed as this is used to communicate to the guest
2493+ * that the size of disk has changed!
2494+ */
2495+ if ((dev->state != XenbusStateInitialised) &&
2496+ (dev->state != XenbusStateConnected)) {
24892497 if (talk_to_blkback(dev, info))
24902498 break;
24912499 }
2500+
24922501 blkfront_connect(info);
24932502 break;
24942503
drivers/char/ipmi/ipmi_msghandler.c+6−2
@@ -3820,6 +3820,7 @@ static void handle_new_recv_msgs(ipmi_smi_t intf) · 3819 unmodified lines
38203820 while (!list_empty(&intf->waiting_rcv_msgs)) {
38213821 smi_msg = list_entry(intf->waiting_rcv_msgs.next,
38223822 struct ipmi_smi_msg, link);
3823+ list_del(&smi_msg->link);
38233824 if (!run_to_completion)
38243825 spin_unlock_irqrestore(&intf->waiting_rcv_msgs_lock,
38253826 flags);
@@ -3829,11 +3830,14 @@ static void handle_new_recv_msgs(ipmi_smi_t intf) · 3 unmodified lines
38293830 if (rv > 0) {
38303831 /*
38313832 * To preserve message order, quit if we
3832− * can't handle a message.
3833+ * can't handle a message. Add the message
3834+ * back at the head, this is safe because this
3835+ * tasklet is the only thing that pulls the
3836+ * messages.
38333837 */
3838+ list_add(&smi_msg->link, &intf->waiting_rcv_msgs);
38343839 break;
38353840 } else {
3836− list_del(&smi_msg->link);
38373841 if (rv == 0)
38383842 /* Message handled */
38393843 ipmi_free_smi_msg(smi_msg);
drivers/clk/Kconfig+1−0
@@ -175,6 +175,7 @@ config COMMON_CLK_KEYSTONE · 174 unmodified lines
175175 config COMMON_CLK_NXP
176176 def_bool COMMON_CLK && (ARCH_LPC18XX || ARCH_LPC32XX)
177177 select REGMAP_MMIO if ARCH_LPC32XX
178+ select MFD_SYSCON if ARCH_LPC18XX
178179 ---help---
179180 Support for clock providers on NXP platforms.
180181
drivers/clk/microchip/clk-pic32mzda.c+5−5
@@ -180,15 +180,15 @@ static int pic32mzda_clk_probe(struct platform_device *pdev) · 179 unmodified lines
180180
181181 /* register fixed rate clocks */
182182 clks[POSCCLK] = clk_register_fixed_rate(&pdev->dev, "posc_clk", NULL,
183− CLK_IS_ROOT, 24000000);
183+ 0, 24000000);
184184 clks[FRCCLK] = clk_register_fixed_rate(&pdev->dev, "frc_clk", NULL,
185− CLK_IS_ROOT, 8000000);
185+ 0, 8000000);
186186 clks[BFRCCLK] = clk_register_fixed_rate(&pdev->dev, "bfrc_clk", NULL,
187− CLK_IS_ROOT, 8000000);
187+ 0, 8000000);
188188 clks[LPRCCLK] = clk_register_fixed_rate(&pdev->dev, "lprc_clk", NULL,
189− CLK_IS_ROOT, 32000);
189+ 0, 32000);
190190 clks[UPLLCLK] = clk_register_fixed_rate(&pdev->dev, "usbphy_clk", NULL,
191− CLK_IS_ROOT, 24000000);
191+ 0, 24000000);
192192 /* fixed rate (optional) clock */
193193 if (of_find_property(np, "microchip,pic32mzda-sosc", NULL)) {
194194 pr_info("pic32-clk: dt requests SOSC.\n");
drivers/cpufreq/intel_pstate.c+11−23
@@ -372,26 +372,9 @@ static bool intel_pstate_get_ppc_enable_status(void) · 371 unmodified lines
372372 return acpi_ppc;
373373 }
374374
375−/*
376− * The max target pstate ratio is a 8 bit value in both PLATFORM_INFO MSR and
377− * in TURBO_RATIO_LIMIT MSR, which pstate driver stores in max_pstate and
378− * max_turbo_pstate fields. The PERF_CTL MSR contains 16 bit value for P state
379− * ratio, out of it only high 8 bits are used. For example 0x1700 is setting
380− * target ratio 0x17. The _PSS control value stores in a format which can be
381− * directly written to PERF_CTL MSR. But in intel_pstate driver this shift
382− * occurs during write to PERF_CTL (E.g. for cores core_set_pstate()).
383− * This function converts the _PSS control value to intel pstate driver format
384− * for comparison and assignment.
385− */
386−static int convert_to_native_pstate_format(struct cpudata *cpu, int index)
387−{
388− return cpu->acpi_perf_data.states[index].control >> 8;
389−}
390−
391375 static void intel_pstate_init_acpi_perf_limits(struct cpufreq_policy *policy)
392376 {
393377 struct cpudata *cpu;
394− int turbo_pss_ctl;
395378 int ret;
396379 int i;
397380
@@ -441,11 +424,10 @@ static void intel_pstate_init_acpi_perf_limits(struct cpufreq_policy *policy) · 43 unmodified lines
441424 * max frequency, which will cause a reduced performance as
442425 * this driver uses real max turbo frequency as the max
443426 * frequency. So correct this frequency in _PSS table to
444− * correct max turbo frequency based on the turbo ratio.
427+ * correct max turbo frequency based on the turbo state.
445428 * Also need to convert to MHz as _PSS freq is in MHz.
446429 */
447− turbo_pss_ctl = convert_to_native_pstate_format(cpu, 0);
448− if (turbo_pss_ctl > cpu->pstate.max_pstate)
430+ if (!limits->turbo_disabled)
449431 cpu->acpi_perf_data.states[0].core_frequency =
450432 policy->cpuinfo.max_freq / 1000;
451433 cpu->valid_pss_table = true;
@@ -1460,6 +1442,9 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) · 1008 unmodified lines
14601442
14611443 intel_pstate_clear_update_util_hook(policy->cpu);
14621444
1445+ pr_debug("set_policy cpuinfo.max %u policy->max %u\n",
1446+ policy->cpuinfo.max_freq, policy->max);
1447+
14631448 cpu = all_cpu_data[0];
14641449 if (cpu->pstate.max_pstate_physical > cpu->pstate.max_pstate &&
14651450 policy->max < policy->cpuinfo.max_freq &&
@@ -1495,13 +1480,13 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) · 29 unmodified lines
14951480 limits->max_sysfs_pct);
14961481 limits->max_perf_pct = max(limits->min_policy_pct,
14971482 limits->max_perf_pct);
1498− limits->max_perf = round_up(limits->max_perf, FRAC_BITS);
14991483
15001484 /* Make sure min_perf_pct <= max_perf_pct */
15011485 limits->min_perf_pct = min(limits->max_perf_pct, limits->min_perf_pct);
15021486
15031487 limits->min_perf = div_fp(limits->min_perf_pct, 100);
15041488 limits->max_perf = div_fp(limits->max_perf_pct, 100);
1489+ limits->max_perf = round_up(limits->max_perf, FRAC_BITS);
15051490
15061491 out:
15071492 intel_pstate_set_update_util_hook(policy->cpu);
@@ -1558,8 +1543,11 @@ static int intel_pstate_cpu_init(struct cpufreq_policy *policy) · 50 unmodified lines
15581543
15591544 /* cpuinfo and default policy values */
15601545 policy->cpuinfo.min_freq = cpu->pstate.min_pstate * cpu->pstate.scaling;
1561− policy->cpuinfo.max_freq =
1562− cpu->pstate.turbo_pstate * cpu->pstate.scaling;
1546+ update_turbo_state();
1547+ policy->cpuinfo.max_freq = limits->turbo_disabled ?
1548+ cpu->pstate.max_pstate : cpu->pstate.turbo_pstate;
1549+ policy->cpuinfo.max_freq *= cpu->pstate.scaling;
1550+
15631551 intel_pstate_init_acpi_perf_limits(policy);
15641552 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
15651553 cpumask_set_cpu(policy->cpu, policy->cpus);
drivers/dma/at_xdmac.c+57−25
@@ -242,7 +242,7 @@ struct at_xdmac_lld { · 241 unmodified lines
242242 u32 mbr_dus; /* Destination Microblock Stride Register */
243243 };
244244
245−
245+/* 64-bit alignment needed to update CNDA and CUBC registers in an atomic way. */
246246 struct at_xdmac_desc {
247247 struct at_xdmac_lld lld;
248248 enum dma_transfer_direction direction;
@@ -253,7 +253,7 @@ struct at_xdmac_desc { · 4 unmodified lines
253253 unsigned int xfer_size;
254254 struct list_head descs_list;
255255 struct list_head xfer_node;
256−};
256+} __aligned(sizeof(u64));
257257
258258 static inline void __iomem *at_xdmac_chan_reg_base(struct at_xdmac *atxdmac, unsigned int chan_nb)
259259 {
@@ -1400,6 +1400,7 @@ at_xdmac_tx_status(struct dma_chan *chan, dma_cookie_t cookie, · 1140 unmodified lines
14001400 u32 cur_nda, check_nda, cur_ubc, mask, value;
14011401 u8 dwidth = 0;
14021402 unsigned long flags;
1403+ bool initd;
14031404
14041405 ret = dma_cookie_status(chan, cookie, txstate);
14051406 if (ret == DMA_COMPLETE)
@@ -1424,7 +1425,16 @@ at_xdmac_tx_status(struct dma_chan *chan, dma_cookie_t cookie, · 18 unmodified lines
14241425 residue = desc->xfer_size;
14251426 /*
14261427 * Flush FIFO: only relevant when the transfer is source peripheral
1427− * synchronized.
1428+ * synchronized. Flush is needed before reading CUBC because data in
1429+ * the FIFO are not reported by CUBC. Reporting a residue of the
1430+ * transfer length while we have data in FIFO can cause issue.
1431+ * Usecase: atmel USART has a timeout which means I have received
1432+ * characters but there is no more character received for a while. On
1433+ * timeout, it requests the residue. If the data are in the DMA FIFO,
1434+ * we will return a residue of the transfer length. It means no data
1435+ * received. If an application is waiting for these data, it will hang
1436+ * since we won't have another USART timeout without receiving new
1437+ * data.
14281438 */
14291439 mask = AT_XDMAC_CC_TYPE | AT_XDMAC_CC_DSYNC;
14301440 value = AT_XDMAC_CC_TYPE_PER_TRAN | AT_XDMAC_CC_DSYNC_PER2MEM;
@@ -1435,34 +1445,43 @@ at_xdmac_tx_status(struct dma_chan *chan, dma_cookie_t cookie, · 4 unmodified lines
14351445 }
14361446
14371447 /*
1438− * When processing the residue, we need to read two registers but we
1439− * can't do it in an atomic way. AT_XDMAC_CNDA is used to find where
1440− * we stand in the descriptor list and AT_XDMAC_CUBC is used
1441− * to know how many data are remaining for the current descriptor.
1442− * Since the dma channel is not paused to not loose data, between the
1443− * AT_XDMAC_CNDA and AT_XDMAC_CUBC read, we may have change of
1444− * descriptor.
1445− * For that reason, after reading AT_XDMAC_CUBC, we check if we are
1446− * still using the same descriptor by reading a second time
1447− * AT_XDMAC_CNDA. If AT_XDMAC_CNDA has changed, it means we have to
1448− * read again AT_XDMAC_CUBC.
1448+ * The easiest way to compute the residue should be to pause the DMA
1449+ * but doing this can lead to miss some data as some devices don't
1450+ * have FIFO.
1451+ * We need to read several registers because:
1452+ * - DMA is running therefore a descriptor change is possible while
1453+ * reading these registers
1454+ * - When the block transfer is done, the value of the CUBC register
1455+ * is set to its initial value until the fetch of the next descriptor.
1456+ * This value will corrupt the residue calculation so we have to skip
1457+ * it.
1458+ *
1459+ * INITD -------- ------------
1460+ * |____________________|
1461+ * _______________________ _______________
1462+ * NDA @desc2 \/ @desc3
1463+ * _______________________/\_______________
1464+ * __________ ___________ _______________
1465+ * CUBC 0 \/ MAX desc1 \/ MAX desc2
1466+ * __________/\___________/\_______________
1467+ *
1468+ * Since descriptors are aligned on 64 bits, we can assume that
1469+ * the update of NDA and CUBC is atomic.
14491470 * Memory barriers are used to ensure the read order of the registers.
1450− * A max number of retries is set because unlikely it can never ends if
1451− * we are transferring a lot of data with small buffers.
1471+ * A max number of retries is set because unlikely it could never ends.
14521472 */
1453− cur_nda = at_xdmac_chan_read(atchan, AT_XDMAC_CNDA) & 0xfffffffc;
1454− rmb();
1455− cur_ubc = at_xdmac_chan_read(atchan, AT_XDMAC_CUBC);
14561473 for (retry = 0; retry < AT_XDMAC_RESIDUE_MAX_RETRIES; retry++) {
1457− rmb();
14581474 check_nda = at_xdmac_chan_read(atchan, AT_XDMAC_CNDA) & 0xfffffffc;
1459−
1460− if (likely(cur_nda == check_nda))
1461− break;
1462−
1463− cur_nda = check_nda;
1475+ rmb();
1476+ initd = !!(at_xdmac_chan_read(atchan, AT_XDMAC_CC) & AT_XDMAC_CC_INITD);
14641477 rmb();
14651478 cur_ubc = at_xdmac_chan_read(atchan, AT_XDMAC_CUBC);
1479+ rmb();
1480+ cur_nda = at_xdmac_chan_read(atchan, AT_XDMAC_CNDA) & 0xfffffffc;
1481+ rmb();
1482+
1483+ if ((check_nda == cur_nda) && initd)
1484+ break;
14661485 }
14671486
14681487 if (unlikely(retry >= AT_XDMAC_RESIDUE_MAX_RETRIES)) {
@@ -1470,6 +1489,19 @@ at_xdmac_tx_status(struct dma_chan *chan, dma_cookie_t cookie, · 1 unmodified line
14701489 goto spin_unlock;
14711490 }
14721491
1492+ /*
1493+ * Flush FIFO: only relevant when the transfer is source peripheral
1494+ * synchronized. Another flush is needed here because CUBC is updated
1495+ * when the controller sends the data write command. It can lead to
1496+ * report data that are not written in the memory or the device. The
1497+ * FIFO flush ensures that data are really written.
1498+ */
1499+ if ((desc->lld.mbr_cfg & mask) == value) {
1500+ at_xdmac_write(atxdmac, AT_XDMAC_GSWF, atchan->mask);
1501+ while (!(at_xdmac_chan_read(atchan, AT_XDMAC_CIS) & AT_XDMAC_CIS_FIS))
1502+ cpu_relax();
1503+ }
1504+
14731505 /*
14741506 * Remove size of all microblocks already transferred and the current
14751507 * one. Then add the remaining size to transfer of the current
drivers/dma/mv_xor.c+6−4
@@ -703,8 +703,9 @@ static int mv_chan_memcpy_self_test(struct mv_xor_chan *mv_chan) · 702 unmodified lines
703703 goto free_resources;
704704 }
705705
706− src_dma = dma_map_page(dma_chan->device->dev, virt_to_page(src), 0,
707− PAGE_SIZE, DMA_TO_DEVICE);
706+ src_dma = dma_map_page(dma_chan->device->dev, virt_to_page(src),
707+ (size_t)src & ~PAGE_MASK, PAGE_SIZE,
708+ DMA_TO_DEVICE);
708709 unmap->addr[0] = src_dma;
709710
710711 ret = dma_mapping_error(dma_chan->device->dev, src_dma);
@@ -714,8 +715,9 @@ static int mv_chan_memcpy_self_test(struct mv_xor_chan *mv_chan) · 3 unmodified lines
714715 }
715716 unmap->to_cnt = 1;
716717
717− dest_dma = dma_map_page(dma_chan->device->dev, virt_to_page(dest), 0,
718− PAGE_SIZE, DMA_FROM_DEVICE);
718+ dest_dma = dma_map_page(dma_chan->device->dev, virt_to_page(dest),
719+ (size_t)dest & ~PAGE_MASK, PAGE_SIZE,
720+ DMA_FROM_DEVICE);
719721 unmap->addr[1] = dest_dma;
720722
721723 ret = dma_mapping_error(dma_chan->device->dev, dest_dma);
drivers/edac/edac_mc.c+2−1
@@ -565,7 +565,8 @@ void edac_mc_reset_delay_period(unsigned long value) · 564 unmodified lines
565565 list_for_each(item, &mc_devices) {
566566 mci = list_entry(item, struct mem_ctl_info, link);
567567
568− edac_mod_work(&mci->work, value);
568+ if (mci->op_state == OP_RUNNING_POLL)
569+ edac_mod_work(&mci->work, value);
569570 }
570571 mutex_unlock(&mem_ctls_mutex);
571572 }
drivers/edac/sb_edac.c+22−13
@@ -239,8 +239,11 @@ static const u32 rir_offset[MAX_RIR_RANGES][MAX_RIR_WAY] = { · 238 unmodified lines
239239 { 0x1a0, 0x1a4, 0x1a8, 0x1ac, 0x1b0, 0x1b4, 0x1b8, 0x1bc },
240240 };
241241
242−#define RIR_RNK_TGT(reg) GET_BITFIELD(reg, 16, 19)
243−#define RIR_OFFSET(reg) GET_BITFIELD(reg, 2, 14)
242+#define RIR_RNK_TGT(type, reg) (((type) == BROADWELL) ? \
243+ GET_BITFIELD(reg, 20, 23) : GET_BITFIELD(reg, 16, 19))
244+
245+#define RIR_OFFSET(type, reg) (((type) == HASWELL || (type) == BROADWELL) ? \
246+ GET_BITFIELD(reg, 2, 15) : GET_BITFIELD(reg, 2, 14))
244247
245248 /* Device 16, functions 2-7 */
246249
@@ -326,6 +329,7 @@ struct pci_id_descr { · 79 unmodified lines
326329 struct pci_id_table {
327330 const struct pci_id_descr *descr;
328331 int n_devs;
332+ enum type type;
329333 };
330334
331335 struct sbridge_dev {
@@ -394,9 +398,14 @@ static const struct pci_id_descr pci_dev_descr_sbridge[] = { · 62 unmodified lines
394398 { PCI_DESCR(PCI_DEVICE_ID_INTEL_SBRIDGE_BR, 0) },
395399 };
396400
397−#define PCI_ID_TABLE_ENTRY(A) { .descr=A, .n_devs = ARRAY_SIZE(A) }
401+#define PCI_ID_TABLE_ENTRY(A, T) { \
402+ .descr = A, \
403+ .n_devs = ARRAY_SIZE(A), \
404+ .type = T \
405+}
406+
398407 static const struct pci_id_table pci_dev_descr_sbridge_table[] = {
399− PCI_ID_TABLE_ENTRY(pci_dev_descr_sbridge),
408+ PCI_ID_TABLE_ENTRY(pci_dev_descr_sbridge, SANDY_BRIDGE),
400409 {0,} /* 0 terminated list. */
401410 };
402411
@@ -463,7 +472,7 @@ static const struct pci_id_descr pci_dev_descr_ibridge[] = { · 60 unmodified lines
463472 };
464473
465474 static const struct pci_id_table pci_dev_descr_ibridge_table[] = {
466− PCI_ID_TABLE_ENTRY(pci_dev_descr_ibridge),
475+ PCI_ID_TABLE_ENTRY(pci_dev_descr_ibridge, IVY_BRIDGE),
467476 {0,} /* 0 terminated list. */
468477 };
469478
@@ -536,7 +545,7 @@ static const struct pci_id_descr pci_dev_descr_haswell[] = { · 66 unmodified lines
536545 };
537546
538547 static const struct pci_id_table pci_dev_descr_haswell_table[] = {
539− PCI_ID_TABLE_ENTRY(pci_dev_descr_haswell),
548+ PCI_ID_TABLE_ENTRY(pci_dev_descr_haswell, HASWELL),
540549 {0,} /* 0 terminated list. */
541550 };
542551
@@ -580,7 +589,7 @@ static const struct pci_id_descr pci_dev_descr_knl[] = { · 37 unmodified lines
580589 };
581590
582591 static const struct pci_id_table pci_dev_descr_knl_table[] = {
583− PCI_ID_TABLE_ENTRY(pci_dev_descr_knl),
592+ PCI_ID_TABLE_ENTRY(pci_dev_descr_knl, KNIGHTS_LANDING),
584593 {0,}
585594 };
586595
@@ -648,7 +657,7 @@ static const struct pci_id_descr pci_dev_descr_broadwell[] = { · 61 unmodified lines
648657 };
649658
650659 static const struct pci_id_table pci_dev_descr_broadwell_table[] = {
651− PCI_ID_TABLE_ENTRY(pci_dev_descr_broadwell),
660+ PCI_ID_TABLE_ENTRY(pci_dev_descr_broadwell, BROADWELL),
652661 {0,} /* 0 terminated list. */
653662 };
654663
@@ -1894,14 +1903,14 @@ static void get_memory_layout(const struct mem_ctl_info *mci) · 1239 unmodified lines
18941903 pci_read_config_dword(pvt->pci_tad[i],
18951904 rir_offset[j][k],
18961905 &reg);
1897− tmp_mb = RIR_OFFSET(reg) << 6;
1906+ tmp_mb = RIR_OFFSET(pvt->info.type, reg) << 6;
18981907
18991908 gb = div_u64_rem(tmp_mb, 1024, &mb);
19001909 edac_dbg(0, "CH#%d RIR#%d INTL#%d, offset %u.%03u GB (0x%016Lx), tgt: %d, reg=0x%08x\n",
19011910 i, j, k,
19021911 gb, (mb*1000)/1024,
19031912 ((u64)tmp_mb) << 20L,
1904− (u32)RIR_RNK_TGT(reg),
1913+ (u32)RIR_RNK_TGT(pvt->info.type, reg),
19051914 reg);
19061915 }
19071916 }
@@ -2234,7 +2243,7 @@ static int get_memory_error_data(struct mem_ctl_info *mci, · 326 unmodified lines
22342243 pci_read_config_dword(pvt->pci_tad[ch_add + base_ch],
22352244 rir_offset[n_rir][idx],
22362245 &reg);
2237− *rank = RIR_RNK_TGT(reg);
2246+ *rank = RIR_RNK_TGT(pvt->info.type, reg);
22382247
22392248 edac_dbg(0, "RIR#%d: channel address 0x%08Lx < 0x%08Lx, RIR interleave %d, index %d\n",
22402249 n_rir,
@@ -3357,12 +3366,12 @@ fail0: · 1116 unmodified lines
33573366 #define ICPU(model, table) \
33583367 { X86_VENDOR_INTEL, 6, model, 0, (unsigned long)&table }
33593368
3360−/* Order here must match "enum type" */
33613369 static const struct x86_cpu_id sbridge_cpuids[] = {
33623370 ICPU(0x2d, pci_dev_descr_sbridge_table), /* SANDY_BRIDGE */
33633371 ICPU(0x3e, pci_dev_descr_ibridge_table), /* IVY_BRIDGE */
33643372 ICPU(0x3f, pci_dev_descr_haswell_table), /* HASWELL */
33653373 ICPU(0x4f, pci_dev_descr_broadwell_table), /* BROADWELL */
3374+ ICPU(0x56, pci_dev_descr_broadwell_table), /* BROADWELL-DE */
33663375 ICPU(0x57, pci_dev_descr_knl_table), /* KNIGHTS_LANDING */
33673376 { }
33683377 };
@@ -3398,7 +3407,7 @@ static int sbridge_probe(const struct x86_cpu_id *id) · 29 unmodified lines
33983407 mc, mc + 1, num_mc);
33993408
34003409 sbridge_dev->mc = mc++;
3401− rc = sbridge_register_mci(sbridge_dev, id - sbridge_cpuids);
3410+ rc = sbridge_register_mci(sbridge_dev, ptable->type);
34023411 if (unlikely(rc < 0))
34033412 goto fail1;
34043413 }
drivers/extcon/extcon-palmas.c+2−0
@@ -360,6 +360,8 @@ static int palmas_usb_probe(struct platform_device *pdev) · 359 unmodified lines
360360
361361 palmas_enable_irq(palmas_usb);
362362 /* perform initial detection */
363+ if (palmas_usb->enable_gpio_vbus_detection)
364+ palmas_vbus_irq_handler(palmas_usb->gpio_vbus_irq, palmas_usb);
363365 palmas_gpio_id_detect(&palmas_usb->wq_detectid.work);
364366 device_set_wakeup_capable(&pdev->dev, true);
365367 return 0;
drivers/firmware/efi/arm-init.c+6−8
@@ -174,6 +174,7 @@ static __init void reserve_regions(void) · 173 unmodified lines
174174 {
175175 efi_memory_desc_t *md;
176176 u64 paddr, npages, size;
177+ int resv;
177178
178179 if (efi_enabled(EFI_DBG))
179180 pr_info("Processing EFI memory map:\n");
@@ -190,12 +191,14 @@ static __init void reserve_regions(void) · 10 unmodified lines
190191 paddr = md->phys_addr;
191192 npages = md->num_pages;
192193
194+ resv = is_reserve_region(md);
193195 if (efi_enabled(EFI_DBG)) {
194196 char buf[64];
195197
196− pr_info(" 0x%012llx-0x%012llx %s",
198+ pr_info(" 0x%012llx-0x%012llx %s%s\n",
197199 paddr, paddr + (npages << EFI_PAGE_SHIFT) - 1,
198− efi_md_typeattr_format(buf, sizeof(buf), md));
200+ efi_md_typeattr_format(buf, sizeof(buf), md),
201+ resv ? "*" : "");
199202 }
200203
201204 memrange_efi_to_native(&paddr, &npages);
@@ -204,14 +207,9 @@ static __init void reserve_regions(void) · 2 unmodified lines
204207 if (is_normal_ram(md))
205208 early_init_dt_add_memory_arch(paddr, size);
206209
207− if (is_reserve_region(md)) {
210+ if (resv)
208211 memblock_mark_nomap(paddr, size);
209− if (efi_enabled(EFI_DBG))
210− pr_cont("*");
211− }
212212
213− if (efi_enabled(EFI_DBG))
214− pr_cont("\n");
215213 }
216214
217215 set_bit(EFI_MEMMAP, &efi.flags);
drivers/gpio/Kconfig+5−4
@@ -33,6 +33,7 @@ config ARCH_REQUIRE_GPIOLIB · 32 unmodified lines
3333
3434 menuconfig GPIOLIB
3535 bool "GPIO Support"
36+ select ANON_INODES
3637 help
3738 This enables GPIO support through the generic GPIO library.
3839 You only need to enable this, if you also want to enable
@@ -530,7 +531,7 @@ menu "Port-mapped I/O GPIO drivers" · 491 unmodified lines
530531
531532 config GPIO_104_DIO_48E
532533 tristate "ACCES 104-DIO-48E GPIO support"
533− depends on ISA
534+ depends on ISA_BUS_API
534535 select GPIOLIB_IRQCHIP
535536 help
536537 Enables GPIO support for the ACCES 104-DIO-48E series (104-DIO-48E,
@@ -540,7 +541,7 @@ config GPIO_104_DIO_48E · 3 unmodified lines
540541
541542 config GPIO_104_IDIO_16
542543 tristate "ACCES 104-IDIO-16 GPIO support"
543− depends on ISA
544+ depends on ISA_BUS_API
544545 select GPIOLIB_IRQCHIP
545546 help
546547 Enables GPIO support for the ACCES 104-IDIO-16 family (104-IDIO-16,
@@ -551,7 +552,7 @@ config GPIO_104_IDIO_16 · 4 unmodified lines
551552
552553 config GPIO_104_IDI_48
553554 tristate "ACCES 104-IDI-48 GPIO support"
554− depends on ISA
555+ depends on ISA_BUS_API
555556 select GPIOLIB_IRQCHIP
556557 help
557558 Enables GPIO support for the ACCES 104-IDI-48 family (104-IDI-48A,
@@ -627,7 +628,7 @@ config GPIO_TS5500 · 69 unmodified lines
627628
628629 config GPIO_WS16C48
629630 tristate "WinSystems WS16C48 GPIO support"
630− depends on ISA
631+ depends on ISA_BUS_API
631632 select GPIOLIB_IRQCHIP
632633 help
633634 Enables GPIO support for the WinSystems WS16C48. The base port
drivers/gpio/gpio-104-dio-48e.c+2−2
@@ -75,7 +75,7 @@ static int dio48e_gpio_direction_input(struct gpio_chip *chip, unsigned offset) · 74 unmodified lines
7575 {
7676 struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip);
7777 const unsigned io_port = offset / 8;
78− const unsigned control_port = io_port / 2;
78+ const unsigned int control_port = io_port / 3;
7979 const unsigned control_addr = dio48egpio->base + 3 + control_port*4;
8080 unsigned long flags;
8181 unsigned control;
@@ -115,7 +115,7 @@ static int dio48e_gpio_direction_output(struct gpio_chip *chip, unsigned offset, · 33 unmodified lines
115115 {
116116 struct dio48e_gpio *const dio48egpio = gpiochip_get_data(chip);
117117 const unsigned io_port = offset / 8;
118− const unsigned control_port = io_port / 2;
118+ const unsigned int control_port = io_port / 3;
119119 const unsigned mask = BIT(offset % 8);
120120 const unsigned control_addr = dio48egpio->base + 3 + control_port*4;
121121 const unsigned out_port = (io_port > 2) ? io_port + 1 : io_port;
drivers/gpio/gpio-bcm-kona.c+2−2
@@ -547,11 +547,11 @@ static void bcm_kona_gpio_reset(struct bcm_kona_gpio *kona_gpio) · 546 unmodified lines
547547 /* disable interrupts and clear status */
548548 for (i = 0; i < kona_gpio->num_bank; i++) {
549549 /* Unlock the entire bank first */
550− bcm_kona_gpio_write_lock_regs(kona_gpio, i, UNLOCK_CODE);
550+ bcm_kona_gpio_write_lock_regs(reg_base, i, UNLOCK_CODE);
551551 writel(0xffffffff, reg_base + GPIO_INT_MASK(i));
552552 writel(0xffffffff, reg_base + GPIO_INT_STATUS(i));
553553 /* Now re-lock the bank */
554− bcm_kona_gpio_write_lock_regs(kona_gpio, i, LOCK_CODE);
554+ bcm_kona_gpio_write_lock_regs(reg_base, i, LOCK_CODE);
555555 }
556556 }
557557
drivers/gpio/gpio-zynq.c+7−0
@@ -709,7 +709,13 @@ static int zynq_gpio_probe(struct platform_device *pdev) · 708 unmodified lines
709709 dev_err(&pdev->dev, "input clock not found.\n");
710710 return PTR_ERR(gpio->clk);
711711 }
712+ ret = clk_prepare_enable(gpio->clk);
713+ if (ret) {
714+ dev_err(&pdev->dev, "Unable to enable clock.\n");
715+ return ret;
716+ }
712717
718+ pm_runtime_set_active(&pdev->dev);
713719 pm_runtime_enable(&pdev->dev);
714720 ret = pm_runtime_get_sync(&pdev->dev);
715721 if (ret < 0)
@@ -747,6 +753,7 @@ err_pm_put: · 31 unmodified lines
747753 pm_runtime_put(&pdev->dev);
748754 err_pm_dis:
749755 pm_runtime_disable(&pdev->dev);
756+ clk_disable_unprepare(gpio->clk);
750757
751758 return ret;
752759 }
drivers/gpio/gpiolib-of.c+1−0
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616 #include <linux/errno.h>
1717 #include <linux/module.h>
1818 #include <linux/io.h>
19+#include <linux/io-mapping.h>
1920 #include <linux/gpio/consumer.h>
2021 #include <linux/of.h>
2122 #include <linux/of_address.h>
drivers/gpio/gpiolib.c+3−3
@@ -449,7 +449,6 @@ static void gpiodevice_release(struct device *dev) · 448 unmodified lines
449449 {
450450 struct gpio_device *gdev = dev_get_drvdata(dev);
451451
452− cdev_del(&gdev->chrdev);
453452 list_del(&gdev->list);
454453 ida_simple_remove(&gpio_ida, gdev->id);
455454 kfree(gdev->label);
@@ -482,7 +481,6 @@ static int gpiochip_setup_dev(struct gpio_device *gdev) · 26 unmodified lines
482481
483482 /* From this point, the .release() function cleans up gpio_device */
484483 gdev->dev.release = gpiodevice_release;
485− get_device(&gdev->dev);
486484 pr_debug("%s: registered GPIOs %d to %d on device: %s (%s)\n",
487485 __func__, gdev->base, gdev->base + gdev->ngpio - 1,
488486 dev_name(&gdev->dev), gdev->chip->label ? : "generic");
@@ -770,6 +768,8 @@ void gpiochip_remove(struct gpio_chip *chip) · 281 unmodified lines
770768 * be removed, else it will be dangling until the last user is
771769 * gone.
772770 */
771+ cdev_del(&gdev->chrdev);
772+ device_del(&gdev->dev);
773773 put_device(&gdev->dev);
774774 }
775775 EXPORT_SYMBOL_GPL(gpiochip_remove);
@@ -869,7 +869,7 @@ struct gpio_chip *gpiochip_find(void *data, · 93 unmodified lines
869869
870870 spin_lock_irqsave(&gpio_lock, flags);
871871 list_for_each_entry(gdev, &gpio_devices, list)
872− if (match(gdev->chip, data))
872+ if (gdev->chip && match(gdev->chip, data))
873873 break;
874874
875875 /* No match? */
drivers/gpu/drm/amd/amdgpu/amdgpu.h+7−0
@@ -1820,6 +1820,8 @@ struct amdgpu_asic_funcs { · 1819 unmodified lines
18201820 /* MM block clocks */
18211821 int (*set_uvd_clocks)(struct amdgpu_device *adev, u32 vclk, u32 dclk);
18221822 int (*set_vce_clocks)(struct amdgpu_device *adev, u32 evclk, u32 ecclk);
1823+ /* query virtual capabilities */
1824+ u32 (*get_virtual_caps)(struct amdgpu_device *adev);
18231825 };
18241826
18251827 /*
@@ -1914,8 +1916,12 @@ void amdgpu_cgs_destroy_device(struct cgs_device *cgs_device); · 88 unmodified lines
19141916
19151917
19161918 /* GPU virtualization */
1919+#define AMDGPU_VIRT_CAPS_SRIOV_EN (1 << 0)
1920+#define AMDGPU_VIRT_CAPS_IS_VF (1 << 1)
19171921 struct amdgpu_virtualization {
19181922 bool supports_sr_iov;
1923+ bool is_virtual;
1924+ u32 caps;
19191925 };
19201926
19211927 /*
@@ -2204,6 +2210,7 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring) · 282 unmodified lines
22042210 #define amdgpu_asic_get_xclk(adev) (adev)->asic_funcs->get_xclk((adev))
22052211 #define amdgpu_asic_set_uvd_clocks(adev, v, d) (adev)->asic_funcs->set_uvd_clocks((adev), (v), (d))
22062212 #define amdgpu_asic_set_vce_clocks(adev, ev, ec) (adev)->asic_funcs->set_vce_clocks((adev), (ev), (ec))
2213+#define amdgpu_asic_get_virtual_caps(adev) ((adev)->asic_funcs->get_virtual_caps((adev)))
22072214 #define amdgpu_asic_get_gpu_clock_counter(adev) (adev)->asic_funcs->get_gpu_clock_counter((adev))
22082215 #define amdgpu_asic_read_disabled_bios(adev) (adev)->asic_funcs->read_disabled_bios((adev))
22092216 #define amdgpu_asic_read_bios_from_rom(adev, b, l) (adev)->asic_funcs->read_bios_from_rom((adev), (b), (l))
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c+12−0
@@ -696,6 +696,17 @@ static uint32_t fw_type_convert(struct cgs_device *cgs_device, uint32_t fw_type) · 695 unmodified lines
696696 return result;
697697 }
698698
699+static int amdgpu_cgs_rel_firmware(struct cgs_device *cgs_device, enum cgs_ucode_id type)
700+{
701+ CGS_FUNC_ADEV;
702+ if ((CGS_UCODE_ID_SMU == type) || (CGS_UCODE_ID_SMU_SK == type)) {
703+ release_firmware(adev->pm.fw);
704+ return 0;
705+ }
706+ /* cannot release other firmware because they are not created by cgs */
707+ return -EINVAL;
708+}
709+
699710 static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,
700711 enum cgs_ucode_id type,
701712 struct cgs_firmware_info *info)
@@ -1125,6 +1136,7 @@ static const struct cgs_ops amdgpu_cgs_ops = { · 423 unmodified lines
11251136 amdgpu_cgs_pm_query_clock_limits,
11261137 amdgpu_cgs_set_camera_voltages,
11271138 amdgpu_cgs_get_firmware_info,
1139+ amdgpu_cgs_rel_firmware,
11281140 amdgpu_cgs_set_powergating_state,
11291141 amdgpu_cgs_set_clockgating_state,
11301142 amdgpu_cgs_get_active_displays_info,
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c+23−2
@@ -827,8 +827,10 @@ static uint32_t cail_ioreg_read(struct card_info *info, uint32_t reg) · 826 unmodified lines
827827 */
828828 static void amdgpu_atombios_fini(struct amdgpu_device *adev)
829829 {
830− if (adev->mode_info.atom_context)
830+ if (adev->mode_info.atom_context) {
831831 kfree(adev->mode_info.atom_context->scratch);
832+ kfree(adev->mode_info.atom_context->iio);
833+ }
832834 kfree(adev->mode_info.atom_context);
833835 adev->mode_info.atom_context = NULL;
834836 kfree(adev->mode_info.atom_card_info);
@@ -1325,6 +1327,11 @@ static int amdgpu_fini(struct amdgpu_device *adev) · 490 unmodified lines
13251327 adev->ip_block_status[i].valid = false;
13261328 }
13271329
1330+ for (i = adev->num_ip_blocks - 1; i >= 0; i--) {
1331+ if (adev->ip_blocks[i].funcs->late_fini)
1332+ adev->ip_blocks[i].funcs->late_fini((void *)adev);
1333+ }
1334+
13281335 return 0;
13291336 }
13301337
@@ -1378,6 +1385,15 @@ static int amdgpu_resume(struct amdgpu_device *adev) · 47 unmodified lines
13781385 return 0;
13791386 }
13801387
1388+static bool amdgpu_device_is_virtual(void)
1389+{
1390+#ifdef CONFIG_X86
1391+ return boot_cpu_has(X86_FEATURE_HYPERVISOR);
1392+#else
1393+ return false;
1394+#endif
1395+}
1396+
13811397 /**
13821398 * amdgpu_device_init - initialize the driver
13831399 *
@@ -1512,9 +1528,14 @@ int amdgpu_device_init(struct amdgpu_device *adev, · 128 unmodified lines
15121528 adev->virtualization.supports_sr_iov =
15131529 amdgpu_atombios_has_gpu_virtualization_table(adev);
15141530
1531+ /* Check if we are executing in a virtualized environment */
1532+ adev->virtualization.is_virtual = amdgpu_device_is_virtual();
1533+ adev->virtualization.caps = amdgpu_asic_get_virtual_caps(adev);
1534+
15151535 /* Post card if necessary */
15161536 if (!amdgpu_card_posted(adev) ||
1517− adev->virtualization.supports_sr_iov) {
1537+ (adev->virtualization.is_virtual &&
1538+ !adev->virtualization.caps & AMDGPU_VIRT_CAPS_SRIOV_EN)) {
15181539 if (!adev->bios) {
15191540 dev_err(adev->dev, "Card not posted and no BIOS - ignoring\n");
15201541 return -EINVAL;
drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c+17−7
@@ -183,13 +183,6 @@ static int amdgpu_pp_sw_fini(void *handle) · 182 unmodified lines
183183 if (ret)
184184 return ret;
185185
186−#ifdef CONFIG_DRM_AMD_POWERPLAY
187− if (adev->pp_enabled) {
188− amdgpu_pm_sysfs_fini(adev);
189− amd_powerplay_fini(adev->powerplay.pp_handle);
190− }
191−#endif
192−
193186 return ret;
194187 }
195188
@@ -223,6 +216,22 @@ static int amdgpu_pp_hw_fini(void *handle) · 27 unmodified lines
223216 return ret;
224217 }
225218
219+static void amdgpu_pp_late_fini(void *handle)
220+{
221+#ifdef CONFIG_DRM_AMD_POWERPLAY
222+ struct amdgpu_device *adev = (struct amdgpu_device *)handle;
223+
224+ if (adev->pp_enabled) {
225+ amdgpu_pm_sysfs_fini(adev);
226+ amd_powerplay_fini(adev->powerplay.pp_handle);
227+ }
228+
229+ if (adev->powerplay.ip_funcs->late_fini)
230+ adev->powerplay.ip_funcs->late_fini(
231+ adev->powerplay.pp_handle);
232+#endif
233+}
234+
226235 static int amdgpu_pp_suspend(void *handle)
227236 {
228237 int ret = 0;
@@ -311,6 +320,7 @@ const struct amd_ip_funcs amdgpu_pp_ip_funcs = { · 82 unmodified lines
311320 .sw_fini = amdgpu_pp_sw_fini,
312321 .hw_init = amdgpu_pp_hw_init,
313322 .hw_fini = amdgpu_pp_hw_fini,
323+ .late_fini = amdgpu_pp_late_fini,
314324 .suspend = amdgpu_pp_suspend,
315325 .resume = amdgpu_pp_resume,
316326 .is_idle = amdgpu_pp_is_idle,
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c+1−0
@@ -343,6 +343,7 @@ void amdgpu_ring_fini(struct amdgpu_ring *ring) · 342 unmodified lines
343343 ring->ring = NULL;
344344 ring->ring_obj = NULL;
345345
346+ amdgpu_wb_free(ring->adev, ring->cond_exe_offs);
346347 amdgpu_wb_free(ring->adev, ring->fence_offs);
347348 amdgpu_wb_free(ring->adev, ring->rptr_offs);
348349 amdgpu_wb_free(ring->adev, ring->wptr_offs);
drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c+1−0
@@ -115,6 +115,7 @@ int amdgpu_sa_bo_manager_start(struct amdgpu_device *adev, · 114 unmodified lines
115115 return r;
116116 }
117117 r = amdgpu_bo_kmap(sa_manager->bo, &sa_manager->cpu_ptr);
118+ memset(sa_manager->cpu_ptr, 0, sa_manager->size);
118119 amdgpu_bo_unreserve(sa_manager->bo);
119120 return r;
120121 }
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c+10−9
@@ -253,19 +253,20 @@ int amdgpu_uvd_sw_fini(struct amdgpu_device *adev) · 252 unmodified lines
253253 {
254254 int r;
255255
256− if (adev->uvd.vcpu_bo == NULL)
257− return 0;
256+ kfree(adev->uvd.saved_bo);
258257
259258 amd_sched_entity_fini(&adev->uvd.ring.sched, &adev->uvd.entity);
260259
261− r = amdgpu_bo_reserve(adev->uvd.vcpu_bo, false);
262− if (!r) {
263− amdgpu_bo_kunmap(adev->uvd.vcpu_bo);
264− amdgpu_bo_unpin(adev->uvd.vcpu_bo);
265− amdgpu_bo_unreserve(adev->uvd.vcpu_bo);
266− }
260+ if (adev->uvd.vcpu_bo) {
261+ r = amdgpu_bo_reserve(adev->uvd.vcpu_bo, false);
262+ if (!r) {
263+ amdgpu_bo_kunmap(adev->uvd.vcpu_bo);
264+ amdgpu_bo_unpin(adev->uvd.vcpu_bo);
265+ amdgpu_bo_unreserve(adev->uvd.vcpu_bo);
266+ }
267267
268− amdgpu_bo_unref(&adev->uvd.vcpu_bo);
268+ amdgpu_bo_unref(&adev->uvd.vcpu_bo);
269+ }
269270
270271 amdgpu_ring_fini(&adev->uvd.ring);
271272
drivers/gpu/drm/amd/amdgpu/ci_dpm.c+3−0
@@ -6221,6 +6221,9 @@ static int ci_dpm_sw_fini(void *handle) · 6220 unmodified lines
62216221 ci_dpm_fini(adev);
62226222 mutex_unlock(&adev->pm.mutex);
62236223
6224+ release_firmware(adev->pm.fw);
6225+ adev->pm.fw = NULL;
6226+
62246227 return 0;
62256228 }
62266229
drivers/gpu/drm/amd/amdgpu/cik.c+7−0
@@ -962,6 +962,12 @@ static bool cik_read_bios_from_rom(struct amdgpu_device *adev, · 961 unmodified lines
962962 return true;
963963 }
964964
965+static u32 cik_get_virtual_caps(struct amdgpu_device *adev)
966+{
967+ /* CIK does not support SR-IOV */
968+ return 0;
969+}
970+
965971 static const struct amdgpu_allowed_register_entry cik_allowed_read_registers[] = {
966972 {mmGRBM_STATUS, false},
967973 {mmGB_ADDR_CONFIG, false},
@@ -2007,6 +2013,7 @@ static const struct amdgpu_asic_funcs cik_asic_funcs = · 1039 unmodified lines
20072013 .get_xclk = &cik_get_xclk,
20082014 .set_uvd_clocks = &cik_set_uvd_clocks,
20092015 .set_vce_clocks = &cik_set_vce_clocks,
2016+ .get_virtual_caps = &cik_get_virtual_caps,
20102017 /* these should be moved to their own ip modules */
20112018 .get_gpu_clock_counter = &gfx_v7_0_get_gpu_clock_counter,
20122019 .wait_for_mc_idle = &gmc_v7_0_mc_wait_for_idle,
drivers/gpu/drm/amd/amdgpu/cik_sdma.c+20−2
@@ -66,6 +66,16 @@ MODULE_FIRMWARE("radeon/mullins_sdma1.bin"); · 65 unmodified lines
6666
6767 u32 amdgpu_cik_gpu_check_soft_reset(struct amdgpu_device *adev);
6868
69+
70+static void cik_sdma_free_microcode(struct amdgpu_device *adev)
71+{
72+ int i;
73+ for (i = 0; i < adev->sdma.num_instances; i++) {
74+ release_firmware(adev->sdma.instance[i].fw);
75+ adev->sdma.instance[i].fw = NULL;
76+ }
77+}
78+
6979 /*
7080 * sDMA - System DMA
7181 * Starting with CIK, the GPU has new asynchronous
@@ -419,6 +429,8 @@ static int cik_sdma_gfx_resume(struct amdgpu_device *adev) · 347 unmodified lines
419429 /* Initialize the ring buffer's read and write pointers */
420430 WREG32(mmSDMA0_GFX_RB_RPTR + sdma_offsets[i], 0);
421431 WREG32(mmSDMA0_GFX_RB_WPTR + sdma_offsets[i], 0);
432+ WREG32(mmSDMA0_GFX_IB_RPTR + sdma_offsets[i], 0);
433+ WREG32(mmSDMA0_GFX_IB_OFFSET + sdma_offsets[i], 0);
422434
423435 /* set the wb address whether it's enabled or not */
424436 WREG32(mmSDMA0_GFX_RB_RPTR_ADDR_HI + sdma_offsets[i],
@@ -446,7 +458,12 @@ static int cik_sdma_gfx_resume(struct amdgpu_device *adev) · 21 unmodified lines
446458 WREG32(mmSDMA0_GFX_IB_CNTL + sdma_offsets[i], ib_cntl);
447459
448460 ring->ready = true;
461+ }
462+
463+ cik_sdma_enable(adev, true);
449464
465+ for (i = 0; i < adev->sdma.num_instances; i++) {
466+ ring = &adev->sdma.instance[i].ring;
450467 r = amdgpu_ring_test_ring(ring);
451468 if (r) {
452469 ring->ready = false;
@@ -529,8 +546,8 @@ static int cik_sdma_start(struct amdgpu_device *adev) · 76 unmodified lines
529546 if (r)
530547 return r;
531548
532− /* unhalt the MEs */
533− cik_sdma_enable(adev, true);
549+ /* halt the engine before programing */
550+ cik_sdma_enable(adev, false);
534551
535552 /* start the gfx rings and rlc compute queues */
536553 r = cik_sdma_gfx_resume(adev);
@@ -998,6 +1015,7 @@ static int cik_sdma_sw_fini(void *handle) · 461 unmodified lines
9981015 for (i = 0; i < adev->sdma.num_instances; i++)
9991016 amdgpu_ring_fini(&adev->sdma.instance[i].ring);
10001017
1018+ cik_sdma_free_microcode(adev);
10011019 return 0;
10021020 }
10031021
drivers/gpu/drm/amd/amdgpu/fiji_dpm.c+5−0
@@ -72,6 +72,11 @@ static int fiji_dpm_sw_init(void *handle) · 71 unmodified lines
7272
7373 static int fiji_dpm_sw_fini(void *handle)
7474 {
75+ struct amdgpu_device *adev = (struct amdgpu_device *)handle;
76+
77+ release_firmware(adev->pm.fw);
78+ adev->pm.fw = NULL;
79+
7580 return 0;
7681 }
7782
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c+18−1
@@ -991,6 +991,22 @@ out: · 990 unmodified lines
991991 return err;
992992 }
993993
994+static void gfx_v7_0_free_microcode(struct amdgpu_device *adev)
995+{
996+ release_firmware(adev->gfx.pfp_fw);
997+ adev->gfx.pfp_fw = NULL;
998+ release_firmware(adev->gfx.me_fw);
999+ adev->gfx.me_fw = NULL;
1000+ release_firmware(adev->gfx.ce_fw);
1001+ adev->gfx.ce_fw = NULL;
1002+ release_firmware(adev->gfx.mec_fw);
1003+ adev->gfx.mec_fw = NULL;
1004+ release_firmware(adev->gfx.mec2_fw);
1005+ adev->gfx.mec2_fw = NULL;
1006+ release_firmware(adev->gfx.rlc_fw);
1007+ adev->gfx.rlc_fw = NULL;
1008+}
1009+
9941010 /**
9951011 * gfx_v7_0_tiling_mode_table_init - init the hw tiling table
9961012 *
@@ -4489,6 +4505,7 @@ static int gfx_v7_0_sw_fini(void *handle) · 3492 unmodified lines
44894505 gfx_v7_0_cp_compute_fini(adev);
44904506 gfx_v7_0_rlc_fini(adev);
44914507 gfx_v7_0_mec_fini(adev);
4508+ gfx_v7_0_free_microcode(adev);
44924509
44934510 return 0;
44944511 }
@@ -4816,7 +4833,7 @@ static int gfx_v7_0_eop_irq(struct amdgpu_device *adev, · 321 unmodified lines
48164833 case 2:
48174834 for (i = 0; i < adev->gfx.num_compute_rings; i++) {
48184835 ring = &adev->gfx.compute_ring[i];
4819− if ((ring->me == me_id) & (ring->pipe == pipe_id))
4836+ if ((ring->me == me_id) && (ring->pipe == pipe_id))
48204837 amdgpu_fence_process(ring);
48214838 }
48224839 break;
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c+26−2
@@ -836,6 +836,26 @@ err1: · 835 unmodified lines
836836 return r;
837837 }
838838
839+
840+static void gfx_v8_0_free_microcode(struct amdgpu_device *adev) {
841+ release_firmware(adev->gfx.pfp_fw);
842+ adev->gfx.pfp_fw = NULL;
843+ release_firmware(adev->gfx.me_fw);
844+ adev->gfx.me_fw = NULL;
845+ release_firmware(adev->gfx.ce_fw);
846+ adev->gfx.ce_fw = NULL;
847+ release_firmware(adev->gfx.rlc_fw);
848+ adev->gfx.rlc_fw = NULL;
849+ release_firmware(adev->gfx.mec_fw);
850+ adev->gfx.mec_fw = NULL;
851+ if ((adev->asic_type != CHIP_STONEY) &&
852+ (adev->asic_type != CHIP_TOPAZ))
853+ release_firmware(adev->gfx.mec2_fw);
854+ adev->gfx.mec2_fw = NULL;
855+
856+ kfree(adev->gfx.rlc.register_list_format);
857+}
858+
839859 static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
840860 {
841861 const char *chip_name;
@@ -1983,7 +2003,7 @@ static int gfx_v8_0_sw_fini(void *handle) · 1141 unmodified lines
19832003
19842004 gfx_v8_0_rlc_fini(adev);
19852005
1986− kfree(adev->gfx.rlc.register_list_format);
2006+ gfx_v8_0_free_microcode(adev);
19872007
19882008 return 0;
19892009 }
@@ -3974,11 +3994,15 @@ static int gfx_v8_0_cp_gfx_start(struct amdgpu_device *adev) · 1984 unmodified lines
39743994 amdgpu_ring_write(ring, 0x3a00161a);
39753995 amdgpu_ring_write(ring, 0x0000002e);
39763996 break;
3977− case CHIP_TOPAZ:
39783997 case CHIP_CARRIZO:
39793998 amdgpu_ring_write(ring, 0x00000002);
39803999 amdgpu_ring_write(ring, 0x00000000);
39814000 break;
4001+ case CHIP_TOPAZ:
4002+ amdgpu_ring_write(ring, adev->gfx.config.num_rbs == 1 ?
4003+ 0x00000000 : 0x00000002);
4004+ amdgpu_ring_write(ring, 0x00000000);
4005+ break;
39824006 case CHIP_STONEY:
39834007 amdgpu_ring_write(ring, 0x00000000);
39844008 amdgpu_ring_write(ring, 0x00000000);
drivers/gpu/drm/amd/amdgpu/iceland_dpm.c+5−0
@@ -72,6 +72,11 @@ static int iceland_dpm_sw_init(void *handle) · 71 unmodified lines
7272
7373 static int iceland_dpm_sw_fini(void *handle)
7474 {
75+ struct amdgpu_device *adev = (struct amdgpu_device *)handle;
76+
77+ release_firmware(adev->pm.fw);
78+ adev->pm.fw = NULL;
79+
7580 return 0;
7681 }
7782
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c+18−2
@@ -105,6 +105,15 @@ static void sdma_v2_4_init_golden_registers(struct amdgpu_device *adev) · 104 unmodified lines
105105 }
106106 }
107107
108+static void sdma_v2_4_free_microcode(struct amdgpu_device *adev)
109+{
110+ int i;
111+ for (i = 0; i < adev->sdma.num_instances; i++) {
112+ release_firmware(adev->sdma.instance[i].fw);
113+ adev->sdma.instance[i].fw = NULL;
114+ }
115+}
116+
108117 /**
109118 * sdma_v2_4_init_microcode - load ucode images from disk
110119 *
@@ -461,6 +470,8 @@ static int sdma_v2_4_gfx_resume(struct amdgpu_device *adev) · 350 unmodified lines
461470 /* Initialize the ring buffer's read and write pointers */
462471 WREG32(mmSDMA0_GFX_RB_RPTR + sdma_offsets[i], 0);
463472 WREG32(mmSDMA0_GFX_RB_WPTR + sdma_offsets[i], 0);
473+ WREG32(mmSDMA0_GFX_IB_RPTR + sdma_offsets[i], 0);
474+ WREG32(mmSDMA0_GFX_IB_OFFSET + sdma_offsets[i], 0);
464475
465476 /* set the wb address whether it's enabled or not */
466477 WREG32(mmSDMA0_GFX_RB_RPTR_ADDR_HI + sdma_offsets[i],
@@ -489,7 +500,11 @@ static int sdma_v2_4_gfx_resume(struct amdgpu_device *adev) · 22 unmodified lines
489500 WREG32(mmSDMA0_GFX_IB_CNTL + sdma_offsets[i], ib_cntl);
490501
491502 ring->ready = true;
503+ }
492504
505+ sdma_v2_4_enable(adev, true);
506+ for (i = 0; i < adev->sdma.num_instances; i++) {
507+ ring = &adev->sdma.instance[i].ring;
493508 r = amdgpu_ring_test_ring(ring);
494509 if (r) {
495510 ring->ready = false;
@@ -580,8 +595,8 @@ static int sdma_v2_4_start(struct amdgpu_device *adev) · 84 unmodified lines
580595 return -EINVAL;
581596 }
582597
583− /* unhalt the MEs */
584− sdma_v2_4_enable(adev, true);
598+ /* halt the engine before programing */
599+ sdma_v2_4_enable(adev, false);
585600
586601 /* start the gfx rings and rlc compute queues */
587602 r = sdma_v2_4_gfx_resume(adev);
@@ -1012,6 +1027,7 @@ static int sdma_v2_4_sw_fini(void *handle) · 424 unmodified lines
10121027 for (i = 0; i < adev->sdma.num_instances; i++)
10131028 amdgpu_ring_fini(&adev->sdma.instance[i].ring);
10141029
1030+ sdma_v2_4_free_microcode(adev);
10151031 return 0;
10161032 }
10171033
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c+23−4
@@ -236,6 +236,15 @@ static void sdma_v3_0_init_golden_registers(struct amdgpu_device *adev) · 235 unmodified lines
236236 }
237237 }
238238
239+static void sdma_v3_0_free_microcode(struct amdgpu_device *adev)
240+{
241+ int i;
242+ for (i = 0; i < adev->sdma.num_instances; i++) {
243+ release_firmware(adev->sdma.instance[i].fw);
244+ adev->sdma.instance[i].fw = NULL;
245+ }
246+}
247+
239248 /**
240249 * sdma_v3_0_init_microcode - load ucode images from disk
241250 *
@@ -672,6 +681,8 @@ static int sdma_v3_0_gfx_resume(struct amdgpu_device *adev) · 430 unmodified lines
672681 /* Initialize the ring buffer's read and write pointers */
673682 WREG32(mmSDMA0_GFX_RB_RPTR + sdma_offsets[i], 0);
674683 WREG32(mmSDMA0_GFX_RB_WPTR + sdma_offsets[i], 0);
684+ WREG32(mmSDMA0_GFX_IB_RPTR + sdma_offsets[i], 0);
685+ WREG32(mmSDMA0_GFX_IB_OFFSET + sdma_offsets[i], 0);
675686
676687 /* set the wb address whether it's enabled or not */
677688 WREG32(mmSDMA0_GFX_RB_RPTR_ADDR_HI + sdma_offsets[i],
@@ -711,7 +722,15 @@ static int sdma_v3_0_gfx_resume(struct amdgpu_device *adev) · 33 unmodified lines
711722 WREG32(mmSDMA0_GFX_IB_CNTL + sdma_offsets[i], ib_cntl);
712723
713724 ring->ready = true;
725+ }
726+
727+ /* unhalt the MEs */
728+ sdma_v3_0_enable(adev, true);
729+ /* enable sdma ring preemption */
730+ sdma_v3_0_ctx_switch_enable(adev, true);
714731
732+ for (i = 0; i < adev->sdma.num_instances; i++) {
733+ ring = &adev->sdma.instance[i].ring;
715734 r = amdgpu_ring_test_ring(ring);
716735 if (r) {
717736 ring->ready = false;
@@ -804,10 +823,9 @@ static int sdma_v3_0_start(struct amdgpu_device *adev) · 86 unmodified lines
804823 }
805824 }
806825
807− /* unhalt the MEs */
808− sdma_v3_0_enable(adev, true);
809− /* enable sdma ring preemption */
810− sdma_v3_0_ctx_switch_enable(adev, true);
826+ /* disble sdma engine before programing it */
827+ sdma_v3_0_ctx_switch_enable(adev, false);
828+ sdma_v3_0_enable(adev, false);
811829
812830 /* start the gfx rings and rlc compute queues */
813831 r = sdma_v3_0_gfx_resume(adev);
@@ -1247,6 +1265,7 @@ static int sdma_v3_0_sw_fini(void *handle) · 433 unmodified lines
12471265 for (i = 0; i < adev->sdma.num_instances; i++)
12481266 amdgpu_ring_fini(&adev->sdma.instance[i].ring);
12491267
1268+ sdma_v3_0_free_microcode(adev);
12501269 return 0;
12511270 }
12521271
drivers/gpu/drm/amd/amdgpu/tonga_dpm.c+5−0
@@ -71,6 +71,11 @@ static int tonga_dpm_sw_init(void *handle) · 70 unmodified lines
7171
7272 static int tonga_dpm_sw_fini(void *handle)
7373 {
74+ struct amdgpu_device *adev = (struct amdgpu_device *)handle;
75+
76+ release_firmware(adev->pm.fw);
77+ adev->pm.fw = NULL;
78+
7479 return 0;
7580 }
7681
drivers/gpu/drm/amd/amdgpu/vi.c+15−0
@@ -421,6 +421,20 @@ static bool vi_read_bios_from_rom(struct amdgpu_device *adev, · 420 unmodified lines
421421 return true;
422422 }
423423
424+static u32 vi_get_virtual_caps(struct amdgpu_device *adev)
425+{
426+ u32 caps = 0;
427+ u32 reg = RREG32(mmBIF_IOV_FUNC_IDENTIFIER);
428+
429+ if (REG_GET_FIELD(reg, BIF_IOV_FUNC_IDENTIFIER, IOV_ENABLE))
430+ caps |= AMDGPU_VIRT_CAPS_SRIOV_EN;
431+
432+ if (REG_GET_FIELD(reg, BIF_IOV_FUNC_IDENTIFIER, FUNC_IDENTIFIER))
433+ caps |= AMDGPU_VIRT_CAPS_IS_VF;
434+
435+ return caps;
436+}
437+
424438 static const struct amdgpu_allowed_register_entry tonga_allowed_read_registers[] = {
425439 {mmGB_MACROTILE_MODE7, true},
426440 };
@@ -1118,6 +1132,7 @@ static const struct amdgpu_asic_funcs vi_asic_funcs = · 691 unmodified lines
11181132 .get_xclk = &vi_get_xclk,
11191133 .set_uvd_clocks = &vi_set_uvd_clocks,
11201134 .set_vce_clocks = &vi_set_vce_clocks,
1135+ .get_virtual_caps = &vi_get_virtual_caps,
11211136 /* these should be moved to their own ip modules */
11221137 .get_gpu_clock_counter = &gfx_v8_0_get_gpu_clock_counter,
11231138 .wait_for_mc_idle = &gmc_v8_0_mc_wait_for_idle,
drivers/gpu/drm/amd/amdkfd/kfd_process.c+43−27
@@ -242,13 +242,19 @@ static void kfd_process_notifier_release(struct mmu_notifier *mn, · 241 unmodified lines
242242 pqm_uninit(&p->pqm);
243243
244244 /* Iterate over all process device data structure and check
245− * if we should reset all wavefronts */
246− list_for_each_entry(pdd, &p->per_device_data, per_device_list)
245+ * if we should delete debug managers and reset all wavefronts
246+ */
247+ list_for_each_entry(pdd, &p->per_device_data, per_device_list) {
248+ if ((pdd->dev->dbgmgr) &&
249+ (pdd->dev->dbgmgr->pasid == p->pasid))
250+ kfd_dbgmgr_destroy(pdd->dev->dbgmgr);
251+
247252 if (pdd->reset_wavefronts) {
248253 pr_warn("amdkfd: Resetting all wave fronts\n");
249254 dbgdev_wave_reset_wavefronts(pdd->dev, p);
250255 pdd->reset_wavefronts = false;
251256 }
257+ }
252258
253259 mutex_unlock(&p->mutex);
254260
@@ -404,42 +410,52 @@ void kfd_unbind_process_from_device(struct kfd_dev *dev, unsigned int pasid) · 149 unmodified lines
404410
405411 idx = srcu_read_lock(&kfd_processes_srcu);
406412
413+ /*
414+ * Look for the process that matches the pasid. If there is no such
415+ * process, we either released it in amdkfd's own notifier, or there
416+ * is a bug. Unfortunately, there is no way to tell...
417+ */
407418 hash_for_each_rcu(kfd_processes_table, i, p, kfd_processes)
408− if (p->pasid == pasid)
409− break;
419+ if (p->pasid == pasid) {
410420
411− srcu_read_unlock(&kfd_processes_srcu, idx);
421+ srcu_read_unlock(&kfd_processes_srcu, idx);
412422
413− BUG_ON(p->pasid != pasid);
423+ pr_debug("Unbinding process %d from IOMMU\n", pasid);
414424
415− mutex_lock(&p->mutex);
425+ mutex_lock(&p->mutex);
416426
417− if ((dev->dbgmgr) && (dev->dbgmgr->pasid == p->pasid))
418− kfd_dbgmgr_destroy(dev->dbgmgr);
427+ if ((dev->dbgmgr) && (dev->dbgmgr->pasid == p->pasid))
428+ kfd_dbgmgr_destroy(dev->dbgmgr);
419429
420− pqm_uninit(&p->pqm);
430+ pqm_uninit(&p->pqm);
421431
422− pdd = kfd_get_process_device_data(dev, p);
432+ pdd = kfd_get_process_device_data(dev, p);
423433
424− if (!pdd) {
425− mutex_unlock(&p->mutex);
426− return;
427− }
434+ if (!pdd) {
435+ mutex_unlock(&p->mutex);
436+ return;
437+ }
428438
429− if (pdd->reset_wavefronts) {
430− dbgdev_wave_reset_wavefronts(pdd->dev, p);
431− pdd->reset_wavefronts = false;
432− }
439+ if (pdd->reset_wavefronts) {
440+ dbgdev_wave_reset_wavefronts(pdd->dev, p);
441+ pdd->reset_wavefronts = false;
442+ }
433443
434− /*
435− * Just mark pdd as unbound, because we still need it to call
436− * amd_iommu_unbind_pasid() in when the process exits.
437− * We don't call amd_iommu_unbind_pasid() here
438− * because the IOMMU called us.
439− */
440− pdd->bound = false;
444+ /*
445+ * Just mark pdd as unbound, because we still need it
446+ * to call amd_iommu_unbind_pasid() in when the
447+ * process exits.
448+ * We don't call amd_iommu_unbind_pasid() here
449+ * because the IOMMU called us.
450+ */
451+ pdd->bound = false;
441452
442− mutex_unlock(&p->mutex);
453+ mutex_unlock(&p->mutex);
454+
455+ return;
456+ }
457+
458+ srcu_read_unlock(&kfd_processes_srcu, idx);
443459 }
444460
445461 struct kfd_process_device *kfd_get_first_process_device_data(struct kfd_process *p)
drivers/gpu/drm/amd/amdkfd/kfd_topology.c+1−1
@@ -666,7 +666,7 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr, · 665 unmodified lines
666666 dev->node_props.simd_count);
667667
668668 if (dev->mem_bank_count < dev->node_props.mem_banks_count) {
669− pr_warn("kfd: mem_banks_count truncated from %d to %d\n",
669+ pr_info_once("kfd: mem_banks_count truncated from %d to %d\n",
670670 dev->node_props.mem_banks_count,
671671 dev->mem_bank_count);
672672 sysfs_show_32bit_prop(buffer, "mem_banks_count",
drivers/gpu/drm/amd/include/amd_shared.h+1−0
@@ -157,6 +157,7 @@ struct amd_ip_funcs { · 156 unmodified lines
157157 int (*hw_init)(void *handle);
158158 /* tears down the hw state */
159159 int (*hw_fini)(void *handle);
160+ void (*late_fini)(void *handle);
160161 /* handles IP specific hw/sw changes for suspend */
161162 int (*suspend)(void *handle);
162163 /* handles IP specific hw/sw changes for resume */
drivers/gpu/drm/amd/include/cgs_common.h+6−0
@@ -581,6 +581,9 @@ typedef int (*cgs_get_firmware_info)(struct cgs_device *cgs_device, · 580 unmodified lines
581581 enum cgs_ucode_id type,
582582 struct cgs_firmware_info *info);
583583
584+typedef int (*cgs_rel_firmware)(struct cgs_device *cgs_device,
585+ enum cgs_ucode_id type);
586+
584587 typedef int(*cgs_set_powergating_state)(struct cgs_device *cgs_device,
585588 enum amd_ip_block_type block_type,
586589 enum amd_powergating_state state);
@@ -645,6 +648,7 @@ struct cgs_ops { · 58 unmodified lines
645648 cgs_set_camera_voltages_t set_camera_voltages;
646649 /* Firmware Info */
647650 cgs_get_firmware_info get_firmware_info;
651+ cgs_rel_firmware rel_firmware;
648652 /* cg pg interface*/
649653 cgs_set_powergating_state set_powergating_state;
650654 cgs_set_clockgating_state set_clockgating_state;
@@ -738,6 +742,8 @@ struct cgs_device · 87 unmodified lines
738742 CGS_CALL(set_camera_voltages,dev,mask,voltages)
739743 #define cgs_get_firmware_info(dev, type, info) \
740744 CGS_CALL(get_firmware_info, dev, type, info)
745+#define cgs_rel_firmware(dev, type) \
746+ CGS_CALL(rel_firmware, dev, type)
741747 #define cgs_set_powergating_state(dev, block_type, state) \
742748 CGS_CALL(set_powergating_state, dev, block_type, state)
743749 #define cgs_set_clockgating_state(dev, block_type, state) \
drivers/gpu/drm/amd/powerplay/amd_powerplay.c+7−1
@@ -73,11 +73,14 @@ static int pp_sw_init(void *handle) · 72 unmodified lines
7373
7474 ret = hwmgr->hwmgr_func->backend_init(hwmgr);
7575 if (ret)
76− goto err;
76+ goto err1;
7777
7878 pr_info("amdgpu: powerplay initialized\n");
7979
8080 return 0;
81+err1:
82+ if (hwmgr->pptable_func->pptable_fini)
83+ hwmgr->pptable_func->pptable_fini(hwmgr);
8184 err:
8285 pr_err("amdgpu: powerplay initialization failed\n");
8386 return ret;
@@ -100,6 +103,9 @@ static int pp_sw_fini(void *handle) · 16 unmodified lines
100103 if (hwmgr->hwmgr_func->backend_fini != NULL)
101104 ret = hwmgr->hwmgr_func->backend_fini(hwmgr);
102105
106+ if (hwmgr->pptable_func->pptable_fini)
107+ hwmgr->pptable_func->pptable_fini(hwmgr);
108+
103109 return ret;
104110 }
105111
drivers/gpu/drm/amd/powerplay/eventmgr/eventmgr.c+0−3
@@ -58,9 +58,6 @@ static void pem_fini(struct pp_eventmgr *eventmgr) · 57 unmodified lines
5858 pem_unregister_interrupts(eventmgr);
5959
6060 pem_handle_event(eventmgr, AMD_PP_EVENT_UNINITIALIZE, &event_data);
61−
62− if (eventmgr != NULL)
63− kfree(eventmgr);
6461 }
6562
6663 int eventmgr_init(struct pp_instance *handle)
drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c+1−1
@@ -1830,7 +1830,7 @@ static uint16_t fiji_find_closest_vddci(struct pp_hwmgr *hwmgr, uint16_t vddci) · 1829 unmodified lines
18301830
18311831 PP_ASSERT_WITH_CODE(false,
18321832 "VDDCI is larger than max VDDCI in VDDCI Voltage Table!",
1833− return vddci_table->entries[i].value);
1833+ return vddci_table->entries[i-1].value);
18341834 }
18351835
18361836 static int fiji_get_dependency_volt_by_clk(struct pp_hwmgr *hwmgr,
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c+8−1
@@ -93,6 +93,13 @@ int hwmgr_fini(struct pp_hwmgr *hwmgr) · 92 unmodified lines
9393 if (hwmgr == NULL || hwmgr->ps == NULL)
9494 return -EINVAL;
9595
96+ /* do hwmgr finish*/
97+ kfree(hwmgr->backend);
98+
99+ kfree(hwmgr->start_thermal_controller.function_list);
100+
101+ kfree(hwmgr->set_temperature_range.function_list);
102+
96103 kfree(hwmgr->ps);
97104 kfree(hwmgr);
98105 return 0;
@@ -462,7 +469,7 @@ uint16_t phm_find_closest_vddci(struct pp_atomctrl_voltage_table *vddci_table, u · 363 unmodified lines
462469
463470 PP_ASSERT_WITH_CODE(false,
464471 "VDDCI is larger than max VDDCI in VDDCI Voltage Table!",
465− return vddci_table->entries[i].value);
472+ return vddci_table->entries[i-1].value);
466473 }
467474
468475 int phm_find_boot_level(void *table,
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr_ppt.h+1−0
@@ -39,6 +39,7 @@ struct phm_ppt_v1_clock_voltage_dependency_record { · 38 unmodified lines
3939 uint8_t phases;
4040 uint8_t cks_enable;
4141 uint8_t cks_voffset;
42+ uint32_t sclk_offset;
4243 };
4344
4445 typedef struct phm_ppt_v1_clock_voltage_dependency_record phm_ppt_v1_clock_voltage_dependency_record;
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c+17−11
@@ -999,7 +999,7 @@ static int polaris10_get_dependency_volt_by_clk(struct pp_hwmgr *hwmgr, · 998 unmodified lines
999999 vddci = phm_find_closest_vddci(&(data->vddci_voltage_table),
10001000 (dep_table->entries[i].vddc -
10011001 (uint16_t)data->vddc_vddci_delta));
1002− *voltage |= (vddci * VOLTAGE_SCALE) << VDDCI_SHIFT;
1002+ *voltage |= (vddci * VOLTAGE_SCALE) << VDDCI_SHIFT;
10031003 }
10041004
10051005 if (POLARIS10_VOLTAGE_CONTROL_NONE == data->mvdd_control)
@@ -3520,10 +3520,11 @@ static int polaris10_get_pp_table_entry_callback_func(struct pp_hwmgr *hwmgr, · 2514 unmodified lines
35203520 ATOM_Tonga_State *state_entry = (ATOM_Tonga_State *)state;
35213521 ATOM_Tonga_POWERPLAYTABLE *powerplay_table =
35223522 (ATOM_Tonga_POWERPLAYTABLE *)pp_table;
3523− ATOM_Tonga_SCLK_Dependency_Table *sclk_dep_table =
3524− (ATOM_Tonga_SCLK_Dependency_Table *)
3523+ PPTable_Generic_SubTable_Header *sclk_dep_table =
3524+ (PPTable_Generic_SubTable_Header *)
35253525 (((unsigned long)powerplay_table) +
35263526 le16_to_cpu(powerplay_table->usSclkDependencyTableOffset));
3527+
35273528 ATOM_Tonga_MCLK_Dependency_Table *mclk_dep_table =
35283529 (ATOM_Tonga_MCLK_Dependency_Table *)
35293530 (((unsigned long)powerplay_table) +
@@ -3575,7 +3576,11 @@ static int polaris10_get_pp_table_entry_callback_func(struct pp_hwmgr *hwmgr, · 45 unmodified lines
35753576 /* Performance levels are arranged from low to high. */
35763577 performance_level->memory_clock = mclk_dep_table->entries
35773578 [state_entry->ucMemoryClockIndexLow].ulMclk;
3578− performance_level->engine_clock = sclk_dep_table->entries
3579+ if (sclk_dep_table->ucRevId == 0)
3580+ performance_level->engine_clock = ((ATOM_Tonga_SCLK_Dependency_Table *)sclk_dep_table)->entries
3581+ [state_entry->ucEngineClockIndexLow].ulSclk;
3582+ else if (sclk_dep_table->ucRevId == 1)
3583+ performance_level->engine_clock = ((ATOM_Polaris_SCLK_Dependency_Table *)sclk_dep_table)->entries
35793584 [state_entry->ucEngineClockIndexLow].ulSclk;
35803585 performance_level->pcie_gen = get_pcie_gen_support(data->pcie_gen_cap,
35813586 state_entry->ucPCIEGenLow);
@@ -3586,8 +3591,14 @@ static int polaris10_get_pp_table_entry_callback_func(struct pp_hwmgr *hwmgr, · 4 unmodified lines
35863591 [polaris10_power_state->performance_level_count++]);
35873592 performance_level->memory_clock = mclk_dep_table->entries
35883593 [state_entry->ucMemoryClockIndexHigh].ulMclk;
3589− performance_level->engine_clock = sclk_dep_table->entries
3594+
3595+ if (sclk_dep_table->ucRevId == 0)
3596+ performance_level->engine_clock = ((ATOM_Tonga_SCLK_Dependency_Table *)sclk_dep_table)->entries
35903597 [state_entry->ucEngineClockIndexHigh].ulSclk;
3598+ else if (sclk_dep_table->ucRevId == 1)
3599+ performance_level->engine_clock = ((ATOM_Polaris_SCLK_Dependency_Table *)sclk_dep_table)->entries
3600+ [state_entry->ucEngineClockIndexHigh].ulSclk;
3601+
35913602 performance_level->pcie_gen = get_pcie_gen_support(data->pcie_gen_cap,
35923603 state_entry->ucPCIEGenHigh);
35933604 performance_level->pcie_lane = get_pcie_lane_support(data->pcie_lane_cap,
@@ -3645,7 +3656,6 @@ static int polaris10_get_pp_table_entry(struct pp_hwmgr *hwmgr, · 51 unmodified lines
36453656 switch (state->classification.ui_label) {
36463657 case PP_StateUILabel_Performance:
36473658 data->use_pcie_performance_levels = true;
3648−
36493659 for (i = 0; i < ps->performance_level_count; i++) {
36503660 if (data->pcie_gen_performance.max <
36513661 ps->performance_levels[i].pcie_gen)
@@ -3661,7 +3671,6 @@ static int polaris10_get_pp_table_entry(struct pp_hwmgr *hwmgr, · 9 unmodified lines
36613671 ps->performance_levels[i].pcie_lane)
36623672 data->pcie_lane_performance.max =
36633673 ps->performance_levels[i].pcie_lane;
3664−
36653674 if (data->pcie_lane_performance.min >
36663675 ps->performance_levels[i].pcie_lane)
36673676 data->pcie_lane_performance.min =
@@ -4187,12 +4196,9 @@ int polaris10_update_samu_dpm(struct pp_hwmgr *hwmgr, bool bgate) · 519 unmodified lines
41874196 {
41884197 struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend);
41894198 uint32_t mm_boot_level_offset, mm_boot_level_value;
4190− struct phm_ppt_v1_information *table_info =
4191− (struct phm_ppt_v1_information *)(hwmgr->pptable);
41924199
41934200 if (!bgate) {
4194− data->smc_state_table.SamuBootLevel =
4195− (uint8_t) (table_info->mm_dep_table->count - 1);
4201+ data->smc_state_table.SamuBootLevel = 0;
41964202 mm_boot_level_offset = data->dpm_table_start +
41974203 offsetof(SMU74_Discrete_DpmTable, SamuBootLevel);
41984204 mm_boot_level_offset /= 4;
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_powertune.c+1−1
@@ -286,7 +286,7 @@ int polaris10_populate_pm_fuses(struct pp_hwmgr *hwmgr) · 285 unmodified lines
286286
287287 if (polaris10_copy_bytes_to_smc(hwmgr->smumgr, pm_fuse_table_offset,
288288 (uint8_t *)&data->power_tune_table,
289− sizeof(struct SMU74_Discrete_PmFuses), data->sram_end))
289+ (sizeof(struct SMU74_Discrete_PmFuses) - 92), data->sram_end))
290290 PP_ASSERT_WITH_CODE(false,
291291 "Attempt to download PmFuseTable Failed!",
292292 return -EINVAL);
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c+0−21
@@ -2847,27 +2847,6 @@ static int tonga_setup_default_dpm_tables(struct pp_hwmgr *hwmgr) · 2846 unmodified lines
28472847 }
28482848 }
28492849
2850− /* Initialize Vddc DPM table based on allow Vddc values. And populate corresponding std values. */
2851− for (i = 0; i < allowed_vdd_sclk_table->count; i++) {
2852− data->dpm_table.vddc_table.dpm_levels[i].value = allowed_vdd_mclk_table->entries[i].vddc;
2853− /* tonga_hwmgr->dpm_table.VddcTable.dpm_levels[i].param1 = stdVoltageTable->entries[i].Leakage; */
2854− /* param1 is for corresponding std voltage */
2855− data->dpm_table.vddc_table.dpm_levels[i].enabled = 1;
2856− }
2857− data->dpm_table.vddc_table.count = allowed_vdd_sclk_table->count;
2858−
2859− if (NULL != allowed_vdd_mclk_table) {
2860− /* Initialize Vddci DPM table based on allow Mclk values */
2861− for (i = 0; i < allowed_vdd_mclk_table->count; i++) {
2862− data->dpm_table.vdd_ci_table.dpm_levels[i].value = allowed_vdd_mclk_table->entries[i].vddci;
2863− data->dpm_table.vdd_ci_table.dpm_levels[i].enabled = 1;
2864− data->dpm_table.mvdd_table.dpm_levels[i].value = allowed_vdd_mclk_table->entries[i].mvdd;
2865− data->dpm_table.mvdd_table.dpm_levels[i].enabled = 1;
2866− }
2867− data->dpm_table.vdd_ci_table.count = allowed_vdd_mclk_table->count;
2868− data->dpm_table.mvdd_table.count = allowed_vdd_mclk_table->count;
2869− }
2870−
28712850 /* setup PCIE gen speed levels*/
28722851 tonga_setup_default_pcie_tables(hwmgr);
28732852
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_pptable.h+16−0
@@ -197,6 +197,22 @@ typedef struct _ATOM_Tonga_SCLK_Dependency_Table { · 196 unmodified lines
197197 ATOM_Tonga_SCLK_Dependency_Record entries[1]; /* Dynamically allocate entries. */
198198 } ATOM_Tonga_SCLK_Dependency_Table;
199199
200+typedef struct _ATOM_Polaris_SCLK_Dependency_Record {
201+ UCHAR ucVddInd; /* Base voltage */
202+ USHORT usVddcOffset; /* Offset relative to base voltage */
203+ ULONG ulSclk;
204+ USHORT usEdcCurrent;
205+ UCHAR ucReliabilityTemperature;
206+ UCHAR ucCKSVOffsetandDisable; /* Bits 0~6: Voltage offset for CKS, Bit 7: Disable/enable for the SCLK level. */
207+ ULONG ulSclkOffset;
208+} ATOM_Polaris_SCLK_Dependency_Record;
209+
210+typedef struct _ATOM_Polaris_SCLK_Dependency_Table {
211+ UCHAR ucRevId;
212+ UCHAR ucNumEntries; /* Number of entries. */
213+ ATOM_Polaris_SCLK_Dependency_Record entries[1]; /* Dynamically allocate entries. */
214+} ATOM_Polaris_SCLK_Dependency_Table;
215+
200216 typedef struct _ATOM_Tonga_PCIE_Record {
201217 UCHAR ucPCIEGenSpeed;
202218 UCHAR usPCIELaneWidth;
drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c+89−56
@@ -408,41 +408,78 @@ static int get_mclk_voltage_dependency_table( · 407 unmodified lines
408408 static int get_sclk_voltage_dependency_table(
409409 struct pp_hwmgr *hwmgr,
410410 phm_ppt_v1_clock_voltage_dependency_table **pp_tonga_sclk_dep_table,
411− const ATOM_Tonga_SCLK_Dependency_Table * sclk_dep_table
411+ const PPTable_Generic_SubTable_Header *sclk_dep_table
412412 )
413413 {
414414 uint32_t table_size, i;
415415 phm_ppt_v1_clock_voltage_dependency_table *sclk_table;
416416
417− PP_ASSERT_WITH_CODE((0 != sclk_dep_table->ucNumEntries),
418− "Invalid PowerPlay Table!", return -1);
417+ if (sclk_dep_table->ucRevId < 1) {
418+ const ATOM_Tonga_SCLK_Dependency_Table *tonga_table =
419+ (ATOM_Tonga_SCLK_Dependency_Table *)sclk_dep_table;
419420
420− table_size = sizeof(uint32_t) + sizeof(phm_ppt_v1_clock_voltage_dependency_record)
421− * sclk_dep_table->ucNumEntries;
421+ PP_ASSERT_WITH_CODE((0 != tonga_table->ucNumEntries),
422+ "Invalid PowerPlay Table!", return -1);
422423
423− sclk_table = (phm_ppt_v1_clock_voltage_dependency_table *)
424− kzalloc(table_size, GFP_KERNEL);
424+ table_size = sizeof(uint32_t) + sizeof(phm_ppt_v1_clock_voltage_dependency_record)
425+ * tonga_table->ucNumEntries;
425426
426− if (NULL == sclk_table)
427− return -ENOMEM;
427+ sclk_table = (phm_ppt_v1_clock_voltage_dependency_table *)
428+ kzalloc(table_size, GFP_KERNEL);
428429
429− memset(sclk_table, 0x00, table_size);
430−
431− sclk_table->count = (uint32_t)sclk_dep_table->ucNumEntries;
432−
433− for (i = 0; i < sclk_dep_table->ucNumEntries; i++) {
434− sclk_table->entries[i].vddInd =
435− sclk_dep_table->entries[i].ucVddInd;
436− sclk_table->entries[i].vdd_offset =
437− sclk_dep_table->entries[i].usVddcOffset;
438− sclk_table->entries[i].clk =
439− sclk_dep_table->entries[i].ulSclk;
440− sclk_table->entries[i].cks_enable =
441− (((sclk_dep_table->entries[i].ucCKSVOffsetandDisable & 0x80) >> 7) == 0) ? 1 : 0;
442− sclk_table->entries[i].cks_voffset =
443− (sclk_dep_table->entries[i].ucCKSVOffsetandDisable & 0x7F);
444− }
430+ if (NULL == sclk_table)
431+ return -ENOMEM;
432+
433+ memset(sclk_table, 0x00, table_size);
434+
435+ sclk_table->count = (uint32_t)tonga_table->ucNumEntries;
436+
437+ for (i = 0; i < tonga_table->ucNumEntries; i++) {
438+ sclk_table->entries[i].vddInd =
439+ tonga_table->entries[i].ucVddInd;
440+ sclk_table->entries[i].vdd_offset =
441+ tonga_table->entries[i].usVddcOffset;
442+ sclk_table->entries[i].clk =
443+ tonga_table->entries[i].ulSclk;
444+ sclk_table->entries[i].cks_enable =
445+ (((tonga_table->entries[i].ucCKSVOffsetandDisable & 0x80) >> 7) == 0) ? 1 : 0;
446+ sclk_table->entries[i].cks_voffset =
447+ (tonga_table->entries[i].ucCKSVOffsetandDisable & 0x7F);
448+ }
449+ } else {
450+ const ATOM_Polaris_SCLK_Dependency_Table *polaris_table =
451+ (ATOM_Polaris_SCLK_Dependency_Table *)sclk_dep_table;
452+
453+ PP_ASSERT_WITH_CODE((0 != polaris_table->ucNumEntries),
454+ "Invalid PowerPlay Table!", return -1);
455+
456+ table_size = sizeof(uint32_t) + sizeof(phm_ppt_v1_clock_voltage_dependency_record)
457+ * polaris_table->ucNumEntries;
458+
459+ sclk_table = (phm_ppt_v1_clock_voltage_dependency_table *)
460+ kzalloc(table_size, GFP_KERNEL);
445461
462+ if (NULL == sclk_table)
463+ return -ENOMEM;
464+
465+ memset(sclk_table, 0x00, table_size);
466+
467+ sclk_table->count = (uint32_t)polaris_table->ucNumEntries;
468+
469+ for (i = 0; i < polaris_table->ucNumEntries; i++) {
470+ sclk_table->entries[i].vddInd =
471+ polaris_table->entries[i].ucVddInd;
472+ sclk_table->entries[i].vdd_offset =
473+ polaris_table->entries[i].usVddcOffset;
474+ sclk_table->entries[i].clk =
475+ polaris_table->entries[i].ulSclk;
476+ sclk_table->entries[i].cks_enable =
477+ (((polaris_table->entries[i].ucCKSVOffsetandDisable & 0x80) >> 7) == 0) ? 1 : 0;
478+ sclk_table->entries[i].cks_voffset =
479+ (polaris_table->entries[i].ucCKSVOffsetandDisable & 0x7F);
480+ sclk_table->entries[i].sclk_offset = polaris_table->entries[i].ulSclkOffset;
481+ }
482+ }
446483 *pp_tonga_sclk_dep_table = sclk_table;
447484
448485 return 0;
@@ -708,8 +745,8 @@ static int init_clock_voltage_dependency( · 259 unmodified lines
708745 const ATOM_Tonga_MCLK_Dependency_Table *mclk_dep_table =
709746 (const ATOM_Tonga_MCLK_Dependency_Table *)(((unsigned long) powerplay_table) +
710747 le16_to_cpu(powerplay_table->usMclkDependencyTableOffset));
711− const ATOM_Tonga_SCLK_Dependency_Table *sclk_dep_table =
712− (const ATOM_Tonga_SCLK_Dependency_Table *)(((unsigned long) powerplay_table) +
748+ const PPTable_Generic_SubTable_Header *sclk_dep_table =
749+ (const PPTable_Generic_SubTable_Header *)(((unsigned long) powerplay_table) +
713750 le16_to_cpu(powerplay_table->usSclkDependencyTableOffset));
714751 const ATOM_Tonga_Hard_Limit_Table *pHardLimits =
715752 (const ATOM_Tonga_Hard_Limit_Table *)(((unsigned long) powerplay_table) +
@@ -1040,48 +1077,44 @@ int tonga_pp_tables_uninitialize(struct pp_hwmgr *hwmgr) · 324 unmodified lines
10401077 struct phm_ppt_v1_information *pp_table_information =
10411078 (struct phm_ppt_v1_information *)(hwmgr->pptable);
10421079
1043− if (NULL != hwmgr->soft_pp_table) {
1044− kfree(hwmgr->soft_pp_table);
1080+ if (NULL != hwmgr->soft_pp_table)
10451081 hwmgr->soft_pp_table = NULL;
1046− }
10471082
1048− if (NULL != pp_table_information->vdd_dep_on_sclk)
1049− pp_table_information->vdd_dep_on_sclk = NULL;
1083+ kfree(pp_table_information->vdd_dep_on_sclk);
1084+ pp_table_information->vdd_dep_on_sclk = NULL;
10501085
1051− if (NULL != pp_table_information->vdd_dep_on_mclk)
1052− pp_table_information->vdd_dep_on_mclk = NULL;
1086+ kfree(pp_table_information->vdd_dep_on_mclk);
1087+ pp_table_information->vdd_dep_on_mclk = NULL;
10531088
1054− if (NULL != pp_table_information->valid_mclk_values)
1055− pp_table_information->valid_mclk_values = NULL;
1089+ kfree(pp_table_information->valid_mclk_values);
1090+ pp_table_information->valid_mclk_values = NULL;
10561091
1057− if (NULL != pp_table_information->valid_sclk_values)
1058− pp_table_information->valid_sclk_values = NULL;
1092+ kfree(pp_table_information->valid_sclk_values);
1093+ pp_table_information->valid_sclk_values = NULL;
10591094
1060− if (NULL != pp_table_information->vddc_lookup_table)
1061− pp_table_information->vddc_lookup_table = NULL;
1095+ kfree(pp_table_information->vddc_lookup_table);
1096+ pp_table_information->vddc_lookup_table = NULL;
10621097
1063− if (NULL != pp_table_information->vddgfx_lookup_table)
1064− pp_table_information->vddgfx_lookup_table = NULL;
1098+ kfree(pp_table_information->vddgfx_lookup_table);
1099+ pp_table_information->vddgfx_lookup_table = NULL;
10651100
1066− if (NULL != pp_table_information->mm_dep_table)
1067− pp_table_information->mm_dep_table = NULL;
1101+ kfree(pp_table_information->mm_dep_table);
1102+ pp_table_information->mm_dep_table = NULL;
10681103
1069− if (NULL != pp_table_information->cac_dtp_table)
1070− pp_table_information->cac_dtp_table = NULL;
1104+ kfree(pp_table_information->cac_dtp_table);
1105+ pp_table_information->cac_dtp_table = NULL;
10711106
1072− if (NULL != hwmgr->dyn_state.cac_dtp_table)
1073− hwmgr->dyn_state.cac_dtp_table = NULL;
1107+ kfree(hwmgr->dyn_state.cac_dtp_table);
1108+ hwmgr->dyn_state.cac_dtp_table = NULL;
10741109
1075− if (NULL != pp_table_information->ppm_parameter_table)
1076− pp_table_information->ppm_parameter_table = NULL;
1110+ kfree(pp_table_information->ppm_parameter_table);
1111+ pp_table_information->ppm_parameter_table = NULL;
10771112
1078− if (NULL != pp_table_information->pcie_table)
1079− pp_table_information->pcie_table = NULL;
1113+ kfree(pp_table_information->pcie_table);
1114+ pp_table_information->pcie_table = NULL;
10801115
1081− if (NULL != hwmgr->pptable) {
1082− kfree(hwmgr->pptable);
1083− hwmgr->pptable = NULL;
1084− }
1116+ kfree(hwmgr->pptable);
1117+ hwmgr->pptable = NULL;
10851118
10861119 return result;
10871120 }
drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c+6−0
@@ -1006,10 +1006,16 @@ static int fiji_smu_init(struct pp_smumgr *smumgr) · 1005 unmodified lines
10061006
10071007 static int fiji_smu_fini(struct pp_smumgr *smumgr)
10081008 {
1009+ struct fiji_smumgr *priv = (struct fiji_smumgr *)(smumgr->backend);
1010+
1011+ smu_free_memory(smumgr->device, (void *)priv->header_buffer.handle);
1012+
10091013 if (smumgr->backend) {
10101014 kfree(smumgr->backend);
10111015 smumgr->backend = NULL;
10121016 }
1017+
1018+ cgs_rel_firmware(smumgr->device, CGS_UCODE_ID_SMU);
10131019 return 0;
10141020 }
10151021
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c+1−0
@@ -469,6 +469,7 @@ int polaris10_smu_fini(struct pp_smumgr *smumgr) · 468 unmodified lines
469469 kfree(smumgr->backend);
470470 smumgr->backend = NULL;
471471 }
472+ cgs_rel_firmware(smumgr->device, CGS_UCODE_ID_SMU);
472473 return 0;
473474 }
474475
drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c+1−0
@@ -81,6 +81,7 @@ int smum_init(struct amd_pp_init *pp_init, struct pp_instance *handle) · 80 unmodified lines
8181
8282 int smum_fini(struct pp_smumgr *smumgr)
8383 {
84+ kfree(smumgr->device);
8485 kfree(smumgr);
8586 return 0;
8687 }
drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c+7−0
@@ -328,10 +328,17 @@ int tonga_write_smc_sram_dword(struct pp_smumgr *smumgr, · 327 unmodified lines
328328
329329 static int tonga_smu_fini(struct pp_smumgr *smumgr)
330330 {
331+ struct tonga_smumgr *priv = (struct tonga_smumgr *)(smumgr->backend);
332+
333+ smu_free_memory(smumgr->device, (void *)priv->smu_buffer.handle);
334+ smu_free_memory(smumgr->device, (void *)priv->header_buffer.handle);
335+
331336 if (smumgr->backend != NULL) {
332337 kfree(smumgr->backend);
333338 smumgr->backend = NULL;
334339 }
340+
341+ cgs_rel_firmware(smumgr->device, CGS_UCODE_ID_SMU);
335342 return 0;
336343 }
337344
drivers/gpu/drm/drm_crtc_helper.c+28−26
@@ -528,11 +528,11 @@ drm_crtc_helper_disable(struct drm_crtc *crtc) · 527 unmodified lines
528528 int drm_crtc_helper_set_config(struct drm_mode_set *set)
529529 {
530530 struct drm_device *dev;
531− struct drm_crtc *new_crtc;
532− struct drm_encoder *save_encoders, *new_encoder, *encoder;
531+ struct drm_crtc **save_encoder_crtcs, *new_crtc;
532+ struct drm_encoder **save_connector_encoders, *new_encoder, *encoder;
533533 bool mode_changed = false; /* if true do a full mode set */
534534 bool fb_changed = false; /* if true and !mode_changed just do a flip */
535− struct drm_connector *save_connectors, *connector;
535+ struct drm_connector *connector;
536536 int count = 0, ro, fail = 0;
537537 const struct drm_crtc_helper_funcs *crtc_funcs;
538538 struct drm_mode_set save_set;
@@ -574,15 +574,15 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) · 35 unmodified lines
574574 * Allocate space for the backup of all (non-pointer) encoder and
575575 * connector data.
576576 */
577− save_encoders = kzalloc(dev->mode_config.num_encoder *
578− sizeof(struct drm_encoder), GFP_KERNEL);
579− if (!save_encoders)
577+ save_encoder_crtcs = kzalloc(dev->mode_config.num_encoder *
578+ sizeof(struct drm_crtc *), GFP_KERNEL);
579+ if (!save_encoder_crtcs)
580580 return -ENOMEM;
581581
582− save_connectors = kzalloc(dev->mode_config.num_connector *
583− sizeof(struct drm_connector), GFP_KERNEL);
584− if (!save_connectors) {
585− kfree(save_encoders);
582+ save_connector_encoders = kzalloc(dev->mode_config.num_connector *
583+ sizeof(struct drm_encoder *), GFP_KERNEL);
584+ if (!save_connector_encoders) {
585+ kfree(save_encoder_crtcs);
586586 return -ENOMEM;
587587 }
588588
@@ -593,12 +593,12 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) · 4 unmodified lines
593593 */
594594 count = 0;
595595 drm_for_each_encoder(encoder, dev) {
596− save_encoders[count++] = *encoder;
596+ save_encoder_crtcs[count++] = encoder->crtc;
597597 }
598598
599599 count = 0;
600600 drm_for_each_connector(connector, dev) {
601− save_connectors[count++] = *connector;
601+ save_connector_encoders[count++] = connector->encoder;
602602 }
603603
604604 save_set.crtc = set->crtc;
@@ -631,8 +631,12 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) · 26 unmodified lines
631631 mode_changed = true;
632632 }
633633
634− /* take a reference on all connectors in set */
634+ /* take a reference on all unbound connectors in set, reuse the
635+ * already taken reference for bound connectors
636+ */
635637 for (ro = 0; ro < set->num_connectors; ro++) {
638+ if (set->connectors[ro]->encoder)
639+ continue;
636640 drm_connector_reference(set->connectors[ro]);
637641 }
638642
@@ -754,30 +758,28 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) · 115 unmodified lines
754758 }
755759 }
756760
757− /* after fail drop reference on all connectors in save set */
758− count = 0;
759− drm_for_each_connector(connector, dev) {
760− drm_connector_unreference(&save_connectors[count++]);
761− }
762−
763− kfree(save_connectors);
764− kfree(save_encoders);
761+ kfree(save_connector_encoders);
762+ kfree(save_encoder_crtcs);
765763 return 0;
766764
767765 fail:
768766 /* Restore all previous data. */
769767 count = 0;
770768 drm_for_each_encoder(encoder, dev) {
771− *encoder = save_encoders[count++];
769+ encoder->crtc = save_encoder_crtcs[count++];
772770 }
773771
774772 count = 0;
775773 drm_for_each_connector(connector, dev) {
776− *connector = save_connectors[count++];
774+ connector->encoder = save_connector_encoders[count++];
777775 }
778776
779− /* after fail drop reference on all connectors in set */
777+ /* after fail drop reference on all unbound connectors in set, let
778+ * bound connectors keep their reference
779+ */
780780 for (ro = 0; ro < set->num_connectors; ro++) {
781+ if (set->connectors[ro]->encoder)
782+ continue;
781783 drm_connector_unreference(set->connectors[ro]);
782784 }
783785
@@ -787,8 +789,8 @@ fail: · 3 unmodified lines
787789 save_set.y, save_set.fb))
788790 DRM_ERROR("failed to restore config after modeset failure\n");
789791
790− kfree(save_connectors);
791− kfree(save_encoders);
792+ kfree(save_connector_encoders);
793+ kfree(save_encoder_crtcs);
792794 return ret;
793795 }
794796 EXPORT_SYMBOL(drm_crtc_helper_set_config);
drivers/gpu/drm/drm_dp_mst_topology.c+3−5
@@ -2927,11 +2927,9 @@ static void drm_dp_destroy_connector_work(struct work_struct *work) · 2926 unmodified lines
29272927 drm_dp_port_teardown_pdt(port, port->pdt);
29282928
29292929 if (!port->input && port->vcpi.vcpi > 0) {
2930− if (mgr->mst_state) {
2931− drm_dp_mst_reset_vcpi_slots(mgr, port);
2932− drm_dp_update_payload_part1(mgr);
2933− drm_dp_mst_put_payload_id(mgr, port->vcpi.vcpi);
2934− }
2930+ drm_dp_mst_reset_vcpi_slots(mgr, port);
2931+ drm_dp_update_payload_part1(mgr);
2932+ drm_dp_mst_put_payload_id(mgr, port->vcpi.vcpi);
29352933 }
29362934
29372935 kref_put(&port->kref, drm_dp_free_mst_port);
drivers/gpu/drm/etnaviv/etnaviv_iommu.c+1−0
@@ -225,6 +225,7 @@ struct iommu_domain *etnaviv_iommu_domain_alloc(struct etnaviv_gpu *gpu) · 224 unmodified lines
225225
226226 etnaviv_domain->domain.type = __IOMMU_DOMAIN_PAGING;
227227 etnaviv_domain->domain.ops = &etnaviv_iommu_ops.ops;
228+ etnaviv_domain->domain.pgsize_bitmap = SZ_4K;
228229 etnaviv_domain->domain.geometry.aperture_start = GPU_MEM_START;
229230 etnaviv_domain->domain.geometry.aperture_end = GPU_MEM_START + PT_ENTRIES * SZ_4K - 1;
230231
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c+2−1
@@ -42,9 +42,10 @@ static const struct regmap_config fsl_dcu_regmap_config = { · 41 unmodified lines
4242 .reg_bits = 32,
4343 .reg_stride = 4,
4444 .val_bits = 32,
45− .cache_type = REGCACHE_RBTREE,
45+ .cache_type = REGCACHE_FLAT,
4646
4747 .volatile_reg = fsl_dcu_drm_is_volatile_reg,
48+ .max_register = 0x11fc,
4849 };
4950
5051 static int fsl_dcu_drm_irq_init(struct drm_device *dev)
drivers/gpu/drm/i915/i915_drv.h+1−0
@@ -3481,6 +3481,7 @@ int intel_bios_init(struct drm_i915_private *dev_priv); · 3480 unmodified lines
34813481 bool intel_bios_is_valid_vbt(const void *buf, size_t size);
34823482 bool intel_bios_is_tv_present(struct drm_i915_private *dev_priv);
34833483 bool intel_bios_is_lvds_present(struct drm_i915_private *dev_priv, u8 *i2c_pin);
3484+bool intel_bios_is_port_present(struct drm_i915_private *dev_priv, enum port port);
34843485 bool intel_bios_is_port_edp(struct drm_i915_private *dev_priv, enum port port);
34853486 bool intel_bios_is_port_dp_dual_mode(struct drm_i915_private *dev_priv, enum port port);
34863487 bool intel_bios_is_dsi_present(struct drm_i915_private *dev_priv, enum port *port);
drivers/gpu/drm/i915/intel_bios.c+45−1
@@ -139,6 +139,11 @@ fill_detail_timing_data(struct drm_display_mode *panel_fixed_mode, · 138 unmodified lines
139139 else
140140 panel_fixed_mode->flags |= DRM_MODE_FLAG_NVSYNC;
141141
142+ panel_fixed_mode->width_mm = (dvo_timing->himage_hi << 8) |
143+ dvo_timing->himage_lo;
144+ panel_fixed_mode->height_mm = (dvo_timing->vimage_hi << 8) |
145+ dvo_timing->vimage_lo;
146+
142147 /* Some VBTs have bogus h/vtotal values */
143148 if (panel_fixed_mode->hsync_end > panel_fixed_mode->htotal)
144149 panel_fixed_mode->htotal = panel_fixed_mode->hsync_end + 1;
@@ -1187,7 +1192,7 @@ parse_device_mapping(struct drm_i915_private *dev_priv, · 1042 unmodified lines
11871192 }
11881193 if (bdb->version < 106) {
11891194 expected_size = 22;
1190− } else if (bdb->version < 109) {
1195+ } else if (bdb->version < 111) {
11911196 expected_size = 27;
11921197 } else if (bdb->version < 195) {
11931198 BUILD_BUG_ON(sizeof(struct old_child_dev_config) != 33);
@@ -1545,6 +1550,45 @@ bool intel_bios_is_lvds_present(struct drm_i915_private *dev_priv, u8 *i2c_pin) · 351 unmodified lines
15451550 return false;
15461551 }
15471552
1553+/**
1554+ * intel_bios_is_port_present - is the specified digital port present
1555+ * @dev_priv: i915 device instance
1556+ * @port: port to check
1557+ *
1558+ * Return true if the device in %port is present.
1559+ */
1560+bool intel_bios_is_port_present(struct drm_i915_private *dev_priv, enum port port)
1561+{
1562+ static const struct {
1563+ u16 dp, hdmi;
1564+ } port_mapping[] = {
1565+ [PORT_B] = { DVO_PORT_DPB, DVO_PORT_HDMIB, },
1566+ [PORT_C] = { DVO_PORT_DPC, DVO_PORT_HDMIC, },
1567+ [PORT_D] = { DVO_PORT_DPD, DVO_PORT_HDMID, },
1568+ [PORT_E] = { DVO_PORT_DPE, DVO_PORT_HDMIE, },
1569+ };
1570+ int i;
1571+
1572+ /* FIXME maybe deal with port A as well? */
1573+ if (WARN_ON(port == PORT_A) || port >= ARRAY_SIZE(port_mapping))
1574+ return false;
1575+
1576+ if (!dev_priv->vbt.child_dev_num)
1577+ return false;
1578+
1579+ for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
1580+ const union child_device_config *p_child =
1581+ &dev_priv->vbt.child_dev[i];
1582+ if ((p_child->common.dvo_port == port_mapping[port].dp ||
1583+ p_child->common.dvo_port == port_mapping[port].hdmi) &&
1584+ (p_child->common.device_type & (DEVICE_TYPE_TMDS_DVI_SIGNALING |
1585+ DEVICE_TYPE_DISPLAYPORT_OUTPUT)))
1586+ return true;
1587+ }
1588+
1589+ return false;
1590+}
1591+
15481592 /**
15491593 * intel_bios_is_port_edp - is the device in given port eDP
15501594 * @dev_priv: i915 device instance
drivers/gpu/drm/i915/intel_display.c+60−28
@@ -8275,12 +8275,14 @@ static void ironlake_init_pch_refclk(struct drm_device *dev) · 8274 unmodified lines
82758275 {
82768276 struct drm_i915_private *dev_priv = dev->dev_private;
82778277 struct intel_encoder *encoder;
8278+ int i;
82788279 u32 val, final;
82798280 bool has_lvds = false;
82808281 bool has_cpu_edp = false;
82818282 bool has_panel = false;
82828283 bool has_ck505 = false;
82838284 bool can_ssc = false;
8285+ bool using_ssc_source = false;
82848286
82858287 /* We need to take the global config into account */
82868288 for_each_intel_encoder(dev, encoder) {
@@ -8307,8 +8309,22 @@ static void ironlake_init_pch_refclk(struct drm_device *dev) · 20 unmodified lines
83078309 can_ssc = true;
83088310 }
83098311
8310− DRM_DEBUG_KMS("has_panel %d has_lvds %d has_ck505 %d\n",
8311− has_panel, has_lvds, has_ck505);
8312+ /* Check if any DPLLs are using the SSC source */
8313+ for (i = 0; i < dev_priv->num_shared_dpll; i++) {
8314+ u32 temp = I915_READ(PCH_DPLL(i));
8315+
8316+ if (!(temp & DPLL_VCO_ENABLE))
8317+ continue;
8318+
8319+ if ((temp & PLL_REF_INPUT_MASK) ==
8320+ PLLB_REF_INPUT_SPREADSPECTRUMIN) {
8321+ using_ssc_source = true;
8322+ break;
8323+ }
8324+ }
8325+
8326+ DRM_DEBUG_KMS("has_panel %d has_lvds %d has_ck505 %d using_ssc_source %d\n",
8327+ has_panel, has_lvds, has_ck505, using_ssc_source);
83128328
83138329 /* Ironlake: try to setup display ref clock before DPLL
83148330 * enabling. This is only under driver's control after
@@ -8345,9 +8361,9 @@ static void ironlake_init_pch_refclk(struct drm_device *dev) · 30 unmodified lines
83458361 final |= DREF_CPU_SOURCE_OUTPUT_NONSPREAD;
83468362 } else
83478363 final |= DREF_CPU_SOURCE_OUTPUT_DISABLE;
8348− } else {
8349− final |= DREF_SSC_SOURCE_DISABLE;
8350− final |= DREF_CPU_SOURCE_OUTPUT_DISABLE;
8364+ } else if (using_ssc_source) {
8365+ final |= DREF_SSC_SOURCE_ENABLE;
8366+ final |= DREF_SSC1_ENABLE;
83518367 }
83528368
83538369 if (final == val)
@@ -8393,7 +8409,7 @@ static void ironlake_init_pch_refclk(struct drm_device *dev) · 39 unmodified lines
83938409 POSTING_READ(PCH_DREF_CONTROL);
83948410 udelay(200);
83958411 } else {
8396− DRM_DEBUG_KMS("Disabling SSC entirely\n");
8412+ DRM_DEBUG_KMS("Disabling CPU source output\n");
83978413
83988414 val &= ~DREF_CPU_SOURCE_OUTPUT_MASK;
83998415
@@ -8404,16 +8420,20 @@ static void ironlake_init_pch_refclk(struct drm_device *dev) · 4 unmodified lines
84048420 POSTING_READ(PCH_DREF_CONTROL);
84058421 udelay(200);
84068422
8407− /* Turn off the SSC source */
8408− val &= ~DREF_SSC_SOURCE_MASK;
8409− val |= DREF_SSC_SOURCE_DISABLE;
8423+ if (!using_ssc_source) {
8424+ DRM_DEBUG_KMS("Disabling SSC source\n");
84108425
8411− /* Turn off SSC1 */
8412− val &= ~DREF_SSC1_ENABLE;
8426+ /* Turn off the SSC source */
8427+ val &= ~DREF_SSC_SOURCE_MASK;
8428+ val |= DREF_SSC_SOURCE_DISABLE;
84138429
8414− I915_WRITE(PCH_DREF_CONTROL, val);
8415− POSTING_READ(PCH_DREF_CONTROL);
8416− udelay(200);
8430+ /* Turn off SSC1 */
8431+ val &= ~DREF_SSC1_ENABLE;
8432+
8433+ I915_WRITE(PCH_DREF_CONTROL, val);
8434+ POSTING_READ(PCH_DREF_CONTROL);
8435+ udelay(200);
8436+ }
84178437 }
84188438
84198439 BUG_ON(val != final);
@@ -14554,6 +14574,8 @@ static void intel_setup_outputs(struct drm_device *dev) · 6134 unmodified lines
1455414574 if (I915_READ(PCH_DP_D) & DP_DETECTED)
1455514575 intel_dp_init(dev, PCH_DP_D, PORT_D);
1455614576 } else if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) {
14577+ bool has_edp, has_port;
14578+
1455714579 /*
1455814580 * The DP_DETECTED bit is the latched state of the DDC
1455914581 * SDA pin at boot. However since eDP doesn't require DDC
@@ -14562,27 +14584,37 @@ static void intel_setup_outputs(struct drm_device *dev) · 2 unmodified lines
1456214584 * Thus we can't rely on the DP_DETECTED bit alone to detect
1456314585 * eDP ports. Consult the VBT as well as DP_DETECTED to
1456414586 * detect eDP ports.
14587+ *
14588+ * Sadly the straps seem to be missing sometimes even for HDMI
14589+ * ports (eg. on Voyo V3 - CHT x7-Z8700), so check both strap
14590+ * and VBT for the presence of the port. Additionally we can't
14591+ * trust the port type the VBT declares as we've seen at least
14592+ * HDMI ports that the VBT claim are DP or eDP.
1456514593 */
14566− if (I915_READ(VLV_HDMIB) & SDVO_DETECTED &&
14567− !intel_dp_is_edp(dev, PORT_B))
14594+ has_edp = intel_dp_is_edp(dev, PORT_B);
14595+ has_port = intel_bios_is_port_present(dev_priv, PORT_B);
14596+ if (I915_READ(VLV_DP_B) & DP_DETECTED || has_port)
14597+ has_edp &= intel_dp_init(dev, VLV_DP_B, PORT_B);
14598+ if ((I915_READ(VLV_HDMIB) & SDVO_DETECTED || has_port) && !has_edp)
1456814599 intel_hdmi_init(dev, VLV_HDMIB, PORT_B);
14569− if (I915_READ(VLV_DP_B) & DP_DETECTED ||
14570− intel_dp_is_edp(dev, PORT_B))
14571− intel_dp_init(dev, VLV_DP_B, PORT_B);
1457214600
14573− if (I915_READ(VLV_HDMIC) & SDVO_DETECTED &&
14574− !intel_dp_is_edp(dev, PORT_C))
14601+ has_edp = intel_dp_is_edp(dev, PORT_C);
14602+ has_port = intel_bios_is_port_present(dev_priv, PORT_C);
14603+ if (I915_READ(VLV_DP_C) & DP_DETECTED || has_port)
14604+ has_edp &= intel_dp_init(dev, VLV_DP_C, PORT_C);
14605+ if ((I915_READ(VLV_HDMIC) & SDVO_DETECTED || has_port) && !has_edp)
1457514606 intel_hdmi_init(dev, VLV_HDMIC, PORT_C);
14576− if (I915_READ(VLV_DP_C) & DP_DETECTED ||
14577− intel_dp_is_edp(dev, PORT_C))
14578− intel_dp_init(dev, VLV_DP_C, PORT_C);
1457914607
1458014608 if (IS_CHERRYVIEW(dev)) {
14581− /* eDP not supported on port D, so don't check VBT */
14582− if (I915_READ(CHV_HDMID) & SDVO_DETECTED)
14583− intel_hdmi_init(dev, CHV_HDMID, PORT_D);
14584− if (I915_READ(CHV_DP_D) & DP_DETECTED)
14609+ /*
14610+ * eDP not supported on port D,
14611+ * so no need to worry about it
14612+ */
14613+ has_port = intel_bios_is_port_present(dev_priv, PORT_D);
14614+ if (I915_READ(CHV_DP_D) & DP_DETECTED || has_port)
1458514615 intel_dp_init(dev, CHV_DP_D, PORT_D);
14616+ if (I915_READ(CHV_HDMID) & SDVO_DETECTED || has_port)
14617+ intel_hdmi_init(dev, CHV_HDMID, PORT_D);
1458614618 }
1458714619
1458814620 intel_dsi_init(dev);
drivers/gpu/drm/i915/intel_dp.c+10−8
@@ -5725,8 +5725,11 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, · 5724 unmodified lines
57255725 if (!fixed_mode && dev_priv->vbt.lfp_lvds_vbt_mode) {
57265726 fixed_mode = drm_mode_duplicate(dev,
57275727 dev_priv->vbt.lfp_lvds_vbt_mode);
5728− if (fixed_mode)
5728+ if (fixed_mode) {
57295729 fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
5730+ connector->display_info.width_mm = fixed_mode->width_mm;
5731+ connector->display_info.height_mm = fixed_mode->height_mm;
5732+ }
57305733 }
57315734 mutex_unlock(&dev->mode_config.mutex);
57325735
@@ -5923,9 +5926,9 @@ fail: · 190 unmodified lines
59235926 return false;
59245927 }
59255928
5926−void
5927−intel_dp_init(struct drm_device *dev,
5928− i915_reg_t output_reg, enum port port)
5929+bool intel_dp_init(struct drm_device *dev,
5930+ i915_reg_t output_reg,
5931+ enum port port)
59295932 {
59305933 struct drm_i915_private *dev_priv = dev->dev_private;
59315934 struct intel_digital_port *intel_dig_port;
@@ -5935,7 +5938,7 @@ intel_dp_init(struct drm_device *dev, · 3 unmodified lines
59355938
59365939 intel_dig_port = kzalloc(sizeof(*intel_dig_port), GFP_KERNEL);
59375940 if (!intel_dig_port)
5938− return;
5941+ return false;
59395942
59405943 intel_connector = intel_connector_alloc();
59415944 if (!intel_connector)
@@ -5992,7 +5995,7 @@ intel_dp_init(struct drm_device *dev, · 50 unmodified lines
59925995 if (!intel_dp_init_connector(intel_dig_port, intel_connector))
59935996 goto err_init_connector;
59945997
5995− return;
5998+ return true;
59965999
59976000 err_init_connector:
59986001 drm_encoder_cleanup(encoder);
@@ -6000,8 +6003,7 @@ err_encoder_init: · 1 unmodified line
60006003 kfree(intel_connector);
60016004 err_connector_alloc:
60026005 kfree(intel_dig_port);
6003−
6004− return;
6006+ return false;
60056007 }
60066008
60076009 void intel_dp_mst_suspend(struct drm_device *dev)
drivers/gpu/drm/i915/intel_dpll_mgr.c+3−0
@@ -366,6 +366,9 @@ ibx_get_dpll(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state, · 365 unmodified lines
366366 DPLL_ID_PCH_PLL_B);
367367 }
368368
369+ if (!pll)
370+ return NULL;
371+
369372 /* reference the pll */
370373 intel_reference_shared_dpll(pll, crtc_state);
371374
drivers/gpu/drm/i915/intel_drv.h+1−1
@@ -1284,7 +1284,7 @@ void intel_csr_ucode_suspend(struct drm_i915_private *); · 1283 unmodified lines
12841284 void intel_csr_ucode_resume(struct drm_i915_private *);
12851285
12861286 /* intel_dp.c */
1287−void intel_dp_init(struct drm_device *dev, i915_reg_t output_reg, enum port port);
1287+bool intel_dp_init(struct drm_device *dev, i915_reg_t output_reg, enum port port);
12881288 bool intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
12891289 struct intel_connector *intel_connector);
12901290 void intel_dp_set_link_params(struct intel_dp *intel_dp,
drivers/gpu/drm/i915/intel_dsi.c+3−0
@@ -1545,6 +1545,9 @@ void intel_dsi_init(struct drm_device *dev) · 1544 unmodified lines
15451545 goto err;
15461546 }
15471547
1548+ connector->display_info.width_mm = fixed_mode->width_mm;
1549+ connector->display_info.height_mm = fixed_mode->height_mm;
1550+
15481551 intel_panel_init(&intel_connector->panel, fixed_mode, NULL);
15491552
15501553 intel_dsi_add_properties(intel_connector);
drivers/gpu/drm/i915/intel_hdmi.c+3−0
@@ -2142,6 +2142,9 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port, · 2141 unmodified lines
21422142 enum port port = intel_dig_port->port;
21432143 uint8_t alternate_ddc_pin;
21442144
2145+ DRM_DEBUG_KMS("Adding HDMI connector on port %c\n",
2146+ port_name(port));
2147+
21452148 if (WARN(intel_dig_port->max_lanes < 4,
21462149 "Not enough lanes (%d) for HDMI on port %c\n",
21472150 intel_dig_port->max_lanes, port_name(port)))
drivers/gpu/drm/i915/intel_lvds.c+2−0
@@ -1082,6 +1082,8 @@ void intel_lvds_init(struct drm_device *dev) · 1081 unmodified lines
10821082 fixed_mode = drm_mode_duplicate(dev, dev_priv->vbt.lfp_lvds_vbt_mode);
10831083 if (fixed_mode) {
10841084 fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
1085+ connector->display_info.width_mm = fixed_mode->width_mm;
1086+ connector->display_info.height_mm = fixed_mode->height_mm;
10851087 goto out;
10861088 }
10871089 }
drivers/gpu/drm/i915/intel_vbt_defs.h+4−3
@@ -403,9 +403,10 @@ struct lvds_dvo_timing { · 402 unmodified lines
403403 u8 vsync_off:4;
404404 u8 rsvd0:6;
405405 u8 hsync_off_hi:2;
406− u8 h_image;
407− u8 v_image;
408− u8 max_hv;
406+ u8 himage_lo;
407+ u8 vimage_lo;
408+ u8 vimage_hi:4;
409+ u8 himage_hi:4;
409410 u8 h_border;
410411 u8 v_border;
411412 u8 rsvd1:3;
drivers/gpu/drm/msm/adreno/adreno_gpu.c+1−1
@@ -408,7 +408,7 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev, · 407 unmodified lines
408408 }
409409
410410 adreno_gpu->memptrs = msm_gem_vaddr(adreno_gpu->memptrs_bo);
411− if (!adreno_gpu->memptrs) {
411+ if (IS_ERR(adreno_gpu->memptrs)) {
412412 dev_err(drm->dev, "could not vmap memptrs\n");
413413 return -ENOMEM;
414414 }
drivers/gpu/drm/msm/msm_fbdev.c+4−0
@@ -159,6 +159,10 @@ static int msm_fbdev_create(struct drm_fb_helper *helper, · 158 unmodified lines
159159 dev->mode_config.fb_base = paddr;
160160
161161 fbi->screen_base = msm_gem_vaddr_locked(fbdev->bo);
162+ if (IS_ERR(fbi->screen_base)) {
163+ ret = PTR_ERR(fbi->screen_base);
164+ goto fail_unlock;
165+ }
162166 fbi->screen_size = fbdev->bo->size;
163167 fbi->fix.smem_start = paddr;
164168 fbi->fix.smem_len = fbdev->bo->size;
drivers/gpu/drm/msm/msm_gem.c+2−0
@@ -398,6 +398,8 @@ void *msm_gem_vaddr_locked(struct drm_gem_object *obj) · 397 unmodified lines
398398 return ERR_CAST(pages);
399399 msm_obj->vaddr = vmap(pages, obj->size >> PAGE_SHIFT,
400400 VM_MAP, pgprot_writecombine(PAGE_KERNEL));
401+ if (msm_obj->vaddr == NULL)
402+ return ERR_PTR(-ENOMEM);
401403 }
402404 return msm_obj->vaddr;
403405 }
drivers/gpu/drm/msm/msm_gem_submit.c+7−0
@@ -40,12 +40,14 @@ static struct msm_gem_submit *submit_create(struct drm_device *dev, · 39 unmodified lines
4040
4141 submit->dev = dev;
4242 submit->gpu = gpu;
43+ submit->fence = NULL;
4344 submit->pid = get_pid(task_pid(current));
4445
4546 /* initially, until copy_from_user() and bo lookup succeeds: */
4647 submit->nr_bos = 0;
4748 submit->nr_cmds = 0;
4849
50+ INIT_LIST_HEAD(&submit->node);
4951 INIT_LIST_HEAD(&submit->bo_list);
5052 ww_acquire_init(&submit->ticket, &reservation_ww_class);
5153
@@ -75,6 +77,11 @@ static int submit_lookup_objects(struct msm_gem_submit *submit, · 23 unmodified lines
7577 void __user *userptr =
7678 u64_to_user_ptr(args->bos + (i * sizeof(submit_bo)));
7779
80+ /* make sure we don't have garbage flags, in case we hit
81+ * error path before flags is initialized:
82+ */
83+ submit->bos[i].flags = 0;
84+
7885 ret = copy_from_user(&submit_bo, userptr, sizeof(submit_bo));
7986 if (ret) {
8087 ret = -EFAULT;
drivers/gpu/drm/msm/msm_rd.c+3−0
@@ -312,6 +312,9 @@ void msm_rd_dump_submit(struct msm_gem_submit *submit) · 311 unmodified lines
312312 struct msm_gem_object *obj = submit->bos[idx].obj;
313313 const char *buf = msm_gem_vaddr_locked(&obj->base);
314314
315+ if (IS_ERR(buf))
316+ continue;
317+
315318 buf += iova - submit->bos[idx].iova;
316319
317320 rd_write_section(rd, RD_GPUADDR,
drivers/gpu/drm/msm/msm_ringbuffer.c+4−0
@@ -40,6 +40,10 @@ struct msm_ringbuffer *msm_ringbuffer_new(struct msm_gpu *gpu, int size) · 39 unmodified lines
4040 }
4141
4242 ring->start = msm_gem_vaddr_locked(ring->bo);
43+ if (IS_ERR(ring->start)) {
44+ ret = PTR_ERR(ring->start);
45+ goto fail;
46+ }
4347 ring->end = ring->start + (size / 4);
4448 ring->cur = ring->start;
4549
drivers/gpu/drm/nouveau/include/nvkm/core/device.h+1−1
@@ -16,9 +16,9 @@ enum nvkm_devidx { · 15 unmodified lines
1616 NVKM_SUBDEV_MC,
1717 NVKM_SUBDEV_BUS,
1818 NVKM_SUBDEV_TIMER,
19+ NVKM_SUBDEV_INSTMEM,
1920 NVKM_SUBDEV_FB,
2021 NVKM_SUBDEV_LTC,
21− NVKM_SUBDEV_INSTMEM,
2222 NVKM_SUBDEV_MMU,
2323 NVKM_SUBDEV_BAR,
2424 NVKM_SUBDEV_PMU,
drivers/gpu/drm/nouveau/include/nvkm/subdev/bios/disp.h+3−2
@@ -25,7 +25,8 @@ u16 nvbios_outp_match(struct nvkm_bios *, u16 type, u16 mask, · 24 unmodified lines
2525 u8 *ver, u8 *hdr, u8 *cnt, u8 *len, struct nvbios_outp *);
2626
2727 struct nvbios_ocfg {
28− u16 match;
28+ u8 proto;
29+ u8 flags;
2930 u16 clkcmp[2];
3031 };
3132
@@ -33,7 +34,7 @@ u16 nvbios_ocfg_entry(struct nvkm_bios *, u16 outp, u8 idx, · 1 unmodified line
3334 u8 *ver, u8 *hdr, u8 *cnt, u8 *len);
3435 u16 nvbios_ocfg_parse(struct nvkm_bios *, u16 outp, u8 idx,
3536 u8 *ver, u8 *hdr, u8 *cnt, u8 *len, struct nvbios_ocfg *);
36−u16 nvbios_ocfg_match(struct nvkm_bios *, u16 outp, u16 type,
37+u16 nvbios_ocfg_match(struct nvkm_bios *, u16 outp, u8 proto, u8 flags,
3738 u8 *ver, u8 *hdr, u8 *cnt, u8 *len, struct nvbios_ocfg *);
3839 u16 nvbios_oclk_match(struct nvkm_bios *, u16 cmp, u32 khz);
3940 #endif
drivers/gpu/drm/nouveau/nouveau_fbcon.c+1−0
@@ -552,6 +552,7 @@ nouveau_fbcon_init(struct drm_device *dev) · 551 unmodified lines
552552 if (ret)
553553 goto fini;
554554
555+ fbcon->helper.fbdev->pixmap.buf_align = 4;
555556 return 0;
556557
557558 fini:
drivers/gpu/drm/nouveau/nv04_fbcon.c+2−5
@@ -82,7 +82,6 @@ nv04_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) · 81 unmodified lines
8282 uint32_t fg;
8383 uint32_t bg;
8484 uint32_t dsize;
85− uint32_t width;
8685 uint32_t *data = (uint32_t *)image->data;
8786 int ret;
8887
@@ -93,9 +92,6 @@ nv04_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) · 4 unmodified lines
9392 if (ret)
9493 return ret;
9594
96− width = ALIGN(image->width, 8);
97− dsize = ALIGN(width * image->height, 32) >> 5;
98−
9995 if (info->fix.visual == FB_VISUAL_TRUECOLOR ||
10096 info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
10197 fg = ((uint32_t *) info->pseudo_palette)[image->fg_color];
@@ -111,10 +107,11 @@ nv04_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) · 9 unmodified lines
111107 ((image->dx + image->width) & 0xffff));
112108 OUT_RING(chan, bg);
113109 OUT_RING(chan, fg);
114− OUT_RING(chan, (image->height << 16) | width);
110+ OUT_RING(chan, (image->height << 16) | image->width);
115111 OUT_RING(chan, (image->height << 16) | image->width);
116112 OUT_RING(chan, (image->dy << 16) | (image->dx & 0xffff));
117113
114+ dsize = ALIGN(image->width * image->height, 32) >> 5;
118115 while (dsize) {
119116 int iter_len = dsize > 128 ? 128 : dsize;
120117
drivers/gpu/drm/nouveau/nv50_fbcon.c+2−4
@@ -95,7 +95,7 @@ nv50_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) · 94 unmodified lines
9595 struct nouveau_fbdev *nfbdev = info->par;
9696 struct nouveau_drm *drm = nouveau_drm(nfbdev->dev);
9797 struct nouveau_channel *chan = drm->channel;
98− uint32_t width, dwords, *data = (uint32_t *)image->data;
98+ uint32_t dwords, *data = (uint32_t *)image->data;
9999 uint32_t mask = ~(~0 >> (32 - info->var.bits_per_pixel));
100100 uint32_t *palette = info->pseudo_palette;
101101 int ret;
@@ -107,9 +107,6 @@ nv50_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) · 5 unmodified lines
107107 if (ret)
108108 return ret;
109109
110− width = ALIGN(image->width, 32);
111− dwords = (width * image->height) >> 5;
112−
113110 BEGIN_NV04(chan, NvSub2D, 0x0814, 2);
114111 if (info->fix.visual == FB_VISUAL_TRUECOLOR ||
115112 info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
@@ -128,6 +125,7 @@ nv50_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) · 12 unmodified lines
128125 OUT_RING(chan, 0);
129126 OUT_RING(chan, image->dy);
130127
128+ dwords = ALIGN(image->width * image->height, 32) >> 5;
131129 while (dwords) {
132130 int push = dwords > 2047 ? 2047 : dwords;
133131
drivers/gpu/drm/nouveau/nvc0_fbcon.c+2−4
@@ -95,7 +95,7 @@ nvc0_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) · 94 unmodified lines
9595 struct nouveau_fbdev *nfbdev = info->par;
9696 struct nouveau_drm *drm = nouveau_drm(nfbdev->dev);
9797 struct nouveau_channel *chan = drm->channel;
98− uint32_t width, dwords, *data = (uint32_t *)image->data;
98+ uint32_t dwords, *data = (uint32_t *)image->data;
9999 uint32_t mask = ~(~0 >> (32 - info->var.bits_per_pixel));
100100 uint32_t *palette = info->pseudo_palette;
101101 int ret;
@@ -107,9 +107,6 @@ nvc0_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) · 5 unmodified lines
107107 if (ret)
108108 return ret;
109109
110− width = ALIGN(image->width, 32);
111− dwords = (width * image->height) >> 5;
112−
113110 BEGIN_NVC0(chan, NvSub2D, 0x0814, 2);
114111 if (info->fix.visual == FB_VISUAL_TRUECOLOR ||
115112 info->fix.visual == FB_VISUAL_DIRECTCOLOR) {
@@ -128,6 +125,7 @@ nvc0_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) · 12 unmodified lines
128125 OUT_RING (chan, 0);
129126 OUT_RING (chan, image->dy);
130127
128+ dwords = ALIGN(image->width * image->height, 32) >> 5;
131129 while (dwords) {
132130 int push = dwords > 2047 ? 2047 : dwords;
133131
drivers/gpu/drm/nouveau/nvkm/engine/device/pci.c+1−1
@@ -1614,7 +1614,7 @@ nvkm_device_pci_func = { · 1613 unmodified lines
16141614 .fini = nvkm_device_pci_fini,
16151615 .resource_addr = nvkm_device_pci_resource_addr,
16161616 .resource_size = nvkm_device_pci_resource_size,
1617− .cpu_coherent = !IS_ENABLED(CONFIG_ARM) && !IS_ENABLED(CONFIG_ARM64),
1617+ .cpu_coherent = !IS_ENABLED(CONFIG_ARM),
16181618 };
16191619
16201620 int
drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild+1−0
@@ -18,6 +18,7 @@ nvkm-y += nvkm/engine/disp/piornv50.o · 17 unmodified lines
1818 nvkm-y += nvkm/engine/disp/sornv50.o
1919 nvkm-y += nvkm/engine/disp/sorg94.o
2020 nvkm-y += nvkm/engine/disp/sorgf119.o
21+nvkm-y += nvkm/engine/disp/sorgm107.o
2122 nvkm-y += nvkm/engine/disp/sorgm200.o
2223 nvkm-y += nvkm/engine/disp/dport.o
2324
drivers/gpu/drm/nouveau/nvkm/engine/disp/gf119.c+5−8
@@ -76,6 +76,7 @@ exec_lookup(struct nv50_disp *disp, int head, int or, u32 ctrl, · 75 unmodified lines
7676 mask |= 0x0001 << or;
7777 mask |= 0x0100 << head;
7878
79+
7980 list_for_each_entry(outp, &disp->base.outp, head) {
8081 if ((outp->info.hasht & 0xff) == type &&
8182 (outp->info.hashm & mask) == mask) {
@@ -155,25 +156,21 @@ exec_clkcmp(struct nv50_disp *disp, int head, int id, u32 pclk, u32 *conf) · 73 unmodified lines
155156 if (!outp)
156157 return NULL;
157158
159+ *conf = (ctrl & 0x00000f00) >> 8;
158160 switch (outp->info.type) {
159161 case DCB_OUTPUT_TMDS:
160− *conf = (ctrl & 0x00000f00) >> 8;
161162 if (*conf == 5)
162163 *conf |= 0x0100;
163164 break;
164165 case DCB_OUTPUT_LVDS:
165− *conf = disp->sor.lvdsconf;
166− break;
167− case DCB_OUTPUT_DP:
168− *conf = (ctrl & 0x00000f00) >> 8;
166+ *conf |= disp->sor.lvdsconf;
169167 break;
170− case DCB_OUTPUT_ANALOG:
171168 default:
172− *conf = 0x00ff;
173169 break;
174170 }
175171
176− data = nvbios_ocfg_match(bios, data, *conf, &ver, &hdr, &cnt, &len, &info2);
172+ data = nvbios_ocfg_match(bios, data, *conf & 0xff, *conf >> 8,
173+ &ver, &hdr, &cnt, &len, &info2);
177174 if (data && id < 0xff) {
178175 data = nvbios_oclk_match(bios, info2.clkcmp[id], pclk);
179176 if (data) {
drivers/gpu/drm/nouveau/nvkm/engine/disp/gm107.c+1−1
@@ -36,7 +36,7 @@ gm107_disp = { · 35 unmodified lines
3636 .outp.internal.crt = nv50_dac_output_new,
3737 .outp.internal.tmds = nv50_sor_output_new,
3838 .outp.internal.lvds = nv50_sor_output_new,
39− .outp.internal.dp = gf119_sor_dp_new,
39+ .outp.internal.dp = gm107_sor_dp_new,
4040 .dac.nr = 3,
4141 .dac.power = nv50_dac_power,
4242 .dac.sense = nv50_dac_sense,
drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.c+4−8
@@ -387,22 +387,17 @@ exec_clkcmp(struct nv50_disp *disp, int head, int id, u32 pclk, u32 *conf) · 386 unmodified lines
387387 if (!outp)
388388 return NULL;
389389
390+ *conf = (ctrl & 0x00000f00) >> 8;
390391 if (outp->info.location == 0) {
391392 switch (outp->info.type) {
392393 case DCB_OUTPUT_TMDS:
393− *conf = (ctrl & 0x00000f00) >> 8;
394394 if (*conf == 5)
395395 *conf |= 0x0100;
396396 break;
397397 case DCB_OUTPUT_LVDS:
398− *conf = disp->sor.lvdsconf;
398+ *conf |= disp->sor.lvdsconf;
399399 break;
400− case DCB_OUTPUT_DP:
401− *conf = (ctrl & 0x00000f00) >> 8;
402− break;
403− case DCB_OUTPUT_ANALOG:
404400 default:
405− *conf = 0x00ff;
406401 break;
407402 }
408403 } else {
@@ -410,7 +405,8 @@ exec_clkcmp(struct nv50_disp *disp, int head, int id, u32 pclk, u32 *conf) · 1 unmodified line
410405 pclk = pclk / 2;
411406 }
412407
413− data = nvbios_ocfg_match(bios, data, *conf, &ver, &hdr, &cnt, &len, &info2);
408+ data = nvbios_ocfg_match(bios, data, *conf & 0xff, *conf >> 8,
409+ &ver, &hdr, &cnt, &len, &info2);
414410 if (data && id < 0xff) {
415411 data = nvbios_oclk_match(bios, info2.clkcmp[id], pclk);
416412 if (data) {
drivers/gpu/drm/nouveau/nvkm/engine/disp/outpdp.h+7−2
@@ -62,7 +62,12 @@ int g94_sor_dp_lnk_pwr(struct nvkm_output_dp *, int); · 61 unmodified lines
6262 int gf119_sor_dp_new(struct nvkm_disp *, int, struct dcb_output *,
6363 struct nvkm_output **);
6464 int gf119_sor_dp_lnk_ctl(struct nvkm_output_dp *, int, int, bool);
65+int gf119_sor_dp_drv_ctl(struct nvkm_output_dp *, int, int, int, int);
6566
66−int gm200_sor_dp_new(struct nvkm_disp *, int, struct dcb_output *,
67− struct nvkm_output **);
67+int gm107_sor_dp_new(struct nvkm_disp *, int, struct dcb_output *,
68+ struct nvkm_output **);
69+int gm107_sor_dp_pattern(struct nvkm_output_dp *, int);
70+
71+int gm200_sor_dp_new(struct nvkm_disp *, int, struct dcb_output *,
72+ struct nvkm_output **);
6873 #endif
drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgf119.c+2−3
@@ -40,8 +40,7 @@ static int · 39 unmodified lines
4040 gf119_sor_dp_pattern(struct nvkm_output_dp *outp, int pattern)
4141 {
4242 struct nvkm_device *device = outp->base.disp->engine.subdev.device;
43− const u32 loff = gf119_sor_loff(outp);
44− nvkm_mask(device, 0x61c110 + loff, 0x0f0f0f0f, 0x01010101 * pattern);
43+ nvkm_mask(device, 0x61c110, 0x0f0f0f0f, 0x01010101 * pattern);
4544 return 0;
4645 }
4746
@@ -64,7 +63,7 @@ gf119_sor_dp_lnk_ctl(struct nvkm_output_dp *outp, int nr, int bw, bool ef) · 16 unmodified lines
6463 return 0;
6564 }
6665
67−static int
66+int
6867 gf119_sor_dp_drv_ctl(struct nvkm_output_dp *outp,
6968 int ln, int vs, int pe, int pc)
7069 {
drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm107.c+53−0
@@ -0,0 +1,53 @@
1+/*
2+ * Copyright 2016 Red Hat Inc.
3+ *
4+ * Permission is hereby granted, free of charge, to any person obtaining a
5+ * copy of this software and associated documentation files (the "Software"),
6+ * to deal in the Software without restriction, including without limitation
7+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+ * and/or sell copies of the Software, and to permit persons to whom the
9+ * Software is furnished to do so, subject to the following conditions:
10+ *
11+ * The above copyright notice and this permission notice shall be included in
12+ * all copies or substantial portions of the Software.
13+ *
14+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20+ * OTHER DEALINGS IN THE SOFTWARE.
21+ *
22+ * Authors: Ben Skeggs <bskeggs@redhat.com>
23+ */
24+#include "nv50.h"
25+#include "outpdp.h"
26+
27+int
28+gm107_sor_dp_pattern(struct nvkm_output_dp *outp, int pattern)
29+{
30+ struct nvkm_device *device = outp->base.disp->engine.subdev.device;
31+ const u32 soff = outp->base.or * 0x800;
32+ const u32 data = 0x01010101 * pattern;
33+ if (outp->base.info.sorconf.link & 1)
34+ nvkm_mask(device, 0x61c110 + soff, 0x0f0f0f0f, data);
35+ else
36+ nvkm_mask(device, 0x61c12c + soff, 0x0f0f0f0f, data);
37+ return 0;
38+}
39+
40+static const struct nvkm_output_dp_func
41+gm107_sor_dp_func = {
42+ .pattern = gm107_sor_dp_pattern,
43+ .lnk_pwr = g94_sor_dp_lnk_pwr,
44+ .lnk_ctl = gf119_sor_dp_lnk_ctl,
45+ .drv_ctl = gf119_sor_dp_drv_ctl,
46+};
47+
48+int
49+gm107_sor_dp_new(struct nvkm_disp *disp, int index,
50+ struct dcb_output *dcbE, struct nvkm_output **poutp)
51+{
52+ return nvkm_output_dp_new_(&gm107_sor_dp_func, disp, index, dcbE, poutp);
53+}
drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c+1−14
@@ -56,19 +56,6 @@ gm200_sor_dp_lane_map(struct nvkm_device *device, u8 lane) · 55 unmodified lines
5656 return lane * 0x08;
5757 }
5858
59−static int
60−gm200_sor_dp_pattern(struct nvkm_output_dp *outp, int pattern)
61−{
62− struct nvkm_device *device = outp->base.disp->engine.subdev.device;
63− const u32 soff = gm200_sor_soff(outp);
64− const u32 data = 0x01010101 * pattern;
65− if (outp->base.info.sorconf.link & 1)
66− nvkm_mask(device, 0x61c110 + soff, 0x0f0f0f0f, data);
67− else
68− nvkm_mask(device, 0x61c12c + soff, 0x0f0f0f0f, data);
69− return 0;
70−}
71−
7259 static int
7360 gm200_sor_dp_lnk_pwr(struct nvkm_output_dp *outp, int nr)
7461 {
@@ -129,7 +116,7 @@ gm200_sor_dp_drv_ctl(struct nvkm_output_dp *outp, · 54 unmodified lines
129116
130117 static const struct nvkm_output_dp_func
131118 gm200_sor_dp_func = {
132− .pattern = gm200_sor_dp_pattern,
119+ .pattern = gm107_sor_dp_pattern,
133120 .lnk_pwr = gm200_sor_dp_lnk_pwr,
134121 .lnk_ctl = gf119_sor_dp_lnk_ctl,
135122 .drv_ctl = gm200_sor_dp_drv_ctl,
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c+28−9
@@ -949,22 +949,41 @@ gf100_gr_trap_gpc_rop(struct gf100_gr *gr, int gpc) · 948 unmodified lines
949949 }
950950
951951 static const struct nvkm_enum gf100_mp_warp_error[] = {
952− { 0x00, "NO_ERROR" },
953− { 0x01, "STACK_MISMATCH" },
952+ { 0x01, "STACK_ERROR" },
953+ { 0x02, "API_STACK_ERROR" },
954+ { 0x03, "RET_EMPTY_STACK_ERROR" },
955+ { 0x04, "PC_WRAP" },
954956 { 0x05, "MISALIGNED_PC" },
955− { 0x08, "MISALIGNED_GPR" },
956− { 0x09, "INVALID_OPCODE" },
957− { 0x0d, "GPR_OUT_OF_BOUNDS" },
958− { 0x0e, "MEM_OUT_OF_BOUNDS" },
959− { 0x0f, "UNALIGNED_MEM_ACCESS" },
957+ { 0x06, "PC_OVERFLOW" },
958+ { 0x07, "MISALIGNED_IMMC_ADDR" },
959+ { 0x08, "MISALIGNED_REG" },
960+ { 0x09, "ILLEGAL_INSTR_ENCODING" },
961+ { 0x0a, "ILLEGAL_SPH_INSTR_COMBO" },
962+ { 0x0b, "ILLEGAL_INSTR_PARAM" },
963+ { 0x0c, "INVALID_CONST_ADDR" },
964+ { 0x0d, "OOR_REG" },
965+ { 0x0e, "OOR_ADDR" },
966+ { 0x0f, "MISALIGNED_ADDR" },
960967 { 0x10, "INVALID_ADDR_SPACE" },
961− { 0x11, "INVALID_PARAM" },
968+ { 0x11, "ILLEGAL_INSTR_PARAM2" },
969+ { 0x12, "INVALID_CONST_ADDR_LDC" },
970+ { 0x13, "GEOMETRY_SM_ERROR" },
971+ { 0x14, "DIVERGENT" },
972+ { 0x15, "WARP_EXIT" },
962973 {}
963974 };
964975
965976 static const struct nvkm_bitfield gf100_mp_global_error[] = {
977+ { 0x00000001, "SM_TO_SM_FAULT" },
978+ { 0x00000002, "L1_ERROR" },
966979 { 0x00000004, "MULTIPLE_WARP_ERRORS" },
967− { 0x00000008, "OUT_OF_STACK_SPACE" },
980+ { 0x00000008, "PHYSICAL_STACK_OVERFLOW" },
981+ { 0x00000010, "BPT_INT" },
982+ { 0x00000020, "BPT_PAUSE" },
983+ { 0x00000040, "SINGLE_STEP_COMPLETE" },
984+ { 0x20000000, "ECC_SEC_ERROR" },
985+ { 0x40000000, "ECC_DED_ERROR" },
986+ { 0x80000000, "TIMEOUT" },
968987 {}
969988 };
970989
drivers/gpu/drm/nouveau/nvkm/subdev/bios/disp.c+5−3
@@ -141,7 +141,8 @@ nvbios_ocfg_parse(struct nvkm_bios *bios, u16 outp, u8 idx, · 140 unmodified lines
141141 {
142142 u16 data = nvbios_ocfg_entry(bios, outp, idx, ver, hdr, cnt, len);
143143 if (data) {
144− info->match = nvbios_rd16(bios, data + 0x00);
144+ info->proto = nvbios_rd08(bios, data + 0x00);
145+ info->flags = nvbios_rd16(bios, data + 0x01);
145146 info->clkcmp[0] = nvbios_rd16(bios, data + 0x02);
146147 info->clkcmp[1] = nvbios_rd16(bios, data + 0x04);
147148 }
@@ -149,12 +150,13 @@ nvbios_ocfg_parse(struct nvkm_bios *bios, u16 outp, u8 idx, · 1 unmodified line
149150 }
150151
151152 u16
152−nvbios_ocfg_match(struct nvkm_bios *bios, u16 outp, u16 type,
153+nvbios_ocfg_match(struct nvkm_bios *bios, u16 outp, u8 proto, u8 flags,
153154 u8 *ver, u8 *hdr, u8 *cnt, u8 *len, struct nvbios_ocfg *info)
154155 {
155156 u16 data, idx = 0;
156157 while ((data = nvbios_ocfg_parse(bios, outp, idx++, ver, hdr, cnt, len, info))) {
157− if (info->match == type)
158+ if ((info->proto == proto || info->proto == 0xff) &&
159+ (info->flags == flags))
158160 break;
159161 }
160162 return data;
drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c+9−7
@@ -276,6 +276,8 @@ nvkm_iccsense_oneinit(struct nvkm_subdev *subdev) · 275 unmodified lines
276276 struct pwr_rail_t *r = &stbl.rail[i];
277277 struct nvkm_iccsense_rail *rail;
278278 struct nvkm_iccsense_sensor *sensor;
279+ int (*read)(struct nvkm_iccsense *,
280+ struct nvkm_iccsense_rail *);
279281
280282 if (!r->mode || r->resistor_mohm == 0)
281283 continue;
@@ -284,31 +286,31 @@ nvkm_iccsense_oneinit(struct nvkm_subdev *subdev) · 2 unmodified lines
284286 if (!sensor)
285287 continue;
286288
287− rail = kmalloc(sizeof(*rail), GFP_KERNEL);
288− if (!rail)
289− return -ENOMEM;
290−
291289 switch (sensor->type) {
292290 case NVBIOS_EXTDEV_INA209:
293291 if (r->rail != 0)
294292 continue;
295− rail->read = nvkm_iccsense_ina209_read;
293+ read = nvkm_iccsense_ina209_read;
296294 break;
297295 case NVBIOS_EXTDEV_INA219:
298296 if (r->rail != 0)
299297 continue;
300− rail->read = nvkm_iccsense_ina219_read;
298+ read = nvkm_iccsense_ina219_read;
301299 break;
302300 case NVBIOS_EXTDEV_INA3221:
303301 if (r->rail >= 3)
304302 continue;
305− rail->read = nvkm_iccsense_ina3221_read;
303+ read = nvkm_iccsense_ina3221_read;
306304 break;
307305 default:
308306 continue;
309307 }
310308
309+ rail = kmalloc(sizeof(*rail), GFP_KERNEL);
310+ if (!rail)
311+ return -ENOMEM;
311312 sensor->rail_mask |= 1 << r->rail;
313+ rail->read = read;
312314 rail->sensor = sensor;
313315 rail->idx = r->rail;
314316 rail->mohm = r->resistor_mohm;
drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gm107.c+3−3
@@ -69,11 +69,11 @@ gm107_ltc_zbc_clear_depth(struct nvkm_ltc *ltc, int i, const u32 depth) · 68 unmodified lines
6969 }
7070
7171 static void
72−gm107_ltc_lts_isr(struct nvkm_ltc *ltc, int c, int s)
72+gm107_ltc_intr_lts(struct nvkm_ltc *ltc, int c, int s)
7373 {
7474 struct nvkm_subdev *subdev = &ltc->subdev;
7575 struct nvkm_device *device = subdev->device;
76− u32 base = 0x140000 + (c * 0x2000) + (s * 0x200);
76+ u32 base = 0x140400 + (c * 0x2000) + (s * 0x200);
7777 u32 stat = nvkm_rd32(device, base + 0x00c);
7878
7979 if (stat) {
@@ -92,7 +92,7 @@ gm107_ltc_intr(struct nvkm_ltc *ltc) · 12 unmodified lines
9292 while (mask) {
9393 u32 s, c = __ffs(mask);
9494 for (s = 0; s < ltc->lts_nr; s++)
95− gm107_ltc_lts_isr(ltc, c, s);
95+ gm107_ltc_intr_lts(ltc, c, s);
9696 mask &= ~(1 << c);
9797 }
9898 }
drivers/gpu/drm/nouveau/nvkm/subdev/ltc/gm200.c+1−1
@@ -46,7 +46,7 @@ static const struct nvkm_ltc_func · 45 unmodified lines
4646 gm200_ltc = {
4747 .oneinit = gm200_ltc_oneinit,
4848 .init = gm200_ltc_init,
49− .intr = gm107_ltc_intr, /*XXX: not validated */
49+ .intr = gm107_ltc_intr,
5050 .cbc_clear = gm107_ltc_cbc_clear,
5151 .cbc_wait = gm107_ltc_cbc_wait,
5252 .zbc = 16,
drivers/gpu/drm/omapdrm/dss/dsi.c+0−1
@@ -1167,7 +1167,6 @@ static int dsi_regulator_init(struct platform_device *dsidev) · 1166 unmodified lines
11671167 {
11681168 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
11691169 struct regulator *vdds_dsi;
1170− int r;
11711170
11721171 if (dsi->vdds_dsi_reg != NULL)
11731172 return 0;
drivers/gpu/drm/omapdrm/dss/hdmi5.c+0−1
@@ -120,7 +120,6 @@ static irqreturn_t hdmi_irq_handler(int irq, void *data) · 119 unmodified lines
120120
121121 static int hdmi_init_regulator(void)
122122 {
123− int r;
124123 struct regulator *reg;
125124
126125 if (hdmi.vdda_reg != NULL)
drivers/gpu/drm/radeon/atombios_crtc.c+3−2
@@ -589,7 +589,8 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, · 588 unmodified lines
589589 if (ASIC_IS_DCE41(rdev) || ASIC_IS_DCE61(rdev) || ASIC_IS_DCE8(rdev))
590590 radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV;
591591 /* use frac fb div on RS780/RS880 */
592− if ((rdev->family == CHIP_RS780) || (rdev->family == CHIP_RS880))
592+ if (((rdev->family == CHIP_RS780) || (rdev->family == CHIP_RS880))
593+ && !radeon_crtc->ss_enabled)
593594 radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV;
594595 if (ASIC_IS_DCE32(rdev) && mode->clock > 165000)
595596 radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV;
@@ -626,7 +627,7 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, · 30 unmodified lines
626627 if (radeon_crtc->ss.refdiv) {
627628 radeon_crtc->pll_flags |= RADEON_PLL_USE_REF_DIV;
628629 radeon_crtc->pll_reference_div = radeon_crtc->ss.refdiv;
629− if (ASIC_IS_AVIVO(rdev))
630+ if (rdev->family >= CHIP_RV770)
630631 radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV;
631632 }
632633 }
drivers/gpu/drm/radeon/radeon_device.c+22−1
@@ -630,6 +630,23 @@ void radeon_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc) · 629 unmodified lines
630630 /*
631631 * GPU helpers function.
632632 */
633+
634+/**
635+ * radeon_device_is_virtual - check if we are running is a virtual environment
636+ *
637+ * Check if the asic has been passed through to a VM (all asics).
638+ * Used at driver startup.
639+ * Returns true if virtual or false if not.
640+ */
641+static bool radeon_device_is_virtual(void)
642+{
643+#ifdef CONFIG_X86
644+ return boot_cpu_has(X86_FEATURE_HYPERVISOR);
645+#else
646+ return false;
647+#endif
648+}
649+
633650 /**
634651 * radeon_card_posted - check if the hw has already been initialized
635652 *
@@ -643,6 +660,10 @@ bool radeon_card_posted(struct radeon_device *rdev) · 7 unmodified lines
643660 {
644661 uint32_t reg;
645662
663+ /* for pass through, always force asic_init */
664+ if (radeon_device_is_virtual())
665+ return false;
666+
646667 /* required for EFI mode on macbook2,1 which uses an r5xx asic */
647668 if (efi_enabled(EFI_BOOT) &&
648669 (rdev->pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE) &&
@@ -1631,7 +1652,7 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend, · 982 unmodified lines
16311652 radeon_agp_suspend(rdev);
16321653
16331654 pci_save_state(dev->pdev);
1634− if (freeze && rdev->family >= CHIP_R600) {
1655+ if (freeze && rdev->family >= CHIP_CEDAR) {
16351656 rdev->asic->asic_reset(rdev, true);
16361657 pci_restore_state(dev->pdev);
16371658 } else if (suspend) {
drivers/gpu/drm/vc4/vc4_crtc.c+22−10
@@ -456,14 +456,6 @@ static void vc4_crtc_atomic_flush(struct drm_crtc *crtc, · 455 unmodified lines
456456
457457 WARN_ON_ONCE(dlist_next - dlist_start != vc4_state->mm.size);
458458
459− HVS_WRITE(SCALER_DISPLISTX(vc4_crtc->channel),
460− vc4_state->mm.start);
461−
462− if (debug_dump_regs) {
463− DRM_INFO("CRTC %d HVS after:\n", drm_crtc_index(crtc));
464− vc4_hvs_dump_state(dev);
465− }
466−
467459 if (crtc->state->event) {
468460 unsigned long flags;
469461
@@ -473,8 +465,20 @@ static void vc4_crtc_atomic_flush(struct drm_crtc *crtc, · 3 unmodified lines
473465
474466 spin_lock_irqsave(&dev->event_lock, flags);
475467 vc4_crtc->event = crtc->state->event;
476− spin_unlock_irqrestore(&dev->event_lock, flags);
477468 crtc->state->event = NULL;
469+
470+ HVS_WRITE(SCALER_DISPLISTX(vc4_crtc->channel),
471+ vc4_state->mm.start);
472+
473+ spin_unlock_irqrestore(&dev->event_lock, flags);
474+ } else {
475+ HVS_WRITE(SCALER_DISPLISTX(vc4_crtc->channel),
476+ vc4_state->mm.start);
477+ }
478+
479+ if (debug_dump_regs) {
480+ DRM_INFO("CRTC %d HVS after:\n", drm_crtc_index(crtc));
481+ vc4_hvs_dump_state(dev);
478482 }
479483 }
480484
@@ -500,12 +504,17 @@ static void vc4_crtc_handle_page_flip(struct vc4_crtc *vc4_crtc) · 19 unmodified lines
500504 {
501505 struct drm_crtc *crtc = &vc4_crtc->base;
502506 struct drm_device *dev = crtc->dev;
507+ struct vc4_dev *vc4 = to_vc4_dev(dev);
508+ struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(crtc->state);
509+ u32 chan = vc4_crtc->channel;
503510 unsigned long flags;
504511
505512 spin_lock_irqsave(&dev->event_lock, flags);
506− if (vc4_crtc->event) {
513+ if (vc4_crtc->event &&
514+ (vc4_state->mm.start == HVS_READ(SCALER_DISPLACTX(chan)))) {
507515 drm_crtc_send_vblank_event(crtc, vc4_crtc->event);
508516 vc4_crtc->event = NULL;
517+ drm_crtc_vblank_put(crtc);
509518 }
510519 spin_unlock_irqrestore(&dev->event_lock, flags);
511520 }
@@ -556,6 +565,7 @@ vc4_async_page_flip_complete(struct vc4_seqno_cb *cb) · 44 unmodified lines
556565 spin_unlock_irqrestore(&dev->event_lock, flags);
557566 }
558567
568+ drm_crtc_vblank_put(crtc);
559569 drm_framebuffer_unreference(flip_state->fb);
560570 kfree(flip_state);
561571
@@ -598,6 +608,8 @@ static int vc4_async_page_flip(struct drm_crtc *crtc, · 36 unmodified lines
598608 return ret;
599609 }
600610
611+ WARN_ON(drm_crtc_vblank_get(crtc) != 0);
612+
601613 /* Immediately update the plane's legacy fb pointer, so that later
602614 * modeset prep sees the state that will be present when the semaphore
603615 * is released.
drivers/gpu/drm/vc4/vc4_drv.c+7−7
@@ -66,12 +66,12 @@ static const struct file_operations vc4_drm_fops = { · 65 unmodified lines
6666 };
6767
6868 static const struct drm_ioctl_desc vc4_drm_ioctls[] = {
69− DRM_IOCTL_DEF_DRV(VC4_SUBMIT_CL, vc4_submit_cl_ioctl, 0),
70− DRM_IOCTL_DEF_DRV(VC4_WAIT_SEQNO, vc4_wait_seqno_ioctl, 0),
71− DRM_IOCTL_DEF_DRV(VC4_WAIT_BO, vc4_wait_bo_ioctl, 0),
72− DRM_IOCTL_DEF_DRV(VC4_CREATE_BO, vc4_create_bo_ioctl, 0),
73− DRM_IOCTL_DEF_DRV(VC4_MMAP_BO, vc4_mmap_bo_ioctl, 0),
74− DRM_IOCTL_DEF_DRV(VC4_CREATE_SHADER_BO, vc4_create_shader_bo_ioctl, 0),
69+ DRM_IOCTL_DEF_DRV(VC4_SUBMIT_CL, vc4_submit_cl_ioctl, DRM_RENDER_ALLOW),
70+ DRM_IOCTL_DEF_DRV(VC4_WAIT_SEQNO, vc4_wait_seqno_ioctl, DRM_RENDER_ALLOW),
71+ DRM_IOCTL_DEF_DRV(VC4_WAIT_BO, vc4_wait_bo_ioctl, DRM_RENDER_ALLOW),
72+ DRM_IOCTL_DEF_DRV(VC4_CREATE_BO, vc4_create_bo_ioctl, DRM_RENDER_ALLOW),
73+ DRM_IOCTL_DEF_DRV(VC4_MMAP_BO, vc4_mmap_bo_ioctl, DRM_RENDER_ALLOW),
74+ DRM_IOCTL_DEF_DRV(VC4_CREATE_SHADER_BO, vc4_create_shader_bo_ioctl, DRM_RENDER_ALLOW),
7575 DRM_IOCTL_DEF_DRV(VC4_GET_HANG_STATE, vc4_get_hang_state_ioctl,
7676 DRM_ROOT_ONLY),
7777 };
@@ -91,7 +91,7 @@ static struct drm_driver vc4_drm_driver = { · 13 unmodified lines
9191
9292 .enable_vblank = vc4_enable_vblank,
9393 .disable_vblank = vc4_disable_vblank,
94− .get_vblank_counter = drm_vblank_count,
94+ .get_vblank_counter = drm_vblank_no_hw_counter,
9595
9696 #if defined(CONFIG_DEBUG_FS)
9797 .debugfs_init = vc4_debugfs_init,
drivers/gpu/drm/vc4/vc4_kms.c+12−4
@@ -117,10 +117,18 @@ static int vc4_atomic_commit(struct drm_device *dev, · 116 unmodified lines
117117 return -ENOMEM;
118118
119119 /* Make sure that any outstanding modesets have finished. */
120− ret = down_interruptible(&vc4->async_modeset);
121− if (ret) {
122− kfree(c);
123− return ret;
120+ if (nonblock) {
121+ ret = down_trylock(&vc4->async_modeset);
122+ if (ret) {
123+ kfree(c);
124+ return -EBUSY;
125+ }
126+ } else {
127+ ret = down_interruptible(&vc4->async_modeset);
128+ if (ret) {
129+ kfree(c);
130+ return ret;
131+ }
124132 }
125133
126134 ret = drm_atomic_helper_prepare_planes(dev, state);
drivers/gpu/drm/vc4/vc4_regs.h+4−0
@@ -341,6 +341,10 @@ · 340 unmodified lines
341341 #define SCALER_DISPLACT0 0x00000030
342342 #define SCALER_DISPLACT1 0x00000034
343343 #define SCALER_DISPLACT2 0x00000038
344+#define SCALER_DISPLACTX(x) (SCALER_DISPLACT0 + \
345+ (x) * (SCALER_DISPLACT1 - \
346+ SCALER_DISPLACT0))
347+
344348 #define SCALER_DISPCTRL0 0x00000040
345349 # define SCALER_DISPCTRLX_ENABLE BIT(31)
346350 # define SCALER_DISPCTRLX_RESET BIT(30)
drivers/gpu/drm/vmwgfx/vmwgfx_msg.c+3−1
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828 #include <linux/slab.h>
2929 #include <linux/module.h>
3030 #include <linux/kernel.h>
31+#include <linux/frame.h>
3132 #include <asm/hypervisor.h>
3233 #include "drmP.h"
3334 #include "vmwgfx_msg.h"
@@ -194,7 +195,7 @@ static int vmw_send_msg(struct rpc_channel *channel, const char *msg) · 160 unmodified lines
194195
195196 return -EINVAL;
196197 }
197−
198+STACK_FRAME_NON_STANDARD(vmw_send_msg);
198199
199200
200201 /**
@@ -304,6 +305,7 @@ static int vmw_recv_msg(struct rpc_channel *channel, void **msg, · 103 unmodified lines
304305
305306 return 0;
306307 }
308+STACK_FRAME_NON_STANDARD(vmw_recv_msg);
307309
308310
309311 /**
drivers/hid/hid-elo.c+1−1
@@ -261,7 +261,7 @@ static void elo_remove(struct hid_device *hdev) · 260 unmodified lines
261261 struct elo_priv *priv = hid_get_drvdata(hdev);
262262
263263 hid_hw_stop(hdev);
264− flush_workqueue(wq);
264+ cancel_delayed_work_sync(&priv->work);
265265 kfree(priv);
266266 }
267267
drivers/hid/hid-multitouch.c+5−0
@@ -1401,6 +1401,11 @@ static const struct hid_device_id mt_devices[] = { · 1400 unmodified lines
14011401 MT_USB_DEVICE(USB_VENDOR_ID_NOVATEK,
14021402 USB_DEVICE_ID_NOVATEK_PCT) },
14031403
1404+ /* Ntrig Panel */
1405+ { .driver_data = MT_CLS_NSMU,
1406+ HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8,
1407+ USB_VENDOR_ID_NTRIG, 0x1b05) },
1408+
14041409 /* PixArt optical touch screen */
14051410 { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER,
14061411 MT_USB_DEVICE(USB_VENDOR_ID_PIXART,
drivers/hwmon/fam15h_power.c+2−6
@@ -172,9 +172,9 @@ static void do_read_registers_on_cu(void *_data) · 171 unmodified lines
172172 */
173173 static int read_registers(struct fam15h_power_data *data)
174174 {
175− int this_cpu, ret, cpu;
176175 int core, this_core;
177176 cpumask_var_t mask;
177+ int ret, cpu;
178178
179179 ret = zalloc_cpumask_var(&mask, GFP_KERNEL);
180180 if (!ret)
@@ -183,7 +183,6 @@ static int read_registers(struct fam15h_power_data *data) · 2 unmodified lines
183183 memset(data->cu_on, 0, sizeof(int) * MAX_CUS);
184184
185185 get_online_cpus();
186− this_cpu = smp_processor_id();
187186
188187 /*
189188 * Choose the first online core of each compute unit, and then
@@ -205,12 +204,9 @@ static int read_registers(struct fam15h_power_data *data) · 15 unmodified lines
205204 cpumask_set_cpu(cpumask_any(topology_sibling_cpumask(cpu)), mask);
206205 }
207206
208− if (cpumask_test_cpu(this_cpu, mask))
209− do_read_registers_on_cu(data);
207+ on_each_cpu_mask(mask, do_read_registers_on_cu, data, true);
210208
211− smp_call_function_many(mask, do_read_registers_on_cu, data, true);
212209 put_online_cpus();
213−
214210 free_cpumask_var(mask);
215211
216212 return 0;
drivers/hwmon/lm90.c+1−1
@@ -375,7 +375,7 @@ struct lm90_data { · 374 unmodified lines
375375 int kind;
376376 u32 flags;
377377
378− int update_interval; /* in milliseconds */
378+ unsigned int update_interval; /* in milliseconds */
379379
380380 u8 config_orig; /* Original configuration register value */
381381 u8 convrate_orig; /* Original conversion rate register value */
drivers/hwtracing/coresight/coresight-tmc-etr.c+4−7
@@ -300,13 +300,10 @@ int tmc_read_unprepare_etr(struct tmc_drvdata *drvdata) · 299 unmodified lines
300300 if (local_read(&drvdata->mode) == CS_MODE_SYSFS) {
301301 /*
302302 * The trace run will continue with the same allocated trace
303− * buffer. As such zero-out the buffer so that we don't end
304− * up with stale data.
305− *
306− * Since the tracer is still enabled drvdata::buf
307− * can't be NULL.
303+ * buffer. The trace buffer is cleared in tmc_etr_enable_hw(),
304+ * so we don't have to explicitly clear it. Also, since the
305+ * tracer is still enabled drvdata::buf can't be NULL.
308306 */
309− memset(drvdata->buf, 0, drvdata->size);
310307 tmc_etr_enable_hw(drvdata);
311308 } else {
312309 /*
@@ -315,7 +312,7 @@ int tmc_read_unprepare_etr(struct tmc_drvdata *drvdata) · 2 unmodified lines
315312 */
316313 vaddr = drvdata->vaddr;
317314 paddr = drvdata->paddr;
318− drvdata->buf = NULL;
315+ drvdata->buf = drvdata->vaddr = NULL;
319316 }
320317
321318 drvdata->reading = false;
drivers/hwtracing/coresight/coresight.c+9−6
@@ -385,7 +385,6 @@ static int _coresight_build_path(struct coresight_device *csdev, · 384 unmodified lines
385385 int i;
386386 bool found = false;
387387 struct coresight_node *node;
388− struct coresight_connection *conn;
389388
390389 /* An activated sink has been found. Enqueue the element */
391390 if ((csdev->type == CORESIGHT_DEV_TYPE_SINK ||
@@ -394,8 +393,9 @@ static int _coresight_build_path(struct coresight_device *csdev, · 2 unmodified lines
394393
395394 /* Not a sink - recursively explore each port found on this element */
396395 for (i = 0; i < csdev->nr_outport; i++) {
397− conn = &csdev->conns[i];
398− if (_coresight_build_path(conn->child_dev, path) == 0) {
396+ struct coresight_device *child_dev = csdev->conns[i].child_dev;
397+
398+ if (child_dev && _coresight_build_path(child_dev, path) == 0) {
399399 found = true;
400400 break;
401401 }
@@ -425,6 +425,7 @@ out: · 23 unmodified lines
425425 struct list_head *coresight_build_path(struct coresight_device *csdev)
426426 {
427427 struct list_head *path;
428+ int rc;
428429
429430 path = kzalloc(sizeof(struct list_head), GFP_KERNEL);
430431 if (!path)
@@ -432,9 +433,10 @@ struct list_head *coresight_build_path(struct coresight_device *csdev) · 1 unmodified line
432433
433434 INIT_LIST_HEAD(path);
434435
435− if (_coresight_build_path(csdev, path)) {
436+ rc = _coresight_build_path(csdev, path);
437+ if (rc) {
436438 kfree(path);
437− path = NULL;
439+ return ERR_PTR(rc);
438440 }
439441
440442 return path;
@@ -507,8 +509,9 @@ int coresight_enable(struct coresight_device *csdev) · 66 unmodified lines
507509 goto out;
508510
509511 path = coresight_build_path(csdev);
510− if (!path) {
512+ if (IS_ERR(path)) {
511513 pr_err("building path(s) failed\n");
514+ ret = PTR_ERR(path);
512515 goto out;
513516 }
514517
drivers/i2c/busses/i2c-i801.c+96−3
@@ -245,6 +245,13 @@ struct i801_priv { · 244 unmodified lines
245245 struct platform_device *mux_pdev;
246246 #endif
247247 struct platform_device *tco_pdev;
248+
249+ /*
250+ * If set to true the host controller registers are reserved for
251+ * ACPI AML use. Protected by acpi_lock.
252+ */
253+ bool acpi_reserved;
254+ struct mutex acpi_lock;
248255 };
249256
250257 #define FEATURE_SMBUS_PEC (1 << 0)
@@ -718,6 +725,12 @@ static s32 i801_access(struct i2c_adapter *adap, u16 addr, · 467 unmodified lines
718725 int ret = 0, xact = 0;
719726 struct i801_priv *priv = i2c_get_adapdata(adap);
720727
728+ mutex_lock(&priv->acpi_lock);
729+ if (priv->acpi_reserved) {
730+ mutex_unlock(&priv->acpi_lock);
731+ return -EBUSY;
732+ }
733+
721734 pm_runtime_get_sync(&priv->pci_dev->dev);
722735
723736 hwpec = (priv->features & FEATURE_SMBUS_PEC) && (flags & I2C_CLIENT_PEC)
@@ -820,6 +833,7 @@ static s32 i801_access(struct i2c_adapter *adap, u16 addr, · 96 unmodified lines
820833 out:
821834 pm_runtime_mark_last_busy(&priv->pci_dev->dev);
822835 pm_runtime_put_autosuspend(&priv->pci_dev->dev);
836+ mutex_unlock(&priv->acpi_lock);
823837 return ret;
824838 }
825839
@@ -1257,6 +1271,83 @@ static void i801_add_tco(struct i801_priv *priv) · 431 unmodified lines
12571271 priv->tco_pdev = pdev;
12581272 }
12591273
1274+#ifdef CONFIG_ACPI
1275+static acpi_status
1276+i801_acpi_io_handler(u32 function, acpi_physical_address address, u32 bits,
1277+ u64 *value, void *handler_context, void *region_context)
1278+{
1279+ struct i801_priv *priv = handler_context;
1280+ struct pci_dev *pdev = priv->pci_dev;
1281+ acpi_status status;
1282+
1283+ /*
1284+ * Once BIOS AML code touches the OpRegion we warn and inhibit any
1285+ * further access from the driver itself. This device is now owned
1286+ * by the system firmware.
1287+ */
1288+ mutex_lock(&priv->acpi_lock);
1289+
1290+ if (!priv->acpi_reserved) {
1291+ priv->acpi_reserved = true;
1292+
1293+ dev_warn(&pdev->dev, "BIOS is accessing SMBus registers\n");
1294+ dev_warn(&pdev->dev, "Driver SMBus register access inhibited\n");
1295+
1296+ /*
1297+ * BIOS is accessing the host controller so prevent it from
1298+ * suspending automatically from now on.
1299+ */
1300+ pm_runtime_get_sync(&pdev->dev);
1301+ }
1302+
1303+ if ((function & ACPI_IO_MASK) == ACPI_READ)
1304+ status = acpi_os_read_port(address, (u32 *)value, bits);
1305+ else
1306+ status = acpi_os_write_port(address, (u32)*value, bits);
1307+
1308+ mutex_unlock(&priv->acpi_lock);
1309+
1310+ return status;
1311+}
1312+
1313+static int i801_acpi_probe(struct i801_priv *priv)
1314+{
1315+ struct acpi_device *adev;
1316+ acpi_status status;
1317+
1318+ adev = ACPI_COMPANION(&priv->pci_dev->dev);
1319+ if (adev) {
1320+ status = acpi_install_address_space_handler(adev->handle,
1321+ ACPI_ADR_SPACE_SYSTEM_IO, i801_acpi_io_handler,
1322+ NULL, priv);
1323+ if (ACPI_SUCCESS(status))
1324+ return 0;
1325+ }
1326+
1327+ return acpi_check_resource_conflict(&priv->pci_dev->resource[SMBBAR]);
1328+}
1329+
1330+static void i801_acpi_remove(struct i801_priv *priv)
1331+{
1332+ struct acpi_device *adev;
1333+
1334+ adev = ACPI_COMPANION(&priv->pci_dev->dev);
1335+ if (!adev)
1336+ return;
1337+
1338+ acpi_remove_address_space_handler(adev->handle,
1339+ ACPI_ADR_SPACE_SYSTEM_IO, i801_acpi_io_handler);
1340+
1341+ mutex_lock(&priv->acpi_lock);
1342+ if (priv->acpi_reserved)
1343+ pm_runtime_put(&priv->pci_dev->dev);
1344+ mutex_unlock(&priv->acpi_lock);
1345+}
1346+#else
1347+static inline int i801_acpi_probe(struct i801_priv *priv) { return 0; }
1348+static inline void i801_acpi_remove(struct i801_priv *priv) { }
1349+#endif
1350+
12601351 static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
12611352 {
12621353 unsigned char temp;
@@ -1274,6 +1365,7 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id) · 11 unmodified lines
12741365 priv->adapter.dev.parent = &dev->dev;
12751366 ACPI_COMPANION_SET(&priv->adapter.dev, ACPI_COMPANION(&dev->dev));
12761367 priv->adapter.retries = 3;
1368+ mutex_init(&priv->acpi_lock);
12771369
12781370 priv->pci_dev = dev;
12791371 switch (dev->device) {
@@ -1336,10 +1428,8 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id) · 56 unmodified lines
13361428 return -ENODEV;
13371429 }
13381430
1339− err = acpi_check_resource_conflict(&dev->resource[SMBBAR]);
1340− if (err) {
1431+ if (i801_acpi_probe(priv))
13411432 return -ENODEV;
1342− }
13431433
13441434 err = pcim_iomap_regions(dev, 1 << SMBBAR,
13451435 dev_driver_string(&dev->dev));
@@ -1348,6 +1438,7 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id) · 2 unmodified lines
13481438 "Failed to request SMBus region 0x%lx-0x%Lx\n",
13491439 priv->smba,
13501440 (unsigned long long)pci_resource_end(dev, SMBBAR));
1441+ i801_acpi_remove(priv);
13511442 return err;
13521443 }
13531444
@@ -1412,6 +1503,7 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id) · 58 unmodified lines
14121503 err = i2c_add_adapter(&priv->adapter);
14131504 if (err) {
14141505 dev_err(&dev->dev, "Failed to add SMBus adapter\n");
1506+ i801_acpi_remove(priv);
14151507 return err;
14161508 }
14171509
@@ -1438,6 +1530,7 @@ static void i801_remove(struct pci_dev *dev) · 20 unmodified lines
14381530
14391531 i801_del_mux(priv);
14401532 i2c_del_adapter(&priv->adapter);
1533+ i801_acpi_remove(priv);
14411534 pci_write_config_byte(dev, SMBHSTCFG, priv->original_hstcfg);
14421535
14431536 platform_device_unregister(priv->tco_pdev);
drivers/i2c/busses/i2c-octeon.c+10−7
@@ -934,8 +934,15 @@ static int octeon_i2c_read(struct octeon_i2c *i2c, int target, · 933 unmodified lines
934934 return result;
935935
936936 for (i = 0; i < length; i++) {
937− /* for the last byte TWSI_CTL_AAK must not be set */
938− if (i + 1 == length)
937+ /*
938+ * For the last byte to receive TWSI_CTL_AAK must not be set.
939+ *
940+ * A special case is I2C_M_RECV_LEN where we don't know the
941+ * additional length yet. If recv_len is set we assume we're
942+ * not reading the final byte and therefore need to set
943+ * TWSI_CTL_AAK.
944+ */
945+ if ((i + 1 == length) && !(recv_len && i == 0))
939946 final_read = true;
940947
941948 /* clear iflg to allow next event */
@@ -950,12 +957,8 @@ static int octeon_i2c_read(struct octeon_i2c *i2c, int target, · 8 unmodified lines
950957
951958 data[i] = octeon_i2c_data_read(i2c);
952959 if (recv_len && i == 0) {
953− if (data[i] > I2C_SMBUS_BLOCK_MAX + 1) {
954− dev_err(i2c->dev,
955− "%s: read len > I2C_SMBUS_BLOCK_MAX %d\n",
956− __func__, data[i]);
960+ if (data[i] > I2C_SMBUS_BLOCK_MAX + 1)
957961 return -EPROTO;
958− }
959962 length += data[i];
960963 }
961964
drivers/i2c/muxes/i2c-mux-reg.c+1−0
@@ -260,6 +260,7 @@ static struct platform_driver i2c_mux_reg_driver = { · 259 unmodified lines
260260 .remove = i2c_mux_reg_remove,
261261 .driver = {
262262 .name = "i2c-mux-reg",
263+ .of_match_table = of_match_ptr(i2c_mux_reg_of_match),
263264 },
264265 };
265266
drivers/iio/accel/st_accel_buffer.c+1−1
@@ -91,7 +91,7 @@ static const struct iio_buffer_setup_ops st_accel_buffer_setup_ops = { · 90 unmodified lines
9191
9292 int st_accel_allocate_ring(struct iio_dev *indio_dev)
9393 {
94− return iio_triggered_buffer_setup(indio_dev, &iio_pollfunc_store_time,
94+ return iio_triggered_buffer_setup(indio_dev, NULL,
9595 &st_sensors_trigger_handler, &st_accel_buffer_setup_ops);
9696 }
9797
drivers/iio/accel/st_accel_core.c+1−0
@@ -741,6 +741,7 @@ static const struct iio_info accel_info = { · 740 unmodified lines
741741 static const struct iio_trigger_ops st_accel_trigger_ops = {
742742 .owner = THIS_MODULE,
743743 .set_trigger_state = ST_ACCEL_TRIGGER_SET_STATE,
744+ .validate_device = st_sensors_validate_device,
744745 };
745746 #define ST_ACCEL_TRIGGER_OPS (&st_accel_trigger_ops)
746747 #else
drivers/iio/common/st_sensors/st_sensors_buffer.c+7−18
@@ -56,31 +56,20 @@ irqreturn_t st_sensors_trigger_handler(int irq, void *p) · 55 unmodified lines
5656 struct iio_poll_func *pf = p;
5757 struct iio_dev *indio_dev = pf->indio_dev;
5858 struct st_sensor_data *sdata = iio_priv(indio_dev);
59+ s64 timestamp;
5960
60− /* If we have a status register, check if this IRQ came from us */
61− if (sdata->sensor_settings->drdy_irq.addr_stat_drdy) {
62− u8 status;
63−
64− len = sdata->tf->read_byte(&sdata->tb, sdata->dev,
65− sdata->sensor_settings->drdy_irq.addr_stat_drdy,
66− &status);
67− if (len < 0)
68− dev_err(sdata->dev, "could not read channel status\n");
69−
70− /*
71− * If this was not caused by any channels on this sensor,
72− * return IRQ_NONE
73− */
74− if (!(status & (u8)indio_dev->active_scan_mask[0]))
75− return IRQ_NONE;
76− }
61+ /* If we do timetamping here, do it before reading the values */
62+ if (sdata->hw_irq_trigger)
63+ timestamp = sdata->hw_timestamp;
64+ else
65+ timestamp = iio_get_time_ns();
7766
7867 len = st_sensors_get_buffer_element(indio_dev, sdata->buffer_data);
7968 if (len < 0)
8069 goto st_sensors_get_buffer_element_error;
8170
8271 iio_push_to_buffers_with_timestamp(indio_dev, sdata->buffer_data,
83− pf->timestamp);
72+ timestamp);
8473
8574 st_sensors_get_buffer_element_error:
8675 iio_trigger_notify_done(indio_dev->trig);
drivers/iio/common/st_sensors/st_sensors_core.c+8−0
@@ -382,6 +382,11 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev, · 381 unmodified lines
382382 if (err < 0)
383383 return err;
384384
385+ /* Disable DRDY, this might be still be enabled after reboot. */
386+ err = st_sensors_set_dataready_irq(indio_dev, false);
387+ if (err < 0)
388+ return err;
389+
385390 if (sdata->current_fullscale) {
386391 err = st_sensors_set_fullscale(indio_dev,
387392 sdata->current_fullscale->num);
@@ -443,6 +448,9 @@ int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable) · 55 unmodified lines
443448 else
444449 drdy_mask = sdata->sensor_settings->drdy_irq.mask_int2;
445450
451+ /* Flag to the poll function that the hardware trigger is in use */
452+ sdata->hw_irq_trigger = enable;
453+
446454 /* Enable/Disable the interrupt generator for data ready. */
447455 err = st_sensors_write_data_with_mask(indio_dev,
448456 sdata->sensor_settings->drdy_irq.addr,
drivers/iio/common/st_sensors/st_sensors_trigger.c+89−7
@@ -17,6 +17,73 @@ · 16 unmodified lines
1717 #include <linux/iio/common/st_sensors.h>
1818 #include "st_sensors_core.h"
1919
20+/**
21+ * st_sensors_irq_handler() - top half of the IRQ-based triggers
22+ * @irq: irq number
23+ * @p: private handler data
24+ */
25+irqreturn_t st_sensors_irq_handler(int irq, void *p)
26+{
27+ struct iio_trigger *trig = p;
28+ struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig);
29+ struct st_sensor_data *sdata = iio_priv(indio_dev);
30+
31+ /* Get the time stamp as close in time as possible */
32+ sdata->hw_timestamp = iio_get_time_ns();
33+ return IRQ_WAKE_THREAD;
34+}
35+
36+/**
37+ * st_sensors_irq_thread() - bottom half of the IRQ-based triggers
38+ * @irq: irq number
39+ * @p: private handler data
40+ */
41+irqreturn_t st_sensors_irq_thread(int irq, void *p)
42+{
43+ struct iio_trigger *trig = p;
44+ struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig);
45+ struct st_sensor_data *sdata = iio_priv(indio_dev);
46+ int ret;
47+
48+ /*
49+ * If this trigger is backed by a hardware interrupt and we have a
50+ * status register, check if this IRQ came from us
51+ */
52+ if (sdata->sensor_settings->drdy_irq.addr_stat_drdy) {
53+ u8 status;
54+
55+ ret = sdata->tf->read_byte(&sdata->tb, sdata->dev,
56+ sdata->sensor_settings->drdy_irq.addr_stat_drdy,
57+ &status);
58+ if (ret < 0) {
59+ dev_err(sdata->dev, "could not read channel status\n");
60+ goto out_poll;
61+ }
62+ /*
63+ * the lower bits of .active_scan_mask[0] is directly mapped
64+ * to the channels on the sensor: either bit 0 for
65+ * one-dimensional sensors, or e.g. x,y,z for accelerometers,
66+ * gyroscopes or magnetometers. No sensor use more than 3
67+ * channels, so cut the other status bits here.
68+ */
69+ status &= 0x07;
70+
71+ /*
72+ * If this was not caused by any channels on this sensor,
73+ * return IRQ_NONE
74+ */
75+ if (!indio_dev->active_scan_mask)
76+ return IRQ_NONE;
77+ if (!(status & (u8)indio_dev->active_scan_mask[0]))
78+ return IRQ_NONE;
79+ }
80+
81+out_poll:
82+ /* It's our IRQ: proceed to handle the register polling */
83+ iio_trigger_poll_chained(p);
84+ return IRQ_HANDLED;
85+}
86+
2087 int st_sensors_allocate_trigger(struct iio_dev *indio_dev,
2188 const struct iio_trigger_ops *trigger_ops)
2289 {
@@ -30,6 +97,10 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev, · 7 unmodified lines
3097 return -ENOMEM;
3198 }
3299
100+ iio_trigger_set_drvdata(sdata->trig, indio_dev);
101+ sdata->trig->ops = trigger_ops;
102+ sdata->trig->dev.parent = sdata->dev;
103+
33104 irq = sdata->get_irq_data_ready(indio_dev);
34105 irq_trig = irqd_get_trigger_type(irq_get_irq_data(irq));
35106 /*
@@ -77,9 +148,12 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev, · 41 unmodified lines
77148 sdata->sensor_settings->drdy_irq.addr_stat_drdy)
78149 irq_trig |= IRQF_SHARED;
79150
80− err = request_threaded_irq(irq,
81− iio_trigger_generic_data_rdy_poll,
82− NULL,
151+ /* Let's create an interrupt thread masking the hard IRQ here */
152+ irq_trig |= IRQF_ONESHOT;
153+
154+ err = request_threaded_irq(sdata->get_irq_data_ready(indio_dev),
155+ st_sensors_irq_handler,
156+ st_sensors_irq_thread,
83157 irq_trig,
84158 sdata->trig->name,
85159 sdata->trig);
@@ -88,10 +162,6 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev, · 2 unmodified lines
88162 goto iio_trigger_free;
89163 }
90164
91− iio_trigger_set_drvdata(sdata->trig, indio_dev);
92− sdata->trig->ops = trigger_ops;
93− sdata->trig->dev.parent = sdata->dev;
94−
95165 err = iio_trigger_register(sdata->trig);
96166 if (err < 0) {
97167 dev_err(&indio_dev->dev, "failed to register iio trigger.\n");
@@ -119,6 +189,18 @@ void st_sensors_deallocate_trigger(struct iio_dev *indio_dev) · 21 unmodified lines
119189 }
120190 EXPORT_SYMBOL(st_sensors_deallocate_trigger);
121191
192+int st_sensors_validate_device(struct iio_trigger *trig,
193+ struct iio_dev *indio_dev)
194+{
195+ struct iio_dev *indio = iio_trigger_get_drvdata(trig);
196+
197+ if (indio != indio_dev)
198+ return -EINVAL;
199+
200+ return 0;
201+}
202+EXPORT_SYMBOL(st_sensors_validate_device);
203+
122204 MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>");
123205 MODULE_DESCRIPTION("STMicroelectronics ST-sensors trigger");
124206 MODULE_LICENSE("GPL v2");
drivers/iio/dac/Kconfig+1−1
@@ -247,7 +247,7 @@ config MCP4922 · 246 unmodified lines
247247
248248 config STX104
249249 tristate "Apex Embedded Systems STX104 DAC driver"
250− depends on X86 && ISA
250+ depends on X86 && ISA_BUS_API
251251 help
252252 Say yes here to build support for the 2-channel DAC on the Apex
253253 Embedded Systems STX104 integrated analog PC/104 card. The base port
drivers/iio/dac/ad5592r-base.c+1−1
@@ -525,7 +525,7 @@ static int ad5592r_alloc_channels(struct ad5592r_state *st) · 524 unmodified lines
525525
526526 device_for_each_child_node(st->dev, child) {
527527 ret = fwnode_property_read_u32(child, "reg", &reg);
528− if (ret || reg > ARRAY_SIZE(st->channel_modes))
528+ if (ret || reg >= ARRAY_SIZE(st->channel_modes))
529529 continue;
530530
531531 ret = fwnode_property_read_u32(child, "adi,mode", &tmp);
drivers/iio/gyro/st_gyro_buffer.c+1−1
@@ -91,7 +91,7 @@ static const struct iio_buffer_setup_ops st_gyro_buffer_setup_ops = { · 90 unmodified lines
9191
9292 int st_gyro_allocate_ring(struct iio_dev *indio_dev)
9393 {
94− return iio_triggered_buffer_setup(indio_dev, &iio_pollfunc_store_time,
94+ return iio_triggered_buffer_setup(indio_dev, NULL,
9595 &st_sensors_trigger_handler, &st_gyro_buffer_setup_ops);
9696 }
9797
drivers/iio/gyro/st_gyro_core.c+1−0
@@ -409,6 +409,7 @@ static const struct iio_info gyro_info = { · 408 unmodified lines
409409 static const struct iio_trigger_ops st_gyro_trigger_ops = {
410410 .owner = THIS_MODULE,
411411 .set_trigger_state = ST_GYRO_TRIGGER_SET_STATE,
412+ .validate_device = st_sensors_validate_device,
412413 };
413414 #define ST_GYRO_TRIGGER_OPS (&st_gyro_trigger_ops)
414415 #else
drivers/iio/humidity/am2315.c+1−3
@@ -165,10 +165,8 @@ static irqreturn_t am2315_trigger_handler(int irq, void *p) · 164 unmodified lines
165165 struct am2315_sensor_data sensor_data;
166166
167167 ret = am2315_read_data(data, &sensor_data);
168− if (ret < 0) {
169− mutex_unlock(&data->lock);
168+ if (ret < 0)
170169 goto err;
171− }
172170
173171 mutex_lock(&data->lock);
174172 if (*(indio_dev->active_scan_mask) == AM2315_ALL_CHANNEL_MASK) {
drivers/iio/humidity/hdc100x.c+10−10
@@ -55,7 +55,7 @@ static const struct { · 54 unmodified lines
5555 },
5656 { /* IIO_HUMIDITYRELATIVE channel */
5757 .shift = 8,
58− .mask = 2,
58+ .mask = 3,
5959 },
6060 };
6161
@@ -164,14 +164,14 @@ static int hdc100x_get_measurement(struct hdc100x_data *data, · 102 unmodified lines
164164 dev_err(&client->dev, "cannot read high byte measurement");
165165 return ret;
166166 }
167− val = ret << 6;
167+ val = ret << 8;
168168
169169 ret = i2c_smbus_read_byte(client);
170170 if (ret < 0) {
171171 dev_err(&client->dev, "cannot read low byte measurement");
172172 return ret;
173173 }
174− val |= ret >> 2;
174+ val |= ret;
175175
176176 return val;
177177 }
@@ -211,18 +211,18 @@ static int hdc100x_read_raw(struct iio_dev *indio_dev, · 33 unmodified lines
211211 return IIO_VAL_INT_PLUS_MICRO;
212212 case IIO_CHAN_INFO_SCALE:
213213 if (chan->type == IIO_TEMP) {
214− *val = 165;
215− *val2 = 65536 >> 2;
214+ *val = 165000;
215+ *val2 = 65536;
216216 return IIO_VAL_FRACTIONAL;
217217 } else {
218− *val = 0;
219− *val2 = 10000;
220− return IIO_VAL_INT_PLUS_MICRO;
218+ *val = 100;
219+ *val2 = 65536;
220+ return IIO_VAL_FRACTIONAL;
221221 }
222222 break;
223223 case IIO_CHAN_INFO_OFFSET:
224− *val = -3971;
225− *val2 = 879096;
224+ *val = -15887;
225+ *val2 = 515151;
226226 return IIO_VAL_INT_PLUS_MICRO;
227227 default:
228228 return -EINVAL;
drivers/iio/imu/bmi160/bmi160_core.c+8−8
@@ -210,11 +210,11 @@ static const struct bmi160_scale_item bmi160_scale_table[] = { · 209 unmodified lines
210210 };
211211
212212 static const struct bmi160_odr bmi160_accel_odr[] = {
213− {0x01, 0, 78125},
214− {0x02, 1, 5625},
215− {0x03, 3, 125},
216− {0x04, 6, 25},
217− {0x05, 12, 5},
213+ {0x01, 0, 781250},
214+ {0x02, 1, 562500},
215+ {0x03, 3, 125000},
216+ {0x04, 6, 250000},
217+ {0x05, 12, 500000},
218218 {0x06, 25, 0},
219219 {0x07, 50, 0},
220220 {0x08, 100, 0},
@@ -230,7 +230,7 @@ static const struct bmi160_odr bmi160_gyro_odr[] = { · 9 unmodified lines
230230 {0x08, 100, 0},
231231 {0x09, 200, 0},
232232 {0x0A, 400, 0},
233− {0x0B, 8000, 0},
233+ {0x0B, 800, 0},
234234 {0x0C, 1600, 0},
235235 {0x0D, 3200, 0},
236236 };
@@ -365,8 +365,8 @@ int bmi160_set_odr(struct bmi160_data *data, enum bmi160_sensor_type t, · 128 unmodified lines
365365
366366 return regmap_update_bits(data->regmap,
367367 bmi160_regs[t].config,
368− bmi160_odr_table[t].tbl[i].bits,
369− bmi160_regs[t].config_odr_mask);
368+ bmi160_regs[t].config_odr_mask,
369+ bmi160_odr_table[t].tbl[i].bits);
370370 }
371371
372372 static int bmi160_get_odr(struct bmi160_data *data, enum bmi160_sensor_type t,
drivers/iio/industrialio-trigger.c+18−5
@@ -213,22 +213,35 @@ static int iio_trigger_attach_poll_func(struct iio_trigger *trig, · 212 unmodified lines
213213
214214 /* Prevent the module from being removed whilst attached to a trigger */
215215 __module_get(pf->indio_dev->info->driver_module);
216+
217+ /* Get irq number */
216218 pf->irq = iio_trigger_get_irq(trig);
219+ if (pf->irq < 0)
220+ goto out_put_module;
221+
222+ /* Request irq */
217223 ret = request_threaded_irq(pf->irq, pf->h, pf->thread,
218224 pf->type, pf->name,
219225 pf);
220− if (ret < 0) {
221− module_put(pf->indio_dev->info->driver_module);
222− return ret;
223− }
226+ if (ret < 0)
227+ goto out_put_irq;
224228
229+ /* Enable trigger in driver */
225230 if (trig->ops->set_trigger_state && notinuse) {
226231 ret = trig->ops->set_trigger_state(trig, true);
227232 if (ret < 0)
228− module_put(pf->indio_dev->info->driver_module);
233+ goto out_free_irq;
229234 }
230235
231236 return ret;
237+
238+out_free_irq:
239+ free_irq(pf->irq, pf);
240+out_put_irq:
241+ iio_trigger_put_irq(trig, pf->irq);
242+out_put_module:
243+ module_put(pf->indio_dev->info->driver_module);
244+ return ret;
232245 }
233246
234247 static int iio_trigger_detach_poll_func(struct iio_trigger *trig,
drivers/iio/light/apds9960.c+1−0
@@ -1011,6 +1011,7 @@ static int apds9960_probe(struct i2c_client *client, · 1010 unmodified lines
10111011
10121012 iio_device_attach_buffer(indio_dev, buffer);
10131013
1014+ indio_dev->dev.parent = &client->dev;
10141015 indio_dev->info = &apds9960_info;
10151016 indio_dev->name = APDS9960_DRV_NAME;
10161017 indio_dev->channels = apds9960_channels;
drivers/iio/light/bh1780.c+6−4
@@ -84,7 +84,7 @@ static int bh1780_debugfs_reg_access(struct iio_dev *indio_dev, · 83 unmodified lines
8484 int ret;
8585
8686 if (!readval)
87− bh1780_write(bh1780, (u8)reg, (u8)writeval);
87+ return bh1780_write(bh1780, (u8)reg, (u8)writeval);
8888
8989 ret = bh1780_read(bh1780, (u8)reg);
9090 if (ret < 0)
@@ -187,7 +187,7 @@ static int bh1780_probe(struct i2c_client *client, · 96 unmodified lines
187187
188188 indio_dev->dev.parent = &client->dev;
189189 indio_dev->info = &bh1780_info;
190− indio_dev->name = id->name;
190+ indio_dev->name = "bh1780";
191191 indio_dev->channels = bh1780_channels;
192192 indio_dev->num_channels = ARRAY_SIZE(bh1780_channels);
193193 indio_dev->modes = INDIO_DIRECT_MODE;
@@ -226,7 +226,8 @@ static int bh1780_remove(struct i2c_client *client) · 32 unmodified lines
226226 static int bh1780_runtime_suspend(struct device *dev)
227227 {
228228 struct i2c_client *client = to_i2c_client(dev);
229− struct bh1780_data *bh1780 = i2c_get_clientdata(client);
229+ struct iio_dev *indio_dev = i2c_get_clientdata(client);
230+ struct bh1780_data *bh1780 = iio_priv(indio_dev);
230231 int ret;
231232
232233 ret = bh1780_write(bh1780, BH1780_REG_CONTROL, BH1780_POFF);
@@ -241,7 +242,8 @@ static int bh1780_runtime_suspend(struct device *dev) · 8 unmodified lines
241242 static int bh1780_runtime_resume(struct device *dev)
242243 {
243244 struct i2c_client *client = to_i2c_client(dev);
244− struct bh1780_data *bh1780 = i2c_get_clientdata(client);
245+ struct iio_dev *indio_dev = i2c_get_clientdata(client);
246+ struct bh1780_data *bh1780 = iio_priv(indio_dev);
245247 int ret;
246248
247249 ret = bh1780_write(bh1780, BH1780_REG_CONTROL, BH1780_PON);
drivers/iio/light/max44000.c+0−1
@@ -147,7 +147,6 @@ static const struct iio_chan_spec max44000_channels[] = { · 146 unmodified lines
147147 {
148148 .type = IIO_PROXIMITY,
149149 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
150− .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),
151150 .scan_index = MAX44000_SCAN_INDEX_PRX,
152151 .scan_type = {
153152 .sign = 'u',
drivers/iio/magnetometer/st_magn_buffer.c+1−1
@@ -82,7 +82,7 @@ static const struct iio_buffer_setup_ops st_magn_buffer_setup_ops = { · 81 unmodified lines
8282
8383 int st_magn_allocate_ring(struct iio_dev *indio_dev)
8484 {
85− return iio_triggered_buffer_setup(indio_dev, &iio_pollfunc_store_time,
85+ return iio_triggered_buffer_setup(indio_dev, NULL,
8686 &st_sensors_trigger_handler, &st_magn_buffer_setup_ops);
8787 }
8888
drivers/iio/magnetometer/st_magn_core.c+1−0
@@ -572,6 +572,7 @@ static const struct iio_info magn_info = { · 571 unmodified lines
572572 static const struct iio_trigger_ops st_magn_trigger_ops = {
573573 .owner = THIS_MODULE,
574574 .set_trigger_state = ST_MAGN_TRIGGER_SET_STATE,
575+ .validate_device = st_sensors_validate_device,
575576 };
576577 #define ST_MAGN_TRIGGER_OPS (&st_magn_trigger_ops)
577578 #else
drivers/iio/pressure/bmp280.c+2−2
@@ -1073,8 +1073,8 @@ static int bmp280_probe(struct i2c_client *client, · 1072 unmodified lines
10731073 if (ret < 0)
10741074 return ret;
10751075 if (chip_id != id->driver_data) {
1076− dev_err(&client->dev, "bad chip id. expected %x got %x\n",
1077− BMP280_CHIP_ID, chip_id);
1076+ dev_err(&client->dev, "bad chip id. expected %lx got %x\n",
1077+ id->driver_data, chip_id);
10781078 return -EINVAL;
10791079 }
10801080
drivers/iio/pressure/st_pressure_buffer.c+1−1
@@ -82,7 +82,7 @@ static const struct iio_buffer_setup_ops st_press_buffer_setup_ops = { · 81 unmodified lines
8282
8383 int st_press_allocate_ring(struct iio_dev *indio_dev)
8484 {
85− return iio_triggered_buffer_setup(indio_dev, &iio_pollfunc_store_time,
85+ return iio_triggered_buffer_setup(indio_dev, NULL,
8686 &st_sensors_trigger_handler, &st_press_buffer_setup_ops);
8787 }
8888
drivers/iio/pressure/st_pressure_core.c+51−30
@@ -28,15 +28,21 @@ · 27 unmodified lines
2828 #include <linux/iio/common/st_sensors.h>
2929 #include "st_pressure.h"
3030
31+#define MCELSIUS_PER_CELSIUS 1000
32+
33+/* Default pressure sensitivity */
3134 #define ST_PRESS_LSB_PER_MBAR 4096UL
3235 #define ST_PRESS_KPASCAL_NANO_SCALE (100000000UL / \
3336 ST_PRESS_LSB_PER_MBAR)
37+
38+/* Default temperature sensitivity */
3439 #define ST_PRESS_LSB_PER_CELSIUS 480UL
35−#define ST_PRESS_CELSIUS_NANO_SCALE (1000000000UL / \
36− ST_PRESS_LSB_PER_CELSIUS)
40+#define ST_PRESS_MILLI_CELSIUS_OFFSET 42500UL
41+
3742 #define ST_PRESS_NUMBER_DATA_CHANNELS 1
3843
3944 /* FULLSCALE */
45+#define ST_PRESS_FS_AVL_1100MB 1100
4046 #define ST_PRESS_FS_AVL_1260MB 1260
4147
4248 #define ST_PRESS_1_OUT_XL_ADDR 0x28
@@ -54,9 +60,6 @@ · 11 unmodified lines
5460 #define ST_PRESS_LPS331AP_PW_MASK 0x80
5561 #define ST_PRESS_LPS331AP_FS_ADDR 0x23
5662 #define ST_PRESS_LPS331AP_FS_MASK 0x30
57−#define ST_PRESS_LPS331AP_FS_AVL_1260_VAL 0x00
58−#define ST_PRESS_LPS331AP_FS_AVL_1260_GAIN ST_PRESS_KPASCAL_NANO_SCALE
59−#define ST_PRESS_LPS331AP_FS_AVL_TEMP_GAIN ST_PRESS_CELSIUS_NANO_SCALE
6063 #define ST_PRESS_LPS331AP_BDU_ADDR 0x20
6164 #define ST_PRESS_LPS331AP_BDU_MASK 0x04
6265 #define ST_PRESS_LPS331AP_DRDY_IRQ_ADDR 0x22
@@ -67,9 +70,14 @@ · 4 unmodified lines
6770 #define ST_PRESS_LPS331AP_OD_IRQ_ADDR 0x22
6871 #define ST_PRESS_LPS331AP_OD_IRQ_MASK 0x40
6972 #define ST_PRESS_LPS331AP_MULTIREAD_BIT true
70−#define ST_PRESS_LPS331AP_TEMP_OFFSET 42500
7173
7274 /* CUSTOM VALUES FOR LPS001WP SENSOR */
75+
76+/* LPS001WP pressure resolution */
77+#define ST_PRESS_LPS001WP_LSB_PER_MBAR 16UL
78+/* LPS001WP temperature resolution */
79+#define ST_PRESS_LPS001WP_LSB_PER_CELSIUS 64UL
80+
7381 #define ST_PRESS_LPS001WP_WAI_EXP 0xba
7482 #define ST_PRESS_LPS001WP_ODR_ADDR 0x20
7583 #define ST_PRESS_LPS001WP_ODR_MASK 0x30
@@ -78,6 +86,8 @@ · 2 unmodified lines
7886 #define ST_PRESS_LPS001WP_ODR_AVL_13HZ_VAL 0x03
7987 #define ST_PRESS_LPS001WP_PW_ADDR 0x20
8088 #define ST_PRESS_LPS001WP_PW_MASK 0x40
89+#define ST_PRESS_LPS001WP_FS_AVL_PRESS_GAIN \
90+ (100000000UL / ST_PRESS_LPS001WP_LSB_PER_MBAR)
8191 #define ST_PRESS_LPS001WP_BDU_ADDR 0x20
8292 #define ST_PRESS_LPS001WP_BDU_MASK 0x04
8393 #define ST_PRESS_LPS001WP_MULTIREAD_BIT true
@@ -94,11 +104,6 @@ · 10 unmodified lines
94104 #define ST_PRESS_LPS25H_ODR_AVL_25HZ_VAL 0x04
95105 #define ST_PRESS_LPS25H_PW_ADDR 0x20
96106 #define ST_PRESS_LPS25H_PW_MASK 0x80
97−#define ST_PRESS_LPS25H_FS_ADDR 0x00
98−#define ST_PRESS_LPS25H_FS_MASK 0x00
99−#define ST_PRESS_LPS25H_FS_AVL_1260_VAL 0x00
100−#define ST_PRESS_LPS25H_FS_AVL_1260_GAIN ST_PRESS_KPASCAL_NANO_SCALE
101−#define ST_PRESS_LPS25H_FS_AVL_TEMP_GAIN ST_PRESS_CELSIUS_NANO_SCALE
102107 #define ST_PRESS_LPS25H_BDU_ADDR 0x20
103108 #define ST_PRESS_LPS25H_BDU_MASK 0x04
104109 #define ST_PRESS_LPS25H_DRDY_IRQ_ADDR 0x23
@@ -109,7 +114,6 @@ · 4 unmodified lines
109114 #define ST_PRESS_LPS25H_OD_IRQ_ADDR 0x22
110115 #define ST_PRESS_LPS25H_OD_IRQ_MASK 0x40
111116 #define ST_PRESS_LPS25H_MULTIREAD_BIT true
112−#define ST_PRESS_LPS25H_TEMP_OFFSET 42500
113117 #define ST_PRESS_LPS25H_OUT_XL_ADDR 0x28
114118 #define ST_TEMP_LPS25H_OUT_L_ADDR 0x2b
115119
@@ -181,7 +185,9 @@ static const struct iio_chan_spec st_press_lps001wp_channels[] = { · 65 unmodified lines
181185 .storagebits = 16,
182186 .endianness = IIO_LE,
183187 },
184− .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
188+ .info_mask_separate =
189+ BIT(IIO_CHAN_INFO_RAW) |
190+ BIT(IIO_CHAN_INFO_SCALE),
185191 .modified = 0,
186192 },
187193 {
@@ -197,7 +203,7 @@ static const struct iio_chan_spec st_press_lps001wp_channels[] = { · 9 unmodified lines
197203 },
198204 .info_mask_separate =
199205 BIT(IIO_CHAN_INFO_RAW) |
200− BIT(IIO_CHAN_INFO_OFFSET),
206+ BIT(IIO_CHAN_INFO_SCALE),
201207 .modified = 0,
202208 },
203209 IIO_CHAN_SOFT_TIMESTAMP(1)
@@ -253,11 +259,14 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { · 49 unmodified lines
253259 .addr = ST_PRESS_LPS331AP_FS_ADDR,
254260 .mask = ST_PRESS_LPS331AP_FS_MASK,
255261 .fs_avl = {
262+ /*
263+ * Pressure and temperature sensitivity values
264+ * as defined in table 3 of LPS331AP datasheet.
265+ */
256266 [0] = {
257267 .num = ST_PRESS_FS_AVL_1260MB,
258− .value = ST_PRESS_LPS331AP_FS_AVL_1260_VAL,
259− .gain = ST_PRESS_LPS331AP_FS_AVL_1260_GAIN,
260− .gain2 = ST_PRESS_LPS331AP_FS_AVL_TEMP_GAIN,
268+ .gain = ST_PRESS_KPASCAL_NANO_SCALE,
269+ .gain2 = ST_PRESS_LSB_PER_CELSIUS,
261270 },
262271 },
263272 },
@@ -302,7 +311,17 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { · 38 unmodified lines
302311 .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
303312 },
304313 .fs = {
305− .addr = 0,
314+ .fs_avl = {
315+ /*
316+ * Pressure and temperature resolution values
317+ * as defined in table 3 of LPS001WP datasheet.
318+ */
319+ [0] = {
320+ .num = ST_PRESS_FS_AVL_1100MB,
321+ .gain = ST_PRESS_LPS001WP_FS_AVL_PRESS_GAIN,
322+ .gain2 = ST_PRESS_LPS001WP_LSB_PER_CELSIUS,
323+ },
324+ },
306325 },
307326 .bdu = {
308327 .addr = ST_PRESS_LPS001WP_BDU_ADDR,
@@ -339,14 +358,15 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { · 30 unmodified lines
339358 .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
340359 },
341360 .fs = {
342− .addr = ST_PRESS_LPS25H_FS_ADDR,
343− .mask = ST_PRESS_LPS25H_FS_MASK,
344361 .fs_avl = {
362+ /*
363+ * Pressure and temperature sensitivity values
364+ * as defined in table 3 of LPS25H datasheet.
365+ */
345366 [0] = {
346367 .num = ST_PRESS_FS_AVL_1260MB,
347− .value = ST_PRESS_LPS25H_FS_AVL_1260_VAL,
348− .gain = ST_PRESS_LPS25H_FS_AVL_1260_GAIN,
349− .gain2 = ST_PRESS_LPS25H_FS_AVL_TEMP_GAIN,
368+ .gain = ST_PRESS_KPASCAL_NANO_SCALE,
369+ .gain2 = ST_PRESS_LSB_PER_CELSIUS,
350370 },
351371 },
352372 },
@@ -450,26 +470,26 @@ static int st_press_read_raw(struct iio_dev *indio_dev, · 97 unmodified lines
450470
451471 return IIO_VAL_INT;
452472 case IIO_CHAN_INFO_SCALE:
453− *val = 0;
454−
455473 switch (ch->type) {
456474 case IIO_PRESSURE:
475+ *val = 0;
457476 *val2 = press_data->current_fullscale->gain;
458− break;
477+ return IIO_VAL_INT_PLUS_NANO;
459478 case IIO_TEMP:
479+ *val = MCELSIUS_PER_CELSIUS;
460480 *val2 = press_data->current_fullscale->gain2;
461− break;
481+ return IIO_VAL_FRACTIONAL;
462482 default:
463483 err = -EINVAL;
464484 goto read_error;
465485 }
466486
467− return IIO_VAL_INT_PLUS_NANO;
468487 case IIO_CHAN_INFO_OFFSET:
469488 switch (ch->type) {
470489 case IIO_TEMP:
471− *val = 425;
472− *val2 = 10;
490+ *val = ST_PRESS_MILLI_CELSIUS_OFFSET *
491+ press_data->current_fullscale->gain2;
492+ *val2 = MCELSIUS_PER_CELSIUS;
473493 break;
474494 default:
475495 err = -EINVAL;
@@ -511,6 +531,7 @@ static const struct iio_info press_info = { · 35 unmodified lines
511531 static const struct iio_trigger_ops st_press_trigger_ops = {
512532 .owner = THIS_MODULE,
513533 .set_trigger_state = ST_PRESS_TRIGGER_SET_STATE,
534+ .validate_device = st_sensors_validate_device,
514535 };
515536 #define ST_PRESS_TRIGGER_OPS (&st_press_trigger_ops)
516537 #else
drivers/iio/proximity/as3935.c+12−5
@@ -64,6 +64,7 @@ struct as3935_state { · 63 unmodified lines
6464 struct delayed_work work;
6565
6666 u32 tune_cap;
67+ u8 buffer[16]; /* 8-bit data + 56-bit padding + 64-bit timestamp */
6768 u8 buf[2] ____cacheline_aligned;
6869 };
6970
@@ -72,7 +73,8 @@ static const struct iio_chan_spec as3935_channels[] = { · 2 unmodified lines
7273 .type = IIO_PROXIMITY,
7374 .info_mask_separate =
7475 BIT(IIO_CHAN_INFO_RAW) |
75− BIT(IIO_CHAN_INFO_PROCESSED),
76+ BIT(IIO_CHAN_INFO_PROCESSED) |
77+ BIT(IIO_CHAN_INFO_SCALE),
7678 .scan_index = 0,
7779 .scan_type = {
7880 .sign = 'u',
@@ -181,7 +183,12 @@ static int as3935_read_raw(struct iio_dev *indio_dev, · 102 unmodified lines
181183 /* storm out of range */
182184 if (*val == AS3935_DATA_MASK)
183185 return -EINVAL;
184− *val *= 1000;
186+
187+ if (m == IIO_CHAN_INFO_PROCESSED)
188+ *val *= 1000;
189+ break;
190+ case IIO_CHAN_INFO_SCALE:
191+ *val = 1000;
185192 break;
186193 default:
187194 return -EINVAL;
@@ -206,10 +213,10 @@ static irqreturn_t as3935_trigger_handler(int irq, void *private) · 18 unmodified lines
206213 ret = as3935_read(st, AS3935_DATA, &val);
207214 if (ret)
208215 goto err_read;
209− val &= AS3935_DATA_MASK;
210− val *= 1000;
211216
212− iio_push_to_buffers_with_timestamp(indio_dev, &val, pf->timestamp);
217+ st->buffer[0] = val & AS3935_DATA_MASK;
218+ iio_push_to_buffers_with_timestamp(indio_dev, &st->buffer,
219+ pf->timestamp);
213220 err_read:
214221 iio_trigger_notify_done(indio_dev->trig);
215222
drivers/infiniband/core/cache.c+8−2
@@ -178,6 +178,7 @@ static int write_gid(struct ib_device *ib_dev, u8 port, · 177 unmodified lines
178178 {
179179 int ret = 0;
180180 struct net_device *old_net_dev;
181+ enum ib_gid_type old_gid_type;
181182
182183 /* in rdma_cap_roce_gid_table, this funciton should be protected by a
183184 * sleep-able lock.
@@ -199,6 +200,7 @@ static int write_gid(struct ib_device *ib_dev, u8 port, · 15 unmodified lines
199200 }
200201
201202 old_net_dev = table->data_vec[ix].attr.ndev;
203+ old_gid_type = table->data_vec[ix].attr.gid_type;
202204 if (old_net_dev && old_net_dev != attr->ndev)
203205 dev_put(old_net_dev);
204206 /* if modify_gid failed, just delete the old gid */
@@ -207,10 +209,14 @@ static int write_gid(struct ib_device *ib_dev, u8 port, · 2 unmodified lines
207209 attr = &zattr;
208210 table->data_vec[ix].context = NULL;
209211 }
210− if (default_gid)
211− table->data_vec[ix].props |= GID_TABLE_ENTRY_DEFAULT;
212+
212213 memcpy(&table->data_vec[ix].gid, gid, sizeof(*gid));
213214 memcpy(&table->data_vec[ix].attr, attr, sizeof(*attr));
215+ if (default_gid) {
216+ table->data_vec[ix].props |= GID_TABLE_ENTRY_DEFAULT;
217+ if (action == GID_TABLE_WRITE_ACTION_DEL)
218+ table->data_vec[ix].attr.gid_type = old_gid_type;
219+ }
214220 if (table->data_vec[ix].attr.ndev &&
215221 table->data_vec[ix].attr.ndev != old_net_dev)
216222 dev_hold(table->data_vec[ix].attr.ndev);
drivers/infiniband/core/cm.c+2−2
@@ -3452,14 +3452,14 @@ static int cm_establish(struct ib_cm_id *cm_id) · 3451 unmodified lines
34523452 work->cm_event.event = IB_CM_USER_ESTABLISHED;
34533453
34543454 /* Check if the device started its remove_one */
3455− spin_lock_irq(&cm.lock);
3455+ spin_lock_irqsave(&cm.lock, flags);
34563456 if (!cm_dev->going_down) {
34573457 queue_delayed_work(cm.wq, &work->work, 0);
34583458 } else {
34593459 kfree(work);
34603460 ret = -ENODEV;
34613461 }
3462− spin_unlock_irq(&cm.lock);
3462+ spin_unlock_irqrestore(&cm.lock, flags);
34633463
34643464 out:
34653465 return ret;
drivers/infiniband/core/device.c+5−1
@@ -661,6 +661,9 @@ int ib_query_port(struct ib_device *device, · 660 unmodified lines
661661 if (err || port_attr->subnet_prefix)
662662 return err;
663663
664+ if (rdma_port_get_link_layer(device, port_num) != IB_LINK_LAYER_INFINIBAND)
665+ return 0;
666+
664667 err = ib_query_gid(device, port_num, 0, &gid, NULL);
665668 if (err)
666669 return err;
@@ -1024,7 +1027,8 @@ static int __init ib_core_init(void) · 357 unmodified lines
10241027 goto err_mad;
10251028 }
10261029
1027− if (ib_add_ibnl_clients()) {
1030+ ret = ib_add_ibnl_clients();
1031+ if (ret) {
10281032 pr_warn("Couldn't register ibnl clients\n");
10291033 goto err_sa;
10301034 }
drivers/infiniband/core/iwpm_msg.c+1−1
@@ -506,7 +506,7 @@ int iwpm_add_and_query_mapping_cb(struct sk_buff *skb, · 505 unmodified lines
506506 if (!nlmsg_request) {
507507 pr_info("%s: Could not find a matching request (seq = %u)\n",
508508 __func__, msg_seq);
509− return -EINVAL;
509+ return -EINVAL;
510510 }
511511 pm_msg = nlmsg_request->req_buffer;
512512 local_sockaddr = (struct sockaddr_storage *)
drivers/infiniband/core/mad.c+3−3
@@ -1638,9 +1638,9 @@ static void remove_mad_reg_req(struct ib_mad_agent_private *agent_priv) · 1637 unmodified lines
16381638 /* Now, check to see if there are any methods still in use */
16391639 if (!check_method_table(method)) {
16401640 /* If not, release management method table */
1641− kfree(method);
1642− class->method_table[mgmt_class] = NULL;
1643− /* Any management classes left ? */
1641+ kfree(method);
1642+ class->method_table[mgmt_class] = NULL;
1643+ /* Any management classes left ? */
16441644 if (!check_class_table(class)) {
16451645 /* If not, release management class table */
16461646 kfree(class);
drivers/infiniband/core/sysfs.c+16−8
@@ -889,9 +889,9 @@ static struct attribute *alloc_hsa_lifespan(char *name, u8 port_num) · 888 unmodified lines
889889 static void setup_hw_stats(struct ib_device *device, struct ib_port *port,
890890 u8 port_num)
891891 {
892− struct attribute_group *hsag = NULL;
892+ struct attribute_group *hsag;
893893 struct rdma_hw_stats *stats;
894− int i = 0, ret;
894+ int i, ret;
895895
896896 stats = device->alloc_hw_stats(device, port_num);
897897
@@ -899,19 +899,22 @@ static void setup_hw_stats(struct ib_device *device, struct ib_port *port, · 1 unmodified line
899899 return;
900900
901901 if (!stats->names || stats->num_counters <= 0)
902− goto err;
902+ goto err_free_stats;
903903
904+ /*
905+ * Two extra attribue elements here, one for the lifespan entry and
906+ * one to NULL terminate the list for the sysfs core code
907+ */
904908 hsag = kzalloc(sizeof(*hsag) +
905− // 1 extra for the lifespan config entry
906− sizeof(void *) * (stats->num_counters + 1),
909+ sizeof(void *) * (stats->num_counters + 2),
907910 GFP_KERNEL);
908911 if (!hsag)
909− return;
912+ goto err_free_stats;
910913
911914 ret = device->get_hw_stats(device, stats, port_num,
912915 stats->num_counters);
913916 if (ret != stats->num_counters)
914− goto err;
917+ goto err_free_hsag;
915918
916919 stats->timestamp = jiffies;
917920
@@ -922,10 +925,13 @@ static void setup_hw_stats(struct ib_device *device, struct ib_port *port, · 4 unmodified lines
922925 hsag->attrs[i] = alloc_hsa(i, port_num, stats->names[i]);
923926 if (!hsag->attrs[i])
924927 goto err;
928+ sysfs_attr_init(hsag->attrs[i]);
925929 }
926930
927931 /* treat an error here as non-fatal */
928932 hsag->attrs[i] = alloc_hsa_lifespan("lifespan", port_num);
933+ if (hsag->attrs[i])
934+ sysfs_attr_init(hsag->attrs[i]);
929935
930936 if (port) {
931937 struct kobject *kobj = &port->kobj;
@@ -946,10 +952,12 @@ static void setup_hw_stats(struct ib_device *device, struct ib_port *port, · 14 unmodified lines
946952 return;
947953
948954 err:
949− kfree(stats);
950955 for (; i >= 0; i--)
951956 kfree(hsag->attrs[i]);
957+err_free_hsag:
952958 kfree(hsag);
959+err_free_stats:
960+ kfree(stats);
953961 return;
954962 }
955963
drivers/infiniband/hw/hfi1/affinity.c+14−17
@@ -300,16 +300,15 @@ int hfi1_get_proc_affinity(struct hfi1_devdata *dd, int node) · 299 unmodified lines
300300 const struct cpumask *node_mask,
301301 *proc_mask = tsk_cpus_allowed(current);
302302 struct cpu_mask_set *set = &dd->affinity->proc;
303− char buf[1024];
304303
305304 /*
306305 * check whether process/context affinity has already
307306 * been set
308307 */
309308 if (cpumask_weight(proc_mask) == 1) {
310− scnprintf(buf, 1024, "%*pbl", cpumask_pr_args(proc_mask));
311− hfi1_cdbg(PROC, "PID %u %s affinity set to CPU %s",
312− current->pid, current->comm, buf);
309+ hfi1_cdbg(PROC, "PID %u %s affinity set to CPU %*pbl",
310+ current->pid, current->comm,
311+ cpumask_pr_args(proc_mask));
313312 /*
314313 * Mark the pre-set CPU as used. This is atomic so we don't
315314 * need the lock
@@ -318,9 +317,9 @@ int hfi1_get_proc_affinity(struct hfi1_devdata *dd, int node) · 2 unmodified lines
318317 cpumask_set_cpu(cpu, &set->used);
319318 goto done;
320319 } else if (cpumask_weight(proc_mask) < cpumask_weight(&set->mask)) {
321− scnprintf(buf, 1024, "%*pbl", cpumask_pr_args(proc_mask));
322− hfi1_cdbg(PROC, "PID %u %s affinity set to CPU set(s) %s",
323− current->pid, current->comm, buf);
320+ hfi1_cdbg(PROC, "PID %u %s affinity set to CPU set(s) %*pbl",
321+ current->pid, current->comm,
322+ cpumask_pr_args(proc_mask));
324323 goto done;
325324 }
326325
@@ -356,8 +355,8 @@ int hfi1_get_proc_affinity(struct hfi1_devdata *dd, int node) · 29 unmodified lines
356355 cpumask_or(intrs, intrs, (dd->affinity->rcv_intr.gen ?
357356 &dd->affinity->rcv_intr.mask :
358357 &dd->affinity->rcv_intr.used));
359− scnprintf(buf, 1024, "%*pbl", cpumask_pr_args(intrs));
360− hfi1_cdbg(PROC, "CPUs used by interrupts: %s", buf);
358+ hfi1_cdbg(PROC, "CPUs used by interrupts: %*pbl",
359+ cpumask_pr_args(intrs));
361360
362361 /*
363362 * If we don't have a NUMA node requested, preference is towards
@@ -366,18 +365,16 @@ int hfi1_get_proc_affinity(struct hfi1_devdata *dd, int node) · 2 unmodified lines
366365 if (node == -1)
367366 node = dd->node;
368367 node_mask = cpumask_of_node(node);
369− scnprintf(buf, 1024, "%*pbl", cpumask_pr_args(node_mask));
370− hfi1_cdbg(PROC, "device on NUMA %u, CPUs %s", node, buf);
368+ hfi1_cdbg(PROC, "device on NUMA %u, CPUs %*pbl", node,
369+ cpumask_pr_args(node_mask));
371370
372371 /* diff will hold all unused cpus */
373372 cpumask_andnot(diff, &set->mask, &set->used);
374− scnprintf(buf, 1024, "%*pbl", cpumask_pr_args(diff));
375− hfi1_cdbg(PROC, "unused CPUs (all) %s", buf);
373+ hfi1_cdbg(PROC, "unused CPUs (all) %*pbl", cpumask_pr_args(diff));
376374
377375 /* get cpumask of available CPUs on preferred NUMA */
378376 cpumask_and(mask, diff, node_mask);
379− scnprintf(buf, 1024, "%*pbl", cpumask_pr_args(mask));
380− hfi1_cdbg(PROC, "available cpus on NUMA %s", buf);
377+ hfi1_cdbg(PROC, "available cpus on NUMA %*pbl", cpumask_pr_args(mask));
381378
382379 /*
383380 * At first, we don't want to place processes on the same
@@ -395,8 +392,8 @@ int hfi1_get_proc_affinity(struct hfi1_devdata *dd, int node) · 11 unmodified lines
395392 cpumask_andnot(diff, &set->mask, &set->used);
396393 cpumask_andnot(mask, diff, node_mask);
397394 }
398− scnprintf(buf, 1024, "%*pbl", cpumask_pr_args(mask));
399− hfi1_cdbg(PROC, "possible CPUs for process %s", buf);
395+ hfi1_cdbg(PROC, "possible CPUs for process %*pbl",
396+ cpumask_pr_args(mask));
400397
401398 cpu = cpumask_first(mask);
402399 if (cpu >= nr_cpu_ids) /* empty */
drivers/infiniband/hw/hfi1/chip.c+3−3
@@ -7832,8 +7832,8 @@ static void handle_dcc_err(struct hfi1_devdata *dd, u32 unused, u64 reg) · 7831 unmodified lines
78327832 * save first 2 flits in the packet that caused
78337833 * the error
78347834 */
7835− dd->err_info_rcvport.packet_flit1 = hdr0;
7836− dd->err_info_rcvport.packet_flit2 = hdr1;
7835+ dd->err_info_rcvport.packet_flit1 = hdr0;
7836+ dd->err_info_rcvport.packet_flit2 = hdr1;
78377837 }
78387838 switch (info) {
78397839 case 1:
@@ -11906,7 +11906,7 @@ static void update_synth_timer(unsigned long opaque) · 4066 unmodified lines
1190611906 hfi1_cdbg(CNTR, "[%d] No update necessary", dd->unit);
1190711907 }
1190811908
11909−mod_timer(&dd->synth_stats_timer, jiffies + HZ * SYNTH_CNT_TIME);
11909+ mod_timer(&dd->synth_stats_timer, jiffies + HZ * SYNTH_CNT_TIME);
1191011910 }
1191111911
1191211912 #define C_MAX_NAME 13 /* 12 chars + one for /0 */
drivers/infiniband/hw/hfi1/init.c+1−1
@@ -1337,7 +1337,7 @@ static void cleanup_device_data(struct hfi1_devdata *dd) · 1336 unmodified lines
13371337 dma_free_coherent(&dd->pcidev->dev, sizeof(u64),
13381338 (void *)dd->rcvhdrtail_dummy_kvaddr,
13391339 dd->rcvhdrtail_dummy_physaddr);
1340− dd->rcvhdrtail_dummy_kvaddr = NULL;
1340+ dd->rcvhdrtail_dummy_kvaddr = NULL;
13411341 }
13421342
13431343 for (ctxt = 0; tmp && ctxt < dd->num_rcv_contexts; ctxt++) {
drivers/infiniband/hw/hfi1/trace.c+0−13
@@ -214,19 +214,6 @@ const char *print_u32_array( · 213 unmodified lines
214214 return ret;
215215 }
216216
217−const char *print_u64_array(
218− struct trace_seq *p,
219− u64 *arr, int len)
220−{
221− int i;
222− const char *ret = trace_seq_buffer_ptr(p);
223−
224− for (i = 0; i < len; i++)
225− trace_seq_printf(p, "%s0x%016llx", i == 0 ? "" : " ", arr[i]);
226− trace_seq_putc(p, 0);
227− return ret;
228−}
229−
230217 __hfi1_trace_fn(PKT);
231218 __hfi1_trace_fn(PROC);
232219 __hfi1_trace_fn(SDMA);
drivers/infiniband/hw/hfi1/user_sdma.c+3−3
@@ -183,7 +183,7 @@ struct user_sdma_iovec { · 182 unmodified lines
183183 struct sdma_mmu_node *node;
184184 };
185185
186−#define SDMA_CACHE_NODE_EVICT BIT(0)
186+#define SDMA_CACHE_NODE_EVICT 0
187187
188188 struct sdma_mmu_node {
189189 struct mmu_rb_node rb;
@@ -1355,11 +1355,11 @@ static int set_txreq_header(struct user_sdma_request *req, · 1165 unmodified lines
13551355 */
13561356 SDMA_DBG(req, "TID offset %ubytes %uunits om%u",
13571357 req->tidoffset, req->tidoffset / req->omfactor,
1358− !!(req->omfactor - KDETH_OM_SMALL));
1358+ req->omfactor != KDETH_OM_SMALL);
13591359 KDETH_SET(hdr->kdeth.ver_tid_offset, OFFSET,
13601360 req->tidoffset / req->omfactor);
13611361 KDETH_SET(hdr->kdeth.ver_tid_offset, OM,
1362− !!(req->omfactor - KDETH_OM_SMALL));
1362+ req->omfactor != KDETH_OM_SMALL);
13631363 }
13641364 done:
13651365 trace_hfi1_sdma_user_header(pq->dd, pq->ctxt, pq->subctxt,
drivers/infiniband/hw/mlx4/main.c+2−2
@@ -505,9 +505,9 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, · 504 unmodified lines
505505 props->device_cap_flags |= IB_DEVICE_MEM_WINDOW_TYPE_2B;
506506 else
507507 props->device_cap_flags |= IB_DEVICE_MEM_WINDOW_TYPE_2A;
508− if (dev->steering_support == MLX4_STEERING_MODE_DEVICE_MANAGED)
509− props->device_cap_flags |= IB_DEVICE_MANAGED_FLOW_STEERING;
510508 }
509+ if (dev->steering_support == MLX4_STEERING_MODE_DEVICE_MANAGED)
510+ props->device_cap_flags |= IB_DEVICE_MANAGED_FLOW_STEERING;
511511
512512 props->device_cap_flags |= IB_DEVICE_RAW_IP_CSUM;
513513
drivers/infiniband/hw/mlx5/cq.c+9−3
@@ -822,7 +822,8 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev, · 821 unmodified lines
822822 int eqn;
823823 int err;
824824
825− if (entries < 0)
825+ if (entries < 0 ||
826+ (entries > (1 << MLX5_CAP_GEN(dev->mdev, log_max_cq_sz))))
826827 return ERR_PTR(-EINVAL);
827828
828829 if (check_cq_create_flags(attr->flags))
@@ -1168,11 +1169,16 @@ int mlx5_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata) · 339 unmodified lines
11681169 return -ENOSYS;
11691170 }
11701171
1171− if (entries < 1)
1172+ if (entries < 1 ||
1173+ entries > (1 << MLX5_CAP_GEN(dev->mdev, log_max_cq_sz))) {
1174+ mlx5_ib_warn(dev, "wrong entries number %d, max %d\n",
1175+ entries,
1176+ 1 << MLX5_CAP_GEN(dev->mdev, log_max_cq_sz));
11721177 return -EINVAL;
1178+ }
11731179
11741180 entries = roundup_pow_of_two(entries + 1);
1175− if (entries > (1 << MLX5_CAP_GEN(dev->mdev, log_max_cq_sz)) + 1)
1181+ if (entries > (1 << MLX5_CAP_GEN(dev->mdev, log_max_cq_sz)) + 1)
11761182 return -EINVAL;
11771183
11781184 if (entries == ibcq->cqe + 1)
drivers/infiniband/hw/mlx5/main.c+15−7
@@ -524,6 +524,9 @@ static int mlx5_ib_query_device(struct ib_device *ibdev, · 523 unmodified lines
524524 MLX5_CAP_ETH(dev->mdev, scatter_fcs))
525525 props->device_cap_flags |= IB_DEVICE_RAW_SCATTER_FCS;
526526
527+ if (mlx5_get_flow_namespace(dev->mdev, MLX5_FLOW_NAMESPACE_BYPASS))
528+ props->device_cap_flags |= IB_DEVICE_MANAGED_FLOW_STEERING;
529+
527530 props->vendor_part_id = mdev->pdev->device;
528531 props->hw_ver = mdev->pdev->revision;
529532
@@ -915,7 +918,8 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev, · 385 unmodified lines
915918 num_uars = req.total_num_uuars / MLX5_NON_FP_BF_REGS_PER_PAGE;
916919 gross_uuars = num_uars * MLX5_BF_REGS_PER_PAGE;
917920 resp.qp_tab_size = 1 << MLX5_CAP_GEN(dev->mdev, log_max_qp);
918− resp.bf_reg_size = 1 << MLX5_CAP_GEN(dev->mdev, log_bf_reg_size);
921+ if (mlx5_core_is_pf(dev->mdev) && MLX5_CAP_GEN(dev->mdev, bf))
922+ resp.bf_reg_size = 1 << MLX5_CAP_GEN(dev->mdev, log_bf_reg_size);
919923 resp.cache_line_size = L1_CACHE_BYTES;
920924 resp.max_sq_desc_sz = MLX5_CAP_GEN(dev->mdev, max_wqe_sz_sq);
921925 resp.max_rq_desc_sz = MLX5_CAP_GEN(dev->mdev, max_wqe_sz_rq);
@@ -988,7 +992,14 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev, · 66 unmodified lines
988992 if (field_avail(typeof(resp), cqe_version, udata->outlen))
989993 resp.response_length += sizeof(resp.cqe_version);
990994
991− if (field_avail(typeof(resp), hca_core_clock_offset, udata->outlen)) {
995+ /*
996+ * We don't want to expose information from the PCI bar that is located
997+ * after 4096 bytes, so if the arch only supports larger pages, let's
998+ * pretend we don't support reading the HCA's core clock. This is also
999+ * forced by mmap function.
1000+ */
1001+ if (PAGE_SIZE <= 4096 &&
1002+ field_avail(typeof(resp), hca_core_clock_offset, udata->outlen)) {
9921003 resp.comp_mask |=
9931004 MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_CORE_CLOCK_OFFSET;
9941005 resp.hca_core_clock_offset =
@@ -1798,7 +1809,7 @@ static ssize_t show_fw_ver(struct device *device, struct device_attribute *attr, · 803 unmodified lines
17981809 {
17991810 struct mlx5_ib_dev *dev =
18001811 container_of(device, struct mlx5_ib_dev, ib_dev.dev);
1801− return sprintf(buf, "%d.%d.%d\n", fw_rev_maj(dev->mdev),
1812+ return sprintf(buf, "%d.%d.%04d\n", fw_rev_maj(dev->mdev),
18021813 fw_rev_min(dev->mdev), fw_rev_sub(dev->mdev));
18031814 }
18041815
@@ -1866,14 +1877,11 @@ static void mlx5_ib_event(struct mlx5_core_dev *dev, void *context, · 61 unmodified lines
18661877 break;
18671878
18681879 case MLX5_DEV_EVENT_PORT_DOWN:
1880+ case MLX5_DEV_EVENT_PORT_INITIALIZED:
18691881 ibev.event = IB_EVENT_PORT_ERR;
18701882 port = (u8)param;
18711883 break;
18721884
1873− case MLX5_DEV_EVENT_PORT_INITIALIZED:
1874− /* not used by ULPs */
1875− return;
1876−
18771885 case MLX5_DEV_EVENT_LID_CHANGE:
18781886 ibev.event = IB_EVENT_LID_CHANGE;
18791887 port = (u8)param;
drivers/infiniband/hw/mlx5/qp.c+25−16
@@ -235,6 +235,8 @@ static int set_rq_size(struct mlx5_ib_dev *dev, struct ib_qp_cap *cap, · 234 unmodified lines
235235 qp->rq.max_gs = 0;
236236 qp->rq.wqe_cnt = 0;
237237 qp->rq.wqe_shift = 0;
238+ cap->max_recv_wr = 0;
239+ cap->max_recv_sge = 0;
238240 } else {
239241 if (ucmd) {
240242 qp->rq.wqe_cnt = ucmd->rq_wqe_count;
@@ -1851,13 +1853,15 @@ static int modify_raw_packet_eth_prio(struct mlx5_core_dev *dev, · 1610 unmodified lines
18511853 static int mlx5_set_path(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
18521854 const struct ib_ah_attr *ah,
18531855 struct mlx5_qp_path *path, u8 port, int attr_mask,
1854− u32 path_flags, const struct ib_qp_attr *attr)
1856+ u32 path_flags, const struct ib_qp_attr *attr,
1857+ bool alt)
18551858 {
18561859 enum rdma_link_layer ll = rdma_port_get_link_layer(&dev->ib_dev, port);
18571860 int err;
18581861
18591862 if (attr_mask & IB_QP_PKEY_INDEX)
1860− path->pkey_index = attr->pkey_index;
1863+ path->pkey_index = cpu_to_be16(alt ? attr->alt_pkey_index :
1864+ attr->pkey_index);
18611865
18621866 if (ah->ah_flags & IB_AH_GRH) {
18631867 if (ah->grh.sgid_index >=
@@ -1877,9 +1881,9 @@ static int mlx5_set_path(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp, · 13 unmodified lines
18771881 ah->grh.sgid_index);
18781882 path->dci_cfi_prio_sl = (ah->sl & 0x7) << 4;
18791883 } else {
1880− path->fl = (path_flags & MLX5_PATH_FLAG_FL) ? 0x80 : 0;
1881− path->free_ar = (path_flags & MLX5_PATH_FLAG_FREE_AR) ? 0x80 :
1882− 0;
1884+ path->fl_free_ar = (path_flags & MLX5_PATH_FLAG_FL) ? 0x80 : 0;
1885+ path->fl_free_ar |=
1886+ (path_flags & MLX5_PATH_FLAG_FREE_AR) ? 0x40 : 0;
18831887 path->rlid = cpu_to_be16(ah->dlid);
18841888 path->grh_mlid = ah->src_path_bits & 0x7f;
18851889 if (ah->ah_flags & IB_AH_GRH)
@@ -1903,7 +1907,7 @@ static int mlx5_set_path(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp, · 17 unmodified lines
19031907 path->port = port;
19041908
19051909 if (attr_mask & IB_QP_TIMEOUT)
1906− path->ackto_lt = attr->timeout << 3;
1910+ path->ackto_lt = (alt ? attr->alt_timeout : attr->timeout) << 3;
19071911
19081912 if ((qp->ibqp.qp_type == IB_QPT_RAW_PACKET) && qp->sq.wqe_cnt)
19091913 return modify_raw_packet_eth_prio(dev->mdev,
@@ -2264,7 +2268,7 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp, · 354 unmodified lines
22642268 context->log_pg_sz_remote_qpn = cpu_to_be32(attr->dest_qp_num);
22652269
22662270 if (attr_mask & IB_QP_PKEY_INDEX)
2267− context->pri_path.pkey_index = attr->pkey_index;
2271+ context->pri_path.pkey_index = cpu_to_be16(attr->pkey_index);
22682272
22692273 /* todo implement counter_index functionality */
22702274
@@ -2277,7 +2281,7 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp, · 6 unmodified lines
22772281 if (attr_mask & IB_QP_AV) {
22782282 err = mlx5_set_path(dev, qp, &attr->ah_attr, &context->pri_path,
22792283 attr_mask & IB_QP_PORT ? attr->port_num : qp->port,
2280− attr_mask, 0, attr);
2284+ attr_mask, 0, attr, false);
22812285 if (err)
22822286 goto out;
22832287 }
@@ -2288,7 +2292,9 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp, · 4 unmodified lines
22882292 if (attr_mask & IB_QP_ALT_PATH) {
22892293 err = mlx5_set_path(dev, qp, &attr->alt_ah_attr,
22902294 &context->alt_path,
2291− attr->alt_port_num, attr_mask, 0, attr);
2295+ attr->alt_port_num,
2296+ attr_mask | IB_QP_PKEY_INDEX | IB_QP_TIMEOUT,
2297+ 0, attr, true);
22922298 if (err)
22932299 goto out;
22942300 }
@@ -4013,11 +4019,12 @@ static int query_qp_attr(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp, · 1718 unmodified lines
40134019 if (qp->ibqp.qp_type == IB_QPT_RC || qp->ibqp.qp_type == IB_QPT_UC) {
40144020 to_ib_ah_attr(dev, &qp_attr->ah_attr, &context->pri_path);
40154021 to_ib_ah_attr(dev, &qp_attr->alt_ah_attr, &context->alt_path);
4016− qp_attr->alt_pkey_index = context->alt_path.pkey_index & 0x7f;
4022+ qp_attr->alt_pkey_index =
4023+ be16_to_cpu(context->alt_path.pkey_index);
40174024 qp_attr->alt_port_num = qp_attr->alt_ah_attr.port_num;
40184025 }
40194026
4020− qp_attr->pkey_index = context->pri_path.pkey_index & 0x7f;
4027+ qp_attr->pkey_index = be16_to_cpu(context->pri_path.pkey_index);
40214028 qp_attr->port_num = context->pri_path.port;
40224029
40234030 /* qp_attr->en_sqd_async_notify is only applicable in modify qp */
@@ -4079,17 +4086,19 @@ int mlx5_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, · 55 unmodified lines
40794086 qp_attr->cap.max_recv_sge = qp->rq.max_gs;
40804087
40814088 if (!ibqp->uobject) {
4082− qp_attr->cap.max_send_wr = qp->sq.wqe_cnt;
4089+ qp_attr->cap.max_send_wr = qp->sq.max_post;
40834090 qp_attr->cap.max_send_sge = qp->sq.max_gs;
4091+ qp_init_attr->qp_context = ibqp->qp_context;
40844092 } else {
40854093 qp_attr->cap.max_send_wr = 0;
40864094 qp_attr->cap.max_send_sge = 0;
40874095 }
40884096
4089− /* We don't support inline sends for kernel QPs (yet), and we
4090− * don't know what userspace's value should be.
4091− */
4092− qp_attr->cap.max_inline_data = 0;
4097+ qp_init_attr->qp_type = ibqp->qp_type;
4098+ qp_init_attr->recv_cq = ibqp->recv_cq;
4099+ qp_init_attr->send_cq = ibqp->send_cq;
4100+ qp_init_attr->srq = ibqp->srq;
4101+ qp_attr->cap.max_inline_data = qp->max_inline_data;
40934102
40944103 qp_init_attr->cap = qp_attr->cap;
40954104
drivers/infiniband/hw/usnic/usnic_uiom.c+0−5
@@ -36,7 +36,6 @@ · 35 unmodified lines
3636 #include <linux/dma-mapping.h>
3737 #include <linux/sched.h>
3838 #include <linux/hugetlb.h>
39−#include <linux/dma-attrs.h>
4039 #include <linux/iommu.h>
4140 #include <linux/workqueue.h>
4241 #include <linux/list.h>
@@ -112,10 +111,6 @@ static int usnic_uiom_get_pages(unsigned long addr, size_t size, int writable, · 69 unmodified lines
112111 int i;
113112 int flags;
114113 dma_addr_t pa;
115− DEFINE_DMA_ATTRS(attrs);
116−
117− if (dmasync)
118− dma_set_attr(DMA_ATTR_WRITE_BARRIER, &attrs);
119114
120115 if (!can_do_mlock())
121116 return -EPERM;
drivers/infiniband/sw/rdmavt/qp.c+6−0
@@ -502,6 +502,12 @@ static void rvt_remove_qp(struct rvt_dev_info *rdi, struct rvt_qp *qp) · 501 unmodified lines
502502 */
503503 static void rvt_reset_qp(struct rvt_dev_info *rdi, struct rvt_qp *qp,
504504 enum ib_qp_type type)
505+ __releases(&qp->s_lock)
506+ __releases(&qp->s_hlock)
507+ __releases(&qp->r_lock)
508+ __acquires(&qp->r_lock)
509+ __acquires(&qp->s_hlock)
510+ __acquires(&qp->s_lock)
505511 {
506512 if (qp->state != IB_QPS_RESET) {
507513 qp->state = IB_QPS_RESET;
drivers/infiniband/ulp/ipoib/ipoib.h+1−0
@@ -94,6 +94,7 @@ enum { · 93 unmodified lines
9494 IPOIB_NEIGH_TBL_FLUSH = 12,
9595 IPOIB_FLAG_DEV_ADDR_SET = 13,
9696 IPOIB_FLAG_DEV_ADDR_CTRL = 14,
97+ IPOIB_FLAG_GOING_DOWN = 15,
9798
9899 IPOIB_MAX_BACKOFF_SECONDS = 16,
99100
drivers/infiniband/ulp/ipoib/ipoib_cm.c+4−0
@@ -1486,6 +1486,10 @@ static ssize_t set_mode(struct device *d, struct device_attribute *attr, · 1485 unmodified lines
14861486 {
14871487 struct net_device *dev = to_net_dev(d);
14881488 int ret;
1489+ struct ipoib_dev_priv *priv = netdev_priv(dev);
1490+
1491+ if (test_bit(IPOIB_FLAG_GOING_DOWN, &priv->flags))
1492+ return -EPERM;
14891493
14901494 if (!rtnl_trylock())
14911495 return restart_syscall();
drivers/infiniband/ulp/ipoib/ipoib_ib.c+4−4
@@ -1015,7 +1015,7 @@ static bool ipoib_dev_addr_changed_valid(struct ipoib_dev_priv *priv) · 1014 unmodified lines
10151015 if (ib_query_gid(priv->ca, priv->port, 0, &gid0, NULL))
10161016 return false;
10171017
1018− netif_addr_lock(priv->dev);
1018+ netif_addr_lock_bh(priv->dev);
10191019
10201020 /* The subnet prefix may have changed, update it now so we won't have
10211021 * to do it later
@@ -1026,12 +1026,12 @@ static bool ipoib_dev_addr_changed_valid(struct ipoib_dev_priv *priv) · 4 unmodified lines
10261026
10271027 search_gid.global.interface_id = priv->local_gid.global.interface_id;
10281028
1029− netif_addr_unlock(priv->dev);
1029+ netif_addr_unlock_bh(priv->dev);
10301030
10311031 err = ib_find_gid(priv->ca, &search_gid, IB_GID_TYPE_IB,
10321032 priv->dev, &port, &index);
10331033
1034− netif_addr_lock(priv->dev);
1034+ netif_addr_lock_bh(priv->dev);
10351035
10361036 if (search_gid.global.interface_id !=
10371037 priv->local_gid.global.interface_id)
@@ -1092,7 +1092,7 @@ static bool ipoib_dev_addr_changed_valid(struct ipoib_dev_priv *priv) · 54 unmodified lines
10921092 }
10931093
10941094 out:
1095− netif_addr_unlock(priv->dev);
1095+ netif_addr_unlock_bh(priv->dev);
10961096
10971097 return ret;
10981098 }
drivers/infiniband/ulp/ipoib/ipoib_main.c+10−5
@@ -1206,7 +1206,9 @@ struct ipoib_neigh *ipoib_neigh_get(struct net_device *dev, u8 *daddr) · 1205 unmodified lines
12061206 neigh = NULL;
12071207 goto out_unlock;
12081208 }
1209− neigh->alive = jiffies;
1209+
1210+ if (likely(skb_queue_len(&neigh->queue) < IPOIB_MAX_PATH_REC_QUEUE))
1211+ neigh->alive = jiffies;
12101212 goto out_unlock;
12111213 }
12121214 }
@@ -1851,7 +1853,7 @@ static void set_base_guid(struct ipoib_dev_priv *priv, union ib_gid *gid) · 638 unmodified lines
18511853 struct ipoib_dev_priv *child_priv;
18521854 struct net_device *netdev = priv->dev;
18531855
1854− netif_addr_lock(netdev);
1856+ netif_addr_lock_bh(netdev);
18551857
18561858 memcpy(&priv->local_gid.global.interface_id,
18571859 &gid->global.interface_id,
@@ -1859,7 +1861,7 @@ static void set_base_guid(struct ipoib_dev_priv *priv, union ib_gid *gid) · 1 unmodified line
18591861 memcpy(netdev->dev_addr + 4, &priv->local_gid, sizeof(priv->local_gid));
18601862 clear_bit(IPOIB_FLAG_DEV_ADDR_SET, &priv->flags);
18611863
1862− netif_addr_unlock(netdev);
1864+ netif_addr_unlock_bh(netdev);
18631865
18641866 if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) {
18651867 down_read(&priv->vlan_rwsem);
@@ -1875,7 +1877,7 @@ static int ipoib_check_lladdr(struct net_device *dev, · 9 unmodified lines
18751877 union ib_gid *gid = (union ib_gid *)(ss->__data + 4);
18761878 int ret = 0;
18771879
1878− netif_addr_lock(dev);
1880+ netif_addr_lock_bh(dev);
18791881
18801882 /* Make sure the QPN, reserved and subnet prefix match the current
18811883 * lladdr, it also makes sure the lladdr is unicast.
@@ -1885,7 +1887,7 @@ static int ipoib_check_lladdr(struct net_device *dev, · 3 unmodified lines
18851887 gid->global.interface_id == 0)
18861888 ret = -EINVAL;
18871889
1888− netif_addr_unlock(dev);
1890+ netif_addr_unlock_bh(dev);
18891891
18901892 return ret;
18911893 }
@@ -2141,6 +2143,9 @@ static void ipoib_remove_one(struct ib_device *device, void *client_data) · 249 unmodified lines
21412143 ib_unregister_event_handler(&priv->event_handler);
21422144 flush_workqueue(ipoib_workqueue);
21432145
2146+ /* mark interface in the middle of destruction */
2147+ set_bit(IPOIB_FLAG_GOING_DOWN, &priv->flags);
2148+
21442149 rtnl_lock();
21452150 dev_change_flags(priv->dev, priv->dev->flags & ~IFF_UP);
21462151 rtnl_unlock();
drivers/infiniband/ulp/ipoib/ipoib_multicast.c+3−3
@@ -582,13 +582,13 @@ void ipoib_mcast_join_task(struct work_struct *work) · 581 unmodified lines
582582 return;
583583 }
584584 priv->local_lid = port_attr.lid;
585− netif_addr_lock(dev);
585+ netif_addr_lock_bh(dev);
586586
587587 if (!test_bit(IPOIB_FLAG_DEV_ADDR_SET, &priv->flags)) {
588− netif_addr_unlock(dev);
588+ netif_addr_unlock_bh(dev);
589589 return;
590590 }
591− netif_addr_unlock(dev);
591+ netif_addr_unlock_bh(dev);
592592
593593 spin_lock_irq(&priv->lock);
594594 if (!test_bit(IPOIB_FLAG_OPER_UP, &priv->flags))
drivers/infiniband/ulp/ipoib/ipoib_vlan.c+6−0
@@ -131,6 +131,9 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey) · 130 unmodified lines
131131
132132 ppriv = netdev_priv(pdev);
133133
134+ if (test_bit(IPOIB_FLAG_GOING_DOWN, &ppriv->flags))
135+ return -EPERM;
136+
134137 snprintf(intf_name, sizeof intf_name, "%s.%04x",
135138 ppriv->dev->name, pkey);
136139 priv = ipoib_intf_alloc(intf_name);
@@ -183,6 +186,9 @@ int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey) · 46 unmodified lines
183186
184187 ppriv = netdev_priv(pdev);
185188
189+ if (test_bit(IPOIB_FLAG_GOING_DOWN, &ppriv->flags))
190+ return -EPERM;
191+
186192 if (!rtnl_trylock())
187193 return restart_syscall();
188194
drivers/infiniband/ulp/srp/ib_srp.c+2−5
@@ -1457,7 +1457,6 @@ static int srp_map_sg_fr(struct srp_map_state *state, struct srp_rdma_ch *ch, · 1456 unmodified lines
14571457 {
14581458 unsigned int sg_offset = 0;
14591459
1460− state->desc = req->indirect_desc;
14611460 state->fr.next = req->fr_list;
14621461 state->fr.end = req->fr_list + ch->target->mr_per_cmd;
14631462 state->sg = scat;
@@ -1489,7 +1488,6 @@ static int srp_map_sg_dma(struct srp_map_state *state, struct srp_rdma_ch *ch, · 25 unmodified lines
14891488 struct scatterlist *sg;
14901489 int i;
14911490
1492− state->desc = req->indirect_desc;
14931491 for_each_sg(scat, sg, count, i) {
14941492 srp_map_desc(state, ib_sg_dma_address(dev->dev, sg),
14951493 ib_sg_dma_len(dev->dev, sg),
@@ -1655,6 +1653,7 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_rdma_ch *ch, · 159 unmodified lines
16551653 target->indirect_size, DMA_TO_DEVICE);
16561654
16571655 memset(&state, 0, sizeof(state));
1656+ state.desc = req->indirect_desc;
16581657 if (dev->use_fast_reg)
16591658 ret = srp_map_sg_fr(&state, ch, req, scat, count);
16601659 else if (dev->use_fmr)
@@ -3526,7 +3525,7 @@ static void srp_add_one(struct ib_device *device) · 1865 unmodified lines
35263525 int mr_page_shift, p;
35273526 u64 max_pages_per_mr;
35283527
3529− srp_dev = kmalloc(sizeof *srp_dev, GFP_KERNEL);
3528+ srp_dev = kzalloc(sizeof(*srp_dev), GFP_KERNEL);
35303529 if (!srp_dev)
35313530 return;
35323531
@@ -3586,8 +3585,6 @@ static void srp_add_one(struct ib_device *device) · 53 unmodified lines
35863585 IB_ACCESS_REMOTE_WRITE);
35873586 if (IS_ERR(srp_dev->global_mr))
35883587 goto err_pd;
3589− } else {
3590− srp_dev->global_mr = NULL;
35913588 }
35923589
35933590 for (p = rdma_start_port(device); p <= rdma_end_port(device); ++p) {
drivers/iommu/arm-smmu-v3.c+1−0
@@ -1941,6 +1941,7 @@ static struct iommu_ops arm_smmu_ops = { · 1940 unmodified lines
19411941 .attach_dev = arm_smmu_attach_dev,
19421942 .map = arm_smmu_map,
19431943 .unmap = arm_smmu_unmap,
1944+ .map_sg = default_iommu_map_sg,
19441945 .iova_to_phys = arm_smmu_iova_to_phys,
19451946 .add_device = arm_smmu_add_device,
19461947 .remove_device = arm_smmu_remove_device,
drivers/iommu/intel-iommu.c+12−5
@@ -3222,11 +3222,6 @@ static int __init init_dmars(void) · 3221 unmodified lines
32223222 }
32233223 }
32243224
3225− iommu_flush_write_buffer(iommu);
3226− iommu_set_root_entry(iommu);
3227− iommu->flush.flush_context(iommu, 0, 0, 0, DMA_CCMD_GLOBAL_INVL);
3228− iommu->flush.flush_iotlb(iommu, 0, 0, 0, DMA_TLB_GLOBAL_FLUSH);
3229−
32303225 if (!ecap_pass_through(iommu->ecap))
32313226 hw_pass_through = 0;
32323227 #ifdef CONFIG_INTEL_IOMMU_SVM
@@ -3235,6 +3230,18 @@ static int __init init_dmars(void) · 2 unmodified lines
32353230 #endif
32363231 }
32373232
3233+ /*
3234+ * Now that qi is enabled on all iommus, set the root entry and flush
3235+ * caches. This is required on some Intel X58 chipsets, otherwise the
3236+ * flush_context function will loop forever and the boot hangs.
3237+ */
3238+ for_each_active_iommu(iommu, drhd) {
3239+ iommu_flush_write_buffer(iommu);
3240+ iommu_set_root_entry(iommu);
3241+ iommu->flush.flush_context(iommu, 0, 0, 0, DMA_CCMD_GLOBAL_INVL);
3242+ iommu->flush.flush_iotlb(iommu, 0, 0, 0, DMA_TLB_GLOBAL_FLUSH);
3243+ }
3244+
32383245 if (iommu_pass_through)
32393246 iommu_identity_mapping |= IDENTMAP_ALL;
32403247
drivers/iommu/rockchip-iommu.c+1−1
@@ -815,7 +815,7 @@ static int rk_iommu_attach_device(struct iommu_domain *domain, · 814 unmodified lines
815815 dte_addr = virt_to_phys(rk_domain->dt);
816816 for (i = 0; i < iommu->num_mmu; i++) {
817817 rk_iommu_write(iommu->bases[i], RK_MMU_DTE_ADDR, dte_addr);
818− rk_iommu_command(iommu->bases[i], RK_MMU_CMD_ZAP_CACHE);
818+ rk_iommu_base_command(iommu->bases[i], RK_MMU_CMD_ZAP_CACHE);
819819 rk_iommu_write(iommu->bases[i], RK_MMU_INT_MASK, RK_MMU_IRQ_MASK);
820820 }
821821
drivers/leds/led-core.c+6−3
@@ -53,11 +53,12 @@ static void led_timer_function(unsigned long data) · 52 unmodified lines
5353
5454 if (!led_cdev->blink_delay_on || !led_cdev->blink_delay_off) {
5555 led_set_brightness_nosleep(led_cdev, LED_OFF);
56+ led_cdev->flags &= ~LED_BLINK_SW;
5657 return;
5758 }
5859
5960 if (led_cdev->flags & LED_BLINK_ONESHOT_STOP) {
60− led_cdev->flags &= ~LED_BLINK_ONESHOT_STOP;
61+ led_cdev->flags &= ~(LED_BLINK_ONESHOT_STOP | LED_BLINK_SW);
6162 return;
6263 }
6364
@@ -151,6 +152,7 @@ static void led_set_software_blink(struct led_classdev *led_cdev, · 87 unmodified lines
151152 return;
152153 }
153154
155+ led_cdev->flags |= LED_BLINK_SW;
154156 mod_timer(&led_cdev->blink_timer, jiffies + 1);
155157 }
156158
@@ -219,6 +221,7 @@ void led_stop_software_blink(struct led_classdev *led_cdev) · 62 unmodified lines
219221 del_timer_sync(&led_cdev->blink_timer);
220222 led_cdev->blink_delay_on = 0;
221223 led_cdev->blink_delay_off = 0;
224+ led_cdev->flags &= ~LED_BLINK_SW;
222225 }
223226 EXPORT_SYMBOL_GPL(led_stop_software_blink);
224227
@@ -226,10 +229,10 @@ void led_set_brightness(struct led_classdev *led_cdev, · 1 unmodified line
226229 enum led_brightness brightness)
227230 {
228231 /*
229− * In case blinking is on delay brightness setting
232+ * If software blink is active, delay brightness setting
230233 * until the next timer tick.
231234 */
232− if (led_cdev->blink_delay_on || led_cdev->blink_delay_off) {
235+ if (led_cdev->flags & LED_BLINK_SW) {
233236 /*
234237 * If we need to disable soft blinking delegate this to the
235238 * work queue task to avoid problems in case we are called
drivers/leds/trigger/ledtrig-heartbeat.c+31−0
@@ -19,6 +19,7 @@ · 18 unmodified lines
1919 #include <linux/sched.h>
2020 #include <linux/leds.h>
2121 #include <linux/reboot.h>
22+#include <linux/suspend.h>
2223 #include "../leds.h"
2324
2425 static int panic_heartbeats;
@@ -154,6 +155,30 @@ static struct led_trigger heartbeat_led_trigger = { · 129 unmodified lines
154155 .deactivate = heartbeat_trig_deactivate,
155156 };
156157
158+static int heartbeat_pm_notifier(struct notifier_block *nb,
159+ unsigned long pm_event, void *unused)
160+{
161+ int rc;
162+
163+ switch (pm_event) {
164+ case PM_SUSPEND_PREPARE:
165+ case PM_HIBERNATION_PREPARE:
166+ case PM_RESTORE_PREPARE:
167+ led_trigger_unregister(&heartbeat_led_trigger);
168+ break;
169+ case PM_POST_SUSPEND:
170+ case PM_POST_HIBERNATION:
171+ case PM_POST_RESTORE:
172+ rc = led_trigger_register(&heartbeat_led_trigger);
173+ if (rc)
174+ pr_err("could not re-register heartbeat trigger\n");
175+ break;
176+ default:
177+ break;
178+ }
179+ return NOTIFY_DONE;
180+}
181+
157182 static int heartbeat_reboot_notifier(struct notifier_block *nb,
158183 unsigned long code, void *unused)
159184 {
@@ -168,6 +193,10 @@ static int heartbeat_panic_notifier(struct notifier_block *nb, · 8 unmodified lines
168193 return NOTIFY_DONE;
169194 }
170195
196+static struct notifier_block heartbeat_pm_nb = {
197+ .notifier_call = heartbeat_pm_notifier,
198+};
199+
171200 static struct notifier_block heartbeat_reboot_nb = {
172201 .notifier_call = heartbeat_reboot_notifier,
173202 };
@@ -184,12 +213,14 @@ static int __init heartbeat_trig_init(void) · 10 unmodified lines
184213 atomic_notifier_chain_register(&panic_notifier_list,
185214 &heartbeat_panic_nb);
186215 register_reboot_notifier(&heartbeat_reboot_nb);
216+ register_pm_notifier(&heartbeat_pm_nb);
187217 }
188218 return rc;
189219 }
190220
191221 static void __exit heartbeat_trig_exit(void)
192222 {
223+ unregister_pm_notifier(&heartbeat_pm_nb);
193224 unregister_reboot_notifier(&heartbeat_reboot_nb);
194225 atomic_notifier_chain_unregister(&panic_notifier_list,
195226 &heartbeat_panic_nb);
drivers/mcb/mcb-core.c+16−1
@@ -61,21 +61,36 @@ static int mcb_probe(struct device *dev) · 60 unmodified lines
6161 struct mcb_driver *mdrv = to_mcb_driver(dev->driver);
6262 struct mcb_device *mdev = to_mcb_device(dev);
6363 const struct mcb_device_id *found_id;
64+ struct module *carrier_mod;
65+ int ret;
6466
6567 found_id = mcb_match_id(mdrv->id_table, mdev);
6668 if (!found_id)
6769 return -ENODEV;
6870
69− return mdrv->probe(mdev, found_id);
71+ carrier_mod = mdev->dev.parent->driver->owner;
72+ if (!try_module_get(carrier_mod))
73+ return -EINVAL;
74+
75+ get_device(dev);
76+ ret = mdrv->probe(mdev, found_id);
77+ if (ret)
78+ module_put(carrier_mod);
79+
80+ return ret;
7081 }
7182
7283 static int mcb_remove(struct device *dev)
7384 {
7485 struct mcb_driver *mdrv = to_mcb_driver(dev->driver);
7586 struct mcb_device *mdev = to_mcb_device(dev);
87+ struct module *carrier_mod;
7688
7789 mdrv->remove(mdev);
7890
91+ carrier_mod = mdev->dev.parent->driver->owner;
92+ module_put(carrier_mod);
93+
7994 put_device(&mdev->dev);
8095
8196 return 0;
drivers/media/usb/uvc/uvc_v4l2.c+20−77
@@ -1274,8 +1274,6 @@ struct uvc_xu_control_mapping32 { · 1273 unmodified lines
12741274 static int uvc_v4l2_get_xu_mapping(struct uvc_xu_control_mapping *kp,
12751275 const struct uvc_xu_control_mapping32 __user *up)
12761276 {
1277− struct uvc_menu_info __user *umenus;
1278− struct uvc_menu_info __user *kmenus;
12791277 compat_caddr_t p;
12801278
12811279 if (!access_ok(VERIFY_READ, up, sizeof(*up)) ||
@@ -1292,17 +1290,7 @@ static int uvc_v4l2_get_xu_mapping(struct uvc_xu_control_mapping *kp, · 10 unmodified lines
12921290
12931291 if (__get_user(p, &up->menu_info))
12941292 return -EFAULT;
1295− umenus = compat_ptr(p);
1296− if (!access_ok(VERIFY_READ, umenus, kp->menu_count * sizeof(*umenus)))
1297− return -EFAULT;
1298−
1299− kmenus = compat_alloc_user_space(kp->menu_count * sizeof(*kmenus));
1300− if (kmenus == NULL)
1301− return -EFAULT;
1302− kp->menu_info = kmenus;
1303−
1304− if (copy_in_user(kmenus, umenus, kp->menu_count * sizeof(*umenus)))
1305− return -EFAULT;
1293+ kp->menu_info = compat_ptr(p);
13061294
13071295 return 0;
13081296 }
@@ -1310,10 +1298,6 @@ static int uvc_v4l2_get_xu_mapping(struct uvc_xu_control_mapping *kp, · 1 unmodified line
13101298 static int uvc_v4l2_put_xu_mapping(const struct uvc_xu_control_mapping *kp,
13111299 struct uvc_xu_control_mapping32 __user *up)
13121300 {
1313− struct uvc_menu_info __user *umenus;
1314− struct uvc_menu_info __user *kmenus = kp->menu_info;
1315− compat_caddr_t p;
1316−
13171301 if (!access_ok(VERIFY_WRITE, up, sizeof(*up)) ||
13181302 __copy_to_user(up, kp, offsetof(typeof(*up), menu_info)) ||
13191303 __put_user(kp->menu_count, &up->menu_count))
@@ -1322,16 +1306,6 @@ static int uvc_v4l2_put_xu_mapping(const struct uvc_xu_control_mapping *kp, · 2 unmodified lines
13221306 if (__clear_user(up->reserved, sizeof(up->reserved)))
13231307 return -EFAULT;
13241308
1325− if (kp->menu_count == 0)
1326− return 0;
1327−
1328− if (get_user(p, &up->menu_info))
1329− return -EFAULT;
1330− umenus = compat_ptr(p);
1331−
1332− if (copy_in_user(umenus, kmenus, kp->menu_count * sizeof(*umenus)))
1333− return -EFAULT;
1334−
13351309 return 0;
13361310 }
13371311
@@ -1346,8 +1320,6 @@ struct uvc_xu_control_query32 { · 8 unmodified lines
13461320 static int uvc_v4l2_get_xu_query(struct uvc_xu_control_query *kp,
13471321 const struct uvc_xu_control_query32 __user *up)
13481322 {
1349− u8 __user *udata;
1350− u8 __user *kdata;
13511323 compat_caddr_t p;
13521324
13531325 if (!access_ok(VERIFY_READ, up, sizeof(*up)) ||
@@ -1361,17 +1333,7 @@ static int uvc_v4l2_get_xu_query(struct uvc_xu_control_query *kp, · 7 unmodified lines
13611333
13621334 if (__get_user(p, &up->data))
13631335 return -EFAULT;
1364− udata = compat_ptr(p);
1365− if (!access_ok(VERIFY_READ, udata, kp->size))
1366− return -EFAULT;
1367−
1368− kdata = compat_alloc_user_space(kp->size);
1369− if (kdata == NULL)
1370− return -EFAULT;
1371− kp->data = kdata;
1372−
1373− if (copy_in_user(kdata, udata, kp->size))
1374− return -EFAULT;
1336+ kp->data = compat_ptr(p);
13751337
13761338 return 0;
13771339 }
@@ -1379,26 +1341,10 @@ static int uvc_v4l2_get_xu_query(struct uvc_xu_control_query *kp, · 1 unmodified line
13791341 static int uvc_v4l2_put_xu_query(const struct uvc_xu_control_query *kp,
13801342 struct uvc_xu_control_query32 __user *up)
13811343 {
1382− u8 __user *udata;
1383− u8 __user *kdata = kp->data;
1384− compat_caddr_t p;
1385−
13861344 if (!access_ok(VERIFY_WRITE, up, sizeof(*up)) ||
13871345 __copy_to_user(up, kp, offsetof(typeof(*up), data)))
13881346 return -EFAULT;
13891347
1390− if (kp->size == 0)
1391− return 0;
1392−
1393− if (get_user(p, &up->data))
1394− return -EFAULT;
1395− udata = compat_ptr(p);
1396− if (!access_ok(VERIFY_READ, udata, kp->size))
1397− return -EFAULT;
1398−
1399− if (copy_in_user(udata, kdata, kp->size))
1400− return -EFAULT;
1401−
14021348 return 0;
14031349 }
14041350
@@ -1408,47 +1354,44 @@ static int uvc_v4l2_put_xu_query(const struct uvc_xu_control_query *kp, · 3 unmodified lines
14081354 static long uvc_v4l2_compat_ioctl32(struct file *file,
14091355 unsigned int cmd, unsigned long arg)
14101356 {
1357+ struct uvc_fh *handle = file->private_data;
14111358 union {
14121359 struct uvc_xu_control_mapping xmap;
14131360 struct uvc_xu_control_query xqry;
14141361 } karg;
14151362 void __user *up = compat_ptr(arg);
1416− mm_segment_t old_fs;
14171363 long ret;
14181364
14191365 switch (cmd) {
14201366 case UVCIOC_CTRL_MAP32:
1421− cmd = UVCIOC_CTRL_MAP;
14221367 ret = uvc_v4l2_get_xu_mapping(&karg.xmap, up);
1368+ if (ret)
1369+ return ret;
1370+ ret = uvc_ioctl_ctrl_map(handle->chain, &karg.xmap);
1371+ if (ret)
1372+ return ret;
1373+ ret = uvc_v4l2_put_xu_mapping(&karg.xmap, up);
1374+ if (ret)
1375+ return ret;
1376+
14231377 break;
14241378
14251379 case UVCIOC_CTRL_QUERY32:
1426− cmd = UVCIOC_CTRL_QUERY;
14271380 ret = uvc_v4l2_get_xu_query(&karg.xqry, up);
1381+ if (ret)
1382+ return ret;
1383+ ret = uvc_xu_ctrl_query(handle->chain, &karg.xqry);
1384+ if (ret)
1385+ return ret;
1386+ ret = uvc_v4l2_put_xu_query(&karg.xqry, up);
1387+ if (ret)
1388+ return ret;
14281389 break;
14291390
14301391 default:
14311392 return -ENOIOCTLCMD;
14321393 }
14331394
1434− old_fs = get_fs();
1435− set_fs(KERNEL_DS);
1436− ret = video_ioctl2(file, cmd, (unsigned long)&karg);
1437− set_fs(old_fs);
1438−
1439− if (ret < 0)
1440− return ret;
1441−
1442− switch (cmd) {
1443− case UVCIOC_CTRL_MAP:
1444− ret = uvc_v4l2_put_xu_mapping(&karg.xmap, up);
1445− break;
1446−
1447− case UVCIOC_CTRL_QUERY:
1448− ret = uvc_v4l2_put_xu_query(&karg.xqry, up);
1449− break;
1450− }
1451−
14521395 return ret;
14531396 }
14541397 #endif
drivers/media/v4l2-core/v4l2-mc.c+1−1
@@ -1,7 +1,7 @@
11 /*
22 * Media Controller ancillary functions
33 *
4− * Copyright (c) 2016 Mauro Carvalho Chehab <mchehab@osg.samsung.com>
4+ * Copyright (c) 2016 Mauro Carvalho Chehab <mchehab@kernel.org>
55 * Copyright (C) 2016 Shuah Khan <shuahkh@osg.samsung.com>
66 * Copyright (C) 2006-2010 Nokia Corporation
77 * Copyright (c) 2016 Intel Corporation.
drivers/memory/omap-gpmc.c+1−1
@@ -398,7 +398,7 @@ static void gpmc_cs_bool_timings(int cs, const struct gpmc_bool_timings *p) · 397 unmodified lines
398398 gpmc_cs_modify_reg(cs, GPMC_CS_CONFIG4,
399399 GPMC_CONFIG4_OEEXTRADELAY, p->oe_extra_delay);
400400 gpmc_cs_modify_reg(cs, GPMC_CS_CONFIG4,
401− GPMC_CONFIG4_OEEXTRADELAY, p->we_extra_delay);
401+ GPMC_CONFIG4_WEEXTRADELAY, p->we_extra_delay);
402402 gpmc_cs_modify_reg(cs, GPMC_CS_CONFIG6,
403403 GPMC_CONFIG6_CYCLE2CYCLESAMECSEN,
404404 p->cycle2cyclesamecsen);
drivers/misc/mei/client.c+1−1
@@ -730,7 +730,7 @@ static void mei_cl_wake_all(struct mei_cl *cl) · 729 unmodified lines
730730 /* synchronized under device mutex */
731731 if (waitqueue_active(&cl->wait)) {
732732 cl_dbg(dev, cl, "Waking up ctrl write clients!\n");
733− wake_up_interruptible(&cl->wait);
733+ wake_up(&cl->wait);
734734 }
735735 }
736736
drivers/mtd/ubi/build.c+9−2
@@ -1147,11 +1147,17 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway) · 1146 unmodified lines
11471147 */
11481148 static struct mtd_info * __init open_mtd_by_chdev(const char *mtd_dev)
11491149 {
1150− struct kstat stat;
11511150 int err, minor;
1151+ struct path path;
1152+ struct kstat stat;
11521153
11531154 /* Probably this is an MTD character device node path */
1154− err = vfs_stat(mtd_dev, &stat);
1155+ err = kern_path(mtd_dev, LOOKUP_FOLLOW, &path);
1156+ if (err)
1157+ return ERR_PTR(err);
1158+
1159+ err = vfs_getattr(&path, &stat);
1160+ path_put(&path);
11551161 if (err)
11561162 return ERR_PTR(err);
11571163
@@ -1160,6 +1166,7 @@ static struct mtd_info * __init open_mtd_by_chdev(const char *mtd_dev) · 2 unmodified lines
11601166 return ERR_PTR(-EINVAL);
11611167
11621168 minor = MINOR(stat.rdev);
1169+
11631170 if (minor & 1)
11641171 /*
11651172 * Just do not think the "/dev/mtdrX" devices support is need,
drivers/mtd/ubi/kapi.c+7−1
@@ -302,6 +302,7 @@ EXPORT_SYMBOL_GPL(ubi_open_volume_nm); · 301 unmodified lines
302302 struct ubi_volume_desc *ubi_open_volume_path(const char *pathname, int mode)
303303 {
304304 int error, ubi_num, vol_id;
305+ struct path path;
305306 struct kstat stat;
306307
307308 dbg_gen("open volume %s, mode %d", pathname, mode);
@@ -309,7 +310,12 @@ struct ubi_volume_desc *ubi_open_volume_path(const char *pathname, int mode) · 1 unmodified line
309310 if (!pathname || !*pathname)
310311 return ERR_PTR(-EINVAL);
311312
312− error = vfs_stat(pathname, &stat);
313+ error = kern_path(pathname, LOOKUP_FOLLOW, &path);
314+ if (error)
315+ return ERR_PTR(error);
316+
317+ error = vfs_getattr(&path, &stat);
318+ path_put(&path);
313319 if (error)
314320 return ERR_PTR(error);
315321
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c+62−89
@@ -12895,52 +12895,71 @@ static int __bnx2x_vlan_configure_vid(struct bnx2x *bp, u16 vid, bool add) · 12894 unmodified lines
1289512895 return rc;
1289612896 }
1289712897
12898−int bnx2x_vlan_reconfigure_vid(struct bnx2x *bp)
12898+static int bnx2x_vlan_configure_vid_list(struct bnx2x *bp)
1289912899 {
1290012900 struct bnx2x_vlan_entry *vlan;
1290112901 int rc = 0;
1290212902
12903− if (!bp->vlan_cnt) {
12904− DP(NETIF_MSG_IFUP, "No need to re-configure vlan filters\n");
12905− return 0;
12906− }
12907−
12903+ /* Configure all non-configured entries */
1290812904 list_for_each_entry(vlan, &bp->vlan_reg, link) {
12909− /* Prepare for cleanup in case of errors */
12910− if (rc) {
12911− vlan->hw = false;
12912− continue;
12913− }
12914−
12915− if (!vlan->hw)
12905+ if (vlan->hw)
1291612906 continue;
1291712907
12918− DP(NETIF_MSG_IFUP, "Re-configuring vlan 0x%04x\n", vlan->vid);
12908+ if (bp->vlan_cnt >= bp->vlan_credit)
12909+ return -ENOBUFS;
1291912910
1292012911 rc = __bnx2x_vlan_configure_vid(bp, vlan->vid, true);
1292112912 if (rc) {
12922− BNX2X_ERR("Unable to configure VLAN %d\n", vlan->vid);
12923− vlan->hw = false;
12924− rc = -EINVAL;
12925− continue;
12913+ BNX2X_ERR("Unable to config VLAN %d\n", vlan->vid);
12914+ return rc;
1292612915 }
12916+
12917+ DP(NETIF_MSG_IFUP, "HW configured for VLAN %d\n", vlan->vid);
12918+ vlan->hw = true;
12919+ bp->vlan_cnt++;
1292712920 }
1292812921
12929− return rc;
12922+ return 0;
12923+}
12924+
12925+static void bnx2x_vlan_configure(struct bnx2x *bp, bool set_rx_mode)
12926+{
12927+ bool need_accept_any_vlan;
12928+
12929+ need_accept_any_vlan = !!bnx2x_vlan_configure_vid_list(bp);
12930+
12931+ if (bp->accept_any_vlan != need_accept_any_vlan) {
12932+ bp->accept_any_vlan = need_accept_any_vlan;
12933+ DP(NETIF_MSG_IFUP, "Accept all VLAN %s\n",
12934+ bp->accept_any_vlan ? "raised" : "cleared");
12935+ if (set_rx_mode) {
12936+ if (IS_PF(bp))
12937+ bnx2x_set_rx_mode_inner(bp);
12938+ else
12939+ bnx2x_vfpf_storm_rx_mode(bp);
12940+ }
12941+ }
12942+}
12943+
12944+int bnx2x_vlan_reconfigure_vid(struct bnx2x *bp)
12945+{
12946+ struct bnx2x_vlan_entry *vlan;
12947+
12948+ /* The hw forgot all entries after reload */
12949+ list_for_each_entry(vlan, &bp->vlan_reg, link)
12950+ vlan->hw = false;
12951+ bp->vlan_cnt = 0;
12952+
12953+ /* Don't set rx mode here. Our caller will do it. */
12954+ bnx2x_vlan_configure(bp, false);
12955+
12956+ return 0;
1293012957 }
1293112958
1293212959 static int bnx2x_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid)
1293312960 {
1293412961 struct bnx2x *bp = netdev_priv(dev);
1293512962 struct bnx2x_vlan_entry *vlan;
12936− bool hw = false;
12937− int rc = 0;
12938−
12939− if (!netif_running(bp->dev)) {
12940− DP(NETIF_MSG_IFUP,
12941− "Ignoring VLAN configuration the interface is down\n");
12942− return -EFAULT;
12943− }
1294412963
1294512964 DP(NETIF_MSG_IFUP, "Adding VLAN %d\n", vid);
1294612965
@@ -12948,93 +12967,47 @@ static int bnx2x_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid) · 1 unmodified line
1294812967 if (!vlan)
1294912968 return -ENOMEM;
1295012969
12951− bp->vlan_cnt++;
12952− if (bp->vlan_cnt > bp->vlan_credit && !bp->accept_any_vlan) {
12953− DP(NETIF_MSG_IFUP, "Accept all VLAN raised\n");
12954− bp->accept_any_vlan = true;
12955− if (IS_PF(bp))
12956− bnx2x_set_rx_mode_inner(bp);
12957− else
12958− bnx2x_vfpf_storm_rx_mode(bp);
12959− } else if (bp->vlan_cnt <= bp->vlan_credit) {
12960− rc = __bnx2x_vlan_configure_vid(bp, vid, true);
12961− hw = true;
12962− }
12963−
1296412970 vlan->vid = vid;
12965− vlan->hw = hw;
12971+ vlan->hw = false;
12972+ list_add_tail(&vlan->link, &bp->vlan_reg);
1296612973
12967− if (!rc) {
12968− list_add(&vlan->link, &bp->vlan_reg);
12969− } else {
12970− bp->vlan_cnt--;
12971− kfree(vlan);
12972− }
12973−
12974− DP(NETIF_MSG_IFUP, "Adding VLAN result %d\n", rc);
12974+ if (netif_running(dev))
12975+ bnx2x_vlan_configure(bp, true);
1297512976
12976− return rc;
12977+ return 0;
1297712978 }
1297812979
1297912980 static int bnx2x_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid)
1298012981 {
1298112982 struct bnx2x *bp = netdev_priv(dev);
1298212983 struct bnx2x_vlan_entry *vlan;
12984+ bool found = false;
1298312985 int rc = 0;
1298412986
12985− if (!netif_running(bp->dev)) {
12986− DP(NETIF_MSG_IFUP,
12987− "Ignoring VLAN configuration the interface is down\n");
12988− return -EFAULT;
12989− }
12990−
1299112987 DP(NETIF_MSG_IFUP, "Removing VLAN %d\n", vid);
1299212988
12993− if (!bp->vlan_cnt) {
12994− BNX2X_ERR("Unable to kill VLAN %d\n", vid);
12995− return -EINVAL;
12996− }
12997−
1299812989 list_for_each_entry(vlan, &bp->vlan_reg, link)
12999− if (vlan->vid == vid)
12990+ if (vlan->vid == vid) {
12991+ found = true;
1300012992 break;
12993+ }
1300112994
13002− if (vlan->vid != vid) {
12995+ if (!found) {
1300312996 BNX2X_ERR("Unable to kill VLAN %d - not found\n", vid);
1300412997 return -EINVAL;
1300512998 }
1300612999
13007− if (vlan->hw)
13000+ if (netif_running(dev) && vlan->hw) {
1300813001 rc = __bnx2x_vlan_configure_vid(bp, vid, false);
13002+ DP(NETIF_MSG_IFUP, "HW deconfigured for VLAN %d\n", vid);
13003+ bp->vlan_cnt--;
13004+ }
1300913005
1301013006 list_del(&vlan->link);
1301113007 kfree(vlan);
1301213008
13013− bp->vlan_cnt--;
13014−
13015− if (bp->vlan_cnt <= bp->vlan_credit && bp->accept_any_vlan) {
13016− /* Configure all non-configured entries */
13017− list_for_each_entry(vlan, &bp->vlan_reg, link) {
13018− if (vlan->hw)
13019− continue;
13020−
13021− rc = __bnx2x_vlan_configure_vid(bp, vlan->vid, true);
13022− if (rc) {
13023− BNX2X_ERR("Unable to config VLAN %d\n",
13024− vlan->vid);
13025− continue;
13026− }
13027− DP(NETIF_MSG_IFUP, "HW configured for VLAN %d\n",
13028− vlan->vid);
13029− vlan->hw = true;
13030− }
13031− DP(NETIF_MSG_IFUP, "Accept all VLAN Removed\n");
13032− bp->accept_any_vlan = false;
13033− if (IS_PF(bp))
13034− bnx2x_set_rx_mode_inner(bp);
13035− else
13036− bnx2x_vfpf_storm_rx_mode(bp);
13037− }
13009+ if (netif_running(dev))
13010+ bnx2x_vlan_configure(bp, true);
1303813011
1303913012 DP(NETIF_MSG_IFUP, "Removing VLAN result %d\n", rc);
1304013013
drivers/net/ethernet/broadcom/bnxt/bnxt.c+25−21
@@ -286,7 +286,9 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) · 285 unmodified lines
286286 cpu_to_le32(DB_KEY_TX_PUSH | DB_LONG_TX_PUSH | prod);
287287 txr->tx_prod = prod;
288288
289+ tx_buf->is_push = 1;
289290 netdev_tx_sent_queue(txq, skb->len);
291+ wmb(); /* Sync is_push and byte queue before pushing data */
290292
291293 push_len = (length + sizeof(*tx_push) + 7) / 8;
292294 if (push_len > 16) {
@@ -298,7 +300,6 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) · 5 unmodified lines
298300 push_len);
299301 }
300302
301− tx_buf->is_push = 1;
302303 goto tx_done;
303304 }
304305
@@ -1112,19 +1113,13 @@ static inline struct sk_buff *bnxt_tpa_end(struct bnxt *bp, · 807 unmodified lines
11121113 if (tpa_info->hash_type != PKT_HASH_TYPE_NONE)
11131114 skb_set_hash(skb, tpa_info->rss_hash, tpa_info->hash_type);
11141115
1115− if (tpa_info->flags2 & RX_CMP_FLAGS2_META_FORMAT_VLAN) {
1116− netdev_features_t features = skb->dev->features;
1116+ if ((tpa_info->flags2 & RX_CMP_FLAGS2_META_FORMAT_VLAN) &&
1117+ (skb->dev->features & NETIF_F_HW_VLAN_CTAG_RX)) {
11171118 u16 vlan_proto = tpa_info->metadata >>
11181119 RX_CMP_FLAGS2_METADATA_TPID_SFT;
1120+ u16 vtag = tpa_info->metadata & RX_CMP_FLAGS2_METADATA_VID_MASK;
11191121
1120− if (((features & NETIF_F_HW_VLAN_CTAG_RX) &&
1121− vlan_proto == ETH_P_8021Q) ||
1122− ((features & NETIF_F_HW_VLAN_STAG_RX) &&
1123− vlan_proto == ETH_P_8021AD)) {
1124− __vlan_hwaccel_put_tag(skb, htons(vlan_proto),
1125− tpa_info->metadata &
1126− RX_CMP_FLAGS2_METADATA_VID_MASK);
1127− }
1122+ __vlan_hwaccel_put_tag(skb, htons(vlan_proto), vtag);
11281123 }
11291124
11301125 skb_checksum_none_assert(skb);
@@ -1277,19 +1272,14 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_napi *bnapi, u32 *raw_cons, · 146 unmodified lines
12771272
12781273 skb->protocol = eth_type_trans(skb, dev);
12791274
1280− if (rxcmp1->rx_cmp_flags2 &
1281− cpu_to_le32(RX_CMP_FLAGS2_META_FORMAT_VLAN)) {
1282− netdev_features_t features = skb->dev->features;
1275+ if ((rxcmp1->rx_cmp_flags2 &
1276+ cpu_to_le32(RX_CMP_FLAGS2_META_FORMAT_VLAN)) &&
1277+ (skb->dev->features & NETIF_F_HW_VLAN_CTAG_RX)) {
12831278 u32 meta_data = le32_to_cpu(rxcmp1->rx_cmp_meta_data);
1279+ u16 vtag = meta_data & RX_CMP_FLAGS2_METADATA_VID_MASK;
12841280 u16 vlan_proto = meta_data >> RX_CMP_FLAGS2_METADATA_TPID_SFT;
12851281
1286− if (((features & NETIF_F_HW_VLAN_CTAG_RX) &&
1287− vlan_proto == ETH_P_8021Q) ||
1288− ((features & NETIF_F_HW_VLAN_STAG_RX) &&
1289− vlan_proto == ETH_P_8021AD))
1290− __vlan_hwaccel_put_tag(skb, htons(vlan_proto),
1291− meta_data &
1292− RX_CMP_FLAGS2_METADATA_VID_MASK);
1282+ __vlan_hwaccel_put_tag(skb, htons(vlan_proto), vtag);
12931283 }
12941284
12951285 skb_checksum_none_assert(skb);
@@ -5466,6 +5456,20 @@ static netdev_features_t bnxt_fix_features(struct net_device *dev, · 4170 unmodified lines
54665456
54675457 if (!bnxt_rfs_capable(bp))
54685458 features &= ~NETIF_F_NTUPLE;
5459+
5460+ /* Both CTAG and STAG VLAN accelaration on the RX side have to be
5461+ * turned on or off together.
5462+ */
5463+ if ((features & (NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX)) !=
5464+ (NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX)) {
5465+ if (dev->features & NETIF_F_HW_VLAN_CTAG_RX)
5466+ features &= ~(NETIF_F_HW_VLAN_CTAG_RX |
5467+ NETIF_F_HW_VLAN_STAG_RX);
5468+ else
5469+ features |= NETIF_F_HW_VLAN_CTAG_RX |
5470+ NETIF_F_HW_VLAN_STAG_RX;
5471+ }
5472+
54695473 return features;
54705474 }
54715475
drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h+1−0
@@ -144,6 +144,7 @@ CH_PCI_DEVICE_ID_TABLE_DEFINE_BEGIN · 143 unmodified lines
144144 CH_PCI_ID_TABLE_FENTRY(0x5015), /* T502-bt */
145145 CH_PCI_ID_TABLE_FENTRY(0x5016), /* T580-OCP-SO */
146146 CH_PCI_ID_TABLE_FENTRY(0x5017), /* T520-OCP-SO */
147+ CH_PCI_ID_TABLE_FENTRY(0x5018), /* T540-BT */
147148 CH_PCI_ID_TABLE_FENTRY(0x5080), /* Custom T540-cr */
148149 CH_PCI_ID_TABLE_FENTRY(0x5081), /* Custom T540-LL-cr */
149150 CH_PCI_ID_TABLE_FENTRY(0x5082), /* Custom T504-cr */
drivers/net/ethernet/ethoc.c+4−3
@@ -1195,7 +1195,7 @@ static int ethoc_probe(struct platform_device *pdev) · 1194 unmodified lines
11951195 priv->mdio = mdiobus_alloc();
11961196 if (!priv->mdio) {
11971197 ret = -ENOMEM;
1198− goto free;
1198+ goto free2;
11991199 }
12001200
12011201 priv->mdio->name = "ethoc-mdio";
@@ -1208,7 +1208,7 @@ static int ethoc_probe(struct platform_device *pdev) · 6 unmodified lines
12081208 ret = mdiobus_register(priv->mdio);
12091209 if (ret) {
12101210 dev_err(&netdev->dev, "failed to register MDIO bus\n");
1211− goto free;
1211+ goto free2;
12121212 }
12131213
12141214 ret = ethoc_mdio_probe(netdev);
@@ -1241,9 +1241,10 @@ error2: · 26 unmodified lines
12411241 error:
12421242 mdiobus_unregister(priv->mdio);
12431243 mdiobus_free(priv->mdio);
1244−free:
1244+free2:
12451245 if (priv->clk)
12461246 clk_disable_unprepare(priv->clk);
1247+free:
12471248 free_netdev(netdev);
12481249 out:
12491250 return ret;
drivers/net/ethernet/freescale/fec_main.c+4−4
@@ -2416,24 +2416,24 @@ fec_enet_set_coalesce(struct net_device *ndev, struct ethtool_coalesce *ec) · 2415 unmodified lines
24162416 return -EOPNOTSUPP;
24172417
24182418 if (ec->rx_max_coalesced_frames > 255) {
2419− pr_err("Rx coalesced frames exceed hardware limiation");
2419+ pr_err("Rx coalesced frames exceed hardware limitation\n");
24202420 return -EINVAL;
24212421 }
24222422
24232423 if (ec->tx_max_coalesced_frames > 255) {
2424− pr_err("Tx coalesced frame exceed hardware limiation");
2424+ pr_err("Tx coalesced frame exceed hardware limitation\n");
24252425 return -EINVAL;
24262426 }
24272427
24282428 cycle = fec_enet_us_to_itr_clock(ndev, fep->rx_time_itr);
24292429 if (cycle > 0xFFFF) {
2430− pr_err("Rx coalesed usec exceeed hardware limiation");
2430+ pr_err("Rx coalesced usec exceed hardware limitation\n");
24312431 return -EINVAL;
24322432 }
24332433
24342434 cycle = fec_enet_us_to_itr_clock(ndev, fep->tx_time_itr);
24352435 if (cycle > 0xFFFF) {
2436− pr_err("Rx coalesed usec exceeed hardware limiation");
2436+ pr_err("Rx coalesced usec exceed hardware limitation\n");
24372437 return -EINVAL;
24382438 }
24392439
drivers/net/ethernet/freescale/gianfar.c+2−1
@@ -2440,7 +2440,8 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev) · 2439 unmodified lines
24402440 tx_queue->tx_ring_size);
24412441
24422442 if (likely(!nr_frags)) {
2443− lstatus |= BD_LFLAG(TXBD_LAST | TXBD_INTERRUPT);
2443+ if (likely(!do_tstamp))
2444+ lstatus |= BD_LFLAG(TXBD_LAST | TXBD_INTERRUPT);
24442445 } else {
24452446 u32 lstatus_start = lstatus;
24462447
drivers/net/ethernet/mediatek/mtk_eth_soc.c+34−6
@@ -133,6 +133,8 @@ static int mtk_mdio_read(struct mii_bus *bus, int phy_addr, int phy_reg) · 132 unmodified lines
133133 static void mtk_phy_link_adjust(struct net_device *dev)
134134 {
135135 struct mtk_mac *mac = netdev_priv(dev);
136+ u16 lcl_adv = 0, rmt_adv = 0;
137+ u8 flowctrl;
136138 u32 mcr = MAC_MCR_MAX_RX_1536 | MAC_MCR_IPG_CFG |
137139 MAC_MCR_FORCE_MODE | MAC_MCR_TX_EN |
138140 MAC_MCR_RX_EN | MAC_MCR_BACKOFF_EN |
@@ -150,11 +152,30 @@ static void mtk_phy_link_adjust(struct net_device *dev) · 11 unmodified lines
150152 if (mac->phy_dev->link)
151153 mcr |= MAC_MCR_FORCE_LINK;
152154
153− if (mac->phy_dev->duplex)
155+ if (mac->phy_dev->duplex) {
154156 mcr |= MAC_MCR_FORCE_DPX;
155157
156− if (mac->phy_dev->pause)
157− mcr |= MAC_MCR_FORCE_RX_FC | MAC_MCR_FORCE_TX_FC;
158+ if (mac->phy_dev->pause)
159+ rmt_adv = LPA_PAUSE_CAP;
160+ if (mac->phy_dev->asym_pause)
161+ rmt_adv |= LPA_PAUSE_ASYM;
162+
163+ if (mac->phy_dev->advertising & ADVERTISED_Pause)
164+ lcl_adv |= ADVERTISE_PAUSE_CAP;
165+ if (mac->phy_dev->advertising & ADVERTISED_Asym_Pause)
166+ lcl_adv |= ADVERTISE_PAUSE_ASYM;
167+
168+ flowctrl = mii_resolve_flowctrl_fdx(lcl_adv, rmt_adv);
169+
170+ if (flowctrl & FLOW_CTRL_TX)
171+ mcr |= MAC_MCR_FORCE_TX_FC;
172+ if (flowctrl & FLOW_CTRL_RX)
173+ mcr |= MAC_MCR_FORCE_RX_FC;
174+
175+ netif_dbg(mac->hw, link, dev, "rx pause %s, tx pause %s\n",
176+ flowctrl & FLOW_CTRL_RX ? "enabled" : "disabled",
177+ flowctrl & FLOW_CTRL_TX ? "enabled" : "disabled");
178+ }
158179
159180 mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id));
160181
@@ -208,10 +229,16 @@ static int mtk_phy_connect(struct mtk_mac *mac) · 47 unmodified lines
208229 u32 val, ge_mode;
209230
210231 np = of_parse_phandle(mac->of_node, "phy-handle", 0);
232+ if (!np && of_phy_is_fixed_link(mac->of_node))
233+ if (!of_phy_register_fixed_link(mac->of_node))
234+ np = of_node_get(mac->of_node);
211235 if (!np)
212236 return -ENODEV;
213237
214238 switch (of_get_phy_mode(np)) {
239+ case PHY_INTERFACE_MODE_RGMII_TXID:
240+ case PHY_INTERFACE_MODE_RGMII_RXID:
241+ case PHY_INTERFACE_MODE_RGMII_ID:
215242 case PHY_INTERFACE_MODE_RGMII:
216243 ge_mode = 0;
217244 break;
@@ -236,7 +263,8 @@ static int mtk_phy_connect(struct mtk_mac *mac) · 18 unmodified lines
236263 mac->phy_dev->autoneg = AUTONEG_ENABLE;
237264 mac->phy_dev->speed = 0;
238265 mac->phy_dev->duplex = 0;
239− mac->phy_dev->supported &= PHY_BASIC_FEATURES;
266+ mac->phy_dev->supported &= PHY_GBIT_FEATURES | SUPPORTED_Pause |
267+ SUPPORTED_Asym_Pause;
240268 mac->phy_dev->advertising = mac->phy_dev->supported |
241269 ADVERTISED_Autoneg;
242270 phy_start_aneg(mac->phy_dev);
@@ -280,7 +308,7 @@ static int mtk_mdio_init(struct mtk_eth *eth) · 37 unmodified lines
280308 return 0;
281309
282310 err_free_bus:
283− kfree(eth->mii_bus);
311+ mdiobus_free(eth->mii_bus);
284312
285313 err_put_node:
286314 of_node_put(mii_np);
@@ -295,7 +323,7 @@ static void mtk_mdio_cleanup(struct mtk_eth *eth) · 8 unmodified lines
295323
296324 mdiobus_unregister(eth->mii_bus);
297325 of_node_put(eth->mii_bus->dev.of_node);
298− kfree(eth->mii_bus);
326+ mdiobus_free(eth->mii_bus);
299327 }
300328
301329 static inline void mtk_irq_disable(struct mtk_eth *eth, u32 mask)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c+1−4
@@ -3192,10 +3192,7 @@ static void mlx5e_destroy_netdev(struct mlx5_core_dev *mdev, void *vpriv) · 3191 unmodified lines
31923192 flush_workqueue(priv->wq);
31933193 if (test_bit(MLX5_INTERFACE_STATE_SHUTDOWN, &mdev->intf_state)) {
31943194 netif_device_detach(netdev);
3195− mutex_lock(&priv->state_lock);
3196− if (test_bit(MLX5E_STATE_OPENED, &priv->state))
3197− mlx5e_close_locked(netdev);
3198− mutex_unlock(&priv->state_lock);
3195+ mlx5e_close(netdev);
31993196 } else {
32003197 unregister_netdev(netdev);
32013198 }
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c+2−1
@@ -317,7 +317,8 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb) · 316 unmodified lines
317317 while ((sq->pc & wq->sz_m1) > sq->edge)
318318 mlx5e_send_nop(sq, false);
319319
320− sq->bf_budget = bf ? sq->bf_budget - 1 : 0;
320+ if (bf)
321+ sq->bf_budget--;
321322
322323 sq->stats.packets++;
323324 sq->stats.bytes += num_bytes;
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c+43−26
@@ -383,7 +383,7 @@ __esw_fdb_set_vport_rule(struct mlx5_eswitch *esw, u32 vport, bool rx_rule, · 382 unmodified lines
383383 match_v,
384384 MLX5_FLOW_CONTEXT_ACTION_FWD_DEST,
385385 0, &dest);
386− if (IS_ERR_OR_NULL(flow_rule)) {
386+ if (IS_ERR(flow_rule)) {
387387 pr_warn(
388388 "FDB: Failed to add flow rule: dmac_v(%pM) dmac_c(%pM) -> vport(%d), err(%ld)\n",
389389 dmac_v, dmac_c, vport, PTR_ERR(flow_rule));
@@ -457,7 +457,7 @@ static int esw_create_fdb_table(struct mlx5_eswitch *esw, int nvports) · 67 unmodified lines
457457
458458 table_size = BIT(MLX5_CAP_ESW_FLOWTABLE_FDB(dev, log_max_ft_size));
459459 fdb = mlx5_create_flow_table(root_ns, 0, table_size, 0);
460− if (IS_ERR_OR_NULL(fdb)) {
460+ if (IS_ERR(fdb)) {
461461 err = PTR_ERR(fdb);
462462 esw_warn(dev, "Failed to create FDB Table err %d\n", err);
463463 goto out;
@@ -474,7 +474,7 @@ static int esw_create_fdb_table(struct mlx5_eswitch *esw, int nvports) · 10 unmodified lines
474474 MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, table_size - 3);
475475 eth_broadcast_addr(dmac);
476476 g = mlx5_create_flow_group(fdb, flow_group_in);
477− if (IS_ERR_OR_NULL(g)) {
477+ if (IS_ERR(g)) {
478478 err = PTR_ERR(g);
479479 esw_warn(dev, "Failed to create flow group err(%d)\n", err);
480480 goto out;
@@ -489,7 +489,7 @@ static int esw_create_fdb_table(struct mlx5_eswitch *esw, int nvports) · 8 unmodified lines
489489 eth_zero_addr(dmac);
490490 dmac[0] = 0x01;
491491 g = mlx5_create_flow_group(fdb, flow_group_in);
492− if (IS_ERR_OR_NULL(g)) {
492+ if (IS_ERR(g)) {
493493 err = PTR_ERR(g);
494494 esw_warn(dev, "Failed to create allmulti flow group err(%d)\n", err);
495495 goto out;
@@ -506,7 +506,7 @@ static int esw_create_fdb_table(struct mlx5_eswitch *esw, int nvports) · 10 unmodified lines
506506 MLX5_SET(create_flow_group_in, flow_group_in, start_flow_index, table_size - 1);
507507 MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, table_size - 1);
508508 g = mlx5_create_flow_group(fdb, flow_group_in);
509− if (IS_ERR_OR_NULL(g)) {
509+ if (IS_ERR(g)) {
510510 err = PTR_ERR(g);
511511 esw_warn(dev, "Failed to create promisc flow group err(%d)\n", err);
512512 goto out;
@@ -529,7 +529,7 @@ out: · 16 unmodified lines
529529 }
530530 }
531531
532− kfree(flow_group_in);
532+ kvfree(flow_group_in);
533533 return err;
534534 }
535535
@@ -651,6 +651,7 @@ static void update_allmulti_vports(struct mlx5_eswitch *esw, · 115 unmodified lines
651651 esw_fdb_set_vport_rule(esw,
652652 mac,
653653 vport_idx);
654+ iter_vaddr->mc_promisc = true;
654655 break;
655656 case MLX5_ACTION_DEL:
656657 if (!iter_vaddr)
@@ -1060,7 +1061,7 @@ static void esw_vport_enable_egress_acl(struct mlx5_eswitch *esw, · 403 unmodified lines
10601061 return;
10611062
10621063 acl = mlx5_create_vport_flow_table(root_ns, 0, table_size, 0, vport->vport);
1063− if (IS_ERR_OR_NULL(acl)) {
1064+ if (IS_ERR(acl)) {
10641065 err = PTR_ERR(acl);
10651066 esw_warn(dev, "Failed to create E-Switch vport[%d] egress flow Table, err(%d)\n",
10661067 vport->vport, err);
@@ -1075,7 +1076,7 @@ static void esw_vport_enable_egress_acl(struct mlx5_eswitch *esw, · 8 unmodified lines
10751076 MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, 0);
10761077
10771078 vlan_grp = mlx5_create_flow_group(acl, flow_group_in);
1078− if (IS_ERR_OR_NULL(vlan_grp)) {
1079+ if (IS_ERR(vlan_grp)) {
10791080 err = PTR_ERR(vlan_grp);
10801081 esw_warn(dev, "Failed to create E-Switch vport[%d] egress allowed vlans flow group, err(%d)\n",
10811082 vport->vport, err);
@@ -1086,7 +1087,7 @@ static void esw_vport_enable_egress_acl(struct mlx5_eswitch *esw, · 4 unmodified lines
10861087 MLX5_SET(create_flow_group_in, flow_group_in, start_flow_index, 1);
10871088 MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, 1);
10881089 drop_grp = mlx5_create_flow_group(acl, flow_group_in);
1089− if (IS_ERR_OR_NULL(drop_grp)) {
1090+ if (IS_ERR(drop_grp)) {
10901091 err = PTR_ERR(drop_grp);
10911092 esw_warn(dev, "Failed to create E-Switch vport[%d] egress drop flow group, err(%d)\n",
10921093 vport->vport, err);
@@ -1097,7 +1098,7 @@ static void esw_vport_enable_egress_acl(struct mlx5_eswitch *esw, · 4 unmodified lines
10971098 vport->egress.drop_grp = drop_grp;
10981099 vport->egress.allowed_vlans_grp = vlan_grp;
10991100 out:
1100− kfree(flow_group_in);
1101+ kvfree(flow_group_in);
11011102 if (err && !IS_ERR_OR_NULL(vlan_grp))
11021103 mlx5_destroy_flow_group(vlan_grp);
11031104 if (err && !IS_ERR_OR_NULL(acl))
@@ -1174,7 +1175,7 @@ static void esw_vport_enable_ingress_acl(struct mlx5_eswitch *esw, · 70 unmodified lines
11741175 return;
11751176
11761177 acl = mlx5_create_vport_flow_table(root_ns, 0, table_size, 0, vport->vport);
1177− if (IS_ERR_OR_NULL(acl)) {
1178+ if (IS_ERR(acl)) {
11781179 err = PTR_ERR(acl);
11791180 esw_warn(dev, "Failed to create E-Switch vport[%d] ingress flow Table, err(%d)\n",
11801181 vport->vport, err);
@@ -1192,7 +1193,7 @@ static void esw_vport_enable_ingress_acl(struct mlx5_eswitch *esw, · 11 unmodified lines
11921193 MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, 0);
11931194
11941195 g = mlx5_create_flow_group(acl, flow_group_in);
1195− if (IS_ERR_OR_NULL(g)) {
1196+ if (IS_ERR(g)) {
11961197 err = PTR_ERR(g);
11971198 esw_warn(dev, "Failed to create E-Switch vport[%d] ingress untagged spoofchk flow group, err(%d)\n",
11981199 vport->vport, err);
@@ -1207,7 +1208,7 @@ static void esw_vport_enable_ingress_acl(struct mlx5_eswitch *esw, · 8 unmodified lines
12071208 MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, 1);
12081209
12091210 g = mlx5_create_flow_group(acl, flow_group_in);
1210− if (IS_ERR_OR_NULL(g)) {
1211+ if (IS_ERR(g)) {
12111212 err = PTR_ERR(g);
12121213 esw_warn(dev, "Failed to create E-Switch vport[%d] ingress untagged flow group, err(%d)\n",
12131214 vport->vport, err);
@@ -1223,7 +1224,7 @@ static void esw_vport_enable_ingress_acl(struct mlx5_eswitch *esw, · 9 unmodified lines
12231224 MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, 2);
12241225
12251226 g = mlx5_create_flow_group(acl, flow_group_in);
1226− if (IS_ERR_OR_NULL(g)) {
1227+ if (IS_ERR(g)) {
12271228 err = PTR_ERR(g);
12281229 esw_warn(dev, "Failed to create E-Switch vport[%d] ingress spoofchk flow group, err(%d)\n",
12291230 vport->vport, err);
@@ -1236,7 +1237,7 @@ static void esw_vport_enable_ingress_acl(struct mlx5_eswitch *esw, · 6 unmodified lines
12361237 MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, 3);
12371238
12381239 g = mlx5_create_flow_group(acl, flow_group_in);
1239− if (IS_ERR_OR_NULL(g)) {
1240+ if (IS_ERR(g)) {
12401241 err = PTR_ERR(g);
12411242 esw_warn(dev, "Failed to create E-Switch vport[%d] ingress drop flow group, err(%d)\n",
12421243 vport->vport, err);
@@ -1259,7 +1260,7 @@ out: · 16 unmodified lines
12591260 mlx5_destroy_flow_table(vport->ingress.acl);
12601261 }
12611262
1262− kfree(flow_group_in);
1263+ kvfree(flow_group_in);
12631264 }
12641265
12651266 static void esw_vport_cleanup_ingress_rules(struct mlx5_eswitch *esw,
@@ -1363,7 +1364,7 @@ static int esw_vport_ingress_config(struct mlx5_eswitch *esw, · 97 unmodified lines
13631364 match_v,
13641365 MLX5_FLOW_CONTEXT_ACTION_ALLOW,
13651366 0, NULL);
1366− if (IS_ERR_OR_NULL(vport->ingress.allow_rule)) {
1367+ if (IS_ERR(vport->ingress.allow_rule)) {
13671368 err = PTR_ERR(vport->ingress.allow_rule);
13681369 pr_warn("vport[%d] configure ingress allow rule, err(%d)\n",
13691370 vport->vport, err);
@@ -1380,7 +1381,7 @@ static int esw_vport_ingress_config(struct mlx5_eswitch *esw, · 10 unmodified lines
13801381 match_v,
13811382 MLX5_FLOW_CONTEXT_ACTION_DROP,
13821383 0, NULL);
1383− if (IS_ERR_OR_NULL(vport->ingress.drop_rule)) {
1384+ if (IS_ERR(vport->ingress.drop_rule)) {
13841385 err = PTR_ERR(vport->ingress.drop_rule);
13851386 pr_warn("vport[%d] configure ingress drop rule, err(%d)\n",
13861387 vport->vport, err);
@@ -1439,7 +1440,7 @@ static int esw_vport_egress_config(struct mlx5_eswitch *esw, · 52 unmodified lines
14391440 match_v,
14401441 MLX5_FLOW_CONTEXT_ACTION_ALLOW,
14411442 0, NULL);
1442− if (IS_ERR_OR_NULL(vport->egress.allowed_vlan)) {
1443+ if (IS_ERR(vport->egress.allowed_vlan)) {
14431444 err = PTR_ERR(vport->egress.allowed_vlan);
14441445 pr_warn("vport[%d] configure egress allowed vlan rule failed, err(%d)\n",
14451446 vport->vport, err);
@@ -1457,7 +1458,7 @@ static int esw_vport_egress_config(struct mlx5_eswitch *esw, · 11 unmodified lines
14571458 match_v,
14581459 MLX5_FLOW_CONTEXT_ACTION_DROP,
14591460 0, NULL);
1460− if (IS_ERR_OR_NULL(vport->egress.drop_rule)) {
1461+ if (IS_ERR(vport->egress.drop_rule)) {
14611462 err = PTR_ERR(vport->egress.drop_rule);
14621463 pr_warn("vport[%d] configure egress drop rule failed, err(%d)\n",
14631464 vport->vport, err);
@@ -1491,14 +1492,11 @@ static void esw_enable_vport(struct mlx5_eswitch *esw, int vport_num, · 27 unmodified lines
14911492
14921493 /* Sync with current vport context */
14931494 vport->enabled_events = enable_events;
1494− esw_vport_change_handle_locked(vport);
1495−
14961495 vport->enabled = true;
14971496
14981497 /* only PF is trusted by default */
14991498 vport->trusted = (vport_num) ? false : true;
1500−
1501− arm_vport_context_events_cmd(esw->dev, vport_num, enable_events);
1499+ esw_vport_change_handle_locked(vport);
15021500
15031501 esw->enabled_vports++;
15041502 esw_debug(esw->dev, "Enabled VPORT(%d)\n", vport_num);
@@ -1728,11 +1726,24 @@ void mlx5_eswitch_vport_event(struct mlx5_eswitch *esw, struct mlx5_eqe *eqe) · 223 unmodified lines
17281726 (esw && MLX5_CAP_GEN(esw->dev, vport_group_manager) && mlx5_core_is_pf(esw->dev))
17291727 #define LEGAL_VPORT(esw, vport) (vport >= 0 && vport < esw->total_vports)
17301728
1729+static void node_guid_gen_from_mac(u64 *node_guid, u8 mac[ETH_ALEN])
1730+{
1731+ ((u8 *)node_guid)[7] = mac[0];
1732+ ((u8 *)node_guid)[6] = mac[1];
1733+ ((u8 *)node_guid)[5] = mac[2];
1734+ ((u8 *)node_guid)[4] = 0xff;
1735+ ((u8 *)node_guid)[3] = 0xfe;
1736+ ((u8 *)node_guid)[2] = mac[3];
1737+ ((u8 *)node_guid)[1] = mac[4];
1738+ ((u8 *)node_guid)[0] = mac[5];
1739+}
1740+
17311741 int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw,
17321742 int vport, u8 mac[ETH_ALEN])
17331743 {
1734− int err = 0;
17351744 struct mlx5_vport *evport;
1745+ u64 node_guid;
1746+ int err = 0;
17361747
17371748 if (!ESW_ALLOWED(esw))
17381749 return -EPERM;
@@ -1756,11 +1767,17 @@ int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw, · 17 unmodified lines
17561767 return err;
17571768 }
17581769
1770+ node_guid_gen_from_mac(&node_guid, mac);
1771+ err = mlx5_modify_nic_vport_node_guid(esw->dev, vport, node_guid);
1772+ if (err)
1773+ mlx5_core_warn(esw->dev,
1774+ "Failed to set vport %d node guid, err = %d. RDMA_CM will not function properly for this VF.\n",
1775+ vport, err);
1776+
17591777 mutex_lock(&esw->state_lock);
17601778 if (evport->enabled)
17611779 err = esw_vport_ingress_config(esw, evport);
17621780 mutex_unlock(&esw->state_lock);
1763−
17641781 return err;
17651782 }
17661783
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c+25−15
@@ -1292,8 +1292,8 @@ static int update_root_ft_destroy(struct mlx5_flow_table *ft) · 1291 unmodified lines
12921292 ft->id);
12931293 return err;
12941294 }
1295− root->root_ft = new_root_ft;
12961295 }
1296+ root->root_ft = new_root_ft;
12971297 return 0;
12981298 }
12991299
@@ -1767,6 +1767,9 @@ static void cleanup_root_ns(struct mlx5_core_dev *dev) · 467 unmodified lines
17671767
17681768 void mlx5_cleanup_fs(struct mlx5_core_dev *dev)
17691769 {
1770+ if (MLX5_CAP_GEN(dev, port_type) != MLX5_CAP_PORT_TYPE_ETH)
1771+ return;
1772+
17701773 cleanup_root_ns(dev);
17711774 cleanup_single_prio_root_ns(dev, dev->priv.fdb_root_ns);
17721775 cleanup_single_prio_root_ns(dev, dev->priv.esw_egress_root_ns);
@@ -1828,29 +1831,36 @@ int mlx5_init_fs(struct mlx5_core_dev *dev) · 55 unmodified lines
18281831 {
18291832 int err = 0;
18301833
1834+ if (MLX5_CAP_GEN(dev, port_type) != MLX5_CAP_PORT_TYPE_ETH)
1835+ return 0;
1836+
18311837 err = mlx5_init_fc_stats(dev);
18321838 if (err)
18331839 return err;
18341840
1835− if (MLX5_CAP_GEN(dev, nic_flow_table)) {
1841+ if (MLX5_CAP_GEN(dev, nic_flow_table) &&
1842+ MLX5_CAP_FLOWTABLE_NIC_RX(dev, ft_support)) {
18361843 err = init_root_ns(dev);
18371844 if (err)
18381845 goto err;
18391846 }
1847+
18401848 if (MLX5_CAP_GEN(dev, eswitch_flow_table)) {
1841− err = init_fdb_root_ns(dev);
1842− if (err)
1843− goto err;
1844− }
1845− if (MLX5_CAP_ESW_EGRESS_ACL(dev, ft_support)) {
1846− err = init_egress_acl_root_ns(dev);
1847− if (err)
1848− goto err;
1849− }
1850− if (MLX5_CAP_ESW_INGRESS_ACL(dev, ft_support)) {
1851− err = init_ingress_acl_root_ns(dev);
1852− if (err)
1853− goto err;
1849+ if (MLX5_CAP_ESW_FLOWTABLE_FDB(dev, ft_support)) {
1850+ err = init_fdb_root_ns(dev);
1851+ if (err)
1852+ goto err;
1853+ }
1854+ if (MLX5_CAP_ESW_EGRESS_ACL(dev, ft_support)) {
1855+ err = init_egress_acl_root_ns(dev);
1856+ if (err)
1857+ goto err;
1858+ }
1859+ if (MLX5_CAP_ESW_INGRESS_ACL(dev, ft_support)) {
1860+ err = init_ingress_acl_root_ns(dev);
1861+ if (err)
1862+ goto err;
1863+ }
18541864 }
18551865
18561866 return 0;
drivers/net/ethernet/mellanox/mlx5/core/qp.c+1−1
@@ -418,7 +418,7 @@ int mlx5_core_xrcd_alloc(struct mlx5_core_dev *dev, u32 *xrcdn) · 417 unmodified lines
418418 if (out.hdr.status)
419419 err = mlx5_cmd_status_to_err(&out.hdr);
420420 else
421− *xrcdn = be32_to_cpu(out.xrcdn);
421+ *xrcdn = be32_to_cpu(out.xrcdn) & 0xffffff;
422422
423423 return err;
424424 }
drivers/net/ethernet/mellanox/mlx5/core/vport.c+38−0
@@ -508,6 +508,44 @@ int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid) · 507 unmodified lines
508508 }
509509 EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_node_guid);
510510
511+int mlx5_modify_nic_vport_node_guid(struct mlx5_core_dev *mdev,
512+ u32 vport, u64 node_guid)
513+{
514+ int inlen = MLX5_ST_SZ_BYTES(modify_nic_vport_context_in);
515+ void *nic_vport_context;
516+ u8 *guid;
517+ void *in;
518+ int err;
519+
520+ if (!vport)
521+ return -EINVAL;
522+ if (!MLX5_CAP_GEN(mdev, vport_group_manager))
523+ return -EACCES;
524+ if (!MLX5_CAP_ESW(mdev, nic_vport_node_guid_modify))
525+ return -ENOTSUPP;
526+
527+ in = mlx5_vzalloc(inlen);
528+ if (!in)
529+ return -ENOMEM;
530+
531+ MLX5_SET(modify_nic_vport_context_in, in,
532+ field_select.node_guid, 1);
533+ MLX5_SET(modify_nic_vport_context_in, in, vport_number, vport);
534+ MLX5_SET(modify_nic_vport_context_in, in, other_vport, !!vport);
535+
536+ nic_vport_context = MLX5_ADDR_OF(modify_nic_vport_context_in,
537+ in, nic_vport_context);
538+ guid = MLX5_ADDR_OF(nic_vport_context, nic_vport_context,
539+ node_guid);
540+ MLX5_SET64(nic_vport_context, nic_vport_context, node_guid, node_guid);
541+
542+ err = mlx5_modify_nic_vport_context(mdev, in, inlen);
543+
544+ kvfree(in);
545+
546+ return err;
547+}
548+
511549 int mlx5_query_nic_vport_qkey_viol_cntr(struct mlx5_core_dev *mdev,
512550 u16 *qkey_viol_cntr)
513551 {
drivers/net/ethernet/mellanox/mlxsw/spectrum.c+112−91
@@ -247,15 +247,23 @@ static int mlxsw_sp_port_mtu_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 mtu) · 246 unmodified lines
247247 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(pmtu), pmtu_pl);
248248 }
249249
250−static int mlxsw_sp_port_swid_set(struct mlxsw_sp_port *mlxsw_sp_port, u8 swid)
250+static int __mlxsw_sp_port_swid_set(struct mlxsw_sp *mlxsw_sp, u8 local_port,
251+ u8 swid)
251252 {
252− struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
253253 char pspa_pl[MLXSW_REG_PSPA_LEN];
254254
255− mlxsw_reg_pspa_pack(pspa_pl, swid, mlxsw_sp_port->local_port);
255+ mlxsw_reg_pspa_pack(pspa_pl, swid, local_port);
256256 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(pspa), pspa_pl);
257257 }
258258
259+static int mlxsw_sp_port_swid_set(struct mlxsw_sp_port *mlxsw_sp_port, u8 swid)
260+{
261+ struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
262+
263+ return __mlxsw_sp_port_swid_set(mlxsw_sp, mlxsw_sp_port->local_port,
264+ swid);
265+}
266+
259267 static int mlxsw_sp_port_vp_mode_set(struct mlxsw_sp_port *mlxsw_sp_port,
260268 bool enable)
261269 {
@@ -305,9 +313,9 @@ mlxsw_sp_port_system_port_mapping_set(struct mlxsw_sp_port *mlxsw_sp_port) · 43 unmodified lines
305313 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sspr), sspr_pl);
306314 }
307315
308−static int __mlxsw_sp_port_module_info_get(struct mlxsw_sp *mlxsw_sp,
309− u8 local_port, u8 *p_module,
310− u8 *p_width, u8 *p_lane)
316+static int mlxsw_sp_port_module_info_get(struct mlxsw_sp *mlxsw_sp,
317+ u8 local_port, u8 *p_module,
318+ u8 *p_width, u8 *p_lane)
311319 {
312320 char pmlp_pl[MLXSW_REG_PMLP_LEN];
313321 int err;
@@ -322,16 +330,6 @@ static int __mlxsw_sp_port_module_info_get(struct mlxsw_sp *mlxsw_sp, · 8 unmodified lines
322330 return 0;
323331 }
324332
325−static int mlxsw_sp_port_module_info_get(struct mlxsw_sp *mlxsw_sp,
326− u8 local_port, u8 *p_module,
327− u8 *p_width)
328−{
329− u8 lane;
330−
331− return __mlxsw_sp_port_module_info_get(mlxsw_sp, local_port, p_module,
332− p_width, &lane);
333−}
334−
335333 static int mlxsw_sp_port_module_map(struct mlxsw_sp *mlxsw_sp, u8 local_port,
336334 u8 module, u8 width, u8 lane)
337335 {
@@ -949,17 +947,11 @@ static int mlxsw_sp_port_get_phys_port_name(struct net_device *dev, char *name, · 611 unmodified lines
949947 size_t len)
950948 {
951949 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
952− u8 module, width, lane;
950+ u8 module = mlxsw_sp_port->mapping.module;
951+ u8 width = mlxsw_sp_port->mapping.width;
952+ u8 lane = mlxsw_sp_port->mapping.lane;
953953 int err;
954954
955− err = __mlxsw_sp_port_module_info_get(mlxsw_sp_port->mlxsw_sp,
956− mlxsw_sp_port->local_port,
957− &module, &width, &lane);
958− if (err) {
959− netdev_err(dev, "Failed to retrieve module information\n");
960− return err;
961− }
962−
963955 if (!mlxsw_sp_port->split)
964956 err = snprintf(name, len, "p%d", module + 1);
965957 else
@@ -1681,8 +1673,8 @@ static int mlxsw_sp_port_ets_init(struct mlxsw_sp_port *mlxsw_sp_port) · 715 unmodified lines
16811673 return 0;
16821674 }
16831675
1684−static int __mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
1685− bool split, u8 module, u8 width)
1676+static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
1677+ bool split, u8 module, u8 width, u8 lane)
16861678 {
16871679 struct mlxsw_sp_port *mlxsw_sp_port;
16881680 struct net_device *dev;
@@ -1697,6 +1689,9 @@ static int __mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port, · 8 unmodified lines
16971689 mlxsw_sp_port->mlxsw_sp = mlxsw_sp;
16981690 mlxsw_sp_port->local_port = local_port;
16991691 mlxsw_sp_port->split = split;
1692+ mlxsw_sp_port->mapping.module = module;
1693+ mlxsw_sp_port->mapping.width = width;
1694+ mlxsw_sp_port->mapping.lane = lane;
17001695 bytes = DIV_ROUND_UP(VLAN_N_VID, BITS_PER_BYTE);
17011696 mlxsw_sp_port->active_vlans = kzalloc(bytes, GFP_KERNEL);
17021697 if (!mlxsw_sp_port->active_vlans) {
@@ -1839,28 +1834,6 @@ err_port_active_vlans_alloc: · 136 unmodified lines
18391834 return err;
18401835 }
18411836
1842−static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
1843− bool split, u8 module, u8 width, u8 lane)
1844−{
1845− int err;
1846−
1847− err = mlxsw_sp_port_module_map(mlxsw_sp, local_port, module, width,
1848− lane);
1849− if (err)
1850− return err;
1851−
1852− err = __mlxsw_sp_port_create(mlxsw_sp, local_port, split, module,
1853− width);
1854− if (err)
1855− goto err_port_create;
1856−
1857− return 0;
1858−
1859−err_port_create:
1860− mlxsw_sp_port_module_unmap(mlxsw_sp, local_port);
1861− return err;
1862−}
1863−
18641837 static void mlxsw_sp_port_vports_fini(struct mlxsw_sp_port *mlxsw_sp_port)
18651838 {
18661839 struct net_device *dev = mlxsw_sp_port->dev;
@@ -1909,8 +1882,8 @@ static void mlxsw_sp_ports_remove(struct mlxsw_sp *mlxsw_sp) · 42 unmodified lines
19091882
19101883 static int mlxsw_sp_ports_create(struct mlxsw_sp *mlxsw_sp)
19111884 {
1885+ u8 module, width, lane;
19121886 size_t alloc_size;
1913− u8 module, width;
19141887 int i;
19151888 int err;
19161889
@@ -1921,13 +1894,14 @@ static int mlxsw_sp_ports_create(struct mlxsw_sp *mlxsw_sp) · 4 unmodified lines
19211894
19221895 for (i = 1; i < MLXSW_PORT_MAX_PORTS; i++) {
19231896 err = mlxsw_sp_port_module_info_get(mlxsw_sp, i, &module,
1924− &width);
1897+ &width, &lane);
19251898 if (err)
19261899 goto err_port_module_info_get;
19271900 if (!width)
19281901 continue;
19291902 mlxsw_sp->port_to_module[i] = module;
1930− err = __mlxsw_sp_port_create(mlxsw_sp, i, false, module, width);
1903+ err = mlxsw_sp_port_create(mlxsw_sp, i, false, module, width,
1904+ lane);
19311905 if (err)
19321906 goto err_port_create;
19331907 }
@@ -1948,12 +1922,85 @@ static u8 mlxsw_sp_cluster_base_port_get(u8 local_port) · 14 unmodified lines
19481922 return local_port - offset;
19491923 }
19501924
1925+static int mlxsw_sp_port_split_create(struct mlxsw_sp *mlxsw_sp, u8 base_port,
1926+ u8 module, unsigned int count)
1927+{
1928+ u8 width = MLXSW_PORT_MODULE_MAX_WIDTH / count;
1929+ int err, i;
1930+
1931+ for (i = 0; i < count; i++) {
1932+ err = mlxsw_sp_port_module_map(mlxsw_sp, base_port + i, module,
1933+ width, i * width);
1934+ if (err)
1935+ goto err_port_module_map;
1936+ }
1937+
1938+ for (i = 0; i < count; i++) {
1939+ err = __mlxsw_sp_port_swid_set(mlxsw_sp, base_port + i, 0);
1940+ if (err)
1941+ goto err_port_swid_set;
1942+ }
1943+
1944+ for (i = 0; i < count; i++) {
1945+ err = mlxsw_sp_port_create(mlxsw_sp, base_port + i, true,
1946+ module, width, i * width);
1947+ if (err)
1948+ goto err_port_create;
1949+ }
1950+
1951+ return 0;
1952+
1953+err_port_create:
1954+ for (i--; i >= 0; i--)
1955+ mlxsw_sp_port_remove(mlxsw_sp, base_port + i);
1956+ i = count;
1957+err_port_swid_set:
1958+ for (i--; i >= 0; i--)
1959+ __mlxsw_sp_port_swid_set(mlxsw_sp, base_port + i,
1960+ MLXSW_PORT_SWID_DISABLED_PORT);
1961+ i = count;
1962+err_port_module_map:
1963+ for (i--; i >= 0; i--)
1964+ mlxsw_sp_port_module_unmap(mlxsw_sp, base_port + i);
1965+ return err;
1966+}
1967+
1968+static void mlxsw_sp_port_unsplit_create(struct mlxsw_sp *mlxsw_sp,
1969+ u8 base_port, unsigned int count)
1970+{
1971+ u8 local_port, module, width = MLXSW_PORT_MODULE_MAX_WIDTH;
1972+ int i;
1973+
1974+ /* Split by four means we need to re-create two ports, otherwise
1975+ * only one.
1976+ */
1977+ count = count / 2;
1978+
1979+ for (i = 0; i < count; i++) {
1980+ local_port = base_port + i * 2;
1981+ module = mlxsw_sp->port_to_module[local_port];
1982+
1983+ mlxsw_sp_port_module_map(mlxsw_sp, local_port, module, width,
1984+ 0);
1985+ }
1986+
1987+ for (i = 0; i < count; i++)
1988+ __mlxsw_sp_port_swid_set(mlxsw_sp, base_port + i * 2, 0);
1989+
1990+ for (i = 0; i < count; i++) {
1991+ local_port = base_port + i * 2;
1992+ module = mlxsw_sp->port_to_module[local_port];
1993+
1994+ mlxsw_sp_port_create(mlxsw_sp, local_port, false, module,
1995+ width, 0);
1996+ }
1997+}
1998+
19511999 static int mlxsw_sp_port_split(struct mlxsw_core *mlxsw_core, u8 local_port,
19522000 unsigned int count)
19532001 {
19542002 struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core);
19552003 struct mlxsw_sp_port *mlxsw_sp_port;
1956− u8 width = MLXSW_PORT_MODULE_MAX_WIDTH / count;
19572004 u8 module, cur_width, base_port;
19582005 int i;
19592006 int err;
@@ -1965,18 +2012,14 @@ static int mlxsw_sp_port_split(struct mlxsw_core *mlxsw_core, u8 local_port, · 5 unmodified lines
19652012 return -EINVAL;
19662013 }
19672014
2015+ module = mlxsw_sp_port->mapping.module;
2016+ cur_width = mlxsw_sp_port->mapping.width;
2017+
19682018 if (count != 2 && count != 4) {
19692019 netdev_err(mlxsw_sp_port->dev, "Port can only be split into 2 or 4 ports\n");
19702020 return -EINVAL;
19712021 }
19722022
1973− err = mlxsw_sp_port_module_info_get(mlxsw_sp, local_port, &module,
1974− &cur_width);
1975− if (err) {
1976− netdev_err(mlxsw_sp_port->dev, "Failed to get port's width\n");
1977− return err;
1978− }
1979−
19802023 if (cur_width != MLXSW_PORT_MODULE_MAX_WIDTH) {
19812024 netdev_err(mlxsw_sp_port->dev, "Port cannot be split further\n");
19822025 return -EINVAL;
@@ -2001,25 +2044,16 @@ static int mlxsw_sp_port_split(struct mlxsw_core *mlxsw_core, u8 local_port, · 18 unmodified lines
20012044 for (i = 0; i < count; i++)
20022045 mlxsw_sp_port_remove(mlxsw_sp, base_port + i);
20032046
2004− for (i = 0; i < count; i++) {
2005− err = mlxsw_sp_port_create(mlxsw_sp, base_port + i, true,
2006− module, width, i * width);
2007− if (err) {
2008− dev_err(mlxsw_sp->bus_info->dev, "Failed to create split port\n");
2009− goto err_port_create;
2010− }
2047+ err = mlxsw_sp_port_split_create(mlxsw_sp, base_port, module, count);
2048+ if (err) {
2049+ dev_err(mlxsw_sp->bus_info->dev, "Failed to create split ports\n");
2050+ goto err_port_split_create;
20112051 }
20122052
20132053 return 0;
20142054
2015−err_port_create:
2016− for (i--; i >= 0; i--)
2017− mlxsw_sp_port_remove(mlxsw_sp, base_port + i);
2018− for (i = 0; i < count / 2; i++) {
2019− module = mlxsw_sp->port_to_module[base_port + i * 2];
2020− mlxsw_sp_port_create(mlxsw_sp, base_port + i * 2, false,
2021− module, MLXSW_PORT_MODULE_MAX_WIDTH, 0);
2022− }
2055+err_port_split_create:
2056+ mlxsw_sp_port_unsplit_create(mlxsw_sp, base_port, count);
20232057 return err;
20242058 }
20252059
@@ -2027,10 +2061,9 @@ static int mlxsw_sp_port_unsplit(struct mlxsw_core *mlxsw_core, u8 local_port) · 1 unmodified line
20272061 {
20282062 struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core);
20292063 struct mlxsw_sp_port *mlxsw_sp_port;
2030− u8 module, cur_width, base_port;
2064+ u8 cur_width, base_port;
20312065 unsigned int count;
20322066 int i;
2033− int err;
20342067
20352068 mlxsw_sp_port = mlxsw_sp->ports[local_port];
20362069 if (!mlxsw_sp_port) {
@@ -2044,12 +2077,7 @@ static int mlxsw_sp_port_unsplit(struct mlxsw_core *mlxsw_core, u8 local_port) · 7 unmodified lines
20442077 return -EINVAL;
20452078 }
20462079
2047− err = mlxsw_sp_port_module_info_get(mlxsw_sp, local_port, &module,
2048− &cur_width);
2049− if (err) {
2050− netdev_err(mlxsw_sp_port->dev, "Failed to get port's width\n");
2051− return err;
2052− }
2080+ cur_width = mlxsw_sp_port->mapping.width;
20532081 count = cur_width == 1 ? 4 : 2;
20542082
20552083 base_port = mlxsw_sp_cluster_base_port_get(local_port);
@@ -2061,14 +2089,7 @@ static int mlxsw_sp_port_unsplit(struct mlxsw_core *mlxsw_core, u8 local_port) · 5 unmodified lines
20612089 for (i = 0; i < count; i++)
20622090 mlxsw_sp_port_remove(mlxsw_sp, base_port + i);
20632091
2064− for (i = 0; i < count / 2; i++) {
2065− module = mlxsw_sp->port_to_module[base_port + i * 2];
2066− err = mlxsw_sp_port_create(mlxsw_sp, base_port + i * 2, false,
2067− module, MLXSW_PORT_MODULE_MAX_WIDTH,
2068− 0);
2069− if (err)
2070− dev_err(mlxsw_sp->bus_info->dev, "Failed to reinstantiate port\n");
2071− }
2092+ mlxsw_sp_port_unsplit_create(mlxsw_sp, base_port, count);
20722093
20732094 return 0;
20742095 }
drivers/net/ethernet/mellanox/mlxsw/spectrum.h+5−0
@@ -229,6 +229,11 @@ struct mlxsw_sp_port { · 228 unmodified lines
229229 struct ieee_maxrate *maxrate;
230230 struct ieee_pfc *pfc;
231231 } dcb;
232+ struct {
233+ u8 module;
234+ u8 width;
235+ u8 lane;
236+ } mapping;
232237 /* 802.1Q bridge VLANs */
233238 unsigned long *active_vlans;
234239 unsigned long *untagged_vlans;
drivers/net/ethernet/qlogic/qed/qed_main.c+36−9
@@ -1105,6 +1105,39 @@ static int qed_get_port_type(u32 media_type) · 1104 unmodified lines
11051105 return port_type;
11061106 }
11071107
1108+static int qed_get_link_data(struct qed_hwfn *hwfn,
1109+ struct qed_mcp_link_params *params,
1110+ struct qed_mcp_link_state *link,
1111+ struct qed_mcp_link_capabilities *link_caps)
1112+{
1113+ void *p;
1114+
1115+ if (!IS_PF(hwfn->cdev)) {
1116+ qed_vf_get_link_params(hwfn, params);
1117+ qed_vf_get_link_state(hwfn, link);
1118+ qed_vf_get_link_caps(hwfn, link_caps);
1119+
1120+ return 0;
1121+ }
1122+
1123+ p = qed_mcp_get_link_params(hwfn);
1124+ if (!p)
1125+ return -ENXIO;
1126+ memcpy(params, p, sizeof(*params));
1127+
1128+ p = qed_mcp_get_link_state(hwfn);
1129+ if (!p)
1130+ return -ENXIO;
1131+ memcpy(link, p, sizeof(*link));
1132+
1133+ p = qed_mcp_get_link_capabilities(hwfn);
1134+ if (!p)
1135+ return -ENXIO;
1136+ memcpy(link_caps, p, sizeof(*link_caps));
1137+
1138+ return 0;
1139+}
1140+
11081141 static void qed_fill_link(struct qed_hwfn *hwfn,
11091142 struct qed_link_output *if_link)
11101143 {
@@ -1116,15 +1149,9 @@ static void qed_fill_link(struct qed_hwfn *hwfn, · 5 unmodified lines
11161149 memset(if_link, 0, sizeof(*if_link));
11171150
11181151 /* Prepare source inputs */
1119− if (IS_PF(hwfn->cdev)) {
1120− memcpy(&params, qed_mcp_get_link_params(hwfn), sizeof(params));
1121− memcpy(&link, qed_mcp_get_link_state(hwfn), sizeof(link));
1122− memcpy(&link_caps, qed_mcp_get_link_capabilities(hwfn),
1123− sizeof(link_caps));
1124− } else {
1125− qed_vf_get_link_params(hwfn, &params);
1126− qed_vf_get_link_state(hwfn, &link);
1127− qed_vf_get_link_caps(hwfn, &link_caps);
1152+ if (qed_get_link_data(hwfn, &params, &link, &link_caps)) {
1153+ dev_warn(&hwfn->cdev->pdev->dev, "no link data available\n");
1154+ return;
11281155 }
11291156
11301157 /* Set the link parameters to pass to protocol driver */
drivers/net/ethernet/qlogic/qed/qed_sriov.h+3−1
@@ -12,11 +12,13 @@ · 11 unmodified lines
1212 #include "qed_vf.h"
1313 #define QED_VF_ARRAY_LENGTH (3)
1414
15+#ifdef CONFIG_QED_SRIOV
1516 #define IS_VF(cdev) ((cdev)->b_is_vf)
1617 #define IS_PF(cdev) (!((cdev)->b_is_vf))
17−#ifdef CONFIG_QED_SRIOV
1818 #define IS_PF_SRIOV(p_hwfn) (!!((p_hwfn)->cdev->p_iov_info))
1919 #else
20+#define IS_VF(cdev) (0)
21+#define IS_PF(cdev) (1)
2022 #define IS_PF_SRIOV(p_hwfn) (0)
2123 #endif
2224 #define IS_PF_SRIOV_ALLOC(p_hwfn) (!!((p_hwfn)->pf_iov_info))
drivers/net/ethernet/qlogic/qede/qede_main.c+2−0
@@ -87,7 +87,9 @@ static const struct pci_device_id qede_pci_tbl[] = { · 86 unmodified lines
8787 {PCI_VDEVICE(QLOGIC, PCI_DEVICE_ID_57980S_100), QEDE_PRIVATE_PF},
8888 {PCI_VDEVICE(QLOGIC, PCI_DEVICE_ID_57980S_50), QEDE_PRIVATE_PF},
8989 {PCI_VDEVICE(QLOGIC, PCI_DEVICE_ID_57980S_25), QEDE_PRIVATE_PF},
90+#ifdef CONFIG_QED_SRIOV
9091 {PCI_VDEVICE(QLOGIC, PCI_DEVICE_ID_57980S_IOV), QEDE_PRIVATE_VF},
92+#endif
9193 { 0 }
9294 };
9395
drivers/net/ethernet/sfc/mcdi_port.c+4−3
@@ -189,11 +189,12 @@ static u32 mcdi_to_ethtool_cap(u32 media, u32 cap) · 188 unmodified lines
189189
190190 case MC_CMD_MEDIA_XFP:
191191 case MC_CMD_MEDIA_SFP_PLUS:
192− result |= SUPPORTED_FIBRE;
193− break;
194−
195192 case MC_CMD_MEDIA_QSFP_PLUS:
196193 result |= SUPPORTED_FIBRE;
194+ if (cap & (1 << MC_CMD_PHY_CAP_1000FDX_LBN))
195+ result |= SUPPORTED_1000baseT_Full;
196+ if (cap & (1 << MC_CMD_PHY_CAP_10000FDX_LBN))
197+ result |= SUPPORTED_10000baseT_Full;
197198 if (cap & (1 << MC_CMD_PHY_CAP_40000FDX_LBN))
198199 result |= SUPPORTED_40000baseCR4_Full;
199200 break;
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c+1−1
@@ -156,7 +156,7 @@ static void dwmac4_set_filter(struct mac_device_info *hw, · 155 unmodified lines
156156 struct netdev_hw_addr *ha;
157157
158158 netdev_for_each_uc_addr(ha, dev) {
159− dwmac4_set_umac_addr(ioaddr, ha->addr, reg);
159+ dwmac4_set_umac_addr(hw, ha->addr, reg);
160160 reg++;
161161 }
162162 }
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+4−2
@@ -3450,8 +3450,6 @@ int stmmac_resume(struct device *dev) · 3449 unmodified lines
34503450 if (!netif_running(ndev))
34513451 return 0;
34523452
3453− spin_lock_irqsave(&priv->lock, flags);
3454−
34553453 /* Power Down bit, into the PM register, is cleared
34563454 * automatically as soon as a magic packet or a Wake-up frame
34573455 * is received. Anyway, it's better to manually clear
@@ -3459,7 +3457,9 @@ int stmmac_resume(struct device *dev) · 1 unmodified line
34593457 * from another devices (e.g. serial console).
34603458 */
34613459 if (device_may_wakeup(priv->device)) {
3460+ spin_lock_irqsave(&priv->lock, flags);
34623461 priv->hw->mac->pmt(priv->hw, 0);
3462+ spin_unlock_irqrestore(&priv->lock, flags);
34633463 priv->irq_wake = 0;
34643464 } else {
34653465 pinctrl_pm_select_default_state(priv->device);
@@ -3473,6 +3473,8 @@ int stmmac_resume(struct device *dev) · 7 unmodified lines
34733473
34743474 netif_device_attach(ndev);
34753475
3476+ spin_lock_irqsave(&priv->lock, flags);
3477+
34763478 priv->cur_rx = 0;
34773479 priv->dirty_rx = 0;
34783480 priv->dirty_tx = 0;
drivers/net/ethernet/ti/cpsw.c+1−1
@@ -1339,7 +1339,7 @@ static int cpsw_ndo_open(struct net_device *ndev) · 1338 unmodified lines
13391339 if (priv->coal_intvl != 0) {
13401340 struct ethtool_coalesce coal;
13411341
1342− coal.rx_coalesce_usecs = (priv->coal_intvl << 4);
1342+ coal.rx_coalesce_usecs = priv->coal_intvl;
13431343 cpsw_set_coalesce(ndev, &coal);
13441344 }
13451345
drivers/net/vmxnet3/vmxnet3_drv.c+1−1
@@ -1369,7 +1369,7 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq, · 1368 unmodified lines
13691369 rcdlro = (struct Vmxnet3_RxCompDescExt *)rcd;
13701370
13711371 segCnt = rcdlro->segCnt;
1372− BUG_ON(segCnt <= 1);
1372+ WARN_ON_ONCE(segCnt == 0);
13731373 mss = rcdlro->mss;
13741374 if (unlikely(segCnt <= 1))
13751375 segCnt = 0;
drivers/net/vmxnet3/vmxnet3_int.h+2−2
@@ -69,10 +69,10 @@ · 68 unmodified lines
6969 /*
7070 * Version numbers
7171 */
72−#define VMXNET3_DRIVER_VERSION_STRING "1.4.7.0-k"
72+#define VMXNET3_DRIVER_VERSION_STRING "1.4.8.0-k"
7373
7474 /* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */
75−#define VMXNET3_DRIVER_VERSION_NUM 0x01040700
75+#define VMXNET3_DRIVER_VERSION_NUM 0x01040800
7676
7777 #if defined(CONFIG_PCI_MSI)
7878 /* RSS only makes sense if MSI-X is supported. */
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c+16−0
@@ -2540,12 +2540,14 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, · 2539 unmodified lines
25402540 const u8 *mac, struct station_info *sinfo)
25412541 {
25422542 struct brcmf_if *ifp = netdev_priv(ndev);
2543+ struct brcmf_scb_val_le scb_val;
25432544 s32 err = 0;
25442545 struct brcmf_sta_info_le sta_info_le;
25452546 u32 sta_flags;
25462547 u32 is_tdls_peer;
25472548 s32 total_rssi;
25482549 s32 count_rssi;
2550+ int rssi;
25492551 u32 i;
25502552
25512553 brcmf_dbg(TRACE, "Enter, MAC %pM\n", mac);
@@ -2629,6 +2631,20 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, · 77 unmodified lines
26292631 sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
26302632 total_rssi /= count_rssi;
26312633 sinfo->signal = total_rssi;
2634+ } else if (test_bit(BRCMF_VIF_STATUS_CONNECTED,
2635+ &ifp->vif->sme_state)) {
2636+ memset(&scb_val, 0, sizeof(scb_val));
2637+ err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI,
2638+ &scb_val, sizeof(scb_val));
2639+ if (err) {
2640+ brcmf_err("Could not get rssi (%d)\n", err);
2641+ goto done;
2642+ } else {
2643+ rssi = le32_to_cpu(scb_val.val);
2644+ sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
2645+ sinfo->signal = rssi;
2646+ brcmf_dbg(CONN, "RSSI %d dBm\n", rssi);
2647+ }
26322648 }
26332649 }
26342650 done:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c+2−0
@@ -1157,6 +1157,8 @@ brcmf_msgbuf_process_rx_complete(struct brcmf_msgbuf *msgbuf, void *buf) · 1156 unmodified lines
11571157 brcmu_pkt_buf_free_skb(skb);
11581158 return;
11591159 }
1160+
1161+ skb->protocol = eth_type_trans(skb, ifp->ndev);
11601162 brcmf_netif_rx(ifp, skb);
11611163 }
11621164
drivers/net/wireless/mac80211_hwsim.c+1−0
@@ -2776,6 +2776,7 @@ static int hwsim_tx_info_frame_received_nl(struct sk_buff *skb_2, · 2775 unmodified lines
27762776 if (!info->attrs[HWSIM_ATTR_ADDR_TRANSMITTER] ||
27772777 !info->attrs[HWSIM_ATTR_FLAGS] ||
27782778 !info->attrs[HWSIM_ATTR_COOKIE] ||
2779+ !info->attrs[HWSIM_ATTR_SIGNAL] ||
27792780 !info->attrs[HWSIM_ATTR_TX_INFO])
27802781 goto out;
27812782
drivers/net/wireless/realtek/rtlwifi/core.c+3−3
@@ -54,7 +54,7 @@ EXPORT_SYMBOL(channel5g_80m); · 53 unmodified lines
5454 void rtl_addr_delay(u32 addr)
5555 {
5656 if (addr == 0xfe)
57− msleep(50);
57+ mdelay(50);
5858 else if (addr == 0xfd)
5959 msleep(5);
6060 else if (addr == 0xfc)
@@ -75,7 +75,7 @@ void rtl_rfreg_delay(struct ieee80211_hw *hw, enum radio_path rfpath, u32 addr, · 14 unmodified lines
7575 rtl_addr_delay(addr);
7676 } else {
7777 rtl_set_rfreg(hw, rfpath, addr, mask, data);
78− usleep_range(1, 2);
78+ udelay(1);
7979 }
8080 }
8181 EXPORT_SYMBOL(rtl_rfreg_delay);
@@ -86,7 +86,7 @@ void rtl_bb_delay(struct ieee80211_hw *hw, u32 addr, u32 data) · 4 unmodified lines
8686 rtl_addr_delay(addr);
8787 } else {
8888 rtl_set_bbreg(hw, addr, MASKDWORD, data);
89− usleep_range(1, 2);
89+ udelay(1);
9090 }
9191 }
9292 EXPORT_SYMBOL(rtl_bb_delay);
drivers/nvme/host/pci.c+7−2
@@ -1679,9 +1679,14 @@ static int nvme_pci_enable(struct nvme_dev *dev) · 1678 unmodified lines
16791679
16801680 static void nvme_dev_unmap(struct nvme_dev *dev)
16811681 {
1682+ struct pci_dev *pdev = to_pci_dev(dev->dev);
1683+ int bars;
1684+
16821685 if (dev->bar)
16831686 iounmap(dev->bar);
1684− pci_release_regions(to_pci_dev(dev->dev));
1687+
1688+ bars = pci_select_bars(pdev, IORESOURCE_MEM);
1689+ pci_release_selected_regions(pdev, bars);
16851690 }
16861691
16871692 static void nvme_pci_disable(struct nvme_dev *dev)
@@ -1924,7 +1929,7 @@ static int nvme_dev_map(struct nvme_dev *dev) · 236 unmodified lines
19241929
19251930 return 0;
19261931 release:
1927− pci_release_regions(pdev);
1932+ pci_release_selected_regions(pdev, bars);
19281933 return -ENODEV;
19291934 }
19301935
drivers/of/fdt.c+13−2
@@ -395,7 +395,7 @@ static int unflatten_dt_nodes(const void *blob, · 394 unmodified lines
395395 struct device_node **nodepp)
396396 {
397397 struct device_node *root;
398− int offset = 0, depth = 0;
398+ int offset = 0, depth = 0, initial_depth = 0;
399399 #define FDT_MAX_DEPTH 64
400400 unsigned int fpsizes[FDT_MAX_DEPTH];
401401 struct device_node *nps[FDT_MAX_DEPTH];
@@ -405,11 +405,22 @@ static int unflatten_dt_nodes(const void *blob, · 3 unmodified lines
405405 if (nodepp)
406406 *nodepp = NULL;
407407
408+ /*
409+ * We're unflattening device sub-tree if @dad is valid. There are
410+ * possibly multiple nodes in the first level of depth. We need
411+ * set @depth to 1 to make fdt_next_node() happy as it bails
412+ * immediately when negative @depth is found. Otherwise, the device
413+ * nodes except the first one won't be unflattened successfully.
414+ */
415+ if (dad)
416+ depth = initial_depth = 1;
417+
408418 root = dad;
409419 fpsizes[depth] = dad ? strlen(of_node_full_name(dad)) : 0;
410420 nps[depth] = dad;
421+
411422 for (offset = 0;
412− offset >= 0 && depth >= 0;
423+ offset >= 0 && depth >= initial_depth;
413424 offset = fdt_next_node(blob, offset, &depth)) {
414425 if (WARN_ON_ONCE(depth >= FDT_MAX_DEPTH))
415426 continue;
drivers/of/irq.c+10−9
@@ -386,13 +386,13 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r) · 385 unmodified lines
386386 EXPORT_SYMBOL_GPL(of_irq_to_resource);
387387
388388 /**
389− * of_irq_get - Decode a node's IRQ and return it as a Linux irq number
389+ * of_irq_get - Decode a node's IRQ and return it as a Linux IRQ number
390390 * @dev: pointer to device tree node
391− * @index: zero-based index of the irq
392− *
393− * Returns Linux irq number on success, or -EPROBE_DEFER if the irq domain
394− * is not yet created.
391+ * @index: zero-based index of the IRQ
395392 *
393+ * Returns Linux IRQ number on success, or 0 on the IRQ mapping failure, or
394+ * -EPROBE_DEFER if the IRQ domain is not yet created, or error code in case
395+ * of any other failure.
396396 */
397397 int of_irq_get(struct device_node *dev, int index)
398398 {
@@ -413,12 +413,13 @@ int of_irq_get(struct device_node *dev, int index) · 14 unmodified lines
413413 EXPORT_SYMBOL_GPL(of_irq_get);
414414
415415 /**
416− * of_irq_get_byname - Decode a node's IRQ and return it as a Linux irq number
416+ * of_irq_get_byname - Decode a node's IRQ and return it as a Linux IRQ number
417417 * @dev: pointer to device tree node
418− * @name: irq name
418+ * @name: IRQ name
419419 *
420− * Returns Linux irq number on success, or -EPROBE_DEFER if the irq domain
421− * is not yet created, or error code in case of any other failure.
420+ * Returns Linux IRQ number on success, or 0 on the IRQ mapping failure, or
421+ * -EPROBE_DEFER if the IRQ domain is not yet created, or error code in case
422+ * of any other failure.
422423 */
423424 int of_irq_get_byname(struct device_node *dev, const char *name)
424425 {
drivers/of/of_reserved_mem.c+9−2
@@ -127,8 +127,15 @@ static int __init __reserved_mem_alloc_size(unsigned long node, · 126 unmodified lines
127127 }
128128
129129 /* Need adjust the alignment to satisfy the CMA requirement */
130− if (IS_ENABLED(CONFIG_CMA) && of_flat_dt_is_compatible(node, "shared-dma-pool"))
131− align = max(align, (phys_addr_t)PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order));
130+ if (IS_ENABLED(CONFIG_CMA)
131+ && of_flat_dt_is_compatible(node, "shared-dma-pool")
132+ && of_get_flat_dt_prop(node, "reusable", NULL)
133+ && !of_get_flat_dt_prop(node, "no-map", NULL)) {
134+ unsigned long order =
135+ max_t(unsigned long, MAX_ORDER - 1, pageblock_order);
136+
137+ align = max(align, (phys_addr_t)PAGE_SIZE << order);
138+ }
132139
133140 prop = of_get_flat_dt_prop(node, "alloc-ranges", &len);
134141 if (prop) {
drivers/perf/arm_pmu.c+1−1
@@ -1010,8 +1010,8 @@ int arm_pmu_device_probe(struct platform_device *pdev, · 1009 unmodified lines
10101010 if (!ret)
10111011 ret = init_fn(pmu);
10121012 } else {
1013− ret = probe_current_pmu(pmu, probe_table);
10141013 cpumask_setall(&pmu->supported_cpus);
1014+ ret = probe_current_pmu(pmu, probe_table);
10151015 }
10161016
10171017 if (ret) {
drivers/phy/phy-exynos-mipi-video.c+5−1
@@ -233,8 +233,12 @@ static inline int __is_running(const struct exynos_mipi_phy_desc *data, · 232 unmodified lines
233233 struct exynos_mipi_video_phy *state)
234234 {
235235 u32 val;
236+ int ret;
237+
238+ ret = regmap_read(state->regmaps[data->resetn_map], data->resetn_reg, &val);
239+ if (ret)
240+ return 0;
236241
237− regmap_read(state->regmaps[data->resetn_map], data->resetn_reg, &val);
238242 return val & data->resetn_val;
239243 }
240244
drivers/phy/phy-ti-pipe3.c+11−4
@@ -293,11 +293,18 @@ static int ti_pipe3_init(struct phy *x) · 292 unmodified lines
293293 ret = ti_pipe3_dpll_wait_lock(phy);
294294 }
295295
296− /* Program the DPLL only if not locked */
296+ /* SATA has issues if re-programmed when locked */
297297 val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_STATUS);
298− if (!(val & PLL_LOCK))
299− if (ti_pipe3_dpll_program(phy))
300− return -EINVAL;
298+ if ((val & PLL_LOCK) && of_device_is_compatible(phy->dev->of_node,
299+ "ti,phy-pipe3-sata"))
300+ return ret;
301+
302+ /* Program the DPLL */
303+ ret = ti_pipe3_dpll_program(phy);
304+ if (ret) {
305+ ti_pipe3_disable_clocks(phy);
306+ return -EINVAL;
307+ }
301308
302309 return ret;
303310 }
drivers/phy/phy-twl4030-usb.c+10−4
@@ -463,7 +463,8 @@ static int twl4030_phy_power_on(struct phy *phy) · 462 unmodified lines
463463 twl4030_usb_set_mode(twl, twl->usb_mode);
464464 if (twl->usb_mode == T2_USB_MODE_ULPI)
465465 twl4030_i2c_access(twl, 0);
466− schedule_delayed_work(&twl->id_workaround_work, 0);
466+ twl->linkstat = MUSB_UNKNOWN;
467+ schedule_delayed_work(&twl->id_workaround_work, HZ);
467468
468469 return 0;
469470 }
@@ -537,6 +538,7 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl) · 67 unmodified lines
537538 struct twl4030_usb *twl = _twl;
538539 enum musb_vbus_id_status status;
539540 bool status_changed = false;
541+ int err;
540542
541543 status = twl4030_usb_linkstat(twl);
542544
@@ -567,7 +569,9 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl) · 24 unmodified lines
567569 pm_runtime_mark_last_busy(twl->dev);
568570 pm_runtime_put_autosuspend(twl->dev);
569571 }
570− musb_mailbox(status);
572+ err = musb_mailbox(status);
573+ if (err)
574+ twl->linkstat = MUSB_UNKNOWN;
571575 }
572576
573577 /* don't schedule during sleep - irq works right then */
@@ -595,7 +599,8 @@ static int twl4030_phy_init(struct phy *phy) · 21 unmodified lines
595599 struct twl4030_usb *twl = phy_get_drvdata(phy);
596600
597601 pm_runtime_get_sync(twl->dev);
598− schedule_delayed_work(&twl->id_workaround_work, 0);
602+ twl->linkstat = MUSB_UNKNOWN;
603+ schedule_delayed_work(&twl->id_workaround_work, HZ);
599604 pm_runtime_mark_last_busy(twl->dev);
600605 pm_runtime_put_autosuspend(twl->dev);
601606
@@ -763,7 +768,8 @@ static int twl4030_usb_remove(struct platform_device *pdev) · 161 unmodified lines
763768 if (cable_present(twl->linkstat))
764769 pm_runtime_put_noidle(twl->dev);
765770 pm_runtime_mark_last_busy(twl->dev);
766− pm_runtime_put_sync_suspend(twl->dev);
771+ pm_runtime_dont_use_autosuspend(&pdev->dev);
772+ pm_runtime_put_sync(twl->dev);
767773 pm_runtime_disable(twl->dev);
768774
769775 /* autogate 60MHz ULPI clock,
drivers/platform/x86/Kconfig+4−6
@@ -103,7 +103,6 @@ config DELL_SMBIOS · 102 unmodified lines
103103
104104 config DELL_LAPTOP
105105 tristate "Dell Laptop Extras"
106− depends on X86
107106 depends on DELL_SMBIOS
108107 depends on DMI
109108 depends on BACKLIGHT_CLASS_DEVICE
@@ -505,7 +504,7 @@ config THINKPAD_ACPI_HOTKEY_POLL · 395 unmodified lines
505504
506505 config SENSORS_HDAPS
507506 tristate "Thinkpad Hard Drive Active Protection System (hdaps)"
508− depends on INPUT && X86
507+ depends on INPUT
509508 select INPUT_POLLDEV
510509 default n
511510 help
@@ -749,7 +748,7 @@ config TOSHIBA_WMI · 237 unmodified lines
749748
750749 config ACPI_CMPC
751750 tristate "CMPC Laptop Extras"
752− depends on X86 && ACPI
751+ depends on ACPI
753752 depends on RFKILL || RFKILL=n
754753 select INPUT
755754 select BACKLIGHT_CLASS_DEVICE
@@ -848,7 +847,7 @@ config INTEL_IMR · 92 unmodified lines
848847
849848 config INTEL_PMC_CORE
850849 bool "Intel PMC Core driver"
851− depends on X86 && PCI
850+ depends on PCI
852851 ---help---
853852 The Intel Platform Controller Hub for Intel Core SoCs provides access
854853 to Power Management Controller registers via a PCI interface. This
@@ -860,7 +859,7 @@ config INTEL_PMC_CORE · 5 unmodified lines
860859
861860 config IBM_RTL
862861 tristate "Device driver to enable PRTL support"
863− depends on X86 && PCI
862+ depends on PCI
864863 ---help---
865864 Enable support for IBM Premium Real Time Mode (PRTM).
866865 This module will allow you the enter and exit PRTM in the BIOS via
@@ -894,7 +893,6 @@ config XO15_EBOOK · 27 unmodified lines
894893
895894 config SAMSUNG_LAPTOP
896895 tristate "Samsung Laptop driver"
897− depends on X86
898896 depends on RFKILL || RFKILL = n
899897 depends on ACPI_VIDEO || ACPI_VIDEO = n
900898 depends on BACKLIGHT_CLASS_DEVICE
drivers/platform/x86/ideapad-laptop.c+2−0
@@ -567,6 +567,7 @@ static void ideapad_sysfs_exit(struct ideapad_private *priv) · 566 unmodified lines
567567 static const struct key_entry ideapad_keymap[] = {
568568 { KE_KEY, 6, { KEY_SWITCHVIDEOMODE } },
569569 { KE_KEY, 7, { KEY_CAMERA } },
570+ { KE_KEY, 8, { KEY_MICMUTE } },
570571 { KE_KEY, 11, { KEY_F16 } },
571572 { KE_KEY, 13, { KEY_WLAN } },
572573 { KE_KEY, 16, { KEY_PROG1 } },
@@ -809,6 +810,7 @@ static void ideapad_acpi_notify(acpi_handle handle, u32 event, void *data) · 236 unmodified lines
809810 break;
810811 case 13:
811812 case 11:
813+ case 8:
812814 case 7:
813815 case 6:
814816 ideapad_input_report(priv, vpc_bit);
drivers/platform/x86/thinkpad_acpi.c+63−24
@@ -2043,6 +2043,7 @@ static int hotkey_autosleep_ack; · 2042 unmodified lines
20432043
20442044 static u32 hotkey_orig_mask; /* events the BIOS had enabled */
20452045 static u32 hotkey_all_mask; /* all events supported in fw */
2046+static u32 hotkey_adaptive_all_mask; /* all adaptive events supported in fw */
20462047 static u32 hotkey_reserved_mask; /* events better left disabled */
20472048 static u32 hotkey_driver_mask; /* events needed by the driver */
20482049 static u32 hotkey_user_mask; /* events visible to userspace */
@@ -2742,6 +2743,17 @@ static ssize_t hotkey_all_mask_show(struct device *dev, · 693 unmodified lines
27422743
27432744 static DEVICE_ATTR_RO(hotkey_all_mask);
27442745
2746+/* sysfs hotkey all_mask ----------------------------------------------- */
2747+static ssize_t hotkey_adaptive_all_mask_show(struct device *dev,
2748+ struct device_attribute *attr,
2749+ char *buf)
2750+{
2751+ return snprintf(buf, PAGE_SIZE, "0x%08x\n",
2752+ hotkey_adaptive_all_mask | hotkey_source_mask);
2753+}
2754+
2755+static DEVICE_ATTR_RO(hotkey_adaptive_all_mask);
2756+
27452757 /* sysfs hotkey recommended_mask --------------------------------------- */
27462758 static ssize_t hotkey_recommended_mask_show(struct device *dev,
27472759 struct device_attribute *attr,
@@ -2985,6 +2997,7 @@ static struct attribute *hotkey_attributes[] __initdata = { · 237 unmodified lines
29852997 &dev_attr_wakeup_hotunplug_complete.attr,
29862998 &dev_attr_hotkey_mask.attr,
29872999 &dev_attr_hotkey_all_mask.attr,
3000+ &dev_attr_hotkey_adaptive_all_mask.attr,
29883001 &dev_attr_hotkey_recommended_mask.attr,
29893002 #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL
29903003 &dev_attr_hotkey_source_mask.attr,
@@ -3321,20 +3334,6 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) · 330 unmodified lines
33213334 if (!tp_features.hotkey)
33223335 return 1;
33233336
3324− /*
3325− * Check if we have an adaptive keyboard, like on the
3326− * Lenovo Carbon X1 2014 (2nd Gen).
3327− */
3328− if (acpi_evalf(hkey_handle, &hkeyv, "MHKV", "qd")) {
3329− if ((hkeyv >> 8) == 2) {
3330− tp_features.has_adaptive_kbd = true;
3331− res = sysfs_create_group(&tpacpi_pdev->dev.kobj,
3332− &adaptive_kbd_attr_group);
3333− if (res)
3334− goto err_exit;
3335− }
3336− }
3337−
33383337 quirks = tpacpi_check_quirks(tpacpi_hotkey_qtable,
33393338 ARRAY_SIZE(tpacpi_hotkey_qtable));
33403339
@@ -3357,30 +3356,70 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) · 16 unmodified lines
33573356 A30, R30, R31, T20-22, X20-21, X22-24. Detected by checking
33583357 for HKEY interface version 0x100 */
33593358 if (acpi_evalf(hkey_handle, &hkeyv, "MHKV", "qd")) {
3360− if ((hkeyv >> 8) != 1) {
3361− pr_err("unknown version of the HKEY interface: 0x%x\n",
3362− hkeyv);
3363− pr_err("please report this to %s\n", TPACPI_MAIL);
3364− } else {
3359+ vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
3360+ "firmware HKEY interface version: 0x%x\n",
3361+ hkeyv);
3362+
3363+ switch (hkeyv >> 8) {
3364+ case 1:
33653365 /*
33663366 * MHKV 0x100 in A31, R40, R40e,
33673367 * T4x, X31, and later
33683368 */
3369− vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
3370− "firmware HKEY interface version: 0x%x\n",
3371− hkeyv);
33723369
33733370 /* Paranoia check AND init hotkey_all_mask */
33743371 if (!acpi_evalf(hkey_handle, &hotkey_all_mask,
33753372 "MHKA", "qd")) {
3376− pr_err("missing MHKA handler, "
3377− "please report this to %s\n",
3373+ pr_err("missing MHKA handler, please report this to %s\n",
33783374 TPACPI_MAIL);
33793375 /* Fallback: pre-init for FN+F3,F4,F12 */
33803376 hotkey_all_mask = 0x080cU;
33813377 } else {
33823378 tp_features.hotkey_mask = 1;
33833379 }
3380+ break;
3381+
3382+ case 2:
3383+ /*
3384+ * MHKV 0x200 in X1, T460s, X260, T560, X1 Tablet (2016)
3385+ */
3386+
3387+ /* Paranoia check AND init hotkey_all_mask */
3388+ if (!acpi_evalf(hkey_handle, &hotkey_all_mask,
3389+ "MHKA", "dd", 1)) {
3390+ pr_err("missing MHKA handler, please report this to %s\n",
3391+ TPACPI_MAIL);
3392+ /* Fallback: pre-init for FN+F3,F4,F12 */
3393+ hotkey_all_mask = 0x080cU;
3394+ } else {
3395+ tp_features.hotkey_mask = 1;
3396+ }
3397+
3398+ /*
3399+ * Check if we have an adaptive keyboard, like on the
3400+ * Lenovo Carbon X1 2014 (2nd Gen).
3401+ */
3402+ if (acpi_evalf(hkey_handle, &hotkey_adaptive_all_mask,
3403+ "MHKA", "dd", 2)) {
3404+ if (hotkey_adaptive_all_mask != 0) {
3405+ tp_features.has_adaptive_kbd = true;
3406+ res = sysfs_create_group(
3407+ &tpacpi_pdev->dev.kobj,
3408+ &adaptive_kbd_attr_group);
3409+ if (res)
3410+ goto err_exit;
3411+ }
3412+ } else {
3413+ tp_features.has_adaptive_kbd = false;
3414+ hotkey_adaptive_all_mask = 0x0U;
3415+ }
3416+ break;
3417+
3418+ default:
3419+ pr_err("unknown version of the HKEY interface: 0x%x\n",
3420+ hkeyv);
3421+ pr_err("please report this to %s\n", TPACPI_MAIL);
3422+ break;
33843423 }
33853424 }
33863425
drivers/pwm/core.c+2−1
@@ -457,7 +457,8 @@ int pwm_apply_state(struct pwm_device *pwm, struct pwm_state *state) · 456 unmodified lines
457457 {
458458 int err;
459459
460− if (!pwm)
460+ if (!pwm || !state || !state->period ||
461+ state->duty_cycle > state->period)
461462 return -EINVAL;
462463
463464 if (!memcmp(state, &pwm->state, sizeof(*state)))
drivers/pwm/pwm-atmel-hlcdc.c+1−1
@@ -272,7 +272,7 @@ static int atmel_hlcdc_pwm_probe(struct platform_device *pdev) · 271 unmodified lines
272272 chip->chip.of_pwm_n_cells = 3;
273273 chip->chip.can_sleep = 1;
274274
275− ret = pwmchip_add(&chip->chip);
275+ ret = pwmchip_add_with_polarity(&chip->chip, PWM_POLARITY_INVERSED);
276276 if (ret) {
277277 clk_disable_unprepare(hlcdc->periph_clk);
278278 return ret;
drivers/pwm/sysfs.c+1−1
@@ -152,7 +152,7 @@ static ssize_t enable_store(struct device *child, · 151 unmodified lines
152152 goto unlock;
153153 }
154154
155− pwm_apply_state(pwm, &state);
155+ ret = pwm_apply_state(pwm, &state);
156156
157157 unlock:
158158 mutex_unlock(&export->lock);
drivers/regulator/qcom_smd-regulator.c+14−1
@@ -140,6 +140,19 @@ static const struct regulator_ops rpm_smps_ldo_ops = { · 139 unmodified lines
140140 .enable = rpm_reg_enable,
141141 .disable = rpm_reg_disable,
142142 .is_enabled = rpm_reg_is_enabled,
143+ .list_voltage = regulator_list_voltage_linear_range,
144+
145+ .get_voltage = rpm_reg_get_voltage,
146+ .set_voltage = rpm_reg_set_voltage,
147+
148+ .set_load = rpm_reg_set_load,
149+};
150+
151+static const struct regulator_ops rpm_smps_ldo_ops_fixed = {
152+ .enable = rpm_reg_enable,
153+ .disable = rpm_reg_disable,
154+ .is_enabled = rpm_reg_is_enabled,
155+ .list_voltage = regulator_list_voltage_linear_range,
143156
144157 .get_voltage = rpm_reg_get_voltage,
145158 .set_voltage = rpm_reg_set_voltage,
@@ -247,7 +260,7 @@ static const struct regulator_desc pm8941_nldo = { · 101 unmodified lines
247260 static const struct regulator_desc pm8941_lnldo = {
248261 .fixed_uV = 1740000,
249262 .n_voltages = 1,
250− .ops = &rpm_smps_ldo_ops,
263+ .ops = &rpm_smps_ldo_ops_fixed,
251264 };
252265
253266 static const struct regulator_desc pm8941_switch = {
drivers/regulator/tps51632-regulator.c+6−3
@@ -94,11 +94,14 @@ static int tps51632_dcdc_set_ramp_delay(struct regulator_dev *rdev, · 93 unmodified lines
9494 int ramp_delay)
9595 {
9696 struct tps51632_chip *tps = rdev_get_drvdata(rdev);
97− int bit = ramp_delay/6000;
97+ int bit;
9898 int ret;
9999
100− if (bit)
101− bit--;
100+ if (ramp_delay == 0)
101+ bit = 0;
102+ else
103+ bit = DIV_ROUND_UP(ramp_delay, 6000) - 1;
104+
102105 ret = regmap_write(tps->regmap, TPS51632_SLEW_REGS, BIT(bit));
103106 if (ret < 0)
104107 dev_err(tps->dev, "SLEW reg write failed, err %d\n", ret);
drivers/scsi/scsi_devinfo.c+1−0
@@ -230,6 +230,7 @@ static struct { · 229 unmodified lines
230230 {"PIONEER", "CD-ROM DRM-624X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
231231 {"Promise", "VTrak E610f", NULL, BLIST_SPARSELUN | BLIST_NO_RSOC},
232232 {"Promise", "", NULL, BLIST_SPARSELUN},
233+ {"QEMU", "QEMU CD-ROM", NULL, BLIST_SKIP_VPD_PAGES},
233234 {"QNAP", "iSCSI Storage", NULL, BLIST_MAX_1024},
234235 {"SYNOLOGY", "iSCSI Storage", NULL, BLIST_MAX_1024},
235236 {"QUANTUM", "XP34301", "1071", BLIST_NOTQ},
drivers/scsi/sd.c+4−4
@@ -2867,10 +2867,10 @@ static int sd_revalidate_disk(struct gendisk *disk) · 2866 unmodified lines
28672867 if (sdkp->opt_xfer_blocks &&
28682868 sdkp->opt_xfer_blocks <= dev_max &&
28692869 sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS &&
2870− sdkp->opt_xfer_blocks * sdp->sector_size >= PAGE_SIZE)
2871− rw_max = q->limits.io_opt =
2872− sdkp->opt_xfer_blocks * sdp->sector_size;
2873− else
2870+ logical_to_bytes(sdp, sdkp->opt_xfer_blocks) >= PAGE_SIZE) {
2871+ q->limits.io_opt = logical_to_bytes(sdp, sdkp->opt_xfer_blocks);
2872+ rw_max = logical_to_sectors(sdp, sdkp->opt_xfer_blocks);
2873+ } else
28742874 rw_max = BLK_DEF_MAX_SECTORS;
28752875
28762876 /* Combine with controller limits */
drivers/scsi/sd.h+5−0
@@ -151,6 +151,11 @@ static inline sector_t logical_to_sectors(struct scsi_device *sdev, sector_t blo · 150 unmodified lines
151151 return blocks << (ilog2(sdev->sector_size) - 9);
152152 }
153153
154+static inline unsigned int logical_to_bytes(struct scsi_device *sdev, sector_t blocks)
155+{
156+ return blocks * sdev->sector_size;
157+}
158+
154159 /*
155160 * A DIF-capable target device can be formatted with different
156161 * protection schemes. Currently 0 through 3 are defined:
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c+4−3
@@ -2525,12 +2525,13 @@ kiblnd_passive_connect(struct rdma_cm_id *cmid, void *priv, int priv_nob) · 2524 unmodified lines
25252525 return 0;
25262526
25272527 failed:
2528− if (ni)
2528+ if (ni) {
25292529 lnet_ni_decref(ni);
2530+ rej.ibr_cp.ibcp_queue_depth = kiblnd_msg_queue_size(version, ni);
2531+ rej.ibr_cp.ibcp_max_frags = kiblnd_rdma_frags(version, ni);
2532+ }
25302533
25312534 rej.ibr_version = version;
2532− rej.ibr_cp.ibcp_queue_depth = kiblnd_msg_queue_size(version, ni);
2533− rej.ibr_cp.ibcp_max_frags = kiblnd_rdma_frags(version, ni);
25342535 kiblnd_reject(cmid, &rej);
25352536
25362537 return -ECONNREFUSED;
drivers/staging/rtl8188eu/core/rtw_efuse.c+1−1
@@ -102,7 +102,7 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _size_byte, u8 *pbuf) · 101 unmodified lines
102102 if (!efuseTbl)
103103 return;
104104
105− eFuseWord = (u16 **)rtw_malloc2d(EFUSE_MAX_SECTION_88E, EFUSE_MAX_WORD_UNIT, sizeof(*eFuseWord));
105+ eFuseWord = (u16 **)rtw_malloc2d(EFUSE_MAX_SECTION_88E, EFUSE_MAX_WORD_UNIT, sizeof(u16));
106106 if (!eFuseWord) {
107107 DBG_88E("%s: alloc eFuseWord fail!\n", __func__);
108108 goto eFuseWord_failed;
drivers/staging/rtl8188eu/hal/usb_halinit.c+2−1
@@ -2072,7 +2072,8 @@ void rtl8188eu_set_hal_ops(struct adapter *adapt) · 2071 unmodified lines
20722072 {
20732073 struct hal_ops *halfunc = &adapt->HalFunc;
20742074
2075− adapt->HalData = kzalloc(sizeof(*adapt->HalData), GFP_KERNEL);
2075+
2076+ adapt->HalData = kzalloc(sizeof(struct hal_data_8188e), GFP_KERNEL);
20762077 if (!adapt->HalData)
20772078 DBG_88E("cant not alloc memory for HAL DATA\n");
20782079
drivers/thermal/cpu_cooling.c+8−8
@@ -857,14 +857,6 @@ __cpufreq_cooling_register(struct device_node *np, · 856 unmodified lines
857857 goto free_power_table;
858858 }
859859
860− snprintf(dev_name, sizeof(dev_name), "thermal-cpufreq-%d",
861− cpufreq_dev->id);
862−
863− cool_dev = thermal_of_cooling_device_register(np, dev_name, cpufreq_dev,
864− &cpufreq_cooling_ops);
865− if (IS_ERR(cool_dev))
866− goto remove_idr;
867−
868860 /* Fill freq-table in descending order of frequencies */
869861 for (i = 0, freq = -1; i <= cpufreq_dev->max_level; i++) {
870862 freq = find_next_max(table, freq);
@@ -877,6 +869,14 @@ __cpufreq_cooling_register(struct device_node *np, · 6 unmodified lines
877869 pr_debug("%s: freq:%u KHz\n", __func__, freq);
878870 }
879871
872+ snprintf(dev_name, sizeof(dev_name), "thermal-cpufreq-%d",
873+ cpufreq_dev->id);
874+
875+ cool_dev = thermal_of_cooling_device_register(np, dev_name, cpufreq_dev,
876+ &cpufreq_cooling_ops);
877+ if (IS_ERR(cool_dev))
878+ goto remove_idr;
879+
880880 cpufreq_dev->clipped_freq = cpufreq_dev->freq_table[0];
881881 cpufreq_dev->cool_dev = cool_dev;
882882
drivers/usb/core/quirks.c+13−10
@@ -44,6 +44,9 @@ static const struct usb_device_id usb_quirk_list[] = { · 43 unmodified lines
4444 /* Creative SB Audigy 2 NX */
4545 { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME },
4646
47+ /* USB3503 */
48+ { USB_DEVICE(0x0424, 0x3503), .driver_info = USB_QUIRK_RESET_RESUME },
49+
4750 /* Microsoft Wireless Laser Mouse 6000 Receiver */
4851 { USB_DEVICE(0x045e, 0x00e1), .driver_info = USB_QUIRK_RESET_RESUME },
4952
@@ -173,6 +176,10 @@ static const struct usb_device_id usb_quirk_list[] = { · 123 unmodified lines
173176 /* MAYA44USB sound device */
174177 { USB_DEVICE(0x0a92, 0x0091), .driver_info = USB_QUIRK_RESET_RESUME },
175178
179+ /* ASUS Base Station(T100) */
180+ { USB_DEVICE(0x0b05, 0x17e0), .driver_info =
181+ USB_QUIRK_IGNORE_REMOTE_WAKEUP },
182+
176183 /* Action Semiconductor flash disk */
177184 { USB_DEVICE(0x10d6, 0x2200), .driver_info =
178185 USB_QUIRK_STRING_FETCH_255 },
@@ -188,26 +195,22 @@ static const struct usb_device_id usb_quirk_list[] = { · 9 unmodified lines
188195 { USB_DEVICE(0x1908, 0x1315), .driver_info =
189196 USB_QUIRK_HONOR_BNUMINTERFACES },
190197
191− /* INTEL VALUE SSD */
192− { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
193−
194− /* USB3503 */
195− { USB_DEVICE(0x0424, 0x3503), .driver_info = USB_QUIRK_RESET_RESUME },
196−
197− /* ASUS Base Station(T100) */
198− { USB_DEVICE(0x0b05, 0x17e0), .driver_info =
199− USB_QUIRK_IGNORE_REMOTE_WAKEUP },
200−
201198 /* Protocol and OTG Electrical Test Device */
202199 { USB_DEVICE(0x1a0a, 0x0200), .driver_info =
203200 USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL },
204201
202+ /* Acer C120 LED Projector */
203+ { USB_DEVICE(0x1de1, 0xc102), .driver_info = USB_QUIRK_NO_LPM },
204+
205205 /* Blackmagic Design Intensity Shuttle */
206206 { USB_DEVICE(0x1edb, 0xbd3b), .driver_info = USB_QUIRK_NO_LPM },
207207
208208 /* Blackmagic Design UltraStudio SDI */
209209 { USB_DEVICE(0x1edb, 0xbd4f), .driver_info = USB_QUIRK_NO_LPM },
210210
211+ /* INTEL VALUE SSD */
212+ { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
213+
211214 { } /* terminating entry must be last */
212215 };
213216
drivers/usb/dwc2/core.h+27−0
@@ -64,6 +64,17 @@ · 63 unmodified lines
6464 DWC2_TRACE_SCHEDULER_VB(pr_fmt("%s: SCH: " fmt), \
6565 dev_name(hsotg->dev), ##__VA_ARGS__)
6666
67+#ifdef CONFIG_MIPS
68+/*
69+ * There are some MIPS machines that can run in either big-endian
70+ * or little-endian mode and that use the dwc2 register without
71+ * a byteswap in both ways.
72+ * Unlike other architectures, MIPS apparently does not require a
73+ * barrier before the __raw_writel() to synchronize with DMA but does
74+ * require the barrier after the __raw_writel() to serialize a set of
75+ * writes. This set of operations was added specifically for MIPS and
76+ * should only be used there.
77+ */
6778 static inline u32 dwc2_readl(const void __iomem *addr)
6879 {
6980 u32 value = __raw_readl(addr);
@@ -90,6 +101,22 @@ static inline void dwc2_writel(u32 value, void __iomem *addr) · 20 unmodified lines
90101 pr_info("INFO:: wrote %08x to %p\n", value, addr);
91102 #endif
92103 }
104+#else
105+/* Normal architectures just use readl/write */
106+static inline u32 dwc2_readl(const void __iomem *addr)
107+{
108+ return readl(addr);
109+}
110+
111+static inline void dwc2_writel(u32 value, void __iomem *addr)
112+{
113+ writel(value, addr);
114+
115+#ifdef DWC2_LOG_WRITES
116+ pr_info("info:: wrote %08x to %p\n", value, addr);
117+#endif
118+}
119+#endif
93120
94121 /* Maximum number of Endpoints/HostChannels */
95122 #define MAX_EPS_CHANNELS 16
drivers/usb/dwc2/gadget.c+20−4
@@ -1018,7 +1018,7 @@ static int dwc2_hsotg_process_req_status(struct dwc2_hsotg *hsotg, · 1017 unmodified lines
10181018 return 1;
10191019 }
10201020
1021−static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value);
1021+static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value, bool now);
10221022
10231023 /**
10241024 * get_ep_head - return the first request on the endpoint
@@ -1094,7 +1094,7 @@ static int dwc2_hsotg_process_req_feature(struct dwc2_hsotg *hsotg, · 69 unmodified lines
10941094 case USB_ENDPOINT_HALT:
10951095 halted = ep->halted;
10961096
1097− dwc2_hsotg_ep_sethalt(&ep->ep, set);
1097+ dwc2_hsotg_ep_sethalt(&ep->ep, set, true);
10981098
10991099 ret = dwc2_hsotg_send_reply(hsotg, ep0, NULL, 0);
11001100 if (ret) {
@@ -2948,8 +2948,13 @@ static int dwc2_hsotg_ep_dequeue(struct usb_ep *ep, struct usb_request *req) · 1847 unmodified lines
29482948 * dwc2_hsotg_ep_sethalt - set halt on a given endpoint
29492949 * @ep: The endpoint to set halt.
29502950 * @value: Set or unset the halt.
2951+ * @now: If true, stall the endpoint now. Otherwise return -EAGAIN if
2952+ * the endpoint is busy processing requests.
2953+ *
2954+ * We need to stall the endpoint immediately if request comes from set_feature
2955+ * protocol command handler.
29512956 */
2952−static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value)
2957+static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value, bool now)
29532958 {
29542959 struct dwc2_hsotg_ep *hs_ep = our_ep(ep);
29552960 struct dwc2_hsotg *hs = hs_ep->parent;
@@ -2969,6 +2974,17 @@ static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value) · 13 unmodified lines
29692974 return 0;
29702975 }
29712976
2977+ if (hs_ep->isochronous) {
2978+ dev_err(hs->dev, "%s is Isochronous Endpoint\n", ep->name);
2979+ return -EINVAL;
2980+ }
2981+
2982+ if (!now && value && !list_empty(&hs_ep->queue)) {
2983+ dev_dbg(hs->dev, "%s request is pending, cannot halt\n",
2984+ ep->name);
2985+ return -EAGAIN;
2986+ }
2987+
29722988 if (hs_ep->dir_in) {
29732989 epreg = DIEPCTL(index);
29742990 epctl = dwc2_readl(hs->regs + epreg);
@@ -3020,7 +3036,7 @@ static int dwc2_hsotg_ep_sethalt_lock(struct usb_ep *ep, int value) · 45 unmodified lines
30203036 int ret = 0;
30213037
30223038 spin_lock_irqsave(&hs->lock, flags);
3023− ret = dwc2_hsotg_ep_sethalt(ep, value);
3039+ ret = dwc2_hsotg_ep_sethalt(ep, value, false);
30243040 spin_unlock_irqrestore(&hs->lock, flags);
30253041
30263042 return ret;
drivers/usb/dwc3/core.h+1−0
@@ -402,6 +402,7 @@ · 401 unmodified lines
402402 #define DWC3_DEPCMD_GET_RSC_IDX(x) (((x) >> DWC3_DEPCMD_PARAM_SHIFT) & 0x7f)
403403 #define DWC3_DEPCMD_STATUS(x) (((x) >> 12) & 0x0F)
404404 #define DWC3_DEPCMD_HIPRI_FORCERM (1 << 11)
405+#define DWC3_DEPCMD_CLEARPENDIN (1 << 11)
405406 #define DWC3_DEPCMD_CMDACT (1 << 10)
406407 #define DWC3_DEPCMD_CMDIOC (1 << 8)
407408
drivers/usb/dwc3/dwc3-exynos.c+11−8
@@ -128,12 +128,6 @@ static int dwc3_exynos_probe(struct platform_device *pdev) · 127 unmodified lines
128128
129129 platform_set_drvdata(pdev, exynos);
130130
131− ret = dwc3_exynos_register_phys(exynos);
132− if (ret) {
133− dev_err(dev, "couldn't register PHYs\n");
134− return ret;
135− }
136−
137131 exynos->dev = dev;
138132
139133 exynos->clk = devm_clk_get(dev, "usbdrd30");
@@ -183,20 +177,29 @@ static int dwc3_exynos_probe(struct platform_device *pdev) · 43 unmodified lines
183177 goto err3;
184178 }
185179
180+ ret = dwc3_exynos_register_phys(exynos);
181+ if (ret) {
182+ dev_err(dev, "couldn't register PHYs\n");
183+ goto err4;
184+ }
185+
186186 if (node) {
187187 ret = of_platform_populate(node, NULL, NULL, dev);
188188 if (ret) {
189189 dev_err(dev, "failed to add dwc3 core\n");
190− goto err4;
190+ goto err5;
191191 }
192192 } else {
193193 dev_err(dev, "no device node, failed to add dwc3 core\n");
194194 ret = -ENODEV;
195− goto err4;
195+ goto err5;
196196 }
197197
198198 return 0;
199199
200+err5:
201+ platform_device_unregister(exynos->usb2_phy);
202+ platform_device_unregister(exynos->usb3_phy);
200203 err4:
201204 regulator_disable(exynos->vdd10);
202205 err3:
drivers/usb/dwc3/dwc3-st.c+8−2
@@ -129,12 +129,18 @@ static int st_dwc3_drd_init(struct st_dwc3 *dwc3_data) · 128 unmodified lines
129129 switch (dwc3_data->dr_mode) {
130130 case USB_DR_MODE_PERIPHERAL:
131131
132− val &= ~(USB3_FORCE_VBUSVALID | USB3_DELAY_VBUSVALID
132+ val &= ~(USB3_DELAY_VBUSVALID
133133 | USB3_SEL_FORCE_OPMODE | USB3_FORCE_OPMODE(0x3)
134134 | USB3_SEL_FORCE_DPPULLDOWN2 | USB3_FORCE_DPPULLDOWN2
135135 | USB3_SEL_FORCE_DMPULLDOWN2 | USB3_FORCE_DMPULLDOWN2);
136136
137− val |= USB3_DEVICE_NOT_HOST;
137+ /*
138+ * USB3_PORT2_FORCE_VBUSVALID When '1' and when
139+ * USB3_PORT2_DEVICE_NOT_HOST = 1, forces VBUSVLDEXT2 input
140+ * of the pico PHY to 1.
141+ */
142+
143+ val |= USB3_DEVICE_NOT_HOST | USB3_FORCE_VBUSVALID;
138144 break;
139145
140146 case USB_DR_MODE_HOST:
drivers/usb/dwc3/gadget.c+24−6
@@ -347,6 +347,28 @@ int dwc3_send_gadget_ep_cmd(struct dwc3 *dwc, unsigned ep, · 346 unmodified lines
347347 return ret;
348348 }
349349
350+static int dwc3_send_clear_stall_ep_cmd(struct dwc3_ep *dep)
351+{
352+ struct dwc3 *dwc = dep->dwc;
353+ struct dwc3_gadget_ep_cmd_params params;
354+ u32 cmd = DWC3_DEPCMD_CLEARSTALL;
355+
356+ /*
357+ * As of core revision 2.60a the recommended programming model
358+ * is to set the ClearPendIN bit when issuing a Clear Stall EP
359+ * command for IN endpoints. This is to prevent an issue where
360+ * some (non-compliant) hosts may not send ACK TPs for pending
361+ * IN transfers due to a mishandled error condition. Synopsys
362+ * STAR 9000614252.
363+ */
364+ if (dep->direction && (dwc->revision >= DWC3_REVISION_260A))
365+ cmd |= DWC3_DEPCMD_CLEARPENDIN;
366+
367+ memset(&params, 0, sizeof(params));
368+
369+ return dwc3_send_gadget_ep_cmd(dwc, dep->number, cmd, &params);
370+}
371+
350372 static dma_addr_t dwc3_trb_dma_offset(struct dwc3_ep *dep,
351373 struct dwc3_trb *trb)
352374 {
@@ -1314,8 +1336,7 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol) · 961 unmodified lines
13141336 else
13151337 dep->flags |= DWC3_EP_STALL;
13161338 } else {
1317− ret = dwc3_send_gadget_ep_cmd(dwc, dep->number,
1318− DWC3_DEPCMD_CLEARSTALL, &params);
1339+ ret = dwc3_send_clear_stall_ep_cmd(dep);
13191340 if (ret)
13201341 dev_err(dwc->dev, "failed to clear STALL on %s\n",
13211342 dep->name);
@@ -2247,7 +2268,6 @@ static void dwc3_clear_stall_all_ep(struct dwc3 *dwc) · 925 unmodified lines
22472268
22482269 for (epnum = 1; epnum < DWC3_ENDPOINTS_NUM; epnum++) {
22492270 struct dwc3_ep *dep;
2250− struct dwc3_gadget_ep_cmd_params params;
22512271 int ret;
22522272
22532273 dep = dwc->eps[epnum];
@@ -2259,9 +2279,7 @@ static void dwc3_clear_stall_all_ep(struct dwc3 *dwc) · 5 unmodified lines
22592279
22602280 dep->flags &= ~DWC3_EP_STALL;
22612281
2262− memset(&params, 0, sizeof(params));
2263− ret = dwc3_send_gadget_ep_cmd(dwc, dep->number,
2264− DWC3_DEPCMD_CLEARSTALL, &params);
2282+ ret = dwc3_send_clear_stall_ep_cmd(dep);
22652283 WARN_ON_ONCE(ret);
22662284 }
22672285 }
drivers/usb/gadget/composite.c+13−8
@@ -1868,14 +1868,19 @@ unknown: · 1867 unmodified lines
18681868 }
18691869 break;
18701870 }
1871− req->length = value;
1872− req->context = cdev;
1873− req->zero = value < w_length;
1874− value = composite_ep0_queue(cdev, req, GFP_ATOMIC);
1875− if (value < 0) {
1876− DBG(cdev, "ep_queue --> %d\n", value);
1877− req->status = 0;
1878− composite_setup_complete(gadget->ep0, req);
1871+
1872+ if (value >= 0) {
1873+ req->length = value;
1874+ req->context = cdev;
1875+ req->zero = value < w_length;
1876+ value = composite_ep0_queue(cdev, req,
1877+ GFP_ATOMIC);
1878+ if (value < 0) {
1879+ DBG(cdev, "ep_queue --> %d\n", value);
1880+ req->status = 0;
1881+ composite_setup_complete(gadget->ep0,
1882+ req);
1883+ }
18791884 }
18801885 return value;
18811886 }
drivers/usb/gadget/configfs.c+1−0
@@ -1401,6 +1401,7 @@ static const struct usb_gadget_driver configfs_driver_template = { · 1400 unmodified lines
14011401 .owner = THIS_MODULE,
14021402 .name = "configfs-gadget",
14031403 },
1404+ .match_existing_only = 1,
14041405 };
14051406
14061407 static struct config_group *gadgets_make(
drivers/usb/gadget/function/f_fs.c+15−15
@@ -2051,7 +2051,7 @@ static int __ffs_data_do_os_desc(enum ffs_os_desc_type type, · 2050 unmodified lines
20512051
20522052 if (len < sizeof(*d) ||
20532053 d->bFirstInterfaceNumber >= ffs->interfaces_count ||
2054− d->Reserved1)
2054+ !d->Reserved1)
20552055 return -EINVAL;
20562056 for (i = 0; i < ARRAY_SIZE(d->Reserved2); ++i)
20572057 if (d->Reserved2[i])
@@ -2729,6 +2729,7 @@ static int _ffs_func_bind(struct usb_configuration *c, · 671 unmodified lines
27292729 func->ffs->ss_descs_count;
27302730
27312731 int fs_len, hs_len, ss_len, ret, i;
2732+ struct ffs_ep *eps_ptr;
27322733
27332734 /* Make it a single chunk, less management later on */
27342735 vla_group(d);
@@ -2777,12 +2778,9 @@ static int _ffs_func_bind(struct usb_configuration *c, · 42 unmodified lines
27772778 ffs->raw_descs_length);
27782779
27792780 memset(vla_ptr(vlabuf, d, inums), 0xff, d_inums__sz);
2780− for (ret = ffs->eps_count; ret; --ret) {
2781− struct ffs_ep *ptr;
2782−
2783− ptr = vla_ptr(vlabuf, d, eps);
2784− ptr[ret].num = -1;
2785− }
2781+ eps_ptr = vla_ptr(vlabuf, d, eps);
2782+ for (i = 0; i < ffs->eps_count; i++)
2783+ eps_ptr[i].num = -1;
27862784
27872785 /* Save pointers
27882786 * d_eps == vlabuf, func->eps used to kfree vlabuf later
@@ -2851,7 +2849,7 @@ static int _ffs_func_bind(struct usb_configuration *c, · 62 unmodified lines
28512849 goto error;
28522850
28532851 func->function.os_desc_table = vla_ptr(vlabuf, d, os_desc_table);
2854− if (c->cdev->use_os_string)
2852+ if (c->cdev->use_os_string) {
28552853 for (i = 0; i < ffs->interfaces_count; ++i) {
28562854 struct usb_os_desc *desc;
28572855
@@ -2862,13 +2860,15 @@ static int _ffs_func_bind(struct usb_configuration *c, · 4 unmodified lines
28622860 vla_ptr(vlabuf, d, ext_compat) + i * 16;
28632861 INIT_LIST_HEAD(&desc->ext_prop);
28642862 }
2865− ret = ffs_do_os_descs(ffs->ms_os_descs_count,
2866− vla_ptr(vlabuf, d, raw_descs) +
2867− fs_len + hs_len + ss_len,
2868− d_raw_descs__sz - fs_len - hs_len - ss_len,
2869− __ffs_func_bind_do_os_desc, func);
2870− if (unlikely(ret < 0))
2871− goto error;
2863+ ret = ffs_do_os_descs(ffs->ms_os_descs_count,
2864+ vla_ptr(vlabuf, d, raw_descs) +
2865+ fs_len + hs_len + ss_len,
2866+ d_raw_descs__sz - fs_len - hs_len -
2867+ ss_len,
2868+ __ffs_func_bind_do_os_desc, func);
2869+ if (unlikely(ret < 0))
2870+ goto error;
2871+ }
28722872 func->function.os_desc_n =
28732873 c->cdev->use_os_string ? ffs->interfaces_count : 0;
28742874
drivers/usb/gadget/function/f_printer.c+0−8
@@ -161,14 +161,6 @@ static struct usb_endpoint_descriptor hs_ep_out_desc = { · 160 unmodified lines
161161 .wMaxPacketSize = cpu_to_le16(512)
162162 };
163163
164−static struct usb_qualifier_descriptor dev_qualifier = {
165− .bLength = sizeof(dev_qualifier),
166− .bDescriptorType = USB_DT_DEVICE_QUALIFIER,
167− .bcdUSB = cpu_to_le16(0x0200),
168− .bDeviceClass = USB_CLASS_PRINTER,
169− .bNumConfigurations = 1
170−};
171−
172164 static struct usb_descriptor_header *hs_printer_function[] = {
173165 (struct usb_descriptor_header *) &intf_desc,
174166 (struct usb_descriptor_header *) &hs_ep_in_desc,
drivers/usb/gadget/function/f_tcm.c+11−9
@@ -1445,16 +1445,18 @@ static void usbg_drop_tpg(struct se_portal_group *se_tpg) · 1444 unmodified lines
14451445 for (i = 0; i < TPG_INSTANCES; ++i)
14461446 if (tpg_instances[i].tpg == tpg)
14471447 break;
1448− if (i < TPG_INSTANCES)
1448+ if (i < TPG_INSTANCES) {
14491449 tpg_instances[i].tpg = NULL;
1450− opts = container_of(tpg_instances[i].func_inst,
1451− struct f_tcm_opts, func_inst);
1452− mutex_lock(&opts->dep_lock);
1453− if (opts->has_dep)
1454− module_put(opts->dependent);
1455− else
1456− configfs_undepend_item_unlocked(&opts->func_inst.group.cg_item);
1457− mutex_unlock(&opts->dep_lock);
1450+ opts = container_of(tpg_instances[i].func_inst,
1451+ struct f_tcm_opts, func_inst);
1452+ mutex_lock(&opts->dep_lock);
1453+ if (opts->has_dep)
1454+ module_put(opts->dependent);
1455+ else
1456+ configfs_undepend_item_unlocked(
1457+ &opts->func_inst.group.cg_item);
1458+ mutex_unlock(&opts->dep_lock);
1459+ }
14581460 mutex_unlock(&tpg_instances_lock);
14591461
14601462 kfree(tpg);
drivers/usb/gadget/function/f_uac2.c+1−12
@@ -598,18 +598,6 @@ static struct usb_gadget_strings *fn_strings[] = { · 597 unmodified lines
598598 NULL,
599599 };
600600
601−static struct usb_qualifier_descriptor devqual_desc = {
602− .bLength = sizeof devqual_desc,
603− .bDescriptorType = USB_DT_DEVICE_QUALIFIER,
604−
605− .bcdUSB = cpu_to_le16(0x200),
606− .bDeviceClass = USB_CLASS_MISC,
607− .bDeviceSubClass = 0x02,
608− .bDeviceProtocol = 0x01,
609− .bNumConfigurations = 1,
610− .bRESERVED = 0,
611−};
612−
613601 static struct usb_interface_assoc_descriptor iad_desc = {
614602 .bLength = sizeof iad_desc,
615603 .bDescriptorType = USB_DT_INTERFACE_ASSOCIATION,
@@ -1292,6 +1280,7 @@ in_rq_cur(struct usb_function *fn, const struct usb_ctrlrequest *cr) · 676 unmodified lines
12921280
12931281 if (control_selector == UAC2_CS_CONTROL_SAM_FREQ) {
12941282 struct cntrl_cur_lay3 c;
1283+ memset(&c, 0, sizeof(struct cntrl_cur_lay3));
12951284
12961285 if (entity_id == USB_IN_CLK_ID)
12971286 c.dCUR = p_srate;
drivers/usb/gadget/function/storage_common.c+1−3
@@ -83,9 +83,7 @@ EXPORT_SYMBOL_GPL(fsg_fs_function); · 82 unmodified lines
8383 * USB 2.0 devices need to expose both high speed and full speed
8484 * descriptors, unless they only run at full speed.
8585 *
86− * That means alternate endpoint descriptors (bigger packets)
87− * and a "device qualifier" ... plus more construction options
88− * for the configuration descriptor.
86+ * That means alternate endpoint descriptors (bigger packets).
8987 */
9088 struct usb_endpoint_descriptor fsg_hs_bulk_in_desc = {
9189 .bLength = USB_DT_ENDPOINT_SIZE,
drivers/usb/gadget/legacy/inode.c+13−4
@@ -938,8 +938,11 @@ ep0_read (struct file *fd, char __user *buf, size_t len, loff_t *ptr) · 937 unmodified lines
938938 struct usb_ep *ep = dev->gadget->ep0;
939939 struct usb_request *req = dev->req;
940940
941− if ((retval = setup_req (ep, req, 0)) == 0)
942− retval = usb_ep_queue (ep, req, GFP_ATOMIC);
941+ if ((retval = setup_req (ep, req, 0)) == 0) {
942+ spin_unlock_irq (&dev->lock);
943+ retval = usb_ep_queue (ep, req, GFP_KERNEL);
944+ spin_lock_irq (&dev->lock);
945+ }
943946 dev->state = STATE_DEV_CONNECTED;
944947
945948 /* assume that was SET_CONFIGURATION */
@@ -1457,8 +1460,11 @@ delegate: · 511 unmodified lines
14571460 w_length);
14581461 if (value < 0)
14591462 break;
1463+
1464+ spin_unlock (&dev->lock);
14601465 value = usb_ep_queue (gadget->ep0, dev->req,
1461− GFP_ATOMIC);
1466+ GFP_KERNEL);
1467+ spin_lock (&dev->lock);
14621468 if (value < 0) {
14631469 clean_req (gadget->ep0, dev->req);
14641470 break;
@@ -1481,11 +1487,14 @@ delegate: · 16 unmodified lines
14811487 if (value >= 0 && dev->state != STATE_DEV_SETUP) {
14821488 req->length = value;
14831489 req->zero = value < w_length;
1484− value = usb_ep_queue (gadget->ep0, req, GFP_ATOMIC);
1490+
1491+ spin_unlock (&dev->lock);
1492+ value = usb_ep_queue (gadget->ep0, req, GFP_KERNEL);
14851493 if (value < 0) {
14861494 DBG (dev, "ep_queue --> %d\n", value);
14871495 req->status = 0;
14881496 }
1497+ return value;
14891498 }
14901499
14911500 /* device stalls when value < 0 */
drivers/usb/gadget/udc/udc-core.c+8−4
@@ -603,11 +603,15 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver) · 602 unmodified lines
603603 }
604604 }
605605
606− list_add_tail(&driver->pending, &gadget_driver_pending_list);
607− pr_info("udc-core: couldn't find an available UDC - added [%s] to list of pending drivers\n",
608− driver->function);
606+ if (!driver->match_existing_only) {
607+ list_add_tail(&driver->pending, &gadget_driver_pending_list);
608+ pr_info("udc-core: couldn't find an available UDC - added [%s] to list of pending drivers\n",
609+ driver->function);
610+ ret = 0;
611+ }
612+
609613 mutex_unlock(&udc_lock);
610− return 0;
614+ return ret;
611615 found:
612616 ret = udc_bind_to_driver(udc, driver);
613617 mutex_unlock(&udc_lock);
drivers/usb/host/ehci-hcd.c+9−0
@@ -368,6 +368,15 @@ static void ehci_shutdown(struct usb_hcd *hcd) · 367 unmodified lines
368368 {
369369 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
370370
371+ /**
372+ * Protect the system from crashing at system shutdown in cases where
373+ * usb host is not added yet from OTG controller driver.
374+ * As ehci_setup() not done yet, so stop accessing registers or
375+ * variables initialized in ehci_setup()
376+ */
377+ if (!ehci->sbrn)
378+ return;
379+
371380 spin_lock_irq(&ehci->lock);
372381 ehci->shutdown = true;
373382 ehci->rh_state = EHCI_RH_STOPPING;
drivers/usb/host/ehci-hub.c+11−3
@@ -872,14 +872,22 @@ int ehci_hub_control( · 871 unmodified lines
872872 ) {
873873 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
874874 int ports = HCS_N_PORTS (ehci->hcs_params);
875− u32 __iomem *status_reg = &ehci->regs->port_status[
876− (wIndex & 0xff) - 1];
877− u32 __iomem *hostpc_reg = &ehci->regs->hostpc[(wIndex & 0xff) - 1];
875+ u32 __iomem *status_reg, *hostpc_reg;
878876 u32 temp, temp1, status;
879877 unsigned long flags;
880878 int retval = 0;
881879 unsigned selector;
882880
881+ /*
882+ * Avoid underflow while calculating (wIndex & 0xff) - 1.
883+ * The compiler might deduce that wIndex can never be 0 and then
884+ * optimize away the tests for !wIndex below.
885+ */
886+ temp = wIndex & 0xff;
887+ temp -= (temp > 0);
888+ status_reg = &ehci->regs->port_status[temp];
889+ hostpc_reg = &ehci->regs->hostpc[temp];
890+
883891 /*
884892 * FIXME: support SetPortFeatures USB_PORT_FEAT_INDICATOR.
885893 * HCS_INDICATOR may say we can change LEDs to off/amber/green.
drivers/usb/host/ehci-msm.c+12−2
@@ -179,22 +179,32 @@ static int ehci_msm_remove(struct platform_device *pdev) · 178 unmodified lines
179179 static int ehci_msm_pm_suspend(struct device *dev)
180180 {
181181 struct usb_hcd *hcd = dev_get_drvdata(dev);
182+ struct ehci_hcd *ehci = hcd_to_ehci(hcd);
182183 bool do_wakeup = device_may_wakeup(dev);
183184
184185 dev_dbg(dev, "ehci-msm PM suspend\n");
185186
186− return ehci_suspend(hcd, do_wakeup);
187+ /* Only call ehci_suspend if ehci_setup has been done */
188+ if (ehci->sbrn)
189+ return ehci_suspend(hcd, do_wakeup);
190+
191+ return 0;
187192 }
188193
189194 static int ehci_msm_pm_resume(struct device *dev)
190195 {
191196 struct usb_hcd *hcd = dev_get_drvdata(dev);
197+ struct ehci_hcd *ehci = hcd_to_ehci(hcd);
192198
193199 dev_dbg(dev, "ehci-msm PM resume\n");
194− ehci_resume(hcd, false);
200+
201+ /* Only call ehci_resume if ehci_setup has been done */
202+ if (ehci->sbrn)
203+ ehci_resume(hcd, false);
195204
196205 return 0;
197206 }
207+
198208 #else
199209 #define ehci_msm_pm_suspend NULL
200210 #define ehci_msm_pm_resume NULL
drivers/usb/host/ehci-tegra.c+13−3
@@ -81,15 +81,23 @@ static int tegra_reset_usb_controller(struct platform_device *pdev) · 80 unmodified lines
8181 struct usb_hcd *hcd = platform_get_drvdata(pdev);
8282 struct tegra_ehci_hcd *tegra =
8383 (struct tegra_ehci_hcd *)hcd_to_ehci(hcd)->priv;
84+ bool has_utmi_pad_registers = false;
8485
8586 phy_np = of_parse_phandle(pdev->dev.of_node, "nvidia,phy", 0);
8687 if (!phy_np)
8788 return -ENOENT;
8889
90+ if (of_property_read_bool(phy_np, "nvidia,has-utmi-pad-registers"))
91+ has_utmi_pad_registers = true;
92+
8993 if (!usb1_reset_attempted) {
9094 struct reset_control *usb1_reset;
9195
92− usb1_reset = of_reset_control_get(phy_np, "usb");
96+ if (!has_utmi_pad_registers)
97+ usb1_reset = of_reset_control_get(phy_np, "utmi-pads");
98+ else
99+ usb1_reset = tegra->rst;
100+
93101 if (IS_ERR(usb1_reset)) {
94102 dev_warn(&pdev->dev,
95103 "can't get utmi-pads reset from the PHY\n");
@@ -99,13 +107,15 @@ static int tegra_reset_usb_controller(struct platform_device *pdev) · 3 unmodified lines
99107 reset_control_assert(usb1_reset);
100108 udelay(1);
101109 reset_control_deassert(usb1_reset);
110+
111+ if (!has_utmi_pad_registers)
112+ reset_control_put(usb1_reset);
102113 }
103114
104− reset_control_put(usb1_reset);
105115 usb1_reset_attempted = true;
106116 }
107117
108− if (!of_property_read_bool(phy_np, "nvidia,has-utmi-pad-registers")) {
118+ if (!has_utmi_pad_registers) {
109119 reset_control_assert(tegra->rst);
110120 udelay(1);
111121 reset_control_deassert(tegra->rst);
drivers/usb/host/ohci-q.c+2−1
@@ -183,7 +183,6 @@ static int ed_schedule (struct ohci_hcd *ohci, struct ed *ed) · 182 unmodified lines
183183 {
184184 int branch;
185185
186− ed->state = ED_OPER;
187186 ed->ed_prev = NULL;
188187 ed->ed_next = NULL;
189188 ed->hwNextED = 0;
@@ -259,6 +258,8 @@ static int ed_schedule (struct ohci_hcd *ohci, struct ed *ed) · 69 unmodified lines
259258 /* the HC may not see the schedule updates yet, but if it does
260259 * then they'll be properly ordered.
261260 */
261+
262+ ed->state = ED_OPER;
262263 return 0;
263264 }
264265
drivers/usb/host/xhci-pci.c+5−0
@@ -37,6 +37,7 @@ · 36 unmodified lines
3737 /* Device for a quirk */
3838 #define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73
3939 #define PCI_DEVICE_ID_FRESCO_LOGIC_PDK 0x1000
40+#define PCI_DEVICE_ID_FRESCO_LOGIC_FL1009 0x1009
4041 #define PCI_DEVICE_ID_FRESCO_LOGIC_FL1400 0x1400
4142
4243 #define PCI_VENDOR_ID_ETRON 0x1b6f
@@ -114,6 +115,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) · 71 unmodified lines
114115 xhci->quirks |= XHCI_TRUST_TX_LENGTH;
115116 }
116117
118+ if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC &&
119+ pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1009)
120+ xhci->quirks |= XHCI_BROKEN_STREAMS;
121+
117122 if (pdev->vendor == PCI_VENDOR_ID_NEC)
118123 xhci->quirks |= XHCI_NEC_HOST;
119124
drivers/usb/host/xhci-plat.c+3−0
@@ -196,6 +196,9 @@ static int xhci_plat_probe(struct platform_device *pdev) · 195 unmodified lines
196196 ret = clk_prepare_enable(clk);
197197 if (ret)
198198 goto put_hcd;
199+ } else if (PTR_ERR(clk) == -EPROBE_DEFER) {
200+ ret = -EPROBE_DEFER;
201+ goto put_hcd;
199202 }
200203
201204 xhci = hcd_to_xhci(hcd);
drivers/usb/host/xhci-ring.c+24−6
@@ -290,6 +290,14 @@ static int xhci_abort_cmd_ring(struct xhci_hcd *xhci) · 289 unmodified lines
290290
291291 temp_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring);
292292 xhci->cmd_ring_state = CMD_RING_STATE_ABORTED;
293+
294+ /*
295+ * Writing the CMD_RING_ABORT bit should cause a cmd completion event,
296+ * however on some host hw the CMD_RING_RUNNING bit is correctly cleared
297+ * but the completion event in never sent. Use the cmd timeout timer to
298+ * handle those cases. Use twice the time to cover the bit polling retry
299+ */
300+ mod_timer(&xhci->cmd_timer, jiffies + (2 * XHCI_CMD_DEFAULT_TIMEOUT));
293301 xhci_write_64(xhci, temp_64 | CMD_RING_ABORT,
294302 &xhci->op_regs->cmd_ring);
295303
@@ -314,6 +322,7 @@ static int xhci_abort_cmd_ring(struct xhci_hcd *xhci) · 18 unmodified lines
314322
315323 xhci_err(xhci, "Stopped the command ring failed, "
316324 "maybe the host is dead\n");
325+ del_timer(&xhci->cmd_timer);
317326 xhci->xhc_state |= XHCI_STATE_DYING;
318327 xhci_quiesce(xhci);
319328 xhci_halt(xhci);
@@ -1246,22 +1255,21 @@ void xhci_handle_command_timeout(unsigned long data) · 926 unmodified lines
12461255 int ret;
12471256 unsigned long flags;
12481257 u64 hw_ring_state;
1249− struct xhci_command *cur_cmd = NULL;
1258+ bool second_timeout = false;
12501259 xhci = (struct xhci_hcd *) data;
12511260
12521261 /* mark this command to be cancelled */
12531262 spin_lock_irqsave(&xhci->lock, flags);
12541263 if (xhci->current_cmd) {
1255− cur_cmd = xhci->current_cmd;
1256− cur_cmd->status = COMP_CMD_ABORT;
1264+ if (xhci->current_cmd->status == COMP_CMD_ABORT)
1265+ second_timeout = true;
1266+ xhci->current_cmd->status = COMP_CMD_ABORT;
12571267 }
12581268
1259−
12601269 /* Make sure command ring is running before aborting it */
12611270 hw_ring_state = xhci_read_64(xhci, &xhci->op_regs->cmd_ring);
12621271 if ((xhci->cmd_ring_state & CMD_RING_STATE_RUNNING) &&
12631272 (hw_ring_state & CMD_RING_RUNNING)) {
1264−
12651273 spin_unlock_irqrestore(&xhci->lock, flags);
12661274 xhci_dbg(xhci, "Command timeout\n");
12671275 ret = xhci_abort_cmd_ring(xhci);
@@ -1273,6 +1281,15 @@ void xhci_handle_command_timeout(unsigned long data) · 5 unmodified lines
12731281 }
12741282 return;
12751283 }
1284+
1285+ /* command ring failed to restart, or host removed. Bail out */
1286+ if (second_timeout || xhci->xhc_state & XHCI_STATE_REMOVING) {
1287+ spin_unlock_irqrestore(&xhci->lock, flags);
1288+ xhci_dbg(xhci, "command timed out twice, ring start fail?\n");
1289+ xhci_cleanup_command_queue(xhci);
1290+ return;
1291+ }
1292+
12761293 /* command timeout on stopped ring, ring can't be aborted */
12771294 xhci_dbg(xhci, "Command timeout on stopped ring\n");
12781295 xhci_handle_stopped_cmd_ring(xhci, xhci->current_cmd);
@@ -2721,7 +2738,8 @@ hw_died: · 1442 unmodified lines
27212738 writel(irq_pending, &xhci->ir_set->irq_pending);
27222739 }
27232740
2724− if (xhci->xhc_state & XHCI_STATE_DYING) {
2741+ if (xhci->xhc_state & XHCI_STATE_DYING ||
2742+ xhci->xhc_state & XHCI_STATE_HALTED) {
27252743 xhci_dbg(xhci, "xHCI dying, ignoring interrupt. "
27262744 "Shouldn't IRQs be disabled?\n");
27272745 /* Clear the event handler busy flag (RW1C);
drivers/usb/host/xhci.c+16−13
@@ -685,20 +685,23 @@ void xhci_stop(struct usb_hcd *hcd) · 684 unmodified lines
685685 u32 temp;
686686 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
687687
688− if (xhci->xhc_state & XHCI_STATE_HALTED)
689− return;
690−
691688 mutex_lock(&xhci->mutex);
692− spin_lock_irq(&xhci->lock);
693− xhci->xhc_state |= XHCI_STATE_HALTED;
694− xhci->cmd_ring_state = CMD_RING_STATE_STOPPED;
695689
696− /* Make sure the xHC is halted for a USB3 roothub
697− * (xhci_stop() could be called as part of failed init).
698− */
699− xhci_halt(xhci);
700− xhci_reset(xhci);
701− spin_unlock_irq(&xhci->lock);
690+ if (!(xhci->xhc_state & XHCI_STATE_HALTED)) {
691+ spin_lock_irq(&xhci->lock);
692+
693+ xhci->xhc_state |= XHCI_STATE_HALTED;
694+ xhci->cmd_ring_state = CMD_RING_STATE_STOPPED;
695+ xhci_halt(xhci);
696+ xhci_reset(xhci);
697+
698+ spin_unlock_irq(&xhci->lock);
699+ }
700+
701+ if (!usb_hcd_is_primary_hcd(hcd)) {
702+ mutex_unlock(&xhci->mutex);
703+ return;
704+ }
702705
703706 xhci_cleanup_msix(xhci);
704707
@@ -4886,7 +4889,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) · 4181 unmodified lines
48864889 xhci->hcc_params2 = readl(&xhci->cap_regs->hcc_params2);
48874890 xhci_print_registers(xhci);
48884891
4889− xhci->quirks = quirks;
4892+ xhci->quirks |= quirks;
48904893
48914894 get_quirks(dev, xhci);
48924895
drivers/usb/musb/musb_core.c+37−48
@@ -1090,29 +1090,6 @@ void musb_stop(struct musb *musb) · 1089 unmodified lines
10901090 musb_platform_try_idle(musb, 0);
10911091 }
10921092
1093−static void musb_shutdown(struct platform_device *pdev)
1094−{
1095− struct musb *musb = dev_to_musb(&pdev->dev);
1096− unsigned long flags;
1097−
1098− pm_runtime_get_sync(musb->controller);
1099−
1100− musb_host_cleanup(musb);
1101− musb_gadget_cleanup(musb);
1102−
1103− spin_lock_irqsave(&musb->lock, flags);
1104− musb_platform_disable(musb);
1105− musb_generic_disable(musb);
1106− spin_unlock_irqrestore(&musb->lock, flags);
1107−
1108− musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
1109− musb_platform_exit(musb);
1110−
1111− pm_runtime_put(musb->controller);
1112− /* FIXME power down */
1113−}
1114−
1115−
11161093 /*-------------------------------------------------------------------------*/
11171094
11181095 /*
@@ -1702,7 +1679,7 @@ EXPORT_SYMBOL_GPL(musb_dma_completion); · 583 unmodified lines
17021679 #define use_dma 0
17031680 #endif
17041681
1705−static void (*musb_phy_callback)(enum musb_vbus_id_status status);
1682+static int (*musb_phy_callback)(enum musb_vbus_id_status status);
17061683
17071684 /*
17081685 * musb_mailbox - optional phy notifier function
@@ -1711,11 +1688,12 @@ static void (*musb_phy_callback)(enum musb_vbus_id_status status); · 2 unmodified lines
17111688 * Optionally gets called from the USB PHY. Note that the USB PHY must be
17121689 * disabled at the point the phy_callback is registered or unregistered.
17131690 */
1714−void musb_mailbox(enum musb_vbus_id_status status)
1691+int musb_mailbox(enum musb_vbus_id_status status)
17151692 {
17161693 if (musb_phy_callback)
1717− musb_phy_callback(status);
1694+ return musb_phy_callback(status);
17181695
1696+ return -ENODEV;
17191697 };
17201698 EXPORT_SYMBOL_GPL(musb_mailbox);
17211699
@@ -2028,11 +2006,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) · 306 unmodified lines
20282006 musb_readl = musb_default_readl;
20292007 musb_writel = musb_default_writel;
20302008
2031− /* We need musb_read/write functions initialized for PM */
2032− pm_runtime_use_autosuspend(musb->controller);
2033− pm_runtime_set_autosuspend_delay(musb->controller, 200);
2034− pm_runtime_enable(musb->controller);
2035−
20362009 /* The musb_platform_init() call:
20372010 * - adjusts musb->mregs
20382011 * - sets the musb->isr
@@ -2134,6 +2107,16 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) · 95 unmodified lines
21342107 if (musb->ops->phy_callback)
21352108 musb_phy_callback = musb->ops->phy_callback;
21362109
2110+ /*
2111+ * We need musb_read/write functions initialized for PM.
2112+ * Note that at least 2430 glue needs autosuspend delay
2113+ * somewhere above 300 ms for the hardware to idle properly
2114+ * after disconnecting the cable in host mode. Let's use
2115+ * 500 ms for some margin.
2116+ */
2117+ pm_runtime_use_autosuspend(musb->controller);
2118+ pm_runtime_set_autosuspend_delay(musb->controller, 500);
2119+ pm_runtime_enable(musb->controller);
21372120 pm_runtime_get_sync(musb->controller);
21382121
21392122 status = usb_phy_init(musb->xceiv);
@@ -2237,13 +2220,8 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) · 97 unmodified lines
22372220 if (status)
22382221 goto fail5;
22392222
2240− pm_runtime_put(musb->controller);
2241−
2242− /*
2243− * For why this is currently needed, see commit 3e43a0725637
2244− * ("usb: musb: core: add pm_runtime_irq_safe()")
2245− */
2246− pm_runtime_irq_safe(musb->controller);
2223+ pm_runtime_mark_last_busy(musb->controller);
2224+ pm_runtime_put_autosuspend(musb->controller);
22472225
22482226 return 0;
22492227
@@ -2265,7 +2243,9 @@ fail2_5: · 15 unmodified lines
22652243 usb_phy_shutdown(musb->xceiv);
22662244
22672245 err_usb_phy_init:
2246+ pm_runtime_dont_use_autosuspend(musb->controller);
22682247 pm_runtime_put_sync(musb->controller);
2248+ pm_runtime_disable(musb->controller);
22692249
22702250 fail2:
22712251 if (musb->irq_wake)
@@ -2273,7 +2253,6 @@ fail2: · 1 unmodified line
22732253 musb_platform_exit(musb);
22742254
22752255 fail1:
2276− pm_runtime_disable(musb->controller);
22772256 dev_err(musb->controller,
22782257 "musb_init_controller failed with status %d\n", status);
22792258
@@ -2312,6 +2291,7 @@ static int musb_remove(struct platform_device *pdev) · 32 unmodified lines
23122291 {
23132292 struct device *dev = &pdev->dev;
23142293 struct musb *musb = dev_to_musb(dev);
2294+ unsigned long flags;
23152295
23162296 /* this gets called on rmmod.
23172297 * - Host mode: host may still be active
@@ -2319,17 +2299,26 @@ static int musb_remove(struct platform_device *pdev) · 1 unmodified line
23192299 * - OTG mode: both roles are deactivated (or never-activated)
23202300 */
23212301 musb_exit_debugfs(musb);
2322− musb_shutdown(pdev);
2323− musb_phy_callback = NULL;
2324−
2325− if (musb->dma_controller)
2326− musb_dma_controller_destroy(musb->dma_controller);
2327−
2328− usb_phy_shutdown(musb->xceiv);
23292302
23302303 cancel_work_sync(&musb->irq_work);
23312304 cancel_delayed_work_sync(&musb->finish_resume_work);
23322305 cancel_delayed_work_sync(&musb->deassert_reset_work);
2306+ pm_runtime_get_sync(musb->controller);
2307+ musb_host_cleanup(musb);
2308+ musb_gadget_cleanup(musb);
2309+ spin_lock_irqsave(&musb->lock, flags);
2310+ musb_platform_disable(musb);
2311+ musb_generic_disable(musb);
2312+ spin_unlock_irqrestore(&musb->lock, flags);
2313+ musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
2314+ pm_runtime_dont_use_autosuspend(musb->controller);
2315+ pm_runtime_put_sync(musb->controller);
2316+ pm_runtime_disable(musb->controller);
2317+ musb_platform_exit(musb);
2318+ musb_phy_callback = NULL;
2319+ if (musb->dma_controller)
2320+ musb_dma_controller_destroy(musb->dma_controller);
2321+ usb_phy_shutdown(musb->xceiv);
23332322 musb_free(musb);
23342323 device_init_wakeup(dev, 0);
23352324 return 0;
@@ -2429,7 +2418,8 @@ static void musb_restore_context(struct musb *musb) · 93 unmodified lines
24292418 musb_writew(musb_base, MUSB_INTRTXE, musb->intrtxe);
24302419 musb_writew(musb_base, MUSB_INTRRXE, musb->intrrxe);
24312420 musb_writeb(musb_base, MUSB_INTRUSBE, musb->context.intrusbe);
2432− musb_writeb(musb_base, MUSB_DEVCTL, musb->context.devctl);
2421+ if (musb->context.devctl & MUSB_DEVCTL_SESSION)
2422+ musb_writeb(musb_base, MUSB_DEVCTL, musb->context.devctl);
24332423
24342424 for (i = 0; i < musb->config->num_eps; ++i) {
24352425 struct musb_hw_ep *hw_ep;
@@ -2612,7 +2602,6 @@ static struct platform_driver musb_driver = { · 176 unmodified lines
26122602 },
26132603 .probe = musb_probe,
26142604 .remove = musb_remove,
2615− .shutdown = musb_shutdown,
26162605 };
26172606
26182607 module_platform_driver(musb_driver);
drivers/usb/musb/musb_core.h+2−1
@@ -215,7 +215,7 @@ struct musb_platform_ops { · 214 unmodified lines
215215 dma_addr_t *dma_addr, u32 *len);
216216 void (*pre_root_reset_end)(struct musb *musb);
217217 void (*post_root_reset_end)(struct musb *musb);
218− void (*phy_callback)(enum musb_vbus_id_status status);
218+ int (*phy_callback)(enum musb_vbus_id_status status);
219219 };
220220
221221 /*
@@ -312,6 +312,7 @@ struct musb { · 90 unmodified lines
312312 struct work_struct irq_work;
313313 struct delayed_work deassert_reset_work;
314314 struct delayed_work finish_resume_work;
315+ struct delayed_work gadget_work;
315316 u16 hwvers;
316317
317318 u16 intrrxe;
drivers/usb/musb/musb_gadget.c+23−11
@@ -1656,6 +1656,20 @@ static int musb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA) · 1655 unmodified lines
16561656 return usb_phy_set_power(musb->xceiv, mA);
16571657 }
16581658
1659+static void musb_gadget_work(struct work_struct *work)
1660+{
1661+ struct musb *musb;
1662+ unsigned long flags;
1663+
1664+ musb = container_of(work, struct musb, gadget_work.work);
1665+ pm_runtime_get_sync(musb->controller);
1666+ spin_lock_irqsave(&musb->lock, flags);
1667+ musb_pullup(musb, musb->softconnect);
1668+ spin_unlock_irqrestore(&musb->lock, flags);
1669+ pm_runtime_mark_last_busy(musb->controller);
1670+ pm_runtime_put_autosuspend(musb->controller);
1671+}
1672+
16591673 static int musb_gadget_pullup(struct usb_gadget *gadget, int is_on)
16601674 {
16611675 struct musb *musb = gadget_to_musb(gadget);
@@ -1663,20 +1677,16 @@ static int musb_gadget_pullup(struct usb_gadget *gadget, int is_on) · 1 unmodified line
16631677
16641678 is_on = !!is_on;
16651679
1666− pm_runtime_get_sync(musb->controller);
1667−
16681680 /* NOTE: this assumes we are sensing vbus; we'd rather
16691681 * not pullup unless the B-session is active.
16701682 */
16711683 spin_lock_irqsave(&musb->lock, flags);
16721684 if (is_on != musb->softconnect) {
16731685 musb->softconnect = is_on;
1674− musb_pullup(musb, is_on);
1686+ schedule_delayed_work(&musb->gadget_work, 0);
16751687 }
16761688 spin_unlock_irqrestore(&musb->lock, flags);
16771689
1678− pm_runtime_put(musb->controller);
1679−
16801690 return 0;
16811691 }
16821692
@@ -1845,7 +1855,7 @@ int musb_gadget_setup(struct musb *musb) · 162 unmodified lines
18451855 #elif IS_ENABLED(CONFIG_USB_MUSB_GADGET)
18461856 musb->g.is_otg = 0;
18471857 #endif
1848−
1858+ INIT_DELAYED_WORK(&musb->gadget_work, musb_gadget_work);
18491859 musb_g_init_endpoints(musb);
18501860
18511861 musb->is_active = 0;
@@ -1866,6 +1876,8 @@ void musb_gadget_cleanup(struct musb *musb) · 14 unmodified lines
18661876 {
18671877 if (musb->port_mode == MUSB_PORT_MODE_HOST)
18681878 return;
1879+
1880+ cancel_delayed_work_sync(&musb->gadget_work);
18691881 usb_del_gadget_udc(&musb->g);
18701882 }
18711883
@@ -1914,8 +1926,8 @@ static int musb_gadget_start(struct usb_gadget *g, · 42 unmodified lines
19141926 if (musb->xceiv->last_event == USB_EVENT_ID)
19151927 musb_platform_set_vbus(musb, 1);
19161928
1917− if (musb->xceiv->last_event == USB_EVENT_NONE)
1918− pm_runtime_put(musb->controller);
1929+ pm_runtime_mark_last_busy(musb->controller);
1930+ pm_runtime_put_autosuspend(musb->controller);
19191931
19201932 return 0;
19211933
@@ -1934,8 +1946,7 @@ static int musb_gadget_stop(struct usb_gadget *g) · 12 unmodified lines
19341946 struct musb *musb = gadget_to_musb(g);
19351947 unsigned long flags;
19361948
1937− if (musb->xceiv->last_event == USB_EVENT_NONE)
1938− pm_runtime_get_sync(musb->controller);
1949+ pm_runtime_get_sync(musb->controller);
19391950
19401951 /*
19411952 * REVISIT always use otg_set_peripheral() here too;
@@ -1963,7 +1974,8 @@ static int musb_gadget_stop(struct usb_gadget *g) · 21 unmodified lines
19631974 * that currently misbehaves.
19641975 */
19651976
1966− pm_runtime_put(musb->controller);
1977+ pm_runtime_mark_last_busy(musb->controller);
1978+ pm_runtime_put_autosuspend(musb->controller);
19671979
19681980 return 0;
19691981 }
drivers/usb/musb/musb_host.c+37−31
@@ -434,7 +434,13 @@ static void musb_advance_schedule(struct musb *musb, struct urb *urb, · 433 unmodified lines
434434 }
435435 }
436436
437− if (qh != NULL && qh->is_ready) {
437+ /*
438+ * The pipe must be broken if current urb->status is set, so don't
439+ * start next urb.
440+ * TODO: to minimize the risk of regression, only check urb->status
441+ * for RX, until we have a test case to understand the behavior of TX.
442+ */
443+ if ((!status || !is_in) && qh && qh->is_ready) {
438444 dev_dbg(musb->controller, "... next ep%d %cX urb %p\n",
439445 hw_ep->epnum, is_in ? 'R' : 'T', next_urb(qh));
440446 musb_start_urb(musb, is_in, qh);
@@ -594,14 +600,13 @@ musb_rx_reinit(struct musb *musb, struct musb_qh *qh, u8 epnum) · 153 unmodified lines
594600 musb_writew(ep->regs, MUSB_TXCSR, 0);
595601
596602 /* scrub all previous state, clearing toggle */
597− } else {
598− csr = musb_readw(ep->regs, MUSB_RXCSR);
599− if (csr & MUSB_RXCSR_RXPKTRDY)
600− WARNING("rx%d, packet/%d ready?\n", ep->epnum,
601− musb_readw(ep->regs, MUSB_RXCOUNT));
602−
603− musb_h_flush_rxfifo(ep, MUSB_RXCSR_CLRDATATOG);
604603 }
604+ csr = musb_readw(ep->regs, MUSB_RXCSR);
605+ if (csr & MUSB_RXCSR_RXPKTRDY)
606+ WARNING("rx%d, packet/%d ready?\n", ep->epnum,
607+ musb_readw(ep->regs, MUSB_RXCOUNT));
608+
609+ musb_h_flush_rxfifo(ep, MUSB_RXCSR_CLRDATATOG);
605610
606611 /* target addr and (for multipoint) hub addr/port */
607612 if (musb->is_multipoint) {
@@ -627,7 +632,7 @@ musb_rx_reinit(struct musb *musb, struct musb_qh *qh, u8 epnum) · 19 unmodified lines
627632 ep->rx_reinit = 0;
628633 }
629634
630−static int musb_tx_dma_set_mode_mentor(struct dma_controller *dma,
635+static void musb_tx_dma_set_mode_mentor(struct dma_controller *dma,
631636 struct musb_hw_ep *hw_ep, struct musb_qh *qh,
632637 struct urb *urb, u32 offset,
633638 u32 *length, u8 *mode)
@@ -664,23 +669,18 @@ static int musb_tx_dma_set_mode_mentor(struct dma_controller *dma, · 30 unmodified lines
664669 }
665670 channel->desired_mode = *mode;
666671 musb_writew(epio, MUSB_TXCSR, csr);
667−
668− return 0;
669672 }
670673
671−static int musb_tx_dma_set_mode_cppi_tusb(struct dma_controller *dma,
672− struct musb_hw_ep *hw_ep,
673− struct musb_qh *qh,
674− struct urb *urb,
675− u32 offset,
676− u32 *length,
677− u8 *mode)
674+static void musb_tx_dma_set_mode_cppi_tusb(struct dma_controller *dma,
675+ struct musb_hw_ep *hw_ep,
676+ struct musb_qh *qh,
677+ struct urb *urb,
678+ u32 offset,
679+ u32 *length,
680+ u8 *mode)
678681 {
679682 struct dma_channel *channel = hw_ep->tx_channel;
680683
681− if (!is_cppi_enabled(hw_ep->musb) && !tusb_dma_omap(hw_ep->musb))
682− return -ENODEV;
683−
684684 channel->actual_len = 0;
685685
686686 /*
@@ -688,8 +688,6 @@ static int musb_tx_dma_set_mode_cppi_tusb(struct dma_controller *dma, · 1 unmodified line
688688 * to identify the zero-length-final-packet case.
689689 */
690690 *mode = (urb->transfer_flags & URB_ZERO_PACKET) ? 1 : 0;
691−
692− return 0;
693691 }
694692
695693 static bool musb_tx_dma_program(struct dma_controller *dma,
@@ -699,15 +697,14 @@ static bool musb_tx_dma_program(struct dma_controller *dma, · 3 unmodified lines
699697 struct dma_channel *channel = hw_ep->tx_channel;
700698 u16 pkt_size = qh->maxpacket;
701699 u8 mode;
702− int res;
703700
704701 if (musb_dma_inventra(hw_ep->musb) || musb_dma_ux500(hw_ep->musb))
705− res = musb_tx_dma_set_mode_mentor(dma, hw_ep, qh, urb,
706− offset, &length, &mode);
702+ musb_tx_dma_set_mode_mentor(dma, hw_ep, qh, urb, offset,
703+ &length, &mode);
704+ else if (is_cppi_enabled(hw_ep->musb) || tusb_dma_omap(hw_ep->musb))
705+ musb_tx_dma_set_mode_cppi_tusb(dma, hw_ep, qh, urb, offset,
706+ &length, &mode);
707707 else
708− res = musb_tx_dma_set_mode_cppi_tusb(dma, hw_ep, qh, urb,
709− offset, &length, &mode);
710− if (res)
711708 return false;
712709
713710 qh->segsize = length;
@@ -995,9 +992,15 @@ static void musb_bulk_nak_timeout(struct musb *musb, struct musb_hw_ep *ep, · 281 unmodified lines
995992 if (is_in) {
996993 dma = is_dma_capable() ? ep->rx_channel : NULL;
997994
998− /* clear nak timeout bit */
995+ /*
996+ * Need to stop the transaction by clearing REQPKT first
997+ * then the NAK Timeout bit ref MUSBMHDRC USB 2.0 HIGH-SPEED
998+ * DUAL-ROLE CONTROLLER Programmer's Guide, section 9.2.2
999+ */
9991000 rx_csr = musb_readw(epio, MUSB_RXCSR);
10001001 rx_csr |= MUSB_RXCSR_H_WZC_BITS;
1002+ rx_csr &= ~MUSB_RXCSR_H_REQPKT;
1003+ musb_writew(epio, MUSB_RXCSR, rx_csr);
10011004 rx_csr &= ~MUSB_RXCSR_DATAERROR;
10021005 musb_writew(epio, MUSB_RXCSR, rx_csr);
10031006
@@ -1551,7 +1554,7 @@ static int musb_rx_dma_iso_cppi41(struct dma_controller *dma, · 547 unmodified lines
15511554 struct urb *urb,
15521555 size_t len)
15531556 {
1554− struct dma_channel *channel = hw_ep->tx_channel;
1557+ struct dma_channel *channel = hw_ep->rx_channel;
15551558 void __iomem *epio = hw_ep->regs;
15561559 dma_addr_t *buf;
15571560 u32 length, res;
@@ -1870,6 +1873,9 @@ void musb_host_rx(struct musb *musb, u8 epnum) · 312 unmodified lines
18701873 status = -EPROTO;
18711874 musb_writeb(epio, MUSB_RXINTERVAL, 0);
18721875
1876+ rx_csr &= ~MUSB_RXCSR_H_ERROR;
1877+ musb_writew(epio, MUSB_RXCSR, rx_csr);
1878+
18731879 } else if (rx_csr & MUSB_RXCSR_DATAERROR) {
18741880
18751881 if (USB_ENDPOINT_XFER_ISOC != qh->type) {
drivers/usb/musb/omap2430.c+89−168
@@ -49,97 +49,14 @@ struct omap2430_glue { · 48 unmodified lines
4949 enum musb_vbus_id_status status;
5050 struct work_struct omap_musb_mailbox_work;
5151 struct device *control_otghs;
52+ bool cable_connected;
53+ bool enabled;
54+ bool powered;
5255 };
5356 #define glue_to_musb(g) platform_get_drvdata(g->musb)
5457
5558 static struct omap2430_glue *_glue;
5659
57−static struct timer_list musb_idle_timer;
58−
59−static void musb_do_idle(unsigned long _musb)
60−{
61− struct musb *musb = (void *)_musb;
62− unsigned long flags;
63− u8 power;
64− u8 devctl;
65−
66− spin_lock_irqsave(&musb->lock, flags);
67−
68− switch (musb->xceiv->otg->state) {
69− case OTG_STATE_A_WAIT_BCON:
70−
71− devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
72− if (devctl & MUSB_DEVCTL_BDEVICE) {
73− musb->xceiv->otg->state = OTG_STATE_B_IDLE;
74− MUSB_DEV_MODE(musb);
75− } else {
76− musb->xceiv->otg->state = OTG_STATE_A_IDLE;
77− MUSB_HST_MODE(musb);
78− }
79− break;
80− case OTG_STATE_A_SUSPEND:
81− /* finish RESUME signaling? */
82− if (musb->port1_status & MUSB_PORT_STAT_RESUME) {
83− power = musb_readb(musb->mregs, MUSB_POWER);
84− power &= ~MUSB_POWER_RESUME;
85− dev_dbg(musb->controller, "root port resume stopped, power %02x\n", power);
86− musb_writeb(musb->mregs, MUSB_POWER, power);
87− musb->is_active = 1;
88− musb->port1_status &= ~(USB_PORT_STAT_SUSPEND
89− | MUSB_PORT_STAT_RESUME);
90− musb->port1_status |= USB_PORT_STAT_C_SUSPEND << 16;
91− usb_hcd_poll_rh_status(musb->hcd);
92− /* NOTE: it might really be A_WAIT_BCON ... */
93− musb->xceiv->otg->state = OTG_STATE_A_HOST;
94− }
95− break;
96− case OTG_STATE_A_HOST:
97− devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
98− if (devctl & MUSB_DEVCTL_BDEVICE)
99− musb->xceiv->otg->state = OTG_STATE_B_IDLE;
100− else
101− musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON;
102− default:
103− break;
104− }
105− spin_unlock_irqrestore(&musb->lock, flags);
106−}
107−
108−
109−static void omap2430_musb_try_idle(struct musb *musb, unsigned long timeout)
110−{
111− unsigned long default_timeout = jiffies + msecs_to_jiffies(3);
112− static unsigned long last_timer;
113−
114− if (timeout == 0)
115− timeout = default_timeout;
116−
117− /* Never idle if active, or when VBUS timeout is not set as host */
118− if (musb->is_active || ((musb->a_wait_bcon == 0)
119− && (musb->xceiv->otg->state == OTG_STATE_A_WAIT_BCON))) {
120− dev_dbg(musb->controller, "%s active, deleting timer\n",
121− usb_otg_state_string(musb->xceiv->otg->state));
122− del_timer(&musb_idle_timer);
123− last_timer = jiffies;
124− return;
125− }
126−
127− if (time_after(last_timer, timeout)) {
128− if (!timer_pending(&musb_idle_timer))
129− last_timer = timeout;
130− else {
131− dev_dbg(musb->controller, "Longer idle timer already pending, ignoring\n");
132− return;
133− }
134− }
135− last_timer = timeout;
136−
137− dev_dbg(musb->controller, "%s inactive, for idle timer for %lu ms\n",
138− usb_otg_state_string(musb->xceiv->otg->state),
139− (unsigned long)jiffies_to_msecs(timeout - jiffies));
140− mod_timer(&musb_idle_timer, timeout);
141−}
142−
14360 static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
14461 {
14562 struct usb_otg *otg = musb->xceiv->otg;
@@ -205,16 +122,6 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on) · 59 unmodified lines
205122 musb_readb(musb->mregs, MUSB_DEVCTL));
206123 }
207124
208−static int omap2430_musb_set_mode(struct musb *musb, u8 musb_mode)
209−{
210− u8 devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
211−
212− devctl |= MUSB_DEVCTL_SESSION;
213− musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
214−
215− return 0;
216−}
217−
218125 static inline void omap2430_low_level_exit(struct musb *musb)
219126 {
220127 u32 l;
@@ -234,22 +141,63 @@ static inline void omap2430_low_level_init(struct musb *musb) · 13 unmodified lines
234141 musb_writel(musb->mregs, OTG_FORCESTDBY, l);
235142 }
236143
237−static void omap2430_musb_mailbox(enum musb_vbus_id_status status)
144+/*
145+ * We can get multiple cable events so we need to keep track
146+ * of the power state. Only keep power enabled if USB cable is
147+ * connected and a gadget is started.
148+ */
149+static void omap2430_set_power(struct musb *musb, bool enabled, bool cable)
150+{
151+ struct device *dev = musb->controller;
152+ struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
153+ bool power_up;
154+ int res;
155+
156+ if (glue->enabled != enabled)
157+ glue->enabled = enabled;
158+
159+ if (glue->cable_connected != cable)
160+ glue->cable_connected = cable;
161+
162+ power_up = glue->enabled && glue->cable_connected;
163+ if (power_up == glue->powered) {
164+ dev_warn(musb->controller, "power state already %i\n",
165+ power_up);
166+ return;
167+ }
168+
169+ glue->powered = power_up;
170+
171+ if (power_up) {
172+ res = pm_runtime_get_sync(musb->controller);
173+ if (res < 0) {
174+ dev_err(musb->controller, "could not enable: %i", res);
175+ glue->powered = false;
176+ }
177+ } else {
178+ pm_runtime_mark_last_busy(musb->controller);
179+ pm_runtime_put_autosuspend(musb->controller);
180+ }
181+}
182+
183+static int omap2430_musb_mailbox(enum musb_vbus_id_status status)
238184 {
239185 struct omap2430_glue *glue = _glue;
240186
241187 if (!glue) {
242188 pr_err("%s: musb core is not yet initialized\n", __func__);
243− return;
189+ return -EPROBE_DEFER;
244190 }
245191 glue->status = status;
246192
247193 if (!glue_to_musb(glue)) {
248194 pr_err("%s: musb core is not yet ready\n", __func__);
249− return;
195+ return -EPROBE_DEFER;
250196 }
251197
252198 schedule_work(&glue->omap_musb_mailbox_work);
199+
200+ return 0;
253201 }
254202
255203 static void omap_musb_set_mailbox(struct omap2430_glue *glue)
@@ -259,6 +207,13 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue) · 3 unmodified lines
259207 struct musb_hdrc_platform_data *pdata = dev_get_platdata(dev);
260208 struct omap_musb_board_data *data = pdata->board_data;
261209 struct usb_otg *otg = musb->xceiv->otg;
210+ bool cable_connected;
211+
212+ cable_connected = ((glue->status == MUSB_ID_GROUND) ||
213+ (glue->status == MUSB_VBUS_VALID));
214+
215+ if (cable_connected)
216+ omap2430_set_power(musb, glue->enabled, cable_connected);
262217
263218 switch (glue->status) {
264219 case MUSB_ID_GROUND:
@@ -268,7 +223,6 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue) · 3 unmodified lines
268223 musb->xceiv->otg->state = OTG_STATE_A_IDLE;
269224 musb->xceiv->last_event = USB_EVENT_ID;
270225 if (musb->gadget_driver) {
271− pm_runtime_get_sync(dev);
272226 omap_control_usb_set_mode(glue->control_otghs,
273227 USB_MODE_HOST);
274228 omap2430_musb_set_vbus(musb, 1);
@@ -281,8 +235,6 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue) · 6 unmodified lines
281235 otg->default_a = false;
282236 musb->xceiv->otg->state = OTG_STATE_B_IDLE;
283237 musb->xceiv->last_event = USB_EVENT_VBUS;
284− if (musb->gadget_driver)
285− pm_runtime_get_sync(dev);
286238 omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE);
287239 break;
288240
@@ -291,11 +243,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue) · 2 unmodified lines
291243 dev_dbg(dev, "VBUS Disconnect\n");
292244
293245 musb->xceiv->last_event = USB_EVENT_NONE;
294− if (musb->gadget_driver) {
246+ if (musb->gadget_driver)
295247 omap2430_musb_set_vbus(musb, 0);
296− pm_runtime_mark_last_busy(dev);
297− pm_runtime_put_autosuspend(dev);
298− }
299248
300249 if (data->interface_type == MUSB_INTERFACE_UTMI)
301250 otg_set_vbus(musb->xceiv->otg, 0);
@@ -307,6 +256,9 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue) · 5 unmodified lines
307256 dev_dbg(dev, "ID float\n");
308257 }
309258
259+ if (!cable_connected)
260+ omap2430_set_power(musb, glue->enabled, cable_connected);
261+
310262 atomic_notifier_call_chain(&musb->xceiv->notifier,
311263 musb->xceiv->last_event, NULL);
312264 }
@@ -316,13 +268,8 @@ static void omap_musb_mailbox_work(struct work_struct *mailbox_work) · 3 unmodified lines
316268 {
317269 struct omap2430_glue *glue = container_of(mailbox_work,
318270 struct omap2430_glue, omap_musb_mailbox_work);
319− struct musb *musb = glue_to_musb(glue);
320− struct device *dev = musb->controller;
321271
322− pm_runtime_get_sync(dev);
323272 omap_musb_set_mailbox(glue);
324− pm_runtime_mark_last_busy(dev);
325− pm_runtime_put_autosuspend(dev);
326273 }
327274
328275 static irqreturn_t omap2430_musb_interrupt(int irq, void *__hci)
@@ -389,23 +336,7 @@ static int omap2430_musb_init(struct musb *musb) · 60 unmodified lines
389336 return PTR_ERR(musb->phy);
390337 }
391338 musb->isr = omap2430_musb_interrupt;
392−
393− /*
394− * Enable runtime PM for musb parent (this driver). We can't
395− * do it earlier as struct musb is not yet allocated and we
396− * need to touch the musb registers for runtime PM.
397− */
398− pm_runtime_enable(glue->dev);
399− status = pm_runtime_get_sync(glue->dev);
400− if (status < 0)
401− goto err1;
402−
403− status = pm_runtime_get_sync(dev);
404− if (status < 0) {
405− dev_err(dev, "pm_runtime_get_sync FAILED %d\n", status);
406− pm_runtime_put_sync(glue->dev);
407− goto err1;
408− }
339+ phy_init(musb->phy);
409340
410341 l = musb_readl(musb->mregs, OTG_INTERFSEL);
411342
@@ -427,20 +358,10 @@ static int omap2430_musb_init(struct musb *musb) · 15 unmodified lines
427358 musb_readl(musb->mregs, OTG_INTERFSEL),
428359 musb_readl(musb->mregs, OTG_SIMENABLE));
429360
430− setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb);
431−
432361 if (glue->status != MUSB_UNKNOWN)
433362 omap_musb_set_mailbox(glue);
434363
435− phy_init(musb->phy);
436− phy_power_on(musb->phy);
437−
438− pm_runtime_put_noidle(musb->controller);
439− pm_runtime_put_noidle(glue->dev);
440364 return 0;
441−
442−err1:
443− return status;
444365 }
445366
446367 static void omap2430_musb_enable(struct musb *musb)
@@ -452,6 +373,11 @@ static void omap2430_musb_enable(struct musb *musb) · 5 unmodified lines
452373 struct musb_hdrc_platform_data *pdata = dev_get_platdata(dev);
453374 struct omap_musb_board_data *data = pdata->board_data;
454375
376+ if (!WARN_ON(!musb->phy))
377+ phy_power_on(musb->phy);
378+
379+ omap2430_set_power(musb, true, glue->cable_connected);
380+
455381 switch (glue->status) {
456382
457383 case MUSB_ID_GROUND:
@@ -487,18 +413,25 @@ static void omap2430_musb_disable(struct musb *musb) · 29 unmodified lines
487413 struct device *dev = musb->controller;
488414 struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
489415
416+ if (!WARN_ON(!musb->phy))
417+ phy_power_off(musb->phy);
418+
490419 if (glue->status != MUSB_UNKNOWN)
491420 omap_control_usb_set_mode(glue->control_otghs,
492421 USB_MODE_DISCONNECT);
422+
423+ omap2430_set_power(musb, false, glue->cable_connected);
493424 }
494425
495426 static int omap2430_musb_exit(struct musb *musb)
496427 {
497− del_timer_sync(&musb_idle_timer);
428+ struct device *dev = musb->controller;
429+ struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
498430
499431 omap2430_low_level_exit(musb);
500− phy_power_off(musb->phy);
501432 phy_exit(musb->phy);
433+ musb->phy = NULL;
434+ cancel_work_sync(&glue->omap_musb_mailbox_work);
502435
503436 return 0;
504437 }
@@ -512,9 +445,6 @@ static const struct musb_platform_ops omap2430_ops = { · 7 unmodified lines
512445 .init = omap2430_musb_init,
513446 .exit = omap2430_musb_exit,
514447
515− .set_mode = omap2430_musb_set_mode,
516− .try_idle = omap2430_musb_try_idle,
517−
518448 .set_vbus = omap2430_musb_set_vbus,
519449
520450 .enable = omap2430_musb_enable,
@@ -639,11 +569,9 @@ static int omap2430_probe(struct platform_device *pdev) · 118 unmodified lines
639569 goto err2;
640570 }
641571
642− /*
643− * Note that we cannot enable PM runtime yet for this
644− * driver as we need struct musb initialized first.
645− * See omap2430_musb_init above.
646− */
572+ pm_runtime_enable(glue->dev);
573+ pm_runtime_use_autosuspend(glue->dev);
574+ pm_runtime_set_autosuspend_delay(glue->dev, 500);
647575
648576 ret = platform_device_add(musb);
649577 if (ret) {
@@ -662,12 +590,14 @@ err0: · 12 unmodified lines
662590
663591 static int omap2430_remove(struct platform_device *pdev)
664592 {
665− struct omap2430_glue *glue = platform_get_drvdata(pdev);
593+ struct omap2430_glue *glue = platform_get_drvdata(pdev);
594+ struct musb *musb = glue_to_musb(glue);
666595
667596 pm_runtime_get_sync(glue->dev);
668− cancel_work_sync(&glue->omap_musb_mailbox_work);
669597 platform_device_unregister(glue->musb);
598+ omap2430_set_power(musb, false, false);
670599 pm_runtime_put_sync(glue->dev);
600+ pm_runtime_dont_use_autosuspend(glue->dev);
671601 pm_runtime_disable(glue->dev);
672602
673603 return 0;
@@ -680,12 +610,13 @@ static int omap2430_runtime_suspend(struct device *dev) · 6 unmodified lines
680610 struct omap2430_glue *glue = dev_get_drvdata(dev);
681611 struct musb *musb = glue_to_musb(glue);
682612
683− if (musb) {
684− musb->context.otg_interfsel = musb_readl(musb->mregs,
685− OTG_INTERFSEL);
613+ if (!musb)
614+ return 0;
686615
687− omap2430_low_level_exit(musb);
688− }
616+ musb->context.otg_interfsel = musb_readl(musb->mregs,
617+ OTG_INTERFSEL);
618+
619+ omap2430_low_level_exit(musb);
689620
690621 return 0;
691622 }
@@ -696,7 +627,7 @@ static int omap2430_runtime_resume(struct device *dev) · 4 unmodified lines
696627 struct musb *musb = glue_to_musb(glue);
697628
698629 if (!musb)
699− return -EPROBE_DEFER;
630+ return 0;
700631
701632 omap2430_low_level_init(musb);
702633 musb_writel(musb->mregs, OTG_INTERFSEL,
@@ -738,18 +669,8 @@ static struct platform_driver omap2430_driver = { · 35 unmodified lines
738669 },
739670 };
740671
672+module_platform_driver(omap2430_driver);
673+
741674 MODULE_DESCRIPTION("OMAP2PLUS MUSB Glue Layer");
742675 MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
743676 MODULE_LICENSE("GPL v2");
744−
745−static int __init omap2430_init(void)
746−{
747− return platform_driver_register(&omap2430_driver);
748−}
749−subsys_initcall(omap2430_init);
750−
751−static void __exit omap2430_exit(void)
752−{
753− platform_driver_unregister(&omap2430_driver);
754−}
755−module_exit(omap2430_exit);
drivers/usb/musb/sunxi.c+34−20
@@ -80,7 +80,8 @@ static struct musb *sunxi_musb; · 79 unmodified lines
8080
8181 struct sunxi_glue {
8282 struct device *dev;
83− struct platform_device *musb;
83+ struct musb *musb;
84+ struct platform_device *musb_pdev;
8485 struct clk *clk;
8586 struct reset_control *rst;
8687 struct phy *phy;
@@ -102,7 +103,7 @@ static void sunxi_musb_work(struct work_struct *work) · 15 unmodified lines
102103 return;
103104
104105 if (test_and_clear_bit(SUNXI_MUSB_FL_HOSTMODE_PEND, &glue->flags)) {
105− struct musb *musb = platform_get_drvdata(glue->musb);
106+ struct musb *musb = glue->musb;
106107 unsigned long flags;
107108 u8 devctl;
108109
@@ -112,7 +113,7 @@ static void sunxi_musb_work(struct work_struct *work) · 3 unmodified lines
112113 if (test_bit(SUNXI_MUSB_FL_HOSTMODE, &glue->flags)) {
113114 set_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags);
114115 musb->xceiv->otg->default_a = 1;
115− musb->xceiv->otg->state = OTG_STATE_A_IDLE;
116+ musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE;
116117 MUSB_HST_MODE(musb);
117118 devctl |= MUSB_DEVCTL_SESSION;
118119 } else {
@@ -145,10 +146,12 @@ static void sunxi_musb_set_vbus(struct musb *musb, int is_on) · 26 unmodified lines
145146 {
146147 struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent);
147148
148− if (is_on)
149+ if (is_on) {
149150 set_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags);
150− else
151+ musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE;
152+ } else {
151153 clear_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags);
154+ }
152155
153156 schedule_work(&glue->work);
154157 }
@@ -264,15 +267,6 @@ static int sunxi_musb_init(struct musb *musb) · 109 unmodified lines
264267 if (ret)
265268 goto error_unregister_notifier;
266269
267− if (musb->port_mode == MUSB_PORT_MODE_HOST) {
268− ret = phy_power_on(glue->phy);
269− if (ret)
270− goto error_phy_exit;
271− set_bit(SUNXI_MUSB_FL_PHY_ON, &glue->flags);
272− /* Stop musb work from turning vbus off again */
273− set_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags);
274− }
275−
276270 musb->isr = sunxi_musb_interrupt;
277271
278272 /* Stop the musb-core from doing runtime pm (not supported on sunxi) */
@@ -280,8 +274,6 @@ static int sunxi_musb_init(struct musb *musb) · 1 unmodified line
280274
281275 return 0;
282276
283−error_phy_exit:
284− phy_exit(glue->phy);
285277 error_unregister_notifier:
286278 if (musb->port_mode == MUSB_PORT_MODE_DUAL_ROLE)
287279 extcon_unregister_notifier(glue->extcon, EXTCON_USB_HOST,
@@ -323,10 +315,31 @@ static int sunxi_musb_exit(struct musb *musb) · 35 unmodified lines
323315 return 0;
324316 }
325317
318+static int sunxi_set_mode(struct musb *musb, u8 mode)
319+{
320+ struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent);
321+ int ret;
322+
323+ if (mode == MUSB_HOST) {
324+ ret = phy_power_on(glue->phy);
325+ if (ret)
326+ return ret;
327+
328+ set_bit(SUNXI_MUSB_FL_PHY_ON, &glue->flags);
329+ /* Stop musb work from turning vbus off again */
330+ set_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags);
331+ musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE;
332+ }
333+
334+ return 0;
335+}
336+
326337 static void sunxi_musb_enable(struct musb *musb)
327338 {
328339 struct sunxi_glue *glue = dev_get_drvdata(musb->controller->parent);
329340
341+ glue->musb = musb;
342+
330343 /* musb_core does not call us in a balanced manner */
331344 if (test_and_set_bit(SUNXI_MUSB_FL_ENABLED, &glue->flags))
332345 return;
@@ -569,6 +582,7 @@ static const struct musb_platform_ops sunxi_musb_ops = { · 236 unmodified lines
569582 .exit = sunxi_musb_exit,
570583 .enable = sunxi_musb_enable,
571584 .disable = sunxi_musb_disable,
585+ .set_mode = sunxi_set_mode,
572586 .fifo_offset = sunxi_musb_fifo_offset,
573587 .ep_offset = sunxi_musb_ep_offset,
574588 .busctl_offset = sunxi_musb_busctl_offset,
@@ -721,9 +735,9 @@ static int sunxi_musb_probe(struct platform_device *pdev) · 146 unmodified lines
721735 pinfo.data = &pdata;
722736 pinfo.size_data = sizeof(pdata);
723737
724− glue->musb = platform_device_register_full(&pinfo);
725− if (IS_ERR(glue->musb)) {
726− ret = PTR_ERR(glue->musb);
738+ glue->musb_pdev = platform_device_register_full(&pinfo);
739+ if (IS_ERR(glue->musb_pdev)) {
740+ ret = PTR_ERR(glue->musb_pdev);
727741 dev_err(&pdev->dev, "Error registering musb dev: %d\n", ret);
728742 goto err_unregister_usb_phy;
729743 }
@@ -740,7 +754,7 @@ static int sunxi_musb_remove(struct platform_device *pdev) · 10 unmodified lines
740754 struct sunxi_glue *glue = platform_get_drvdata(pdev);
741755 struct platform_device *usb_phy = glue->usb_phy;
742756
743− platform_device_unregister(glue->musb); /* Frees glue ! */
757+ platform_device_unregister(glue->musb_pdev);
744758 usb_phy_generic_unregister(usb_phy);
745759
746760 return 0;
drivers/usb/phy/phy-twl6030-usb.c+24−5
@@ -97,6 +97,9 @@ struct twl6030_usb { · 96 unmodified lines
9797
9898 struct regulator *usb3v3;
9999
100+ /* used to check initial cable status after probe */
101+ struct delayed_work get_status_work;
102+
100103 /* used to set vbus, in atomic path */
101104 struct work_struct set_vbus_work;
102105
@@ -227,12 +230,16 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl) · 124 unmodified lines
227230 twl->asleep = 1;
228231 status = MUSB_VBUS_VALID;
229232 twl->linkstat = status;
230− musb_mailbox(status);
233+ ret = musb_mailbox(status);
234+ if (ret)
235+ twl->linkstat = MUSB_UNKNOWN;
231236 } else {
232237 if (twl->linkstat != MUSB_UNKNOWN) {
233238 status = MUSB_VBUS_OFF;
234239 twl->linkstat = status;
235− musb_mailbox(status);
240+ ret = musb_mailbox(status);
241+ if (ret)
242+ twl->linkstat = MUSB_UNKNOWN;
236243 if (twl->asleep) {
237244 regulator_disable(twl->usb3v3);
238245 twl->asleep = 0;
@@ -264,7 +271,9 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl) · 25 unmodified lines
264271 twl6030_writeb(twl, TWL_MODULE_USB, 0x10, USB_ID_INT_EN_HI_SET);
265272 status = MUSB_ID_GROUND;
266273 twl->linkstat = status;
267− musb_mailbox(status);
274+ ret = musb_mailbox(status);
275+ if (ret)
276+ twl->linkstat = MUSB_UNKNOWN;
268277 } else {
269278 twl6030_writeb(twl, TWL_MODULE_USB, 0x10, USB_ID_INT_EN_HI_CLR);
270279 twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_SET);
@@ -274,6 +283,15 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl) · 3 unmodified lines
274283 return IRQ_HANDLED;
275284 }
276285
286+static void twl6030_status_work(struct work_struct *work)
287+{
288+ struct twl6030_usb *twl = container_of(work, struct twl6030_usb,
289+ get_status_work.work);
290+
291+ twl6030_usb_irq(twl->irq2, twl);
292+ twl6030_usbotg_irq(twl->irq1, twl);
293+}
294+
277295 static int twl6030_enable_irq(struct twl6030_usb *twl)
278296 {
279297 twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_SET);
@@ -284,8 +302,6 @@ static int twl6030_enable_irq(struct twl6030_usb *twl) · 4 unmodified lines
284302 REG_INT_MSK_LINE_C);
285303 twl6030_interrupt_unmask(TWL6030_CHARGER_CTRL_INT_MASK,
286304 REG_INT_MSK_STS_C);
287− twl6030_usb_irq(twl->irq2, twl);
288− twl6030_usbotg_irq(twl->irq1, twl);
289305
290306 return 0;
291307 }
@@ -371,6 +387,7 @@ static int twl6030_usb_probe(struct platform_device *pdev) · 79 unmodified lines
371387 dev_warn(&pdev->dev, "could not create sysfs file\n");
372388
373389 INIT_WORK(&twl->set_vbus_work, otg_set_vbus_work);
390+ INIT_DELAYED_WORK(&twl->get_status_work, twl6030_status_work);
374391
375392 status = request_threaded_irq(twl->irq1, NULL, twl6030_usbotg_irq,
376393 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING | IRQF_ONESHOT,
@@ -395,6 +412,7 @@ static int twl6030_usb_probe(struct platform_device *pdev) · 18 unmodified lines
395412
396413 twl->asleep = 0;
397414 twl6030_enable_irq(twl);
415+ schedule_delayed_work(&twl->get_status_work, HZ);
398416 dev_info(&pdev->dev, "Initialized TWL6030 USB module\n");
399417
400418 return 0;
@@ -404,6 +422,7 @@ static int twl6030_usb_remove(struct platform_device *pdev) · 3 unmodified lines
404422 {
405423 struct twl6030_usb *twl = platform_get_drvdata(pdev);
406424
425+ cancel_delayed_work(&twl->get_status_work);
407426 twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK,
408427 REG_INT_MSK_LINE_C);
409428 twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK,
drivers/usb/serial/mos7720.c+1−0
@@ -2007,6 +2007,7 @@ static void mos7720_release(struct usb_serial *serial) · 2006 unmodified lines
20072007 urblist_entry)
20082008 usb_unlink_urb(urbtrack->urb);
20092009 spin_unlock_irqrestore(&mos_parport->listlock, flags);
2010+ parport_del_port(mos_parport->pp);
20102011
20112012 kref_put(&mos_parport->ref_count, destroy_mos_parport);
20122013 }
drivers/usb/storage/uas.c+1−1
@@ -836,6 +836,7 @@ static int uas_slave_configure(struct scsi_device *sdev) · 835 unmodified lines
836836 if (devinfo->flags & US_FL_BROKEN_FUA)
837837 sdev->broken_fua = 1;
838838
839+ scsi_change_queue_depth(sdev, devinfo->qdepth - 2);
839840 return 0;
840841 }
841842
@@ -848,7 +849,6 @@ static struct scsi_host_template uas_host_template = { · 6 unmodified lines
848849 .slave_configure = uas_slave_configure,
849850 .eh_abort_handler = uas_eh_abort_handler,
850851 .eh_bus_reset_handler = uas_eh_bus_reset_handler,
851− .can_queue = MAX_CMNDS,
852852 .this_id = -1,
853853 .sg_tablesize = SG_NONE,
854854 .skip_settle_delay = 1,
drivers/usb/usbip/vhci_hcd.c+1−1
@@ -941,7 +941,7 @@ static void vhci_stop(struct usb_hcd *hcd) · 940 unmodified lines
941941
942942 static int vhci_get_frame_number(struct usb_hcd *hcd)
943943 {
944− pr_err("Not yet implemented\n");
944+ dev_err_ratelimited(&hcd->self.root_hub->dev, "Not yet implemented\n");
945945 return 0;
946946 }
947947
drivers/watchdog/Kconfig+1−1
@@ -746,7 +746,7 @@ config ALIM7101_WDT · 745 unmodified lines
746746
747747 config EBC_C384_WDT
748748 tristate "WinSystems EBC-C384 Watchdog Timer"
749− depends on X86 && ISA
749+ depends on X86 && ISA_BUS_API
750750 select WATCHDOG_CORE
751751 help
752752 Enables watchdog timer support for the watchdog timer on the
fs/binfmt_elf.c+1−1
@@ -2275,7 +2275,7 @@ static int elf_core_dump(struct coredump_params *cprm) · 2274 unmodified lines
22752275 goto end_coredump;
22762276
22772277 /* Align to page */
2278− if (!dump_skip(cprm, dataoff - cprm->file->f_pos))
2278+ if (!dump_skip(cprm, dataoff - cprm->pos))
22792279 goto end_coredump;
22802280
22812281 for (i = 0, vma = first_vma(current, gate_vma); vma != NULL;
fs/binfmt_elf_fdpic.c+1−1
@@ -1787,7 +1787,7 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm) · 1786 unmodified lines
17871787 goto end_coredump;
17881788 }
17891789
1790− if (!dump_skip(cprm, dataoff - cprm->file->f_pos))
1790+ if (!dump_skip(cprm, dataoff - cprm->pos))
17911791 goto end_coredump;
17921792
17931793 if (!elf_fdpic_dump_segments(cprm))
fs/btrfs/check-integrity.c+1−1
@@ -2645,7 +2645,7 @@ static void btrfsic_dump_tree_sub(const struct btrfsic_state *state, · 2644 unmodified lines
26452645 * This algorithm is recursive because the amount of used stack space
26462646 * is very small and the max recursion depth is limited.
26472647 */
2648− indent_add = sprintf(buf, "%c-%llu(%s/%llu/%d)",
2648+ indent_add = sprintf(buf, "%c-%llu(%s/%llu/%u)",
26492649 btrfsic_get_block_type(state, block),
26502650 block->logical_bytenr, block->dev_state->name,
26512651 block->dev_bytenr, block->mirror_num);
fs/btrfs/ctree.c+10−3
@@ -1373,7 +1373,8 @@ tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct btrfs_path *path, · 1372 unmodified lines
13731373
13741374 if (tm->op == MOD_LOG_KEY_REMOVE_WHILE_FREEING) {
13751375 BUG_ON(tm->slot != 0);
1376− eb_rewin = alloc_dummy_extent_buffer(fs_info, eb->start);
1376+ eb_rewin = alloc_dummy_extent_buffer(fs_info, eb->start,
1377+ eb->len);
13771378 if (!eb_rewin) {
13781379 btrfs_tree_read_unlock_blocking(eb);
13791380 free_extent_buffer(eb);
@@ -1454,7 +1455,8 @@ get_old_root(struct btrfs_root *root, u64 time_seq) · 74 unmodified lines
14541455 } else if (old_root) {
14551456 btrfs_tree_read_unlock(eb_root);
14561457 free_extent_buffer(eb_root);
1457− eb = alloc_dummy_extent_buffer(root->fs_info, logical);
1458+ eb = alloc_dummy_extent_buffer(root->fs_info, logical,
1459+ root->nodesize);
14581460 } else {
14591461 btrfs_set_lock_blocking_rw(eb_root, BTRFS_READ_LOCK);
14601462 eb = btrfs_clone_extent_buffer(eb_root);
@@ -1552,6 +1554,7 @@ noinline int btrfs_cow_block(struct btrfs_trans_handle *trans, · 91 unmodified lines
15521554 trans->transid, root->fs_info->generation);
15531555
15541556 if (!should_cow_block(trans, root, buf)) {
1557+ trans->dirty = true;
15551558 *cow_ret = buf;
15561559 return 0;
15571560 }
@@ -2510,6 +2513,8 @@ read_block_for_search(struct btrfs_trans_handle *trans, · 952 unmodified lines
25102513 if (!btrfs_buffer_uptodate(tmp, 0, 0))
25112514 ret = -EIO;
25122515 free_extent_buffer(tmp);
2516+ } else {
2517+ ret = PTR_ERR(tmp);
25132518 }
25142519 return ret;
25152520 }
@@ -2773,8 +2778,10 @@ again: · 257 unmodified lines
27732778 * then we don't want to set the path blocking,
27742779 * so we test it here
27752780 */
2776− if (!should_cow_block(trans, root, b))
2781+ if (!should_cow_block(trans, root, b)) {
2782+ trans->dirty = true;
27772783 goto cow_done;
2784+ }
27782785
27792786 /*
27802787 * must have write locks on this node and the
fs/btrfs/disk-io.c+32−22
@@ -1098,7 +1098,7 @@ void readahead_tree_block(struct btrfs_root *root, u64 bytenr) · 1097 unmodified lines
10981098 struct inode *btree_inode = root->fs_info->btree_inode;
10991099
11001100 buf = btrfs_find_create_tree_block(root, bytenr);
1101− if (!buf)
1101+ if (IS_ERR(buf))
11021102 return;
11031103 read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree,
11041104 buf, 0, WAIT_NONE, btree_get_extent, 0);
@@ -1114,7 +1114,7 @@ int reada_tree_block_flagged(struct btrfs_root *root, u64 bytenr, · 9 unmodified lines
11141114 int ret;
11151115
11161116 buf = btrfs_find_create_tree_block(root, bytenr);
1117− if (!buf)
1117+ if (IS_ERR(buf))
11181118 return 0;
11191119
11201120 set_bit(EXTENT_BUFFER_READAHEAD, &buf->bflags);
@@ -1147,7 +1147,8 @@ struct extent_buffer *btrfs_find_create_tree_block(struct btrfs_root *root, · 26 unmodified lines
11471147 u64 bytenr)
11481148 {
11491149 if (btrfs_test_is_dummy_root(root))
1150− return alloc_test_extent_buffer(root->fs_info, bytenr);
1150+ return alloc_test_extent_buffer(root->fs_info, bytenr,
1151+ root->nodesize);
11511152 return alloc_extent_buffer(root->fs_info, bytenr);
11521153 }
11531154
@@ -1171,8 +1172,8 @@ struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 bytenr, · 17 unmodified lines
11711172 int ret;
11721173
11731174 buf = btrfs_find_create_tree_block(root, bytenr);
1174− if (!buf)
1175− return ERR_PTR(-ENOMEM);
1175+ if (IS_ERR(buf))
1176+ return buf;
11761177
11771178 ret = btree_read_extent_buffer_pages(root, buf, 0, parent_transid);
11781179 if (ret) {
@@ -1314,14 +1315,16 @@ static struct btrfs_root *btrfs_alloc_root(struct btrfs_fs_info *fs_info, · 135 unmodified lines
13141315
13151316 #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
13161317 /* Should only be used by the testing infrastructure */
1317−struct btrfs_root *btrfs_alloc_dummy_root(void)
1318+struct btrfs_root *btrfs_alloc_dummy_root(u32 sectorsize, u32 nodesize)
13181319 {
13191320 struct btrfs_root *root;
13201321
13211322 root = btrfs_alloc_root(NULL, GFP_KERNEL);
13221323 if (!root)
13231324 return ERR_PTR(-ENOMEM);
1324− __setup_root(4096, 4096, 4096, root, NULL, 1);
1325+ /* We don't use the stripesize in selftest, set it as sectorsize */
1326+ __setup_root(nodesize, sectorsize, sectorsize, root, NULL,
1327+ BTRFS_ROOT_TREE_OBJECTID);
13251328 set_bit(BTRFS_ROOT_DUMMY_ROOT, &root->state);
13261329 root->alloc_bytenr = 0;
13271330
@@ -1803,6 +1806,13 @@ static int cleaner_kthread(void *arg) · 475 unmodified lines
18031806 if (btrfs_need_cleaner_sleep(root))
18041807 goto sleep;
18051808
1809+ /*
1810+ * Do not do anything if we might cause open_ctree() to block
1811+ * before we have finished mounting the filesystem.
1812+ */
1813+ if (!root->fs_info->open)
1814+ goto sleep;
1815+
18061816 if (!mutex_trylock(&root->fs_info->cleaner_mutex))
18071817 goto sleep;
18081818
@@ -2517,7 +2527,6 @@ int open_ctree(struct super_block *sb, · 708 unmodified lines
25172527 int num_backups_tried = 0;
25182528 int backup_index = 0;
25192529 int max_active;
2520− bool cleaner_mutex_locked = false;
25212530
25222531 tree_root = fs_info->tree_root = btrfs_alloc_root(fs_info, GFP_KERNEL);
25232532 chunk_root = fs_info->chunk_root = btrfs_alloc_root(fs_info, GFP_KERNEL);
@@ -2996,13 +3005,6 @@ retry_root_backup: · 472 unmodified lines
29963005 goto fail_sysfs;
29973006 }
29983007
2999− /*
3000− * Hold the cleaner_mutex thread here so that we don't block
3001− * for a long time on btrfs_recover_relocation. cleaner_kthread
3002− * will wait for us to finish mounting the filesystem.
3003− */
3004− mutex_lock(&fs_info->cleaner_mutex);
3005− cleaner_mutex_locked = true;
30063008 fs_info->cleaner_kthread = kthread_run(cleaner_kthread, tree_root,
30073009 "btrfs-cleaner");
30083010 if (IS_ERR(fs_info->cleaner_kthread))
@@ -3062,8 +3064,10 @@ retry_root_backup: · 53 unmodified lines
30623064 ret = btrfs_cleanup_fs_roots(fs_info);
30633065 if (ret)
30643066 goto fail_qgroup;
3065− /* We locked cleaner_mutex before creating cleaner_kthread. */
3067+
3068+ mutex_lock(&fs_info->cleaner_mutex);
30663069 ret = btrfs_recover_relocation(tree_root);
3070+ mutex_unlock(&fs_info->cleaner_mutex);
30673071 if (ret < 0) {
30683072 btrfs_warn(fs_info, "failed to recover relocation: %d",
30693073 ret);
@@ -3071,8 +3075,6 @@ retry_root_backup: · 1 unmodified line
30713075 goto fail_qgroup;
30723076 }
30733077 }
3074− mutex_unlock(&fs_info->cleaner_mutex);
3075− cleaner_mutex_locked = false;
30763078
30773079 location.objectid = BTRFS_FS_TREE_OBJECTID;
30783080 location.type = BTRFS_ROOT_ITEM_KEY;
@@ -3186,10 +3188,6 @@ fail_cleaner: · 107 unmodified lines
31863188 filemap_write_and_wait(fs_info->btree_inode->i_mapping);
31873189
31883190 fail_sysfs:
3189− if (cleaner_mutex_locked) {
3190− mutex_unlock(&fs_info->cleaner_mutex);
3191− cleaner_mutex_locked = false;
3192− }
31933191 btrfs_sysfs_remove_mounted(fs_info);
31943192
31953193 fail_fsdev_sysfs:
@@ -4130,6 +4128,18 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info, · 934 unmodified lines
41304128 * Hint to catch really bogus numbers, bitflips or so, more exact checks are
41314129 * done later
41324130 */
4131+ if (btrfs_super_bytes_used(sb) < 6 * btrfs_super_nodesize(sb)) {
4132+ btrfs_err(fs_info, "bytes_used is too small %llu",
4133+ btrfs_super_bytes_used(sb));
4134+ ret = -EINVAL;
4135+ }
4136+ if (!is_power_of_2(btrfs_super_stripesize(sb)) ||
4137+ ((btrfs_super_stripesize(sb) != sectorsize) &&
4138+ (btrfs_super_stripesize(sb) != 4096))) {
4139+ btrfs_err(fs_info, "invalid stripesize %u",
4140+ btrfs_super_stripesize(sb));
4141+ ret = -EINVAL;
4142+ }
41334143 if (btrfs_super_num_devices(sb) > (1UL << 31))
41344144 printk(KERN_WARNING "BTRFS: suspicious number of devices: %llu\n",
41354145 btrfs_super_num_devices(sb));
fs/btrfs/disk-io.h+1−1
@@ -90,7 +90,7 @@ void btrfs_drop_and_free_fs_root(struct btrfs_fs_info *fs_info, · 89 unmodified lines
9090 void btrfs_free_fs_root(struct btrfs_root *root);
9191
9292 #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
93−struct btrfs_root *btrfs_alloc_dummy_root(void);
93+struct btrfs_root *btrfs_alloc_dummy_root(u32 sectorsize, u32 nodesize);
9494 #endif
9595
9696 /*
fs/btrfs/extent-tree.c+7−5
@@ -8016,8 +8016,9 @@ btrfs_init_new_buffer(struct btrfs_trans_handle *trans, struct btrfs_root *root, · 8015 unmodified lines
80168016 struct extent_buffer *buf;
80178017
80188018 buf = btrfs_find_create_tree_block(root, bytenr);
8019− if (!buf)
8020− return ERR_PTR(-ENOMEM);
8019+ if (IS_ERR(buf))
8020+ return buf;
8021+
80218022 btrfs_set_header_generation(buf, trans->transid);
80228023 btrfs_set_buffer_lockdep_class(root->root_key.objectid, buf, level);
80238024 btrfs_tree_lock(buf);
@@ -8044,7 +8045,7 @@ btrfs_init_new_buffer(struct btrfs_trans_handle *trans, struct btrfs_root *root, · 20 unmodified lines
80448045 set_extent_dirty(&trans->transaction->dirty_pages, buf->start,
80458046 buf->start + buf->len - 1, GFP_NOFS);
80468047 }
8047− trans->blocks_used++;
8048+ trans->dirty = true;
80488049 /* this returns a buffer locked for blocking */
80498050 return buf;
80508051 }
@@ -8659,8 +8660,9 @@ static noinline int do_walk_down(struct btrfs_trans_handle *trans, · 608 unmodified lines
86598660 next = btrfs_find_tree_block(root->fs_info, bytenr);
86608661 if (!next) {
86618662 next = btrfs_find_create_tree_block(root, bytenr);
8662− if (!next)
8663− return -ENOMEM;
8663+ if (IS_ERR(next))
8664+ return PTR_ERR(next);
8665+
86648666 btrfs_set_buffer_lockdep_class(root->root_key.objectid, next,
86658667 level - 1);
86668668 reada = 1;
fs/btrfs/extent_io.c+17−8
@@ -4728,16 +4728,16 @@ err: · 4727 unmodified lines
47284728 }
47294729
47304730 struct extent_buffer *alloc_dummy_extent_buffer(struct btrfs_fs_info *fs_info,
4731− u64 start)
4731+ u64 start, u32 nodesize)
47324732 {
47334733 unsigned long len;
47344734
47354735 if (!fs_info) {
47364736 /*
47374737 * Called only from tests that don't always have a fs_info
4738− * available, but we know that nodesize is 4096
4738+ * available
47394739 */
4740− len = 4096;
4740+ len = nodesize;
47414741 } else {
47424742 len = fs_info->tree_root->nodesize;
47434743 }
@@ -4833,7 +4833,7 @@ struct extent_buffer *find_extent_buffer(struct btrfs_fs_info *fs_info, · 89 unmodified lines
48334833
48344834 #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
48354835 struct extent_buffer *alloc_test_extent_buffer(struct btrfs_fs_info *fs_info,
4836− u64 start)
4836+ u64 start, u32 nodesize)
48374837 {
48384838 struct extent_buffer *eb, *exists = NULL;
48394839 int ret;
@@ -4841,7 +4841,7 @@ struct extent_buffer *alloc_test_extent_buffer(struct btrfs_fs_info *fs_info, · 1 unmodified line
48414841 eb = find_extent_buffer(fs_info, start);
48424842 if (eb)
48434843 return eb;
4844− eb = alloc_dummy_extent_buffer(fs_info, start);
4844+ eb = alloc_dummy_extent_buffer(fs_info, start, nodesize);
48454845 if (!eb)
48464846 return NULL;
48474847 eb->fs_info = fs_info;
@@ -4892,18 +4892,25 @@ struct extent_buffer *alloc_extent_buffer(struct btrfs_fs_info *fs_info, · 44 unmodified lines
48924892 int uptodate = 1;
48934893 int ret;
48944894
4895+ if (!IS_ALIGNED(start, fs_info->tree_root->sectorsize)) {
4896+ btrfs_err(fs_info, "bad tree block start %llu", start);
4897+ return ERR_PTR(-EINVAL);
4898+ }
4899+
48954900 eb = find_extent_buffer(fs_info, start);
48964901 if (eb)
48974902 return eb;
48984903
48994904 eb = __alloc_extent_buffer(fs_info, start, len);
49004905 if (!eb)
4901− return NULL;
4906+ return ERR_PTR(-ENOMEM);
49024907
49034908 for (i = 0; i < num_pages; i++, index++) {
49044909 p = find_or_create_page(mapping, index, GFP_NOFS|__GFP_NOFAIL);
4905− if (!p)
4910+ if (!p) {
4911+ exists = ERR_PTR(-ENOMEM);
49064912 goto free_eb;
4913+ }
49074914
49084915 spin_lock(&mapping->private_lock);
49094916 if (PagePrivate(p)) {
@@ -4948,8 +4955,10 @@ struct extent_buffer *alloc_extent_buffer(struct btrfs_fs_info *fs_info, · 38 unmodified lines
49484955 set_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags);
49494956 again:
49504957 ret = radix_tree_preload(GFP_NOFS);
4951− if (ret)
4958+ if (ret) {
4959+ exists = ERR_PTR(ret);
49524960 goto free_eb;
4961+ }
49534962
49544963 spin_lock(&fs_info->buffer_lock);
49554964 ret = radix_tree_insert(&fs_info->buffer_radix,
fs/btrfs/extent_io.h+2−2
@@ -348,7 +348,7 @@ struct extent_buffer *alloc_extent_buffer(struct btrfs_fs_info *fs_info, · 347 unmodified lines
348348 struct extent_buffer *__alloc_dummy_extent_buffer(struct btrfs_fs_info *fs_info,
349349 u64 start, unsigned long len);
350350 struct extent_buffer *alloc_dummy_extent_buffer(struct btrfs_fs_info *fs_info,
351− u64 start);
351+ u64 start, u32 nodesize);
352352 struct extent_buffer *btrfs_clone_extent_buffer(struct extent_buffer *src);
353353 struct extent_buffer *find_extent_buffer(struct btrfs_fs_info *fs_info,
354354 u64 start);
@@ -468,5 +468,5 @@ noinline u64 find_lock_delalloc_range(struct inode *inode, · 113 unmodified lines
468468 u64 *end, u64 max_bytes);
469469 #endif
470470 struct extent_buffer *alloc_test_extent_buffer(struct btrfs_fs_info *fs_info,
471− u64 start);
471+ u64 start, u32 nodesize);
472472 #endif
fs/btrfs/free-space-cache.c+9−9
@@ -29,7 +29,7 @@ · 28 unmodified lines
2929 #include "inode-map.h"
3030 #include "volumes.h"
3131
32−#define BITS_PER_BITMAP (PAGE_SIZE * 8)
32+#define BITS_PER_BITMAP (PAGE_SIZE * 8UL)
3333 #define MAX_CACHE_BYTES_PER_GIG SZ_32K
3434
3535 struct btrfs_trim_range {
@@ -1415,11 +1415,11 @@ static inline u64 offset_to_bitmap(struct btrfs_free_space_ctl *ctl, · 1379 unmodified lines
14151415 u64 offset)
14161416 {
14171417 u64 bitmap_start;
1418− u32 bytes_per_bitmap;
1418+ u64 bytes_per_bitmap;
14191419
14201420 bytes_per_bitmap = BITS_PER_BITMAP * ctl->unit;
14211421 bitmap_start = offset - ctl->start;
1422− bitmap_start = div_u64(bitmap_start, bytes_per_bitmap);
1422+ bitmap_start = div64_u64(bitmap_start, bytes_per_bitmap);
14231423 bitmap_start *= bytes_per_bitmap;
14241424 bitmap_start += ctl->start;
14251425
@@ -1638,10 +1638,10 @@ static void recalculate_thresholds(struct btrfs_free_space_ctl *ctl) · 212 unmodified lines
16381638 u64 bitmap_bytes;
16391639 u64 extent_bytes;
16401640 u64 size = block_group->key.offset;
1641− u32 bytes_per_bg = BITS_PER_BITMAP * ctl->unit;
1642− u32 max_bitmaps = div_u64(size + bytes_per_bg - 1, bytes_per_bg);
1641+ u64 bytes_per_bg = BITS_PER_BITMAP * ctl->unit;
1642+ u64 max_bitmaps = div64_u64(size + bytes_per_bg - 1, bytes_per_bg);
16431643
1644− max_bitmaps = max_t(u32, max_bitmaps, 1);
1644+ max_bitmaps = max_t(u64, max_bitmaps, 1);
16451645
16461646 ASSERT(ctl->total_bitmaps <= max_bitmaps);
16471647
@@ -1660,7 +1660,7 @@ static void recalculate_thresholds(struct btrfs_free_space_ctl *ctl) · 12 unmodified lines
16601660 * sure we don't go over our overall goal of MAX_CACHE_BYTES_PER_GIG as
16611661 * we add more bitmaps.
16621662 */
1663− bitmap_bytes = (ctl->total_bitmaps + 1) * PAGE_SIZE;
1663+ bitmap_bytes = (ctl->total_bitmaps + 1) * ctl->unit;
16641664
16651665 if (bitmap_bytes >= max_bytes) {
16661666 ctl->extents_thresh = 0;
@@ -3662,7 +3662,7 @@ have_info: · 1995 unmodified lines
36623662 if (tmp->offset + tmp->bytes < offset)
36633663 break;
36643664 if (offset + bytes < tmp->offset) {
3665− n = rb_prev(&info->offset_index);
3665+ n = rb_prev(&tmp->offset_index);
36663666 continue;
36673667 }
36683668 info = tmp;
@@ -3676,7 +3676,7 @@ have_info: · 7 unmodified lines
36763676 if (offset + bytes < tmp->offset)
36773677 break;
36783678 if (tmp->offset + tmp->bytes < offset) {
3679− n = rb_next(&info->offset_index);
3679+ n = rb_next(&tmp->offset_index);
36803680 continue;
36813681 }
36823682 info = tmp;
fs/btrfs/hash.c+5−0
@@ -24,6 +24,11 @@ int __init btrfs_hash_init(void) · 23 unmodified lines
2424 return PTR_ERR_OR_ZERO(tfm);
2525 }
2626
27+const char* btrfs_crc32c_impl(void)
28+{
29+ return crypto_tfm_alg_driver_name(crypto_shash_tfm(tfm));
30+}
31+
2732 void btrfs_hash_exit(void)
2833 {
2934 crypto_free_shash(tfm);
fs/btrfs/hash.h+1−0
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 int __init btrfs_hash_init(void);
2323
2424 void btrfs_hash_exit(void);
25+const char* btrfs_crc32c_impl(void);
2526
2627 u32 btrfs_crc32c(u32 crc, const void *address, unsigned int length);
2728
fs/btrfs/inode.c+10−1
@@ -3271,7 +3271,16 @@ int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct inode *inode) · 3270 unmodified lines
32713271 /* grab metadata reservation from transaction handle */
32723272 if (reserve) {
32733273 ret = btrfs_orphan_reserve_metadata(trans, inode);
3274− BUG_ON(ret); /* -ENOSPC in reservation; Logic error? JDM */
3274+ ASSERT(!ret);
3275+ if (ret) {
3276+ atomic_dec(&root->orphan_inodes);
3277+ clear_bit(BTRFS_INODE_ORPHAN_META_RESERVED,
3278+ &BTRFS_I(inode)->runtime_flags);
3279+ if (insert)
3280+ clear_bit(BTRFS_INODE_HAS_ORPHAN_ITEM,
3281+ &BTRFS_I(inode)->runtime_flags);
3282+ return ret;
3283+ }
32753284 }
32763285
32773286 /* insert an orphan item to track this unlinked/truncated file */
fs/btrfs/super.c+39−22
@@ -235,7 +235,7 @@ void __btrfs_abort_transaction(struct btrfs_trans_handle *trans, · 234 unmodified lines
235235 trans->aborted = errno;
236236 /* Nothing used. The other threads that have joined this
237237 * transaction may be able to continue. */
238− if (!trans->blocks_used && list_empty(&trans->new_bgs)) {
238+ if (!trans->dirty && list_empty(&trans->new_bgs)) {
239239 const char *errstr;
240240
241241 errstr = btrfs_decode_error(errno);
@@ -1807,6 +1807,8 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) · 1565 unmodified lines
18071807 }
18081808 }
18091809 sb->s_flags &= ~MS_RDONLY;
1810+
1811+ fs_info->open = 1;
18101812 }
18111813 out:
18121814 wake_up_process(fs_info->transaction_kthread);
@@ -2303,7 +2305,7 @@ static void btrfs_interface_exit(void) · 490 unmodified lines
23032305
23042306 static void btrfs_print_mod_info(void)
23052307 {
2306− printk(KERN_INFO "Btrfs loaded"
2308+ printk(KERN_INFO "Btrfs loaded, crc32c=%s"
23072309 #ifdef CONFIG_BTRFS_DEBUG
23082310 ", debug=on"
23092311 #endif
@@ -2313,33 +2315,48 @@ static void btrfs_print_mod_info(void) · 3 unmodified lines
23132315 #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
23142316 ", integrity-checker=on"
23152317 #endif
2316− "\n");
2318+ "\n",
2319+ btrfs_crc32c_impl());
23172320 }
23182321
23192322 static int btrfs_run_sanity_tests(void)
23202323 {
2321− int ret;
2322−
2324+ int ret, i;
2325+ u32 sectorsize, nodesize;
2326+ u32 test_sectorsize[] = {
2327+ PAGE_SIZE,
2328+ };
23232329 ret = btrfs_init_test_fs();
23242330 if (ret)
23252331 return ret;
2326−
2327− ret = btrfs_test_free_space_cache();
2328− if (ret)
2329− goto out;
2330− ret = btrfs_test_extent_buffer_operations();
2331− if (ret)
2332− goto out;
2333− ret = btrfs_test_extent_io();
2334− if (ret)
2335− goto out;
2336− ret = btrfs_test_inodes();
2337− if (ret)
2338− goto out;
2339− ret = btrfs_test_qgroups();
2340− if (ret)
2341− goto out;
2342− ret = btrfs_test_free_space_tree();
2332+ for (i = 0; i < ARRAY_SIZE(test_sectorsize); i++) {
2333+ sectorsize = test_sectorsize[i];
2334+ for (nodesize = sectorsize;
2335+ nodesize <= BTRFS_MAX_METADATA_BLOCKSIZE;
2336+ nodesize <<= 1) {
2337+ pr_info("BTRFS: selftest: sectorsize: %u nodesize: %u\n",
2338+ sectorsize, nodesize);
2339+ ret = btrfs_test_free_space_cache(sectorsize, nodesize);
2340+ if (ret)
2341+ goto out;
2342+ ret = btrfs_test_extent_buffer_operations(sectorsize,
2343+ nodesize);
2344+ if (ret)
2345+ goto out;
2346+ ret = btrfs_test_extent_io(sectorsize, nodesize);
2347+ if (ret)
2348+ goto out;
2349+ ret = btrfs_test_inodes(sectorsize, nodesize);
2350+ if (ret)
2351+ goto out;
2352+ ret = btrfs_test_qgroups(sectorsize, nodesize);
2353+ if (ret)
2354+ goto out;
2355+ ret = btrfs_test_free_space_tree(sectorsize, nodesize);
2356+ if (ret)
2357+ goto out;
2358+ }
2359+ }
23432360 out:
23442361 btrfs_destroy_test_fs();
23452362 return ret;
fs/btrfs/tests/btrfs-tests.c+3−3
@@ -175,7 +175,7 @@ void btrfs_free_dummy_root(struct btrfs_root *root) · 174 unmodified lines
175175 }
176176
177177 struct btrfs_block_group_cache *
178−btrfs_alloc_dummy_block_group(unsigned long length)
178+btrfs_alloc_dummy_block_group(unsigned long length, u32 sectorsize)
179179 {
180180 struct btrfs_block_group_cache *cache;
181181
@@ -192,8 +192,8 @@ btrfs_alloc_dummy_block_group(unsigned long length) · 10 unmodified lines
192192 cache->key.objectid = 0;
193193 cache->key.offset = length;
194194 cache->key.type = BTRFS_BLOCK_GROUP_ITEM_KEY;
195− cache->sectorsize = 4096;
196− cache->full_stripe_len = 4096;
195+ cache->sectorsize = sectorsize;
196+ cache->full_stripe_len = sectorsize;
197197
198198 INIT_LIST_HEAD(&cache->list);
199199 INIT_LIST_HEAD(&cache->cluster_list);
fs/btrfs/tests/btrfs-tests.h+14−13
@@ -26,27 +26,28 @@ · 25 unmodified lines
2626 struct btrfs_root;
2727 struct btrfs_trans_handle;
2828
29−int btrfs_test_free_space_cache(void);
30−int btrfs_test_extent_buffer_operations(void);
31−int btrfs_test_extent_io(void);
32−int btrfs_test_inodes(void);
33−int btrfs_test_qgroups(void);
34−int btrfs_test_free_space_tree(void);
29+int btrfs_test_free_space_cache(u32 sectorsize, u32 nodesize);
30+int btrfs_test_extent_buffer_operations(u32 sectorsize, u32 nodesize);
31+int btrfs_test_extent_io(u32 sectorsize, u32 nodesize);
32+int btrfs_test_inodes(u32 sectorsize, u32 nodesize);
33+int btrfs_test_qgroups(u32 sectorsize, u32 nodesize);
34+int btrfs_test_free_space_tree(u32 sectorsize, u32 nodesize);
3535 int btrfs_init_test_fs(void);
3636 void btrfs_destroy_test_fs(void);
3737 struct inode *btrfs_new_test_inode(void);
3838 struct btrfs_fs_info *btrfs_alloc_dummy_fs_info(void);
3939 void btrfs_free_dummy_root(struct btrfs_root *root);
4040 struct btrfs_block_group_cache *
41−btrfs_alloc_dummy_block_group(unsigned long length);
41+btrfs_alloc_dummy_block_group(unsigned long length, u32 sectorsize);
4242 void btrfs_free_dummy_block_group(struct btrfs_block_group_cache *cache);
4343 void btrfs_init_dummy_trans(struct btrfs_trans_handle *trans);
4444 #else
45−static inline int btrfs_test_free_space_cache(void)
45+static inline int btrfs_test_free_space_cache(u32 sectorsize, u32 nodesize)
4646 {
4747 return 0;
4848 }
49−static inline int btrfs_test_extent_buffer_operations(void)
49+static inline int btrfs_test_extent_buffer_operations(u32 sectorsize,
50+ u32 nodesize)
5051 {
5152 return 0;
5253 }
@@ -57,19 +58,19 @@ static inline int btrfs_init_test_fs(void) · 4 unmodified lines
5758 static inline void btrfs_destroy_test_fs(void)
5859 {
5960 }
60−static inline int btrfs_test_extent_io(void)
61+static inline int btrfs_test_extent_io(u32 sectorsize, u32 nodesize)
6162 {
6263 return 0;
6364 }
64−static inline int btrfs_test_inodes(void)
65+static inline int btrfs_test_inodes(u32 sectorsize, u32 nodesize)
6566 {
6667 return 0;
6768 }
68−static inline int btrfs_test_qgroups(void)
69+static inline int btrfs_test_qgroups(u32 sectorsize, u32 nodesize)
6970 {
7071 return 0;
7172 }
72−static inline int btrfs_test_free_space_tree(void)
73+static inline int btrfs_test_free_space_tree(u32 sectorsize, u32 nodesize)
7374 {
7475 return 0;
7576 }
fs/btrfs/tests/extent-buffer-tests.c+7−6
@@ -22,7 +22,7 @@ · 21 unmodified lines
2222 #include "../extent_io.h"
2323 #include "../disk-io.h"
2424
25−static int test_btrfs_split_item(void)
25+static int test_btrfs_split_item(u32 sectorsize, u32 nodesize)
2626 {
2727 struct btrfs_path *path;
2828 struct btrfs_root *root;
@@ -40,7 +40,7 @@ static int test_btrfs_split_item(void) · 11 unmodified lines
4040
4141 test_msg("Running btrfs_split_item tests\n");
4242
43− root = btrfs_alloc_dummy_root();
43+ root = btrfs_alloc_dummy_root(sectorsize, nodesize);
4444 if (IS_ERR(root)) {
4545 test_msg("Could not allocate root\n");
4646 return PTR_ERR(root);
@@ -53,7 +53,8 @@ static int test_btrfs_split_item(void) · 6 unmodified lines
5353 return -ENOMEM;
5454 }
5555
56− path->nodes[0] = eb = alloc_dummy_extent_buffer(NULL, 4096);
56+ path->nodes[0] = eb = alloc_dummy_extent_buffer(NULL, nodesize,
57+ nodesize);
5758 if (!eb) {
5859 test_msg("Could not allocate dummy buffer\n");
5960 ret = -ENOMEM;
@@ -222,8 +223,8 @@ out: · 162 unmodified lines
222223 return ret;
223224 }
224225
225−int btrfs_test_extent_buffer_operations(void)
226+int btrfs_test_extent_buffer_operations(u32 sectorsize, u32 nodesize)
226227 {
227− test_msg("Running extent buffer operation tests");
228− return test_btrfs_split_item();
228+ test_msg("Running extent buffer operation tests\n");
229+ return test_btrfs_split_item(sectorsize, nodesize);
229230 }
fs/btrfs/tests/extent-io-tests.c+54−32
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 #include <linux/slab.h>
2222 #include <linux/sizes.h>
2323 #include "btrfs-tests.h"
24+#include "../ctree.h"
2425 #include "../extent_io.h"
2526
2627 #define PROCESS_UNLOCK (1 << 0)
@@ -65,7 +66,7 @@ static noinline int process_page_range(struct inode *inode, u64 start, u64 end, · 38 unmodified lines
6566 return count;
6667 }
6768
68−static int test_find_delalloc(void)
69+static int test_find_delalloc(u32 sectorsize)
6970 {
7071 struct inode *inode;
7172 struct extent_io_tree tmp;
@@ -113,7 +114,7 @@ static int test_find_delalloc(void) · 41 unmodified lines
113114 * |--- delalloc ---|
114115 * |--- search ---|
115116 */
116− set_extent_delalloc(&tmp, 0, 4095, NULL);
117+ set_extent_delalloc(&tmp, 0, sectorsize - 1, NULL);
117118 start = 0;
118119 end = 0;
119120 found = find_lock_delalloc_range(inode, &tmp, locked_page, &start,
@@ -122,9 +123,9 @@ static int test_find_delalloc(void) · 2 unmodified lines
122123 test_msg("Should have found at least one delalloc\n");
123124 goto out_bits;
124125 }
125− if (start != 0 || end != 4095) {
126− test_msg("Expected start 0 end 4095, got start %Lu end %Lu\n",
127− start, end);
126+ if (start != 0 || end != (sectorsize - 1)) {
127+ test_msg("Expected start 0 end %u, got start %llu end %llu\n",
128+ sectorsize - 1, start, end);
128129 goto out_bits;
129130 }
130131 unlock_extent(&tmp, start, end);
@@ -144,7 +145,7 @@ static int test_find_delalloc(void) · 13 unmodified lines
144145 test_msg("Couldn't find the locked page\n");
145146 goto out_bits;
146147 }
147− set_extent_delalloc(&tmp, 4096, max_bytes - 1, NULL);
148+ set_extent_delalloc(&tmp, sectorsize, max_bytes - 1, NULL);
148149 start = test_start;
149150 end = 0;
150151 found = find_lock_delalloc_range(inode, &tmp, locked_page, &start,
@@ -172,7 +173,7 @@ static int test_find_delalloc(void) · 21 unmodified lines
172173 * |--- delalloc ---|
173174 * |--- search ---|
174175 */
175− test_start = max_bytes + 4096;
176+ test_start = max_bytes + sectorsize;
176177 locked_page = find_lock_page(inode->i_mapping, test_start >>
177178 PAGE_SHIFT);
178179 if (!locked_page) {
@@ -272,6 +273,16 @@ out: · 93 unmodified lines
272273 return ret;
273274 }
274275
276+/**
277+ * test_bit_in_byte - Determine whether a bit is set in a byte
278+ * @nr: bit number to test
279+ * @addr: Address to start counting from
280+ */
281+static inline int test_bit_in_byte(int nr, const u8 *addr)
282+{
283+ return 1UL & (addr[nr / BITS_PER_BYTE] >> (nr & (BITS_PER_BYTE - 1)));
284+}
285+
275286 static int __test_eb_bitmaps(unsigned long *bitmap, struct extent_buffer *eb,
276287 unsigned long len)
277288 {
@@ -298,25 +309,29 @@ static int __test_eb_bitmaps(unsigned long *bitmap, struct extent_buffer *eb, · 20 unmodified lines
298309 return -EINVAL;
299310 }
300311
301− bitmap_set(bitmap, (PAGE_SIZE - sizeof(long) / 2) * BITS_PER_BYTE,
302− sizeof(long) * BITS_PER_BYTE);
303− extent_buffer_bitmap_set(eb, PAGE_SIZE - sizeof(long) / 2, 0,
304− sizeof(long) * BITS_PER_BYTE);
305− if (memcmp_extent_buffer(eb, bitmap, 0, len) != 0) {
306− test_msg("Setting straddling pages failed\n");
307− return -EINVAL;
308− }
312+ /* Straddling pages test */
313+ if (len > PAGE_SIZE) {
314+ bitmap_set(bitmap,
315+ (PAGE_SIZE - sizeof(long) / 2) * BITS_PER_BYTE,
316+ sizeof(long) * BITS_PER_BYTE);
317+ extent_buffer_bitmap_set(eb, PAGE_SIZE - sizeof(long) / 2, 0,
318+ sizeof(long) * BITS_PER_BYTE);
319+ if (memcmp_extent_buffer(eb, bitmap, 0, len) != 0) {
320+ test_msg("Setting straddling pages failed\n");
321+ return -EINVAL;
322+ }
309323
310− bitmap_set(bitmap, 0, len * BITS_PER_BYTE);
311− bitmap_clear(bitmap,
312− (PAGE_SIZE - sizeof(long) / 2) * BITS_PER_BYTE,
313− sizeof(long) * BITS_PER_BYTE);
314− extent_buffer_bitmap_set(eb, 0, 0, len * BITS_PER_BYTE);
315− extent_buffer_bitmap_clear(eb, PAGE_SIZE - sizeof(long) / 2, 0,
316− sizeof(long) * BITS_PER_BYTE);
317− if (memcmp_extent_buffer(eb, bitmap, 0, len) != 0) {
318− test_msg("Clearing straddling pages failed\n");
319− return -EINVAL;
324+ bitmap_set(bitmap, 0, len * BITS_PER_BYTE);
325+ bitmap_clear(bitmap,
326+ (PAGE_SIZE - sizeof(long) / 2) * BITS_PER_BYTE,
327+ sizeof(long) * BITS_PER_BYTE);
328+ extent_buffer_bitmap_set(eb, 0, 0, len * BITS_PER_BYTE);
329+ extent_buffer_bitmap_clear(eb, PAGE_SIZE - sizeof(long) / 2, 0,
330+ sizeof(long) * BITS_PER_BYTE);
331+ if (memcmp_extent_buffer(eb, bitmap, 0, len) != 0) {
332+ test_msg("Clearing straddling pages failed\n");
333+ return -EINVAL;
334+ }
320335 }
321336
322337 /*
@@ -333,7 +348,7 @@ static int __test_eb_bitmaps(unsigned long *bitmap, struct extent_buffer *eb, · 10 unmodified lines
333348 for (i = 0; i < len * BITS_PER_BYTE; i++) {
334349 int bit, bit1;
335350
336− bit = !!test_bit(i, bitmap);
351+ bit = !!test_bit_in_byte(i, (u8 *)bitmap);
337352 bit1 = !!extent_buffer_test_bit(eb, 0, i);
338353 if (bit1 != bit) {
339354 test_msg("Testing bit pattern failed\n");
@@ -351,15 +366,22 @@ static int __test_eb_bitmaps(unsigned long *bitmap, struct extent_buffer *eb, · 11 unmodified lines
351366 return 0;
352367 }
353368
354−static int test_eb_bitmaps(void)
369+static int test_eb_bitmaps(u32 sectorsize, u32 nodesize)
355370 {
356− unsigned long len = PAGE_SIZE * 4;
371+ unsigned long len;
357372 unsigned long *bitmap;
358373 struct extent_buffer *eb;
359374 int ret;
360375
361376 test_msg("Running extent buffer bitmap tests\n");
362377
378+ /*
379+ * In ppc64, sectorsize can be 64K, thus 4 * 64K will be larger than
380+ * BTRFS_MAX_METADATA_BLOCKSIZE.
381+ */
382+ len = (sectorsize < BTRFS_MAX_METADATA_BLOCKSIZE)
383+ ? sectorsize * 4 : sectorsize;
384+
363385 bitmap = kmalloc(len, GFP_KERNEL);
364386 if (!bitmap) {
365387 test_msg("Couldn't allocate test bitmap\n");
@@ -379,7 +401,7 @@ static int test_eb_bitmaps(void) · 13 unmodified lines
379401
380402 /* Do it over again with an extent buffer which isn't page-aligned. */
381403 free_extent_buffer(eb);
382− eb = __alloc_dummy_extent_buffer(NULL, PAGE_SIZE / 2, len);
404+ eb = __alloc_dummy_extent_buffer(NULL, nodesize / 2, len);
383405 if (!eb) {
384406 test_msg("Couldn't allocate test extent buffer\n");
385407 kfree(bitmap);
@@ -393,17 +415,17 @@ out: · 7 unmodified lines
393415 return ret;
394416 }
395417
396−int btrfs_test_extent_io(void)
418+int btrfs_test_extent_io(u32 sectorsize, u32 nodesize)
397419 {
398420 int ret;
399421
400422 test_msg("Running extent I/O tests\n");
401423
402− ret = test_find_delalloc();
424+ ret = test_find_delalloc(sectorsize);
403425 if (ret)
404426 goto out;
405427
406− ret = test_eb_bitmaps();
428+ ret = test_eb_bitmaps(sectorsize, nodesize);
407429 out:
408430 test_msg("Extent I/O tests finished\n");
409431 return ret;
fs/btrfs/tests/free-space-tests.c+46−30
@@ -22,7 +22,7 @@ · 21 unmodified lines
2222 #include "../disk-io.h"
2323 #include "../free-space-cache.h"
2424
25−#define BITS_PER_BITMAP (PAGE_SIZE * 8)
25+#define BITS_PER_BITMAP (PAGE_SIZE * 8UL)
2626
2727 /*
2828 * This test just does basic sanity checking, making sure we can add an extent
@@ -99,7 +99,8 @@ static int test_extents(struct btrfs_block_group_cache *cache) · 70 unmodified lines
9999 return 0;
100100 }
101101
102−static int test_bitmaps(struct btrfs_block_group_cache *cache)
102+static int test_bitmaps(struct btrfs_block_group_cache *cache,
103+ u32 sectorsize)
103104 {
104105 u64 next_bitmap_offset;
105106 int ret;
@@ -139,7 +140,7 @@ static int test_bitmaps(struct btrfs_block_group_cache *cache) · 33 unmodified lines
139140 * The first bitmap we have starts at offset 0 so the next one is just
140141 * at the end of the first bitmap.
141142 */
142− next_bitmap_offset = (u64)(BITS_PER_BITMAP * 4096);
143+ next_bitmap_offset = (u64)(BITS_PER_BITMAP * sectorsize);
143144
144145 /* Test a bit straddling two bitmaps */
145146 ret = test_add_free_space_entry(cache, next_bitmap_offset - SZ_2M,
@@ -167,9 +168,10 @@ static int test_bitmaps(struct btrfs_block_group_cache *cache) · 21 unmodified lines
167168 }
168169
169170 /* This is the high grade jackassery */
170−static int test_bitmaps_and_extents(struct btrfs_block_group_cache *cache)
171+static int test_bitmaps_and_extents(struct btrfs_block_group_cache *cache,
172+ u32 sectorsize)
171173 {
172− u64 bitmap_offset = (u64)(BITS_PER_BITMAP * 4096);
174+ u64 bitmap_offset = (u64)(BITS_PER_BITMAP * sectorsize);
173175 int ret;
174176
175177 test_msg("Running bitmap and extent tests\n");
@@ -401,7 +403,8 @@ static int check_cache_empty(struct btrfs_block_group_cache *cache) · 225 unmodified lines
401403 * requests.
402404 */
403405 static int
404−test_steal_space_from_bitmap_to_extent(struct btrfs_block_group_cache *cache)
406+test_steal_space_from_bitmap_to_extent(struct btrfs_block_group_cache *cache,
407+ u32 sectorsize)
405408 {
406409 int ret;
407410 u64 offset;
@@ -539,7 +542,7 @@ test_steal_space_from_bitmap_to_extent(struct btrfs_block_group_cache *cache) · 131 unmodified lines
539542 * The goal is to test that the bitmap entry space stealing doesn't
540543 * steal this space region.
541544 */
542− ret = btrfs_add_free_space(cache, SZ_128M + SZ_16M, 4096);
545+ ret = btrfs_add_free_space(cache, SZ_128M + SZ_16M, sectorsize);
543546 if (ret) {
544547 test_msg("Error adding free space: %d\n", ret);
545548 return ret;
@@ -597,8 +600,8 @@ test_steal_space_from_bitmap_to_extent(struct btrfs_block_group_cache *cache) · 51 unmodified lines
597600 return -ENOENT;
598601 }
599602
600− if (cache->free_space_ctl->free_space != (SZ_1M + 4096)) {
601− test_msg("Cache free space is not 1Mb + 4Kb\n");
603+ if (cache->free_space_ctl->free_space != (SZ_1M + sectorsize)) {
604+ test_msg("Cache free space is not 1Mb + %u\n", sectorsize);
602605 return -EINVAL;
603606 }
604607
@@ -611,22 +614,25 @@ test_steal_space_from_bitmap_to_extent(struct btrfs_block_group_cache *cache) · 6 unmodified lines
611614 return -EINVAL;
612615 }
613616
614− /* All that remains is a 4Kb free space region in a bitmap. Confirm. */
617+ /*
618+ * All that remains is a sectorsize free space region in a bitmap.
619+ * Confirm.
620+ */
615621 ret = check_num_extents_and_bitmaps(cache, 1, 1);
616622 if (ret)
617623 return ret;
618624
619− if (cache->free_space_ctl->free_space != 4096) {
620− test_msg("Cache free space is not 4Kb\n");
625+ if (cache->free_space_ctl->free_space != sectorsize) {
626+ test_msg("Cache free space is not %u\n", sectorsize);
621627 return -EINVAL;
622628 }
623629
624630 offset = btrfs_find_space_for_alloc(cache,
625− 0, 4096, 0,
631+ 0, sectorsize, 0,
626632 &max_extent_size);
627633 if (offset != (SZ_128M + SZ_16M)) {
628− test_msg("Failed to allocate 4Kb from space cache, returned offset is: %llu\n",
629− offset);
634+ test_msg("Failed to allocate %u, returned offset : %llu\n",
635+ sectorsize, offset);
630636 return -EINVAL;
631637 }
632638
@@ -733,7 +739,7 @@ test_steal_space_from_bitmap_to_extent(struct btrfs_block_group_cache *cache) · 100 unmodified lines
733739 * The goal is to test that the bitmap entry space stealing doesn't
734740 * steal this space region.
735741 */
736− ret = btrfs_add_free_space(cache, SZ_32M, 8192);
742+ ret = btrfs_add_free_space(cache, SZ_32M, 2 * sectorsize);
737743 if (ret) {
738744 test_msg("Error adding free space: %d\n", ret);
739745 return ret;
@@ -757,7 +763,7 @@ test_steal_space_from_bitmap_to_extent(struct btrfs_block_group_cache *cache) · 17 unmodified lines
757763
758764 /*
759765 * Confirm that our extent entry didn't stole all free space from the
760− * bitmap, because of the small 8Kb free space region.
766+ * bitmap, because of the small 2 * sectorsize free space region.
761767 */
762768 ret = check_num_extents_and_bitmaps(cache, 2, 1);
763769 if (ret)
@@ -783,8 +789,8 @@ test_steal_space_from_bitmap_to_extent(struct btrfs_block_group_cache *cache) · 19 unmodified lines
783789 return -ENOENT;
784790 }
785791
786− if (cache->free_space_ctl->free_space != (SZ_1M + 8192)) {
787− test_msg("Cache free space is not 1Mb + 8Kb\n");
792+ if (cache->free_space_ctl->free_space != (SZ_1M + 2 * sectorsize)) {
793+ test_msg("Cache free space is not 1Mb + %u\n", 2 * sectorsize);
788794 return -EINVAL;
789795 }
790796
@@ -796,21 +802,25 @@ test_steal_space_from_bitmap_to_extent(struct btrfs_block_group_cache *cache) · 5 unmodified lines
796802 return -EINVAL;
797803 }
798804
799− /* All that remains is a 8Kb free space region in a bitmap. Confirm. */
805+ /*
806+ * All that remains is 2 * sectorsize free space region
807+ * in a bitmap. Confirm.
808+ */
800809 ret = check_num_extents_and_bitmaps(cache, 1, 1);
801810 if (ret)
802811 return ret;
803812
804− if (cache->free_space_ctl->free_space != 8192) {
805− test_msg("Cache free space is not 8Kb\n");
813+ if (cache->free_space_ctl->free_space != 2 * sectorsize) {
814+ test_msg("Cache free space is not %u\n", 2 * sectorsize);
806815 return -EINVAL;
807816 }
808817
809818 offset = btrfs_find_space_for_alloc(cache,
810− 0, 8192, 0,
819+ 0, 2 * sectorsize, 0,
811820 &max_extent_size);
812821 if (offset != SZ_32M) {
813− test_msg("Failed to allocate 8Kb from space cache, returned offset is: %llu\n",
822+ test_msg("Failed to allocate %u, offset: %llu\n",
823+ 2 * sectorsize,
814824 offset);
815825 return -EINVAL;
816826 }
@@ -825,7 +835,7 @@ test_steal_space_from_bitmap_to_extent(struct btrfs_block_group_cache *cache) · 8 unmodified lines
825835 return 0;
826836 }
827837
828−int btrfs_test_free_space_cache(void)
838+int btrfs_test_free_space_cache(u32 sectorsize, u32 nodesize)
829839 {
830840 struct btrfs_block_group_cache *cache;
831841 struct btrfs_root *root = NULL;
@@ -833,13 +843,19 @@ int btrfs_test_free_space_cache(void) · 1 unmodified line
833843
834844 test_msg("Running btrfs free space cache tests\n");
835845
836− cache = btrfs_alloc_dummy_block_group(1024 * 1024 * 1024);
846+ /*
847+ * For ppc64 (with 64k page size), bytes per bitmap might be
848+ * larger than 1G. To make bitmap test available in ppc64,
849+ * alloc dummy block group whose size cross bitmaps.
850+ */
851+ cache = btrfs_alloc_dummy_block_group(BITS_PER_BITMAP * sectorsize
852+ + PAGE_SIZE, sectorsize);
837853 if (!cache) {
838854 test_msg("Couldn't run the tests\n");
839855 return 0;
840856 }
841857
842− root = btrfs_alloc_dummy_root();
858+ root = btrfs_alloc_dummy_root(sectorsize, nodesize);
843859 if (IS_ERR(root)) {
844860 ret = PTR_ERR(root);
845861 goto out;
@@ -855,14 +871,14 @@ int btrfs_test_free_space_cache(void) · 9 unmodified lines
855871 ret = test_extents(cache);
856872 if (ret)
857873 goto out;
858− ret = test_bitmaps(cache);
874+ ret = test_bitmaps(cache, sectorsize);
859875 if (ret)
860876 goto out;
861− ret = test_bitmaps_and_extents(cache);
877+ ret = test_bitmaps_and_extents(cache, sectorsize);
862878 if (ret)
863879 goto out;
864880
865− ret = test_steal_space_from_bitmap_to_extent(cache);
881+ ret = test_steal_space_from_bitmap_to_extent(cache, sectorsize);
866882 out:
867883 btrfs_free_dummy_block_group(cache);
868884 btrfs_free_dummy_root(root);
fs/btrfs/tests/free-space-tree-tests.c+18−12
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616 * Boston, MA 021110-1307, USA.
1717 */
1818
19+#include <linux/types.h>
1920 #include "btrfs-tests.h"
2021 #include "../ctree.h"
2122 #include "../disk-io.h"
@@ -30,7 +31,7 @@ struct free_space_extent { · 8 unmodified lines
3031 * The test cases align their operations to this in order to hit some of the
3132 * edge cases in the bitmap code.
3233 */
33−#define BITMAP_RANGE (BTRFS_FREE_SPACE_BITMAP_BITS * 4096)
34+#define BITMAP_RANGE (BTRFS_FREE_SPACE_BITMAP_BITS * PAGE_SIZE)
3435
3536 static int __check_free_space_extents(struct btrfs_trans_handle *trans,
3637 struct btrfs_fs_info *fs_info,
@@ -439,7 +440,8 @@ typedef int (*test_func_t)(struct btrfs_trans_handle *, · 402 unmodified lines
439440 struct btrfs_block_group_cache *,
440441 struct btrfs_path *);
441442
442−static int run_test(test_func_t test_func, int bitmaps)
443+static int run_test(test_func_t test_func, int bitmaps,
444+ u32 sectorsize, u32 nodesize)
443445 {
444446 struct btrfs_root *root = NULL;
445447 struct btrfs_block_group_cache *cache = NULL;
@@ -447,7 +449,7 @@ static int run_test(test_func_t test_func, int bitmaps) · 1 unmodified line
447449 struct btrfs_path *path = NULL;
448450 int ret;
449451
450− root = btrfs_alloc_dummy_root();
452+ root = btrfs_alloc_dummy_root(sectorsize, nodesize);
451453 if (IS_ERR(root)) {
452454 test_msg("Couldn't allocate dummy root\n");
453455 ret = PTR_ERR(root);
@@ -466,7 +468,8 @@ static int run_test(test_func_t test_func, int bitmaps) · 12 unmodified lines
466468 root->fs_info->free_space_root = root;
467469 root->fs_info->tree_root = root;
468470
469− root->node = alloc_test_extent_buffer(root->fs_info, 4096);
471+ root->node = alloc_test_extent_buffer(root->fs_info,
472+ nodesize, nodesize);
470473 if (!root->node) {
471474 test_msg("Couldn't allocate dummy buffer\n");
472475 ret = -ENOMEM;
@@ -474,9 +477,9 @@ static int run_test(test_func_t test_func, int bitmaps) · 1 unmodified line
474477 }
475478 btrfs_set_header_level(root->node, 0);
476479 btrfs_set_header_nritems(root->node, 0);
477− root->alloc_bytenr += 8192;
480+ root->alloc_bytenr += 2 * nodesize;
478481
479− cache = btrfs_alloc_dummy_block_group(8 * BITMAP_RANGE);
482+ cache = btrfs_alloc_dummy_block_group(8 * BITMAP_RANGE, sectorsize);
480483 if (!cache) {
481484 test_msg("Couldn't allocate dummy block group cache\n");
482485 ret = -ENOMEM;
@@ -534,17 +537,18 @@ out: · 51 unmodified lines
534537 return ret;
535538 }
536539
537−static int run_test_both_formats(test_func_t test_func)
540+static int run_test_both_formats(test_func_t test_func,
541+ u32 sectorsize, u32 nodesize)
538542 {
539543 int ret;
540544
541− ret = run_test(test_func, 0);
545+ ret = run_test(test_func, 0, sectorsize, nodesize);
542546 if (ret)
543547 return ret;
544− return run_test(test_func, 1);
548+ return run_test(test_func, 1, sectorsize, nodesize);
545549 }
546550
547−int btrfs_test_free_space_tree(void)
551+int btrfs_test_free_space_tree(u32 sectorsize, u32 nodesize)
548552 {
549553 test_func_t tests[] = {
550554 test_empty_block_group,
@@ -561,9 +565,11 @@ int btrfs_test_free_space_tree(void) · 10 unmodified lines
561565
562566 test_msg("Running free space tree tests\n");
563567 for (i = 0; i < ARRAY_SIZE(tests); i++) {
564− int ret = run_test_both_formats(tests[i]);
568+ int ret = run_test_both_formats(tests[i], sectorsize,
569+ nodesize);
565570 if (ret) {
566− test_msg("%pf failed\n", tests[i]);
571+ test_msg("%pf : sectorsize %u failed\n",
572+ tests[i], sectorsize);
567573 return ret;
568574 }
569575 }
fs/btrfs/tests/inode-tests.c+188−156
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616 * Boston, MA 021110-1307, USA.
1717 */
1818
19+#include <linux/types.h>
1920 #include "btrfs-tests.h"
2021 #include "../ctree.h"
2122 #include "../btrfs_inode.h"
@@ -86,19 +87,19 @@ static void insert_inode_item_key(struct btrfs_root *root) · 64 unmodified lines
8687 * diagram of how the extents will look though this may not be possible we still
8788 * want to make sure everything acts normally (the last number is not inclusive)
8889 *
89− * [0 - 5][5 - 6][6 - 10][10 - 4096][ 4096 - 8192 ][8192 - 12288]
90− * [hole ][inline][ hole ][ regular ][regular1 split][ hole ]
90+ * [0 - 5][5 - 6][ 6 - 4096 ][ 4096 - 4100][4100 - 8195][8195 - 12291]
91+ * [hole ][inline][hole but no extent][ hole ][ regular ][regular1 split]
9192 *
92− * [ 12288 - 20480][20480 - 24576][ 24576 - 28672 ][28672 - 36864][36864 - 45056]
93− * [regular1 split][ prealloc1 ][prealloc1 written][ prealloc1 ][ compressed ]
93+ * [12291 - 16387][16387 - 24579][24579 - 28675][ 28675 - 32771][32771 - 36867 ]
94+ * [ hole ][regular1 split][ prealloc ][ prealloc1 ][prealloc1 written]
9495 *
95− * [45056 - 49152][49152-53248][53248-61440][61440-65536][ 65536+81920 ]
96− * [ compressed1 ][ regular ][compressed1][ regular ][ hole but no extent]
96+ * [36867 - 45059][45059 - 53251][53251 - 57347][57347 - 61443][61443- 69635]
97+ * [ prealloc1 ][ compressed ][ compressed1 ][ regular ][ compressed1]
9798 *
98− * [81920-86016]
99− * [ regular ]
99+ * [69635-73731][ 73731 - 86019 ][86019-90115]
100+ * [ regular ][ hole but no extent][ regular ]
100101 */
101−static void setup_file_extents(struct btrfs_root *root)
102+static void setup_file_extents(struct btrfs_root *root, u32 sectorsize)
102103 {
103104 int slot = 0;
104105 u64 disk_bytenr = SZ_1M;
@@ -119,7 +120,7 @@ static void setup_file_extents(struct btrfs_root *root) · 14 unmodified lines
119120 insert_extent(root, offset, 1, 1, 0, 0, 0, BTRFS_FILE_EXTENT_INLINE, 0,
120121 slot);
121122 slot++;
122− offset = 4096;
123+ offset = sectorsize;
123124
124125 /* Now another hole */
125126 insert_extent(root, offset, 4, 4, 0, 0, 0, BTRFS_FILE_EXTENT_REG, 0,
@@ -128,99 +129,106 @@ static void setup_file_extents(struct btrfs_root *root) · 2 unmodified lines
128129 offset += 4;
129130
130131 /* Now for a regular extent */
131− insert_extent(root, offset, 4095, 4095, 0, disk_bytenr, 4096,
132− BTRFS_FILE_EXTENT_REG, 0, slot);
132+ insert_extent(root, offset, sectorsize - 1, sectorsize - 1, 0,
133+ disk_bytenr, sectorsize, BTRFS_FILE_EXTENT_REG, 0, slot);
133134 slot++;
134− disk_bytenr += 4096;
135− offset += 4095;
135+ disk_bytenr += sectorsize;
136+ offset += sectorsize - 1;
136137
137138 /*
138139 * Now for 3 extents that were split from a hole punch so we test
139140 * offsets properly.
140141 */
141− insert_extent(root, offset, 4096, 16384, 0, disk_bytenr, 16384,
142− BTRFS_FILE_EXTENT_REG, 0, slot);
142+ insert_extent(root, offset, sectorsize, 4 * sectorsize, 0, disk_bytenr,
143+ 4 * sectorsize, BTRFS_FILE_EXTENT_REG, 0, slot);
143144 slot++;
144− offset += 4096;
145− insert_extent(root, offset, 4096, 4096, 0, 0, 0, BTRFS_FILE_EXTENT_REG,
146− 0, slot);
145+ offset += sectorsize;
146+ insert_extent(root, offset, sectorsize, sectorsize, 0, 0, 0,
147+ BTRFS_FILE_EXTENT_REG, 0, slot);
147148 slot++;
148− offset += 4096;
149− insert_extent(root, offset, 8192, 16384, 8192, disk_bytenr, 16384,
149+ offset += sectorsize;
150+ insert_extent(root, offset, 2 * sectorsize, 4 * sectorsize,
151+ 2 * sectorsize, disk_bytenr, 4 * sectorsize,
150152 BTRFS_FILE_EXTENT_REG, 0, slot);
151153 slot++;
152− offset += 8192;
153− disk_bytenr += 16384;
154+ offset += 2 * sectorsize;
155+ disk_bytenr += 4 * sectorsize;
154156
155157 /* Now for a unwritten prealloc extent */
156− insert_extent(root, offset, 4096, 4096, 0, disk_bytenr, 4096,
157− BTRFS_FILE_EXTENT_PREALLOC, 0, slot);
158+ insert_extent(root, offset, sectorsize, sectorsize, 0, disk_bytenr,
159+ sectorsize, BTRFS_FILE_EXTENT_PREALLOC, 0, slot);
158160 slot++;
159− offset += 4096;
161+ offset += sectorsize;
160162
161163 /*
162164 * We want to jack up disk_bytenr a little more so the em stuff doesn't
163165 * merge our records.
164166 */
165− disk_bytenr += 8192;
167+ disk_bytenr += 2 * sectorsize;
166168
167169 /*
168170 * Now for a partially written prealloc extent, basically the same as
169171 * the hole punch example above. Ram_bytes never changes when you mark
170172 * extents written btw.
171173 */
172− insert_extent(root, offset, 4096, 16384, 0, disk_bytenr, 16384,
173− BTRFS_FILE_EXTENT_PREALLOC, 0, slot);
174+ insert_extent(root, offset, sectorsize, 4 * sectorsize, 0, disk_bytenr,
175+ 4 * sectorsize, BTRFS_FILE_EXTENT_PREALLOC, 0, slot);
174176 slot++;
175− offset += 4096;
176− insert_extent(root, offset, 4096, 16384, 4096, disk_bytenr, 16384,
177− BTRFS_FILE_EXTENT_REG, 0, slot);
177+ offset += sectorsize;
178+ insert_extent(root, offset, sectorsize, 4 * sectorsize, sectorsize,
179+ disk_bytenr, 4 * sectorsize, BTRFS_FILE_EXTENT_REG, 0,
180+ slot);
178181 slot++;
179− offset += 4096;
180− insert_extent(root, offset, 8192, 16384, 8192, disk_bytenr, 16384,
182+ offset += sectorsize;
183+ insert_extent(root, offset, 2 * sectorsize, 4 * sectorsize,
184+ 2 * sectorsize, disk_bytenr, 4 * sectorsize,
181185 BTRFS_FILE_EXTENT_PREALLOC, 0, slot);
182186 slot++;
183− offset += 8192;
184− disk_bytenr += 16384;
187+ offset += 2 * sectorsize;
188+ disk_bytenr += 4 * sectorsize;
185189
186190 /* Now a normal compressed extent */
187− insert_extent(root, offset, 8192, 8192, 0, disk_bytenr, 4096,
188− BTRFS_FILE_EXTENT_REG, BTRFS_COMPRESS_ZLIB, slot);
191+ insert_extent(root, offset, 2 * sectorsize, 2 * sectorsize, 0,
192+ disk_bytenr, sectorsize, BTRFS_FILE_EXTENT_REG,
193+ BTRFS_COMPRESS_ZLIB, slot);
189194 slot++;
190− offset += 8192;
195+ offset += 2 * sectorsize;
191196 /* No merges */
192− disk_bytenr += 8192;
197+ disk_bytenr += 2 * sectorsize;
193198
194199 /* Now a split compressed extent */
195− insert_extent(root, offset, 4096, 16384, 0, disk_bytenr, 4096,
196− BTRFS_FILE_EXTENT_REG, BTRFS_COMPRESS_ZLIB, slot);
200+ insert_extent(root, offset, sectorsize, 4 * sectorsize, 0, disk_bytenr,
201+ sectorsize, BTRFS_FILE_EXTENT_REG,
202+ BTRFS_COMPRESS_ZLIB, slot);
197203 slot++;
198− offset += 4096;
199− insert_extent(root, offset, 4096, 4096, 0, disk_bytenr + 4096, 4096,
204+ offset += sectorsize;
205+ insert_extent(root, offset, sectorsize, sectorsize, 0,
206+ disk_bytenr + sectorsize, sectorsize,
200207 BTRFS_FILE_EXTENT_REG, 0, slot);
201208 slot++;
202− offset += 4096;
203− insert_extent(root, offset, 8192, 16384, 8192, disk_bytenr, 4096,
209+ offset += sectorsize;
210+ insert_extent(root, offset, 2 * sectorsize, 4 * sectorsize,
211+ 2 * sectorsize, disk_bytenr, sectorsize,
204212 BTRFS_FILE_EXTENT_REG, BTRFS_COMPRESS_ZLIB, slot);
205213 slot++;
206− offset += 8192;
207− disk_bytenr += 8192;
214+ offset += 2 * sectorsize;
215+ disk_bytenr += 2 * sectorsize;
208216
209217 /* Now extents that have a hole but no hole extent */
210− insert_extent(root, offset, 4096, 4096, 0, disk_bytenr, 4096,
211− BTRFS_FILE_EXTENT_REG, 0, slot);
218+ insert_extent(root, offset, sectorsize, sectorsize, 0, disk_bytenr,
219+ sectorsize, BTRFS_FILE_EXTENT_REG, 0, slot);
212220 slot++;
213− offset += 16384;
214− disk_bytenr += 4096;
215− insert_extent(root, offset, 4096, 4096, 0, disk_bytenr, 4096,
216− BTRFS_FILE_EXTENT_REG, 0, slot);
221+ offset += 4 * sectorsize;
222+ disk_bytenr += sectorsize;
223+ insert_extent(root, offset, sectorsize, sectorsize, 0, disk_bytenr,
224+ sectorsize, BTRFS_FILE_EXTENT_REG, 0, slot);
217225 }
218226
219227 static unsigned long prealloc_only = 0;
220228 static unsigned long compressed_only = 0;
221229 static unsigned long vacancy_only = 0;
222230
223−static noinline int test_btrfs_get_extent(void)
231+static noinline int test_btrfs_get_extent(u32 sectorsize, u32 nodesize)
224232 {
225233 struct inode *inode = NULL;
226234 struct btrfs_root *root = NULL;
@@ -240,7 +248,7 @@ static noinline int test_btrfs_get_extent(void) · 13 unmodified lines
240248 BTRFS_I(inode)->location.objectid = BTRFS_FIRST_FREE_OBJECTID;
241249 BTRFS_I(inode)->location.offset = 0;
242250
243− root = btrfs_alloc_dummy_root();
251+ root = btrfs_alloc_dummy_root(sectorsize, nodesize);
244252 if (IS_ERR(root)) {
245253 test_msg("Couldn't allocate root\n");
246254 goto out;
@@ -256,7 +264,7 @@ static noinline int test_btrfs_get_extent(void) · 9 unmodified lines
256264 goto out;
257265 }
258266
259− root->node = alloc_dummy_extent_buffer(NULL, 4096);
267+ root->node = alloc_dummy_extent_buffer(NULL, nodesize, nodesize);
260268 if (!root->node) {
261269 test_msg("Couldn't allocate dummy buffer\n");
262270 goto out;
@@ -273,7 +281,7 @@ static noinline int test_btrfs_get_extent(void) · 10 unmodified lines
273281
274282 /* First with no extents */
275283 BTRFS_I(inode)->root = root;
276− em = btrfs_get_extent(inode, NULL, 0, 0, 4096, 0);
284+ em = btrfs_get_extent(inode, NULL, 0, 0, sectorsize, 0);
277285 if (IS_ERR(em)) {
278286 em = NULL;
279287 test_msg("Got an error when we shouldn't have\n");
@@ -295,7 +303,7 @@ static noinline int test_btrfs_get_extent(void) · 15 unmodified lines
295303 * setup_file_extents, so if you change anything there you need to
296304 * update the comment and update the expected values below.
297305 */
298− setup_file_extents(root);
306+ setup_file_extents(root, sectorsize);
299307
300308 em = btrfs_get_extent(inode, NULL, 0, 0, (u64)-1, 0);
301309 if (IS_ERR(em)) {
@@ -318,7 +326,7 @@ static noinline int test_btrfs_get_extent(void) · 16 unmodified lines
318326 offset = em->start + em->len;
319327 free_extent_map(em);
320328
321− em = btrfs_get_extent(inode, NULL, 0, offset, 4096, 0);
329+ em = btrfs_get_extent(inode, NULL, 0, offset, sectorsize, 0);
322330 if (IS_ERR(em)) {
323331 test_msg("Got an error when we shouldn't have\n");
324332 goto out;
@@ -327,7 +335,8 @@ static noinline int test_btrfs_get_extent(void) · 2 unmodified lines
327335 test_msg("Expected an inline, got %llu\n", em->block_start);
328336 goto out;
329337 }
330− if (em->start != offset || em->len != 4091) {
338+
339+ if (em->start != offset || em->len != (sectorsize - 5)) {
331340 test_msg("Unexpected extent wanted start %llu len 1, got start "
332341 "%llu len %llu\n", offset, em->start, em->len);
333342 goto out;
@@ -344,7 +353,7 @@ static noinline int test_btrfs_get_extent(void) · 10 unmodified lines
344353 offset = em->start + em->len;
345354 free_extent_map(em);
346355
347− em = btrfs_get_extent(inode, NULL, 0, offset, 4096, 0);
356+ em = btrfs_get_extent(inode, NULL, 0, offset, sectorsize, 0);
348357 if (IS_ERR(em)) {
349358 test_msg("Got an error when we shouldn't have\n");
350359 goto out;
@@ -366,7 +375,7 @@ static noinline int test_btrfs_get_extent(void) · 15 unmodified lines
366375 free_extent_map(em);
367376
368377 /* Regular extent */
369− em = btrfs_get_extent(inode, NULL, 0, offset, 4096, 0);
378+ em = btrfs_get_extent(inode, NULL, 0, offset, sectorsize, 0);
370379 if (IS_ERR(em)) {
371380 test_msg("Got an error when we shouldn't have\n");
372381 goto out;
@@ -375,7 +384,7 @@ static noinline int test_btrfs_get_extent(void) · 2 unmodified lines
375384 test_msg("Expected a real extent, got %llu\n", em->block_start);
376385 goto out;
377386 }
378− if (em->start != offset || em->len != 4095) {
387+ if (em->start != offset || em->len != sectorsize - 1) {
379388 test_msg("Unexpected extent wanted start %llu len 4095, got "
380389 "start %llu len %llu\n", offset, em->start, em->len);
381390 goto out;
@@ -393,7 +402,7 @@ static noinline int test_btrfs_get_extent(void) · 11 unmodified lines
393402 free_extent_map(em);
394403
395404 /* The next 3 are split extents */
396− em = btrfs_get_extent(inode, NULL, 0, offset, 4096, 0);
405+ em = btrfs_get_extent(inode, NULL, 0, offset, sectorsize, 0);
397406 if (IS_ERR(em)) {
398407 test_msg("Got an error when we shouldn't have\n");
399408 goto out;
@@ -402,9 +411,10 @@ static noinline int test_btrfs_get_extent(void) · 2 unmodified lines
402411 test_msg("Expected a real extent, got %llu\n", em->block_start);
403412 goto out;
404413 }
405− if (em->start != offset || em->len != 4096) {
406− test_msg("Unexpected extent wanted start %llu len 4096, got "
407− "start %llu len %llu\n", offset, em->start, em->len);
414+ if (em->start != offset || em->len != sectorsize) {
415+ test_msg("Unexpected extent start %llu len %u, "
416+ "got start %llu len %llu\n",
417+ offset, sectorsize, em->start, em->len);
408418 goto out;
409419 }
410420 if (em->flags != 0) {
@@ -421,7 +431,7 @@ static noinline int test_btrfs_get_extent(void) · 10 unmodified lines
421431 offset = em->start + em->len;
422432 free_extent_map(em);
423433
424− em = btrfs_get_extent(inode, NULL, 0, offset, 4096, 0);
434+ em = btrfs_get_extent(inode, NULL, 0, offset, sectorsize, 0);
425435 if (IS_ERR(em)) {
426436 test_msg("Got an error when we shouldn't have\n");
427437 goto out;
@@ -430,9 +440,10 @@ static noinline int test_btrfs_get_extent(void) · 2 unmodified lines
430440 test_msg("Expected a hole, got %llu\n", em->block_start);
431441 goto out;
432442 }
433− if (em->start != offset || em->len != 4096) {
434− test_msg("Unexpected extent wanted start %llu len 4096, got "
435− "start %llu len %llu\n", offset, em->start, em->len);
443+ if (em->start != offset || em->len != sectorsize) {
444+ test_msg("Unexpected extent wanted start %llu len %u, "
445+ "got start %llu len %llu\n",
446+ offset, sectorsize, em->start, em->len);
436447 goto out;
437448 }
438449 if (em->flags != 0) {
@@ -442,7 +453,7 @@ static noinline int test_btrfs_get_extent(void) · 3 unmodified lines
442453 offset = em->start + em->len;
443454 free_extent_map(em);
444455
445− em = btrfs_get_extent(inode, NULL, 0, offset, 4096, 0);
456+ em = btrfs_get_extent(inode, NULL, 0, offset, sectorsize, 0);
446457 if (IS_ERR(em)) {
447458 test_msg("Got an error when we shouldn't have\n");
448459 goto out;
@@ -451,9 +462,10 @@ static noinline int test_btrfs_get_extent(void) · 2 unmodified lines
451462 test_msg("Expected a real extent, got %llu\n", em->block_start);
452463 goto out;
453464 }
454− if (em->start != offset || em->len != 8192) {
455− test_msg("Unexpected extent wanted start %llu len 8192, got "
456− "start %llu len %llu\n", offset, em->start, em->len);
465+ if (em->start != offset || em->len != 2 * sectorsize) {
466+ test_msg("Unexpected extent wanted start %llu len %u, "
467+ "got start %llu len %llu\n",
468+ offset, 2 * sectorsize, em->start, em->len);
457469 goto out;
458470 }
459471 if (em->flags != 0) {
@@ -475,7 +487,7 @@ static noinline int test_btrfs_get_extent(void) · 15 unmodified lines
475487 free_extent_map(em);
476488
477489 /* Prealloc extent */
478− em = btrfs_get_extent(inode, NULL, 0, offset, 4096, 0);
490+ em = btrfs_get_extent(inode, NULL, 0, offset, sectorsize, 0);
479491 if (IS_ERR(em)) {
480492 test_msg("Got an error when we shouldn't have\n");
481493 goto out;
@@ -484,9 +496,10 @@ static noinline int test_btrfs_get_extent(void) · 2 unmodified lines
484496 test_msg("Expected a real extent, got %llu\n", em->block_start);
485497 goto out;
486498 }
487− if (em->start != offset || em->len != 4096) {
488− test_msg("Unexpected extent wanted start %llu len 4096, got "
489− "start %llu len %llu\n", offset, em->start, em->len);
499+ if (em->start != offset || em->len != sectorsize) {
500+ test_msg("Unexpected extent wanted start %llu len %u, "
501+ "got start %llu len %llu\n",
502+ offset, sectorsize, em->start, em->len);
490503 goto out;
491504 }
492505 if (em->flags != prealloc_only) {
@@ -503,7 +516,7 @@ static noinline int test_btrfs_get_extent(void) · 10 unmodified lines
503516 free_extent_map(em);
504517
505518 /* The next 3 are a half written prealloc extent */
506− em = btrfs_get_extent(inode, NULL, 0, offset, 4096, 0);
519+ em = btrfs_get_extent(inode, NULL, 0, offset, sectorsize, 0);
507520 if (IS_ERR(em)) {
508521 test_msg("Got an error when we shouldn't have\n");
509522 goto out;
@@ -512,9 +525,10 @@ static noinline int test_btrfs_get_extent(void) · 2 unmodified lines
512525 test_msg("Expected a real extent, got %llu\n", em->block_start);
513526 goto out;
514527 }
515− if (em->start != offset || em->len != 4096) {
516− test_msg("Unexpected extent wanted start %llu len 4096, got "
517− "start %llu len %llu\n", offset, em->start, em->len);
528+ if (em->start != offset || em->len != sectorsize) {
529+ test_msg("Unexpected extent wanted start %llu len %u, "
530+ "got start %llu len %llu\n",
531+ offset, sectorsize, em->start, em->len);
518532 goto out;
519533 }
520534 if (em->flags != prealloc_only) {
@@ -532,7 +546,7 @@ static noinline int test_btrfs_get_extent(void) · 11 unmodified lines
532546 offset = em->start + em->len;
533547 free_extent_map(em);
534548
535− em = btrfs_get_extent(inode, NULL, 0, offset, 4096, 0);
549+ em = btrfs_get_extent(inode, NULL, 0, offset, sectorsize, 0);
536550 if (IS_ERR(em)) {
537551 test_msg("Got an error when we shouldn't have\n");
538552 goto out;
@@ -541,9 +555,10 @@ static noinline int test_btrfs_get_extent(void) · 2 unmodified lines
541555 test_msg("Expected a real extent, got %llu\n", em->block_start);
542556 goto out;
543557 }
544− if (em->start != offset || em->len != 4096) {
545− test_msg("Unexpected extent wanted start %llu len 4096, got "
546− "start %llu len %llu\n", offset, em->start, em->len);
558+ if (em->start != offset || em->len != sectorsize) {
559+ test_msg("Unexpected extent wanted start %llu len %u, "
560+ "got start %llu len %llu\n",
561+ offset, sectorsize, em->start, em->len);
547562 goto out;
548563 }
549564 if (em->flags != 0) {
@@ -564,7 +579,7 @@ static noinline int test_btrfs_get_extent(void) · 14 unmodified lines
564579 offset = em->start + em->len;
565580 free_extent_map(em);
566581
567− em = btrfs_get_extent(inode, NULL, 0, offset, 4096, 0);
582+ em = btrfs_get_extent(inode, NULL, 0, offset, sectorsize, 0);
568583 if (IS_ERR(em)) {
569584 test_msg("Got an error when we shouldn't have\n");
570585 goto out;
@@ -573,9 +588,10 @@ static noinline int test_btrfs_get_extent(void) · 2 unmodified lines
573588 test_msg("Expected a real extent, got %llu\n", em->block_start);
574589 goto out;
575590 }
576− if (em->start != offset || em->len != 8192) {
577− test_msg("Unexpected extent wanted start %llu len 8192, got "
578− "start %llu len %llu\n", offset, em->start, em->len);
591+ if (em->start != offset || em->len != 2 * sectorsize) {
592+ test_msg("Unexpected extent wanted start %llu len %u, "
593+ "got start %llu len %llu\n",
594+ offset, 2 * sectorsize, em->start, em->len);
579595 goto out;
580596 }
581597 if (em->flags != prealloc_only) {
@@ -598,7 +614,7 @@ static noinline int test_btrfs_get_extent(void) · 16 unmodified lines
598614 free_extent_map(em);
599615
600616 /* Now for the compressed extent */
601− em = btrfs_get_extent(inode, NULL, 0, offset, 4096, 0);
617+ em = btrfs_get_extent(inode, NULL, 0, offset, sectorsize, 0);
602618 if (IS_ERR(em)) {
603619 test_msg("Got an error when we shouldn't have\n");
604620 goto out;
@@ -607,9 +623,10 @@ static noinline int test_btrfs_get_extent(void) · 2 unmodified lines
607623 test_msg("Expected a real extent, got %llu\n", em->block_start);
608624 goto out;
609625 }
610− if (em->start != offset || em->len != 8192) {
611− test_msg("Unexpected extent wanted start %llu len 8192, got "
612− "start %llu len %llu\n", offset, em->start, em->len);
626+ if (em->start != offset || em->len != 2 * sectorsize) {
627+ test_msg("Unexpected extent wanted start %llu len %u,"
628+ "got start %llu len %llu\n",
629+ offset, 2 * sectorsize, em->start, em->len);
613630 goto out;
614631 }
615632 if (em->flags != compressed_only) {
@@ -631,7 +648,7 @@ static noinline int test_btrfs_get_extent(void) · 15 unmodified lines
631648 free_extent_map(em);
632649
633650 /* Split compressed extent */
634− em = btrfs_get_extent(inode, NULL, 0, offset, 4096, 0);
651+ em = btrfs_get_extent(inode, NULL, 0, offset, sectorsize, 0);
635652 if (IS_ERR(em)) {
636653 test_msg("Got an error when we shouldn't have\n");
637654 goto out;
@@ -640,9 +657,10 @@ static noinline int test_btrfs_get_extent(void) · 2 unmodified lines
640657 test_msg("Expected a real extent, got %llu\n", em->block_start);
641658 goto out;
642659 }
643− if (em->start != offset || em->len != 4096) {
644− test_msg("Unexpected extent wanted start %llu len 4096, got "
645− "start %llu len %llu\n", offset, em->start, em->len);
660+ if (em->start != offset || em->len != sectorsize) {
661+ test_msg("Unexpected extent wanted start %llu len %u,"
662+ "got start %llu len %llu\n",
663+ offset, sectorsize, em->start, em->len);
646664 goto out;
647665 }
648666 if (em->flags != compressed_only) {
@@ -665,7 +683,7 @@ static noinline int test_btrfs_get_extent(void) · 16 unmodified lines
665683 offset = em->start + em->len;
666684 free_extent_map(em);
667685
668− em = btrfs_get_extent(inode, NULL, 0, offset, 4096, 0);
686+ em = btrfs_get_extent(inode, NULL, 0, offset, sectorsize, 0);
669687 if (IS_ERR(em)) {
670688 test_msg("Got an error when we shouldn't have\n");
671689 goto out;
@@ -674,9 +692,10 @@ static noinline int test_btrfs_get_extent(void) · 2 unmodified lines
674692 test_msg("Expected a real extent, got %llu\n", em->block_start);
675693 goto out;
676694 }
677− if (em->start != offset || em->len != 4096) {
678− test_msg("Unexpected extent wanted start %llu len 4096, got "
679− "start %llu len %llu\n", offset, em->start, em->len);
695+ if (em->start != offset || em->len != sectorsize) {
696+ test_msg("Unexpected extent wanted start %llu len %u, "
697+ "got start %llu len %llu\n",
698+ offset, sectorsize, em->start, em->len);
680699 goto out;
681700 }
682701 if (em->flags != 0) {
@@ -691,7 +710,7 @@ static noinline int test_btrfs_get_extent(void) · 8 unmodified lines
691710 offset = em->start + em->len;
692711 free_extent_map(em);
693712
694− em = btrfs_get_extent(inode, NULL, 0, offset, 4096, 0);
713+ em = btrfs_get_extent(inode, NULL, 0, offset, sectorsize, 0);
695714 if (IS_ERR(em)) {
696715 test_msg("Got an error when we shouldn't have\n");
697716 goto out;
@@ -701,9 +720,10 @@ static noinline int test_btrfs_get_extent(void) · 3 unmodified lines
701720 disk_bytenr, em->block_start);
702721 goto out;
703722 }
704− if (em->start != offset || em->len != 8192) {
705− test_msg("Unexpected extent wanted start %llu len 8192, got "
706− "start %llu len %llu\n", offset, em->start, em->len);
723+ if (em->start != offset || em->len != 2 * sectorsize) {
724+ test_msg("Unexpected extent wanted start %llu len %u, "
725+ "got start %llu len %llu\n",
726+ offset, 2 * sectorsize, em->start, em->len);
707727 goto out;
708728 }
709729 if (em->flags != compressed_only) {
@@ -725,7 +745,7 @@ static noinline int test_btrfs_get_extent(void) · 15 unmodified lines
725745 free_extent_map(em);
726746
727747 /* A hole between regular extents but no hole extent */
728− em = btrfs_get_extent(inode, NULL, 0, offset + 6, 4096, 0);
748+ em = btrfs_get_extent(inode, NULL, 0, offset + 6, sectorsize, 0);
729749 if (IS_ERR(em)) {
730750 test_msg("Got an error when we shouldn't have\n");
731751 goto out;
@@ -734,9 +754,10 @@ static noinline int test_btrfs_get_extent(void) · 2 unmodified lines
734754 test_msg("Expected a real extent, got %llu\n", em->block_start);
735755 goto out;
736756 }
737− if (em->start != offset || em->len != 4096) {
738− test_msg("Unexpected extent wanted start %llu len 4096, got "
739− "start %llu len %llu\n", offset, em->start, em->len);
757+ if (em->start != offset || em->len != sectorsize) {
758+ test_msg("Unexpected extent wanted start %llu len %u, "
759+ "got start %llu len %llu\n",
760+ offset, sectorsize, em->start, em->len);
740761 goto out;
741762 }
742763 if (em->flags != 0) {
@@ -765,9 +786,10 @@ static noinline int test_btrfs_get_extent(void) · 22 unmodified lines
765786 * length of the actual hole, if this changes we'll have to change this
766787 * test.
767788 */
768− if (em->start != offset || em->len != 12288) {
769− test_msg("Unexpected extent wanted start %llu len 12288, got "
770− "start %llu len %llu\n", offset, em->start, em->len);
789+ if (em->start != offset || em->len != 3 * sectorsize) {
790+ test_msg("Unexpected extent wanted start %llu len %u, "
791+ "got start %llu len %llu\n",
792+ offset, 3 * sectorsize, em->start, em->len);
771793 goto out;
772794 }
773795 if (em->flags != vacancy_only) {
@@ -783,7 +805,7 @@ static noinline int test_btrfs_get_extent(void) · 9 unmodified lines
783805 offset = em->start + em->len;
784806 free_extent_map(em);
785807
786− em = btrfs_get_extent(inode, NULL, 0, offset, 4096, 0);
808+ em = btrfs_get_extent(inode, NULL, 0, offset, sectorsize, 0);
787809 if (IS_ERR(em)) {
788810 test_msg("Got an error when we shouldn't have\n");
789811 goto out;
@@ -792,9 +814,10 @@ static noinline int test_btrfs_get_extent(void) · 2 unmodified lines
792814 test_msg("Expected a real extent, got %llu\n", em->block_start);
793815 goto out;
794816 }
795− if (em->start != offset || em->len != 4096) {
796− test_msg("Unexpected extent wanted start %llu len 4096, got "
797− "start %llu len %llu\n", offset, em->start, em->len);
817+ if (em->start != offset || em->len != sectorsize) {
818+ test_msg("Unexpected extent wanted start %llu len %u,"
819+ "got start %llu len %llu\n",
820+ offset, sectorsize, em->start, em->len);
798821 goto out;
799822 }
800823 if (em->flags != 0) {
@@ -815,7 +838,7 @@ out: · 14 unmodified lines
815838 return ret;
816839 }
817840
818−static int test_hole_first(void)
841+static int test_hole_first(u32 sectorsize, u32 nodesize)
819842 {
820843 struct inode *inode = NULL;
821844 struct btrfs_root *root = NULL;
@@ -832,7 +855,7 @@ static int test_hole_first(void) · 10 unmodified lines
832855 BTRFS_I(inode)->location.objectid = BTRFS_FIRST_FREE_OBJECTID;
833856 BTRFS_I(inode)->location.offset = 0;
834857
835− root = btrfs_alloc_dummy_root();
858+ root = btrfs_alloc_dummy_root(sectorsize, nodesize);
836859 if (IS_ERR(root)) {
837860 test_msg("Couldn't allocate root\n");
838861 goto out;
@@ -844,7 +867,7 @@ static int test_hole_first(void) · 5 unmodified lines
844867 goto out;
845868 }
846869
847− root->node = alloc_dummy_extent_buffer(NULL, 4096);
870+ root->node = alloc_dummy_extent_buffer(NULL, nodesize, nodesize);
848871 if (!root->node) {
849872 test_msg("Couldn't allocate dummy buffer\n");
850873 goto out;
@@ -861,9 +884,9 @@ static int test_hole_first(void) · 10 unmodified lines
861884 * btrfs_get_extent.
862885 */
863886 insert_inode_item_key(root);
864− insert_extent(root, 4096, 4096, 4096, 0, 4096, 4096,
865− BTRFS_FILE_EXTENT_REG, 0, 1);
866− em = btrfs_get_extent(inode, NULL, 0, 0, 8192, 0);
887+ insert_extent(root, sectorsize, sectorsize, sectorsize, 0, sectorsize,
888+ sectorsize, BTRFS_FILE_EXTENT_REG, 0, 1);
889+ em = btrfs_get_extent(inode, NULL, 0, 0, 2 * sectorsize, 0);
867890 if (IS_ERR(em)) {
868891 test_msg("Got an error when we shouldn't have\n");
869892 goto out;
@@ -872,9 +895,10 @@ static int test_hole_first(void) · 2 unmodified lines
872895 test_msg("Expected a hole, got %llu\n", em->block_start);
873896 goto out;
874897 }
875− if (em->start != 0 || em->len != 4096) {
876− test_msg("Unexpected extent wanted start 0 len 4096, got start "
877− "%llu len %llu\n", em->start, em->len);
898+ if (em->start != 0 || em->len != sectorsize) {
899+ test_msg("Unexpected extent wanted start 0 len %u, "
900+ "got start %llu len %llu\n",
901+ sectorsize, em->start, em->len);
878902 goto out;
879903 }
880904 if (em->flags != vacancy_only) {
@@ -884,18 +908,19 @@ static int test_hole_first(void) · 3 unmodified lines
884908 }
885909 free_extent_map(em);
886910
887− em = btrfs_get_extent(inode, NULL, 0, 4096, 8192, 0);
911+ em = btrfs_get_extent(inode, NULL, 0, sectorsize, 2 * sectorsize, 0);
888912 if (IS_ERR(em)) {
889913 test_msg("Got an error when we shouldn't have\n");
890914 goto out;
891915 }
892− if (em->block_start != 4096) {
916+ if (em->block_start != sectorsize) {
893917 test_msg("Expected a real extent, got %llu\n", em->block_start);
894918 goto out;
895919 }
896− if (em->start != 4096 || em->len != 4096) {
897− test_msg("Unexpected extent wanted start 4096 len 4096, got "
898− "start %llu len %llu\n", em->start, em->len);
920+ if (em->start != sectorsize || em->len != sectorsize) {
921+ test_msg("Unexpected extent wanted start %u len %u, "
922+ "got start %llu len %llu\n",
923+ sectorsize, sectorsize, em->start, em->len);
899924 goto out;
900925 }
901926 if (em->flags != 0) {
@@ -912,7 +937,7 @@ out: · 10 unmodified lines
912937 return ret;
913938 }
914939
915−static int test_extent_accounting(void)
940+static int test_extent_accounting(u32 sectorsize, u32 nodesize)
916941 {
917942 struct inode *inode = NULL;
918943 struct btrfs_root *root = NULL;
@@ -924,7 +949,7 @@ static int test_extent_accounting(void) · 5 unmodified lines
924949 return ret;
925950 }
926951
927− root = btrfs_alloc_dummy_root();
952+ root = btrfs_alloc_dummy_root(sectorsize, nodesize);
928953 if (IS_ERR(root)) {
929954 test_msg("Couldn't allocate root\n");
930955 goto out;
@@ -954,10 +979,11 @@ static int test_extent_accounting(void) · 23 unmodified lines
954979 goto out;
955980 }
956981
957− /* [BTRFS_MAX_EXTENT_SIZE][4k] */
982+ /* [BTRFS_MAX_EXTENT_SIZE][sectorsize] */
958983 BTRFS_I(inode)->outstanding_extents++;
959984 ret = btrfs_set_extent_delalloc(inode, BTRFS_MAX_EXTENT_SIZE,
960− BTRFS_MAX_EXTENT_SIZE + 4095, NULL);
985+ BTRFS_MAX_EXTENT_SIZE + sectorsize - 1,
986+ NULL);
961987 if (ret) {
962988 test_msg("btrfs_set_extent_delalloc returned %d\n", ret);
963989 goto out;
@@ -969,10 +995,10 @@ static int test_extent_accounting(void) · 5 unmodified lines
969995 goto out;
970996 }
971997
972− /* [BTRFS_MAX_EXTENT_SIZE/2][4K HOLE][the rest] */
998+ /* [BTRFS_MAX_EXTENT_SIZE/2][sectorsize HOLE][the rest] */
973999 ret = clear_extent_bit(&BTRFS_I(inode)->io_tree,
9741000 BTRFS_MAX_EXTENT_SIZE >> 1,
975− (BTRFS_MAX_EXTENT_SIZE >> 1) + 4095,
1001+ (BTRFS_MAX_EXTENT_SIZE >> 1) + sectorsize - 1,
9761002 EXTENT_DELALLOC | EXTENT_DIRTY |
9771003 EXTENT_UPTODATE | EXTENT_DO_ACCOUNTING, 0, 0,
9781004 NULL, GFP_KERNEL);
@@ -987,10 +1013,11 @@ static int test_extent_accounting(void) · 8 unmodified lines
9871013 goto out;
9881014 }
9891015
990− /* [BTRFS_MAX_EXTENT_SIZE][4K] */
1016+ /* [BTRFS_MAX_EXTENT_SIZE][sectorsize] */
9911017 BTRFS_I(inode)->outstanding_extents++;
9921018 ret = btrfs_set_extent_delalloc(inode, BTRFS_MAX_EXTENT_SIZE >> 1,
993− (BTRFS_MAX_EXTENT_SIZE >> 1) + 4095,
1019+ (BTRFS_MAX_EXTENT_SIZE >> 1)
1020+ + sectorsize - 1,
9941021 NULL);
9951022 if (ret) {
9961023 test_msg("btrfs_set_extent_delalloc returned %d\n", ret);
@@ -1004,16 +1031,17 @@ static int test_extent_accounting(void) · 7 unmodified lines
10041031 }
10051032
10061033 /*
1007− * [BTRFS_MAX_EXTENT_SIZE+4K][4K HOLE][BTRFS_MAX_EXTENT_SIZE+4K]
1034+ * [BTRFS_MAX_EXTENT_SIZE+sectorsize][sectorsize HOLE][BTRFS_MAX_EXTENT_SIZE+sectorsize]
10081035 *
10091036 * I'm artificially adding 2 to outstanding_extents because in the
10101037 * buffered IO case we'd add things up as we go, but I don't feel like
10111038 * doing that here, this isn't the interesting case we want to test.
10121039 */
10131040 BTRFS_I(inode)->outstanding_extents += 2;
1014− ret = btrfs_set_extent_delalloc(inode, BTRFS_MAX_EXTENT_SIZE + 8192,
1015− (BTRFS_MAX_EXTENT_SIZE << 1) + 12287,
1016− NULL);
1041+ ret = btrfs_set_extent_delalloc(inode,
1042+ BTRFS_MAX_EXTENT_SIZE + 2 * sectorsize,
1043+ (BTRFS_MAX_EXTENT_SIZE << 1) + 3 * sectorsize - 1,
1044+ NULL);
10171045 if (ret) {
10181046 test_msg("btrfs_set_extent_delalloc returned %d\n", ret);
10191047 goto out;
@@ -1025,10 +1053,13 @@ static int test_extent_accounting(void) · 5 unmodified lines
10251053 goto out;
10261054 }
10271055
1028− /* [BTRFS_MAX_EXTENT_SIZE+4k][4k][BTRFS_MAX_EXTENT_SIZE+4k] */
1056+ /*
1057+ * [BTRFS_MAX_EXTENT_SIZE+sectorsize][sectorsize][BTRFS_MAX_EXTENT_SIZE+sectorsize]
1058+ */
10291059 BTRFS_I(inode)->outstanding_extents++;
1030− ret = btrfs_set_extent_delalloc(inode, BTRFS_MAX_EXTENT_SIZE+4096,
1031− BTRFS_MAX_EXTENT_SIZE+8191, NULL);
1060+ ret = btrfs_set_extent_delalloc(inode,
1061+ BTRFS_MAX_EXTENT_SIZE + sectorsize,
1062+ BTRFS_MAX_EXTENT_SIZE + 2 * sectorsize - 1, NULL);
10321063 if (ret) {
10331064 test_msg("btrfs_set_extent_delalloc returned %d\n", ret);
10341065 goto out;
@@ -1042,8 +1073,8 @@ static int test_extent_accounting(void) · 7 unmodified lines
10421073
10431074 /* [BTRFS_MAX_EXTENT_SIZE+4k][4K HOLE][BTRFS_MAX_EXTENT_SIZE+4k] */
10441075 ret = clear_extent_bit(&BTRFS_I(inode)->io_tree,
1045− BTRFS_MAX_EXTENT_SIZE+4096,
1046− BTRFS_MAX_EXTENT_SIZE+8191,
1076+ BTRFS_MAX_EXTENT_SIZE + sectorsize,
1077+ BTRFS_MAX_EXTENT_SIZE + 2 * sectorsize - 1,
10471078 EXTENT_DIRTY | EXTENT_DELALLOC |
10481079 EXTENT_DO_ACCOUNTING | EXTENT_UPTODATE, 0, 0,
10491080 NULL, GFP_KERNEL);
@@ -1063,8 +1094,9 @@ static int test_extent_accounting(void) · 13 unmodified lines
10631094 * might fail and I'd rather satisfy my paranoia at this point.
10641095 */
10651096 BTRFS_I(inode)->outstanding_extents++;
1066− ret = btrfs_set_extent_delalloc(inode, BTRFS_MAX_EXTENT_SIZE+4096,
1067− BTRFS_MAX_EXTENT_SIZE+8191, NULL);
1097+ ret = btrfs_set_extent_delalloc(inode,
1098+ BTRFS_MAX_EXTENT_SIZE + sectorsize,
1099+ BTRFS_MAX_EXTENT_SIZE + 2 * sectorsize - 1, NULL);
10681100 if (ret) {
10691101 test_msg("btrfs_set_extent_delalloc returned %d\n", ret);
10701102 goto out;
@@ -1103,7 +1135,7 @@ out: · 32 unmodified lines
11031135 return ret;
11041136 }
11051137
1106−int btrfs_test_inodes(void)
1138+int btrfs_test_inodes(u32 sectorsize, u32 nodesize)
11071139 {
11081140 int ret;
11091141
@@ -1112,13 +1144,13 @@ int btrfs_test_inodes(void) · 2 unmodified lines
11121144 set_bit(EXTENT_FLAG_PREALLOC, &prealloc_only);
11131145
11141146 test_msg("Running btrfs_get_extent tests\n");
1115− ret = test_btrfs_get_extent();
1147+ ret = test_btrfs_get_extent(sectorsize, nodesize);
11161148 if (ret)
11171149 return ret;
11181150 test_msg("Running hole first btrfs_get_extent test\n");
1119− ret = test_hole_first();
1151+ ret = test_hole_first(sectorsize, nodesize);
11201152 if (ret)
11211153 return ret;
11221154 test_msg("Running outstanding_extents tests\n");
1123− return test_extent_accounting();
1155+ return test_extent_accounting(sectorsize, nodesize);
11241156 }
fs/btrfs/tests/qgroup-tests.c+64−47
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616 * Boston, MA 021110-1307, USA.
1717 */
1818
19+#include <linux/types.h>
1920 #include "btrfs-tests.h"
2021 #include "../ctree.h"
2122 #include "../transaction.h"
@@ -216,7 +217,8 @@ static int remove_extent_ref(struct btrfs_root *root, u64 bytenr, · 194 unmodified lines
216217 return ret;
217218 }
218219
219−static int test_no_shared_qgroup(struct btrfs_root *root)
220+static int test_no_shared_qgroup(struct btrfs_root *root,
221+ u32 sectorsize, u32 nodesize)
220222 {
221223 struct btrfs_trans_handle trans;
222224 struct btrfs_fs_info *fs_info = root->fs_info;
@@ -227,7 +229,7 @@ static int test_no_shared_qgroup(struct btrfs_root *root) · 4 unmodified lines
227229 btrfs_init_dummy_trans(&trans);
228230
229231 test_msg("Qgroup basic add\n");
230− ret = btrfs_create_qgroup(NULL, fs_info, 5);
232+ ret = btrfs_create_qgroup(NULL, fs_info, BTRFS_FS_TREE_OBJECTID);
231233 if (ret) {
232234 test_msg("Couldn't create a qgroup %d\n", ret);
233235 return ret;
@@ -238,18 +240,19 @@ static int test_no_shared_qgroup(struct btrfs_root *root) · 4 unmodified lines
238240 * we can only call btrfs_qgroup_account_extent() directly to test
239241 * quota.
240242 */
241− ret = btrfs_find_all_roots(&trans, fs_info, 4096, 0, &old_roots);
243+ ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &old_roots);
242244 if (ret) {
243245 ulist_free(old_roots);
244246 test_msg("Couldn't find old roots: %d\n", ret);
245247 return ret;
246248 }
247249
248− ret = insert_normal_tree_ref(root, 4096, 4096, 0, 5);
250+ ret = insert_normal_tree_ref(root, nodesize, nodesize, 0,
251+ BTRFS_FS_TREE_OBJECTID);
249252 if (ret)
250253 return ret;
251254
252− ret = btrfs_find_all_roots(&trans, fs_info, 4096, 0, &new_roots);
255+ ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &new_roots);
253256 if (ret) {
254257 ulist_free(old_roots);
255258 ulist_free(new_roots);
@@ -257,32 +260,33 @@ static int test_no_shared_qgroup(struct btrfs_root *root) · 1 unmodified line
257260 return ret;
258261 }
259262
260− ret = btrfs_qgroup_account_extent(&trans, fs_info, 4096, 4096,
261− old_roots, new_roots);
263+ ret = btrfs_qgroup_account_extent(&trans, fs_info, nodesize,
264+ nodesize, old_roots, new_roots);
262265 if (ret) {
263266 test_msg("Couldn't account space for a qgroup %d\n", ret);
264267 return ret;
265268 }
266269
267− if (btrfs_verify_qgroup_counts(fs_info, 5, 4096, 4096)) {
270+ if (btrfs_verify_qgroup_counts(fs_info, BTRFS_FS_TREE_OBJECTID,
271+ nodesize, nodesize)) {
268272 test_msg("Qgroup counts didn't match expected values\n");
269273 return -EINVAL;
270274 }
271275 old_roots = NULL;
272276 new_roots = NULL;
273277
274− ret = btrfs_find_all_roots(&trans, fs_info, 4096, 0, &old_roots);
278+ ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &old_roots);
275279 if (ret) {
276280 ulist_free(old_roots);
277281 test_msg("Couldn't find old roots: %d\n", ret);
278282 return ret;
279283 }
280284
281− ret = remove_extent_item(root, 4096, 4096);
285+ ret = remove_extent_item(root, nodesize, nodesize);
282286 if (ret)
283287 return -EINVAL;
284288
285− ret = btrfs_find_all_roots(&trans, fs_info, 4096, 0, &new_roots);
289+ ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &new_roots);
286290 if (ret) {
287291 ulist_free(old_roots);
288292 ulist_free(new_roots);
@@ -290,14 +294,14 @@ static int test_no_shared_qgroup(struct btrfs_root *root) · 1 unmodified line
290294 return ret;
291295 }
292296
293− ret = btrfs_qgroup_account_extent(&trans, fs_info, 4096, 4096,
294− old_roots, new_roots);
297+ ret = btrfs_qgroup_account_extent(&trans, fs_info, nodesize,
298+ nodesize, old_roots, new_roots);
295299 if (ret) {
296300 test_msg("Couldn't account space for a qgroup %d\n", ret);
297301 return -EINVAL;
298302 }
299303
300− if (btrfs_verify_qgroup_counts(fs_info, 5, 0, 0)) {
304+ if (btrfs_verify_qgroup_counts(fs_info, BTRFS_FS_TREE_OBJECTID, 0, 0)) {
301305 test_msg("Qgroup counts didn't match expected values\n");
302306 return -EINVAL;
303307 }
@@ -310,7 +314,8 @@ static int test_no_shared_qgroup(struct btrfs_root *root) · 6 unmodified lines
310314 * right, also remove one of the roots and make sure the exclusive count is
311315 * adjusted properly.
312316 */
313−static int test_multiple_refs(struct btrfs_root *root)
317+static int test_multiple_refs(struct btrfs_root *root,
318+ u32 sectorsize, u32 nodesize)
314319 {
315320 struct btrfs_trans_handle trans;
316321 struct btrfs_fs_info *fs_info = root->fs_info;
@@ -322,25 +327,29 @@ static int test_multiple_refs(struct btrfs_root *root) · 5 unmodified lines
322327
323328 test_msg("Qgroup multiple refs test\n");
324329
325− /* We have 5 created already from the previous test */
326− ret = btrfs_create_qgroup(NULL, fs_info, 256);
330+ /*
331+ * We have BTRFS_FS_TREE_OBJECTID created already from the
332+ * previous test.
333+ */
334+ ret = btrfs_create_qgroup(NULL, fs_info, BTRFS_FIRST_FREE_OBJECTID);
327335 if (ret) {
328336 test_msg("Couldn't create a qgroup %d\n", ret);
329337 return ret;
330338 }
331339
332− ret = btrfs_find_all_roots(&trans, fs_info, 4096, 0, &old_roots);
340+ ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &old_roots);
333341 if (ret) {
334342 ulist_free(old_roots);
335343 test_msg("Couldn't find old roots: %d\n", ret);
336344 return ret;
337345 }
338346
339− ret = insert_normal_tree_ref(root, 4096, 4096, 0, 5);
347+ ret = insert_normal_tree_ref(root, nodesize, nodesize, 0,
348+ BTRFS_FS_TREE_OBJECTID);
340349 if (ret)
341350 return ret;
342351
343− ret = btrfs_find_all_roots(&trans, fs_info, 4096, 0, &new_roots);
352+ ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &new_roots);
344353 if (ret) {
345354 ulist_free(old_roots);
346355 ulist_free(new_roots);
@@ -348,30 +357,32 @@ static int test_multiple_refs(struct btrfs_root *root) · 1 unmodified line
348357 return ret;
349358 }
350359
351− ret = btrfs_qgroup_account_extent(&trans, fs_info, 4096, 4096,
352− old_roots, new_roots);
360+ ret = btrfs_qgroup_account_extent(&trans, fs_info, nodesize,
361+ nodesize, old_roots, new_roots);
353362 if (ret) {
354363 test_msg("Couldn't account space for a qgroup %d\n", ret);
355364 return ret;
356365 }
357366
358− if (btrfs_verify_qgroup_counts(fs_info, 5, 4096, 4096)) {
367+ if (btrfs_verify_qgroup_counts(fs_info, BTRFS_FS_TREE_OBJECTID,
368+ nodesize, nodesize)) {
359369 test_msg("Qgroup counts didn't match expected values\n");
360370 return -EINVAL;
361371 }
362372
363− ret = btrfs_find_all_roots(&trans, fs_info, 4096, 0, &old_roots);
373+ ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &old_roots);
364374 if (ret) {
365375 ulist_free(old_roots);
366376 test_msg("Couldn't find old roots: %d\n", ret);
367377 return ret;
368378 }
369379
370− ret = add_tree_ref(root, 4096, 4096, 0, 256);
380+ ret = add_tree_ref(root, nodesize, nodesize, 0,
381+ BTRFS_FIRST_FREE_OBJECTID);
371382 if (ret)
372383 return ret;
373384
374− ret = btrfs_find_all_roots(&trans, fs_info, 4096, 0, &new_roots);
385+ ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &new_roots);
375386 if (ret) {
376387 ulist_free(old_roots);
377388 ulist_free(new_roots);
@@ -379,35 +390,38 @@ static int test_multiple_refs(struct btrfs_root *root) · 1 unmodified line
379390 return ret;
380391 }
381392
382− ret = btrfs_qgroup_account_extent(&trans, fs_info, 4096, 4096,
383− old_roots, new_roots);
393+ ret = btrfs_qgroup_account_extent(&trans, fs_info, nodesize,
394+ nodesize, old_roots, new_roots);
384395 if (ret) {
385396 test_msg("Couldn't account space for a qgroup %d\n", ret);
386397 return ret;
387398 }
388399
389− if (btrfs_verify_qgroup_counts(fs_info, 5, 4096, 0)) {
400+ if (btrfs_verify_qgroup_counts(fs_info, BTRFS_FS_TREE_OBJECTID,
401+ nodesize, 0)) {
390402 test_msg("Qgroup counts didn't match expected values\n");
391403 return -EINVAL;
392404 }
393405
394− if (btrfs_verify_qgroup_counts(fs_info, 256, 4096, 0)) {
406+ if (btrfs_verify_qgroup_counts(fs_info, BTRFS_FIRST_FREE_OBJECTID,
407+ nodesize, 0)) {
395408 test_msg("Qgroup counts didn't match expected values\n");
396409 return -EINVAL;
397410 }
398411
399− ret = btrfs_find_all_roots(&trans, fs_info, 4096, 0, &old_roots);
412+ ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &old_roots);
400413 if (ret) {
401414 ulist_free(old_roots);
402415 test_msg("Couldn't find old roots: %d\n", ret);
403416 return ret;
404417 }
405418
406− ret = remove_extent_ref(root, 4096, 4096, 0, 256);
419+ ret = remove_extent_ref(root, nodesize, nodesize, 0,
420+ BTRFS_FIRST_FREE_OBJECTID);
407421 if (ret)
408422 return ret;
409423
410− ret = btrfs_find_all_roots(&trans, fs_info, 4096, 0, &new_roots);
424+ ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &new_roots);
411425 if (ret) {
412426 ulist_free(old_roots);
413427 ulist_free(new_roots);
@@ -415,19 +429,21 @@ static int test_multiple_refs(struct btrfs_root *root) · 1 unmodified line
415429 return ret;
416430 }
417431
418− ret = btrfs_qgroup_account_extent(&trans, fs_info, 4096, 4096,
419− old_roots, new_roots);
432+ ret = btrfs_qgroup_account_extent(&trans, fs_info, nodesize,
433+ nodesize, old_roots, new_roots);
420434 if (ret) {
421435 test_msg("Couldn't account space for a qgroup %d\n", ret);
422436 return ret;
423437 }
424438
425− if (btrfs_verify_qgroup_counts(fs_info, 256, 0, 0)) {
439+ if (btrfs_verify_qgroup_counts(fs_info, BTRFS_FIRST_FREE_OBJECTID,
440+ 0, 0)) {
426441 test_msg("Qgroup counts didn't match expected values\n");
427442 return -EINVAL;
428443 }
429444
430− if (btrfs_verify_qgroup_counts(fs_info, 5, 4096, 4096)) {
445+ if (btrfs_verify_qgroup_counts(fs_info, BTRFS_FS_TREE_OBJECTID,
446+ nodesize, nodesize)) {
431447 test_msg("Qgroup counts didn't match expected values\n");
432448 return -EINVAL;
433449 }
@@ -435,13 +451,13 @@ static int test_multiple_refs(struct btrfs_root *root) · 1 unmodified line
435451 return 0;
436452 }
437453
438−int btrfs_test_qgroups(void)
454+int btrfs_test_qgroups(u32 sectorsize, u32 nodesize)
439455 {
440456 struct btrfs_root *root;
441457 struct btrfs_root *tmp_root;
442458 int ret = 0;
443459
444− root = btrfs_alloc_dummy_root();
460+ root = btrfs_alloc_dummy_root(sectorsize, nodesize);
445461 if (IS_ERR(root)) {
446462 test_msg("Couldn't allocate root\n");
447463 return PTR_ERR(root);
@@ -468,7 +484,8 @@ int btrfs_test_qgroups(void) · 20 unmodified lines
468484 * Can't use bytenr 0, some things freak out
469485 * *cough*backref walking code*cough*
470486 */
471− root->node = alloc_test_extent_buffer(root->fs_info, 4096);
487+ root->node = alloc_test_extent_buffer(root->fs_info, nodesize,
488+ nodesize);
472489 if (!root->node) {
473490 test_msg("Couldn't allocate dummy buffer\n");
474491 ret = -ENOMEM;
@@ -476,16 +493,16 @@ int btrfs_test_qgroups(void) · 1 unmodified line
476493 }
477494 btrfs_set_header_level(root->node, 0);
478495 btrfs_set_header_nritems(root->node, 0);
479− root->alloc_bytenr += 8192;
496+ root->alloc_bytenr += 2 * nodesize;
480497
481− tmp_root = btrfs_alloc_dummy_root();
498+ tmp_root = btrfs_alloc_dummy_root(sectorsize, nodesize);
482499 if (IS_ERR(tmp_root)) {
483500 test_msg("Couldn't allocate a fs root\n");
484501 ret = PTR_ERR(tmp_root);
485502 goto out;
486503 }
487504
488− tmp_root->root_key.objectid = 5;
505+ tmp_root->root_key.objectid = BTRFS_FS_TREE_OBJECTID;
489506 root->fs_info->fs_root = tmp_root;
490507 ret = btrfs_insert_fs_root(root->fs_info, tmp_root);
491508 if (ret) {
@@ -493,14 +510,14 @@ int btrfs_test_qgroups(void) · 1 unmodified line
493510 goto out;
494511 }
495512
496− tmp_root = btrfs_alloc_dummy_root();
513+ tmp_root = btrfs_alloc_dummy_root(sectorsize, nodesize);
497514 if (IS_ERR(tmp_root)) {
498515 test_msg("Couldn't allocate a fs root\n");
499516 ret = PTR_ERR(tmp_root);
500517 goto out;
501518 }
502519
503− tmp_root->root_key.objectid = 256;
520+ tmp_root->root_key.objectid = BTRFS_FIRST_FREE_OBJECTID;
504521 ret = btrfs_insert_fs_root(root->fs_info, tmp_root);
505522 if (ret) {
506523 test_msg("Couldn't insert fs root %d\n", ret);
@@ -508,10 +525,10 @@ int btrfs_test_qgroups(void) · 1 unmodified line
508525 }
509526
510527 test_msg("Running qgroup tests\n");
511− ret = test_no_shared_qgroup(root);
528+ ret = test_no_shared_qgroup(root, sectorsize, nodesize);
512529 if (ret)
513530 goto out;
514− ret = test_multiple_refs(root);
531+ ret = test_multiple_refs(root, sectorsize, nodesize);
515532 out:
516533 btrfs_free_dummy_root(root);
517534 return ret;
fs/btrfs/transaction.c+1−6
@@ -1311,11 +1311,6 @@ int btrfs_defrag_root(struct btrfs_root *root) · 1310 unmodified lines
13111311 return ret;
13121312 }
13131313
1314−/* Bisesctability fixup, remove in 4.8 */
1315−#ifndef btrfs_std_error
1316−#define btrfs_std_error btrfs_handle_fs_error
1317−#endif
1318−
13191314 /*
13201315 * Do all special snapshot related qgroup dirty hack.
13211316 *
@@ -1385,7 +1380,7 @@ static int qgroup_account_snapshot(struct btrfs_trans_handle *trans, · 63 unmodified lines
13851380 switch_commit_roots(trans->transaction, fs_info);
13861381 ret = btrfs_write_and_wait_transaction(trans, src);
13871382 if (ret)
1388− btrfs_std_error(fs_info, ret,
1383+ btrfs_handle_fs_error(fs_info, ret,
13891384 "Error while writing out transaction for qgroup");
13901385
13911386 out:
fs/btrfs/transaction.h+1−1
@@ -110,7 +110,6 @@ struct btrfs_trans_handle { · 109 unmodified lines
110110 u64 chunk_bytes_reserved;
111111 unsigned long use_count;
112112 unsigned long blocks_reserved;
113− unsigned long blocks_used;
114113 unsigned long delayed_ref_updates;
115114 struct btrfs_transaction *transaction;
116115 struct btrfs_block_rsv *block_rsv;
@@ -121,6 +120,7 @@ struct btrfs_trans_handle { · 4 unmodified lines
121120 bool can_flush_pending_bgs;
122121 bool reloc_reserved;
123122 bool sync;
123+ bool dirty;
124124 unsigned int type;
125125 /*
126126 * this root is only needed to validate that the root passed to
fs/btrfs/tree-log.c+2−2
@@ -2422,8 +2422,8 @@ static noinline int walk_down_log_tree(struct btrfs_trans_handle *trans, · 2421 unmodified lines
24222422 root_owner = btrfs_header_owner(parent);
24232423
24242424 next = btrfs_find_create_tree_block(root, bytenr);
2425− if (!next)
2426− return -ENOMEM;
2425+ if (IS_ERR(next))
2426+ return PTR_ERR(next);
24272427
24282428 if (*level == 1) {
24292429 ret = wc->process_func(root, next, wc, ptr_gen);
fs/btrfs/volumes.c+96−17
@@ -4241,6 +4241,7 @@ int btrfs_create_uuid_tree(struct btrfs_fs_info *fs_info) · 4240 unmodified lines
42414241 if (IS_ERR(uuid_root)) {
42424242 ret = PTR_ERR(uuid_root);
42434243 btrfs_abort_transaction(trans, tree_root, ret);
4244+ btrfs_end_transaction(trans, tree_root);
42444245 return ret;
42454246 }
42464247
@@ -6258,27 +6259,23 @@ struct btrfs_device *btrfs_alloc_device(struct btrfs_fs_info *fs_info, · 2011 unmodified lines
62586259 return dev;
62596260 }
62606261
6261−static int read_one_chunk(struct btrfs_root *root, struct btrfs_key *key,
6262− struct extent_buffer *leaf,
6263− struct btrfs_chunk *chunk)
6262+/* Return -EIO if any error, otherwise return 0. */
6263+static int btrfs_check_chunk_valid(struct btrfs_root *root,
6264+ struct extent_buffer *leaf,
6265+ struct btrfs_chunk *chunk, u64 logical)
62646266 {
6265− struct btrfs_mapping_tree *map_tree = &root->fs_info->mapping_tree;
6266− struct map_lookup *map;
6267− struct extent_map *em;
6268− u64 logical;
62696267 u64 length;
62706268 u64 stripe_len;
6271− u64 devid;
6272− u8 uuid[BTRFS_UUID_SIZE];
6273− int num_stripes;
6274− int ret;
6275− int i;
6269+ u16 num_stripes;
6270+ u16 sub_stripes;
6271+ u64 type;
62766272
6277− logical = key->offset;
62786273 length = btrfs_chunk_length(leaf, chunk);
62796274 stripe_len = btrfs_chunk_stripe_len(leaf, chunk);
62806275 num_stripes = btrfs_chunk_num_stripes(leaf, chunk);
6281− /* Validation check */
6276+ sub_stripes = btrfs_chunk_sub_stripes(leaf, chunk);
6277+ type = btrfs_chunk_type(leaf, chunk);
6278+
62826279 if (!num_stripes) {
62836280 btrfs_err(root->fs_info, "invalid chunk num_stripes: %u",
62846281 num_stripes);
@@ -6289,6 +6286,11 @@ static int read_one_chunk(struct btrfs_root *root, struct btrfs_key *key, · 4 unmodified lines
62896286 "invalid chunk logical %llu", logical);
62906287 return -EIO;
62916288 }
6289+ if (btrfs_chunk_sector_size(leaf, chunk) != root->sectorsize) {
6290+ btrfs_err(root->fs_info, "invalid chunk sectorsize %u",
6291+ btrfs_chunk_sector_size(leaf, chunk));
6292+ return -EIO;
6293+ }
62926294 if (!length || !IS_ALIGNED(length, root->sectorsize)) {
62936295 btrfs_err(root->fs_info,
62946296 "invalid chunk length %llu", length);
@@ -6300,13 +6302,54 @@ static int read_one_chunk(struct btrfs_root *root, struct btrfs_key *key, · 5 unmodified lines
63006302 return -EIO;
63016303 }
63026304 if (~(BTRFS_BLOCK_GROUP_TYPE_MASK | BTRFS_BLOCK_GROUP_PROFILE_MASK) &
6303− btrfs_chunk_type(leaf, chunk)) {
6305+ type) {
63046306 btrfs_err(root->fs_info, "unrecognized chunk type: %llu",
63056307 ~(BTRFS_BLOCK_GROUP_TYPE_MASK |
63066308 BTRFS_BLOCK_GROUP_PROFILE_MASK) &
63076309 btrfs_chunk_type(leaf, chunk));
63086310 return -EIO;
63096311 }
6312+ if ((type & BTRFS_BLOCK_GROUP_RAID10 && sub_stripes != 2) ||
6313+ (type & BTRFS_BLOCK_GROUP_RAID1 && num_stripes < 1) ||
6314+ (type & BTRFS_BLOCK_GROUP_RAID5 && num_stripes < 2) ||
6315+ (type & BTRFS_BLOCK_GROUP_RAID6 && num_stripes < 3) ||
6316+ (type & BTRFS_BLOCK_GROUP_DUP && num_stripes > 2) ||
6317+ ((type & BTRFS_BLOCK_GROUP_PROFILE_MASK) == 0 &&
6318+ num_stripes != 1)) {
6319+ btrfs_err(root->fs_info,
6320+ "invalid num_stripes:sub_stripes %u:%u for profile %llu",
6321+ num_stripes, sub_stripes,
6322+ type & BTRFS_BLOCK_GROUP_PROFILE_MASK);
6323+ return -EIO;
6324+ }
6325+
6326+ return 0;
6327+}
6328+
6329+static int read_one_chunk(struct btrfs_root *root, struct btrfs_key *key,
6330+ struct extent_buffer *leaf,
6331+ struct btrfs_chunk *chunk)
6332+{
6333+ struct btrfs_mapping_tree *map_tree = &root->fs_info->mapping_tree;
6334+ struct map_lookup *map;
6335+ struct extent_map *em;
6336+ u64 logical;
6337+ u64 length;
6338+ u64 stripe_len;
6339+ u64 devid;
6340+ u8 uuid[BTRFS_UUID_SIZE];
6341+ int num_stripes;
6342+ int ret;
6343+ int i;
6344+
6345+ logical = key->offset;
6346+ length = btrfs_chunk_length(leaf, chunk);
6347+ stripe_len = btrfs_chunk_stripe_len(leaf, chunk);
6348+ num_stripes = btrfs_chunk_num_stripes(leaf, chunk);
6349+
6350+ ret = btrfs_check_chunk_valid(root, leaf, chunk, logical);
6351+ if (ret)
6352+ return ret;
63106353
63116354 read_lock(&map_tree->map_tree.lock);
63126355 em = lookup_extent_mapping(&map_tree->map_tree, logical, 1);
@@ -6554,6 +6597,7 @@ int btrfs_read_sys_array(struct btrfs_root *root) · 241 unmodified lines
65546597 u32 array_size;
65556598 u32 len = 0;
65566599 u32 cur_offset;
6600+ u64 type;
65576601 struct btrfs_key key;
65586602
65596603 ASSERT(BTRFS_SUPER_INFO_SIZE <= root->nodesize);
@@ -6563,8 +6607,8 @@ int btrfs_read_sys_array(struct btrfs_root *root) · 3 unmodified lines
65636607 * overallocate but we can keep it as-is, only the first page is used.
65646608 */
65656609 sb = btrfs_find_create_tree_block(root, BTRFS_SUPER_INFO_OFFSET);
6566− if (!sb)
6567− return -ENOMEM;
6610+ if (IS_ERR(sb))
6611+ return PTR_ERR(sb);
65686612 set_extent_buffer_uptodate(sb);
65696613 btrfs_set_buffer_lockdep_class(root->root_key.objectid, sb, 0);
65706614 /*
@@ -6620,6 +6664,15 @@ int btrfs_read_sys_array(struct btrfs_root *root) · 49 unmodified lines
66206664 break;
66216665 }
66226666
6667+ type = btrfs_chunk_type(sb, chunk);
6668+ if ((type & BTRFS_BLOCK_GROUP_SYSTEM) == 0) {
6669+ btrfs_err(root->fs_info,
6670+ "invalid chunk type %llu in sys_array at offset %u",
6671+ type, cur_offset);
6672+ ret = -EIO;
6673+ break;
6674+ }
6675+
66236676 len = btrfs_chunk_item_size(num_stripes);
66246677 if (cur_offset + len > array_size)
66256678 goto out_short_read;
@@ -6638,12 +6691,14 @@ int btrfs_read_sys_array(struct btrfs_root *root) · 12 unmodified lines
66386691 sb_array_offset += len;
66396692 cur_offset += len;
66406693 }
6694+ clear_extent_buffer_uptodate(sb);
66416695 free_extent_buffer_stale(sb);
66426696 return ret;
66436697
66446698 out_short_read:
66456699 printk(KERN_ERR "BTRFS: sys_array too short to read %u bytes at offset %u\n",
66466700 len, cur_offset);
6701+ clear_extent_buffer_uptodate(sb);
66476702 free_extent_buffer_stale(sb);
66486703 return -EIO;
66496704 }
@@ -6656,6 +6711,7 @@ int btrfs_read_chunk_tree(struct btrfs_root *root) · 6 unmodified lines
66566711 struct btrfs_key found_key;
66576712 int ret;
66586713 int slot;
6714+ u64 total_dev = 0;
66596715
66606716 root = root->fs_info->chunk_root;
66616717
@@ -6697,6 +6753,7 @@ int btrfs_read_chunk_tree(struct btrfs_root *root) · 35 unmodified lines
66976753 ret = read_one_dev(root, leaf, dev_item);
66986754 if (ret)
66996755 goto error;
6756+ total_dev++;
67006757 } else if (found_key.type == BTRFS_CHUNK_ITEM_KEY) {
67016758 struct btrfs_chunk *chunk;
67026759 chunk = btrfs_item_ptr(leaf, slot, struct btrfs_chunk);
@@ -6706,6 +6763,28 @@ int btrfs_read_chunk_tree(struct btrfs_root *root) · 3 unmodified lines
67066763 }
67076764 path->slots[0]++;
67086765 }
6766+
6767+ /*
6768+ * After loading chunk tree, we've got all device information,
6769+ * do another round of validation checks.
6770+ */
6771+ if (total_dev != root->fs_info->fs_devices->total_devices) {
6772+ btrfs_err(root->fs_info,
6773+ "super_num_devices %llu mismatch with num_devices %llu found here",
6774+ btrfs_super_num_devices(root->fs_info->super_copy),
6775+ total_dev);
6776+ ret = -EINVAL;
6777+ goto error;
6778+ }
6779+ if (btrfs_super_total_bytes(root->fs_info->super_copy) <
6780+ root->fs_info->fs_devices->total_rw_bytes) {
6781+ btrfs_err(root->fs_info,
6782+ "super_total_bytes %llu mismatch with fs_devices total_rw_bytes %llu",
6783+ btrfs_super_total_bytes(root->fs_info->super_copy),
6784+ root->fs_info->fs_devices->total_rw_bytes);
6785+ ret = -EINVAL;
6786+ goto error;
6787+ }
67096788 ret = 0;
67106789 error:
67116790 unlock_chunks(root);
fs/coredump.c+3−1
@@ -794,6 +794,7 @@ int dump_emit(struct coredump_params *cprm, const void *addr, int nr) · 793 unmodified lines
794794 return 0;
795795 file->f_pos = pos;
796796 cprm->written += n;
797+ cprm->pos += n;
797798 nr -= n;
798799 }
799800 return 1;
@@ -808,6 +809,7 @@ int dump_skip(struct coredump_params *cprm, size_t nr) · 8 unmodified lines
808809 if (dump_interrupted() ||
809810 file->f_op->llseek(file, nr, SEEK_CUR) < 0)
810811 return 0;
812+ cprm->pos += nr;
811813 return 1;
812814 } else {
813815 while (nr > PAGE_SIZE) {
@@ -822,7 +824,7 @@ EXPORT_SYMBOL(dump_skip); · 8 unmodified lines
822824
823825 int dump_align(struct coredump_params *cprm, int align)
824826 {
825− unsigned mod = cprm->file->f_pos & (align - 1);
827+ unsigned mod = cprm->pos & (align - 1);
826828 if (align & (align - 1))
827829 return 0;
828830 return mod ? dump_skip(cprm, align - mod) : 1;
fs/dcache.c+2−2
@@ -1636,7 +1636,7 @@ struct dentry *d_alloc(struct dentry * parent, const struct qstr *name) · 1635 unmodified lines
16361636 struct dentry *dentry = __d_alloc(parent->d_sb, name);
16371637 if (!dentry)
16381638 return NULL;
1639−
1639+ dentry->d_flags |= DCACHE_RCUACCESS;
16401640 spin_lock(&parent->d_lock);
16411641 /*
16421642 * don't need child lock because it is not subject
@@ -2358,7 +2358,6 @@ static void __d_rehash(struct dentry * entry, struct hlist_bl_head *b) · 715 unmodified lines
23582358 {
23592359 BUG_ON(!d_unhashed(entry));
23602360 hlist_bl_lock(b);
2361− entry->d_flags |= DCACHE_RCUACCESS;
23622361 hlist_bl_add_head_rcu(&entry->d_hash, b);
23632362 hlist_bl_unlock(b);
23642363 }
@@ -2843,6 +2842,7 @@ static void __d_move(struct dentry *dentry, struct dentry *target, · 478 unmodified lines
28432842 /* ... and switch them in the tree */
28442843 if (IS_ROOT(dentry)) {
28452844 /* splicing a tree */
2845+ dentry->d_flags |= DCACHE_RCUACCESS;
28462846 dentry->d_parent = target->d_parent;
28472847 target->d_parent = target;
28482848 list_del_init(&target->d_child);
fs/debugfs/file.c+4−3
@@ -127,7 +127,6 @@ static int open_proxy_open(struct inode *inode, struct file *filp) · 126 unmodified lines
127127 r = real_fops->open(inode, filp);
128128
129129 out:
130− fops_put(real_fops);
131130 debugfs_use_file_finish(srcu_idx);
132131 return r;
133132 }
@@ -262,8 +261,10 @@ static int full_proxy_open(struct inode *inode, struct file *filp) · 128 unmodified lines
262261
263262 if (real_fops->open) {
264263 r = real_fops->open(inode, filp);
265−
266− if (filp->f_op != proxy_fops) {
264+ if (r) {
265+ replace_fops(filp, d_inode(dentry)->i_fop);
266+ goto free_proxy;
267+ } else if (filp->f_op != proxy_fops) {
267268 /* No protection against file removal anymore. */
268269 WARN(1, "debugfs file owner replaced proxy fops: %pd",
269270 dentry);
fs/ecryptfs/kthread.c+11−2
@@ -25,6 +25,7 @@ · 24 unmodified lines
2525 #include <linux/slab.h>
2626 #include <linux/wait.h>
2727 #include <linux/mount.h>
28+#include <linux/file.h>
2829 #include "ecryptfs_kernel.h"
2930
3031 struct ecryptfs_open_req {
@@ -147,7 +148,7 @@ int ecryptfs_privileged_open(struct file **lower_file, · 116 unmodified lines
147148 flags |= IS_RDONLY(d_inode(lower_dentry)) ? O_RDONLY : O_RDWR;
148149 (*lower_file) = dentry_open(&req.path, flags, cred);
149150 if (!IS_ERR(*lower_file))
150− goto out;
151+ goto have_file;
151152 if ((flags & O_ACCMODE) == O_RDONLY) {
152153 rc = PTR_ERR((*lower_file));
153154 goto out;
@@ -165,8 +166,16 @@ int ecryptfs_privileged_open(struct file **lower_file, · 11 unmodified lines
165166 mutex_unlock(&ecryptfs_kthread_ctl.mux);
166167 wake_up(&ecryptfs_kthread_ctl.wait);
167168 wait_for_completion(&req.done);
168− if (IS_ERR(*lower_file))
169+ if (IS_ERR(*lower_file)) {
169170 rc = PTR_ERR(*lower_file);
171+ goto out;
172+ }
173+have_file:
174+ if ((*lower_file)->f_op->mmap == NULL) {
175+ fput(*lower_file);
176+ *lower_file = NULL;
177+ rc = -EMEDIUMTYPE;
178+ }
170179 out:
171180 return rc;
172181 }
fs/namei.c+15−46
@@ -3030,9 +3030,13 @@ static int atomic_open(struct nameidata *nd, struct dentry *dentry, · 3029 unmodified lines
30303030 }
30313031 if (*opened & FILE_CREATED)
30323032 fsnotify_create(dir, dentry);
3033− path->dentry = dentry;
3034− path->mnt = nd->path.mnt;
3035− return 1;
3033+ if (unlikely(d_is_negative(dentry))) {
3034+ error = -ENOENT;
3035+ } else {
3036+ path->dentry = dentry;
3037+ path->mnt = nd->path.mnt;
3038+ return 1;
3039+ }
30363040 }
30373041 }
30383042 dput(dentry);
@@ -3201,9 +3205,7 @@ static int do_last(struct nameidata *nd, · 162 unmodified lines
32013205 int acc_mode = op->acc_mode;
32023206 unsigned seq;
32033207 struct inode *inode;
3204− struct path save_parent = { .dentry = NULL, .mnt = NULL };
32053208 struct path path;
3206− bool retried = false;
32073209 int error;
32083210
32093211 nd->flags &= ~LOOKUP_PARENT;
@@ -3246,7 +3248,6 @@ static int do_last(struct nameidata *nd, · 36 unmodified lines
32463248 return -EISDIR;
32473249 }
32483250
3249−retry_lookup:
32503251 if (open_flag & (O_CREAT | O_TRUNC | O_WRONLY | O_RDWR)) {
32513252 error = mnt_want_write(nd->path.mnt);
32523253 if (!error)
@@ -3298,6 +3299,10 @@ retry_lookup: · 45 unmodified lines
32983299 got_write = false;
32993300 }
33003301
3302+ error = follow_managed(&path, nd);
3303+ if (unlikely(error < 0))
3304+ return error;
3305+
33013306 if (unlikely(d_is_negative(path.dentry))) {
33023307 path_to_nameidata(&path, nd);
33033308 return -ENOENT;
@@ -3313,10 +3318,6 @@ retry_lookup: · 9 unmodified lines
33133318 return -EEXIST;
33143319 }
33153320
3316− error = follow_managed(&path, nd);
3317− if (unlikely(error < 0))
3318− return error;
3319−
33203321 seq = 0; /* out of RCU mode, so the value doesn't matter */
33213322 inode = d_backing_inode(path.dentry);
33223323 finish_lookup:
@@ -3327,23 +3328,14 @@ finish_lookup: · 4 unmodified lines
33273328 if (unlikely(error))
33283329 return error;
33293330
3330− if ((nd->flags & LOOKUP_RCU) || nd->path.mnt != path.mnt) {
3331− path_to_nameidata(&path, nd);
3332− } else {
3333− save_parent.dentry = nd->path.dentry;
3334− save_parent.mnt = mntget(path.mnt);
3335− nd->path.dentry = path.dentry;
3336−
3337− }
3331+ path_to_nameidata(&path, nd);
33383332 nd->inode = inode;
33393333 nd->seq = seq;
33403334 /* Why this, you ask? _Now_ we might have grown LOOKUP_JUMPED... */
33413335 finish_open:
33423336 error = complete_walk(nd);
3343− if (error) {
3344− path_put(&save_parent);
3337+ if (error)
33453338 return error;
3346− }
33473339 audit_inode(nd->name, nd->path.dentry, 0);
33483340 error = -EISDIR;
33493341 if ((open_flag & O_CREAT) && d_is_dir(nd->path.dentry))
@@ -3366,13 +3358,9 @@ finish_open_created: · 16 unmodified lines
33663358 goto out;
33673359 BUG_ON(*opened & FILE_OPENED); /* once it's opened, it's opened */
33683360 error = vfs_open(&nd->path, file, current_cred());
3369− if (!error) {
3370− *opened |= FILE_OPENED;
3371− } else {
3372− if (error == -EOPENSTALE)
3373− goto stale_open;
3361+ if (error)
33743362 goto out;
3375− }
3363+ *opened |= FILE_OPENED;
33763364 opened:
33773365 error = open_check_o_direct(file);
33783366 if (!error)
@@ -3388,26 +3376,7 @@ out: · 9 unmodified lines
33883376 }
33893377 if (got_write)
33903378 mnt_drop_write(nd->path.mnt);
3391− path_put(&save_parent);
33923379 return error;
3393−
3394−stale_open:
3395− /* If no saved parent or already retried then can't retry */
3396− if (!save_parent.dentry || retried)
3397− goto out;
3398−
3399− BUG_ON(save_parent.dentry != dir);
3400− path_put(&nd->path);
3401− nd->path = save_parent;
3402− nd->inode = dir->d_inode;
3403− save_parent.mnt = NULL;
3404− save_parent.dentry = NULL;
3405− if (got_write) {
3406− mnt_drop_write(nd->path.mnt);
3407− got_write = false;
3408− }
3409− retried = true;
3410− goto retry_lookup;
34113380 }
34123381
34133382 static int do_tmpfile(struct nameidata *nd, unsigned flags,
fs/namespace.c+4−2
@@ -2409,8 +2409,10 @@ static int do_new_mount(struct path *path, const char *fstype, int flags, · 2408 unmodified lines
24092409 mnt_flags |= MNT_NODEV | MNT_LOCK_NODEV;
24102410 }
24112411 if (type->fs_flags & FS_USERNS_VISIBLE) {
2412− if (!fs_fully_visible(type, &mnt_flags))
2412+ if (!fs_fully_visible(type, &mnt_flags)) {
2413+ put_filesystem(type);
24132414 return -EPERM;
2415+ }
24142416 }
24152417 }
24162418
@@ -3271,7 +3273,7 @@ static bool fs_fully_visible(struct file_system_type *type, int *new_mnt_flags) · 854 unmodified lines
32713273 list_for_each_entry(child, &mnt->mnt_mounts, mnt_child) {
32723274 struct inode *inode = child->mnt_mountpoint->d_inode;
32733275 /* Only worry about locked mounts */
3274− if (!(mnt_flags & MNT_LOCKED))
3276+ if (!(child->mnt.mnt_flags & MNT_LOCKED))
32753277 continue;
32763278 /* Is the directory permanetly empty? */
32773279 if (!is_empty_dir_inode(inode))
fs/nfsd/blocklayout.c+1−1
@@ -290,7 +290,7 @@ out_free_buf: · 289 unmodified lines
290290 return error;
291291 }
292292
293−#define NFSD_MDS_PR_KEY 0x0100000000000000
293+#define NFSD_MDS_PR_KEY 0x0100000000000000ULL
294294
295295 /*
296296 * We use the client ID as a unique key for the reservations.
fs/nfsd/nfs4callback.c+1−17
@@ -710,22 +710,6 @@ static struct rpc_cred *get_backchannel_cred(struct nfs4_client *clp, struct rpc · 709 unmodified lines
710710 }
711711 }
712712
713−static struct rpc_clnt *create_backchannel_client(struct rpc_create_args *args)
714−{
715− struct rpc_xprt *xprt;
716−
717− if (args->protocol != XPRT_TRANSPORT_BC_TCP)
718− return rpc_create(args);
719−
720− xprt = args->bc_xprt->xpt_bc_xprt;
721− if (xprt) {
722− xprt_get(xprt);
723− return rpc_create_xprt(args, xprt);
724− }
725−
726− return rpc_create(args);
727−}
728−
729713 static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *conn, struct nfsd4_session *ses)
730714 {
731715 int maxtime = max_cb_time(clp->net);
@@ -768,7 +752,7 @@ static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *c · 36 unmodified lines
768752 args.authflavor = ses->se_cb_sec.flavor;
769753 }
770754 /* Create RPC client */
771− client = create_backchannel_client(&args);
755+ client = rpc_create(&args);
772756 if (IS_ERR(client)) {
773757 dprintk("NFSD: couldn't create callback client: %ld\n",
774758 PTR_ERR(client));
fs/nfsd/nfs4state.c+37−30
@@ -3480,12 +3480,17 @@ alloc_init_open_stateowner(unsigned int strhashval, struct nfsd4_open *open, · 3479 unmodified lines
34803480 }
34813481
34823482 static struct nfs4_ol_stateid *
3483−init_open_stateid(struct nfs4_ol_stateid *stp, struct nfs4_file *fp,
3484− struct nfsd4_open *open)
3483+init_open_stateid(struct nfs4_file *fp, struct nfsd4_open *open)
34853484 {
34863485
34873486 struct nfs4_openowner *oo = open->op_openowner;
34883487 struct nfs4_ol_stateid *retstp = NULL;
3488+ struct nfs4_ol_stateid *stp;
3489+
3490+ stp = open->op_stp;
3491+ /* We are moving these outside of the spinlocks to avoid the warnings */
3492+ mutex_init(&stp->st_mutex);
3493+ mutex_lock(&stp->st_mutex);
34893494
34903495 spin_lock(&oo->oo_owner.so_client->cl_lock);
34913496 spin_lock(&fp->fi_lock);
@@ -3493,6 +3498,8 @@ init_open_stateid(struct nfs4_ol_stateid *stp, struct nfs4_file *fp, · 1 unmodified line
34933498 retstp = nfsd4_find_existing_open(fp, open);
34943499 if (retstp)
34953500 goto out_unlock;
3501+
3502+ open->op_stp = NULL;
34963503 atomic_inc(&stp->st_stid.sc_count);
34973504 stp->st_stid.sc_type = NFS4_OPEN_STID;
34983505 INIT_LIST_HEAD(&stp->st_locks);
@@ -3502,14 +3509,19 @@ init_open_stateid(struct nfs4_ol_stateid *stp, struct nfs4_file *fp, · 3 unmodified lines
35023509 stp->st_access_bmap = 0;
35033510 stp->st_deny_bmap = 0;
35043511 stp->st_openstp = NULL;
3505− init_rwsem(&stp->st_rwsem);
35063512 list_add(&stp->st_perstateowner, &oo->oo_owner.so_stateids);
35073513 list_add(&stp->st_perfile, &fp->fi_stateids);
35083514
35093515 out_unlock:
35103516 spin_unlock(&fp->fi_lock);
35113517 spin_unlock(&oo->oo_owner.so_client->cl_lock);
3512− return retstp;
3518+ if (retstp) {
3519+ mutex_lock(&retstp->st_mutex);
3520+ /* To keep mutex tracking happy */
3521+ mutex_unlock(&stp->st_mutex);
3522+ stp = retstp;
3523+ }
3524+ return stp;
35133525 }
35143526
35153527 /*
@@ -4305,7 +4317,6 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf · 789 unmodified lines
43054317 struct nfs4_client *cl = open->op_openowner->oo_owner.so_client;
43064318 struct nfs4_file *fp = NULL;
43074319 struct nfs4_ol_stateid *stp = NULL;
4308− struct nfs4_ol_stateid *swapstp = NULL;
43094320 struct nfs4_delegation *dp = NULL;
43104321 __be32 status;
43114322
@@ -4335,32 +4346,28 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf · 23 unmodified lines
43354346 */
43364347 if (stp) {
43374348 /* Stateid was found, this is an OPEN upgrade */
4338− down_read(&stp->st_rwsem);
4349+ mutex_lock(&stp->st_mutex);
43394350 status = nfs4_upgrade_open(rqstp, fp, current_fh, stp, open);
43404351 if (status) {
4341− up_read(&stp->st_rwsem);
4352+ mutex_unlock(&stp->st_mutex);
43424353 goto out;
43434354 }
43444355 } else {
4345− stp = open->op_stp;
4346− open->op_stp = NULL;
4347− swapstp = init_open_stateid(stp, fp, open);
4348− if (swapstp) {
4349− nfs4_put_stid(&stp->st_stid);
4350− stp = swapstp;
4351− down_read(&stp->st_rwsem);
4356+ /* stp is returned locked. */
4357+ stp = init_open_stateid(fp, open);
4358+ /* See if we lost the race to some other thread */
4359+ if (stp->st_access_bmap != 0) {
43524360 status = nfs4_upgrade_open(rqstp, fp, current_fh,
43534361 stp, open);
43544362 if (status) {
4355− up_read(&stp->st_rwsem);
4363+ mutex_unlock(&stp->st_mutex);
43564364 goto out;
43574365 }
43584366 goto upgrade_out;
43594367 }
4360− down_read(&stp->st_rwsem);
43614368 status = nfs4_get_vfs_file(rqstp, fp, current_fh, stp, open);
43624369 if (status) {
4363− up_read(&stp->st_rwsem);
4370+ mutex_unlock(&stp->st_mutex);
43644371 release_open_stateid(stp);
43654372 goto out;
43664373 }
@@ -4372,7 +4379,7 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf · 5 unmodified lines
43724379 }
43734380 upgrade_out:
43744381 nfs4_inc_and_copy_stateid(&open->op_stateid, &stp->st_stid);
4375− up_read(&stp->st_rwsem);
4382+ mutex_unlock(&stp->st_mutex);
43764383
43774384 if (nfsd4_has_session(&resp->cstate)) {
43784385 if (open->op_deleg_want & NFS4_SHARE_WANT_NO_DELEG) {
@@ -4977,12 +4984,12 @@ static __be32 nfs4_seqid_op_checks(struct nfsd4_compound_state *cstate, stateid_ · 598 unmodified lines
49774984 * revoked delegations are kept only for free_stateid.
49784985 */
49794986 return nfserr_bad_stateid;
4980− down_write(&stp->st_rwsem);
4987+ mutex_lock(&stp->st_mutex);
49814988 status = check_stateid_generation(stateid, &stp->st_stid.sc_stateid, nfsd4_has_session(cstate));
49824989 if (status == nfs_ok)
49834990 status = nfs4_check_fh(current_fh, &stp->st_stid);
49844991 if (status != nfs_ok)
4985− up_write(&stp->st_rwsem);
4992+ mutex_unlock(&stp->st_mutex);
49864993 return status;
49874994 }
49884995
@@ -5030,7 +5037,7 @@ static __be32 nfs4_preprocess_confirmed_seqid_op(struct nfsd4_compound_state *cs · 41 unmodified lines
50305037 return status;
50315038 oo = openowner(stp->st_stateowner);
50325039 if (!(oo->oo_flags & NFS4_OO_CONFIRMED)) {
5033− up_write(&stp->st_rwsem);
5040+ mutex_unlock(&stp->st_mutex);
50345041 nfs4_put_stid(&stp->st_stid);
50355042 return nfserr_bad_stateid;
50365043 }
@@ -5062,12 +5069,12 @@ nfsd4_open_confirm(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, · 25 unmodified lines
50625069 oo = openowner(stp->st_stateowner);
50635070 status = nfserr_bad_stateid;
50645071 if (oo->oo_flags & NFS4_OO_CONFIRMED) {
5065− up_write(&stp->st_rwsem);
5072+ mutex_unlock(&stp->st_mutex);
50665073 goto put_stateid;
50675074 }
50685075 oo->oo_flags |= NFS4_OO_CONFIRMED;
50695076 nfs4_inc_and_copy_stateid(&oc->oc_resp_stateid, &stp->st_stid);
5070− up_write(&stp->st_rwsem);
5077+ mutex_unlock(&stp->st_mutex);
50715078 dprintk("NFSD: %s: success, seqid=%d stateid=" STATEID_FMT "\n",
50725079 __func__, oc->oc_seqid, STATEID_VAL(&stp->st_stid.sc_stateid));
50735080
@@ -5143,7 +5150,7 @@ nfsd4_open_downgrade(struct svc_rqst *rqstp, · 69 unmodified lines
51435150 nfs4_inc_and_copy_stateid(&od->od_stateid, &stp->st_stid);
51445151 status = nfs_ok;
51455152 put_stateid:
5146− up_write(&stp->st_rwsem);
5153+ mutex_unlock(&stp->st_mutex);
51475154 nfs4_put_stid(&stp->st_stid);
51485155 out:
51495156 nfsd4_bump_seqid(cstate, status);
@@ -5196,7 +5203,7 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, · 46 unmodified lines
51965203 if (status)
51975204 goto out;
51985205 nfs4_inc_and_copy_stateid(&close->cl_stateid, &stp->st_stid);
5199− up_write(&stp->st_rwsem);
5206+ mutex_unlock(&stp->st_mutex);
52005207
52015208 nfsd4_close_open_stateid(stp);
52025209
@@ -5422,7 +5429,7 @@ init_lock_stateid(struct nfs4_ol_stateid *stp, struct nfs4_lockowner *lo, · 219 unmodified lines
54225429 stp->st_access_bmap = 0;
54235430 stp->st_deny_bmap = open_stp->st_deny_bmap;
54245431 stp->st_openstp = open_stp;
5425− init_rwsem(&stp->st_rwsem);
5432+ mutex_init(&stp->st_mutex);
54265433 list_add(&stp->st_locks, &open_stp->st_locks);
54275434 list_add(&stp->st_perstateowner, &lo->lo_owner.so_stateids);
54285435 spin_lock(&fp->fi_lock);
@@ -5591,7 +5598,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, · 162 unmodified lines
55915598 &open_stp, nn);
55925599 if (status)
55935600 goto out;
5594− up_write(&open_stp->st_rwsem);
5601+ mutex_unlock(&open_stp->st_mutex);
55955602 open_sop = openowner(open_stp->st_stateowner);
55965603 status = nfserr_bad_stateid;
55975604 if (!same_clid(&open_sop->oo_owner.so_client->cl_clientid,
@@ -5600,7 +5607,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, · 2 unmodified lines
56005607 status = lookup_or_create_lock_state(cstate, open_stp, lock,
56015608 &lock_stp, &new);
56025609 if (status == nfs_ok)
5603− down_write(&lock_stp->st_rwsem);
5610+ mutex_lock(&lock_stp->st_mutex);
56045611 } else {
56055612 status = nfs4_preprocess_seqid_op(cstate,
56065613 lock->lk_old_lock_seqid,
@@ -5704,7 +5711,7 @@ out: · 97 unmodified lines
57045711 seqid_mutating_err(ntohl(status)))
57055712 lock_sop->lo_owner.so_seqid++;
57065713
5707− up_write(&lock_stp->st_rwsem);
5714+ mutex_unlock(&lock_stp->st_mutex);
57085715
57095716 /*
57105717 * If this is a new, never-before-used stateid, and we are
@@ -5874,7 +5881,7 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, · 163 unmodified lines
58745881 fput:
58755882 fput(filp);
58765883 put_stateid:
5877− up_write(&stp->st_rwsem);
5884+ mutex_unlock(&stp->st_mutex);
58785885 nfs4_put_stid(&stp->st_stid);
58795886 out:
58805887 nfsd4_bump_seqid(cstate, status);
fs/nfsd/state.h+1−1
@@ -535,7 +535,7 @@ struct nfs4_ol_stateid { · 534 unmodified lines
535535 unsigned char st_access_bmap;
536536 unsigned char st_deny_bmap;
537537 struct nfs4_ol_stateid *st_openstp;
538− struct rw_semaphore st_rwsem;
538+ struct mutex st_mutex;
539539 };
540540
541541 static inline struct nfs4_ol_stateid *openlockstateid(struct nfs4_stid *s)
fs/overlayfs/dir.c+11−2
@@ -405,12 +405,21 @@ static int ovl_create_or_link(struct dentry *dentry, int mode, dev_t rdev, · 404 unmodified lines
405405 err = ovl_create_upper(dentry, inode, &stat, link, hardlink);
406406 } else {
407407 const struct cred *old_cred;
408+ struct cred *override_cred;
408409
409410 old_cred = ovl_override_creds(dentry->d_sb);
410411
411− err = ovl_create_over_whiteout(dentry, inode, &stat, link,
412− hardlink);
412+ err = -ENOMEM;
413+ override_cred = prepare_creds();
414+ if (override_cred) {
415+ override_cred->fsuid = old_cred->fsuid;
416+ override_cred->fsgid = old_cred->fsgid;
417+ put_cred(override_creds(override_cred));
418+ put_cred(override_cred);
413419
420+ err = ovl_create_over_whiteout(dentry, inode, &stat,
421+ link, hardlink);
422+ }
414423 revert_creds(old_cred);
415424 }
416425
fs/overlayfs/inode.c+6−20
@@ -238,41 +238,27 @@ out: · 237 unmodified lines
238238 return err;
239239 }
240240
241−static bool ovl_need_xattr_filter(struct dentry *dentry,
242− enum ovl_path_type type)
243−{
244− if ((type & (__OVL_PATH_PURE | __OVL_PATH_UPPER)) == __OVL_PATH_UPPER)
245− return S_ISDIR(dentry->d_inode->i_mode);
246− else
247− return false;
248−}
249−
250241 ssize_t ovl_getxattr(struct dentry *dentry, struct inode *inode,
251242 const char *name, void *value, size_t size)
252243 {
253− struct path realpath;
254− enum ovl_path_type type = ovl_path_real(dentry, &realpath);
244+ struct dentry *realdentry = ovl_dentry_real(dentry);
255245
256− if (ovl_need_xattr_filter(dentry, type) && ovl_is_private_xattr(name))
246+ if (ovl_is_private_xattr(name))
257247 return -ENODATA;
258248
259− return vfs_getxattr(realpath.dentry, name, value, size);
249+ return vfs_getxattr(realdentry, name, value, size);
260250 }
261251
262252 ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size)
263253 {
264− struct path realpath;
265− enum ovl_path_type type = ovl_path_real(dentry, &realpath);
254+ struct dentry *realdentry = ovl_dentry_real(dentry);
266255 ssize_t res;
267256 int off;
268257
269− res = vfs_listxattr(realpath.dentry, list, size);
258+ res = vfs_listxattr(realdentry, list, size);
270259 if (res <= 0 || size == 0)
271260 return res;
272261
273− if (!ovl_need_xattr_filter(dentry, type))
274− return res;
275−
276262 /* filter out private xattrs */
277263 for (off = 0; off < res;) {
278264 char *s = list + off;
@@ -302,7 +288,7 @@ int ovl_removexattr(struct dentry *dentry, const char *name) · 23 unmodified lines
302288 goto out;
303289
304290 err = -ENODATA;
305− if (ovl_need_xattr_filter(dentry, type) && ovl_is_private_xattr(name))
291+ if (ovl_is_private_xattr(name))
306292 goto out_drop_write;
307293
308294 if (!OVL_TYPE_UPPER(type)) {
fs/proc/root.c+7−0
@@ -121,6 +121,13 @@ static struct dentry *proc_mount(struct file_system_type *fs_type, · 120 unmodified lines
121121 if (IS_ERR(sb))
122122 return ERR_CAST(sb);
123123
124+ /*
125+ * procfs isn't actually a stacking filesystem; however, there is
126+ * too much magic going on inside it to permit stacking things on
127+ * top of it
128+ */
129+ sb->s_stack_depth = FILESYSTEM_MAX_STACK_DEPTH;
130+
124131 if (!proc_parse_options(options, ns)) {
125132 deactivate_locked_super(sb);
126133 return ERR_PTR(-EINVAL);
fs/reiserfs/super.c+7−2
@@ -1393,7 +1393,7 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) · 1392 unmodified lines
13931393 unsigned long safe_mask = 0;
13941394 unsigned int commit_max_age = (unsigned int)-1;
13951395 struct reiserfs_journal *journal = SB_JOURNAL(s);
1396− char *new_opts = kstrdup(arg, GFP_KERNEL);
1396+ char *new_opts;
13971397 int err;
13981398 char *qf_names[REISERFS_MAXQUOTAS];
13991399 unsigned int qfmt = 0;
@@ -1401,6 +1401,10 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) · 1 unmodified line
14011401 int i;
14021402 #endif
14031403
1404+ new_opts = kstrdup(arg, GFP_KERNEL);
1405+ if (arg && !new_opts)
1406+ return -ENOMEM;
1407+
14041408 sync_filesystem(s);
14051409 reiserfs_write_lock(s);
14061410
@@ -1546,7 +1550,8 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) · 139 unmodified lines
15461550 }
15471551
15481552 out_ok_unlocked:
1549− replace_mount_options(s, new_opts);
1553+ if (new_opts)
1554+ replace_mount_options(s, new_opts);
15501555 return 0;
15511556
15521557 out_err_unlock:
fs/udf/partition.c+9−4
@@ -295,7 +295,8 @@ static uint32_t udf_try_read_meta(struct inode *inode, uint32_t block, · 294 unmodified lines
295295 map = &UDF_SB(sb)->s_partmaps[partition];
296296 /* map to sparable/physical partition desc */
297297 phyblock = udf_get_pblock(sb, eloc.logicalBlockNum,
298− map->s_partition_num, ext_offset + offset);
298+ map->s_type_specific.s_metadata.s_phys_partition_ref,
299+ ext_offset + offset);
299300 }
300301
301302 brelse(epos.bh);
@@ -317,14 +318,18 @@ uint32_t udf_get_pblock_meta25(struct super_block *sb, uint32_t block, · 15 unmodified lines
317318 mdata = &map->s_type_specific.s_metadata;
318319 inode = mdata->s_metadata_fe ? : mdata->s_mirror_fe;
319320
320− /* We shouldn't mount such media... */
321− BUG_ON(!inode);
321+ if (!inode)
322+ return 0xFFFFFFFF;
323+
322324 retblk = udf_try_read_meta(inode, block, partition, offset);
323325 if (retblk == 0xFFFFFFFF && mdata->s_metadata_fe) {
324326 udf_warn(sb, "error reading from METADATA, trying to read from MIRROR\n");
325327 if (!(mdata->s_flags & MF_MIRROR_FE_LOADED)) {
326328 mdata->s_mirror_fe = udf_find_metadata_inode_efe(sb,
327− mdata->s_mirror_file_loc, map->s_partition_num);
329+ mdata->s_mirror_file_loc,
330+ mdata->s_phys_partition_ref);
331+ if (IS_ERR(mdata->s_mirror_fe))
332+ mdata->s_mirror_fe = NULL;
328333 mdata->s_flags |= MF_MIRROR_FE_LOADED;
329334 }
330335
fs/udf/super.c+12−10
@@ -951,13 +951,13 @@ out2: · 950 unmodified lines
951951 }
952952
953953 struct inode *udf_find_metadata_inode_efe(struct super_block *sb,
954− u32 meta_file_loc, u32 partition_num)
954+ u32 meta_file_loc, u32 partition_ref)
955955 {
956956 struct kernel_lb_addr addr;
957957 struct inode *metadata_fe;
958958
959959 addr.logicalBlockNum = meta_file_loc;
960− addr.partitionReferenceNum = partition_num;
960+ addr.partitionReferenceNum = partition_ref;
961961
962962 metadata_fe = udf_iget_special(sb, &addr);
963963
@@ -974,7 +974,8 @@ struct inode *udf_find_metadata_inode_efe(struct super_block *sb, · 10 unmodified lines
974974 return metadata_fe;
975975 }
976976
977−static int udf_load_metadata_files(struct super_block *sb, int partition)
977+static int udf_load_metadata_files(struct super_block *sb, int partition,
978+ int type1_index)
978979 {
979980 struct udf_sb_info *sbi = UDF_SB(sb);
980981 struct udf_part_map *map;
@@ -984,20 +985,21 @@ static int udf_load_metadata_files(struct super_block *sb, int partition) · 3 unmodified lines
984985
985986 map = &sbi->s_partmaps[partition];
986987 mdata = &map->s_type_specific.s_metadata;
988+ mdata->s_phys_partition_ref = type1_index;
987989
988990 /* metadata address */
989991 udf_debug("Metadata file location: block = %d part = %d\n",
990− mdata->s_meta_file_loc, map->s_partition_num);
992+ mdata->s_meta_file_loc, mdata->s_phys_partition_ref);
991993
992994 fe = udf_find_metadata_inode_efe(sb, mdata->s_meta_file_loc,
993− map->s_partition_num);
995+ mdata->s_phys_partition_ref);
994996 if (IS_ERR(fe)) {
995997 /* mirror file entry */
996998 udf_debug("Mirror metadata file location: block = %d part = %d\n",
997− mdata->s_mirror_file_loc, map->s_partition_num);
999+ mdata->s_mirror_file_loc, mdata->s_phys_partition_ref);
9981000
9991001 fe = udf_find_metadata_inode_efe(sb, mdata->s_mirror_file_loc,
1000− map->s_partition_num);
1002+ mdata->s_phys_partition_ref);
10011003
10021004 if (IS_ERR(fe)) {
10031005 udf_err(sb, "Both metadata and mirror metadata inode efe can not found\n");
@@ -1015,7 +1017,7 @@ static int udf_load_metadata_files(struct super_block *sb, int partition) · 11 unmodified lines
10151017 */
10161018 if (mdata->s_bitmap_file_loc != 0xFFFFFFFF) {
10171019 addr.logicalBlockNum = mdata->s_bitmap_file_loc;
1018− addr.partitionReferenceNum = map->s_partition_num;
1020+ addr.partitionReferenceNum = mdata->s_phys_partition_ref;
10191021
10201022 udf_debug("Bitmap file location: block = %d part = %d\n",
10211023 addr.logicalBlockNum, addr.partitionReferenceNum);
@@ -1283,7 +1285,7 @@ static int udf_load_partdesc(struct super_block *sb, sector_t block) · 261 unmodified lines
12831285 p = (struct partitionDesc *)bh->b_data;
12841286 partitionNumber = le16_to_cpu(p->partitionNumber);
12851287
1286− /* First scan for TYPE1, SPARABLE and METADATA partitions */
1288+ /* First scan for TYPE1 and SPARABLE partitions */
12871289 for (i = 0; i < sbi->s_partitions; i++) {
12881290 map = &sbi->s_partmaps[i];
12891291 udf_debug("Searching map: (%d == %d)\n",
@@ -1333,7 +1335,7 @@ static int udf_load_partdesc(struct super_block *sb, sector_t block) · 43 unmodified lines
13331335 goto out_bh;
13341336
13351337 if (map->s_partition_type == UDF_METADATA_MAP25) {
1336− ret = udf_load_metadata_files(sb, i);
1338+ ret = udf_load_metadata_files(sb, i, type1_idx);
13371339 if (ret < 0) {
13381340 udf_err(sb, "error loading MetaData partition map %d\n",
13391341 i);
fs/udf/udf_sb.h+5−0
@@ -61,6 +61,11 @@ struct udf_meta_data { · 60 unmodified lines
6161 __u32 s_bitmap_file_loc;
6262 __u32 s_alloc_unit_size;
6363 __u16 s_align_unit_size;
64+ /*
65+ * Partition Reference Number of the associated physical / sparable
66+ * partition
67+ */
68+ __u16 s_phys_partition_ref;
6469 int s_flags;
6570 struct inode *s_metadata_fe;
6671 struct inode *s_mirror_fe;
include/asm-generic/qspinlock.h+17−36
@@ -21,38 +21,34 @@ · 20 unmodified lines
2121
2222 #include <asm-generic/qspinlock_types.h>
2323
24+/**
25+ * queued_spin_unlock_wait - wait until the _current_ lock holder releases the lock
26+ * @lock : Pointer to queued spinlock structure
27+ *
28+ * There is a very slight possibility of live-lock if the lockers keep coming
29+ * and the waiter is just unfortunate enough to not see any unlock state.
30+ */
31+#ifndef queued_spin_unlock_wait
32+extern void queued_spin_unlock_wait(struct qspinlock *lock);
33+#endif
34+
2435 /**
2536 * queued_spin_is_locked - is the spinlock locked?
2637 * @lock: Pointer to queued spinlock structure
2738 * Return: 1 if it is locked, 0 otherwise
2839 */
40+#ifndef queued_spin_is_locked
2941 static __always_inline int queued_spin_is_locked(struct qspinlock *lock)
3042 {
3143 /*
32− * queued_spin_lock_slowpath() can ACQUIRE the lock before
33− * issuing the unordered store that sets _Q_LOCKED_VAL.
34− *
35− * See both smp_cond_acquire() sites for more detail.
36− *
37− * This however means that in code like:
38− *
39− * spin_lock(A) spin_lock(B)
40− * spin_unlock_wait(B) spin_is_locked(A)
41− * do_something() do_something()
42− *
43− * Both CPUs can end up running do_something() because the store
44− * setting _Q_LOCKED_VAL will pass through the loads in
45− * spin_unlock_wait() and/or spin_is_locked().
44+ * See queued_spin_unlock_wait().
4645 *
47− * Avoid this by issuing a full memory barrier between the spin_lock()
48− * and the loads in spin_unlock_wait() and spin_is_locked().
49− *
50− * Note that regular mutual exclusion doesn't care about this
51− * delayed store.
46+ * Any !0 state indicates it is locked, even if _Q_LOCKED_VAL
47+ * isn't immediately observable.
5248 */
53− smp_mb();
54− return atomic_read(&lock->val) & _Q_LOCKED_MASK;
49+ return atomic_read(&lock->val);
5550 }
51+#endif
5652
5753 /**
5854 * queued_spin_value_unlocked - is the spinlock structure unlocked?
@@ -122,21 +118,6 @@ static __always_inline void queued_spin_unlock(struct qspinlock *lock) · 63 unmodified lines
122118 }
123119 #endif
124120
125−/**
126− * queued_spin_unlock_wait - wait until current lock holder releases the lock
127− * @lock : Pointer to queued spinlock structure
128− *
129− * There is a very slight possibility of live-lock if the lockers keep coming
130− * and the waiter is just unfortunate enough to not see any unlock state.
131− */
132−static inline void queued_spin_unlock_wait(struct qspinlock *lock)
133−{
134− /* See queued_spin_is_locked() */
135− smp_mb();
136− while (atomic_read(&lock->val) & _Q_LOCKED_MASK)
137− cpu_relax();
138−}
139−
140121 #ifndef virt_spin_lock
141122 static __always_inline bool virt_spin_lock(struct qspinlock *lock)
142123 {
include/linux/binfmts.h+1−0
@@ -65,6 +65,7 @@ struct coredump_params { · 64 unmodified lines
6565 unsigned long limit;
6666 unsigned long mm_flags;
6767 loff_t written;
68+ loff_t pos;
6869 };
6970
7071 /*
include/linux/clk-provider.h+1−1
@@ -25,7 +25,7 @@ · 24 unmodified lines
2525 #define CLK_SET_PARENT_GATE BIT(1) /* must be gated across re-parent */
2626 #define CLK_SET_RATE_PARENT BIT(2) /* propagate rate change up one level */
2727 #define CLK_IGNORE_UNUSED BIT(3) /* do not gate even if unused */
28−#define CLK_IS_ROOT BIT(4) /* Deprecated: Don't use */
28+ /* unused */
2929 #define CLK_IS_BASIC BIT(5) /* Basic clk, can't do a to_clk_foo() */
3030 #define CLK_GET_RATE_NOCACHE BIT(6) /* do not use the cached clk rate */
3131 #define CLK_SET_RATE_NO_REPARENT BIT(7) /* don't re-parent on rate change */
include/linux/cpuidle.h+3−0
@@ -152,6 +152,8 @@ extern void cpuidle_disable_device(struct cpuidle_device *dev); · 151 unmodified lines
152152 extern int cpuidle_play_dead(void);
153153
154154 extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev);
155+static inline struct cpuidle_device *cpuidle_get_device(void)
156+{return __this_cpu_read(cpuidle_devices); }
155157 #else
156158 static inline void disable_cpuidle(void) { }
157159 static inline bool cpuidle_not_available(struct cpuidle_driver *drv,
@@ -187,6 +189,7 @@ static inline void cpuidle_disable_device(struct cpuidle_device *dev) { } · 29 unmodified lines
187189 static inline int cpuidle_play_dead(void) {return -ENODEV; }
188190 static inline struct cpuidle_driver *cpuidle_get_cpu_driver(
189191 struct cpuidle_device *dev) {return NULL; }
192+static inline struct cpuidle_device *cpuidle_get_device(void) {return NULL; }
190193 #endif
191194
192195 #if defined(CONFIG_CPU_IDLE) && defined(CONFIG_SUSPEND)
include/linux/dcache.h+12−0
@@ -575,5 +575,17 @@ static inline struct inode *vfs_select_inode(struct dentry *dentry, · 574 unmodified lines
575575 return inode;
576576 }
577577
578+/**
579+ * d_real_inode - Return the real inode
580+ * @dentry: The dentry to query
581+ *
582+ * If dentry is on an union/overlay, then return the underlying, real inode.
583+ * Otherwise return d_inode().
584+ */
585+static inline struct inode *d_real_inode(struct dentry *dentry)
586+{
587+ return d_backing_inode(d_real(dentry));
588+}
589+
578590
579591 #endif /* __LINUX_DCACHE_H */
include/linux/efi.h+1−1
@@ -1005,7 +1005,7 @@ extern int efi_memattr_apply_permissions(struct mm_struct *mm, · 1004 unmodified lines
10051005 /* Iterate through an efi_memory_map */
10061006 #define for_each_efi_memory_desc_in_map(m, md) \
10071007 for ((md) = (m)->map; \
1008− (md) <= (efi_memory_desc_t *)((m)->map_end - (m)->desc_size); \
1008+ ((void *)(md) + (m)->desc_size) <= (m)->map_end; \
10091009 (md) = (void *)(md) + (m)->desc_size)
10101010
10111011 /**
include/linux/iio/common/st_sensors.h+8−1
@@ -223,6 +223,8 @@ struct st_sensor_settings { · 222 unmodified lines
223223 * @get_irq_data_ready: Function to get the IRQ used for data ready signal.
224224 * @tf: Transfer function structure used by I/O operations.
225225 * @tb: Transfer buffers and mutex used by I/O operations.
226+ * @hw_irq_trigger: if we're using the hardware interrupt on the sensor.
227+ * @hw_timestamp: Latest timestamp from the interrupt handler, when in use.
226228 */
227229 struct st_sensor_data {
228230 struct device *dev;
@@ -247,6 +249,9 @@ struct st_sensor_data { · 18 unmodified lines
247249
248250 const struct st_sensor_transfer_function *tf;
249251 struct st_sensor_transfer_buffer tb;
252+
253+ bool hw_irq_trigger;
254+ s64 hw_timestamp;
250255 };
251256
252257 #ifdef CONFIG_IIO_BUFFER
@@ -258,7 +263,8 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev, · 5 unmodified lines
258263 const struct iio_trigger_ops *trigger_ops);
259264
260265 void st_sensors_deallocate_trigger(struct iio_dev *indio_dev);
261−
266+int st_sensors_validate_device(struct iio_trigger *trig,
267+ struct iio_dev *indio_dev);
262268 #else
263269 static inline int st_sensors_allocate_trigger(struct iio_dev *indio_dev,
264270 const struct iio_trigger_ops *trigger_ops)
@@ -269,6 +275,7 @@ static inline void st_sensors_deallocate_trigger(struct iio_dev *indio_dev) · 4 unmodified lines
269275 {
270276 return;
271277 }
278+#define st_sensors_validate_device NULL
272279 #endif
273280
274281 int st_sensors_init_sensor(struct iio_dev *indio_dev,
include/linux/isa.h+3−2
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 #define __LINUX_ISA_H
77
88 #include <linux/device.h>
9+#include <linux/errno.h>
910 #include <linux/kernel.h>
1011
1112 struct isa_driver {
@@ -22,13 +23,13 @@ struct isa_driver { · 10 unmodified lines
2223
2324 #define to_isa_driver(x) container_of((x), struct isa_driver, driver)
2425
25−#ifdef CONFIG_ISA
26+#ifdef CONFIG_ISA_BUS_API
2627 int isa_register_driver(struct isa_driver *, unsigned int);
2728 void isa_unregister_driver(struct isa_driver *);
2829 #else
2930 static inline int isa_register_driver(struct isa_driver *d, unsigned int i)
3031 {
31− return 0;
32+ return -ENODEV;
3233 }
3334
3435 static inline void isa_unregister_driver(struct isa_driver *d)
include/linux/leds.h+12−11
@@ -42,15 +42,16 @@ struct led_classdev { · 41 unmodified lines
4242 #define LED_UNREGISTERING (1 << 1)
4343 /* Upper 16 bits reflect control information */
4444 #define LED_CORE_SUSPENDRESUME (1 << 16)
45−#define LED_BLINK_ONESHOT (1 << 17)
46−#define LED_BLINK_ONESHOT_STOP (1 << 18)
47−#define LED_BLINK_INVERT (1 << 19)
48−#define LED_BLINK_BRIGHTNESS_CHANGE (1 << 20)
49−#define LED_BLINK_DISABLE (1 << 21)
50−#define LED_SYSFS_DISABLE (1 << 22)
51−#define LED_DEV_CAP_FLASH (1 << 23)
52−#define LED_HW_PLUGGABLE (1 << 24)
53−#define LED_PANIC_INDICATOR (1 << 25)
45+#define LED_BLINK_SW (1 << 17)
46+#define LED_BLINK_ONESHOT (1 << 18)
47+#define LED_BLINK_ONESHOT_STOP (1 << 19)
48+#define LED_BLINK_INVERT (1 << 20)
49+#define LED_BLINK_BRIGHTNESS_CHANGE (1 << 21)
50+#define LED_BLINK_DISABLE (1 << 22)
51+#define LED_SYSFS_DISABLE (1 << 23)
52+#define LED_DEV_CAP_FLASH (1 << 24)
53+#define LED_HW_PLUGGABLE (1 << 25)
54+#define LED_PANIC_INDICATOR (1 << 26)
5455
5556 /* Set LED brightness level
5657 * Must not sleep. Use brightness_set_blocking for drivers
@@ -72,8 +73,8 @@ struct led_classdev { · 15 unmodified lines
7273 * and if both are zero then a sensible default should be chosen.
7374 * The call should adjust the timings in that case and if it can't
7475 * match the values specified exactly.
75− * Deactivate blinking again when the brightness is set to a fixed
76− * value via the brightness_set() callback.
76+ * Deactivate blinking again when the brightness is set to LED_OFF
77+ * via the brightness_set() callback.
7778 */
7879 int (*blink_set)(struct led_classdev *led_cdev,
7980 unsigned long *delay_on,
include/linux/mlx5/device.h+6−2
@@ -1240,8 +1240,6 @@ struct mlx5_destroy_psv_out { · 1239 unmodified lines
12401240 u8 rsvd[8];
12411241 };
12421242
1243−#define MLX5_CMD_OP_MAX 0x920
1244−
12451243 enum {
12461244 VPORT_STATE_DOWN = 0x0,
12471245 VPORT_STATE_UP = 0x1,
@@ -1369,6 +1367,12 @@ enum mlx5_cap_type { · 121 unmodified lines
13691367 #define MLX5_CAP_FLOWTABLE_MAX(mdev, cap) \
13701368 MLX5_GET(flow_table_nic_cap, mdev->hca_caps_max[MLX5_CAP_FLOW_TABLE], cap)
13711369
1370+#define MLX5_CAP_FLOWTABLE_NIC_RX(mdev, cap) \
1371+ MLX5_CAP_FLOWTABLE(mdev, flow_table_properties_nic_receive.cap)
1372+
1373+#define MLX5_CAP_FLOWTABLE_NIC_RX_MAX(mdev, cap) \
1374+ MLX5_CAP_FLOWTABLE_MAX(mdev, flow_table_properties_nic_receive.cap)
1375+
13721376 #define MLX5_CAP_ESW_FLOWTABLE(mdev, cap) \
13731377 MLX5_GET(flow_table_eswitch_cap, \
13741378 mdev->hca_caps_cur[MLX5_CAP_ESWITCH_FLOW_TABLE], cap)
include/linux/mlx5/mlx5_ifc.h+9−3
@@ -205,7 +205,8 @@ enum { · 204 unmodified lines
205205 MLX5_CMD_OP_ALLOC_FLOW_COUNTER = 0x939,
206206 MLX5_CMD_OP_DEALLOC_FLOW_COUNTER = 0x93a,
207207 MLX5_CMD_OP_QUERY_FLOW_COUNTER = 0x93b,
208− MLX5_CMD_OP_MODIFY_FLOW_TABLE = 0x93c
208+ MLX5_CMD_OP_MODIFY_FLOW_TABLE = 0x93c,
209+ MLX5_CMD_OP_MAX
209210 };
210211
211212 struct mlx5_ifc_flow_table_fields_supported_bits {
@@ -500,7 +501,9 @@ struct mlx5_ifc_e_switch_cap_bits { · 288 unmodified lines
500501 u8 vport_svlan_insert[0x1];
501502 u8 vport_cvlan_insert_if_not_exist[0x1];
502503 u8 vport_cvlan_insert_overwrite[0x1];
503− u8 reserved_at_5[0x1b];
504+ u8 reserved_at_5[0x19];
505+ u8 nic_vport_node_guid_modify[0x1];
506+ u8 nic_vport_port_guid_modify[0x1];
504507
505508 u8 reserved_at_20[0x7e0];
506509 };
@@ -4583,7 +4586,10 @@ struct mlx5_ifc_modify_nic_vport_context_out_bits { · 4076 unmodified lines
45834586 };
45844587
45854588 struct mlx5_ifc_modify_nic_vport_field_select_bits {
4586− u8 reserved_at_0[0x19];
4589+ u8 reserved_at_0[0x16];
4590+ u8 node_guid[0x1];
4591+ u8 port_guid[0x1];
4592+ u8 reserved_at_18[0x1];
45874593 u8 mtu[0x1];
45884594 u8 change_event[0x1];
45894595 u8 promisc[0x1];
include/linux/mlx5/qp.h+3−3
@@ -460,10 +460,9 @@ struct mlx5_core_qp { · 459 unmodified lines
460460 };
461461
462462 struct mlx5_qp_path {
463− u8 fl;
463+ u8 fl_free_ar;
464464 u8 rsvd3;
465− u8 free_ar;
466− u8 pkey_index;
465+ __be16 pkey_index;
467466 u8 rsvd0;
468467 u8 grh_mlid;
469468 __be16 rlid;
@@ -560,6 +559,7 @@ struct mlx5_modify_qp_mbox_in { · 90 unmodified lines
560559 __be32 optparam;
561560 u8 rsvd0[4];
562561 struct mlx5_qp_context ctx;
562+ u8 rsvd2[16];
563563 };
564564
565565 struct mlx5_modify_qp_mbox_out {
include/linux/mlx5/vport.h+2−0
@@ -50,6 +50,8 @@ int mlx5_modify_nic_vport_mtu(struct mlx5_core_dev *mdev, u16 mtu); · 49 unmodified lines
5050 int mlx5_query_nic_vport_system_image_guid(struct mlx5_core_dev *mdev,
5151 u64 *system_image_guid);
5252 int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid);
53+int mlx5_modify_nic_vport_node_guid(struct mlx5_core_dev *mdev,
54+ u32 vport, u64 node_guid);
5355 int mlx5_query_nic_vport_qkey_viol_cntr(struct mlx5_core_dev *mdev,
5456 u16 *qkey_viol_cntr);
5557 int mlx5_query_hca_vport_gid(struct mlx5_core_dev *dev, u8 other_vport,
include/linux/of.h+1−1
@@ -614,7 +614,7 @@ static inline struct device_node *of_parse_phandle(const struct device_node *np, · 613 unmodified lines
614614 return NULL;
615615 }
616616
617−static inline int of_parse_phandle_with_args(struct device_node *np,
617+static inline int of_parse_phandle_with_args(const struct device_node *np,
618618 const char *list_name,
619619 const char *cells_name,
620620 int index,
include/linux/of_pci.h+1−1
@@ -8,7 +8,7 @@ struct pci_dev; · 7 unmodified lines
88 struct of_phandle_args;
99 struct device_node;
1010
11−#ifdef CONFIG_OF
11+#ifdef CONFIG_OF_PCI
1212 int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq);
1313 struct device_node *of_pci_find_child_device(struct device_node *parent,
1414 unsigned int devfn);
include/linux/of_reserved_mem.h+7−0
@@ -31,6 +31,13 @@ typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem); · 30 unmodified lines
3131 int of_reserved_mem_device_init(struct device *dev);
3232 void of_reserved_mem_device_release(struct device *dev);
3333
34+int early_init_dt_alloc_reserved_memory_arch(phys_addr_t size,
35+ phys_addr_t align,
36+ phys_addr_t start,
37+ phys_addr_t end,
38+ bool nomap,
39+ phys_addr_t *res_base);
40+
3441 void fdt_init_reserved_mem(void);
3542 void fdt_reserved_mem_save_node(unsigned long node, const char *uname,
3643 phys_addr_t base, phys_addr_t size);
include/linux/pwm.h+3−0
@@ -235,6 +235,9 @@ static inline int pwm_config(struct pwm_device *pwm, int duty_ns, · 234 unmodified lines
235235 if (!pwm)
236236 return -EINVAL;
237237
238+ if (duty_ns < 0 || period_ns < 0)
239+ return -EINVAL;
240+
238241 pwm_get_state(pwm, &state);
239242 if (state.duty_cycle == duty_ns && state.period == period_ns)
240243 return 0;
include/linux/seqlock.h+5−2
@@ -277,7 +277,10 @@ static inline void raw_write_seqcount_barrier(seqcount_t *s) · 276 unmodified lines
277277
278278 static inline int raw_read_seqcount_latch(seqcount_t *s)
279279 {
280− return lockless_dereference(s)->sequence;
280+ int seq = READ_ONCE(s->sequence);
281+ /* Pairs with the first smp_wmb() in raw_write_seqcount_latch() */
282+ smp_read_barrier_depends();
283+ return seq;
281284 }
282285
283286 /**
@@ -331,7 +334,7 @@ static inline int raw_read_seqcount_latch(seqcount_t *s) · 47 unmodified lines
331334 * unsigned seq, idx;
332335 *
333336 * do {
334− * seq = lockless_dereference(latch)->seq;
337+ * seq = raw_read_seqcount_latch(&latch->seq);
335338 *
336339 * idx = seq & 0x01;
337340 * entry = data_query(latch->data[idx], ...);
include/linux/sunrpc/clnt.h+0−2
@@ -137,8 +137,6 @@ struct rpc_create_args { · 136 unmodified lines
137137 #define RPC_CLNT_CREATE_NO_RETRANS_TIMEOUT (1UL << 9)
138138
139139 struct rpc_clnt *rpc_create(struct rpc_create_args *args);
140−struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args,
141− struct rpc_xprt *xprt);
142140 struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
143141 const struct rpc_program *, u32);
144142 struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);
include/linux/sunrpc/svc_xprt.h+1−0
@@ -84,6 +84,7 @@ struct svc_xprt { · 83 unmodified lines
8484
8585 struct net *xpt_net;
8686 struct rpc_xprt *xpt_bc_xprt; /* NFSv4.1 backchannel */
87+ struct rpc_xprt_switch *xpt_bc_xps; /* NFSv4.1 backchannel */
8788 };
8889
8990 static inline void unregister_xpt_user(struct svc_xprt *xpt, struct svc_xpt_user *u)
include/linux/sunrpc/xprt.h+1−0
@@ -297,6 +297,7 @@ struct xprt_create { · 296 unmodified lines
297297 size_t addrlen;
298298 const char *servername;
299299 struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */
300+ struct rpc_xprt_switch *bc_xps;
300301 unsigned int flags;
301302 };
302303
include/linux/thermal.h+2−0
@@ -335,6 +335,8 @@ struct thermal_genl_event { · 334 unmodified lines
335335 * @get_trend: a pointer to a function that reads the sensor temperature trend.
336336 * @set_emul_temp: a pointer to a function that sets sensor emulated
337337 * temperature.
338+ * @set_trip_temp: a pointer to a function that sets the trip temperature on
339+ * hardware.
338340 */
339341 struct thermal_zone_of_device_ops {
340342 int (*get_temp)(void *, int *);
include/linux/usb/gadget.h+3−0
@@ -1034,6 +1034,8 @@ static inline int usb_gadget_activate(struct usb_gadget *gadget) · 1033 unmodified lines
10341034 * @udc_name: A name of UDC this driver should be bound to. If udc_name is NULL,
10351035 * this driver will be bound to any available UDC.
10361036 * @pending: UDC core private data used for deferred probe of this driver.
1037+ * @match_existing_only: If udc is not found, return an error and don't add this
1038+ * gadget driver to list of pending driver
10371039 *
10381040 * Devices are disabled till a gadget driver successfully bind()s, which
10391041 * means the driver will handle setup() requests needed to enumerate (and
@@ -1097,6 +1099,7 @@ struct usb_gadget_driver { · 57 unmodified lines
10971099
10981100 char *udc_name;
10991101 struct list_head pending;
1102+ unsigned match_existing_only:1;
11001103 };
11011104
11021105
include/linux/usb/musb.h+3−2
@@ -142,10 +142,11 @@ enum musb_vbus_id_status { · 141 unmodified lines
142142 };
143143
144144 #if IS_ENABLED(CONFIG_USB_MUSB_HDRC)
145−void musb_mailbox(enum musb_vbus_id_status status);
145+int musb_mailbox(enum musb_vbus_id_status status);
146146 #else
147−static inline void musb_mailbox(enum musb_vbus_id_status status)
147+static inline int musb_mailbox(enum musb_vbus_id_status status)
148148 {
149+ return 0;
149150 }
150151 #endif
151152
include/media/v4l2-mc.h+1−1
@@ -1,7 +1,7 @@
11 /*
22 * v4l2-mc.h - Media Controller V4L2 types and prototypes
33 *
4− * Copyright (C) 2016 Mauro Carvalho Chehab <mchehab@osg.samsung.com>
4+ * Copyright (C) 2016 Mauro Carvalho Chehab <mchehab@kernel.org>
55 * Copyright (C) 2006-2010 Nokia Corporation
66 * Copyright (c) 2016 Intel Corporation.
77 *
include/net/compat.h+1−0
@@ -42,6 +42,7 @@ int compat_sock_get_timestampns(struct sock *, struct timespec __user *); · 41 unmodified lines
4242
4343 int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *,
4444 struct sockaddr __user **, struct iovec **);
45+struct sock_fprog __user *get_compat_bpf_fprog(char __user *optval);
4546 asmlinkage long compat_sys_sendmsg(int, struct compat_msghdr __user *,
4647 unsigned int);
4748 asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *,
include/net/ip_vs.h+1−1
@@ -1232,7 +1232,7 @@ void ip_vs_conn_expire_now(struct ip_vs_conn *cp); · 1231 unmodified lines
12321232 const char *ip_vs_state_name(__u16 proto, int state);
12331233
12341234 void ip_vs_tcp_conn_listen(struct ip_vs_conn *cp);
1235−int ip_vs_check_template(struct ip_vs_conn *ct);
1235+int ip_vs_check_template(struct ip_vs_conn *ct, struct ip_vs_dest *cdest);
12361236 void ip_vs_random_dropentry(struct netns_ipvs *ipvs);
12371237 int ip_vs_conn_init(void);
12381238 void ip_vs_conn_cleanup(void);
include/net/netfilter/nf_queue.h+2−2
@@ -28,8 +28,8 @@ struct nf_queue_handler { · 27 unmodified lines
2828 struct nf_hook_ops *ops);
2929 };
3030
31−void nf_register_queue_handler(const struct nf_queue_handler *qh);
32−void nf_unregister_queue_handler(void);
31+void nf_register_queue_handler(struct net *net, const struct nf_queue_handler *qh);
32+void nf_unregister_queue_handler(struct net *net);
3333 void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict);
3434
3535 void nf_queue_entry_get_refs(struct nf_queue_entry *entry);
include/net/netns/netfilter.h+2−0
@@ -5,11 +5,13 @@ · 4 unmodified lines
55
66 struct proc_dir_entry;
77 struct nf_logger;
8+struct nf_queue_handler;
89
910 struct netns_nf {
1011 #if defined CONFIG_PROC_FS
1112 struct proc_dir_entry *proc_netfilter;
1213 #endif
14+ const struct nf_queue_handler __rcu *queue_handler;
1315 const struct nf_logger __rcu *nf_loggers[NFPROTO_NUMPROTO];
1416 #ifdef CONFIG_SYSCTL
1517 struct ctl_table_header *nf_log_dir_header;
include/net/pkt_cls.h+7−3
@@ -392,16 +392,20 @@ struct tc_cls_u32_offload { · 391 unmodified lines
392392 };
393393 };
394394
395−static inline bool tc_should_offload(struct net_device *dev, u32 flags)
395+static inline bool tc_should_offload(const struct net_device *dev,
396+ const struct tcf_proto *tp, u32 flags)
396397 {
398+ const struct Qdisc *sch = tp->q;
399+ const struct Qdisc_class_ops *cops = sch->ops->cl_ops;
400+
397401 if (!(dev->features & NETIF_F_HW_TC))
398402 return false;
399−
400403 if (flags & TCA_CLS_FLAGS_SKIP_HW)
401404 return false;
402−
403405 if (!dev->netdev_ops->ndo_setup_tc)
404406 return false;
407+ if (cops && cops->tcf_cl_offload)
408+ return cops->tcf_cl_offload(tp->classid);
405409
406410 return true;
407411 }
include/net/sch_generic.h+5−1
@@ -168,6 +168,7 @@ struct Qdisc_class_ops { · 167 unmodified lines
168168
169169 /* Filter manipulation */
170170 struct tcf_proto __rcu ** (*tcf_chain)(struct Qdisc *, unsigned long);
171+ bool (*tcf_cl_offload)(u32 classid);
171172 unsigned long (*bind_tcf)(struct Qdisc *, unsigned long,
172173 u32 classid);
173174 void (*unbind_tcf)(struct Qdisc *, unsigned long);
@@ -691,9 +692,11 @@ static inline struct sk_buff *qdisc_peek_dequeued(struct Qdisc *sch) · 517 unmodified lines
691692 /* we can reuse ->gso_skb because peek isn't called for root qdiscs */
692693 if (!sch->gso_skb) {
693694 sch->gso_skb = sch->dequeue(sch);
694− if (sch->gso_skb)
695+ if (sch->gso_skb) {
695696 /* it's still part of the queue */
697+ qdisc_qstats_backlog_inc(sch, sch->gso_skb);
696698 sch->q.qlen++;
699+ }
697700 }
698701
699702 return sch->gso_skb;
@@ -706,6 +709,7 @@ static inline struct sk_buff *qdisc_dequeue_peeked(struct Qdisc *sch) · 6 unmodified lines
706709
707710 if (skb) {
708711 sch->gso_skb = NULL;
712+ qdisc_qstats_backlog_dec(sch, skb);
709713 sch->q.qlen--;
710714 } else {
711715 skb = sch->dequeue(sch);
include/rdma/ib_verbs.h+3−3
@@ -217,10 +217,10 @@ enum ib_device_cap_flags { · 216 unmodified lines
217217 IB_DEVICE_CROSS_CHANNEL = (1 << 27),
218218 IB_DEVICE_MANAGED_FLOW_STEERING = (1 << 29),
219219 IB_DEVICE_SIGNATURE_HANDOVER = (1 << 30),
220− IB_DEVICE_ON_DEMAND_PAGING = (1 << 31),
220+ IB_DEVICE_ON_DEMAND_PAGING = (1ULL << 31),
221221 IB_DEVICE_SG_GAPS_REG = (1ULL << 32),
222− IB_DEVICE_VIRTUAL_FUNCTION = ((u64)1 << 33),
223− IB_DEVICE_RAW_SCATTER_FCS = ((u64)1 << 34),
222+ IB_DEVICE_VIRTUAL_FUNCTION = (1ULL << 33),
223+ IB_DEVICE_RAW_SCATTER_FCS = (1ULL << 34),
224224 };
225225
226226 enum ib_signature_prot_cap {
include/uapi/linux/btrfs.h+1−1
@@ -118,7 +118,7 @@ struct btrfs_ioctl_vol_args_v2 { · 117 unmodified lines
118118 };
119119 union {
120120 char name[BTRFS_SUBVOL_NAME_MAX + 1];
121− u64 devid;
121+ __u64 devid;
122122 };
123123 };
124124
include/uapi/linux/gtp.h+1−1
@@ -1,5 +1,5 @@
11 #ifndef _UAPI_LINUX_GTP_H_
2−#define _UAPI_LINUX_GTP_H__
2+#define _UAPI_LINUX_GTP_H_
33
44 enum gtp_genl_cmds {
55 GTP_CMD_NEWPDP,
include/uapi/sound/Kbuild+3−0
@@ -1,5 +1,6 @@
11 # UAPI Header export list
22 header-y += asequencer.h
3+header-y += asoc.h
34 header-y += asound.h
45 header-y += asound_fm.h
56 header-y += compress_offload.h
@@ -10,3 +11,5 @@ header-y += hdsp.h · 4 unmodified lines
1011 header-y += hdspm.h
1112 header-y += sb16_csp.h
1213 header-y += sfnt_info.h
14+header-y += tlv.h
15+header-y += usb_stream.h
kernel/events/core.c+2−4
@@ -3862,10 +3862,8 @@ static void _free_event(struct perf_event *event) · 3861 unmodified lines
38623862 if (event->ctx)
38633863 put_ctx(event->ctx);
38643864
3865− if (event->pmu) {
3866− exclusive_event_destroy(event);
3867− module_put(event->pmu->module);
3868− }
3865+ exclusive_event_destroy(event);
3866+ module_put(event->pmu->module);
38693867
38703868 call_rcu(&event->rcu_head, free_event_rcu);
38713869 }
kernel/futex.c+11−3
@@ -469,7 +469,7 @@ get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, int rw) · 468 unmodified lines
469469 {
470470 unsigned long address = (unsigned long)uaddr;
471471 struct mm_struct *mm = current->mm;
472− struct page *page;
472+ struct page *page, *tail;
473473 struct address_space *mapping;
474474 int err, ro = 0;
475475
@@ -530,7 +530,15 @@ again: · 54 unmodified lines
530530 * considered here and page lock forces unnecessarily serialization
531531 * From this point on, mapping will be re-verified if necessary and
532532 * page lock will be acquired only if it is unavoidable
533− */
533+ *
534+ * Mapping checks require the head page for any compound page so the
535+ * head page and mapping is looked up now. For anonymous pages, it
536+ * does not matter if the page splits in the future as the key is
537+ * based on the address. For filesystem-backed pages, the tail is
538+ * required as the index of the page determines the key. For
539+ * base pages, there is no tail page and tail == page.
540+ */
541+ tail = page;
534542 page = compound_head(page);
535543 mapping = READ_ONCE(page->mapping);
536544
@@ -654,7 +662,7 @@ again: · 117 unmodified lines
654662
655663 key->both.offset |= FUT_OFF_INODE; /* inode-based key */
656664 key->shared.inode = inode;
657− key->shared.pgoff = basepage_index(page);
665+ key->shared.pgoff = basepage_index(tail);
658666 rcu_read_unlock();
659667 }
660668
kernel/kcov.c+6−1
@@ -264,7 +264,12 @@ static const struct file_operations kcov_fops = { · 263 unmodified lines
264264
265265 static int __init kcov_init(void)
266266 {
267− if (!debugfs_create_file("kcov", 0600, NULL, NULL, &kcov_fops)) {
267+ /*
268+ * The kcov debugfs file won't ever get removed and thus,
269+ * there is no need to protect it against removal races. The
270+ * use of debugfs_create_file_unsafe() is actually safe here.
271+ */
272+ if (!debugfs_create_file_unsafe("kcov", 0600, NULL, NULL, &kcov_fops)) {
268273 pr_err("failed to create kcov in debugfs\n");
269274 return -ENOMEM;
270275 }
kernel/locking/mutex.c+6−3
@@ -486,9 +486,6 @@ __ww_mutex_lock_check_stamp(struct mutex *lock, struct ww_acquire_ctx *ctx) · 485 unmodified lines
486486 if (!hold_ctx)
487487 return 0;
488488
489− if (unlikely(ctx == hold_ctx))
490− return -EALREADY;
491−
492489 if (ctx->stamp - hold_ctx->stamp <= LONG_MAX &&
493490 (ctx->stamp != hold_ctx->stamp || ctx > hold_ctx)) {
494491 #ifdef CONFIG_DEBUG_MUTEXES
@@ -514,6 +511,12 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, · 19 unmodified lines
514511 unsigned long flags;
515512 int ret;
516513
514+ if (use_ww_ctx) {
515+ struct ww_mutex *ww = container_of(lock, struct ww_mutex, base);
516+ if (unlikely(ww_ctx == READ_ONCE(ww->ctx)))
517+ return -EALREADY;
518+ }
519+
517520 preempt_disable();
518521 mutex_acquire_nest(&lock->dep_map, subclass, 0, nest_lock, ip);
519522
kernel/locking/qspinlock.c+60−0
@@ -267,6 +267,66 @@ static __always_inline u32 __pv_wait_head_or_lock(struct qspinlock *lock, · 266 unmodified lines
267267 #define queued_spin_lock_slowpath native_queued_spin_lock_slowpath
268268 #endif
269269
270+/*
271+ * queued_spin_lock_slowpath() can (load-)ACQUIRE the lock before
272+ * issuing an _unordered_ store to set _Q_LOCKED_VAL.
273+ *
274+ * This means that the store can be delayed, but no later than the
275+ * store-release from the unlock. This means that simply observing
276+ * _Q_LOCKED_VAL is not sufficient to determine if the lock is acquired.
277+ *
278+ * There are two paths that can issue the unordered store:
279+ *
280+ * (1) clear_pending_set_locked(): *,1,0 -> *,0,1
281+ *
282+ * (2) set_locked(): t,0,0 -> t,0,1 ; t != 0
283+ * atomic_cmpxchg_relaxed(): t,0,0 -> 0,0,1
284+ *
285+ * However, in both cases we have other !0 state we've set before to queue
286+ * ourseves:
287+ *
288+ * For (1) we have the atomic_cmpxchg_acquire() that set _Q_PENDING_VAL, our
289+ * load is constrained by that ACQUIRE to not pass before that, and thus must
290+ * observe the store.
291+ *
292+ * For (2) we have a more intersting scenario. We enqueue ourselves using
293+ * xchg_tail(), which ends up being a RELEASE. This in itself is not
294+ * sufficient, however that is followed by an smp_cond_acquire() on the same
295+ * word, giving a RELEASE->ACQUIRE ordering. This again constrains our load and
296+ * guarantees we must observe that store.
297+ *
298+ * Therefore both cases have other !0 state that is observable before the
299+ * unordered locked byte store comes through. This means we can use that to
300+ * wait for the lock store, and then wait for an unlock.
301+ */
302+#ifndef queued_spin_unlock_wait
303+void queued_spin_unlock_wait(struct qspinlock *lock)
304+{
305+ u32 val;
306+
307+ for (;;) {
308+ val = atomic_read(&lock->val);
309+
310+ if (!val) /* not locked, we're done */
311+ goto done;
312+
313+ if (val & _Q_LOCKED_MASK) /* locked, go wait for unlock */
314+ break;
315+
316+ /* not locked, but pending, wait until we observe the lock */
317+ cpu_relax();
318+ }
319+
320+ /* any unlock is good */
321+ while (atomic_read(&lock->val) & _Q_LOCKED_MASK)
322+ cpu_relax();
323+
324+done:
325+ smp_rmb(); /* CTRL + RMB -> ACQUIRE */
326+}
327+EXPORT_SYMBOL(queued_spin_unlock_wait);
328+#endif
329+
270330 #endif /* _GEN_PV_LOCK_SLOWPATH */
271331
272332 /**
kernel/relay.c+1−0
@@ -614,6 +614,7 @@ free_bufs: · 613 unmodified lines
614614
615615 kref_put(&chan->kref, relay_destroy_channel);
616616 mutex_unlock(&relay_channels_mutex);
617+ kfree(chan);
617618 return NULL;
618619 }
619620 EXPORT_SYMBOL_GPL(relay_open);
kernel/sched/core.c+23−6
@@ -2253,9 +2253,11 @@ int sysctl_numa_balancing(struct ctl_table *table, int write, · 2252 unmodified lines
22532253 #endif
22542254 #endif
22552255
2256+#ifdef CONFIG_SCHEDSTATS
2257+
22562258 DEFINE_STATIC_KEY_FALSE(sched_schedstats);
2259+static bool __initdata __sched_schedstats = false;
22572260
2258−#ifdef CONFIG_SCHEDSTATS
22592261 static void set_schedstats(bool enabled)
22602262 {
22612263 if (enabled)
@@ -2278,11 +2280,16 @@ static int __init setup_schedstats(char *str) · 16 unmodified lines
22782280 if (!str)
22792281 goto out;
22802282
2283+ /*
2284+ * This code is called before jump labels have been set up, so we can't
2285+ * change the static branch directly just yet. Instead set a temporary
2286+ * variable so init_schedstats() can do it later.
2287+ */
22812288 if (!strcmp(str, "enable")) {
2282− set_schedstats(true);
2289+ __sched_schedstats = true;
22832290 ret = 1;
22842291 } else if (!strcmp(str, "disable")) {
2285− set_schedstats(false);
2292+ __sched_schedstats = false;
22862293 ret = 1;
22872294 }
22882295 out:
@@ -2293,6 +2300,11 @@ out: · 4 unmodified lines
22932300 }
22942301 __setup("schedstats=", setup_schedstats);
22952302
2303+static void __init init_schedstats(void)
2304+{
2305+ set_schedstats(__sched_schedstats);
2306+}
2307+
22962308 #ifdef CONFIG_PROC_SYSCTL
22972309 int sysctl_schedstats(struct ctl_table *table, int write,
22982310 void __user *buffer, size_t *lenp, loff_t *ppos)
@@ -2313,8 +2325,10 @@ int sysctl_schedstats(struct ctl_table *table, int write, · 14 unmodified lines
23132325 set_schedstats(state);
23142326 return err;
23152327 }
2316−#endif
2317−#endif
2328+#endif /* CONFIG_PROC_SYSCTL */
2329+#else /* !CONFIG_SCHEDSTATS */
2330+static inline void init_schedstats(void) {}
2331+#endif /* CONFIG_SCHEDSTATS */
23182332
23192333 /*
23202334 * fork()/clone()-time setup:
@@ -3156,7 +3170,8 @@ static noinline void __schedule_bug(struct task_struct *prev) · 835 unmodified lines
31563170 static inline void schedule_debug(struct task_struct *prev)
31573171 {
31583172 #ifdef CONFIG_SCHED_STACK_END_CHECK
3159− BUG_ON(task_stack_end_corrupted(prev));
3173+ if (task_stack_end_corrupted(prev))
3174+ panic("corrupted stack end detected inside scheduler\n");
31603175 #endif
31613176
31623177 if (unlikely(in_atomic_preempt_off())) {
@@ -7487,6 +7502,8 @@ void __init sched_init(void) · 4324 unmodified lines
74877502 #endif
74887503 init_sched_fair_class();
74897504
7505+ init_schedstats();
7506+
74907507 scheduler_running = 1;
74917508 }
74927509
kernel/sched/debug.c+4−11
@@ -427,19 +427,12 @@ print_task(struct seq_file *m, struct rq *rq, struct task_struct *p) · 426 unmodified lines
427427 SPLIT_NS(p->se.vruntime),
428428 (long long)(p->nvcsw + p->nivcsw),
429429 p->prio);
430−#ifdef CONFIG_SCHEDSTATS
431− if (schedstat_enabled()) {
432− SEQ_printf(m, "%9Ld.%06ld %9Ld.%06ld %9Ld.%06ld",
433− SPLIT_NS(p->se.statistics.wait_sum),
434− SPLIT_NS(p->se.sum_exec_runtime),
435− SPLIT_NS(p->se.statistics.sum_sleep_runtime));
436− }
437−#else
430+
438431 SEQ_printf(m, "%9Ld.%06ld %9Ld.%06ld %9Ld.%06ld",
439− 0LL, 0L,
432+ SPLIT_NS(schedstat_val(p, se.statistics.wait_sum)),
440433 SPLIT_NS(p->se.sum_exec_runtime),
441− 0LL, 0L);
442−#endif
434+ SPLIT_NS(schedstat_val(p, se.statistics.sum_sleep_runtime)));
435+
443436 #ifdef CONFIG_NUMA_BALANCING
444437 SEQ_printf(m, " %d %d", task_node(p), task_numa_group_id(p));
445438 #endif
kernel/sched/idle.c+1−1
@@ -127,7 +127,7 @@ static int call_cpuidle(struct cpuidle_driver *drv, struct cpuidle_device *dev, · 126 unmodified lines
127127 */
128128 static void cpuidle_idle_call(void)
129129 {
130− struct cpuidle_device *dev = __this_cpu_read(cpuidle_devices);
130+ struct cpuidle_device *dev = cpuidle_get_device();
131131 struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
132132 int next_state, entered_state;
133133
kernel/sched/stats.h+3−0
@@ -33,6 +33,8 @@ rq_sched_info_dequeued(struct rq *rq, unsigned long long delta) · 32 unmodified lines
3333 # define schedstat_inc(rq, field) do { if (schedstat_enabled()) { (rq)->field++; } } while (0)
3434 # define schedstat_add(rq, field, amt) do { if (schedstat_enabled()) { (rq)->field += (amt); } } while (0)
3535 # define schedstat_set(var, val) do { if (schedstat_enabled()) { var = (val); } } while (0)
36+# define schedstat_val(rq, field) ((schedstat_enabled()) ? (rq)->field : 0)
37+
3638 #else /* !CONFIG_SCHEDSTATS */
3739 static inline void
3840 rq_sched_info_arrive(struct rq *rq, unsigned long long delta)
@@ -47,6 +49,7 @@ rq_sched_info_depart(struct rq *rq, unsigned long long delta) · 8 unmodified lines
4749 # define schedstat_inc(rq, field) do { } while (0)
4850 # define schedstat_add(rq, field, amt) do { } while (0)
4951 # define schedstat_set(var, val) do { } while (0)
52+# define schedstat_val(rq, field) 0
5053 #endif
5154
5255 #ifdef CONFIG_SCHED_INFO
kernel/trace/bpf_trace.c+2−2
@@ -198,7 +198,7 @@ static u64 bpf_perf_event_read(u64 r1, u64 index, u64 r3, u64 r4, u64 r5) · 197 unmodified lines
198198 if (unlikely(index >= array->map.max_entries))
199199 return -E2BIG;
200200
201− file = (struct file *)array->ptrs[index];
201+ file = READ_ONCE(array->ptrs[index]);
202202 if (unlikely(!file))
203203 return -ENOENT;
204204
@@ -247,7 +247,7 @@ static u64 bpf_perf_event_output(u64 r1, u64 r2, u64 flags, u64 r4, u64 size) · 42 unmodified lines
247247 if (unlikely(index >= array->map.max_entries))
248248 return -E2BIG;
249249
250− file = (struct file *)array->ptrs[index];
250+ file = READ_ONCE(array->ptrs[index]);
251251 if (unlikely(!file))
252252 return -ENOENT;
253253
mm/fadvise.c+11−0
@@ -126,6 +126,17 @@ SYSCALL_DEFINE4(fadvise64_64, int, fd, loff_t, offset, loff_t, len, int, advice) · 125 unmodified lines
126126 */
127127 start_index = (offset+(PAGE_SIZE-1)) >> PAGE_SHIFT;
128128 end_index = (endbyte >> PAGE_SHIFT);
129+ if ((endbyte & ~PAGE_MASK) != ~PAGE_MASK) {
130+ /* First page is tricky as 0 - 1 = -1, but pgoff_t
131+ * is unsigned, so the end_index >= start_index
132+ * check below would be true and we'll discard the whole
133+ * file cache which is not what was asked.
134+ */
135+ if (end_index == 0)
136+ break;
137+
138+ end_index--;
139+ }
129140
130141 if (end_index >= start_index) {
131142 unsigned long count = invalidate_mapping_pages(mapping,
mm/hugetlb.c+40−2
@@ -832,8 +832,27 @@ static bool vma_has_reserves(struct vm_area_struct *vma, long chg) · 831 unmodified lines
832832 * Only the process that called mmap() has reserves for
833833 * private mappings.
834834 */
835− if (is_vma_resv_set(vma, HPAGE_RESV_OWNER))
836− return true;
835+ if (is_vma_resv_set(vma, HPAGE_RESV_OWNER)) {
836+ /*
837+ * Like the shared case above, a hole punch or truncate
838+ * could have been performed on the private mapping.
839+ * Examine the value of chg to determine if reserves
840+ * actually exist or were previously consumed.
841+ * Very Subtle - The value of chg comes from a previous
842+ * call to vma_needs_reserves(). The reserve map for
843+ * private mappings has different (opposite) semantics
844+ * than that of shared mappings. vma_needs_reserves()
845+ * has already taken this difference in semantics into
846+ * account. Therefore, the meaning of chg is the same
847+ * as in the shared case above. Code could easily be
848+ * combined, but keeping it separate draws attention to
849+ * subtle differences.
850+ */
851+ if (chg)
852+ return false;
853+ else
854+ return true;
855+ }
837856
838857 return false;
839858 }
@@ -1816,6 +1835,25 @@ static long __vma_reservation_common(struct hstate *h, · 976 unmodified lines
18161835
18171836 if (vma->vm_flags & VM_MAYSHARE)
18181837 return ret;
1838+ else if (is_vma_resv_set(vma, HPAGE_RESV_OWNER) && ret >= 0) {
1839+ /*
1840+ * In most cases, reserves always exist for private mappings.
1841+ * However, a file associated with mapping could have been
1842+ * hole punched or truncated after reserves were consumed.
1843+ * As subsequent fault on such a range will not use reserves.
1844+ * Subtle - The reserve map for private mappings has the
1845+ * opposite meaning than that of shared mappings. If NO
1846+ * entry is in the reserve map, it means a reservation exists.
1847+ * If an entry exists in the reserve map, it means the
1848+ * reservation has already been consumed. As a result, the
1849+ * return value of this routine is the opposite of the
1850+ * value returned from reserve map manipulation routines above.
1851+ */
1852+ if (ret)
1853+ return 0;
1854+ else
1855+ return 1;
1856+ }
18191857 else
18201858 return ret < 0 ? ret : 0;
18211859 }
mm/kasan/kasan.c+2−2
@@ -763,8 +763,8 @@ static int kasan_mem_notifier(struct notifier_block *nb, · 762 unmodified lines
763763
764764 static int __init kasan_memhotplug_init(void)
765765 {
766− pr_err("WARNING: KASAN doesn't support memory hot-add\n");
767− pr_err("Memory hot-add will be disabled\n");
766+ pr_info("WARNING: KASAN doesn't support memory hot-add\n");
767+ pr_info("Memory hot-add will be disabled\n");
768768
769769 hotplug_memory_notifier(kasan_mem_notifier, 0);
770770
mm/memcontrol.c+1−1
@@ -1608,7 +1608,7 @@ static void memcg_oom_recover(struct mem_cgroup *memcg) · 1607 unmodified lines
16081608
16091609 static void mem_cgroup_oom(struct mem_cgroup *memcg, gfp_t mask, int order)
16101610 {
1611− if (!current->memcg_may_oom || current->memcg_in_oom)
1611+ if (!current->memcg_may_oom)
16121612 return;
16131613 /*
16141614 * We are in the middle of the charge context here, so we
mm/page-writeback.c+12−9
@@ -373,8 +373,9 @@ static void domain_dirty_limits(struct dirty_throttle_control *dtc) · 372 unmodified lines
373373 struct dirty_throttle_control *gdtc = mdtc_gdtc(dtc);
374374 unsigned long bytes = vm_dirty_bytes;
375375 unsigned long bg_bytes = dirty_background_bytes;
376− unsigned long ratio = vm_dirty_ratio;
377− unsigned long bg_ratio = dirty_background_ratio;
376+ /* convert ratios to per-PAGE_SIZE for higher precision */
377+ unsigned long ratio = (vm_dirty_ratio * PAGE_SIZE) / 100;
378+ unsigned long bg_ratio = (dirty_background_ratio * PAGE_SIZE) / 100;
378379 unsigned long thresh;
379380 unsigned long bg_thresh;
380381 struct task_struct *tsk;
@@ -386,26 +387,28 @@ static void domain_dirty_limits(struct dirty_throttle_control *dtc) · 5 unmodified lines
386387 /*
387388 * The byte settings can't be applied directly to memcg
388389 * domains. Convert them to ratios by scaling against
389− * globally available memory.
390+ * globally available memory. As the ratios are in
391+ * per-PAGE_SIZE, they can be obtained by dividing bytes by
392+ * number of pages.
390393 */
391394 if (bytes)
392− ratio = min(DIV_ROUND_UP(bytes, PAGE_SIZE) * 100 /
393− global_avail, 100UL);
395+ ratio = min(DIV_ROUND_UP(bytes, global_avail),
396+ PAGE_SIZE);
394397 if (bg_bytes)
395− bg_ratio = min(DIV_ROUND_UP(bg_bytes, PAGE_SIZE) * 100 /
396− global_avail, 100UL);
398+ bg_ratio = min(DIV_ROUND_UP(bg_bytes, global_avail),
399+ PAGE_SIZE);
397400 bytes = bg_bytes = 0;
398401 }
399402
400403 if (bytes)
401404 thresh = DIV_ROUND_UP(bytes, PAGE_SIZE);
402405 else
403− thresh = (ratio * available_memory) / 100;
406+ thresh = (ratio * available_memory) / PAGE_SIZE;
404407
405408 if (bg_bytes)
406409 bg_thresh = DIV_ROUND_UP(bg_bytes, PAGE_SIZE);
407410 else
408− bg_thresh = (bg_ratio * available_memory) / 100;
411+ bg_thresh = (bg_ratio * available_memory) / PAGE_SIZE;
409412
410413 if (bg_thresh >= thresh)
411414 bg_thresh = thresh / 2;
mm/percpu.c+44−29
@@ -112,7 +112,7 @@ struct pcpu_chunk { · 111 unmodified lines
112112 int map_used; /* # of map entries used before the sentry */
113113 int map_alloc; /* # of map entries allocated */
114114 int *map; /* allocation map */
115− struct work_struct map_extend_work;/* async ->map[] extension */
115+ struct list_head map_extend_list;/* on pcpu_map_extend_chunks */
116116
117117 void *data; /* chunk data */
118118 int first_free; /* no free below this */
@@ -162,10 +162,13 @@ static struct pcpu_chunk *pcpu_reserved_chunk; · 43 unmodified lines
162162 static int pcpu_reserved_chunk_limit;
163163
164164 static DEFINE_SPINLOCK(pcpu_lock); /* all internal data structures */
165−static DEFINE_MUTEX(pcpu_alloc_mutex); /* chunk create/destroy, [de]pop */
165+static DEFINE_MUTEX(pcpu_alloc_mutex); /* chunk create/destroy, [de]pop, map ext */
166166
167167 static struct list_head *pcpu_slot __read_mostly; /* chunk list slots */
168168
169+/* chunks which need their map areas extended, protected by pcpu_lock */
170+static LIST_HEAD(pcpu_map_extend_chunks);
171+
169172 /*
170173 * The number of empty populated pages, protected by pcpu_lock. The
171174 * reserved chunk doesn't contribute to the count.
@@ -395,13 +398,19 @@ static int pcpu_need_to_extend(struct pcpu_chunk *chunk, bool is_atomic) · 223 unmodified lines
395398 {
396399 int margin, new_alloc;
397400
401+ lockdep_assert_held(&pcpu_lock);
402+
398403 if (is_atomic) {
399404 margin = 3;
400405
401406 if (chunk->map_alloc <
402− chunk->map_used + PCPU_ATOMIC_MAP_MARGIN_LOW &&
403− pcpu_async_enabled)
404− schedule_work(&chunk->map_extend_work);
407+ chunk->map_used + PCPU_ATOMIC_MAP_MARGIN_LOW) {
408+ if (list_empty(&chunk->map_extend_list)) {
409+ list_add_tail(&chunk->map_extend_list,
410+ &pcpu_map_extend_chunks);
411+ pcpu_schedule_balance_work();
412+ }
413+ }
405414 } else {
406415 margin = PCPU_ATOMIC_MAP_MARGIN_HIGH;
407416 }
@@ -435,6 +444,8 @@ static int pcpu_extend_area_map(struct pcpu_chunk *chunk, int new_alloc) · 27 unmodified lines
435444 size_t old_size = 0, new_size = new_alloc * sizeof(new[0]);
436445 unsigned long flags;
437446
447+ lockdep_assert_held(&pcpu_alloc_mutex);
448+
438449 new = pcpu_mem_zalloc(new_size);
439450 if (!new)
440451 return -ENOMEM;
@@ -467,20 +478,6 @@ out_unlock: · 26 unmodified lines
467478 return 0;
468479 }
469480
470−static void pcpu_map_extend_workfn(struct work_struct *work)
471−{
472− struct pcpu_chunk *chunk = container_of(work, struct pcpu_chunk,
473− map_extend_work);
474− int new_alloc;
475−
476− spin_lock_irq(&pcpu_lock);
477− new_alloc = pcpu_need_to_extend(chunk, false);
478− spin_unlock_irq(&pcpu_lock);
479−
480− if (new_alloc)
481− pcpu_extend_area_map(chunk, new_alloc);
482−}
483−
484481 /**
485482 * pcpu_fit_in_area - try to fit the requested allocation in a candidate area
486483 * @chunk: chunk the candidate area belongs to
@@ -740,7 +737,7 @@ static struct pcpu_chunk *pcpu_alloc_chunk(void) · 253 unmodified lines
740737 chunk->map_used = 1;
741738
742739 INIT_LIST_HEAD(&chunk->list);
743− INIT_WORK(&chunk->map_extend_work, pcpu_map_extend_workfn);
740+ INIT_LIST_HEAD(&chunk->map_extend_list);
744741 chunk->free_size = pcpu_unit_size;
745742 chunk->contig_hint = pcpu_unit_size;
746743
@@ -895,6 +892,9 @@ static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved, · 148 unmodified lines
895892 return NULL;
896893 }
897894
895+ if (!is_atomic)
896+ mutex_lock(&pcpu_alloc_mutex);
897+
898898 spin_lock_irqsave(&pcpu_lock, flags);
899899
900900 /* serve reserved allocations from the reserved chunk if available */
@@ -967,12 +967,9 @@ restart: · 66 unmodified lines
967967 if (is_atomic)
968968 goto fail;
969969
970− mutex_lock(&pcpu_alloc_mutex);
971−
972970 if (list_empty(&pcpu_slot[pcpu_nr_slots - 1])) {
973971 chunk = pcpu_create_chunk();
974972 if (!chunk) {
975− mutex_unlock(&pcpu_alloc_mutex);
976973 err = "failed to allocate new chunk";
977974 goto fail;
978975 }
@@ -983,7 +980,6 @@ restart: · 4 unmodified lines
983980 spin_lock_irqsave(&pcpu_lock, flags);
984981 }
985982
986− mutex_unlock(&pcpu_alloc_mutex);
987983 goto restart;
988984
989985 area_found:
@@ -993,8 +989,6 @@ area_found: · 3 unmodified lines
993989 if (!is_atomic) {
994990 int page_start, page_end, rs, re;
995991
996− mutex_lock(&pcpu_alloc_mutex);
997−
998992 page_start = PFN_DOWN(off);
999993 page_end = PFN_UP(off + size);
1000994
@@ -1005,7 +999,6 @@ area_found: · 4 unmodified lines
1005999
10061000 spin_lock_irqsave(&pcpu_lock, flags);
10071001 if (ret) {
1008− mutex_unlock(&pcpu_alloc_mutex);
10091002 pcpu_free_area(chunk, off, &occ_pages);
10101003 err = "failed to populate";
10111004 goto fail_unlock;
@@ -1045,6 +1038,8 @@ fail: · 33 unmodified lines
10451038 /* see the flag handling in pcpu_blance_workfn() */
10461039 pcpu_atomic_alloc_failed = true;
10471040 pcpu_schedule_balance_work();
1041+ } else {
1042+ mutex_unlock(&pcpu_alloc_mutex);
10481043 }
10491044 return NULL;
10501045 }
@@ -1129,6 +1124,7 @@ static void pcpu_balance_workfn(struct work_struct *work) · 78 unmodified lines
11291124 if (chunk == list_first_entry(free_head, struct pcpu_chunk, list))
11301125 continue;
11311126
1127+ list_del_init(&chunk->map_extend_list);
11321128 list_move(&chunk->list, &to_free);
11331129 }
11341130
@@ -1146,6 +1142,25 @@ static void pcpu_balance_workfn(struct work_struct *work) · 11 unmodified lines
11461142 pcpu_destroy_chunk(chunk);
11471143 }
11481144
1145+ /* service chunks which requested async area map extension */
1146+ do {
1147+ int new_alloc = 0;
1148+
1149+ spin_lock_irq(&pcpu_lock);
1150+
1151+ chunk = list_first_entry_or_null(&pcpu_map_extend_chunks,
1152+ struct pcpu_chunk, map_extend_list);
1153+ if (chunk) {
1154+ list_del_init(&chunk->map_extend_list);
1155+ new_alloc = pcpu_need_to_extend(chunk, false);
1156+ }
1157+
1158+ spin_unlock_irq(&pcpu_lock);
1159+
1160+ if (new_alloc)
1161+ pcpu_extend_area_map(chunk, new_alloc);
1162+ } while (chunk);
1163+
11491164 /*
11501165 * Ensure there are certain number of free populated pages for
11511166 * atomic allocs. Fill up from the most packed so that atomic
@@ -1644,7 +1659,7 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, · 492 unmodified lines
16441659 */
16451660 schunk = memblock_virt_alloc(pcpu_chunk_struct_size, 0);
16461661 INIT_LIST_HEAD(&schunk->list);
1647− INIT_WORK(&schunk->map_extend_work, pcpu_map_extend_workfn);
1662+ INIT_LIST_HEAD(&schunk->map_extend_list);
16481663 schunk->base_addr = base_addr;
16491664 schunk->map = smap;
16501665 schunk->map_alloc = ARRAY_SIZE(smap);
@@ -1673,7 +1688,7 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, · 22 unmodified lines
16731688 if (dyn_size) {
16741689 dchunk = memblock_virt_alloc(pcpu_chunk_struct_size, 0);
16751690 INIT_LIST_HEAD(&dchunk->list);
1676− INIT_WORK(&dchunk->map_extend_work, pcpu_map_extend_workfn);
1691+ INIT_LIST_HEAD(&dchunk->map_extend_list);
16771692 dchunk->base_addr = base_addr;
16781693 dchunk->map = dmap;
16791694 dchunk->map_alloc = ARRAY_SIZE(dmap);
mm/swap.c+19−1
@@ -667,6 +667,24 @@ static void lru_add_drain_per_cpu(struct work_struct *dummy) · 666 unmodified lines
667667
668668 static DEFINE_PER_CPU(struct work_struct, lru_add_drain_work);
669669
670+/*
671+ * lru_add_drain_wq is used to do lru_add_drain_all() from a WQ_MEM_RECLAIM
672+ * workqueue, aiding in getting memory freed.
673+ */
674+static struct workqueue_struct *lru_add_drain_wq;
675+
676+static int __init lru_init(void)
677+{
678+ lru_add_drain_wq = alloc_workqueue("lru-add-drain", WQ_MEM_RECLAIM, 0);
679+
680+ if (WARN(!lru_add_drain_wq,
681+ "Failed to create workqueue lru_add_drain_wq"))
682+ return -ENOMEM;
683+
684+ return 0;
685+}
686+early_initcall(lru_init);
687+
670688 void lru_add_drain_all(void)
671689 {
672690 static DEFINE_MUTEX(lock);
@@ -686,7 +704,7 @@ void lru_add_drain_all(void) · 13 unmodified lines
686704 pagevec_count(&per_cpu(lru_deactivate_pvecs, cpu)) ||
687705 need_activate_page_drain(cpu)) {
688706 INIT_WORK(work, lru_add_drain_per_cpu);
689− schedule_work_on(cpu, work);
707+ queue_work_on(cpu, lru_add_drain_wq, work);
690708 cpumask_set_cpu(cpu, &has_work);
691709 }
692710 }
mm/swap_state.c+4−1
@@ -252,7 +252,10 @@ static inline void free_swap_cache(struct page *page) · 251 unmodified lines
252252 void free_page_and_swap_cache(struct page *page)
253253 {
254254 free_swap_cache(page);
255− put_page(page);
255+ if (is_huge_zero_page(page))
256+ put_huge_zero_page();
257+ else
258+ put_page(page);
256259 }
257260
258261 /*
net/bridge/br_fdb.c+2−0
@@ -279,6 +279,8 @@ void br_fdb_change_mac_address(struct net_bridge *br, const u8 *newaddr) · 278 unmodified lines
279279 * change from under us.
280280 */
281281 list_for_each_entry(v, &vg->vlan_list, vlist) {
282+ if (!br_vlan_should_use(v))
283+ continue;
282284 f = __br_fdb_get(br, br->dev->dev_addr, v->vid);
283285 if (f && f->is_local && !f->dst)
284286 fdb_delete_local(br, NULL, f);
net/compat.c+17−3
@@ -309,8 +309,8 @@ void scm_detach_fds_compat(struct msghdr *kmsg, struct scm_cookie *scm) · 308 unmodified lines
309309 __scm_destroy(scm);
310310 }
311311
312−static int do_set_attach_filter(struct socket *sock, int level, int optname,
313− char __user *optval, unsigned int optlen)
312+/* allocate a 64-bit sock_fprog on the user stack for duration of syscall. */
313+struct sock_fprog __user *get_compat_bpf_fprog(char __user *optval)
314314 {
315315 struct compat_sock_fprog __user *fprog32 = (struct compat_sock_fprog __user *)optval;
316316 struct sock_fprog __user *kfprog = compat_alloc_user_space(sizeof(struct sock_fprog));
@@ -323,6 +323,19 @@ static int do_set_attach_filter(struct socket *sock, int level, int optname, · 6 unmodified lines
323323 __get_user(ptr, &fprog32->filter) ||
324324 __put_user(len, &kfprog->len) ||
325325 __put_user(compat_ptr(ptr), &kfprog->filter))
326+ return NULL;
327+
328+ return kfprog;
329+}
330+EXPORT_SYMBOL_GPL(get_compat_bpf_fprog);
331+
332+static int do_set_attach_filter(struct socket *sock, int level, int optname,
333+ char __user *optval, unsigned int optlen)
334+{
335+ struct sock_fprog __user *kfprog;
336+
337+ kfprog = get_compat_bpf_fprog(optval);
338+ if (!kfprog)
326339 return -EFAULT;
327340
328341 return sock_setsockopt(sock, level, optname, (char __user *)kfprog,
@@ -354,7 +367,8 @@ static int do_set_sock_timeout(struct socket *sock, int level, · 25 unmodified lines
354367 static int compat_sock_setsockopt(struct socket *sock, int level, int optname,
355368 char __user *optval, unsigned int optlen)
356369 {
357− if (optname == SO_ATTACH_FILTER)
370+ if (optname == SO_ATTACH_FILTER ||
371+ optname == SO_ATTACH_REUSEPORT_CBPF)
358372 return do_set_attach_filter(sock, level, optname,
359373 optval, optlen);
360374 if (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO)
net/core/gen_stats.c+2−0
@@ -47,6 +47,7 @@ nla_put_failure: · 46 unmodified lines
4747 * @xstats_type: TLV type for backward compatibility xstats TLV
4848 * @lock: statistics lock
4949 * @d: dumping handle
50+ * @padattr: padding attribute
5051 *
5152 * Initializes the dumping handle, grabs the statistic lock and appends
5253 * an empty TLV header to the socket buffer for use a container for all
@@ -87,6 +88,7 @@ EXPORT_SYMBOL(gnet_stats_start_copy_compat); · 34 unmodified lines
8788 * @type: TLV type for top level statistic TLV
8889 * @lock: statistics lock
8990 * @d: dumping handle
91+ * @padattr: padding attribute
9092 *
9193 * Initializes the dumping handle, grabs the statistic lock and appends
9294 * an empty TLV header to the socket buffer for use a container for all
net/core/net-sysfs.c+1−0
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424 #include <linux/jiffies.h>
2525 #include <linux/pm_runtime.h>
2626 #include <linux/of.h>
27+#include <linux/of_net.h>
2728
2829 #include "net-sysfs.h"
2930
net/ipv4/udp.c+5−5
@@ -1618,12 +1618,12 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) · 1617 unmodified lines
16181618 }
16191619 }
16201620
1621− if (rcu_access_pointer(sk->sk_filter)) {
1622− if (udp_lib_checksum_complete(skb))
1621+ if (rcu_access_pointer(sk->sk_filter) &&
1622+ udp_lib_checksum_complete(skb))
16231623 goto csum_error;
1624− if (sk_filter(sk, skb))
1625− goto drop;
1626− }
1624+
1625+ if (sk_filter(sk, skb))
1626+ goto drop;
16271627
16281628 udp_csum_pull_header(skb);
16291629 if (sk_rcvqueues_full(sk, sk->sk_rcvbuf)) {
net/ipv6/ip6_gre.c+3−0
@@ -1256,6 +1256,8 @@ static int ip6gre_tap_init(struct net_device *dev) · 1255 unmodified lines
12561256 if (ret)
12571257 return ret;
12581258
1259+ dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
1260+
12591261 tunnel = netdev_priv(dev);
12601262
12611263 ip6gre_tnl_link_config(tunnel, 1);
@@ -1289,6 +1291,7 @@ static void ip6gre_tap_setup(struct net_device *dev) · 27 unmodified lines
12891291
12901292 dev->features |= NETIF_F_NETNS_LOCAL;
12911293 dev->priv_flags &= ~IFF_TX_SKB_SHARING;
1294+ dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
12921295 }
12931296
12941297 static bool ip6gre_netlink_encap_parms(struct nlattr *data[],
net/ipv6/ip6_output.c+3−8
@@ -1071,17 +1071,12 @@ struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6, · 1070 unmodified lines
10711071 const struct in6_addr *final_dst)
10721072 {
10731073 struct dst_entry *dst = sk_dst_check(sk, inet6_sk(sk)->dst_cookie);
1074− int err;
10751074
10761075 dst = ip6_sk_dst_check(sk, dst, fl6);
1076+ if (!dst)
1077+ dst = ip6_dst_lookup_flow(sk, fl6, final_dst);
10771078
1078− err = ip6_dst_lookup_tail(sock_net(sk), sk, &dst, fl6);
1079− if (err)
1080− return ERR_PTR(err);
1081− if (final_dst)
1082− fl6->daddr = *final_dst;
1083−
1084− return xfrm_lookup_route(sock_net(sk), dst, flowi6_to_flowi(fl6), sk, 0);
1079+ return dst;
10851080 }
10861081 EXPORT_SYMBOL_GPL(ip6_sk_dst_lookup_flow);
10871082
net/ipv6/netfilter/nf_dup_ipv6.c+1−0
@@ -33,6 +33,7 @@ static bool nf_dup_ipv6_route(struct net *net, struct sk_buff *skb, · 32 unmodified lines
3333 fl6.daddr = *gw;
3434 fl6.flowlabel = (__force __be32)(((iph->flow_lbl[0] & 0xF) << 16) |
3535 (iph->flow_lbl[1] << 8) | iph->flow_lbl[2]);
36+ fl6.flowi6_flags = FLOWI_FLAG_KNOWN_NH;
3637 dst = ip6_route_output(net, NULL, &fl6);
3738 if (dst->error) {
3839 dst_release(dst);
net/ipv6/tcp_ipv6.c+3−1
@@ -1721,7 +1721,9 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i) · 1720 unmodified lines
17211721 destp = ntohs(inet->inet_dport);
17221722 srcp = ntohs(inet->inet_sport);
17231723
1724− if (icsk->icsk_pending == ICSK_TIME_RETRANS) {
1724+ if (icsk->icsk_pending == ICSK_TIME_RETRANS ||
1725+ icsk->icsk_pending == ICSK_TIME_EARLY_RETRANS ||
1726+ icsk->icsk_pending == ICSK_TIME_LOSS_PROBE) {
17251727 timer_active = 1;
17261728 timer_expires = icsk->icsk_timeout;
17271729 } else if (icsk->icsk_pending == ICSK_TIME_PROBE0) {
net/ipv6/udp.c+6−6
@@ -653,12 +653,12 @@ int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) · 652 unmodified lines
653653 }
654654 }
655655
656− if (rcu_access_pointer(sk->sk_filter)) {
657− if (udp_lib_checksum_complete(skb))
658− goto csum_error;
659− if (sk_filter(sk, skb))
660− goto drop;
661− }
656+ if (rcu_access_pointer(sk->sk_filter) &&
657+ udp_lib_checksum_complete(skb))
658+ goto csum_error;
659+
660+ if (sk_filter(sk, skb))
661+ goto drop;
662662
663663 udp_csum_pull_header(skb);
664664 if (sk_rcvqueues_full(sk, sk->sk_rcvbuf)) {
net/l2tp/l2tp_core.c+1−1
@@ -1581,7 +1581,7 @@ int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32 · 1580 unmodified lines
15811581 /* Mark socket as an encapsulation socket. See net/ipv4/udp.c */
15821582 tunnel->encap = encap;
15831583 if (encap == L2TP_ENCAPTYPE_UDP) {
1584− struct udp_tunnel_sock_cfg udp_cfg;
1584+ struct udp_tunnel_sock_cfg udp_cfg = { };
15851585
15861586 udp_cfg.sk_user_data = tunnel;
15871587 udp_cfg.encap_type = UDP_ENCAP_L2TPINUDP;
net/mac80211/mesh.c+4−0
@@ -161,6 +161,10 @@ void mesh_sta_cleanup(struct sta_info *sta) · 160 unmodified lines
161161 del_timer_sync(&sta->mesh->plink_timer);
162162 }
163163
164+ /* make sure no readers can access nexthop sta from here on */
165+ mesh_path_flush_by_nexthop(sta);
166+ synchronize_net();
167+
164168 if (changed)
165169 ieee80211_mbss_info_change_notify(sdata, changed);
166170 }
net/mac80211/sta_info.h+1−1
@@ -280,7 +280,7 @@ struct ieee80211_fast_tx { · 279 unmodified lines
280280 u8 sa_offs, da_offs, pn_offs;
281281 u8 band;
282282 u8 hdr[30 + 2 + IEEE80211_FAST_XMIT_MAX_IV +
283− sizeof(rfc1042_header)];
283+ sizeof(rfc1042_header)] __aligned(2);
284284
285285 struct rcu_head rcu_head;
286286 };
net/netfilter/ipvs/ip_vs_conn.c+3−2
@@ -762,7 +762,7 @@ static int expire_quiescent_template(struct netns_ipvs *ipvs, · 761 unmodified lines
762762 * If available, return 1, otherwise invalidate this connection
763763 * template and return 0.
764764 */
765−int ip_vs_check_template(struct ip_vs_conn *ct)
765+int ip_vs_check_template(struct ip_vs_conn *ct, struct ip_vs_dest *cdest)
766766 {
767767 struct ip_vs_dest *dest = ct->dest;
768768 struct netns_ipvs *ipvs = ct->ipvs;
@@ -772,7 +772,8 @@ int ip_vs_check_template(struct ip_vs_conn *ct) · 3 unmodified lines
772772 */
773773 if ((dest == NULL) ||
774774 !(dest->flags & IP_VS_DEST_F_AVAILABLE) ||
775− expire_quiescent_template(ipvs, dest)) {
775+ expire_quiescent_template(ipvs, dest) ||
776+ (cdest && (dest != cdest))) {
776777 IP_VS_DBG_BUF(9, "check_template: dest not available for "
777778 "protocol %s s:%s:%d v:%s:%d "
778779 "-> d:%s:%d\n",
net/netfilter/ipvs/ip_vs_core.c+3−2
@@ -321,7 +321,7 @@ ip_vs_sched_persist(struct ip_vs_service *svc, · 320 unmodified lines
321321
322322 /* Check if a template already exists */
323323 ct = ip_vs_ct_in_get(&param);
324− if (!ct || !ip_vs_check_template(ct)) {
324+ if (!ct || !ip_vs_check_template(ct, NULL)) {
325325 struct ip_vs_scheduler *sched;
326326
327327 /*
@@ -1154,7 +1154,8 @@ struct ip_vs_conn *ip_vs_new_conn_out(struct ip_vs_service *svc, · 826 unmodified lines
11541154 vport, &param) < 0)
11551155 return NULL;
11561156 ct = ip_vs_ct_in_get(&param);
1157− if (!ct) {
1157+ /* check if template exists and points to the same dest */
1158+ if (!ct || !ip_vs_check_template(ct, dest)) {
11581159 ct = ip_vs_conn_new(&param, dest->af, daddr, dport,
11591160 IP_VS_CONN_F_TEMPLATE, dest, 0);
11601161 if (!ct) {
net/netfilter/nf_conntrack_ftp.c+1−0
@@ -632,6 +632,7 @@ static int __init nf_conntrack_ftp_init(void) · 631 unmodified lines
632632 if (ret) {
633633 pr_err("failed to register helper for pf: %d port: %d\n",
634634 ftp[i][j].tuple.src.l3num, ports[i]);
635+ ports_c = i;
635636 nf_conntrack_ftp_fini();
636637 return ret;
637638 }
net/netfilter/nf_conntrack_helper.c+4−5
@@ -361,9 +361,10 @@ EXPORT_SYMBOL_GPL(nf_ct_helper_log); · 360 unmodified lines
361361
362362 int nf_conntrack_helper_register(struct nf_conntrack_helper *me)
363363 {
364− int ret = 0;
365− struct nf_conntrack_helper *cur;
364+ struct nf_conntrack_tuple_mask mask = { .src.u.all = htons(0xFFFF) };
366365 unsigned int h = helper_hash(&me->tuple);
366+ struct nf_conntrack_helper *cur;
367+ int ret = 0;
367368
368369 BUG_ON(me->expect_policy == NULL);
369370 BUG_ON(me->expect_class_max >= NF_CT_MAX_EXPECT_CLASSES);
@@ -371,9 +372,7 @@ int nf_conntrack_helper_register(struct nf_conntrack_helper *me) · 1 unmodified line
371372
372373 mutex_lock(&nf_ct_helper_mutex);
373374 hlist_for_each_entry(cur, &nf_ct_helper_hash[h], hnode) {
374− if (strncmp(cur->name, me->name, NF_CT_HELPER_NAME_LEN) == 0 &&
375− cur->tuple.src.l3num == me->tuple.src.l3num &&
376− cur->tuple.dst.protonum == me->tuple.dst.protonum) {
375+ if (nf_ct_tuple_src_mask_cmp(&cur->tuple, &me->tuple, &mask)) {
377376 ret = -EEXIST;
378377 goto out;
379378 }
net/netfilter/nf_conntrack_irc.c+1−0
@@ -271,6 +271,7 @@ static int __init nf_conntrack_irc_init(void) · 270 unmodified lines
271271 if (ret) {
272272 pr_err("failed to register helper for pf: %u port: %u\n",
273273 irc[i].tuple.src.l3num, ports[i]);
274+ ports_c = i;
274275 nf_conntrack_irc_fini();
275276 return ret;
276277 }
net/netfilter/nf_conntrack_sane.c+1−0
@@ -223,6 +223,7 @@ static int __init nf_conntrack_sane_init(void) · 222 unmodified lines
223223 if (ret) {
224224 pr_err("failed to register helper for pf: %d port: %d\n",
225225 sane[i][j].tuple.src.l3num, ports[i]);
226+ ports_c = i;
226227 nf_conntrack_sane_fini();
227228 return ret;
228229 }
net/netfilter/nf_conntrack_sip.c+1−0
@@ -1669,6 +1669,7 @@ static int __init nf_conntrack_sip_init(void) · 1668 unmodified lines
16691669 if (ret) {
16701670 pr_err("failed to register helper for pf: %u port: %u\n",
16711671 sip[i][j].tuple.src.l3num, ports[i]);
1672+ ports_c = i;
16721673 nf_conntrack_sip_fini();
16731674 return ret;
16741675 }
net/netfilter/nf_conntrack_standalone.c+0−2
@@ -487,8 +487,6 @@ static struct ctl_table nf_ct_sysctl_table[] = { · 486 unmodified lines
487487 { }
488488 };
489489
490−#define NET_NF_CONNTRACK_MAX 2089
491−
492490 static struct ctl_table nf_ct_netfilter_table[] = {
493491 {
494492 .procname = "nf_conntrack_max",
net/netfilter/nf_conntrack_tftp.c+1−0
@@ -142,6 +142,7 @@ static int __init nf_conntrack_tftp_init(void) · 141 unmodified lines
142142 if (ret) {
143143 pr_err("failed to register helper for pf: %u port: %u\n",
144144 tftp[i][j].tuple.src.l3num, ports[i]);
145+ ports_c = i;
145146 nf_conntrack_tftp_fini();
146147 return ret;
147148 }
net/netfilter/nf_queue.c+8−9
@@ -26,23 +26,21 @@ · 25 unmodified lines
2626 * Once the queue is registered it must reinject all packets it
2727 * receives, no matter what.
2828 */
29−static const struct nf_queue_handler __rcu *queue_handler __read_mostly;
3029
3130 /* return EBUSY when somebody else is registered, return EEXIST if the
3231 * same handler is registered, return 0 in case of success. */
33−void nf_register_queue_handler(const struct nf_queue_handler *qh)
32+void nf_register_queue_handler(struct net *net, const struct nf_queue_handler *qh)
3433 {
3534 /* should never happen, we only have one queueing backend in kernel */
36− WARN_ON(rcu_access_pointer(queue_handler));
37− rcu_assign_pointer(queue_handler, qh);
35+ WARN_ON(rcu_access_pointer(net->nf.queue_handler));
36+ rcu_assign_pointer(net->nf.queue_handler, qh);
3837 }
3938 EXPORT_SYMBOL(nf_register_queue_handler);
4039
4140 /* The caller must flush their queue before this */
42−void nf_unregister_queue_handler(void)
41+void nf_unregister_queue_handler(struct net *net)
4342 {
44− RCU_INIT_POINTER(queue_handler, NULL);
45− synchronize_rcu();
43+ RCU_INIT_POINTER(net->nf.queue_handler, NULL);
4644 }
4745 EXPORT_SYMBOL(nf_unregister_queue_handler);
4846
@@ -103,7 +101,7 @@ void nf_queue_nf_hook_drop(struct net *net, struct nf_hook_ops *ops) · 54 unmodified lines
103101 const struct nf_queue_handler *qh;
104102
105103 rcu_read_lock();
106− qh = rcu_dereference(queue_handler);
104+ qh = rcu_dereference(net->nf.queue_handler);
107105 if (qh)
108106 qh->nf_hook_drop(net, ops);
109107 rcu_read_unlock();
@@ -122,9 +120,10 @@ int nf_queue(struct sk_buff *skb, · 12 unmodified lines
122120 struct nf_queue_entry *entry = NULL;
123121 const struct nf_afinfo *afinfo;
124122 const struct nf_queue_handler *qh;
123+ struct net *net = state->net;
125124
126125 /* QUEUE == DROP if no one is waiting, to be safe. */
127− qh = rcu_dereference(queue_handler);
126+ qh = rcu_dereference(net->nf.queue_handler);
128127 if (!qh) {
129128 status = -ESRCH;
130129 goto err;
net/netfilter/nf_tables_api.c+2−0
@@ -2647,6 +2647,8 @@ static int nf_tables_getset(struct net *net, struct sock *nlsk, · 2646 unmodified lines
26472647 /* Only accept unspec with dump */
26482648 if (nfmsg->nfgen_family == NFPROTO_UNSPEC)
26492649 return -EAFNOSUPPORT;
2650+ if (!nla[NFTA_SET_TABLE])
2651+ return -EINVAL;
26502652
26512653 set = nf_tables_set_lookup(ctx.table, nla[NFTA_SET_NAME]);
26522654 if (IS_ERR(set))
net/netfilter/nfnetlink_queue.c+13−7
@@ -557,7 +557,7 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue, · 556 unmodified lines
557557
558558 if (entskb->tstamp.tv64) {
559559 struct nfqnl_msg_packet_timestamp ts;
560− struct timespec64 kts = ktime_to_timespec64(skb->tstamp);
560+ struct timespec64 kts = ktime_to_timespec64(entskb->tstamp);
561561
562562 ts.sec = cpu_to_be64(kts.tv_sec);
563563 ts.usec = cpu_to_be64(kts.tv_nsec / NSEC_PER_USEC);
@@ -1482,21 +1482,29 @@ static int __net_init nfnl_queue_net_init(struct net *net) · 918 unmodified lines
14821482 net->nf.proc_netfilter, &nfqnl_file_ops))
14831483 return -ENOMEM;
14841484 #endif
1485+ nf_register_queue_handler(net, &nfqh);
14851486 return 0;
14861487 }
14871488
14881489 static void __net_exit nfnl_queue_net_exit(struct net *net)
14891490 {
1491+ nf_unregister_queue_handler(net);
14901492 #ifdef CONFIG_PROC_FS
14911493 remove_proc_entry("nfnetlink_queue", net->nf.proc_netfilter);
14921494 #endif
14931495 }
14941496
1497+static void nfnl_queue_net_exit_batch(struct list_head *net_exit_list)
1498+{
1499+ synchronize_rcu();
1500+}
1501+
14951502 static struct pernet_operations nfnl_queue_net_ops = {
1496− .init = nfnl_queue_net_init,
1497− .exit = nfnl_queue_net_exit,
1498− .id = &nfnl_queue_net_id,
1499− .size = sizeof(struct nfnl_queue_net),
1503+ .init = nfnl_queue_net_init,
1504+ .exit = nfnl_queue_net_exit,
1505+ .exit_batch = nfnl_queue_net_exit_batch,
1506+ .id = &nfnl_queue_net_id,
1507+ .size = sizeof(struct nfnl_queue_net),
15001508 };
15011509
15021510 static int __init nfnetlink_queue_init(void)
@@ -1517,7 +1525,6 @@ static int __init nfnetlink_queue_init(void) · 14 unmodified lines
15171525 }
15181526
15191527 register_netdevice_notifier(&nfqnl_dev_notifier);
1520− nf_register_queue_handler(&nfqh);
15211528 return status;
15221529
15231530 cleanup_netlink_notifier:
@@ -1529,7 +1536,6 @@ out: · 5 unmodified lines
15291536
15301537 static void __exit nfnetlink_queue_fini(void)
15311538 {
1532− nf_unregister_queue_handler();
15331539 unregister_netdevice_notifier(&nfqnl_dev_notifier);
15341540 nfnetlink_subsys_unregister(&nfqnl_subsys);
15351541 netlink_unregister_notifier(&nfqnl_rtnl_notifier);
net/netfilter/x_tables.c+2−2
@@ -612,7 +612,7 @@ int xt_compat_check_entry_offsets(const void *base, const char *elems, · 611 unmodified lines
612612 return -EINVAL;
613613
614614 if (strcmp(t->u.user.name, XT_STANDARD_TARGET) == 0 &&
615− target_offset + sizeof(struct compat_xt_standard_target) != next_offset)
615+ COMPAT_XT_ALIGN(target_offset + sizeof(struct compat_xt_standard_target)) != next_offset)
616616 return -EINVAL;
617617
618618 /* compat_xt_entry match has less strict aligment requirements,
@@ -694,7 +694,7 @@ int xt_check_entry_offsets(const void *base, · 75 unmodified lines
694694 return -EINVAL;
695695
696696 if (strcmp(t->u.user.name, XT_STANDARD_TARGET) == 0 &&
697− target_offset + sizeof(struct xt_standard_target) != next_offset)
697+ XT_ALIGN(target_offset + sizeof(struct xt_standard_target)) != next_offset)
698698 return -EINVAL;
699699
700700 return xt_check_entry_match(elems, base + target_offset,
net/packet/af_packet.c+25−0
@@ -93,6 +93,7 @@ · 92 unmodified lines
9393 #include <net/inet_common.h>
9494 #endif
9595 #include <linux/bpf.h>
96+#include <net/compat.h>
9697
9798 #include "internal.h"
9899
@@ -3940,6 +3941,27 @@ static int packet_getsockopt(struct socket *sock, int level, int optname, · 3841 unmodified lines
39403941 }
39413942
39423943
3944+#ifdef CONFIG_COMPAT
3945+static int compat_packet_setsockopt(struct socket *sock, int level, int optname,
3946+ char __user *optval, unsigned int optlen)
3947+{
3948+ struct packet_sock *po = pkt_sk(sock->sk);
3949+
3950+ if (level != SOL_PACKET)
3951+ return -ENOPROTOOPT;
3952+
3953+ if (optname == PACKET_FANOUT_DATA &&
3954+ po->fanout && po->fanout->type == PACKET_FANOUT_CBPF) {
3955+ optval = (char __user *)get_compat_bpf_fprog(optval);
3956+ if (!optval)
3957+ return -EFAULT;
3958+ optlen = sizeof(struct sock_fprog);
3959+ }
3960+
3961+ return packet_setsockopt(sock, level, optname, optval, optlen);
3962+}
3963+#endif
3964+
39433965 static int packet_notifier(struct notifier_block *this,
39443966 unsigned long msg, void *ptr)
39453967 {
@@ -4416,6 +4438,9 @@ static const struct proto_ops packet_ops = { · 470 unmodified lines
44164438 .shutdown = sock_no_shutdown,
44174439 .setsockopt = packet_setsockopt,
44184440 .getsockopt = packet_getsockopt,
4441+#ifdef CONFIG_COMPAT
4442+ .compat_setsockopt = compat_packet_setsockopt,
4443+#endif
44194444 .sendmsg = packet_sendmsg,
44204445 .recvmsg = packet_recvmsg,
44214446 .mmap = packet_mmap,
net/rds/rds.h+2−0
@@ -74,6 +74,7 @@ enum { · 73 unmodified lines
7474 RDS_CONN_CONNECTING,
7575 RDS_CONN_DISCONNECTING,
7676 RDS_CONN_UP,
77+ RDS_CONN_RESETTING,
7778 RDS_CONN_ERROR,
7879 };
7980
@@ -813,6 +814,7 @@ void rds_connect_worker(struct work_struct *); · 733 unmodified lines
813814 void rds_shutdown_worker(struct work_struct *);
814815 void rds_send_worker(struct work_struct *);
815816 void rds_recv_worker(struct work_struct *);
817+void rds_connect_path_complete(struct rds_connection *conn, int curr);
816818 void rds_connect_complete(struct rds_connection *conn);
817819
818820 /* transport.c */
net/rds/recv.c+2−0
@@ -561,5 +561,7 @@ void rds_inc_info_copy(struct rds_incoming *inc, · 560 unmodified lines
561561 minfo.fport = inc->i_hdr.h_dport;
562562 }
563563
564+ minfo.flags = 0;
565+
564566 rds_info_copy(iter, &minfo, sizeof(minfo));
565567 }
net/rds/send.c+1−0
@@ -99,6 +99,7 @@ void rds_send_reset(struct rds_connection *conn) · 98 unmodified lines
9999 list_splice_init(&conn->c_retrans, &conn->c_send_queue);
100100 spin_unlock_irqrestore(&conn->c_lock, flags);
101101 }
102+EXPORT_SYMBOL_GPL(rds_send_reset);
102103
103104 static int acquire_in_xmit(struct rds_connection *conn)
104105 {
net/rds/tcp.c+75−3
@@ -126,9 +126,81 @@ void rds_tcp_restore_callbacks(struct socket *sock, · 125 unmodified lines
126126 }
127127
128128 /*
129− * This is the only path that sets tc->t_sock. Send and receive trust that
130− * it is set. The RDS_CONN_UP bit protects those paths from being
131− * called while it isn't set.
129+ * rds_tcp_reset_callbacks() switches the to the new sock and
130+ * returns the existing tc->t_sock.
131+ *
132+ * The only functions that set tc->t_sock are rds_tcp_set_callbacks
133+ * and rds_tcp_reset_callbacks. Send and receive trust that
134+ * it is set. The absence of RDS_CONN_UP bit protects those paths
135+ * from being called while it isn't set.
136+ */
137+void rds_tcp_reset_callbacks(struct socket *sock,
138+ struct rds_connection *conn)
139+{
140+ struct rds_tcp_connection *tc = conn->c_transport_data;
141+ struct socket *osock = tc->t_sock;
142+
143+ if (!osock)
144+ goto newsock;
145+
146+ /* Need to resolve a duelling SYN between peers.
147+ * We have an outstanding SYN to this peer, which may
148+ * potentially have transitioned to the RDS_CONN_UP state,
149+ * so we must quiesce any send threads before resetting
150+ * c_transport_data. We quiesce these threads by setting
151+ * c_state to something other than RDS_CONN_UP, and then
152+ * waiting for any existing threads in rds_send_xmit to
153+ * complete release_in_xmit(). (Subsequent threads entering
154+ * rds_send_xmit() will bail on !rds_conn_up().
155+ *
156+ * However an incoming syn-ack at this point would end up
157+ * marking the conn as RDS_CONN_UP, and would again permit
158+ * rds_send_xmi() threads through, so ideally we would
159+ * synchronize on RDS_CONN_UP after lock_sock(), but cannot
160+ * do that: waiting on !RDS_IN_XMIT after lock_sock() may
161+ * end up deadlocking with tcp_sendmsg(), and the RDS_IN_XMIT
162+ * would not get set. As a result, we set c_state to
163+ * RDS_CONN_RESETTTING, to ensure that rds_tcp_state_change
164+ * cannot mark rds_conn_path_up() in the window before lock_sock()
165+ */
166+ atomic_set(&conn->c_state, RDS_CONN_RESETTING);
167+ wait_event(conn->c_waitq, !test_bit(RDS_IN_XMIT, &conn->c_flags));
168+ lock_sock(osock->sk);
169+ /* reset receive side state for rds_tcp_data_recv() for osock */
170+ if (tc->t_tinc) {
171+ rds_inc_put(&tc->t_tinc->ti_inc);
172+ tc->t_tinc = NULL;
173+ }
174+ tc->t_tinc_hdr_rem = sizeof(struct rds_header);
175+ tc->t_tinc_data_rem = 0;
176+ tc->t_sock = NULL;
177+
178+ write_lock_bh(&osock->sk->sk_callback_lock);
179+
180+ osock->sk->sk_user_data = NULL;
181+ osock->sk->sk_data_ready = tc->t_orig_data_ready;
182+ osock->sk->sk_write_space = tc->t_orig_write_space;
183+ osock->sk->sk_state_change = tc->t_orig_state_change;
184+ write_unlock_bh(&osock->sk->sk_callback_lock);
185+ release_sock(osock->sk);
186+ sock_release(osock);
187+newsock:
188+ rds_send_reset(conn);
189+ lock_sock(sock->sk);
190+ write_lock_bh(&sock->sk->sk_callback_lock);
191+ tc->t_sock = sock;
192+ sock->sk->sk_user_data = conn;
193+ sock->sk->sk_data_ready = rds_tcp_data_ready;
194+ sock->sk->sk_write_space = rds_tcp_write_space;
195+ sock->sk->sk_state_change = rds_tcp_state_change;
196+
197+ write_unlock_bh(&sock->sk->sk_callback_lock);
198+ release_sock(sock->sk);
199+}
200+
201+/* Add tc to rds_tcp_tc_list and set tc->t_sock. See comments
202+ * above rds_tcp_reset_callbacks for notes about synchronization
203+ * with data path
132204 */
133205 void rds_tcp_set_callbacks(struct socket *sock, struct rds_connection *conn)
134206 {
net/rds/tcp.h+1−0
@@ -50,6 +50,7 @@ struct rds_tcp_statistics { · 49 unmodified lines
5050 void rds_tcp_tune(struct socket *sock);
5151 void rds_tcp_nonagle(struct socket *sock);
5252 void rds_tcp_set_callbacks(struct socket *sock, struct rds_connection *conn);
53+void rds_tcp_reset_callbacks(struct socket *sock, struct rds_connection *conn);
5354 void rds_tcp_restore_callbacks(struct socket *sock,
5455 struct rds_tcp_connection *tc);
5556 u32 rds_tcp_snd_nxt(struct rds_tcp_connection *tc);
net/rds/tcp_connect.c+1−1
@@ -60,7 +60,7 @@ void rds_tcp_state_change(struct sock *sk) · 59 unmodified lines
6060 case TCP_SYN_RECV:
6161 break;
6262 case TCP_ESTABLISHED:
63− rds_connect_complete(conn);
63+ rds_connect_path_complete(conn, RDS_CONN_CONNECTING);
6464 break;
6565 case TCP_CLOSE_WAIT:
6666 case TCP_CLOSE:
net/rds/tcp_listen.c+7−13
@@ -78,7 +78,6 @@ int rds_tcp_accept_one(struct socket *sock) · 77 unmodified lines
7878 struct inet_sock *inet;
7979 struct rds_tcp_connection *rs_tcp = NULL;
8080 int conn_state;
81− struct sock *nsk;
8281
8382 if (!sock) /* module unload or netns delete in progress */
8483 return -ENETUNREACH;
@@ -136,26 +135,21 @@ int rds_tcp_accept_one(struct socket *sock) · 51 unmodified lines
136135 !conn->c_outgoing) {
137136 goto rst_nsk;
138137 } else {
139− atomic_set(&conn->c_state, RDS_CONN_CONNECTING);
140− wait_event(conn->c_waitq,
141− !test_bit(RDS_IN_XMIT, &conn->c_flags));
142− rds_tcp_restore_callbacks(rs_tcp->t_sock, rs_tcp);
138+ rds_tcp_reset_callbacks(new_sock, conn);
143139 conn->c_outgoing = 0;
140+ /* rds_connect_path_complete() marks RDS_CONN_UP */
141+ rds_connect_path_complete(conn, RDS_CONN_DISCONNECTING);
144142 }
143+ } else {
144+ rds_tcp_set_callbacks(new_sock, conn);
145+ rds_connect_path_complete(conn, RDS_CONN_CONNECTING);
145146 }
146− rds_tcp_set_callbacks(new_sock, conn);
147− rds_connect_complete(conn); /* marks RDS_CONN_UP */
148147 new_sock = NULL;
149148 ret = 0;
150149 goto out;
151150 rst_nsk:
152151 /* reset the newly returned accept sock and bail */
153− nsk = new_sock->sk;
154− rds_tcp_stats_inc(s_tcp_listen_closed_stale);
155− nsk->sk_user_data = NULL;
156− nsk->sk_prot->disconnect(nsk, 0);
157− tcp_done(nsk);
158− new_sock = NULL;
152+ kernel_sock_shutdown(new_sock, SHUT_RDWR);
159153 ret = 0;
160154 out:
161155 if (rs_tcp)
net/rds/threads.c+8−2
@@ -71,9 +71,9 @@ · 70 unmodified lines
7171 struct workqueue_struct *rds_wq;
7272 EXPORT_SYMBOL_GPL(rds_wq);
7373
74−void rds_connect_complete(struct rds_connection *conn)
74+void rds_connect_path_complete(struct rds_connection *conn, int curr)
7575 {
76− if (!rds_conn_transition(conn, RDS_CONN_CONNECTING, RDS_CONN_UP)) {
76+ if (!rds_conn_transition(conn, curr, RDS_CONN_UP)) {
7777 printk(KERN_WARNING "%s: Cannot transition to state UP, "
7878 "current state is %d\n",
7979 __func__,
@@ -90,6 +90,12 @@ void rds_connect_complete(struct rds_connection *conn) · 10 unmodified lines
9090 queue_delayed_work(rds_wq, &conn->c_send_w, 0);
9191 queue_delayed_work(rds_wq, &conn->c_recv_w, 0);
9292 }
93+EXPORT_SYMBOL_GPL(rds_connect_path_complete);
94+
95+void rds_connect_complete(struct rds_connection *conn)
96+{
97+ rds_connect_path_complete(conn, RDS_CONN_CONNECTING);
98+}
9399 EXPORT_SYMBOL_GPL(rds_connect_complete);
94100
95101 /*
net/rxrpc/rxkad.c+1−3
@@ -1162,9 +1162,7 @@ static int rxkad_init(void) · 1161 unmodified lines
11621162 /* pin the cipher we need so that the crypto layer doesn't invoke
11631163 * keventd to go get it */
11641164 rxkad_ci = crypto_alloc_skcipher("pcbc(fcrypt)", 0, CRYPTO_ALG_ASYNC);
1165− if (IS_ERR(rxkad_ci))
1166− return PTR_ERR(rxkad_ci);
1167− return 0;
1165+ return PTR_ERR_OR_ZERO(rxkad_ci);
11681166 }
11691167
11701168 /*
net/sched/act_police.c+11−22
@@ -38,7 +38,7 @@ struct tcf_police { · 37 unmodified lines
3838 bool peak_present;
3939 };
4040 #define to_police(pc) \
41− container_of(pc, struct tcf_police, common)
41+ container_of(pc->priv, struct tcf_police, common)
4242
4343 #define POL_TAB_MASK 15
4444
@@ -119,14 +119,12 @@ static int tcf_act_police_locate(struct net *net, struct nlattr *nla, · 74 unmodified lines
119119 struct nlattr *est, struct tc_action *a,
120120 int ovr, int bind)
121121 {
122− unsigned int h;
123122 int ret = 0, err;
124123 struct nlattr *tb[TCA_POLICE_MAX + 1];
125124 struct tc_police *parm;
126125 struct tcf_police *police;
127126 struct qdisc_rate_table *R_tab = NULL, *P_tab = NULL;
128127 struct tc_action_net *tn = net_generic(net, police_net_id);
129− struct tcf_hashinfo *hinfo = tn->hinfo;
130128 int size;
131129
132130 if (nla == NULL)
@@ -145,7 +143,7 @@ static int tcf_act_police_locate(struct net *net, struct nlattr *nla, · 12 unmodified lines
145143
146144 if (parm->index) {
147145 if (tcf_hash_search(tn, a, parm->index)) {
148− police = to_police(a->priv);
146+ police = to_police(a);
149147 if (bind) {
150148 police->tcf_bindcnt += 1;
151149 police->tcf_refcnt += 1;
@@ -156,16 +154,15 @@ static int tcf_act_police_locate(struct net *net, struct nlattr *nla, · 4 unmodified lines
156154 /* not replacing */
157155 return -EEXIST;
158156 }
157+ } else {
158+ ret = tcf_hash_create(tn, parm->index, NULL, a,
159+ sizeof(*police), bind, false);
160+ if (ret)
161+ return ret;
162+ ret = ACT_P_CREATED;
159163 }
160164
161− police = kzalloc(sizeof(*police), GFP_KERNEL);
162− if (police == NULL)
163− return -ENOMEM;
164− ret = ACT_P_CREATED;
165− police->tcf_refcnt = 1;
166− spin_lock_init(&police->tcf_lock);
167− if (bind)
168− police->tcf_bindcnt = 1;
165+ police = to_police(a);
169166 override:
170167 if (parm->rate.rate) {
171168 err = -ENOMEM;
@@ -237,16 +234,8 @@ override: · 65 unmodified lines
237234 return ret;
238235
239236 police->tcfp_t_c = ktime_get_ns();
240− police->tcf_index = parm->index ? parm->index :
241− tcf_hash_new_index(tn);
242− police->tcf_tm.install = jiffies;
243− police->tcf_tm.lastuse = jiffies;
244− h = tcf_hash(police->tcf_index, POL_TAB_MASK);
245− spin_lock_bh(&hinfo->lock);
246− hlist_add_head(&police->tcf_head, &hinfo->htab[h]);
247− spin_unlock_bh(&hinfo->lock);
237+ tcf_hash_insert(tn, a);
248238
249− a->priv = police;
250239 return ret;
251240
252241 failure_unlock:
@@ -255,7 +244,7 @@ failure: · 2 unmodified lines
255244 qdisc_put_rtab(P_tab);
256245 qdisc_put_rtab(R_tab);
257246 if (ret == ACT_P_CREATED)
258− kfree(police);
247+ tcf_hash_cleanup(a, est);
259248 return err;
260249 }
261250
net/sched/cls_flower.c+3−3
@@ -171,7 +171,7 @@ static void fl_hw_destroy_filter(struct tcf_proto *tp, unsigned long cookie) · 170 unmodified lines
171171 struct tc_cls_flower_offload offload = {0};
172172 struct tc_to_netdev tc;
173173
174− if (!tc_should_offload(dev, 0))
174+ if (!tc_should_offload(dev, tp, 0))
175175 return;
176176
177177 offload.command = TC_CLSFLOWER_DESTROY;
@@ -194,7 +194,7 @@ static void fl_hw_replace_filter(struct tcf_proto *tp, · 16 unmodified lines
194194 struct tc_cls_flower_offload offload = {0};
195195 struct tc_to_netdev tc;
196196
197− if (!tc_should_offload(dev, flags))
197+ if (!tc_should_offload(dev, tp, flags))
198198 return;
199199
200200 offload.command = TC_CLSFLOWER_REPLACE;
@@ -216,7 +216,7 @@ static void fl_hw_update_stats(struct tcf_proto *tp, struct cls_fl_filter *f) · 15 unmodified lines
216216 struct tc_cls_flower_offload offload = {0};
217217 struct tc_to_netdev tc;
218218
219− if (!tc_should_offload(dev, 0))
219+ if (!tc_should_offload(dev, tp, 0))
220220 return;
221221
222222 offload.command = TC_CLSFLOWER_STATS;
net/sched/cls_u32.c+40−32
@@ -440,7 +440,7 @@ static void u32_remove_hw_knode(struct tcf_proto *tp, u32 handle) · 439 unmodified lines
440440 offload.type = TC_SETUP_CLSU32;
441441 offload.cls_u32 = &u32_offload;
442442
443− if (tc_should_offload(dev, 0)) {
443+ if (tc_should_offload(dev, tp, 0)) {
444444 offload.cls_u32->command = TC_CLSU32_DELETE_KNODE;
445445 offload.cls_u32->knode.handle = handle;
446446 dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle,
@@ -457,20 +457,21 @@ static int u32_replace_hw_hnode(struct tcf_proto *tp, · 10 unmodified lines
457457 struct tc_to_netdev offload;
458458 int err;
459459
460+ if (!tc_should_offload(dev, tp, flags))
461+ return tc_skip_sw(flags) ? -EINVAL : 0;
462+
460463 offload.type = TC_SETUP_CLSU32;
461464 offload.cls_u32 = &u32_offload;
462465
463− if (tc_should_offload(dev, flags)) {
464− offload.cls_u32->command = TC_CLSU32_NEW_HNODE;
465− offload.cls_u32->hnode.divisor = h->divisor;
466− offload.cls_u32->hnode.handle = h->handle;
467− offload.cls_u32->hnode.prio = h->prio;
466+ offload.cls_u32->command = TC_CLSU32_NEW_HNODE;
467+ offload.cls_u32->hnode.divisor = h->divisor;
468+ offload.cls_u32->hnode.handle = h->handle;
469+ offload.cls_u32->hnode.prio = h->prio;
468470
469− err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle,
470− tp->protocol, &offload);
471− if (tc_skip_sw(flags))
472− return err;
473− }
471+ err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle,
472+ tp->protocol, &offload);
473+ if (tc_skip_sw(flags))
474+ return err;
474475
475476 return 0;
476477 }
@@ -484,7 +485,7 @@ static void u32_clear_hw_hnode(struct tcf_proto *tp, struct tc_u_hnode *h) · 7 unmodified lines
484485 offload.type = TC_SETUP_CLSU32;
485486 offload.cls_u32 = &u32_offload;
486487
487− if (tc_should_offload(dev, 0)) {
488+ if (tc_should_offload(dev, tp, 0)) {
488489 offload.cls_u32->command = TC_CLSU32_DELETE_HNODE;
489490 offload.cls_u32->hnode.divisor = h->divisor;
490491 offload.cls_u32->hnode.handle = h->handle;
@@ -507,27 +508,28 @@ static int u32_replace_hw_knode(struct tcf_proto *tp, · 16 unmodified lines
507508 offload.type = TC_SETUP_CLSU32;
508509 offload.cls_u32 = &u32_offload;
509510
510− if (tc_should_offload(dev, flags)) {
511− offload.cls_u32->command = TC_CLSU32_REPLACE_KNODE;
512− offload.cls_u32->knode.handle = n->handle;
513− offload.cls_u32->knode.fshift = n->fshift;
511+ if (!tc_should_offload(dev, tp, flags))
512+ return tc_skip_sw(flags) ? -EINVAL : 0;
513+
514+ offload.cls_u32->command = TC_CLSU32_REPLACE_KNODE;
515+ offload.cls_u32->knode.handle = n->handle;
516+ offload.cls_u32->knode.fshift = n->fshift;
514517 #ifdef CONFIG_CLS_U32_MARK
515− offload.cls_u32->knode.val = n->val;
516− offload.cls_u32->knode.mask = n->mask;
518+ offload.cls_u32->knode.val = n->val;
519+ offload.cls_u32->knode.mask = n->mask;
517520 #else
518− offload.cls_u32->knode.val = 0;
519− offload.cls_u32->knode.mask = 0;
521+ offload.cls_u32->knode.val = 0;
522+ offload.cls_u32->knode.mask = 0;
520523 #endif
521− offload.cls_u32->knode.sel = &n->sel;
522− offload.cls_u32->knode.exts = &n->exts;
523− if (n->ht_down)
524− offload.cls_u32->knode.link_handle = n->ht_down->handle;
525−
526− err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle,
527− tp->protocol, &offload);
528− if (tc_skip_sw(flags))
529− return err;
530− }
524+ offload.cls_u32->knode.sel = &n->sel;
525+ offload.cls_u32->knode.exts = &n->exts;
526+ if (n->ht_down)
527+ offload.cls_u32->knode.link_handle = n->ht_down->handle;
528+
529+ err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle,
530+ tp->protocol, &offload);
531+ if (tc_skip_sw(flags))
532+ return err;
531533
532534 return 0;
533535 }
@@ -863,7 +865,7 @@ static int u32_change(struct net *net, struct sk_buff *in_skb, · 329 unmodified lines
863865 if (tb[TCA_U32_FLAGS]) {
864866 flags = nla_get_u32(tb[TCA_U32_FLAGS]);
865867 if (!tc_flags_valid(flags))
866− return err;
868+ return -EINVAL;
867869 }
868870
869871 n = (struct tc_u_knode *)*arg;
@@ -921,11 +923,17 @@ static int u32_change(struct net *net, struct sk_buff *in_skb, · 51 unmodified lines
921923 ht->divisor = divisor;
922924 ht->handle = handle;
923925 ht->prio = tp->prio;
926+
927+ err = u32_replace_hw_hnode(tp, ht, flags);
928+ if (err) {
929+ kfree(ht);
930+ return err;
931+ }
932+
924933 RCU_INIT_POINTER(ht->next, tp_c->hlist);
925934 rcu_assign_pointer(tp_c->hlist, ht);
926935 *arg = (unsigned long)ht;
927936
928− u32_replace_hw_hnode(tp, ht, flags);
929937 return 0;
930938 }
931939
net/sched/sch_drr.c+4−0
@@ -375,6 +375,7 @@ static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch) · 374 unmodified lines
375375 cl->deficit = cl->quantum;
376376 }
377377
378+ qdisc_qstats_backlog_inc(sch, skb);
378379 sch->q.qlen++;
379380 return err;
380381 }
@@ -407,6 +408,7 @@ static struct sk_buff *drr_dequeue(struct Qdisc *sch) · 26 unmodified lines
407408
408409 bstats_update(&cl->bstats, skb);
409410 qdisc_bstats_update(sch, skb);
411+ qdisc_qstats_backlog_dec(sch, skb);
410412 sch->q.qlen--;
411413 return skb;
412414 }
@@ -428,6 +430,7 @@ static unsigned int drr_drop(struct Qdisc *sch) · 15 unmodified lines
428430 if (cl->qdisc->ops->drop) {
429431 len = cl->qdisc->ops->drop(cl->qdisc);
430432 if (len > 0) {
433+ sch->qstats.backlog -= len;
431434 sch->q.qlen--;
432435 if (cl->qdisc->q.qlen == 0)
433436 list_del(&cl->alist);
@@ -463,6 +466,7 @@ static void drr_reset_qdisc(struct Qdisc *sch) · 29 unmodified lines
463466 qdisc_reset(cl->qdisc);
464467 }
465468 }
469+ sch->qstats.backlog = 0;
466470 sch->q.qlen = 0;
467471 }
468472
net/sched/sch_fq_codel.c+19−7
@@ -199,6 +199,7 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch) · 198 unmodified lines
199199 unsigned int idx, prev_backlog, prev_qlen;
200200 struct fq_codel_flow *flow;
201201 int uninitialized_var(ret);
202+ unsigned int pkt_len;
202203 bool memory_limited;
203204
204205 idx = fq_codel_classify(skb, sch, &ret);
@@ -230,6 +231,8 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch) · 25 unmodified lines
230231 prev_backlog = sch->qstats.backlog;
231232 prev_qlen = sch->q.qlen;
232233
234+ /* save this packet length as it might be dropped by fq_codel_drop() */
235+ pkt_len = qdisc_pkt_len(skb);
233236 /* fq_codel_drop() is quite expensive, as it performs a linear search
234237 * in q->backlogs[] to find a fat flow.
235238 * So instead of dropping a single packet, drop half of its backlog
@@ -237,14 +240,23 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch) · 1 unmodified line
237240 */
238241 ret = fq_codel_drop(sch, q->drop_batch_size);
239242
240− q->drop_overlimit += prev_qlen - sch->q.qlen;
243+ prev_qlen -= sch->q.qlen;
244+ prev_backlog -= sch->qstats.backlog;
245+ q->drop_overlimit += prev_qlen;
241246 if (memory_limited)
242− q->drop_overmemory += prev_qlen - sch->q.qlen;
243− /* As we dropped packet(s), better let upper stack know this */
244− qdisc_tree_reduce_backlog(sch, prev_qlen - sch->q.qlen,
245− prev_backlog - sch->qstats.backlog);
247+ q->drop_overmemory += prev_qlen;
246248
247− return ret == idx ? NET_XMIT_CN : NET_XMIT_SUCCESS;
249+ /* As we dropped packet(s), better let upper stack know this.
250+ * If we dropped a packet for this flow, return NET_XMIT_CN,
251+ * but in this case, our parents wont increase their backlogs.
252+ */
253+ if (ret == idx) {
254+ qdisc_tree_reduce_backlog(sch, prev_qlen - 1,
255+ prev_backlog - pkt_len);
256+ return NET_XMIT_CN;
257+ }
258+ qdisc_tree_reduce_backlog(sch, prev_qlen, prev_backlog);
259+ return NET_XMIT_SUCCESS;
248260 }
249261
250262 /* This is the specific function called from codel_dequeue()
@@ -649,7 +661,7 @@ static int fq_codel_dump_class_stats(struct Qdisc *sch, unsigned long cl, · 398 unmodified lines
649661 qs.backlog = q->backlogs[idx];
650662 qs.drops = flow->dropped;
651663 }
652− if (gnet_stats_copy_queue(d, NULL, &qs, 0) < 0)
664+ if (gnet_stats_copy_queue(d, NULL, &qs, qs.qlen) < 0)
653665 return -1;
654666 if (idx < q->flows_cnt)
655667 return gnet_stats_copy_app(d, &xstats, sizeof(xstats));
net/sched/sch_generic.c+2−0
@@ -49,6 +49,7 @@ static inline int dev_requeue_skb(struct sk_buff *skb, struct Qdisc *q) · 48 unmodified lines
4949 {
5050 q->gso_skb = skb;
5151 q->qstats.requeues++;
52+ qdisc_qstats_backlog_inc(q, skb);
5253 q->q.qlen++; /* it's still part of the queue */
5354 __netif_schedule(q);
5455
@@ -92,6 +93,7 @@ static struct sk_buff *dequeue_skb(struct Qdisc *q, bool *validate, · 37 unmodified lines
9293 txq = skb_get_tx_queue(txq->dev, skb);
9394 if (!netif_xmit_frozen_or_stopped(txq)) {
9495 q->gso_skb = NULL;
96+ qdisc_qstats_backlog_dec(q, skb);
9597 q->q.qlen--;
9698 } else
9799 skb = NULL;
net/sched/sch_hfsc.c+4−8
@@ -1529,6 +1529,7 @@ hfsc_reset_qdisc(struct Qdisc *sch) · 1528 unmodified lines
15291529 q->eligible = RB_ROOT;
15301530 INIT_LIST_HEAD(&q->droplist);
15311531 qdisc_watchdog_cancel(&q->watchdog);
1532+ sch->qstats.backlog = 0;
15321533 sch->q.qlen = 0;
15331534 }
15341535
@@ -1559,14 +1560,6 @@ hfsc_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb) · 24 unmodified lines
15591560 struct hfsc_sched *q = qdisc_priv(sch);
15601561 unsigned char *b = skb_tail_pointer(skb);
15611562 struct tc_hfsc_qopt qopt;
1562− struct hfsc_class *cl;
1563− unsigned int i;
1564−
1565− sch->qstats.backlog = 0;
1566− for (i = 0; i < q->clhash.hashsize; i++) {
1567− hlist_for_each_entry(cl, &q->clhash.hash[i], cl_common.hnode)
1568− sch->qstats.backlog += cl->qdisc->qstats.backlog;
1569− }
15701563
15711564 qopt.defcls = q->defcls;
15721565 if (nla_put(skb, TCA_OPTIONS, sizeof(qopt), &qopt))
@@ -1604,6 +1597,7 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch) · 31 unmodified lines
16041597 if (cl->qdisc->q.qlen == 1)
16051598 set_active(cl, qdisc_pkt_len(skb));
16061599
1600+ qdisc_qstats_backlog_inc(sch, skb);
16071601 sch->q.qlen++;
16081602
16091603 return NET_XMIT_SUCCESS;
@@ -1672,6 +1666,7 @@ hfsc_dequeue(struct Qdisc *sch) · 62 unmodified lines
16721666
16731667 qdisc_unthrottled(sch);
16741668 qdisc_bstats_update(sch, skb);
1669+ qdisc_qstats_backlog_dec(sch, skb);
16751670 sch->q.qlen--;
16761671
16771672 return skb;
@@ -1695,6 +1690,7 @@ hfsc_drop(struct Qdisc *sch) · 17 unmodified lines
16951690 }
16961691 cl->qstats.drops++;
16971692 qdisc_qstats_drop(sch);
1693+ sch->qstats.backlog -= len;
16981694 sch->q.qlen--;
16991695 return len;
17001696 }
net/sched/sch_ingress.c+12−0
@@ -27,6 +27,11 @@ static unsigned long ingress_get(struct Qdisc *sch, u32 classid) · 26 unmodified lines
2727 return TC_H_MIN(classid) + 1;
2828 }
2929
30+static bool ingress_cl_offload(u32 classid)
31+{
32+ return true;
33+}
34+
3035 static unsigned long ingress_bind_filter(struct Qdisc *sch,
3136 unsigned long parent, u32 classid)
3237 {
@@ -86,6 +91,7 @@ static const struct Qdisc_class_ops ingress_class_ops = { · 53 unmodified lines
8691 .put = ingress_put,
8792 .walk = ingress_walk,
8893 .tcf_chain = ingress_find_tcf,
94+ .tcf_cl_offload = ingress_cl_offload,
8995 .bind_tcf = ingress_bind_filter,
9096 .unbind_tcf = ingress_put,
9197 };
@@ -110,6 +116,11 @@ static unsigned long clsact_get(struct Qdisc *sch, u32 classid) · 18 unmodified lines
110116 }
111117 }
112118
119+static bool clsact_cl_offload(u32 classid)
120+{
121+ return TC_H_MIN(classid) == TC_H_MIN(TC_H_MIN_INGRESS);
122+}
123+
113124 static unsigned long clsact_bind_filter(struct Qdisc *sch,
114125 unsigned long parent, u32 classid)
115126 {
@@ -158,6 +169,7 @@ static const struct Qdisc_class_ops clsact_class_ops = { · 42 unmodified lines
158169 .put = ingress_put,
159170 .walk = ingress_walk,
160171 .tcf_chain = clsact_find_tcf,
172+ .tcf_cl_offload = clsact_cl_offload,
161173 .bind_tcf = clsact_bind_filter,
162174 .unbind_tcf = ingress_put,
163175 };
net/sched/sch_prio.c+4−0
@@ -85,6 +85,7 @@ prio_enqueue(struct sk_buff *skb, struct Qdisc *sch) · 84 unmodified lines
8585
8686 ret = qdisc_enqueue(skb, qdisc);
8787 if (ret == NET_XMIT_SUCCESS) {
88+ qdisc_qstats_backlog_inc(sch, skb);
8889 sch->q.qlen++;
8990 return NET_XMIT_SUCCESS;
9091 }
@@ -117,6 +118,7 @@ static struct sk_buff *prio_dequeue(struct Qdisc *sch) · 26 unmodified lines
117118 struct sk_buff *skb = qdisc_dequeue_peeked(qdisc);
118119 if (skb) {
119120 qdisc_bstats_update(sch, skb);
121+ qdisc_qstats_backlog_dec(sch, skb);
120122 sch->q.qlen--;
121123 return skb;
122124 }
@@ -135,6 +137,7 @@ static unsigned int prio_drop(struct Qdisc *sch) · 12 unmodified lines
135137 for (prio = q->bands-1; prio >= 0; prio--) {
136138 qdisc = q->queues[prio];
137139 if (qdisc->ops->drop && (len = qdisc->ops->drop(qdisc)) != 0) {
140+ sch->qstats.backlog -= len;
138141 sch->q.qlen--;
139142 return len;
140143 }
@@ -151,6 +154,7 @@ prio_reset(struct Qdisc *sch) · 10 unmodified lines
151154
152155 for (prio = 0; prio < q->bands; prio++)
153156 qdisc_reset(q->queues[prio]);
157+ sch->qstats.backlog = 0;
154158 sch->q.qlen = 0;
155159 }
156160
net/sched/sch_qfq.c+4−2
@@ -1235,8 +1235,10 @@ static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch) · 1234 unmodified lines
12351235 cl->agg->lmax, qdisc_pkt_len(skb), cl->common.classid);
12361236 err = qfq_change_agg(sch, cl, cl->agg->class_weight,
12371237 qdisc_pkt_len(skb));
1238− if (err)
1239− return err;
1238+ if (err) {
1239+ cl->qstats.drops++;
1240+ return qdisc_drop(skb, sch);
1241+ }
12401242 }
12411243
12421244 err = qdisc_enqueue(skb, cl->qdisc);
net/sched/sch_red.c+4−0
@@ -97,6 +97,7 @@ static int red_enqueue(struct sk_buff *skb, struct Qdisc *sch) · 96 unmodified lines
9797
9898 ret = qdisc_enqueue(skb, child);
9999 if (likely(ret == NET_XMIT_SUCCESS)) {
100+ qdisc_qstats_backlog_inc(sch, skb);
100101 sch->q.qlen++;
101102 } else if (net_xmit_drop_count(ret)) {
102103 q->stats.pdrop++;
@@ -118,6 +119,7 @@ static struct sk_buff *red_dequeue(struct Qdisc *sch) · 15 unmodified lines
118119 skb = child->dequeue(child);
119120 if (skb) {
120121 qdisc_bstats_update(sch, skb);
122+ qdisc_qstats_backlog_dec(sch, skb);
121123 sch->q.qlen--;
122124 } else {
123125 if (!red_is_idling(&q->vars))
@@ -143,6 +145,7 @@ static unsigned int red_drop(struct Qdisc *sch) · 19 unmodified lines
143145 if (child->ops->drop && (len = child->ops->drop(child)) > 0) {
144146 q->stats.other++;
145147 qdisc_qstats_drop(sch);
148+ sch->qstats.backlog -= len;
146149 sch->q.qlen--;
147150 return len;
148151 }
@@ -158,6 +161,7 @@ static void red_reset(struct Qdisc *sch) · 9 unmodified lines
158161 struct red_sched_data *q = qdisc_priv(sch);
159162
160163 qdisc_reset(q->qdisc);
164+ sch->qstats.backlog = 0;
161165 sch->q.qlen = 0;
162166 red_restart(&q->vars);
163167 }
net/sched/sch_tbf.c+4−0
@@ -207,6 +207,7 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc *sch) · 206 unmodified lines
207207 return ret;
208208 }
209209
210+ qdisc_qstats_backlog_inc(sch, skb);
210211 sch->q.qlen++;
211212 return NET_XMIT_SUCCESS;
212213 }
@@ -217,6 +218,7 @@ static unsigned int tbf_drop(struct Qdisc *sch) · 4 unmodified lines
217218 unsigned int len = 0;
218219
219220 if (q->qdisc->ops->drop && (len = q->qdisc->ops->drop(q->qdisc)) != 0) {
221+ sch->qstats.backlog -= len;
220222 sch->q.qlen--;
221223 qdisc_qstats_drop(sch);
222224 }
@@ -263,6 +265,7 @@ static struct sk_buff *tbf_dequeue(struct Qdisc *sch) · 40 unmodified lines
263265 q->t_c = now;
264266 q->tokens = toks;
265267 q->ptokens = ptoks;
268+ qdisc_qstats_backlog_dec(sch, skb);
266269 sch->q.qlen--;
267270 qdisc_unthrottled(sch);
268271 qdisc_bstats_update(sch, skb);
@@ -294,6 +297,7 @@ static void tbf_reset(struct Qdisc *sch) · 25 unmodified lines
294297 struct tbf_sched_data *q = qdisc_priv(sch);
295298
296299 qdisc_reset(q->qdisc);
300+ sch->qstats.backlog = 0;
297301 sch->q.qlen = 0;
298302 q->t_c = ktime_get_ns();
299303 q->tokens = q->buffer;
net/sunrpc/clnt.c+25−6
@@ -446,16 +446,27 @@ out_no_rpciod: · 445 unmodified lines
446446 return ERR_PTR(err);
447447 }
448448
449−struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args,
449+static struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args,
450450 struct rpc_xprt *xprt)
451451 {
452452 struct rpc_clnt *clnt = NULL;
453453 struct rpc_xprt_switch *xps;
454454
455− xps = xprt_switch_alloc(xprt, GFP_KERNEL);
456− if (xps == NULL)
457− return ERR_PTR(-ENOMEM);
458−
455+ if (args->bc_xprt && args->bc_xprt->xpt_bc_xps) {
456+ WARN_ON(args->protocol != XPRT_TRANSPORT_BC_TCP);
457+ xps = args->bc_xprt->xpt_bc_xps;
458+ xprt_switch_get(xps);
459+ } else {
460+ xps = xprt_switch_alloc(xprt, GFP_KERNEL);
461+ if (xps == NULL) {
462+ xprt_put(xprt);
463+ return ERR_PTR(-ENOMEM);
464+ }
465+ if (xprt->bc_xprt) {
466+ xprt_switch_get(xps);
467+ xprt->bc_xprt->xpt_bc_xps = xps;
468+ }
469+ }
459470 clnt = rpc_new_client(args, xps, xprt, NULL);
460471 if (IS_ERR(clnt))
461472 return clnt;
@@ -483,7 +494,6 @@ struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args, · 21 unmodified lines
483494
484495 return clnt;
485496 }
486−EXPORT_SYMBOL_GPL(rpc_create_xprt);
487497
488498 /**
489499 * rpc_create - create an RPC client and transport with one call
@@ -509,6 +519,15 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) · 19 unmodified lines
509519 };
510520 char servername[48];
511521
522+ if (args->bc_xprt) {
523+ WARN_ON(args->protocol != XPRT_TRANSPORT_BC_TCP);
524+ xprt = args->bc_xprt->xpt_bc_xprt;
525+ if (xprt) {
526+ xprt_get(xprt);
527+ return rpc_create_xprt(args, xprt);
528+ }
529+ }
530+
512531 if (args->flags & RPC_CLNT_CREATE_INFINITE_SLOTS)
513532 xprtargs.flags |= XPRT_CREATE_INFINITE_SLOTS;
514533 if (args->flags & RPC_CLNT_CREATE_NO_IDLE_TIMEOUT)
net/sunrpc/svc_xprt.c+2−0
@@ -136,6 +136,8 @@ static void svc_xprt_free(struct kref *kref) · 135 unmodified lines
136136 /* See comment on corresponding get in xs_setup_bc_tcp(): */
137137 if (xprt->xpt_bc_xprt)
138138 xprt_put(xprt->xpt_bc_xprt);
139+ if (xprt->xpt_bc_xps)
140+ xprt_switch_put(xprt->xpt_bc_xps);
139141 xprt->xpt_ops->xpo_free(xprt);
140142 module_put(owner);
141143 }
net/sunrpc/xprtsock.c+1−0
@@ -3057,6 +3057,7 @@ static struct rpc_xprt *xs_setup_bc_tcp(struct xprt_create *args) · 3056 unmodified lines
30573057 return xprt;
30583058
30593059 args->bc_xprt->xpt_bc_xprt = NULL;
3060+ args->bc_xprt->xpt_bc_xps = NULL;
30603061 xprt_put(xprt);
30613062 ret = ERR_PTR(-EINVAL);
30623063 out_err:
net/tipc/netlink_compat.c+2−1
@@ -604,7 +604,8 @@ static int tipc_nl_compat_link_dump(struct tipc_nl_compat_msg *msg, · 603 unmodified lines
604604
605605 link_info.dest = nla_get_flag(link[TIPC_NLA_LINK_DEST]);
606606 link_info.up = htonl(nla_get_flag(link[TIPC_NLA_LINK_UP]));
607− strcpy(link_info.str, nla_data(link[TIPC_NLA_LINK_NAME]));
607+ nla_strlcpy(link_info.str, nla_data(link[TIPC_NLA_LINK_NAME]),
608+ TIPC_MAX_LINK_NAME);
608609
609610 return tipc_add_tlv(msg->rep, TIPC_TLV_LINK_INFO,
610611 &link_info, sizeof(link_info));
net/unix/af_unix.c+3−3
@@ -315,7 +315,7 @@ static struct sock *unix_find_socket_byinode(struct inode *i) · 314 unmodified lines
315315 &unix_socket_table[i->i_ino & (UNIX_HASH_SIZE - 1)]) {
316316 struct dentry *dentry = unix_sk(s)->path.dentry;
317317
318− if (dentry && d_backing_inode(dentry) == i) {
318+ if (dentry && d_real_inode(dentry) == i) {
319319 sock_hold(s);
320320 goto found;
321321 }
@@ -911,7 +911,7 @@ static struct sock *unix_find_other(struct net *net, · 589 unmodified lines
911911 err = kern_path(sunname->sun_path, LOOKUP_FOLLOW, &path);
912912 if (err)
913913 goto fail;
914− inode = d_backing_inode(path.dentry);
914+ inode = d_real_inode(path.dentry);
915915 err = inode_permission(inode, MAY_WRITE);
916916 if (err)
917917 goto put_fail;
@@ -1048,7 +1048,7 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) · 130 unmodified lines
10481048 goto out_up;
10491049 }
10501050 addr->hash = UNIX_HASH_SIZE;
1051− hash = d_backing_inode(dentry)->i_ino & (UNIX_HASH_SIZE - 1);
1051+ hash = d_real_inode(dentry)->i_ino & (UNIX_HASH_SIZE - 1);
10521052 spin_lock(&unix_table_lock);
10531053 u->path = u_path;
10541054 list = &unix_socket_table[hash];
net/wireless/core.c+0−2
@@ -363,8 +363,6 @@ struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv, · 362 unmodified lines
363363 WARN_ON(ops->remain_on_channel && !ops->cancel_remain_on_channel);
364364 WARN_ON(ops->tdls_channel_switch && !ops->tdls_cancel_channel_switch);
365365 WARN_ON(ops->add_tx_ts && !ops->del_tx_ts);
366− WARN_ON(ops->set_tx_power && !ops->get_tx_power);
367− WARN_ON(ops->set_antenna && !ops->get_antenna);
368366
369367 alloc_size = sizeof(*rdev) + sizeof_priv;
370368
net/wireless/wext-core.c+23−2
@@ -958,8 +958,29 @@ static int wireless_process_ioctl(struct net *net, struct ifreq *ifr, · 957 unmodified lines
958958 return private(dev, iwr, cmd, info, handler);
959959 }
960960 /* Old driver API : call driver ioctl handler */
961− if (dev->netdev_ops->ndo_do_ioctl)
962− return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd);
961+ if (dev->netdev_ops->ndo_do_ioctl) {
962+#ifdef CONFIG_COMPAT
963+ if (info->flags & IW_REQUEST_FLAG_COMPAT) {
964+ int ret = 0;
965+ struct iwreq iwr_lcl;
966+ struct compat_iw_point *iwp_compat = (void *) &iwr->u.data;
967+
968+ memcpy(&iwr_lcl, iwr, sizeof(struct iwreq));
969+ iwr_lcl.u.data.pointer = compat_ptr(iwp_compat->pointer);
970+ iwr_lcl.u.data.length = iwp_compat->length;
971+ iwr_lcl.u.data.flags = iwp_compat->flags;
972+
973+ ret = dev->netdev_ops->ndo_do_ioctl(dev, (void *) &iwr_lcl, cmd);
974+
975+ iwp_compat->pointer = ptr_to_compat(iwr_lcl.u.data.pointer);
976+ iwp_compat->length = iwr_lcl.u.data.length;
977+ iwp_compat->flags = iwr_lcl.u.data.flags;
978+
979+ return ret;
980+ } else
981+#endif
982+ return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd);
983+ }
963984 return -EOPNOTSUPP;
964985 }
965986
scripts/mod/file2alias.c+1−1
@@ -384,7 +384,7 @@ static void do_of_entry_multi(void *symval, struct module *mod) · 383 unmodified lines
384384 len = sprintf(alias, "of:N%sT%s", (*name)[0] ? *name : "*",
385385 (*type)[0] ? *type : "*");
386386
387− if (compatible[0])
387+ if ((*compatible)[0])
388388 sprintf(&alias[len], "%sC%s", (*type)[0] ? "*" : "",
389389 *compatible);
390390
security/keys/key.c+1−1
@@ -597,7 +597,7 @@ int key_reject_and_link(struct key *key, · 596 unmodified lines
597597
598598 mutex_unlock(&key_construction_mutex);
599599
600− if (keyring)
600+ if (keyring && link_ret == 0)
601601 __key_link_end(keyring, &key->index_key, edit);
602602
603603 /* wake up anyone waiting for a key to be constructed */
sound/pci/hda/hda_intel.c+10−1
@@ -365,8 +365,11 @@ enum { · 364 unmodified lines
365365
366366 #define IS_SKL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa170)
367367 #define IS_SKL_LP(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9d70)
368+#define IS_KBL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa171)
369+#define IS_KBL_LP(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9d71)
368370 #define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98)
369−#define IS_SKL_PLUS(pci) (IS_SKL(pci) || IS_SKL_LP(pci) || IS_BXT(pci))
371+#define IS_SKL_PLUS(pci) (IS_SKL(pci) || IS_SKL_LP(pci) || IS_BXT(pci)) || \
372+ IS_KBL(pci) || IS_KBL_LP(pci)
370373
371374 static char *driver_short_names[] = {
372375 [AZX_DRIVER_ICH] = "HDA Intel",
@@ -2181,6 +2184,12 @@ static const struct pci_device_id azx_ids[] = { · 1808 unmodified lines
21812184 /* Sunrise Point-LP */
21822185 { PCI_DEVICE(0x8086, 0x9d70),
21832186 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_SKYLAKE },
2187+ /* Kabylake */
2188+ { PCI_DEVICE(0x8086, 0xa171),
2189+ .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_SKYLAKE },
2190+ /* Kabylake-LP */
2191+ { PCI_DEVICE(0x8086, 0x9d71),
2192+ .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_SKYLAKE },
21842193 /* Broxton-P(Apollolake) */
21852194 { PCI_DEVICE(0x8086, 0x5a98),
21862195 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_BROXTON },
sound/pci/hda/patch_realtek.c+68−5
@@ -346,6 +346,9 @@ static void alc_fill_eapd_coef(struct hda_codec *codec) · 345 unmodified lines
346346 case 0x10ec0234:
347347 case 0x10ec0274:
348348 case 0x10ec0294:
349+ case 0x10ec0700:
350+ case 0x10ec0701:
351+ case 0x10ec0703:
349352 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
350353 break;
351354 case 0x10ec0662:
@@ -2655,6 +2658,7 @@ enum { · 2303 unmodified lines
26552658 ALC269_TYPE_ALC256,
26562659 ALC269_TYPE_ALC225,
26572660 ALC269_TYPE_ALC294,
2661+ ALC269_TYPE_ALC700,
26582662 };
26592663
26602664 /*
@@ -2686,6 +2690,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec) · 25 unmodified lines
26862690 case ALC269_TYPE_ALC256:
26872691 case ALC269_TYPE_ALC225:
26882692 case ALC269_TYPE_ALC294:
2693+ case ALC269_TYPE_ALC700:
26892694 ssids = alc269_ssids;
26902695 break;
26912696 default:
@@ -3618,13 +3623,20 @@ static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, · 926 unmodified lines
36183623 static void alc_headset_mode_unplugged(struct hda_codec *codec)
36193624 {
36203625 static struct coef_fw coef0255[] = {
3621− WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
36223626 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
36233627 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
36243628 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
36253629 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
36263630 {}
36273631 };
3632+ static struct coef_fw coef0255_1[] = {
3633+ WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
3634+ {}
3635+ };
3636+ static struct coef_fw coef0256[] = {
3637+ WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
3638+ {}
3639+ };
36283640 static struct coef_fw coef0233[] = {
36293641 WRITE_COEF(0x1b, 0x0c0b),
36303642 WRITE_COEF(0x45, 0xc429),
@@ -3677,7 +3689,11 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec) · 46 unmodified lines
36773689
36783690 switch (codec->core.vendor_id) {
36793691 case 0x10ec0255:
3692+ alc_process_coef_fw(codec, coef0255_1);
3693+ alc_process_coef_fw(codec, coef0255);
3694+ break;
36803695 case 0x10ec0256:
3696+ alc_process_coef_fw(codec, coef0256);
36813697 alc_process_coef_fw(codec, coef0255);
36823698 break;
36833699 case 0x10ec0233:
@@ -3896,6 +3912,12 @@ static void alc_headset_mode_ctia(struct hda_codec *codec) · 212 unmodified lines
38963912 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
38973913 {}
38983914 };
3915+ static struct coef_fw coef0256[] = {
3916+ WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
3917+ WRITE_COEF(0x1b, 0x0c6b),
3918+ WRITE_COEFEX(0x57, 0x03, 0x8ea6),
3919+ {}
3920+ };
38993921 static struct coef_fw coef0233[] = {
39003922 WRITE_COEF(0x45, 0xd429),
39013923 WRITE_COEF(0x1b, 0x0c2b),
@@ -3936,9 +3958,11 @@ static void alc_headset_mode_ctia(struct hda_codec *codec) · 34 unmodified lines
39363958
39373959 switch (codec->core.vendor_id) {
39383960 case 0x10ec0255:
3939− case 0x10ec0256:
39403961 alc_process_coef_fw(codec, coef0255);
39413962 break;
3963+ case 0x10ec0256:
3964+ alc_process_coef_fw(codec, coef0256);
3965+ break;
39423966 case 0x10ec0233:
39433967 case 0x10ec0283:
39443968 alc_process_coef_fw(codec, coef0233);
@@ -3978,6 +4002,12 @@ static void alc_headset_mode_omtp(struct hda_codec *codec) · 33 unmodified lines
39784002 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
39794003 {}
39804004 };
4005+ static struct coef_fw coef0256[] = {
4006+ WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4007+ WRITE_COEF(0x1b, 0x0c6b),
4008+ WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4009+ {}
4010+ };
39814011 static struct coef_fw coef0233[] = {
39824012 WRITE_COEF(0x45, 0xe429),
39834013 WRITE_COEF(0x1b, 0x0c2b),
@@ -4018,9 +4048,11 @@ static void alc_headset_mode_omtp(struct hda_codec *codec) · 34 unmodified lines
40184048
40194049 switch (codec->core.vendor_id) {
40204050 case 0x10ec0255:
4021− case 0x10ec0256:
40224051 alc_process_coef_fw(codec, coef0255);
40234052 break;
4053+ case 0x10ec0256:
4054+ alc_process_coef_fw(codec, coef0256);
4055+ break;
40244056 case 0x10ec0233:
40254057 case 0x10ec0283:
40264058 alc_process_coef_fw(codec, coef0233);
@@ -4266,7 +4298,7 @@ static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec, · 239 unmodified lines
42664298 static void alc255_set_default_jack_type(struct hda_codec *codec)
42674299 {
42684300 /* Set to iphone type */
4269− static struct coef_fw fw[] = {
4301+ static struct coef_fw alc255fw[] = {
42704302 WRITE_COEF(0x1b, 0x880b),
42714303 WRITE_COEF(0x45, 0xd089),
42724304 WRITE_COEF(0x1b, 0x080b),
@@ -4274,7 +4306,22 @@ static void alc255_set_default_jack_type(struct hda_codec *codec) · 1 unmodified line
42744306 WRITE_COEF(0x1b, 0x0c0b),
42754307 {}
42764308 };
4277− alc_process_coef_fw(codec, fw);
4309+ static struct coef_fw alc256fw[] = {
4310+ WRITE_COEF(0x1b, 0x884b),
4311+ WRITE_COEF(0x45, 0xd089),
4312+ WRITE_COEF(0x1b, 0x084b),
4313+ WRITE_COEF(0x46, 0x0004),
4314+ WRITE_COEF(0x1b, 0x0c4b),
4315+ {}
4316+ };
4317+ switch (codec->core.vendor_id) {
4318+ case 0x10ec0255:
4319+ alc_process_coef_fw(codec, alc255fw);
4320+ break;
4321+ case 0x10ec0256:
4322+ alc_process_coef_fw(codec, alc256fw);
4323+ break;
4324+ }
42784325 msleep(30);
42794326 }
42804327
@@ -5587,6 +5634,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 1306 unmodified lines
55875634 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
55885635 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
55895636 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
5637+ SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
55905638 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
55915639 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
55925640 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
@@ -5775,6 +5823,10 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { · 182 unmodified lines
57755823 {0x12, 0x90a60180},
57765824 {0x14, 0x90170130},
57775825 {0x21, 0x02211040}),
5826+ SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5827+ {0x12, 0x90a60180},
5828+ {0x14, 0x90170120},
5829+ {0x21, 0x02211030}),
57785830 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
57795831 {0x12, 0x90a60160},
57805832 {0x14, 0x90170120},
@@ -6053,6 +6105,14 @@ static int patch_alc269(struct hda_codec *codec) · 272 unmodified lines
60536105 case 0x10ec0294:
60546106 spec->codec_variant = ALC269_TYPE_ALC294;
60556107 break;
6108+ case 0x10ec0700:
6109+ case 0x10ec0701:
6110+ case 0x10ec0703:
6111+ spec->codec_variant = ALC269_TYPE_ALC700;
6112+ spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
6113+ alc_update_coef_idx(codec, 0x4a, 0, 1 << 15); /* Combo jack auto trigger control */
6114+ break;
6115+
60566116 }
60576117
60586118 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
@@ -7008,6 +7068,9 @@ static const struct hda_device_id snd_hda_id_realtek[] = { · 949 unmodified lines
70087068 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
70097069 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
70107070 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
7071+ HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
7072+ HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
7073+ HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
70117074 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc882),
70127075 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
70137076 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
tools/perf/util/data-convert-bt.c+39−2
@@ -204,6 +204,44 @@ static unsigned long long adjust_signedness(unsigned long long value_int, int si · 203 unmodified lines
204204 return (value_int & value_mask) | ~value_mask;
205205 }
206206
207+static int string_set_value(struct bt_ctf_field *field, const char *string)
208+{
209+ char *buffer = NULL;
210+ size_t len = strlen(string), i, p;
211+ int err;
212+
213+ for (i = p = 0; i < len; i++, p++) {
214+ if (isprint(string[i])) {
215+ if (!buffer)
216+ continue;
217+ buffer[p] = string[i];
218+ } else {
219+ char numstr[5];
220+
221+ snprintf(numstr, sizeof(numstr), "\\x%02x",
222+ (unsigned int)(string[i]) & 0xff);
223+
224+ if (!buffer) {
225+ buffer = zalloc(i + (len - i) * 4 + 2);
226+ if (!buffer) {
227+ pr_err("failed to set unprintable string '%s'\n", string);
228+ return bt_ctf_field_string_set_value(field, "UNPRINTABLE-STRING");
229+ }
230+ if (i > 0)
231+ strncpy(buffer, string, i);
232+ }
233+ strncat(buffer + p, numstr, 4);
234+ p += 3;
235+ }
236+ }
237+
238+ if (!buffer)
239+ return bt_ctf_field_string_set_value(field, string);
240+ err = bt_ctf_field_string_set_value(field, buffer);
241+ free(buffer);
242+ return err;
243+}
244+
207245 static int add_tracepoint_field_value(struct ctf_writer *cw,
208246 struct bt_ctf_event_class *event_class,
209247 struct bt_ctf_event *event,
@@ -270,8 +308,7 @@ static int add_tracepoint_field_value(struct ctf_writer *cw, · 60 unmodified lines
270308 }
271309
272310 if (flags & FIELD_IS_STRING)
273− ret = bt_ctf_field_string_set_value(field,
274− data + offset + i * len);
311+ ret = string_set_value(field, data + offset + i * len);
275312 else {
276313 unsigned long long value_int;
277314
tools/perf/util/event.c+2−0
@@ -673,6 +673,8 @@ int perf_event__synthesize_kernel_mmap(struct perf_tool *tool, · 672 unmodified lines
673673 int err;
674674 union perf_event *event;
675675
676+ if (symbol_conf.kptr_restrict)
677+ return -1;
676678 if (map == NULL)
677679 return -1;
678680
tools/perf/util/symbol.c+8−8
@@ -1933,17 +1933,17 @@ int setup_intlist(struct intlist **list, const char *list_str, · 1932 unmodified lines
19331933 static bool symbol__read_kptr_restrict(void)
19341934 {
19351935 bool value = false;
1936+ FILE *fp = fopen("/proc/sys/kernel/kptr_restrict", "r");
19361937
1937− if (geteuid() != 0) {
1938− FILE *fp = fopen("/proc/sys/kernel/kptr_restrict", "r");
1939− if (fp != NULL) {
1940− char line[8];
1938+ if (fp != NULL) {
1939+ char line[8];
19411940
1942− if (fgets(line, sizeof(line), fp) != NULL)
1943− value = atoi(line) != 0;
1941+ if (fgets(line, sizeof(line), fp) != NULL)
1942+ value = (geteuid() != 0) ?
1943+ (atoi(line) != 0) :
1944+ (atoi(line) == 2);
19441945
1945− fclose(fp);
1946− }
1946+ fclose(fp);
19471947 }
19481948
19491949 return value;
tools/testing/selftests/net/reuseport_bpf.c+5−5
@@ -111,9 +111,9 @@ static void attach_ebpf(int fd, uint16_t mod) · 110 unmodified lines
111111 memset(&attr, 0, sizeof(attr));
112112 attr.prog_type = BPF_PROG_TYPE_SOCKET_FILTER;
113113 attr.insn_cnt = ARRAY_SIZE(prog);
114− attr.insns = (uint64_t)prog;
115− attr.license = (uint64_t)bpf_license;
116− attr.log_buf = (uint64_t)bpf_log_buf;
114+ attr.insns = (unsigned long) &prog;
115+ attr.license = (unsigned long) &bpf_license;
116+ attr.log_buf = (unsigned long) &bpf_log_buf;
117117 attr.log_size = sizeof(bpf_log_buf);
118118 attr.log_level = 1;
119119 attr.kern_version = 0;
@@ -351,8 +351,8 @@ static void test_filter_no_reuseport(const struct test_params p) · 231 unmodified lines
351351 memset(&eprog, 0, sizeof(eprog));
352352 eprog.prog_type = BPF_PROG_TYPE_SOCKET_FILTER;
353353 eprog.insn_cnt = ARRAY_SIZE(ecode);
354− eprog.insns = (uint64_t)ecode;
355− eprog.license = (uint64_t)bpf_license;
354+ eprog.insns = (unsigned long) &ecode;
355+ eprog.license = (unsigned long) &bpf_license;
356356 eprog.kern_version = 0;
357357
358358 memset(&cprog, 0, sizeof(cprog));
tools/virtio/ringtest/Makefile+3−1
@@ -1,6 +1,6 @@
11 all:
22
3−all: ring virtio_ring_0_9 virtio_ring_poll virtio_ring_inorder
3+all: ring virtio_ring_0_9 virtio_ring_poll virtio_ring_inorder noring
44
55 CFLAGS += -Wall
66 CFLAGS += -pthread -O2 -ggdb
@@ -15,11 +15,13 @@ ring: ring.o main.o · 8 unmodified lines
1515 virtio_ring_0_9: virtio_ring_0_9.o main.o
1616 virtio_ring_poll: virtio_ring_poll.o main.o
1717 virtio_ring_inorder: virtio_ring_inorder.o main.o
18+noring: noring.o main.o
1819 clean:
1920 -rm main.o
2021 -rm ring.o ring
2122 -rm virtio_ring_0_9.o virtio_ring_0_9
2223 -rm virtio_ring_poll.o virtio_ring_poll
2324 -rm virtio_ring_inorder.o virtio_ring_inorder
25+ -rm noring.o noring
2426
2527 .PHONY: all clean
tools/virtio/ringtest/README+4−0
@@ -1,2 +1,6 @@
11 Partial implementation of various ring layouts, useful to tune virtio design.
22 Uses shared memory heavily.
3+
4+Typical use:
5+
6+# sh run-on-all.sh perf stat -r 10 --log-fd 1 -- ./ring
tools/virtio/ringtest/noring.c+69−0
@@ -0,0 +1,69 @@
1+#define _GNU_SOURCE
2+#include "main.h"
3+#include <assert.h>
4+
5+/* stub implementation: useful for measuring overhead */
6+void alloc_ring(void)
7+{
8+}
9+
10+/* guest side */
11+int add_inbuf(unsigned len, void *buf, void *datap)
12+{
13+ return 0;
14+}
15+
16+/*
17+ * skb_array API provides no way for producer to find out whether a given
18+ * buffer was consumed. Our tests merely require that a successful get_buf
19+ * implies that add_inbuf succeed in the past, and that add_inbuf will succeed,
20+ * fake it accordingly.
21+ */
22+void *get_buf(unsigned *lenp, void **bufp)
23+{
24+ return "Buffer";
25+}
26+
27+void poll_used(void)
28+{
29+}
30+
31+void disable_call()
32+{
33+ assert(0);
34+}
35+
36+bool enable_call()
37+{
38+ assert(0);
39+}
40+
41+void kick_available(void)
42+{
43+ assert(0);
44+}
45+
46+/* host side */
47+void disable_kick()
48+{
49+ assert(0);
50+}
51+
52+bool enable_kick()
53+{
54+ assert(0);
55+}
56+
57+void poll_avail(void)
58+{
59+}
60+
61+bool use_buf(unsigned *lenp, void **bufp)
62+{
63+ return true;
64+}
65+
66+void call_used(void)
67+{
68+ assert(0);
69+}
tools/virtio/ringtest/run-on-all.sh+2−2
@@ -3,10 +3,10 @@ · 2 unmodified lines
33 #use last CPU for host. Why not the first?
44 #many devices tend to use cpu0 by default so
55 #it tends to be busier
6−HOST_AFFINITY=$(cd /dev/cpu; ls|grep -v '[a-z]'|sort -n|tail -1)
6+HOST_AFFINITY=$(lscpu -p=cpu | tail -1)
77
88 #run command on all cpus
9−for cpu in $(cd /dev/cpu; ls|grep -v '[a-z]'|sort -n);
9+for cpu in $(seq 0 $HOST_AFFINITY)
1010 do
1111 #Don't run guest and host on same CPU
1212 #It actually works ok if using signalling
virt/kvm/kvm_main.c+1−1
@@ -2941,7 +2941,7 @@ static long kvm_vm_ioctl(struct file *filp, · 2940 unmodified lines
29412941 if (copy_from_user(&routing, argp, sizeof(routing)))
29422942 goto out;
29432943 r = -EINVAL;
2944− if (routing.nr >= KVM_MAX_IRQ_ROUTES)
2944+ if (routing.nr > KVM_MAX_IRQ_ROUTES)
29452945 goto out;
29462946 if (routing.flags)
29472947 goto out;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t